/* =============================================================================
   Refera — Onboard surface styles. Owned by the onboard surface agent.
   LAYOUT ONLY: reuse components from ../styles.css (the design-system API is
   documented at the top of that file). New shared components go in styles.css.

   Editorial Precision note: this surface is an explainer, not a data queue —
   but the a11y contract still holds. Every card FILL stays opaque
   (--surface/--paper) so the prose and the "hand it to your admin" snippets
   keep >= 4.5:1 (measured 16-18:1). Cards are flat at rest with the shared
   hover lift, plus a gentle staggered rise as the view mounts. No text ever
   rides on translucency.
   ========================================================================== */

/* ------------------------------------------------------------ section rhythm */
.ob-stack { gap: 28px; }

/* the section label gets a crisp teal accent bar — reads as "machined", ties the
   seven steps together without shouting. Global .section-label supplies the type. */
.ob-section > .section-label {
  position: relative; padding-left: 12px; margin-bottom: 12px;
}
.ob-section > .section-label::before {
  content: ''; position: absolute; left: 0; top: 1px; bottom: 1px;
  width: 3px; border-radius: var(--r-pill); background: var(--teal);
}

.ob-lead {
  font-size: 13.5px; line-height: 1.6; color: var(--ink2);
  max-width: 720px; margin: 0 0 16px;
}

/* -------------------------------------------------- staggered entrance (alive)
   Each block rises on mount with a small stagger, so the page assembles rather
   than snaps in. Opacity/transform only, GPU-cheap. Reduced-motion drops it to
   instant via the global rule (animation:none), leaving every block visible. */
@media (prefers-reduced-motion: no-preference) {
  .ob-head, .ob-stack > * { animation: onboard-rise var(--dur) var(--ease-out) both; }
  .ob-stack > *:nth-child(1) { animation-delay: 30ms; }
  .ob-stack > *:nth-child(2) { animation-delay: 60ms; }
  .ob-stack > *:nth-child(3) { animation-delay: 90ms; }
  .ob-stack > *:nth-child(4) { animation-delay: 120ms; }
  .ob-stack > *:nth-child(5) { animation-delay: 150ms; }
  .ob-stack > *:nth-child(6) { animation-delay: 180ms; }
  .ob-stack > *:nth-child(7) { animation-delay: 210ms; }
  .ob-stack > *:nth-child(8) { animation-delay: 240ms; }
}

@keyframes onboard-rise {
  from { transform: translateY(8px); }
}

/* -------------------------------------------------- the three mailbox path cards */
.ob-paths { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ob-path { display: flex; flex-direction: column; }
/* card hover physics come from the shared .card rule (flat at rest,
   2px lift + soft shadow on pointer hover) */
.ob-path-head { margin-bottom: 4px; row-gap: 4px; }
.ob-path-head .card-title { margin-bottom: 0; margin-right: 2px; }

/* the recommended path wears a fine teal cap inside its own radius — a second,
   quieter signal beyond the "Recommended" chip. Inset so there is no layout shift. */
.ob-path[data-testid="onboard-path-m365"] {
  box-shadow: inset 0 2.5px 0 var(--teal);
}
.ob-path[data-testid="onboard-path-m365"]:hover {
  box-shadow: inset 0 2.5px 0 var(--teal), var(--elev-lift);
}

/* ------------------------------------------------ numbered step lists — quiet, dense */
.ob-steps { margin: 4px 0 0; padding-left: 22px; font-size: 13px; }
.ob-steps li { margin: 8px 0; }
.ob-steps li::marker { color: var(--teal); font-weight: 600; font-variant-numeric: tabular-nums; }

/* plain-honesty asides */
.ob-note { font-size: 12px; color: var(--ink2); margin-top: 12px; }
.ob-note strong { color: var(--ink); font-weight: 600; }

/* -------------------------------------------------------- copyable snippet block
   'Hand this to your admin' content — must be crisp at rest in a 1/3-width card
   and at 390px. Opaque paper fill, ink-legible. The header reads as a labelled
   strip; the copy button preserves the exact text. */
.ob-snippet {
  margin: 14px 0 0; border: 1px solid var(--hair); border-radius: var(--r-input);
  background: var(--paper); overflow: hidden;
}
.ob-snippet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; border-bottom: 1px solid var(--hair);
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink3); background: var(--surface);
}
.ob-snippet-head .copy-btn { margin-left: 0; }
.ob-snippet-body {
  margin: 0; padding: 10px 12px; font-size: 11px; line-height: 1.6;
  color: var(--ink2);
  /* wrap, never clip */
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* -------------------------------------------------------- go-live gates checklist
   An empty (not-yet-ticked) amber box is the honest signal: nothing is done for
   you. Sits on the card's opaque surface. */
.ob-gates { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.ob-gate {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--hair);
}
.ob-gate:first-child { border-top: 0; }
.ob-gate-mark {
  flex: none; width: 13px; height: 13px; align-self: center;
  border: 1.5px solid var(--amber); border-radius: 4px; background: var(--amber-wash);
}

/* --------------------------------------------------- 'put Refera on your phone' card
   The one install call-to-action on the page: a teal left-rail marks it out (same
   language as a selected queue row) without any coloured fill behind the steps, so
   contrast is untouched. */
.card[data-testid="onboard-pwa-install"] {
  box-shadow: inset 3px 0 0 var(--teal);
}
.card[data-testid="onboard-pwa-install"]:hover {
  box-shadow: inset 3px 0 0 var(--teal), var(--elev-lift);
}

/* guide footnote */
.ob-guide-line { font-size: 12px; color: var(--ink2); }
.ob-guide-line a { overflow-wrap: anywhere; }

/* ------------------------------------------------ connected first-run setup */
.setup-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 20px;
}
.setup-head > div { min-width: 0; }
.setup-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.setup-main, .setup-aside { display: grid; gap: 14px; min-width: 0; }
.setup-progress {
  padding: 15px 17px; border: 1px solid var(--hair); border-radius: var(--r-card);
  background: var(--surface);
}
.setup-progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.setup-progress-copy strong { font-size: 14px; }
.setup-progress-copy span { color: var(--ink3); font-size: 12px; }
.setup-progress-track, .setup-meter { height: 7px; border-radius: var(--r-pill); background: var(--paper); overflow: hidden; }
.setup-progress-track span, .setup-meter span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width var(--dur) var(--ease-out); }
.setup-test-guide {
  padding: 15px 17px; border: 1px solid var(--hair); border-left: 3px solid var(--teal);
  border-radius: 8px; background: var(--surface);
}
.setup-test-guide .card-title { margin: 0; }
.setup-test-guide-copy { margin: 10px 0 0; color: var(--ink2); font-size: 12.5px; line-height: 1.5; }
.setup-test-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.setup-test-status { min-height: 1.4em; margin: 8px 0 0; color: var(--ink2); font-size: 12px; }
.setup-tasks { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.setup-task {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 82px; padding: 13px 14px; border: 1px solid var(--hair);
  border-radius: var(--r-card); background: var(--surface);
}
.setup-task.is-done { background: color-mix(in srgb, var(--teal-wash) 45%, var(--surface)); }
.setup-task-number {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  color: var(--ink3); background: var(--paper); border: 1px solid var(--hair); font: 600 12px/1 var(--mono);
}
.setup-task.is-done .setup-task-number { color: var(--teal); background: var(--teal-wash); border-color: var(--teal); }
.setup-task-copy { min-width: 0; }
.setup-task-copy label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.setup-task-copy label input { width: 16px; height: 16px; accent-color: var(--teal); flex: none; }
.setup-task-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ink); }
.setup-task-label .chip { flex: none; }
.setup-task-copy p { margin: 4px 0 0; color: var(--ink2); font-size: 12px; line-height: 1.45; }
.setup-allowance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.setup-allowance .section-label { margin-bottom: 5px; }
.setup-allowance .setup-meter { margin: 14px 0 11px; }
.setup-plain { margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--hair); color: var(--ink2); font-size: 12px; }
.setup-stage .row { margin-bottom: 10px; }
.setup-posture { margin: 12px 0 0; color: var(--ink3); font-size: 11px; }
.setup-loading, .setup-error { max-width: 600px; margin: 28px auto; }

/* Activation concierge: one decision surface, with implementation detail kept
   behind Connection settings instead of presented as customer homework. */
.setup-connected-flow {
  display: grid; gap: 16px; width: 100%; max-width: 1040px;
}
.setup-m365-callback {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 16px; border: 1px solid var(--hair); border-left: 3px solid var(--teal);
  border-radius: 8px; background: var(--surface);
}
.setup-m365-callback[role="alert"] { border-left-color: var(--amber); }
.setup-m365-callback > div:first-child { min-width: 0; }
.setup-m365-callback strong { font-size: 13px; }
.setup-m365-callback p {
  max-width: 760px; margin: 4px 0 0; color: var(--ink2); font-size: 12px; line-height: 1.5;
}
.setup-m365-callback .setup-actions { flex: none; margin-top: 0; }
.setup-concierge-grid {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .6fr);
  gap: 20px; align-items: start; max-width: 1040px;
}
.setup-concierge { padding: 24px; border-radius: 8px; }
.setup-choice-list, .setup-services {
  display: grid; gap: 9px; margin: 22px 0 0; padding: 0; border: 0;
}
.setup-choice-list legend, .setup-services legend {
  margin-bottom: 9px; color: var(--ink); font-size: 12px; font-weight: 650;
}
.setup-choice {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 11px;
  min-height: 64px; padding: 12px 14px; border: 1px solid var(--hair);
  border-radius: 8px; background: var(--surface); cursor: pointer;
}
.setup-choice:hover { border-color: color-mix(in srgb, var(--teal) 55%, var(--hair)); }
.setup-choice.is-selected { border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.setup-choice input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--teal); }
.setup-choice span { display: grid; gap: 2px; }
.setup-choice strong { font-size: 13.5px; }
.setup-choice small { color: var(--ink2); font-size: 12px; line-height: 1.4; }
.setup-access-note {
  margin-top: 14px; padding: 13px 14px; border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0; background: var(--teal-wash);
}
.setup-access-note strong { font-size: 12.5px; }
.setup-access-note p { margin: 6px 0 0; color: var(--ink2); font-size: 11.5px; line-height: 1.5; }
.setup-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.setup-fields label { display: grid; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 600; }
.setup-fields label small { color: var(--ink3); font-weight: 400; }
.setup-fields input {
  width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--hair);
  border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit;
}
.setup-service { display: flex; align-items: center; gap: 9px; min-height: 44px; font-size: 13px; }
.setup-service input { width: 18px; height: 18px; accent-color: var(--teal); }
.setup-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.setup-actions .btn { min-height: 44px; }
.setup-included { border-radius: 8px; }
.setup-included .card-title { margin-top: 14px; }
.setup-included ul { margin: 14px 0; padding-left: 18px; color: var(--ink2); font-size: 13px; }
.setup-included li { margin: 7px 0; }
.setup-progress-page { max-width: 760px; }
.setup-timeline { display: grid; gap: 0; list-style: none; margin: 24px 0 0; padding: 0; }
.setup-timeline li {
  position: relative; display: grid; gap: 2px; min-height: 68px;
  padding: 0 0 18px 42px; color: var(--ink3);
}
.setup-timeline li::before {
  content: ''; position: absolute; left: 4px; top: 3px; width: 22px; height: 22px;
  border: 1.5px solid var(--hair); border-radius: 50%; background: var(--surface);
}
.setup-timeline li:not(:last-child)::after {
  content: ''; position: absolute; left: 15px; top: 28px; bottom: 2px; width: 1px; background: var(--hair);
}
.setup-timeline li.is-done::before { border-color: var(--teal); background: var(--teal); box-shadow: inset 0 0 0 6px var(--surface); }
.setup-timeline li.is-current::before { border-color: var(--amber); background: var(--amber-wash); }
.setup-timeline strong { color: var(--ink); font-size: 13.5px; }
.setup-timeline span { font-size: 12px; }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 959px) {
  .ob-paths { grid-template-columns: minmax(0, 1fr); }
  .setup-layout { grid-template-columns: minmax(0, 1fr); }
  .setup-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-concierge-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 719px) {
  :root { --topbar-h: 52px; }
  .ob-stack { gap: 22px; }
  /* no hover on touch; keep the resting card flat-lift, drop the transform */
  .ob-path:hover { transform: none; }
  .setup-head { align-items: flex-start; flex-direction: column; }
  .setup-head .btn { width: 100%; }
  .setup-aside { grid-template-columns: minmax(0, 1fr); }
  .setup-task { grid-template-columns: 30px minmax(0, 1fr); }
  .setup-task > .btn { grid-column: 2; width: fit-content; }
  .setup-task-label { align-items: flex-start; flex-direction: column; gap: 5px; }
  .setup-progress-copy { align-items: flex-start; flex-direction: column; gap: 2px; }
  .setup-test-actions .btn { min-height: 44px; }
  .setup-fields { grid-template-columns: minmax(0, 1fr); }
  .setup-m365-callback { align-items: stretch; flex-direction: column; }
  .setup-m365-callback .setup-actions { width: 100%; }
  .setup-actions .btn { width: 100%; min-height: 44px; }
  .setup-head,
  .setup-test-guide,
  .setup-test-actions .btn,
  .setup-task,
  .setup-task > .btn {
    scroll-margin-top: calc(var(--safe-top) + var(--topbar-h) + 12px);
    scroll-margin-bottom: calc(var(--safe-bottom) + var(--tabbar-h) + var(--tabbar-gap) + 14px);
  }
}

.setup-route-guard {
  width: min(100%, 680px);
  margin: clamp(32px, 8vh, 88px) auto;
  padding: 0 20px;
  text-align: center;
}

.setup-route-guard .card-sub {
  max-width: 54ch;
  margin: 10px auto 22px;
}
