/* ═══════════════════════════════════════════════════════════════════════════
   SLA Partner Portal — Design System
   Navy (#0E1F3D) + Gold (#B8870A) | Playfair Display + DM Sans + DM Mono
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Tokens --- */
:root {
    --navy:       #0E1F3D;
    --navy-light: #1A2F52;
    --navy-dark:  #091528;
    --gold:       #B8870A;
    --gold-light: #D4A017;
    --gold-dim:   #8A6508;
    --white:      #FFFFFF;
    --off-white:  #F7F5F0;
    --gray-100:   #F0EDE6;
    --gray-200:   #E0DCD3;
    --gray-300:   #C4BFB3;
    --gray-400:   #9E9787;
    --gray-500:   #6E685C;
    --gray-600:   #4A4539;
    --red:        #C0392B;
    --green:      #1B6B3A;
    --blue:       #1155AA;

    /* Four-moment colors */
    --understand: #1D4ED8;
    --plan:       #C9A227;
    --create:     #C2410C;
    --deploy:     #0D9488;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:    'DM Mono', 'Menlo', monospace;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-sm: 0 1px 3px rgba(14,31,61,0.08);
    --shadow-md: 0 4px 12px rgba(14,31,61,0.10);
    --shadow-lg: 0 8px 24px rgba(14,31,61,0.14);

    --transition: 150ms ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-body);
    color: var(--navy);
    background: var(--off-white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--gold-dim); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold); }
img { max-width: 100%; display: block; }

/* --- Typography --- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
.mono { font-family: var(--font-mono); }

/* --- Navigation — LEFT SIDEBAR (Apr 19 2026 Jobs pass) ---
   240px fixed sidebar on the left. Main content shifts right.
   Wordmark + gold rule at top. Primary links vertical. Section label
   "More" below primary. User + sign-out at bottom (always pinned — nav-inner
   scrolls internally so the footer never disappears behind long nav lists). */
.nav {
    background: var(--navy);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(14,31,61,0.08);
    overflow-y: hidden;   /* nav-inner scrolls; footer stays pinned */
    display: flex;
    flex-direction: column;
}
.nav-inner {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;        /* allow flex item to shrink so footer stays visible */
    flex: 1;
    padding: 2rem 1.5rem 1.5rem;
    gap: 0.5rem;
}
.nav-brand {
    display: block;
    color: var(--white);
    font-family: var(--font-display);
    text-decoration: none;
    margin-bottom: 2rem;
    line-height: 1.15;
}
.nav-brand:hover { color: var(--gold-light); }
/* Gold hexagon emblem — the identity mark carried over from the cowork
   version. Pointy-top hex via clip-path, filled with gold. 40px square. */
.nav-hex {
    display: block;
    width: 40px;
    height: 40px;
    background: var(--gold);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    margin-bottom: 1rem;
}
.nav-wordmark {
    display: block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--white);
    line-height: 1.15;
}
.nav-tagline {
    display: block;
    margin-top: 0.35rem;
    font-family: var(--font-body);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    line-height: 1.35;
}
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}
.nav-link {
    color: rgba(255,255,255,0.78);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    display: block;
    text-decoration: none;
    border-left: 2px solid transparent;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,0.06); }
.nav-link.active {
    color: var(--gold-light);
    background: rgba(184,135,10,0.12);
    border-left-color: var(--gold);
}
.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.78);
    margin: 1.25rem 0 0.4rem 0.8rem;
    font-weight: 600;
}
/* D56 — sticky state context selector (base.html, above nav-links) */
.nav-state-ctx {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.9rem 0.8rem 0.2rem 0.8rem;
}
.nav-state-ctx label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}
.nav-state-ctx select {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--white);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
}
.nav-state-ctx select:focus { outline: 1px solid var(--gold); }
.nav-state-ctx select option { color: #1F3864; background: #fff; }

.nav-link-small {
    font-size: 0.82rem;
    padding: 0.4rem 0.8rem;
    color: rgba(255,255,255,0.6);
}
.nav-link-small:hover { color: var(--white); background: rgba(255,255,255,0.04); }
.nav-link-small.active {
    color: var(--gold-light);
    background: rgba(184,135,10,0.10);
    border-left-color: var(--gold);
}
/* "More ▸" disclosure (D50) — collapses deep/diagnostic pages. The <summary>
   is styled to read like a .nav-section-label, with a caret that flips on open. */
.nav-more { margin-top: 0.25rem; }
.nav-more > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.78);
    font-weight: 600;
    margin: 1.25rem 0 0.4rem 0.8rem;
    user-select: none;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: " \25B8"; }      /* ▸ */
.nav-more[open] > summary::after { content: " \25BE"; } /* ▾ */
.nav-more > summary:hover { color: rgba(255,255,255,0.6); }
.nav-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 1rem 1.5rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;   /* always pinned to bottom of sidebar */
}
.nav-footer .nav-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.nav-footer a { color: rgba(255,255,255,0.6); text-decoration: none; }
.nav-footer a:hover { color: var(--gold-light); }

/* Mobile nav toggle — hides sidebar, shows hamburger below 900px */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: var(--navy);
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--white);
    border-radius: 1px;
    transition: all var(--transition);
}

@media (max-width: 900px) {
    .nav {
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .nav.open { transform: translateX(0); }
    .nav-toggle {
        display: flex;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 101;
        border-radius: var(--radius-sm);
    }
    .main { margin-left: 0 !important; }
}

/* WP-H (2026-07-15): the Page Context Bar (.page-ctx) bleeds to the screen
   edge (negative margins above) and its flex-wrapped stat chips have no
   phone-width layout of their own — live-verified at 375px on
   /state-report: the state-abbr circle sits directly under the fixed
   hamburger (.nav-toggle, top:1rem;left:1rem; from the 900px block above)
   and the 5 stat chips wrap into a cramped, hard-to-scan cluster. Give the
   bar room to clear the hamburger and stack its stats as a clean vertical
   list at phone widths, rather than a tight horizontal wrap. */
@media (max-width: 480px) {
    .page-ctx {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 3.25rem;   /* clears the fixed hamburger button */
        gap: 0.5rem;
    }
    .page-ctx-stats {
        width: 100%;
        gap: 0.6rem 1.5rem;
    }
    .page-ctx-moment { align-self: flex-start; }
}

/* --- Main Content (shifted right by sidebar width) ---
   Remove the max-width cap: main uses whatever remains after the 240px
   sidebar. Prior max-width:1240px was clipping the 4th stat card on
   wider viewports. */
.main {
    margin-left: 240px;
    padding: 2rem 2.25rem;
}

/* --- Home (map landing page) — compact header so map fits above fold --- */
.home-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 2rem;
    row-gap: 0.25rem;
    align-items: start;
    margin-bottom: 1.25rem;
}
.home-header h1 {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    grid-column: 1;
    grid-row: 1;
    color: var(--navy);
}
.home-sub {
    margin: 0;
    color: var(--gray-500);
    font-size: 0.9rem;
    grid-column: 1;
    grid-row: 2;
}
.home-stats {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    justify-self: end;
    align-self: center;
}
.home-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.home-stat-val {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.1;
}
.home-stat-label {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-top: 0.2rem;
}
.home-stat-divider {
    width: 1px;
    height: 30px;
    background: var(--gray-200);
}
.home-map-wrap {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(14,31,61,0.04);
}
#home-map {
    /* Fills remaining viewport: 100vh minus top padding, header block, map card padding */
    height: calc(100vh - 230px);
    min-height: 360px;
}
.main-fullscreen {
    max-width: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Footer --- */
.footer {
    background: var(--navy);
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 1.25rem;
    font-size: 0.8rem;
    margin-top: auto;
}
.footer a { color: var(--gold); }

/* --- Cards --- */
/* ── Expandable question text (Issue Landscape, State Report) ─────────────── */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary span[style*="▾"] { transform: rotate(180deg); display:inline-block; }

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h2, .card-header h3 { margin: 0; }
.card-gold { border-left: 4px solid var(--gold); }

/* --- Page Header --- */
.page-header {
    margin-bottom: 2rem;
}
.page-header h1 {
    margin-bottom: 0.5rem;
}
.page-header p {
    color: var(--gray-500);
    font-size: 1rem;
    max-width: 700px;
}

/* --- Filters Bar --- */
.filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filter-select {
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--navy);
    cursor: pointer;
    transition: border-color var(--transition);
}
.filter-select:hover { border-color: var(--gold); }
.filter-select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,135,10,0.2); }

/* --- Toggle Buttons (mode switcher) --- */
.toggle-group {
    display: inline-flex;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.toggle-btn {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border: none;
    background: var(--white);
    color: var(--gray-500);
    cursor: pointer;
    transition: all var(--transition);
}
.toggle-btn:hover { background: var(--gray-100); color: var(--navy); }
.toggle-btn.active { background: var(--navy); color: var(--white); }

/* --- Stat Cards (home page) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    text-align: center;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
thead { background: var(--navy); color: var(--white); }
th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}
tbody tr:hover { background: rgba(184,135,10,0.04); }

/* --- Badges (Tier, State) --- */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-entry       { background: #E8F4E8; color: #1B6B3A; }
.badge-bridge      { background: #E8EEF8; color: #1155AA; }
.badge-downstream  { background: #F0E8F5; color: #5B1B8A; }
.badge-destination { background: #FFF3D6; color: #8A6508; }
.badge-gauge       { background: #F5E8E8; color: #8B1A1A; }

/* D35 — cross-state ("Modeled") estimate badges. `.badge-modeled` marks a
   row estimated from multi-state data; `.badge-modeled-limited` is the
   visually-distinct, more-cautious variant for demographic-only inference
   (single surveyed state's demographic pattern applied to the target
   state). Both carry a native title-attribute tooltip — no JS required. */
.badge-modeled         { background: #EAE3F5; color: #5B3A9E; cursor: help; border-bottom: 1px dotted #5B3A9E; }
.badge-modeled-limited { background: #FBE9D9; color: #9A4A0A; cursor: help; border-bottom: 1px dotted #9A4A0A; }

.moe-tag {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--gray-400);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
}

/* --- Support Bar (inline horizontal bar) --- */
.support-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--gray-100);
}
.support-bar-fill {
    background: var(--gold);
    transition: width 300ms ease;
}
.support-pct {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--navy);
}

/* --- Chart Container --- */
.chart-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}
.chart-container .js-plotly-plot { width: 100% !important; }

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }

/* --- Login Page --- */
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}
.login-box {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 3rem 2.75rem 2.5rem;
    box-shadow: 0 1px 2px rgba(14,31,61,0.04), 0 12px 32px -12px rgba(14,31,61,0.12);
    border: 1px solid var(--gray-200);
}
.login-brand {
    text-align: center;
    margin-bottom: 2.25rem;
}
/* Thin gold hairline — the single craft detail that signals this is a made
   thing, not a template. 1px × 48px, centered above the wordmark. */
.login-rule {
    display: block;
    width: 48px;
    height: 2px;
    background: var(--gold);
    margin: 0 auto 1.25rem;
    border-radius: 1px;
}
.login-wordmark {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: -0.015em;
    line-height: 1.1;
    margin: 0;
}
/* Legacy .login-brand-icon / .login-brand h1 / .login-brand p / .login-subline
   removed Apr 19 2026. The gold rectangle was a placeholder; the subline was
   dead weight. Identity now carried entirely by the wordmark + gold rule. */
.password-wrap {
    position: relative;
}
.password-wrap .form-input {
    padding-right: 3.75rem;
}
.password-toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--gold-dim);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}
.password-toggle:hover { color: var(--gold); }
.password-toggle:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Sign-in button: narrower than full-width so it reads as an intentional
   action, not a slab. Matches the inset of the form-input fields. */
.btn-signin {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 1.75rem auto 0;
}
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--gray-600);
}
.form-input {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--navy);
    transition: border-color var(--transition);
}
.form-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184,135,10,0.15);
}
.btn {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-primary {
    background: var(--gold);
    color: var(--white);
    width: 100%;
    justify-content: center;
}
.btn-primary:hover { background: var(--gold-dim); }
.btn-secondary {
    background: var(--navy);
    color: var(--white);
}
.btn-secondary:hover { background: var(--navy-light); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-200);
    color: var(--navy);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold-dim); }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

.error-msg {
    background: #FDE8E6;
    color: var(--red);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* --- Section Dividers --- */
.section { margin-bottom: 2rem; }
.section-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gold);
    display: inline-block;
}

/* --- HTMX loading --- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
.htmx-request.htmx-indicator {
    display: inline-block;
}
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Utility --- */
.text-gold { color: var(--gold); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }

/* --- State Report (Apr 19 2026 Jobs pass) --- */
.sr-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}
.sr-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.sr-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: help;
    user-select: none;
    outline: none;
}
.sr-help:hover, .sr-help:focus { background: var(--gold); color: var(--white); }
.sr-help-bubble {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: var(--navy);
    color: var(--white);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.45;
    box-shadow: 0 8px 24px rgba(14,31,61,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    cursor: default;
}
.sr-help-bubble strong { color: var(--gold-light); }
.sr-help:hover .sr-help-bubble,
.sr-help:focus .sr-help-bubble { opacity: 1; pointer-events: auto; }
.sr-export-btn {
    background: var(--navy);
    color: var(--white);
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition);
}
.sr-export-btn:hover { background: var(--navy-light); }
.sr-export-status {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.35rem;
    text-align: right;
}

.sr-state-switcher {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.sr-state-chip {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    text-decoration: none;
    transition: all var(--transition);
}
.sr-state-chip:hover { border-color: var(--gold); color: var(--navy); }
.sr-state-chip.active {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* Top-3 winners callout — the punchline. Partner gets the answer
   in 5 seconds before scrolling into the tier breakdown. */
.sr-top3 {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(14,31,61,0.04);
}
.sr-top3-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 0.85rem;
}
.sr-top3-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.sr-top3-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: rgba(184,135,10,0.04);
    border: 1px solid rgba(184,135,10,0.15);
    border-radius: var(--radius-md);
}
.sr-top3-rank {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--gold);
    line-height: 1;
    min-width: 1.5ch;
}
.sr-top3-body { flex: 1; min-width: 0; }
.sr-top3-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sr-top3-pct {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--navy);
    margin-top: 0.15rem;
    line-height: 1;
}

/* Tier card (Apr 19 Jobs pass — adds tier description line under heading) */
.sr-tier-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(14,31,61,0.03);
}
.sr-tier-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.sr-tier-head-left { flex: 1; min-width: 0; }
.sr-tier-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
}
.sr-tier-desc {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin: 0.2rem 0 0;
    line-height: 1.4;
}
.sr-tier-avg {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}
.sr-tier-avg-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    font-weight: 600;
}
.sr-tier-avg-val {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--navy);
}
.sr-tier-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* ── Content wrapper ─────────────────────────────────────────────────────── */
.content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

/* ── Page Context Bar ────────────────────────────────────────────────────── */
/* Full-bleed strip at the top of every tool page. Left: state chip + page
   name. Center: KPI stats. Right: moment label + colored dot. */
.page-ctx {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--off-white);
    border-left: 4px solid var(--gray-300);
    padding: 0.6rem 2.25rem;
    margin: -2rem -2.25rem 1.75rem;   /* bleed to main edges */
    flex-wrap: wrap;
}
.page-ctx.ctx-understand { border-left-color: var(--understand); background: rgba(29,78,216,0.04); }
.page-ctx.ctx-plan       { border-left-color: var(--plan);       background: rgba(201,162,39,0.06); }
.page-ctx.ctx-create     { border-left-color: var(--create);     background: rgba(194,65,12,0.04); }
.page-ctx.ctx-deploy     { border-left-color: var(--deploy);     background: rgba(13,148,136,0.04); }

.page-ctx-state {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.page-ctx-abbr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--white);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.page-ctx-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}
.page-ctx-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.page-ctx-val {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.1;
}
.page-ctx-label {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
}
.page-ctx-moment {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    flex-shrink: 0;
}
.page-ctx-moment-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gray-300);
}
.ctx-understand .page-ctx-moment      { color: var(--understand); }
.ctx-understand .page-ctx-moment-dot  { background: var(--understand); }
.ctx-plan .page-ctx-moment            { color: var(--plan); }
.ctx-plan .page-ctx-moment-dot        { background: var(--plan); }
.ctx-create .page-ctx-moment          { color: var(--create); }
.ctx-create .page-ctx-moment-dot      { background: var(--create); }

/* ── Next-Step Forward Bar ───────────────────────────────────────────────── */
/* Appears at the bottom of each tool page to push users to the next moment. */
.next-step {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
}
.next-step-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.next-step-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.6rem 1.35rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: 0.01em;
}
.next-step-cta.navy {
    background: var(--navy);
    color: var(--white);
}
.next-step-cta.navy:hover { background: var(--navy-light); color: var(--white); }
.next-step-cta.gold {
    background: var(--gold);
    color: var(--white);
}
.next-step-cta.gold:hover { background: var(--gold-dim); color: var(--white); }

/* ── Misc Utility ────────────────────────────────────────────────────────── */
.justify-center { justify-content: center; }
.gap-2 { gap: 1rem; }
.caveat {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-style: italic;
    border-left: 3px solid var(--gray-200);
    padding-left: 0.75rem;
    margin: 0.75rem 0;
}
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { margin-bottom: 0.4rem; }

/* ── Horizon chips (Rec 2 / Rec 3) ──────────────────────────────────────── */
/* Tier-derived horizon approximations on issue cards. */
.horizon-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.5;
    vertical-align: middle;
    white-space: nowrap;
    flex-shrink: 0;
}
.horizon-near  { background: #dcfce7; color: #166534; border: 1px solid rgba(22,101,52,0.2); }
.horizon-multi { background: #fef9c3; color: #854d0e; border: 1px solid rgba(133,77,14,0.2); }
.horizon-long  { background: #f1f5f9; color: #334155; border: 1px solid rgba(71,85,105,0.25); }

/* ── Inline MrP tooltip (Rec 7) ─────────────────────────────────────────── */
/* Hover ⓘ that explains what MrP means. Pure CSS, no JS. */
.mrp-tip {
    position: relative;
    display: inline-block;
    cursor: help;
    color: #6366f1;
    font-size: 11px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 2px;
}
.mrp-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1F3864;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.45;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    white-space: normal;
    width: 230px;
    max-width: 90vw;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
    text-align: left;
}
.mrp-tip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1F3864;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
}
.mrp-tip:hover::after,
.mrp-tip:hover::before { opacity: 1; }

/* ── Verdict banner (Rec 3) ─────────────────────────────────────────────── */
.verdict-banner {
    border-radius: 10px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    border: 1.5px solid;
}
.verdict-near  { background: #f0fdf4; border-color: rgba(22,101,52,0.3); }
.verdict-multi { background: #fefce8; border-color: rgba(133,77,14,0.3); }
.verdict-long  { background: #f8fafc; border-color: rgba(71,85,105,0.35); }
.verdict-tier-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.verdict-headline {
    font-family: 'Playfair Display', serif;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.4rem;
}
.verdict-posture {
    font-size: 0.82rem;
    line-height: 1.5;
    color: #374151;
    max-width: 540px;
}
.page-header p { color: var(--gray-500); font-size: 0.95rem; max-width: 680px; }

/* ── Form-field shake (Fix C — empty-submit feedback) ───────────────────── */
@keyframes shake-field {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-5px); }
    40%      { transform: translateX( 5px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX( 4px); }
}
.field-shake {
    animation: shake-field 0.38s ease;
    border-color: #dc2626 !important;
    outline: none;
}
