/*
 * Help panel and inline "?" popovers.
 *
 * Written as plain CSS against the brand custom properties in brand.css rather
 * than as Tailwind utilities: the app loads Tailwind 2 from a CDN, so there is
 * no build step that could generate anything not already in that bundle.
 */

/* ------------------------------------------------------------ the ? button */

.help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.help-trigger:hover,
.help-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.8);
  outline: none;
}

/* Inline anchors sit next to a field label, so they must not disturb it. */
.help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  margin-left: 0.3rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: var(--primary-blue, #5510f4);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  opacity: 0.75;
}

.help-dot:hover,
.help-dot:focus-visible {
  opacity: 1;
  outline: none;
}

/* A label or value that explains itself on hover, with no visible dot of its
   own: one dot per screen, not one per row of a grid. The dot beside the
   column header is the keyboard route to the same text. */
.help-hoverable {
  cursor: help;
}

/* -------------------------------------------------------------- the panel */

.help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 8, 62, 0.35);
  z-index: 1090;
}

.help-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(30rem, 100vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -8px 0 30px rgba(30, 8, 62, 0.25);
  z-index: 1100;
}

.help-panel[hidden] {
  display: none;
}

.help-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--primary-purple, #3c107b);
  color: #fff;
}

.help-panel__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.help-panel__close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.help-panel__search {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #e9e6f2;
}

.help-panel__input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #d6d0e6;
  border-radius: 0.4rem;
  font-size: 1rem;
}

.help-panel__input:focus {
  outline: none;
  border-color: var(--primary-blue, #5510f4);
  box-shadow: 0 0 0 3px rgba(85, 16, 244, 0.15);
}

.help-panel__results,
.help-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.5rem 1.25rem 1.5rem;
}

.help-panel__results[hidden],
.help-panel__body[hidden] {
  display: none;
}

/* ------------------------------------------------------------- result list */

.help-group {
  margin: 1rem 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a7192;
}

.help-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.help-item {
  display: block;
  width: 100%;
  padding: 0.6rem 0.5rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.help-item:hover,
.help-item:focus-visible {
  background: #f4f1fb;
  outline: none;
}

.help-item__title {
  display: inline;
  font-weight: 700;
  color: var(--dark-purple, #1e083e);
}

.help-item__summary {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #5f5876;
}

.help-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.help-badge--video {
  background: var(--teal, #36e7b0);
  color: #10352a;
}

.help-badge--soon {
  background: #ece8f7;
  color: #6b6486;
}

/* Who a topic is written for. Outlined, so they never read as the filled
   video/guide badges. Shown to admins only. */
.help-badge--aud {
  background: transparent;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0;
  border: 1px solid currentColor;
}

.help-badge--aud-employee {
  color: #2f7d5b;
}

.help-badge--aud-manager {
  color: #a35a12;
}

.help-badge--aud-admin {
  color: #5b3fa0;
}

.help-topic__audience {
  margin: 0 0 0.5rem;
}

.help-topic__audience .help-badge:first-child {
  margin-left: 0;
}

.help-empty {
  margin: 1rem 0;
  color: #5f5876;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ------------------------------------------------------------ topic bodies */

.help-back {
  margin-bottom: 0.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-blue, #5510f4);
  font-weight: 600;
  cursor: pointer;
}

.help-topic h1,
.help-topic h2,
.help-topic h3 {
  margin: 1.2rem 0 0.4rem;
  font-weight: 700;
  color: var(--dark-purple, #1e083e);
}

.help-topic h1 { font-size: 1.25rem; }
.help-topic h2 { font-size: 1.05rem; }
.help-topic h3 { font-size: 0.95rem; }

.help-topic p,
.help-topic li {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #33304a;
}

.help-topic p { margin: 0 0 0.8rem; }

.help-topic ul,
.help-topic ol {
  margin: 0 0 0.9rem 1.1rem;
  padding: 0;
}

.help-topic li { margin-bottom: 0.25rem; }

.help-topic a {
  color: var(--primary-blue, #5510f4);
  text-decoration: underline;
}

.help-topic code {
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
  background: #f1eef9;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

.help-topic video {
  width: 100%;
  border-radius: 0.5rem;
  background: #000;
  margin-bottom: 0.9rem;
}

.help-topic__meta {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  color: #7a7192;
}

.help-topic__related {
  margin-top: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid #e9e6f2;
}

/* ---------------------------------------------------------------- popover */

.help-popover {
  position: absolute;
  z-index: 1120;
  max-width: 20rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.45rem;
  background: var(--dark-purple, #1e083e);
  color: #fff;
  box-shadow: 0 10px 24px rgba(30, 8, 62, 0.3);
}

.help-popover p {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.help-popover__more {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--cyan, #38f5ff);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ------------------------------------------------------------ standalone */

/* The same topic rendered as its own page, for deep links and for anyone who
   would rather read it full width than in a panel. */
.help-page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

@media (max-width: 640px) {
  .help-panel {
    width: 100vw;
  }
}

/* ------------------------------------------------------------- guides */

.help-badge--guide {
  background: var(--primary-blue, #5510f4);
  color: #fff;
}

.help-guide__steps {
  padding-left: 1.2rem;
}

.help-guide__step {
  margin-bottom: 1rem;
}

.help-guide__title {
  margin: 0 0 0.3rem;
  font-weight: 700;
  color: var(--dark-purple, #1e083e);
}

.help-guide__note,
.playbook-step__note {
  margin: 0 0 0.4rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--teal, #36e7b0);
  background: #f4fbf8;
  font-size: 0.85rem;
}

.help-guide__start,
.playbook-go {
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 0.4rem;
  background: var(--primary-blue, #5510f4);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}

.playbook-go--done {
  background: #ece8f7;
  color: #4b4466;
}

.playbook-go--off {
  background: transparent;
  color: #7a7192;
  padding-left: 0;
  cursor: default;
}

/* The runner's dock. Not modal: it sits beside the real page so the user can
   keep working it. Below the help panel (1100) so opening help covers it. */
.playbook-dock {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1050;
  width: 22rem;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  border-radius: 0.6rem;
  background: #fff;
  box-shadow: 0 12px 32px rgba(30, 8, 62, 0.28);
  font-size: 0.88rem;
}

.playbook-dock__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem 0.6rem 0 0;
  background: var(--dark-purple, #1e083e);
  color: #fff;
}

.playbook-dock__label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan, #38f5ff);
}

.playbook-dock__title {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.25;
}

.playbook-dock__btn {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.playbook-dock__body {
  overflow-y: auto;
  padding: 0.6rem 0.8rem 0.8rem;
}

.playbook-dock--min .playbook-dock__body {
  display: none;
}

.playbook-dock__following,
.playbook-dock__foot {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: #7a7192;
}

.playbook-dock__warn,
.playbook-dock__info {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
}

.playbook-dock__warn {
  background: #fffbeb;
  color: #78350f;
}

.playbook-dock__info {
  background: #eef2ff;
  color: #312e81;
}

.playbook-dock__steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.playbook-step {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.15rem 0.3rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0edf7;
}

.playbook-step > :not(.playbook-step__tick) {
  grid-column: 2;
}

.playbook-step__title {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-weight: 600;
  color: var(--dark-purple, #1e083e);
  cursor: pointer;
}

.playbook-step--current .playbook-step__title {
  color: var(--primary-blue, #5510f4);
}

.playbook-step--done .playbook-step__title {
  color: #9a93b0;
  text-decoration: line-through;
}

.playbook-step__actions {
  margin: 0.2rem 0;
  padding: 0;
  list-style: none;
}

.playbook-step__actions li {
  margin: 0.2rem 0;
}

.playbook-step__how {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-blue, #5510f4);
  font-size: 0.8rem;
  cursor: pointer;
}

.playbook-step__body {
  margin-top: 0.3rem;
  font-size: 0.82rem;
}

.playbook-offer {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1050;
  max-width: 20rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.6rem;
  background: #fff;
  box-shadow: 0 12px 32px rgba(30, 8, 62, 0.28);
  font-size: 0.85rem;
}

.playbook-offer p {
  margin: 0 0 0.6rem;
}

.playbook-offer__no {
  border: 0;
  background: transparent;
  color: #7a7192;
  cursor: pointer;
}

/* The pulse that answers "where is it?". An outline, not a size change, so
   nothing on the page moves. */
.help-pulse {
  outline: 3px solid var(--teal, #36e7b0);
  outline-offset: 3px;
  border-radius: 0.3rem;
  animation: help-pulse 1.2s ease-out 3;
}

@keyframes help-pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 231, 176, 0.7); }
  100% { box-shadow: 0 0 0 14px rgba(54, 231, 176, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .help-pulse {
    animation: none;
  }
}

@media (max-width: 640px) {
  .playbook-dock,
  .playbook-offer {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }
}
