/* TBOD POC stylesheet — Afterward design system
 *
 * Token values, type system, spacing, radius, and component anatomy taken
 * from 06_product/ux/prototype-afterward-poc/styles.css per ADR 0005.
 *
 * Strict CSP: no @import, no inline styles, no remote fonts.
 * Fonts self-hosted in static/fonts/ (Inter + Source Serif 4, OFL).
 */

/* ---- Fonts (self-hosted, CSP-friendly) -------------------------------- */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/source-serif-4-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/source-serif-4-400-italic.woff2') format('woff2');
}

/* ---- Tokens ----------------------------------------------------------- */

:root {
    /* Cream surfaces — never pure white */
    --cream-50:  #FBF8F2;
    --cream-100: #F5EFE3;
    --cream-200: #ECE3D0;
    --cream-300: #DCD0B8;

    /* Warm slate text */
    --slate-900: #2A2F33;
    --slate-700: #4A5057;
    --slate-500: #6B7178;
    --slate-400: #8A9099;
    --slate-300: #B5BAC0;

    /* Sage — primary brand */
    --sage-50:  #EFF2EC;
    --sage-100: #DDE4D5;
    --sage-300: #A8B89A;
    --sage-500: #6F8A66;
    --sage-700: #4F6749;
    --sage-900: #2F4030;

    /* Sienna — rare emphasis only */
    --sienna-100: #F4DDCB;
    --sienna-500: #B85C32;
    --sienna-600: #9F4D27;
    --sienna-700: #7E3B1B;

    /* Borders & shadow */
    --border:        #E2D8C2;
    --border-strong: #C9BDA3;
    --shadow-sm: 0 1px 0 rgba(50, 40, 20, 0.04);
    --shadow-md: 0 1px 2px rgba(50, 40, 20, 0.05), 0 4px 12px rgba(50, 40, 20, 0.04);
    --shadow-lg: 0 4px 16px rgba(50, 40, 20, 0.06), 0 24px 48px rgba(50, 40, 20, 0.08);

    /* Type */
    --font-display: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Spacing scale (8px base) */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;
    --s-9: 96px;

    /* Radius */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 18px;
}

/* ---- Reset / base ----------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--cream-50);
    color: var(--slate-900);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

a { color: var(--sage-700); }
a:hover, a:focus { color: var(--sage-900); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--slate-900);
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
h1 { font-size: 44px; }
h2 { font-size: 32px; }
h3 { font-size: 24px; }
h4 { font-size: 20px; }
p { margin: 0; }

/* Older-adult focus ring — generous, intentional */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--sage-700);
    outline-offset: 2px;
}

/* Reduced-motion globally */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}

/* ---- Buttons ---------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    height: 48px;
    padding: 0 var(--s-5);
    border-radius: var(--r-md);
    font-size: 16px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--sage-700); color: var(--cream-50); }
.btn-primary:hover { background: var(--sage-900); color: var(--cream-50); }
.btn-secondary { background: var(--cream-100); color: var(--slate-900); border-color: var(--border); }
.btn-secondary:hover { background: var(--cream-200); color: var(--slate-900); }
.btn-ghost { background: transparent; color: var(--slate-700); }
.btn-ghost:hover { background: var(--cream-100); color: var(--slate-900); }
.btn-emphasis { background: var(--sienna-500); color: var(--cream-50); }
.btn-emphasis:hover { background: var(--sienna-600); color: var(--cream-50); }
.btn-danger { background: var(--sienna-500); color: var(--cream-50); }
.btn-danger:hover { background: var(--sienna-600); color: var(--cream-50); }
.btn-sm { height: 36px; padding: 0 var(--s-4); font-size: 14px; }
.btn-lg { height: 56px; padding: 0 var(--s-6); font-size: 17px; }
.btn-block { width: 100%; }

/* ---- Form fields (older-adult premium: 56px tall) -------------------- */

.field {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    margin-bottom: var(--s-5);
}
.field-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: var(--s-2);
}
.field-label .opt {
    font-weight: 400;
    font-size: 14px;
    color: var(--slate-500);
}
.field-help {
    font-size: 14px;
    color: var(--slate-500);
    line-height: 1.5;
}
.field-error {
    font-size: 14px;
    color: var(--sienna-700);
    line-height: 1.5;
}

input[type="email"],
input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
.input,
.select,
select {
    width: 100%;
    height: 56px;
    padding: 0 var(--s-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--cream-50);
    font-size: 16px;
    color: var(--slate-900);
}
textarea, .textarea {
    width: 100%;
    min-height: 96px;
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--cream-50);
    font-size: 16px;
    color: var(--slate-900);
    resize: vertical;
    line-height: 1.5;
}
input:focus, .input:focus, .select:focus, select:focus,
textarea:focus, .textarea:focus {
    border-color: var(--sage-700);
    background: #fff;
}

/* Visibility radio rows (per-item privacy control, ADR 0005 / poc-experience-spec §8.2) */
.visibility-row {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.visibility-option {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--cream-50);
    cursor: pointer;
    min-height: 56px;
}
.visibility-option:hover { background: var(--cream-100); }
.visibility-option input[type="radio"] {
    width: 18px; height: 18px;
    margin-top: 2px;
    accent-color: var(--sage-700);
}
.visibility-option input[type="radio"]:checked + .visibility-label {
    color: var(--sage-900);
}
.visibility-option:has(input:checked) {
    background: var(--sage-50);
    border-color: var(--sage-300);
}
.visibility-label { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.visibility-label-title { font-weight: 500; font-size: 16px; }
.visibility-label-help { font-size: 14px; color: var(--slate-500); }

/* ---- Cards ----------------------------------------------------------- */

.card {
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-5);
}

/* ---- App shell ------------------------------------------------------- */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cream-50);
}

.topbar {
    height: 72px;
    border-bottom: 1px solid var(--border);
    background: var(--cream-50);
    display: flex;
    align-items: center;
    padding: 0 var(--s-6);
    gap: var(--s-5);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: var(--s-2); }

.wordmark {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: -0.01em;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.wordmark:hover { color: var(--slate-900); }
.wordmark-mark {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--sage-300), var(--sage-700) 70%);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.wordmark-mark::after {
    content: '';
    position: absolute;
    inset: 55% 0 0 0;
    background: var(--cream-100);
    border-top: 1px solid var(--cream-200);
}
.wordmark-tag {
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--slate-400);
    margin-left: 6px;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--sage-100);
    color: var(--sage-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--sage-300);
    text-decoration: none;
}

.icon-btn {
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background: transparent;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-700);
    cursor: pointer;
    text-decoration: none;
}
.icon-btn:hover { background: var(--cream-100); border-color: var(--border); color: var(--slate-900); }

/* Main content area */
.main-area {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--s-7) var(--s-6) var(--s-9);
}
.main-area--narrow { max-width: 760px; }
.main-area--wide { max-width: 1200px; }

/* Trust strip footer */
.trust-strip {
    border-top: 1px solid var(--border);
    background: var(--cream-100);
    padding: var(--s-4) var(--s-6);
    display: flex;
    align-items: center;
    gap: var(--s-5);
    font-size: 13px;
    color: var(--slate-500);
    flex-wrap: wrap;
}
.trust-strip-left { display: flex; align-items: center; gap: var(--s-2); }
.trust-strip-spacer { flex: 1; }
.trust-strip a {
    color: var(--sage-700);
    text-decoration: underline dotted var(--sage-300);
    text-underline-offset: 4px;
}
.trust-strip-links { display: inline-flex; gap: var(--s-4); }

/* ---- Greeting strip + section kicker --------------------------------- */

.greeting {
    margin-bottom: var(--s-7);
}
.greeting h1 {
    font-size: 40px;
    margin-bottom: var(--s-2);
}
.greeting-sub {
    font-size: 17px;
    color: var(--slate-500);
    line-height: 1.55;
    max-width: 600px;
}

.kicker {
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--slate-500);
    margin-bottom: var(--s-3);
    font-weight: 500;
}

/* Inline "← Dashboard" / "← Section" link at the top of inner pages.
   Used by every bucket list page (contacts/inventory/vault/wishes) so
   users always have a way back. Matches the existing form-page back-link
   style established in contacts/contact_form.html. */
.back-link {
    margin-bottom: var(--s-4);
    font-size: 14px;
}
.back-link a {
    color: var(--slate-500);
    text-decoration: none;
    padding: 4px 0;
}
.back-link a:hover,
.back-link a:focus-visible {
    color: var(--slate-900);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ---- Bucket grid + cards (dashboard) --------------------------------- */

.bucket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--s-4);
    margin-bottom: var(--s-7);
}

.bucket-card {
    position: relative;
    min-height: 280px;
    text-decoration: none;
    color: inherit;
    /* Whole-tile hover: lift + shadow + stronger border, plus a subtle
       brighten on the fg gradient. The transition on transform/filter
       belongs on the outer <a> so the back/mid stacked-paper layers
       move with it (they're absolutely positioned children). */
    transition:
        transform 180ms ease-out,
        filter 180ms ease-out;
    cursor: pointer;
}
.bucket-card:hover,
.bucket-card:focus-visible {
    transform: translateY(-3px);
    filter: drop-shadow(0 8px 14px rgba(60, 75, 50, 0.12));
}
.bucket-card:hover .bucket-card-fg,
.bucket-card:focus-visible .bucket-card-fg {
    border-color: var(--sage-500);
    background: linear-gradient(165deg, #D5DECB 0%, #EAF0E1 60%);
}
.bucket-card:focus-visible {
    outline: 2px solid var(--sage-700);
    outline-offset: 4px;
    border-radius: var(--r-lg);
}
@media (prefers-reduced-motion: reduce) {
    .bucket-card,
    .bucket-card:hover,
    .bucket-card:focus-visible {
        transition: none;
        transform: none;
    }
}

/* Stacked-paper depth: back + mid layers absolutely positioned behind */
.bucket-card-back,
.bucket-card-mid {
    position: absolute;
    border-radius: var(--r-lg);
    pointer-events: none;
}
.bucket-card-back {
    top: 10px; left: 14px; right: 14px; bottom: -6px;
    background: #E2EAD8;
    border: 1px solid var(--sage-300);
    opacity: 0.7;
}
.bucket-card-mid {
    top: 5px; left: 7px; right: 7px; bottom: -3px;
    background: #EAF0E1;
    border: 1px solid var(--sage-300);
}

.bucket-card-fg {
    position: relative;
    padding: var(--s-5);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    min-height: 280px;
    background: linear-gradient(165deg, #DDE4D5 0%, #EFF2EC 60%);
    border: 1px solid var(--sage-300);
    border-radius: var(--r-lg);
}

.bucket-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: var(--cream-50);
    border: 1px solid var(--sage-100);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sage-700);
}
.bucket-card-fg h3 { color: var(--sage-900); }
.bucket-sub {
    font-size: 14px;
    color: var(--sage-900);
    opacity: 0.75;
    line-height: 1.5;
}
.bucket-spacer { flex: 1; }

/* Pill bar: each pill takes an equal share of the bar's full width, so
   tiles with different bucket targets (Accounts=12, Contacts=8, Documents=6,
   Wishes=5) all render a single-row indicator of the same total length.
   Without flex:1 + nowrap, the larger-target tiles wrapped into two rows
   while smaller ones rendered one row — the four tiles looked inconsistent. */
.progress-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    width: 100%;
}
.progress-pill {
    flex: 1 1 0;
    min-width: 0;
    height: 6px;
    border-radius: 3px;
}
.progress-pill--filled { background: var(--sage-500); }
.progress-pill--empty { background: var(--cream-200); }
.progress-label {
    font-size: 13px;
    color: var(--slate-500);
    margin-top: var(--s-2);
}

.bucket-actions {
    display: flex;
    gap: var(--s-2);
}
.bucket-actions .btn { flex: 1; }

/* ---- Summary card (the headline card under bucket grid) -------------- */

.summary-card {
    background: linear-gradient(180deg, #FBF8F2, #F5EFE3);
    padding: var(--s-6);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s-6);
    align-items: center;
    margin-bottom: var(--s-7);
}
@media (max-width: 768px) {
    .summary-card { grid-template-columns: 1fr; }
}
.summary-card h2 {
    font-size: 28px;
    line-height: 1.2;
    max-width: 560px;
    margin-bottom: var(--s-3);
}
.summary-card h2 strong { font-weight: 400; color: var(--sage-900); }
.summary-card-gaps {
    margin-top: var(--s-4);
    margin-bottom: var(--s-5);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.gap-row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 10px 12px;
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.gap-row-text { flex: 1; font-size: 15px; }
.gap-row-action {
    color: var(--sage-700);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}
.gap-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.gap-dot--first { background: var(--sienna-500); border: 1px solid var(--sienna-700); }
.gap-dot--rest  { background: var(--sienna-100); border: 1px solid var(--border-strong); }

.summary-card-meta {
    margin-top: var(--s-3);
    font-size: 13px;
    color: var(--slate-500);
    font-style: italic;
}

/* SVG completion ring on the right side of the summary card */
.summary-ring {
    width: 160px; height: 160px;
    flex-shrink: 0;
}
.summary-ring-track { stroke: var(--cream-200); }
.summary-ring-fill  { stroke: var(--sage-700); transition: stroke-dashoffset 600ms ease; }
.summary-ring-text {
    font-family: var(--font-display);
    fill: var(--slate-900);
    font-size: 32px;
    font-weight: 400;
}

/* ---- Task list -------------------------------------------------------- */

.task-card {
    margin-bottom: var(--s-7);
}
.task-card-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--s-4);
}
.task-card-header h3 { flex: 1; }

.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.task-row {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--cream-50);
    text-align: left;
    width: 100%;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.task-row:hover { background: var(--cream-100); }
.task-row--done { background: var(--cream-100); }
.task-row-check {
    margin-top: 1px;
    color: var(--slate-400);
    flex-shrink: 0;
}
.task-row--done .task-row-check { color: var(--sage-700); }
.task-row-body { flex: 1; }
.task-row-text { font-size: 15px; line-height: 1.4; }
.task-row--done .task-row-text { text-decoration: line-through; color: var(--slate-500); }
.task-row-meta {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-top: 4px;
    font-size: 13px;
    color: var(--slate-500);
}

.task-badge {
    display: inline-flex;
    align-items: center;
    background: var(--sage-50);
    border: 1px solid var(--sage-100);
    color: var(--sage-700);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}

.task-add-form {
    display: flex;
    gap: var(--s-2);
    margin-top: var(--s-4);
}
.task-add-form .input { flex: 1; height: 56px; }
.task-add-form .btn { flex-shrink: 0; }

.task-show-more {
    margin-top: var(--s-3);
    background: none;
    border: none;
    color: var(--sage-700);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline dotted var(--sage-300);
    text-underline-offset: 4px;
    padding: 6px 8px;
}

/* ---- "Learn more" inline button + UPL info-tag ----------------------- */

.learn-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--sage-700);
    font-size: 14px;
    padding: 4px 6px;
    margin-left: -6px;
    border-radius: var(--r-sm);
    text-decoration: underline dotted var(--sage-300);
    text-underline-offset: 4px;
    cursor: pointer;
    font-family: inherit;
}
.learn-more:hover { color: var(--sage-900); background: var(--sage-50); }

.info-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--slate-500);
    font-style: italic;
}
.info-tag::before {
    content: 'i';
    font-style: normal;
    font-weight: 600;
    width: 14px; height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--cream-200);
    color: var(--slate-700);
    font-size: 10px;
    font-family: var(--font-display);
}

.lock-affordance {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--slate-500);
}

/* ---- Welcome arc / Anonymous splash ---------------------------------- */

.welcome-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cream-50);
}
.welcome-header {
    height: 72px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--s-6);
}
.welcome-content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--s-7) var(--s-6);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.welcome-hero {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: var(--s-7);
    align-items: center;
}
@media (max-width: 900px) { .welcome-hero { grid-template-columns: 1fr; } }

.welcome-hero h1 { font-size: 44px; margin-bottom: var(--s-4); }
.welcome-lede {
    font-size: 19px;
    color: var(--slate-700);
    line-height: 1.55;
    max-width: 460px;
    margin-bottom: var(--s-5);
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}
.welcome-feature {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: var(--s-3);
    align-items: start;
}
.welcome-feature-tile {
    width: 44px; height: 44px;
    border-radius: var(--r-md);
    background: var(--sage-50);
    border: 1px solid var(--sage-100);
    color: var(--sage-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.welcome-feature-title {
    font-family: var(--font-display);
    font-size: 17px;
    margin-bottom: 4px;
}
.welcome-feature-body {
    font-size: 16px;
    color: var(--slate-700);
    line-height: 1.5;
}

/* Welcome arc copy screens (1-3) */
.welcome-prose {
    max-width: 720px;
    margin: 0 auto;
}
.welcome-prose h2 { margin-bottom: var(--s-4); }
.welcome-prose p {
    font-size: 17px;
    color: var(--slate-700);
    line-height: 1.55;
    margin-bottom: var(--s-4);
    max-width: 640px;
}

/* Anchor the welcome-arc action row (Skip / Continue / progress dots) to the
   bottom of the viewport so it's always reachable without scrolling. The
   matching `.welcome-hero, .welcome-prose { padding-bottom }` rule below
   reserves space so the last line of content isn't hidden under the bar. */
.welcome-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    border-top: 1px solid var(--border);
    padding: var(--s-4) var(--s-6);
    display: flex;
    align-items: center;
    gap: var(--s-4);
    background: var(--cream-100);
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.04);
}
/* Reserve space at the bottom of welcome-arc content so the fixed footer
   doesn't overlap the last line. ~96px = 32px (s-4 top+bottom padding) +
   1px top border + ~44px button height + breathing room. */
.welcome-hero,
.welcome-prose {
    padding-bottom: 96px;
}
.welcome-progress {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}
.welcome-dot {
    width: 8px; height: 8px;
    border-radius: 999px;
    background: var(--cream-300);
    transition: all 200ms ease;
}
.welcome-dot--active {
    width: 32px;
    background: var(--sage-700);
}
.welcome-spacer { flex: 1; }
.welcome-skip {
    background: none;
    border: none;
    color: var(--slate-500);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline dotted var(--border-strong);
    text-underline-offset: 4px;
    font-family: inherit;
    padding: 8px 12px;
}
.welcome-skip:hover { color: var(--slate-900); }

/* ---- Auth chain (signup/login/etc) ---------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cream-50);
}
.auth-header {
    height: 72px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--s-6);
}
.auth-content {
    flex: 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: var(--s-7) var(--s-6);
}
.auth-content h1 { font-size: 32px; margin-bottom: var(--s-3); }
.auth-content .auth-sub {
    color: var(--slate-500);
    font-size: 16px;
    margin-bottom: var(--s-6);
    line-height: 1.55;
}
.auth-card {
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-6);
}
.auth-foot {
    margin-top: var(--s-5);
    text-align: center;
    color: var(--slate-500);
    font-size: 14px;
}
.auth-foot a { color: var(--sage-700); }
.auth-errors {
    background: var(--sienna-100);
    border: 1px solid var(--sienna-500);
    color: var(--sienna-700);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
    font-size: 14px;
}

/* MFA-specific tweaks (build on the auth shell) */
.qr-block {
    display: block;
    margin: var(--s-4) auto;
    padding: var(--s-4);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    text-align: center;
}
.qr-block svg {
    max-width: 240px;
    height: auto;
    margin: 0 auto;
}
.qr-block svg rect { fill: #000000; }
.qr-block svg path { fill: #000000; }

.recovery-codes {
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
    font-family: var(--font-mono);
    font-size: 15px;
    column-count: 2;
    column-gap: var(--s-4);
    margin-bottom: var(--s-4);
}
@media (max-width: 480px) { .recovery-codes { column-count: 1; } }

.manual-key {
    font-family: var(--font-mono);
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 4px 8px;
    word-break: break-all;
    font-size: 14px;
}

/* ---- Section shell (data domain list/empty/form/item) ---------------- */

.section-header {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    margin-bottom: var(--s-6);
}
.section-header-tile {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--sage-50);
    border: 1px solid var(--sage-100);
    color: var(--sage-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.section-header-spacer { flex: 1; }

.empty-state {
    max-width: 560px;
    margin: var(--s-9) auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-4);
}
.empty-state-tile {
    width: 64px; height: 64px;
    border-radius: var(--r-lg);
    background: var(--sage-50);
    border: 1px solid var(--sage-100);
    color: var(--sage-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--s-3);
}
.empty-state h2 { font-size: 36px; }
.empty-state-body {
    font-size: 18px;
    color: var(--slate-700);
    line-height: 1.55;
}
.empty-state-note {
    font-size: 14px;
    color: var(--slate-500);
    font-style: italic;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--s-4);
    list-style: none;
    padding: 0;
    margin: 0;
}
.item-card {
    padding: var(--s-4);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--cream-50);
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    cursor: pointer;
}
.item-card:hover { background: var(--cream-100); }
.item-card-tile {
    width: 44px; height: 44px;
    border-radius: var(--r-md);
    background: var(--sage-50);
    border: 1px solid var(--sage-100);
    color: var(--sage-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.item-card-body { flex: 1; min-width: 0; }
.item-card-title {
    font-size: 17px;
    font-weight: 500;
    color: var(--slate-900);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-card-sub {
    font-size: 14px;
    color: var(--slate-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-card-chev { color: var(--slate-400); flex-shrink: 0; }

/* Form layouts (two-column max width 720) */
.form-layout {
    max-width: 720px;
    margin: 0 auto;
}
.form-section {
    margin-bottom: var(--s-7);
}
.form-section h3 {
    margin-bottom: var(--s-4);
    font-size: 22px;
}
.form-section-help {
    color: var(--slate-500);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: var(--s-4);
}
.form-actions {
    display: flex;
    gap: var(--s-2);
    justify-content: flex-end;
    margin-top: var(--s-6);
    padding-top: var(--s-5);
    border-top: 1px solid var(--border);
}

/* ---- Summary document (the long-form letter) ------------------------ */

.summary-doc-banner {
    background: var(--sage-700);
    color: var(--cream-50);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: var(--s-4);
    font-size: 15px;
}
.summary-doc-back {
    position: fixed;
    top: 92px;
    right: 24px;
    z-index: 25;
    height: 44px;
    padding: 10px 16px 10px 12px;
    background: var(--cream-50);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    font-weight: 500;
    text-decoration: none;
    color: var(--slate-900);
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
}
.summary-doc-back:hover { background: var(--cream-100); color: var(--slate-900); }

.summary-doc-body {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--s-9) var(--s-6);
}
.summary-doc-header { margin-bottom: var(--s-7); }
.summary-doc-header h1 { font-size: 44px; margin-bottom: var(--s-3); }
.summary-doc-standfirst {
    font-size: 17px;
    color: var(--slate-700);
    line-height: 1.55;
}

.summary-section {
    margin-bottom: var(--s-7);
}
.summary-section h2 {
    font-size: 32px;
    border-bottom: 1px solid var(--sage-300);
    padding-bottom: var(--s-2);
    margin-bottom: var(--s-5);
}

.kv-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-6);
    margin-bottom: var(--s-4);
}
.kv-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}
.kv-label {
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--slate-500);
    font-weight: 500;
}
.kv-value {
    font-size: 17px;
    color: var(--slate-900);
}

/* Executor Summary commentary — the educational/AI-assistant-style panel
 * that orients the executor at the top of each section before the user's
 * data appears. Visual treatment matches the prototype's `Commentary`
 * component (06_product/ux/prototype-afterward-poc/summary.jsx):
 *   - sage-50 background + 3px sage-500 left border (the "AI is talking"
 *     visual cue, same family as the floating Assistant pill's sage gradient)
 *   - rounded right corners only (the left edge is the colored bar)
 *   - 14/16px padding, 15px body, 1.6 line-height
 *   - info-tag ("Informational, not legal advice") is nested inside, 8px
 *     margin-top from the body
 */
.summary-commentary {
    margin: 0 0 var(--s-4) 0;
    padding: 14px 16px;
    background: var(--sage-50);
    border-left: 3px solid var(--sage-500);
    border-radius: 0 var(--r-md) var(--r-md) 0;
    font-size: 15px;
    color: var(--slate-700);
    line-height: 1.6;
}
.summary-commentary p {
    margin: 0;
}
.summary-commentary .info-tag {
    margin-top: var(--s-2);
    display: inline-flex;
}
.summary-commentary .learn-more {
    display: inline-flex;
    margin-top: var(--s-2);
    margin-left: 0;
}

.missing-panel {
    background: var(--sienna-100);
    border: 1px solid var(--sienna-500);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    margin-bottom: var(--s-7);
}
.missing-panel h2 {
    color: var(--sienna-700);
    font-size: 24px;
    margin-bottom: var(--s-3);
}
.missing-panel p {
    color: var(--sienna-700);
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: var(--s-3);
}
.missing-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.missing-list li {
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    color: var(--slate-700);
    font-size: 15px;
}
.missing-list li a { color: var(--sage-700); font-weight: 500; }

.executor-checklist {
    list-style: none;
    padding: 0;
    margin: var(--s-3) 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.executor-checklist li {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3);
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.executor-checklist input[type="checkbox"] {
    margin-top: 2px;
    width: 18px; height: 18px;
    accent-color: var(--sage-700);
    flex-shrink: 0;
}
.executor-checklist label { font-size: 15px; line-height: 1.5; cursor: pointer; }

/* Document row in Summary (with placeholder AI summary affordance) */
.doc-row {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--cream-50);
    margin-bottom: var(--s-2);
}
.doc-row-tile {
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background: var(--sage-50);
    border: 1px solid var(--sage-100);
    color: var(--sage-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.doc-row-body { flex: 1; min-width: 0; }
.doc-row-title { font-size: 16px; font-weight: 500; }
.doc-row-meta { font-size: 13px; color: var(--slate-500); }

/* ---- Floating Assistant pill + chat panel --------------------------- */

.assistant-cta {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 30;
    min-height: 72px;
    padding: 12px 20px 12px 14px;
    background: var(--cream-50);
    border: 2px solid var(--sage-700);
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    text-decoration: none;
    color: var(--slate-900);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-family: inherit;
    max-width: 360px;
}
.assistant-cta:hover { color: var(--slate-900); transform: translateY(-1px); }
.assistant-cta-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--sage-300), var(--sage-700));
    border: 2px solid var(--cream-50);
    color: var(--cream-50);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.assistant-cta-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.assistant-cta-title { font-family: var(--font-display); font-size: 18px; color: var(--slate-900); }
.assistant-cta-sub { font-size: 13px; color: var(--slate-700); margin-top: 2px; }
.assistant-cta-arrow { color: var(--sage-700); font-size: 18px; transition: transform 120ms ease; }
.assistant-cta:hover .assistant-cta-arrow { transform: translateX(3px); }

@keyframes assistantPulse {
    0%   { box-shadow: 0 0 0 0 rgba(79,103,73,0.35), var(--shadow-lg); }
    70%  { box-shadow: 0 0 0 18px rgba(79,103,73,0), var(--shadow-lg); }
    100% { box-shadow: 0 0 0 0 rgba(79,103,73,0), var(--shadow-lg); }
}
.assistant-cta { animation: assistantPulse 2.6s ease-out infinite; }

/* Speech bubble above the CTA */
.assistant-bubble-wrap {
    position: fixed;
    bottom: 110px;
    right: 24px;
    z-index: 31;
    max-width: 320px;
}
.assistant-bubble {
    background: var(--cream-50);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 14px 16px 12px;
    box-shadow: var(--shadow-md);
    position: relative;
    font-size: 14px;
    color: var(--slate-900);
    line-height: 1.5;
}
.assistant-bubble::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    background: var(--cream-50);
    border-right: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
    transform: rotate(45deg);
    bottom: -9px;
    right: 36px;
}
.assistant-bubble-dismiss {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px; height: 28px;
    border-radius: var(--r-sm);
    background: transparent;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.assistant-bubble-dismiss:hover { background: var(--cream-100); color: var(--slate-900); }
.assistant-bubble-body { padding-right: var(--s-4); margin-bottom: var(--s-2); }

/* Chat panel (slide-in from right) */
.assistant-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 420px;
    max-width: 100%;
    z-index: 30;
    background: var(--cream-50);
    border-left: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 200ms ease;
}
.assistant-panel--open { transform: translateX(0); }

.assistant-panel-header {
    height: 72px;
    padding: 0 var(--s-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.assistant-panel-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--sage-300), var(--sage-700));
    color: var(--cream-50);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.assistant-panel-titles { flex: 1; }
.assistant-panel-title { font-family: var(--font-display); font-size: 18px; }
.assistant-panel-sub { font-size: 13px; color: var(--slate-500); }

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}
.assistant-msg { display: flex; flex-direction: column; gap: 4px; }
.assistant-msg-bubble {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.55;
    max-width: 90%;
}
.assistant-msg--user .assistant-msg-bubble {
    background: var(--sage-700);
    color: var(--cream-50);
    align-self: flex-end;
}
.assistant-msg--assistant .assistant-msg-bubble {
    background: var(--cream-100);
    color: var(--slate-900);
    border: 1px solid var(--border);
}
.assistant-msg .info-tag { margin-top: 4px; padding-left: 4px; }

.assistant-input-wrap {
    border-top: 1px solid var(--border);
    background: var(--cream-100);
    padding: var(--s-4);
}
.assistant-input-form {
    display: flex;
    gap: var(--s-2);
}
.assistant-input-form .input { height: 44px; }
.assistant-input-form .btn { flex-shrink: 0; }
.assistant-input-disclaimer {
    font-size: 11px;
    color: var(--slate-500);
    margin-top: var(--s-2);
}

/* ---- Legacy `tbod-*` bridge (rebuilt against tokens) ---------------- */
/* Templates we haven't fully migrated yet still reference these classes.
 * Rebuilt against the new tokens so they look in-system rather than ripped
 * out — full migration happens template-by-template across Days 1-3. */

.tbod-shell { display: flex; flex-direction: column; min-height: 100vh; }
.tbod-header {
    background: var(--cream-50);
    color: var(--slate-900);
    padding: 0 var(--s-6);
    height: 72px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--s-4);
}
.tbod-header__brand { font-family: var(--font-display); font-size: 22px; color: var(--slate-900); text-decoration: none; }
.tbod-header__nav { margin-left: auto; display: flex; gap: var(--s-4); align-items: center; }
.tbod-header__nav a { color: var(--slate-700); text-decoration: none; font-size: 14px; }
.tbod-header__nav a:hover { color: var(--sage-700); }
.tbod-main { flex: 1; padding: var(--s-7) var(--s-6); max-width: 1200px; margin: 0 auto; width: 100%; }
.tbod-main--wide { max-width: 1200px; }
.tbod-footer {
    border-top: 1px solid var(--border);
    background: var(--cream-100);
    padding: var(--s-4) var(--s-6);
    text-align: center;
    color: var(--slate-500);
    font-size: 13px;
}
.tbod-card {
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
}
.tbod-card__title { margin: 0 0 var(--s-2) 0; font-family: var(--font-display); font-size: 24px; }
.tbod-card__sub { margin: 0 0 var(--s-4) 0; color: var(--slate-500); font-size: 15px; line-height: 1.55; }

.tbod-field { margin-bottom: var(--s-4); }
.tbod-field__hint { font-size: 14px; color: var(--slate-500); margin-top: 4px; }
.tbod-field__error { font-size: 14px; color: var(--sienna-700); margin-top: 4px; }

.tbod-form-actions { margin-top: var(--s-5); display: flex; gap: var(--s-2); flex-wrap: wrap; }

.tbod-btn { /* alias to .btn-primary */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    height: 48px;
    padding: 0 var(--s-5);
    border-radius: var(--r-md);
    font-size: 16px;
    font-weight: 500;
    border: 1px solid transparent;
    background: var(--sage-700);
    color: var(--cream-50);
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
}
.tbod-btn:hover, .tbod-btn:focus { background: var(--sage-900); color: var(--cream-50); }

.tbod-btn--ghost { background: transparent; color: var(--slate-700); border: 1px solid var(--border); }
.tbod-btn--ghost:hover, .tbod-btn--ghost:focus { background: var(--cream-100); color: var(--slate-900); }
.tbod-btn--danger { background: var(--sienna-500); color: var(--cream-50); border-color: var(--sienna-500); }
.tbod-btn--danger:hover, .tbod-btn--danger:focus { background: var(--sienna-600); }

.tbod-alert {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    margin-bottom: var(--s-3);
    border: 1px solid var(--border);
    font-size: 15px;
    background: var(--cream-100);
}
.tbod-alert--info    { background: var(--sage-50);    border-color: var(--sage-100);    color: var(--sage-900); }
.tbod-alert--success { background: var(--sage-50);    border-color: var(--sage-300);    color: var(--sage-900); }
.tbod-alert--warning { background: var(--sienna-100); border-color: var(--border-strong); color: var(--sienna-700); }
.tbod-alert--error   { background: var(--sienna-100); border-color: var(--sienna-500);   color: var(--sienna-700); }

.tbod-list { list-style: none; padding: 0; margin: 0; }
.tbod-list__item {
    background: var(--cream-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-2);
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.tbod-list__item-title { font-weight: 500; }
.tbod-list__item-meta { color: var(--slate-500); font-size: 14px; }
.tbod-list__item-actions { margin-left: auto; display: flex; gap: var(--s-2); }
.tbod-list__empty { text-align: center; color: var(--slate-500); padding: var(--s-7); font-style: italic; }

.tbod-domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--s-4);
    margin-top: var(--s-4);
}
.tbod-domain-card {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    background: var(--cream-50);
    text-decoration: none;
    color: inherit;
    display: block;
}
.tbod-domain-card:hover, .tbod-domain-card:focus { background: var(--cream-100); border-color: var(--border-strong); color: inherit; }
.tbod-domain-card__title { margin: 0 0 4px 0; font-family: var(--font-display); font-size: 18px; }
.tbod-domain-card__count { color: var(--slate-500); font-size: 14px; }

.tbod-muted { color: var(--slate-500); }
.tbod-disclaimer {
    color: var(--slate-500);
    font-size: 13px;
    margin-top: var(--s-5);
    border-top: 1px solid var(--border);
    padding-top: var(--s-3);
}

/* QR code module styling — preserved from legacy */
.tbod-qr {
    display: block;
    margin: var(--s-4) 0;
    padding: var(--s-4);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    text-align: center;
}
.tbod-qr svg { max-width: 240px; height: auto; }
.tbod-qr svg rect { fill: #000000; }
.tbod-qr svg path { fill: #000000; }

.tbod-recovery-codes {
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
    font-family: var(--font-mono);
    font-size: 15px;
    column-count: 2;
    column-gap: var(--s-4);
}
@media (max-width: 480px) { .tbod-recovery-codes { column-count: 1; } }

/* ---- Utilities ------------------------------------------------------- */

.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-5 { gap: var(--s-5); }
.gap-6 { gap: var(--s-6); }

.text-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 13px; }
.text-muted { color: var(--slate-500); }
.text-strong { color: var(--slate-900); }
.text-display { font-family: var(--font-display); }
.text-italic { font-style: italic; }

.mb-1 { margin-bottom: var(--s-2); }
.mb-2 { margin-bottom: var(--s-3); }
.mb-3 { margin-bottom: var(--s-4); }
.mb-4 { margin-bottom: var(--s-5); }
.mb-5 { margin-bottom: var(--s-6); }
.mt-1 { margin-top: var(--s-2); }
.mt-2 { margin-top: var(--s-3); }
.mt-3 { margin-top: var(--s-4); }
.mt-4 { margin-top: var(--s-5); }
.mt-5 { margin-top: var(--s-6); }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Scrollbar — calm */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--cream-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }


/* ====================================================================
 * MOBILE — best-effort UI per ADR 0005 Addendum A (2026-04-30).
 *
 * Single primary breakpoint at 768px; a tighter 600px block for narrow
 * phone layout. Pure additive: nothing above this comment changes for
 * desktop; this whole block can be deleted to revert mobile without
 * touching desktop pixels.
 *
 * Trade-offs captured in ADR 0005 Addendum A §A.3.
 * ==================================================================== */

/* ---- <= 768px (small tablet + mobile) -------------------------------- */
@media (max-width: 768px) {

    /* TopBar: shrink padding, drop the avatar slot (real-estate). */
    .topbar {
        padding: 0 var(--s-4);
        gap: var(--s-3);
    }
    .topbar .avatar {
        display: none;  /* moved to dashboard surface; sign-out via icon-btn stays */
    }
    .wordmark {
        font-size: 18px;
    }
    .wordmark-tag {
        font-size: 10px;
        padding: 2px 5px;
    }

    /* Main content area: tighter padding so 16px of left/right breathing room.
       Bottom padding stays generous so the floating Assistant pill doesn't
       cover the last row of content on bucket lists. */
    .main-area {
        padding: var(--s-5) var(--s-4) calc(var(--s-9) + 80px);
    }

    /* Greeting strip — h1 ramps down so it fits on one line typically */
    .greeting h1 { font-size: 30px; }
    .greeting-sub { font-size: 16px; }

    /* Bucket grid → single column */
    .bucket-grid {
        grid-template-columns: 1fr;
        gap: var(--s-3);
    }
    .bucket-card-fg { min-height: 220px; padding: var(--s-4); }
    .bucket-card-fg h3 { font-size: 22px; }
    .bucket-icon { width: 44px; height: 44px; border-radius: 12px; }

    /* SummaryCard reflows; ring stacks under the headline */
    .summary-card {
        grid-template-columns: 1fr;
        padding: var(--s-5) var(--s-4);
        gap: var(--s-4);
        text-align: left;
    }
    .summary-card h2 { font-size: 22px; }
    .summary-ring {
        width: 120px; height: 120px;
        margin: 0 auto;  /* center the ring under the gaps list */
    }
    .summary-ring-text { font-size: 26px; }

    /* TaskList — drop the bucket meta on small screens; keep SUGGESTED badge */
    .task-row-meta > span:not(.task-badge) { display: none; }
    .task-add-form {
        flex-direction: column;
        align-items: stretch;
    }
    .task-add-form .btn { width: 100%; }

    /* Welcome arc — Screen 0 already collapses at 900px; tighten copy on phone */
    .welcome-hero h1 { font-size: 32px; }
    .welcome-lede { font-size: 17px; }
    .welcome-prose h2 { font-size: 26px; }
    .welcome-prose p { font-size: 16px; }
    .welcome-feature-tile { width: 40px; height: 40px; }
    /* On phones the action row wraps (button row + dots row), so it's
       taller than desktop — bump the content's bottom-padding to keep the
       last line of copy clear of the fixed footer. */
    .welcome-hero,
    .welcome-prose {
        padding-bottom: 160px;
    }
    .welcome-footer {
        padding: var(--s-3) var(--s-4);
        gap: var(--s-2);
        flex-wrap: wrap;
    }

    /* Section header on data-domain pages — tighter, h2 wraps if needed */
    .section-header { gap: var(--s-3); margin-bottom: var(--s-4); }
    .section-header h2 { font-size: 24px; }
    .section-header-tile { width: 44px; height: 44px; }
    .section-header .btn { padding: 0 var(--s-3); font-size: 14px; }

    /* Empty state — tighter padding + smaller h2 so it doesn't run off */
    .empty-state { margin: var(--s-7) auto; gap: var(--s-3); padding: 0 var(--s-2); }
    .empty-state h2 { font-size: 28px; }
    .empty-state-body { font-size: 16px; }
    .empty-state-tile { width: 56px; height: 56px; }

    /* Item grid: forced single column under 600px (handled below);
       at 600-768 it stays auto-fit but with tighter min-width */
    .item-grid {
        gap: var(--s-3);
        grid-template-columns: 1fr;
    }
    .item-card { padding: var(--s-3); gap: var(--s-3); }
    .item-card-tile { width: 40px; height: 40px; }
    .item-card-title { font-size: 16px; }

    /* Form layout — stack actions vertically (primary above cancel) */
    .form-layout { padding: 0; }
    .form-section { margin-bottom: var(--s-5); }
    .form-section h3 { font-size: 20px; }
    .form-actions {
        flex-direction: column-reverse;  /* primary appears at top (thumb zone) */
        align-items: stretch;
        gap: var(--s-2);
    }
    .form-actions .btn { width: 100%; }

    /* Auth chain — keep card narrow but full bleed at small widths */
    .auth-content { padding: var(--s-5) var(--s-4); }
    .auth-content h1 { font-size: 26px; }

    /* MFA: shrink QR slightly so it fits on a phone */
    .qr-block { padding: var(--s-3); }
    .qr-block svg { max-width: 200px; }
    .recovery-codes { font-size: 14px; padding: var(--s-3); }

    /* Summary doc — tighter outer padding; floating Back moves up so it
       doesn't collide with the banner */
    .summary-doc-banner {
        padding: var(--s-2) var(--s-4);
        font-size: 14px;
    }
    .summary-doc-back {
        top: 64px;
        right: 16px;
        height: 40px;
        padding: 8px 14px 8px 10px;
        font-size: 14px;
    }
    .summary-doc-body {
        padding: var(--s-7) var(--s-4) calc(var(--s-9) + 80px);
    }
    .summary-doc-header h1 { font-size: 32px; }
    .summary-section h2 { font-size: 24px; padding-bottom: var(--s-1); }
    .summary-doc-standfirst { font-size: 16px; }
    .kv-row { gap: var(--s-3); }
    .kv-block { min-width: 0; }
    .kv-value { font-size: 16px; }
    .summary-commentary {
        font-size: 14px;
        padding: 12px 14px;
        line-height: 1.55;
    }

    /* Floating Assistant — re-position and width-cap so it doesn't overflow */
    .assistant-cta {
        bottom: 16px;
        right: 16px;
        max-width: calc(100vw - 32px);
        min-height: 64px;
        padding: 10px 16px 10px 12px;
    }
    .assistant-cta-avatar { width: 40px; height: 40px; }
    .assistant-cta-title { font-size: 16px; }
    .assistant-cta-sub { font-size: 12px; }

    /* Speech bubble — keep aligned with the re-positioned pill */
    .assistant-bubble-wrap {
        bottom: 96px;
        right: 16px;
        max-width: calc(100vw - 32px);
    }

    /* Assistant chat panel — full-screen on mobile (forward-looking;
       see Addendum A §A.3 trade-off #10) */
    .assistant-panel {
        width: 100%;
        border-left: none;
    }
    .assistant-messages { padding: var(--s-3); }
    .assistant-input-wrap { padding: var(--s-3); }

    /* TrustStrip footer — wraps cleanly. ADR 0005 Addendum B (item 7):
       extra bottom padding so the floating Assistant pill (~64-72px tall +
       16px offset) doesn't cover the footer's text/links when scrolled to
       the bottom of a page. Pill stays at bottom-right; the footer's added
       padding gives the pill a "safe zone" below the readable text. */
    .trust-strip {
        padding: var(--s-3) var(--s-4) calc(var(--s-3) + 88px);
        gap: var(--s-2);
        font-size: 12px;
    }
    .trust-strip-links { gap: var(--s-3); flex-wrap: wrap; }

    /* Headings cap — keep h1 readable but tame */
    h1 { font-size: 32px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
}

/* ---- <= 599px (true phone) ----------------------------------------- */
@media (max-width: 599px) {
    /* The main-area gets even less side padding at very narrow widths */
    .main-area { padding-left: var(--s-3); padding-right: var(--s-3); }

    /* Welcome arc Screen 0 hero stack: features stack tightly */
    .welcome-features { gap: var(--s-3); }

    /* Greeting on a phone — wrap long emails / names */
    .greeting h1 { font-size: 26px; word-break: break-word; }
    .greeting-sub { font-size: 15px; }

    /* Two-column recovery codes → one column already by existing 480px rule;
       reinforce here in case columns + monospace overflow */
    .recovery-codes { column-count: 1; }

    /* Form actions still stacked; tighter spacing */
    .form-actions { padding-top: var(--s-4); }

    /* TopBar wordmark text gets even smaller; keep the mark dot */
    .wordmark { font-size: 16px; }
    .wordmark-mark { width: 18px; height: 18px; }

    /* Summary card headline ramps down further */
    .summary-card h2 { font-size: 20px; }
    .summary-ring { width: 100px; height: 100px; }
    .summary-ring-text { font-size: 22px; }

    /* Welcome arc footer: dots + Skip + Continue stack better */
    .welcome-footer .btn,
    .welcome-footer form { width: 100%; }
    .welcome-footer .btn { justify-content: center; }
    .welcome-spacer { display: none; }
    .welcome-progress { order: 2; width: 100%; justify-content: center; }
}
