/* =============================================================
   FirmTools Site Layout CSS
   Application-level structural styles (nav, sidebar, dashboards,
   and wizard-based tools).
   Brand values come from brand.css custom properties — never hardcode.
   ============================================================= */

/* ---- Page header ---- */
.page-header {
    text-align: center;
    padding: 2rem 1.5rem 1.25rem;
}
.page-header h1 { margin-bottom: 0.5rem; }
.page-header p  { color: var(--color-text-muted); margin: 0; }
.page-header-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    line-height: 1;
}

/* ================================================================
   WIZARD STYLES
   Used by multi-step form tools (Personal Budget Worksheet, etc.)
   ================================================================ */

/* ---- Progress bar ---- */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 1rem 1.5rem 0.5rem;
    max-width: 840px;
    margin: 0 auto;
}

.wizard-step {
    display: flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* separator arrow between steps */
.wizard-step + .wizard-step::before {
    content: "›";
    margin: 0 0.5rem;
    color: var(--color-border);
    font-size: 1rem;
    font-weight: 400;
}

.wizard-step.active {
    color: var(--color-primary);
    font-weight: 700;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 3px;
}

.wizard-step.done {
    color: var(--color-positive);
}

/* ---- Wizard card wrapper ---- */
.wizard-card {
    max-width: 720px;
    margin: 1rem auto 2rem;
    padding: 0;
    overflow: hidden;
}

/* ---- Step body ---- */
.wizard-step-body {
    padding: 2rem 2rem 1.25rem;
}
.wizard-step-body h2 {
    color: var(--color-primary);
    margin-bottom: 0.375rem;
}

/* ---- Fieldsets and legends inside wizard steps ---- */
fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.75rem 0;
}
legend {
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--color-primary);
    margin-bottom: 0.625rem;
    padding: 0;
    width: 100%;
}

/* ---- Navigation bar (Back / Next buttons) ---- */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-muted);
}
/* Single-button nav (e.g. the intro "Begin" gate) — right-align */
.wizard-nav--end { justify-content: flex-end; }

/* Two or more buttons sharing one side of the nav bar */
.wizard-nav-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ---- Choice cards (pick one of two or three paths before a wizard branches) ---- */
.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.choice-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 15rem;
    padding: 1.1rem 1.25rem;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.choice-card:hover { border-color: var(--color-primary); }

.choice-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.choice-card-selected {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

.choice-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-primary);
}

.choice-card-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.choice-card-body {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--color-text);
}

/* Resume-draft banner (browser-cached in-progress questionnaire) */
.q-resume {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 720px;
    margin: 1rem auto 0;
}
.q-resume-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.85rem; }

/* ---- Expense sections ---- */
.expense-section {
    border-left: 3px solid var(--color-accent);
    padding-left: 1rem;
    margin-bottom: 2.25rem;
}
.expense-section h3 {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}
.section-total {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: right;
    margin-top: 0.5rem;
}

/* ---- Total row ---- */
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-top: 2px solid var(--color-primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}
.total-value {
    color: var(--color-primary);
    font-family: var(--font-header);
    font-variant-numeric: tabular-nums;
}

/* ---- Field helpers ---- */
.field-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}
.field-row > label { flex: 1; }

@media (max-width: 560px) {
    .field-row { flex-direction: column; gap: 0; }
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1rem;
}

.field-warning {
    color: var(--color-negative);
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.375rem;
    margin-bottom: 0.5rem;
}

.step-hint {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 1.25rem;
}

.optional {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    font-style: italic;
}

/* ---- Radio / checkbox groups ---- */
.radio-group,
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 0.375rem;
    /* Bottom margin so whatever follows a group of options isn't flush against the last row. */
    margin-bottom: 1rem;
}

/* Vertical stack — for radio groups with long option labels */
.radio-group--col {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.375rem;
}

/* Two-column grid variant — use for longer lists like insurance types */
.checkbox-group--cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 2rem;
    margin-top: 0.375rem;
    margin-bottom: 1rem;
}
@media (max-width: 560px) {
    .checkbox-group--cols-2 { grid-template-columns: 1fr; }
}

.radio-label,
.checkbox-label {
    display: flex;
    flex-direction: row;    /* override base label { flex-direction: column } */
    align-items: center;
    gap: 0.45rem;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
    margin-bottom: 0;
    border-radius: var(--radius);
    padding: 0.1rem 0.25rem;
    transition: background 0.12s;
}
.checkbox-label { align-items: center; }
.radio-label:hover,
.checkbox-label:hover {
    background: var(--color-primary-light);
}
.radio-label input,
.checkbox-label input {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* ---- Tool input-panel helpers (shared across tools; prefer these over inline styles) ---- */

/* Muted helper note shown under a field or control. */
.input-note {
    display: block;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin: 0 0 0.5rem;
}

/* Two controls sharing one label caption, side by side (e.g. advance / maintenance LTV). */
.input-inline {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.input-inline > * { min-width: 0; }

/* Section heading carrying an inline On/Off toggle on the right. */
.section-toggle-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
}

/* Dim a whole section when its strategy is toggled off. */
.section-disabled { opacity: 0.45; }

/* One line of a purchase-price allocation grid: a checkbox-label caption over an .input-inline row
   of amount fields. Keeps the same vertical rhythm as stacked form labels. */
.alloc-row { margin-bottom: 0.875rem; }

/* Segmented two-button toggle (e.g. Annual draw / Single lump). */
.btn-toggle-group {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.25rem;
}
.btn-toggle-group .btn { flex: 1; padding: 0.4rem; font-size: 0.85rem; }

/* Result callout inside an input panel (e.g. the borrow estimate). */
.input-callout {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.55rem 0.65rem;
    margin: 0.45rem 0 0.6rem;
}
.input-callout__value { font-weight: 700; font-size: 1.15rem; color: var(--color-primary); }
.input-callout__note { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 0.15rem; }
.input-callout .btn { margin-top: 0.45rem; }

/* Full-width (block) button. */
.btn-block { width: 100%; }

/* A horizontal row of buttons/links that wraps. */
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Compact button (e.g. an inline action next to a field). */
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; white-space: nowrap; }

/* Icon-only button (e.g. remove a table row). */
.btn-icon { background: none; border: none; cursor: pointer; color: var(--color-text-muted); font-size: 1rem; line-height: 1; padding: 0.25rem 0.4rem; border-radius: var(--radius, 4px); }
.btn-icon:hover { color: var(--color-negative); background: var(--color-primary-light, #eef1f7); }

/* Responsive labeled-input grid for compact forms. */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem 1rem; }

/* A card title that opens a new section within a panel (adds top spacing). */
.section-title { margin-top: 1.25rem; }

/* One-line guidance under a field label — the scannable half of a label/InfoTip pair, for inputs
   whose name alone doesn't distinguish them from a neighbour. */
.field-subtitle {
    display: block;
    font-weight: 400;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

/* ---- Result / output helpers (shared across tools) ---- */

/* Muted fine-print note under results; --warn for the negative-colored variant. */
.result-note { font-size: 0.85rem; color: var(--color-text-muted); margin: 0.35rem 0 0; }
.result-note--warn { color: var(--color-negative); }

/* Conditional colors for a stat value. */
.stat-value.is-negative { color: var(--color-negative); }
.stat-value.is-positive { color: var(--color-positive); }

/* Chart container card + its empty-state placeholder. */
.chart-card { margin-top: 1rem; position: relative; min-height: 320px; }
.chart-placeholder { text-align: center; color: var(--color-text-muted); padding: 3rem 0; font-style: italic; }

/* Horizontal-scroll wrapper for wide tables. */
.table-scroll { overflow-x: auto; }

/* Chart snapshot embedded in a print layout (PNG captured from a canvas). */
.print-chart-image { max-width: 100%; height: auto; }

/* Flagged (warning) table row. */
.row-flagged { background: rgba(185, 28, 28, 0.08); }

/* Bulleted list of result points. */
.result-list { font-size: 0.9rem; margin: 0.25rem 0 0 1.25rem; }

/* Small utilities. */
.is-hidden { display: none; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--color-text-muted); }
.text-warn { color: var(--color-negative); font-weight: 600; }

/* Advanced-assumptions disclosure. */
.advanced-details { margin-top: 1rem; }
.advanced-details > summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.advanced-details > div { margin-top: 0.5rem; }
/* A collapsed <details> is only one line tall, so an action button following one reads as part of
   it unless we push it clear. Applies wherever the advanced-assumptions pattern is used. */
.advanced-details + .btn { margin-top: 1.5rem; }

/* A lone checkbox — one standing outside a .checkbox-group, which carries its own bottom margin —
   otherwise sits flush against whatever follows it. */
.checkbox-label + .field-row,
.checkbox-label + .section-title,
.checkbox-label + .advanced-details { margin-top: 1rem; }

/* ---- Currency input ---- */
.input-currency {
    text-align: right;
    font-variant-numeric: tabular-nums;
    max-width: 200px;
}

/* ---- Review table ---- */
.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.review-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.review-table td:last-child { text-align: right; }
.review-table tfoot td { border-bottom: none; }
.review-table--text td:last-child { text-align: left; }

.review-section-header td {
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.review-value {
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
    white-space: nowrap;
}

.review-subtotal td {
    font-weight: 600;
    border-top: 2px solid var(--color-border);
    border-bottom: none;
    padding-top: 0.6rem;
}

.review-total td {
    font-weight: 700;
    font-size: 1rem;
    padding: 0.75rem 0.5rem;
    border-top: 2px solid var(--color-primary);
}

.review-negative td { color: var(--color-negative); }
.review-positive td { color: var(--color-positive); }

/* ---- Alerts ---- */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-top: 1rem;
}
.alert-warning {
    background: var(--color-caution-bg);
    color: var(--color-caution);
    border: 1px solid #fde68a;
}
.alert-success {
    background: var(--color-positive-bg);
    color: var(--color-positive);
    border: 1px solid #bbf7d0;
}

/* ---- Info tip (inline help icon + tooltip) ---- */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.info-tip__icon {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    color: var(--color-primary);
    cursor: help;
    font-size: 0.65rem;
    font-weight: 700;
    font-style: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid currentColor;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
}

.info-tip__bubble {
    display: none;
    position: fixed;
    transform: translate(-50%, calc(-100% - 8px));
    min-width: 200px;
    max-width: 260px;
    width: max-content;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.775rem;
    font-weight: 400;
    font-family: var(--font-body);
    line-height: 1.5;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius);
    z-index: 200;
    pointer-events: none;
    text-align: left;
    white-space: normal;
}

.info-tip__bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-primary);
}

/* Flipped below the icon when there isn't room above (see getInfoTipAnchor): the
   bubble drops under the anchor and its arrow points up instead of down. */
.info-tip__bubble--below {
    transform: translate(-50%, 8px);
}

.info-tip__bubble--below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--color-primary);
}

/* Visibility is driven solely by the component's _visible state (the --visible class).
   We deliberately do NOT reveal on :focus/:focus-within — a mouse or touch click leaves
   the icon focused, which would pin the bubble open after the pointer leaves (the Edge/
   Chromium "tooltip won't dismiss" bug). Keyboard focus is handled in code via onfocus. */
.info-tip .info-tip__bubble--visible {
    display: block;
}

/* ---- Top navigation bar ---- */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.top-nav .brand-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}

.top-nav .brand-logo-img {
    /* Marketing-site logo footprint: 308 x 135. object-fit:contain keeps any logo
       (incl. the current 353x94 one) from distorting if its aspect differs. */
    width: 308px;
    height: 135px;
    object-fit: contain;
    object-position: left center;
    display: block;
    /* Invert the dark logo to white for the navy nav bar */
    filter: brightness(0) invert(1);
}

/* Desktop: vertical left sidebar. Fixed below the 64px header; scrolls when
   modules exceed the viewport. The ≤768px media query overrides this back to
   the original hamburger dropdown. */
.top-nav nav {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: stretch;
    background: var(--color-primary);
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.12);
    z-index: 99;
}

.top-nav nav a {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.6rem 0.85rem;
    width: 100%;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    white-space: normal;
}
.top-nav nav a:hover, .top-nav nav a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* Collapsible tool-tier groups in the sidebar */
.top-nav nav .nav-dashboard {
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.top-nav nav .nav-group {
    border: none;
}
.top-nav nav .nav-group > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255,255,255,0.55);
    font-family: var(--font-header);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.7rem 0.85rem 0.35rem;
    user-select: none;
}
.top-nav nav .nav-group > summary::-webkit-details-marker { display: none; }
.top-nav nav .nav-group > summary::before {
    content: "\25B8"; /* ▸ */
    font-size: 0.7rem;
    transition: transform 0.15s;
}
.top-nav nav .nav-group[open] > summary::before { transform: rotate(90deg); }
.top-nav nav .nav-group > a {
    display: block;       /* full-width rows; <a> in <details> is inline by default */
    width: 100%;
    padding-left: 1.6rem;
}

.top-nav .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.top-nav .nav-actions a, .top-nav .nav-actions button {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.top-nav .nav-actions a:hover, .top-nav .nav-actions button:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.top-nav .nav-actions .btn-signin {
    background: var(--color-accent);
    color: var(--color-primary);
    border-color: var(--color-accent);
    font-weight: 600;
}
.top-nav .nav-actions .btn-signin:hover {
    background: #b5a040;
    border-color: #b5a040;
}
.top-nav .nav-actions .nav-username {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    margin-right: 0.25rem;
}
.top-nav .nav-actions .btn-signout {
    background: transparent;
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.35);
    padding: 0.3rem 0.85rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.top-nav .nav-actions .btn-signout:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.6);
}

/* ---- Tool sub-navigation tab bar ---- */
.tool-subnav {
    position: sticky;
    top: var(--nav-height);
    z-index: 99;
    background: var(--color-secondary);
    border-bottom: 1px solid rgba(0,47,108,0.12);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    /* Sit to the right of the fixed desktop sidebar (reset on mobile) */
    margin-left: var(--sidebar-width);
}

.tool-subnav-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    height: 2.75rem;
}

.tool-subnav-label {
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.65;
}

.tool-subnav-tabs {
    display: flex;
    gap: 0;
    align-items: stretch;
    height: 100%;
    min-width: 0;                       /* allow the strip to shrink below its content width */
    overflow-x: auto;                   /* …and scroll horizontally instead of overflowing the page */
    scrollbar-width: none;              /* Firefox: hide the scrollbar (still swipe/scroll-able) */
    -webkit-overflow-scrolling: touch;  /* momentum scrolling on iOS */
}
.tool-subnav-tabs::-webkit-scrollbar { display: none; }  /* WebKit: hide the scrollbar */

.tool-subnav-tabs a {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--color-primary);
    text-decoration: none;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}

.tool-subnav-tabs a:hover {
    background: rgba(0,47,108,0.07);
    color: var(--color-primary);
}

.tool-subnav-tabs a.active {
    border-bottom-color: var(--color-accent);
    font-weight: 600;
    color: var(--color-primary);
}


/* ---- Page wrapper ---- */
.page-wrapper {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
    /* Sit to the right of the fixed desktop sidebar (reset on mobile) */
    margin-left: var(--sidebar-width);
}

/* ---- Main content area ---- */
.main-content {
    flex: 1;
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

@media (max-width: 600px) {
    .main-content { padding: 1.25rem 1rem; }
}

/* ---- Footer ---- */
.site-footer {
    background: var(--color-primary);
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    padding: 1rem 1.5rem;
    text-align: center;
}

/* ---- Auth layout (login/access-denied) ---- */
.auth-layout {
    min-height: 100vh;
    background: var(--color-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-bottom: 1.75rem;
}

.auth-brand .logo-text {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
}

.auth-tagline {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

/* ---- Dashboard cards ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.dashboard-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.dashboard-card-title {
    font-family: var(--font-header);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}
.dashboard-empty-state {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-style: italic;
    text-align: center;
    padding: 1.5rem 0;
}

/* ---- Public landing tool cards ---- */
.tool-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}
.tool-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.tool-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
    text-decoration: none;
    color: inherit;
}
.tool-card h3 { color: var(--color-primary); }
.tool-card p  { color: var(--color-text-muted); font-size: 0.875rem; flex: 1; }
.tool-card-icon { font-size: 2rem; line-height: 1; }

.tool-card--inactive {
    opacity: 0.72;
    cursor: default;
}
.tool-card--inactive:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-border);
}
.tool-card--inactive h3 { color: var(--color-text-muted); }

/* Badge row: a card can carry both a tier badge and "Coming Soon". */
.tool-cards-grid .tool-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-self: flex-start;
    margin: 0 0 0.25rem;
}

.tool-card-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-primary);
    background: var(--color-primary-light);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.175rem 0.55rem;
}

/* Which tier a tool belongs to. Deliberately quieter than the "Coming Soon" badge and than the
   pillar heading — it's a footnote, not the card's headline. */
.tool-card-badge--tier {
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
    font-weight: 600;
}

.tool-card-cta { align-self: flex-start; }
.tool-card-cta--disabled { opacity: 0.5; }

/* ---- Dashboard: advice pillar sections ---- */
.pillar-section {
    margin: 0 0 2.5rem;
}
/* Tucks under .section-heading's own 2rem/1rem margins. */
.pillar-section-blurb {
    margin: -0.5rem 0 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}
.pillar-section-empty {
    margin: 0 0 1rem;
    padding: 1.25rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-style: italic;
}
.dashboard-signin-note {
    margin: 0 0 1rem;
    padding: 1rem 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* ---- Admin: Tool Management table ---- */
.tool-catalog-status { margin: 0 0 1rem; }
.table-scroll { overflow-x: auto; }
.cell-center { text-align: center; }
.cell-subtext {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.table-note {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.form-select-sm {
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    min-width: 7rem;   /* fit "Advisor" + the chevron; the pillars column competes for width */
}
.checkbox-inline { width: auto; }
/* Lays the shared .checkbox-label controls out as a wrapping row. The labels themselves keep the
   site-wide checkbox styling — only the arrangement is local to this table. */
.pillar-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.5rem;
    margin: 0;
}
.pillar-checkbox-group .checkbox-label { white-space: nowrap; }

/* ---- Responsive nav ---- */

/* The checkbox itself is always invisible — it's only a state carrier for the CSS sibling selector */
.nav-toggle-cb {
    display: none;
    position: absolute;
    pointer-events: none;
    opacity: 0;
}

/* Hamburger label: hidden on desktop */
.nav-toggle-btn {
    display: none;
}

@media (max-width: 768px) {
    /* A 135px bar is too tall on phones — use a compact header on small screens. */
    :root {
        --nav-height: 84px;
    }

    /* Keep header at its normal fixed height — the nav floats below it as an overlay */
    .top-nav {
        height: var(--nav-height);
        padding: 0 1rem;
        overflow: visible;
    }

    /* Logo takes available space, pushing actions + hamburger to the right */
    .top-nav .brand-logo {
        flex: 1;
    }

    /* Scale the logo to the compact mobile header, preserving aspect (no distortion). */
    .top-nav .brand-logo-img {
        width: auto;
        height: calc(var(--nav-height) - 1.25rem);
        max-width: 60vw;
    }

    /* Reduce gap on mobile */
    .top-nav .nav-actions {
        margin-left: 0;
        gap: 0.5rem;
    }

    /* Hide the username on mobile — too cramped alongside Sign Out + hamburger */
    .top-nav .nav-actions .nav-username {
        display: none;
    }

    /* Hamburger button: visible on mobile */
    .nav-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        color: rgba(255, 255, 255, 0.9);
        font-size: 1.35rem;
        border-radius: var(--radius);
        cursor: pointer;
        user-select: none;
        flex-shrink: 0;
        margin-left: 0.375rem;
        transition: background 0.15s;
    }
    .nav-toggle-btn:hover {
        background: rgba(255, 255, 255, 0.12);
    }

    /* Nav hidden by default; absolutely positioned so it overlays content below the header.
       The width/bottom/overflow/border-right resets neutralize the desktop sidebar props. */
    .top-nav nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        bottom: auto;
        width: auto;
        flex-direction: column;
        gap: 0;
        background: var(--color-primary);
        border-top: 1px solid rgba(255, 255, 255, 0.18);
        border-right: none;
        overflow: visible;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
        padding: 0.375rem 0 0.625rem;
    }

    /* Checkbox checked → dropdown opens (~ requires input before nav in the DOM) */
    .nav-toggle-cb:checked ~ nav {
        display: flex;
    }

    /* Full-width tappable nav links on mobile */
    .top-nav nav a {
        padding: 0.6875rem 1rem;
        border-radius: 0;
        width: 100%;
        white-space: nowrap;
    }

    /* No sidebar on mobile → content spans full width */
    .tool-subnav,
    .page-wrapper {
        margin-left: 0;
    }

    /* Sub-nav: drop the tool-name label and tighten padding so the tab strip gets the
       full width. Tabs scroll horizontally (swipe) if they still don't all fit; the
       tool name is already shown in the page <h1> below. */
    .tool-subnav-inner {
        padding: 0 1rem;
        gap: 0;
    }
    .tool-subnav-label {
        display: none;
    }
}

/* ================================================================
   WIZARD SHARED ADDITIONS
   Classes used by Estate Planning, New Client, and other wizard
   tools that weren't in the original site.css.
   ================================================================ */

/* ---- Section headings with inline InfoTip ---- */
.wizard-step-body h3 {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-primary);
    font-size: 1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

/* ---- Field label that can contain an inline InfoTip ---- */
.field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ---- Multi-column field rows ---- */
.field-row--two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0;
}

.field-row--three-col,
.field-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0;
}

@media (max-width: 560px) {
    .field-row--two-col,
    .field-row--three-col,
    .field-row-3 { grid-template-columns: 1fr; }
}

/* ---- Hint text inside a form field label (appears between label text and input) ---- */
.field-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-muted);
    margin: 0;
    line-height: 1.4;
}

/* ---- Currency / prefixed input wrapper ---- */
.input-prefix {
    display: flex;
    align-items: center;
    gap: 0;
}
.input-prefix span {
    display: inline-flex;
    align-items: center;
    padding: 0 0.6rem;
    height: 2.25rem;
    background: var(--color-surface-alt, #f0f2f5);
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 0.9rem;
    color: var(--color-muted);
    font-weight: 600;
    white-space: nowrap;
}
.input-prefix input {
    border-radius: 0 var(--radius) var(--radius) 0;
    flex: 1;
    min-width: 0;
}

/* ---- Required field marker ---- */
.required-mark,
.required {
    color: var(--color-negative);
    font-size: 1em;
    margin-left: 0.1rem;
    font-weight: 700;
}

/* ---- Validation messages (Blazor ValidationMessage component) ---- */
.validation-message {
    display: block;
    color: var(--color-negative);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.2rem;
}

/* Option groups carry a 1rem bottom margin to separate them from whatever follows. When the thing
   that follows is this field's own validation message, that gap reads as a detached error — the
   message should sit as close under a radio list as it does under a text input. */
.radio-group:has(+ .validation-message),
.checkbox-group:has(+ .validation-message) {
    margin-bottom: 0;
}

/* ---- Input with adjacent action button (e.g. SSN reveal) ---- */
.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.input-with-action input { flex: 1; }

/* Compact button sitting inside an .input-with-action row, where a full-size button would
   dwarf the field it belongs to. */
.btn-inline {
    white-space: nowrap;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    text-decoration: underline;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-link:hover { color: var(--color-primary-dark); }

/* ---- Explicit classed inputs (for components that can't rely on tag selectors) ---- */
.input-text {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-surface);
    width: 100%;
}
.input-number { text-align: right; font-variant-numeric: tabular-nums; }

/* ================================================================
   METADATA-DRIVEN QUESTIONNAIRE RENDERER
   Layout for the generic engine (QuestionnaireRunner / QuestionField).
   Dedicated classes so the renderer doesn't depend on the base
   `label { flex-direction: column }` caption pattern.
   ================================================================ */
.q-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem 1.5rem;
    margin-top: 0.5rem;
}
.q-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    min-width: 0;                 /* let inputs shrink within the grid track */
}
.q-field--full { grid-column: 1 / -1; }

/* Left-aligned caption (label text + required mark + InfoTip), one line */
.q-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    text-align: left;
}
.q-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin: 0;
}
/* Nested grid for repeating-group sub-forms */
.q-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.9rem;
    background: var(--color-surface);
}
.q-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.q-item-head strong { color: var(--color-primary); font-size: 0.9rem; }

/* Titled card grouping related questions within a section (GroupKey run) */
.q-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.9rem;
    box-shadow: var(--shadow-card);
}
.q-card-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

@media (max-width: 640px) {
    .q-grid { grid-template-columns: 1fr; }
}

/* Onboarding intro gate (QuestionnaireRunner IntroContent) */
.wizard-intro {
    padding: 2rem 2rem 1.25rem;
}
.intro-lead {
    color: var(--color-text-muted);
    line-height: 1.7;
    margin: 0 0 1.25rem;
}
.intro-list {
    margin: 0.75rem 0 1.25rem;
    padding-left: 1.25rem;
    line-height: 1.7;
    color: var(--color-text);
}
.intro-list li { margin-bottom: 0.35rem; }
.intro-subhead {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 1.25rem 0 0.5rem;
}

/* ---- Indent (sub-sections inside directive cards) ---- */
.indent {
    padding-left: 1.5rem;
    border-left: 2px solid var(--color-border);
    margin-top: 0.75rem;
}

/* ---- Block radio option (bordered, full-width) ---- */
.radio-label--block {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    margin-bottom: 0.5rem;
}
.radio-label--block:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}
.radio-label--block input { margin-top: 0.125rem; flex-shrink: 0; }

/* ---- Small button variants ---- */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}
.btn-danger-sm {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.775rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-negative);
    border: 1px solid var(--color-negative);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-danger-sm:hover { background: var(--color-negative-bg); }

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid currentColor;
}
.badge-auto {
    color: var(--color-positive);
    background: var(--color-positive-bg);
    border-color: #bbf7d0;
}

/* ================================================================
   FILE UPLOAD ZONE
   Drag-and-drop upload area used by Estate Planning Document Upload.
   ================================================================ */

.upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 2.25rem 1.5rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}
.upload-zone:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}
.upload-zone--dragging {
    border-color: var(--color-primary);
    background: #eef4ff;
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.upload-zone__label {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}
.upload-zone__label .upload-icon {
    font-size: 2.75rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.upload-zone__label strong {
    color: var(--color-text);
    font-size: 1.025rem;
}
.upload-zone__label .browse-link {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 600;
    pointer-events: all;
    cursor: pointer;
}

/* The actual <input type="file"> sits over the entire zone, invisible */
.upload-zone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

/* ---- Uploaded file list ---- */
.upload-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.upload-list__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}
.upload-list__icon { flex-shrink: 0; font-size: 1.1rem; line-height: 1; }
.upload-list__name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-list__size { color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0; font-size: 0.8rem; }
.upload-list__category { flex-shrink: 0; }

.btn-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    transition: color 0.12s, background 0.12s;
}
.btn-remove:hover { color: var(--color-negative); background: var(--color-negative-bg); }

/* ================================================================
   DIRECTIVE CARD (Health Care Directives)
   ================================================================ */

.directive-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.directive-card > h3:first-child { margin-top: 0; }

/* ================================================================
   ATTORNEY CHECKLIST
   ================================================================ */

.checklist-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--color-border);
}
.checklist-row:last-child { border-bottom: none; }
.checklist-row .checkbox-label { flex: 1; font-weight: 400; margin-bottom: 0; }
.checkbox-label--auto { color: var(--color-positive); }
.checklist-notes {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
    font-weight: 400;
}

/* ---- Document upload checklist ---- */
.document-checklist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.document-checklist__section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.document-checklist__heading {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}
.document-checklist__list {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}
.document-checklist__list li {
    font-size: 0.875rem;
    color: var(--color-text);
    padding: 0.2rem 0;
    font-weight: 400;
}
@media (max-width: 640px) {
    .document-checklist { grid-template-columns: 1fr; }
}

/* ================================================================
   ASSET SUMMARY
   ================================================================ */

.asset-entry {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}
.asset-entry:last-child { border-bottom: none; }

/* ================================================================
   ADVISORY TEAM
   ================================================================ */

.advisor-entry {
    padding: 0.75rem 0;
}
.advisor-divider {
    border: none;
    border-top: 1px dashed var(--color-border);
    margin: 0.5rem 0;
}

/* ================================================================
   REPRESENTATIVE / PERSON CARDS
   ================================================================ */

.rep-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-card);
}
.rep-card__role {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

/* ================================================================
   REVIEW STEP
   ================================================================ */

.review-section {
    margin-bottom: 1.5rem;
}
.review-section > h3 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius);
    margin-top: 0;
    margin-bottom: 0.625rem;
    display: block; /* override flex from .wizard-step-body h3 */
}

.review-dl {
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 0.25rem 0.75rem;
    font-size: 0.875rem;
}
.review-dl dt {
    color: var(--color-text-muted);
    font-weight: 600;
    padding: 0.2rem 0;
}
.review-dl dd {
    color: var(--color-text);
    padding: 0.2rem 0;
    margin: 0;
}
/* Full-width section band within the review grid (must span both columns, or it offsets the
   following label/value pairs into the wrong cells). */
.review-dl .review-section-header {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 0.4rem 0.625rem;
    border-radius: var(--radius);
    margin: 1rem 0 0.375rem;
}
.review-dl .review-section-header:first-child { margin-top: 0; }

/* Full-width sub-header for a titled group within the review list */
.review-dl .review-group-header {
    grid-column: 1 / -1;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    margin-top: 0.5rem;
}

.review-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}
.review-list li {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}
.review-list li:last-child { border-bottom: none; }

/* ================================================================
   RESULT PANEL
   Shared layout for tools that show a computed outcome (Risk
   Assessment, future scored tools). Vertical rhythm comes from the
   panel — children never need their own stacking margins.
   ================================================================ */
.result-panel {
    padding: 1.5rem 2rem 1.75rem;
}
.result-panel > * + * { margin-top: 1.25rem; }
.result-panel .alert { margin-top: 1.25rem; } /* keep rhythm consistent with stacked siblings */

.result-lead {
    font-size: 1.15rem;
    margin: 0;
}

/* Accent-bordered outcome card; set --result-accent via a modifier class */
.result-card {
    border: 2px solid var(--result-accent, var(--color-primary));
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
}
.result-card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--result-accent, var(--color-primary));
}
.result-card-badge {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    background: var(--result-accent, var(--color-primary));
    border-radius: var(--radius);
    padding: 0.15rem 0.5rem;
}
.result-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin: 0.75rem 0 1rem;
}
.result-card-description {
    margin: 0;
    line-height: 1.6;
}

/* Horizontal band scale (e.g. the five-objective risk spectrum) */
.spectrum {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 6px;
}
.spectrum-band {
    background: var(--result-accent, var(--color-primary));
    color: #fff;
    text-align: center;
    padding: 0.75rem 0.375rem;
    border-radius: var(--radius);
    opacity: 0.4;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.spectrum-band--active {
    opacity: 1;
    outline: 3px solid var(--color-text);
    outline-offset: 1px;
}
.spectrum-abbr  { font-weight: 700; font-size: 1rem; }
.spectrum-label { font-size: 0.8rem; }
@media (max-width: 640px) {
    .spectrum-label { display: none; } /* abbreviations still identify bands on narrow phones */
}

/* Compliance / educational disclosure box */
.disclosure-note {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Investment-objective accent colors (mirror InvestmentObjectiveExtensions.ToCssColor) */
.objective--icp { --result-accent: #1B5E20; }
.objective--img { --result-accent: #388E3C; }
.objective--gwi { --result-accent: #8B8000; }
.objective--g   { --result-accent: #E65100; }
.objective--ag  { --result-accent: #B71C1C; }


/* ---- Modal overlay (shared; first consumer: the welcome-video popup) ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.55);
}
.modal-panel {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    width: 100%;
    max-width: 540px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.modal-panel--video { max-width: 760px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { margin: 0; color: var(--color-primary); }
.modal-close {
    border: none;
    background: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
}
.modal-close:hover { color: var(--color-text); }
.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}
.modal-intro { margin-bottom: 1rem; color: var(--color-text-muted); }
.modal-video {
    display: block;
    width: 100%;
    max-height: 60vh;
    border-radius: var(--radius);
    background: #000;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

/* Small action link inside a .page-header (e.g. "Watch the platform tour"). */
.page-header-action {
    border: none;
    background: none;
    margin-top: 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
}
.page-header-action:hover { color: var(--color-primary-dark); }


/* ================================================================
   DOCUMENT GRAPHICS (FirmTools.UI SVG chart components)
   Static, print-first visuals — inline SVG, no canvas/JS, so they
   are in the DOM before window.print() and colors print exactly.
   All fills come from the --chart-* brand tokens (brand.css).
   First consumer: the One Page Financial Snapshot.
   ================================================================ */

/* ---- Donut (SvgDonutChart) ---- */
.donut-chart {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
}
.donut-stack { display: grid; flex: 0 0 auto; }
.donut-stack > * { grid-area: 1 / 1; }
.donut-svg { display: block; width: 100%; height: auto; }
.donut-center {
    align-self: center;
    justify-self: center;
    text-align: center;
    /* keep the hero content inside the ring */
    max-width: 70%;
}
.donut-seg { fill: none; }
.donut-seg--1 { stroke: var(--chart-cat-1); }
.donut-seg--2 { stroke: var(--chart-cat-2); }
.donut-seg--3 { stroke: var(--chart-cat-3); }
.donut-seg--4 { stroke: var(--chart-cat-4); }
.donut-seg--5 { stroke: var(--chart-cat-5); }
.donut-seg--other { stroke: var(--chart-other); }
.donut-seg--empty { stroke: var(--color-border); }

/* Legend shared by the chart components: swatch + label + value rows.
   Text wears text tokens; the swatch alone carries series identity. */
.chart-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
    flex: 1 1 auto;
    min-width: 0;
}
.chart-legend li {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.12rem 0;
}
.chart-legend-swatch {
    flex: 0 0 auto;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 2px;
    align-self: center;
}
.chart-legend--1 { background: var(--chart-cat-1); }
.chart-legend--2 { background: var(--chart-cat-2); }
.chart-legend--3 { background: var(--chart-cat-3); }
.chart-legend--4 { background: var(--chart-cat-4); }
.chart-legend--5 { background: var(--chart-cat-5); }
.chart-legend--other { background: var(--chart-other); }
.chart-legend-label {
    color: var(--color-text);
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
}
.chart-legend-value {
    margin-left: auto;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

/* ---- Liquidity spectrum bar (LiquiditySpectrumBar) ----
   One proportional stacked SVG bar, then a three-column caption grid.
   Sequential navy ramp: ST light → LT dark (term/yield increases). */
.spectrum-bar { margin: 0.75rem 0; }
.spectrum-bar-svg {
    display: block;
    width: 100%;
    height: 2.25rem;
    border-radius: var(--radius);
}
.spectrum-seg--st { fill: var(--chart-seq-1); }
.spectrum-seg--mt { fill: var(--chart-seq-2); }
.spectrum-seg--lt { fill: var(--chart-seq-3); }
.spectrum-seg--empty { fill: var(--color-surface-muted); }
.spectrum-bar-legend {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 0.625rem;
}
.spectrum-bar-tier { min-width: 0; }
.spectrum-bar-tier-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text);
}
.spectrum-bar-amount {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}
.spectrum-bar-caption {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    line-height: 1.35;
}
/* "≈ N months of expenses" runway line under the short-term caption. */
.spectrum-bar-runway {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 0.15rem;
}

/* ---- Cash-flow waterfall (SvgWaterfallChart) ---- */
.waterfall-chart { margin: 0.75rem 0; }
.waterfall-svg { display: block; width: 100%; height: auto; }
.waterfall-bar--income { fill: var(--chart-seq-3); }
.waterfall-bar--expense { fill: var(--color-negative); opacity: 0.82; }
.waterfall-bar--net-pos { fill: var(--color-positive); }
.waterfall-bar--net-neg { fill: var(--color-negative); }
.waterfall-connector {
    stroke: var(--color-border);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}
.waterfall-value {
    font-family: var(--font-header);
    font-size: 11px;
    font-weight: 600;
    fill: var(--color-text);
}
.waterfall-label {
    font-family: var(--font-body);
    font-size: 10px;
    fill: var(--color-text-muted);
}
.waterfall-baseline { stroke: var(--color-border); stroke-width: 1; }

/* ---- Trend sparkline (SvgSparkline) ---- */
.sparkline { width: 12rem; margin-top: 0.25rem; }
.sparkline-caption {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.1rem;
}
.sparkline-svg { display: block; width: 100%; height: auto; }
.sparkline-line {
    fill: none;
    stroke: var(--chart-seq-2);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.sparkline-dot { fill: var(--color-accent); stroke: var(--color-surface); stroke-width: 1; }
.sparkline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

/* ---- Trend badge (DeltaBadge) ---- */
.delta-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    font-family: var(--font-header);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius);
    padding: 0.1rem 0.45rem;
    white-space: nowrap;
}
.delta-badge--up { color: var(--color-positive); background: var(--color-positive-bg); }
.delta-badge--down { color: var(--color-negative); background: var(--color-negative-bg); }
.delta-badge--flat { color: var(--color-text-muted); background: var(--color-surface-muted); }
.delta-badge-context {
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

/* ---- Insurance coverage tile (CoverageTile) ----
   Status is never color-alone: the pill carries an icon glyph + the word. */
.coverage-tile {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.55rem 0.7rem;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.coverage-tile-type {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.coverage-tile-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.08rem 0.5rem;
}
.coverage-status--covered { color: var(--color-positive); background: var(--color-positive-bg); }
.coverage-status--gap { color: var(--color-negative); background: var(--color-negative-bg); }
.coverage-status--review { color: var(--color-caution); background: var(--color-caution-bg); }
.coverage-tile-figure {
    font-family: var(--font-header);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}
.coverage-tile-carrier,
.coverage-tile-notes {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ================================================================
   ONE PAGE FINANCIAL SNAPSHOT
   The printable one-pager sheet (SnapshotView) and its data-entry
   and household-list helpers. Print sizing lives in print.css.
   ================================================================ */

/* ---- The sheet: a paper-shaped grid, same DOM on screen and print ---- */
.snapshot-sheet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "networth networth"
        "liquidity liquidity"
        "cashflow insurance"
        "debt investments";
    gap: 0.875rem;
    max-width: 8in;
    margin: 0 auto 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
}
@media (max-width: 720px) {
    .snapshot-sheet {
        grid-template-columns: 1fr;
        grid-template-areas: "networth" "liquidity" "cashflow" "insurance" "debt" "investments";
    }
}
.area-networth { grid-area: networth; }
.area-liquidity { grid-area: liquidity; }
.area-cashflow { grid-area: cashflow; }
.area-insurance { grid-area: insurance; }
.area-debt { grid-area: debt; }
.area-investments { grid-area: investments; }

.snapshot-section {
    border-top: 2px solid var(--color-primary);
    padding-top: 0.5rem;
    min-width: 0;
}
.snapshot-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    margin-bottom: 0.375rem;
}
.snapshot-section-figure {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    color: var(--color-text-muted);
}

/* Net worth hero + donut */
.snapshot-networth-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1rem;
    align-items: center;
}
@media (max-width: 560px) { .snapshot-networth-grid { grid-template-columns: 1fr; } }
.snapshot-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
}
.snapshot-hero-value {
    font-family: var(--font-header);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-primary);
}
.snapshot-hero-sub { font-size: 0.8rem; color: var(--color-text-muted); }
.snapshot-donut-center-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.snapshot-cashflow-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.snapshot-note { font-size: 0.75rem; color: var(--color-text-muted); margin: 0.3rem 0 0; }

.coverage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.snapshot-debt-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0;
}
.snapshot-debt-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}
.snapshot-debt-list dt { font-size: 0.85rem; font-weight: 600; }
.snapshot-debt-list dd {
    margin: 0;
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
}
.snapshot-debt-bad { color: var(--color-negative); }

/* Full-width advisor talking-points section at the foot of the sheet. Auto-placed
   (grid-column span) rather than a named area so no empty row appears when absent. */
.snapshot-focus { grid-column: 1 / -1; }
.snapshot-focus-text {
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-line;
    margin: 0;
}

.snapshot-invest-bar {
    display: block;
    width: 100%;
    height: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.invest-seg--r { fill: var(--chart-cat-1); }
.invest-seg--nr { fill: var(--chart-cat-2); }

/* ---- Optional second print page (projections / proposed repositioning) ---- */
.snapshot-extras-toggle {
    max-width: 8in;
    margin: 0 auto 1rem;
}
.snapshot-extra-page {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    max-width: 8in;
    margin: 0 auto 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
}
.snapshot-proposal-row {
    display: grid;
    grid-template-columns: 5.5rem 1fr 7rem;
    align-items: center;
    gap: 0.75rem;
    margin: 0.4rem 0;
}
.snapshot-proposal-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text);
}
.snapshot-proposal-bar { height: 1.75rem; }
.snapshot-proposal-total {
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
    text-align: right;
    white-space: nowrap;
}
/* Per-tier move amount under the proposal bars — deliberately neutral ink (a shift is a
   discussion point, not a good/bad outcome, so no positive/negative coloring). */
.snapshot-proposal-shift {
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.snapshot-projection-total td {
    font-weight: 700;
    border-top: 2px solid var(--color-primary);
}
.snapshot-projection-income td {
    font-weight: 600;
    color: var(--color-primary);
}
/* Band separating the "as positioned today" and "with the proposed repositioning" blocks. */
.snapshot-projection-band td {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    background: var(--color-primary-light);
    border-bottom: none;
}
/* The punchline row: added potential income from repositioning. A proposal that trades
   income for access (more short-term) legitimately shows a negative — never paint it green. */
.snapshot-projection-diff td {
    font-weight: 700;
    color: var(--color-positive);
    border-top: 1px solid var(--color-border);
}
.snapshot-projection-diff td.snapshot-diff-negative { color: var(--color-negative); }

/* ---- On-screen toolbar above the sheet ---- */
.snapshot-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.snapshot-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.snapshot-toolbar-actions select { width: auto; }
.snapshot-draft-pill {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--color-caution);
    background: var(--color-caution-bg);
    border: 1px solid var(--color-caution);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    vertical-align: middle;
}

/* ---- Entry page ---- */
.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.card-title-row .card-title { margin-bottom: 0; }
.entry-subtotal {
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-light);
    border-radius: var(--radius);
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}
.entry-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1rem;
}
@media (max-width: 860px) { .entry-columns { grid-template-columns: 1fr; } }
.entry-column-title {
    font-size: 0.9rem;
    color: var(--color-primary);
    margin: 0.5rem 0;
}
.entry-status { display: flex; flex-direction: column; gap: 0.2rem; }
.entry-credit-note { margin-top: 1rem; }
.entry-saved-notice {
    text-align: right;
    color: var(--color-positive);
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}
.card > .btn { margin-top: 0.625rem; }

/* ---- Table cell helpers (shared) ---- */
.cell-right { text-align: right; }
.cell-center { text-align: center; }
.cell-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---- Household list ---- */
.household-create {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.household-create label { flex: 1 1 260px; margin-bottom: 0; }
.household-create .btn { margin-bottom: 1px; }
.history-row td {
    background: var(--color-surface-muted);
    font-size: 0.82rem;
}
