/* UI pass 2 (8 Nov 2026): the ONE component set every page uses – app, onboarding, client link, sign-in, marketing pages.
   Colours and sizes come from tokens.css. Rules (docs/design/00-petes-brain-design-system.md, UI pass 2 section):
   - Buttons: .btn (primary, ink), .btn.secondary (grey), .btn.destructive (red), .btn.accent (purple: ONLY "Sign and Send"
     and "Confirm Choices"). Disabled = grey fill, grey text. 48px tall, radius 24, 15px/600. Labels in Title Case.
   - Links: .link, purple 600, no underline, 44pt target.
   - Grouped lists (iOS inset): .group > .row (label left, .value right, .chev where a row opens something).
   - Cards white radius 20; grey insets; nothing below 12px. */
@import url("/static/tokens.css");

.pb, .pb * { box-sizing: border-box; }
.pb { font-family: var(--font); font-size: var(--body); line-height: var(--body-lh); color: var(--label); -webkit-font-smoothing: antialiased; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--btn-h); padding: 0 22px;
       border: 0; border-radius: var(--btn-r); background: var(--ink); color: var(--on-ink); font: var(--semibold) var(--btn-size)/1 var(--font);
       text-decoration: none; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; user-select: none;
       transition: background var(--t-fast) ease-out, opacity var(--t-fast) ease-out; }
.btn:hover { background: var(--ink-hover); text-decoration: none; }
.btn.secondary { background: var(--btn-2); color: var(--on-btn-2); }
.btn.secondary:hover { background: var(--fill-hover); }
.btn.destructive { background: var(--destructive); color: var(--on-destructive); }
.btn.accent { background: var(--accent-fill); color: var(--on-accent); }
.btn.accent:hover { background: var(--accent-pressed); }
.btn:disabled, .btn[aria-disabled="true"], .btn.off { background: var(--btn-off); color: var(--on-btn-off); cursor: default; }
.btn.wide { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.busy { pointer-events: none; }

/* ---------- links ---------- */
.link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--link); font-weight: var(--semibold);
        text-decoration: none; background: none; border: 0; padding: 0; font-family: inherit; font-size: inherit; cursor: pointer; }
.link:hover { text-decoration: none; opacity: .85; }
.link.center { display: flex; justify-content: center; margin: 0 auto; }
.link.red { color: var(--red-text); }

/* ---------- cards, insets ---------- */
.card20 { background: var(--surface); border: 1px solid var(--card-edge-2); border-radius: 20px; box-shadow: var(--card-shadow); }
.inset { background: var(--inset); border-radius: 12px; }

/* ---------- grouped lists ---------- */
.group-label { font-size: var(--caption1); font-weight: var(--semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--value); margin: 20px 16px 6px; }
.group { background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--card-edge-2); }
.group > .row, .group > a.row, .group > button.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px; width: 100%;
       background: none; border: 0; font: inherit; color: inherit; text-align: left; text-decoration: none; position: relative; }
.group > .row + .row::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; border-top: 1px solid var(--separator); }
.row .label { flex: 1; min-width: 0; }
.row .label small { display: block; font-size: var(--footnote); color: var(--value); }
.row .value { color: var(--value); text-align: right; }
.row .chev { color: var(--gray3); flex: none; }
.row .chev::after { content: "›"; font-size: 20px; line-height: 1; }
button.row, a.row { cursor: pointer; }

/* ---------- fields ---------- */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: var(--footnote); font-weight: var(--semibold); color: var(--label); margin: 0 0 6px; }
.field input, .field select, .field textarea, input.in, select.in, textarea.in {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--field-edge); border-radius: 10px; background: var(--surface);
  color: var(--label); font: var(--regular) var(--body)/1.3 var(--font); }
.field textarea, textarea.in { min-height: 88px; resize: vertical; }
.field .hint, .hint { display: block; font-size: var(--footnote); color: var(--value); margin-top: 6px; }
.field select:invalid, select.in:invalid { color: var(--on-btn-off); }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; background: var(--track); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 7px; min-height: 32px; padding: 0 14px; font: var(--medium) var(--footnote)/1 var(--font); color: var(--label); cursor: pointer; flex: 1; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--seg-on); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--seg-on-edge); font-weight: var(--semibold); color: var(--label); }
/* (live testing, 26 Nov 2026: the selected segment (AM/PM, How do you work?, Type/Draw/Upload) clearly lighter than its track in dark mode too) */

/* ---------- switch ---------- */
.switch { position: relative; width: 51px; height: 31px; flex: none; appearance: none; -webkit-appearance: none; border-radius: 16px; background: var(--track);
          cursor: pointer; transition: background var(--t) ease-out; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--on-accent); box-shadow: var(--shadow-2); transition: transform var(--t) ease-out; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- tick boxes and choice rows ---------- */
.tick { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 1.5px solid var(--tick-edge); background: var(--surface); display: inline-grid; place-items: center; color: var(--on-accent); }
.tick.on { background: var(--accent-fill); border-color: var(--accent-fill); }
.tick.on::after { content: "✓"; font-size: 14px; font-weight: 700; line-height: 1; }
.tick.round { border-radius: 50%; }
.tick.off { border-color: var(--tick-off); background: var(--surface); }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--card-edge-2); border-radius: 12px;
          background: var(--surface); font: inherit; color: inherit; text-align: left; cursor: pointer; margin: 0 0 8px; }
.choice[aria-checked="true"], .choice.on { border-color: var(--ink); }
.choice[aria-checked="true"] .tick, .choice.on .tick { background: var(--accent-fill); border-color: var(--accent-fill); }
.choice[aria-checked="true"] .tick::after, .choice.on .tick::after { content: "✓"; font-size: 14px; font-weight: 700; color: var(--on-accent); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 12px; background: var(--btn-2); color: var(--label); font-size: var(--caption1); font-weight: var(--semibold); }
.chip.green { background: var(--ok-bg); color: var(--green-text); }

/* ---------- the close (×) button: 44pt target, 8px in ---------- */
.x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--value); border-radius: 22px; }
.x::before { content: ""; width: 28px; height: 28px; border-radius: 14px; background: var(--btn-2); position: absolute; }
.x svg { position: relative; width: 12px; height: 12px; }

/* ---------- the status "!" and "✓" circles ---------- */
.badge { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 700; margin: 0 auto 16px; }
.badge.ok { background: var(--ok-bg); color: var(--green-text); }
.badge.bad { background: var(--bad-bg); color: var(--red-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-strong); }

/* ---------- the 95% window (every "Open") and the centred sheet ---------- */
.win-scrim, .sheet-scrim { position: fixed; inset: 0; background: var(--sheet-scrim); z-index: 1000; display: grid; place-items: center; }
.win-scrim[hidden], .sheet-scrim[hidden] { display: none; }   /* (bug 42, 9 Nov 2026: display:grid beat [hidden]: an empty sheet on load) */
.win { width: 95vw; height: 95vh; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-elevated); display: flex; flex-direction: column; overflow: hidden; }
.win > header { height: 52px; flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--separator); }
.win > header .title { font-weight: var(--semibold); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win > .body { flex: 1; min-height: 0; overflow: auto; }
.win > .body iframe { width: 100%; height: 100%; border: 0; display: block; }
.sheet { width: min(420px, calc(100vw - 32px)); background: var(--surface); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-elevated); text-align: center; }
.sheet h2 { font: var(--semibold) var(--title2)/1.3 var(--font); margin: 0 0 8px; }
.sheet p { margin: 0 0 16px; color: var(--value); }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }
