:root {
    --charcoal: #111111;
    --snow: #ffffff;
    --ultramarine: #1a36d6;
    --signal: #00d65b;
    --hairline: #e5e5e5;
    --muted: #737373;
    --surface: #f8f9fa;
    --surface-soft: #fbfcfc;
    --blue-soft: rgba(239, 246, 255, 0.68);
    --panel-shadow: 0 4px 24px -12px rgba(0, 0, 0, 0.08);
    --font-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

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

html {
    color: var(--charcoal);
    background: var(--snow);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body { margin: 0; min-width: 320px; }

body, button, input, select { font: inherit; }

button, input, select { color: inherit; }

button, select, input[type="checkbox"], input[type="range"] { cursor: pointer; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

p, h1, h2, h3, dl, dd { margin-top: 0; }

img, svg { display: block; max-width: 100%; }

::selection { color: var(--snow); background: var(--ultramarine); }

:focus-visible {
    outline: 2px solid var(--ultramarine);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 8px;
    left: 8px;
    padding: 8px 12px;
    color: var(--snow);
    background: var(--ultramarine);
    transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--charcoal);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.brand__mark {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border-radius: 2px;
    background: var(--ultramarine);
}

.brand--small { font-size: 15px; }
.brand--small .brand__mark { width: 12px; height: 12px; }

.eyebrow {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.family-signature {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.family-signature a {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-header {
    position: relative;
    z-index: 5;
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(20px, 4vw, 64px);
    border-bottom: 1px solid var(--hairline);
    background: var(--snow);
}

.site-nav { display: flex; align-items: center; gap: 28px; }

.site-nav a {
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.site-nav a:hover { color: var(--ultramarine); }

.nav-toggle {
    display: none;
    border: 0;
    background: transparent;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
}

.site-footer,
.workspace-footer {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 24px 48px;
    align-items: start;
    padding: 40px clamp(20px, 4vw, 64px);
    border-top: 1px solid var(--hairline);
    background: var(--surface);
}

.site-footer p,
.workspace-footer p {
    max-width: 520px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.site-footer nav,
.workspace-footer nav { display: flex; gap: 20px; }

.site-footer nav a,
.workspace-footer nav a { font-size: 13px; }

.site-footer .family-signature,
.workspace-footer .family-signature { grid-column: 1 / -1; }

/* Home: AIDesigner Precision Grid */
.home-shell {
    display: grid;
    grid-template-columns: 35% 65%;
    min-height: 100dvh;
}

.editorial-rail {
    position: sticky;
    z-index: 2;
    top: 0;
    display: grid;
    height: 100dvh;
    grid-template-rows: auto 1fr auto;
    border-right: 1px solid var(--hairline);
    background: var(--snow);
}

.rail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 32px;
    border-bottom: 1px solid var(--hairline);
}

.version-badge {
    padding: 4px 8px;
    border: 1px solid var(--hairline);
    border-radius: 2px;
    color: var(--muted);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
}

.rail-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 32px;
}

.rail-copy h1 {
    max-width: 480px;
    margin-bottom: 24px;
    font-size: clamp(38px, 3.4vw, 58px);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.055em;
}

.rail-intro {
    max-width: 390px;
    margin-bottom: 40px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.55;
}

.source-diagnostic {
    display: grid;
    max-width: 390px;
    gap: 18px;
    margin-bottom: 0;
    padding-left: 16px;
    border-left: 2px solid var(--ultramarine);
}

.source-diagnostic div { display: grid; gap: 4px; }

.source-diagnostic dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.source-diagnostic dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
}

.source-diagnostic a { color: var(--ultramarine); }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--signal);
}

.rail-footer {
    padding: 24px 32px 32px;
    border-top: 1px solid var(--hairline);
    background: var(--surface);
}

.rail-footer > p:first-child {
    max-width: 380px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.workspace {
    min-width: 0;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(229, 229, 229, 0.45) 1px, transparent 1px),
        linear-gradient(90deg, rgba(229, 229, 229, 0.45) 1px, transparent 1px);
    background-size: 24px 24px;
}

.workspace-inner {
    width: min(100%, 992px);
    margin: 0 auto;
    padding: 32px 48px 0;
}

.workspace-nav {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 32px;
}

.workspace-nav a {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
}

.workspace-nav a:hover { color: var(--ultramarine); text-decoration: underline; }

.calculator-heading,
.reference-extract > header,
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--hairline);
}

.calculator-heading h2,
.reference-extract h2,
.section-heading h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.calculator-heading .eyebrow,
.reference-extract .eyebrow,
.section-heading .eyebrow { margin-bottom: 4px; }

.calculator-actions { display: flex; align-items: center; gap: 16px; }

.calculator-actions button {
    padding: 0;
    border: 0;
    background: transparent;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
}

.calculator-actions button:hover { color: var(--ultramarine); }

.share-status { color: var(--ultramarine); font-family: var(--font-mono); font-size: 10px; }

.calculator {
    border: 1px solid var(--hairline);
    border-top: 0;
    background: var(--snow);
    box-shadow: var(--panel-shadow);
}

.calculator-core {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr);
    border-bottom: 1px solid var(--hairline);
}

.calculator-core > * { padding: 24px; }
.calculator-core > * + * { border-left: 1px solid var(--hairline); }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.control-section legend,
.field > span:first-child {
    display: block;
    margin-bottom: 11px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.help-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.help {
    display: inline-grid;
    width: 24px;
    min-height: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    color: var(--charcoal);
    background: var(--snow);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
}

.help:hover,
.help[aria-expanded="true"] {
    color: var(--snow);
    border-color: var(--ultramarine);
    background: var(--ultramarine);
}

.help-popover {
    position: absolute;
    z-index: 20;
    top: calc(100% + 10px);
    left: -8px;
    width: min(290px, calc(100vw - 48px));
    padding: 13px 15px;
    border: 1px solid var(--charcoal);
    color: var(--charcoal);
    background: var(--snow);
    box-shadow: 5px 5px 0 rgb(16 20 24 / 12%);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.55;
    text-align: left;
    text-transform: none;
}

.help-popover::before {
    position: absolute;
    top: -6px;
    left: 13px;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--charcoal);
    border-left: 1px solid var(--charcoal);
    background: var(--snow);
    content: '';
    transform: rotate(45deg);
}

.segment {
    display: grid;
    border: 1px solid var(--hairline);
}

.segment--categories { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.segment--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.segment button {
    min-width: 0;
    padding: 9px 6px;
    border: 0;
    background: var(--snow);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}

.segment button + button { border-left: 1px solid var(--hairline); }
.segment button:hover { background: var(--surface); }
.segment button.is-active { color: var(--snow); background: var(--charcoal); }
.segment button:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--ultramarine); outline-offset: -2px; }

.grade-step-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.field select,
.field input[type="number"] {
    width: 100%;
    min-height: 37px;
    padding: 8px 10px;
    border: 1px solid var(--hairline);
    border-radius: 0;
    background: var(--snow);
    font-family: var(--font-mono);
    font-size: 12px;
}

.field select:focus,
.field input[type="number"]:focus {
    border-color: var(--ultramarine);
    outline: 1px solid var(--ultramarine);
}

.field small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

.allowance-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 0.75fr;
    gap: 24px;
    padding: 24px;
    border-bottom: 1px solid var(--hairline);
    background: var(--surface-soft);
}

.segment--compact button { padding-block: 7px; font-size: 10px; }

.stepper {
    display: grid;
    grid-template-columns: 36px minmax(42px, 1fr) 36px;
    border: 1px solid var(--hairline);
    background: var(--snow);
}

.stepper button,
.stepper input {
    min-width: 0;
    min-height: 35px;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-family: var(--font-mono);
    font-size: 12px;
    text-align: center;
}

.stepper button:first-child { border-right: 1px solid var(--hairline); }
.stepper button:last-child { border-left: 1px solid var(--hairline); }
.stepper button:hover { background: var(--surface); }
.stepper input { width: 100%; appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }

.advanced-controls { border-bottom: 1px solid var(--hairline); }

.advanced-controls > summary,
.breakdown > summary {
    padding: 13px 24px;
    color: var(--charcoal);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    list-style-position: inside;
}

.advanced-controls > summary:hover,
.breakdown > summary:hover { color: var(--ultramarine); }

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 24px;
    padding: 8px 24px 24px;
}

.toggle-field {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.toggle-field input { width: 16px; height: 16px; accent-color: var(--ultramarine); }

.work-rate-field input { width: 100%; accent-color: var(--ultramarine); }
.work-rate-field output { float: right; color: var(--charcoal); font-family: var(--font-mono); }

.result-panel {
    position: relative;
    padding: clamp(40px, 6vw, 64px) 32px 48px;
    text-align: center;
}

.live-status {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.status-dot--pulse { position: relative; margin-right: 7px; }

.status-dot--pulse::after {
    position: absolute;
    inset: -4px;
    border: 1px solid var(--signal);
    border-radius: 50%;
    content: "";
    animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse { from { opacity: 0.8; transform: scale(0.5); } to { opacity: 0; transform: scale(1.4); } }

.result-label {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.result-number {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.05em;
}

.result-number > span { margin-top: 9px; color: var(--muted); font-size: clamp(24px, 3vw, 36px); }

.result-number strong {
    font-size: clamp(58px, 7.6vw, 96px);
    font-weight: 500;
    line-height: 0.95;
}

.result-number strong.is-changing { animation: number-change 300ms cubic-bezier(.175,.885,.32,1.275); }

@keyframes number-change {
    50% { opacity: 0.5; filter: blur(4px); transform: translateY(-2px); }
}

.result-profile {
    margin-bottom: 22px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.result-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.result-chips span {
    padding: 5px 8px;
    border: 1px solid var(--hairline);
    color: var(--muted);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 10px;
}

.result-chips strong { color: var(--charcoal); font-weight: 500; }

.breakdown { border-top: 1px solid var(--hairline); background: var(--surface-soft); }
.breakdown dl { margin: 0; padding: 0 24px 20px; }

.breakdown dl > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 8px 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 12px;
}

.breakdown dt { min-width: 0; flex: 1; color: var(--muted); }
.breakdown dd { flex: 0 0 auto; margin: 1px 0 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.breakdown .breakdown-total { color: var(--charcoal); font-weight: 700; }

.breakdown-help > summary {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 7px;
    color: inherit;
    cursor: pointer;
    list-style: none;
}

.breakdown-help > summary::-webkit-details-marker { display: none; }

.breakdown-help > summary span {
    display: inline-grid;
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    color: var(--charcoal);
    background: var(--snow);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    line-height: 1;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.breakdown-help > summary:hover { color: var(--ultramarine); }
.breakdown-help > summary:hover span,
.breakdown-help[open] > summary span { color: var(--snow); border-color: var(--ultramarine); background: var(--ultramarine); }

.breakdown-help p {
    max-width: 580px;
    margin: 7px 0 4px;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.55;
}

.calculation-note { margin: 0; padding: 0 24px 24px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.calculator-error { margin: 0; padding: 32px; color: #8b0000; }

.reference-extract { margin-top: 48px; }
.reference-extract > header a,
.section-heading a { color: var(--ultramarine); font-size: 12px; font-weight: 600; }

.data-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--hairline);
    border-top: 0;
    background: var(--snow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table th,
.data-table td { padding: 12px 16px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); text-align: right; }
.data-table tr > *:last-child { border-right: 0; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table thead th { color: var(--muted); background: var(--surface-soft); font-weight: 500; text-transform: uppercase; }
.data-table th:first-child { min-width: 96px; text-align: left; }
.data-table tbody tr:hover > * { background: var(--surface); }
.data-table .is-current { color: var(--ultramarine); background: var(--blue-soft); font-weight: 700; }

.content-section {
    margin-top: 72px;
    padding-top: 48px;
    border-top: 1px solid var(--hairline);
}

.content-section > h2,
.content-section--intro > h2 {
    max-width: 600px;
    margin-bottom: 28px;
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--hairline); }

.feature-grid article { min-height: 190px; padding: 24px; background: var(--snow); }
.feature-grid article:nth-child(even) { border-left: 1px solid var(--hairline); }
.feature-grid article:nth-child(n + 3) { border-top: 1px solid var(--hairline); }
.feature-grid span { color: var(--ultramarine); font-family: var(--font-mono); font-size: 10px; }
.feature-grid h3 { margin: 28px 0 8px; font-size: 16px; }
.feature-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.profile-groups { border: 1px solid var(--hairline); border-top: 0; }

.profile-group {
    display: grid;
    grid-template-columns: 190px 1fr 1.5fr;
    gap: 24px;
    padding: 24px;
    background: var(--snow);
}

.profile-group + .profile-group { border-top: 1px solid var(--hairline); }
.profile-group h3 { margin: 0; font-size: 15px; }
.profile-group p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.profile-links { display: flex; flex-wrap: wrap; align-content: start; justify-content: flex-end; gap: 6px; }

.profile-links a {
    padding: 5px 7px;
    border: 1px solid var(--hairline);
    color: var(--ultramarine);
    font-family: var(--font-mono);
    font-size: 10px;
    text-decoration: none;
}

.profile-links a:hover { color: var(--snow); border-color: var(--ultramarine); background: var(--ultramarine); }

.faq-section { margin-bottom: 72px; }
.faq-list { border-top: 1px solid var(--hairline); }
.faq-list details { border-bottom: 1px solid var(--hairline); background: rgba(255, 255, 255, 0.6); }
.faq-list summary { padding: 18px 0; font-weight: 600; cursor: pointer; }
.faq-list p { max-width: 680px; padding: 0 28px 20px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.workspace-footer { margin: 0 -48px; padding-inline: 48px; }

/* Reference and editorial pages */
.page-main {
    min-height: 70vh;
    padding: clamp(48px, 7vw, 96px) clamp(20px, 7vw, 104px) 96px;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(229, 229, 229, 0.38) 1px, transparent 1px),
        linear-gradient(90deg, rgba(229, 229, 229, 0.38) 1px, transparent 1px);
    background-size: 24px 24px;
}

.page-wrap { width: min(100%, 1120px); margin: 0 auto; }

.page-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.5fr);
    gap: 48px;
    align-items: end;
    margin-bottom: 48px;
}

.page-hero h1 {
    max-width: 780px;
    margin-bottom: 18px;
    font-size: clamp(42px, 6vw, 76px);
    font-weight: 600;
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.page-hero__intro { max-width: 720px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.profile-answer { color: var(--charcoal); }

.source-card {
    padding: 20px;
    border-left: 2px solid var(--ultramarine);
    background: var(--snow);
    box-shadow: var(--panel-shadow);
}

.source-card p { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.source-card strong { display: block; margin-bottom: 14px; font-family: var(--font-mono); font-size: 12px; }
.source-card a { color: var(--ultramarine); font-size: 12px; }

.page-panel {
    padding: clamp(24px, 4vw, 48px);
    border: 1px solid var(--hairline);
    background: var(--snow);
    box-shadow: var(--panel-shadow);
}

.page-panel + .page-panel { margin-top: 24px; }

.page-panel h2 { margin-bottom: 18px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -0.035em; }
.page-panel h3 { margin: 30px 0 10px; font-size: 18px; }
.page-panel p, .page-panel li { color: #525252; font-size: 15px; line-height: 1.7; }
.page-panel p:last-child { margin-bottom: 0; }
.page-panel a { color: var(--ultramarine); }

.table-section + .table-section,
.table-section + .page-panel,
.page-panel + .table-section { margin-top: 48px; }
.table-section__header { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin-bottom: 18px; }
.table-section__header h2 { margin: 0; font-size: 22px; }
.table-section__header p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.reference-card { padding: 24px; border: 1px solid var(--hairline); background: var(--snow); }
.reference-card .metric { display: block; margin: 18px 0 4px; font-family: var(--font-mono); font-size: 26px; font-variant-numeric: tabular-nums; }
.reference-card h2, .reference-card h3 { margin-bottom: 8px; font-size: 16px; }
.reference-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.prose-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; }
.prose-nav { position: sticky; top: 32px; align-self: start; display: grid; gap: 8px; }
.prose-nav a { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.formula { padding: 16px; border-left: 2px solid var(--ultramarine); background: var(--surface); font-family: var(--font-mono); font-size: 12px; line-height: 1.7; }

.profile-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 32px; border: 1px solid var(--hairline); background: var(--snow); }
.profile-metrics div { padding: 22px; }
.profile-metrics div + div { border-left: 1px solid var(--hairline); }
.profile-metrics dt { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.profile-metrics dd { margin: 8px 0 0; font-family: var(--font-mono); font-size: 22px; }

.primary-action {
    display: inline-block;
    padding: 12px 16px;
    border: 1px solid var(--ultramarine);
    color: var(--snow) !important;
    background: var(--ultramarine);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}
.primary-action:hover { color: var(--ultramarine) !important; background: var(--snow); }

.related-links { display: flex; flex-wrap: wrap; gap: 8px; }
.related-links a { padding: 7px 9px; border: 1px solid var(--hairline); font-family: var(--font-mono); font-size: 11px; text-decoration: none; }
.related-links a:hover { border-color: var(--ultramarine); }

.profile-faq { margin-top: 48px; }
.profile-faq .faq-list { margin-top: 8px; }

.data-table caption {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.coefficient-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.coefficient-summary .reference-card + .reference-card { border-left: 0; }
.coefficient-current { margin-top: 48px; }
.coefficient-guide { margin-top: 72px; }
.coefficient-guide__content > * + * { margin-top: 24px; }
.coefficient-guide [id] { scroll-margin-top: 28px; }

.coefficient-timeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 32px;
    border-top: 1px solid var(--hairline);
    border-left: 1px solid var(--hairline);
}

.coefficient-timeline div { padding: 20px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.coefficient-timeline span { color: var(--ultramarine); font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.coefficient-timeline p { margin: 12px 0 0; font-size: 13px; line-height: 1.55; }

.coefficient-example { margin-top: 28px; padding: 20px; border: 1px solid var(--hairline); background: var(--blue-soft); }
.coefficient-example p { margin: 0; }
.coefficient-example .eyebrow { margin-bottom: 8px; color: var(--ultramarine); }

.coefficient-steps { margin: 24px 0; padding: 0; list-style: none; counter-reset: coefficient-step; }
.coefficient-steps li { position: relative; min-height: 48px; padding: 0 0 20px 52px; counter-increment: coefficient-step; }
.coefficient-steps li::before {
    position: absolute;
    top: 1px;
    left: 0;
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--ultramarine);
    color: var(--ultramarine);
    font-family: var(--font-mono);
    font-size: 10px;
    content: counter(coefficient-step, decimal-leading-zero);
}

.history-section { padding-top: 24px; }
.data-table--history { min-width: 740px; }
.data-table--history th:first-child { position: sticky; left: 0; z-index: 1; min-width: 170px; background: var(--snow); }
.data-table--history thead th:first-child { z-index: 2; background: var(--surface-soft); }
.data-table--history tbody tr:hover th:first-child { background: var(--surface); }
.table-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.table-note a { color: var(--ultramarine); }
.source-list { margin-bottom: 0; padding-left: 20px; }
.source-list li + li { margin-top: 10px; }

/* Job4All accessibility preferences */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.site-nav a,
.site-footer nav a,
.workspace-footer nav a { display: inline-flex; min-height: 44px; align-items: center; }

.job4all-launcher {
    position: fixed;
    z-index: 47;
    bottom: 18px;
    left: 18px;
    display: flex;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 6px 15px 6px 7px;
    border: 1px solid var(--charcoal);
    border-radius: 2px;
    color: var(--snow);
    background: var(--charcoal);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}

.job4all-launcher:hover { background: var(--ultramarine); }
.job4all-launcher.is-active { border-color: var(--ultramarine); box-shadow: 0 0 0 3px rgba(26, 54, 214, 0.22), 0 12px 36px rgba(0, 0, 0, 0.2); }
.job4all-launcher.is-active::after { position: absolute; top: -8px; right: -8px; display: grid; width: 22px; height: 22px; place-items: center; border: 2px solid var(--snow); border-radius: 50%; background: var(--ultramarine); font-family: var(--font-mono); font-size: 9px; content: attr(data-active-count); }
.job4all-launcher__mark { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255, 255, 255, 0.72); border-radius: 2px; background: var(--ultramarine); font-family: var(--font-mono); font-size: 18px; font-weight: 700; }
.job4all-launcher > span:last-child { display: grid; text-align: left; line-height: 1.15; }
.job4all-launcher strong { font-size: 13px; }
.job4all-launcher small { margin-top: 2px; color: #d4d4d8; font-size: 11px; }

.job4all-dialog {
    width: min(700px, calc(100% - 32px));
    max-height: min(860px, calc(100vh - 32px));
    margin: auto;
    padding: 0;
    overflow-y: auto;
    border: 1px solid var(--charcoal);
    border-radius: 2px;
    color: var(--charcoal);
    background: var(--snow);
    box-shadow: 0 35px 100px rgba(0, 0, 0, 0.34);
}

.job4all-dialog::backdrop { background: rgba(17, 17, 17, 0.7); backdrop-filter: blur(4px); }
.job4all-dialog__topline { height: 5px; background: var(--ultramarine); }
.job4all-dialog__header { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 24px; padding: 32px 34px 24px; }
.job4all-dialog__eyebrow { color: var(--ultramarine); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.job4all-dialog h2 { margin: 12px 0 14px; font-size: clamp(38px, 7vw, 58px); font-weight: 600; letter-spacing: -0.055em; line-height: 0.96; }
.job4all-dialog h2 em { color: var(--ultramarine); font-style: normal; }
.job4all-dialog__header p { max-width: 560px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.job4all-dialog__close { width: 44px; height: 44px; padding: 0; border: 1px solid var(--hairline); border-radius: 2px; color: var(--charcoal); background: var(--surface); font-size: 25px; line-height: 1; }
.job4all-dialog__close:hover { color: var(--snow); border-color: var(--ultramarine); background: var(--ultramarine); }
.job4all-preferences { padding: 0 34px 32px; }
.job4all-preferences fieldset { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.job4all-preferences legend { width: 100%; margin-bottom: 10px; padding: 14px 0 10px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.job4all-option { position: relative; display: grid; min-height: 82px; grid-template-columns: minmax(0, 1fr) 50px; gap: 14px; align-items: center; padding: 15px 16px; border: 1px solid var(--hairline); border-radius: 2px; background: var(--surface); cursor: pointer; }
.job4all-option--featured { min-height: 94px; border-left: 4px solid var(--ultramarine); background: var(--blue-soft); }
.job4all-option:hover, .job4all-option:has(input:checked) { border-color: var(--charcoal); background: var(--snow); }
.job4all-option:has(input:focus-visible) { outline: 3px solid var(--ultramarine); outline-offset: 2px; }
.job4all-option input { position: absolute; z-index: 2; top: 50%; right: 16px; width: 48px; height: 28px; margin: 0; opacity: 0; transform: translateY(-50%); cursor: pointer; }
.job4all-option__copy { display: grid; grid-column: 1; gap: 4px; }
.job4all-option__copy strong { font-size: 18px; }
.job4all-option__copy small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.job4all-option__switch { position: relative; display: block; width: 48px; height: 28px; grid-column: 2; border: 2px solid var(--muted); border-radius: 999px; background: var(--snow); }
.job4all-option__switch::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); content: ""; transition: transform 0.16s ease, background 0.16s ease; }
.job4all-option input:checked ~ .job4all-option__switch { border-color: var(--ultramarine); background: var(--ultramarine); }
.job4all-option input:checked ~ .job4all-option__switch::after { background: var(--snow); transform: translateX(20px); }
.job4all-option input:focus-visible ~ .job4all-option__switch { box-shadow: 0 0 0 3px var(--ultramarine); }
.job4all-preferences__footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 23px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.job4all-preferences__footer > a { color: var(--ultramarine); font-size: 13px; font-weight: 700; }
.job4all-preferences__footer > div { display: flex; gap: 8px; }

.job4all-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 15px; border: 1px solid var(--charcoal); border-radius: 2px; color: var(--charcoal); background: var(--snow); font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-decoration: none; }
.job4all-action:hover { color: var(--snow); background: var(--charcoal); }
.job4all-action--primary { color: var(--snow); border-color: var(--ultramarine); background: var(--ultramarine); }
.job4all-action--primary:hover { color: var(--ultramarine); background: var(--snow); }
.job4all-action--light { color: var(--charcoal); border-color: var(--snow); background: var(--snow); }
.job4all-action--light:hover { color: var(--snow); background: transparent; }

/* Job4All public commitment */
.accessibility-page { padding-bottom: 20px; }
.accessibility-hero { max-width: 970px; padding: 24px 0 72px; }
.accessibility-hero h1 { margin: 12px 0 26px; font-size: clamp(58px, 9vw, 112px); font-weight: 600; letter-spacing: -0.065em; line-height: 0.88; }
.accessibility-hero h1 em { color: var(--ultramarine); font-style: normal; }
.accessibility-hero > p:not(.eyebrow) { max-width: 780px; margin-bottom: 28px; color: var(--muted); font-size: 20px; line-height: 1.6; }
.accessibility-hero__action { min-height: 50px; padding-inline: 20px; }
.accessibility-principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--charcoal); border-left: 1px solid var(--hairline); }
.accessibility-principles article { min-height: 260px; padding: 26px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: var(--snow); }
.accessibility-principles span { color: var(--ultramarine); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.accessibility-principles h2 { margin: 58px 0 12px; font-size: 27px; letter-spacing: -0.035em; }
.accessibility-principles p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.accessibility-content { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 80px; align-items: start; padding: 80px 0; }
.accessibility-content h2, .accessibility-limitations h2 { margin: 10px 0 24px; font-size: clamp(40px, 6vw, 68px); letter-spacing: -0.055em; line-height: 0.96; }
.accessibility-content > section p, .accessibility-limitations p { max-width: 720px; color: var(--muted); font-size: 16px; line-height: 1.75; }
.accessibility-content aside { padding: 28px; color: var(--snow); background: var(--charcoal); }
.accessibility-content aside > strong { font-size: 24px; }
.accessibility-content aside p { margin: 14px 0 22px; color: #d4d4d8; font-size: 14px; line-height: 1.65; }
.accessibility-content aside small { display: block; margin-top: 20px; color: #d4d4d8; font-size: 11px; }
.accessibility-limitations { padding: clamp(28px, 5vw, 54px); border: 1px solid var(--hairline); border-left: 5px solid var(--ultramarine); background: var(--snow); }

/* Optional user-selected modes keep the same data, controls and URLs. */
html[data-high-contrast="true"] {
    --charcoal: #000000;
    --snow: #ffffff;
    --ultramarine: #001cba;
    --signal: #006b35;
    --hairline: #222222;
    --muted: #242424;
    --surface: #ffffff;
    --surface-soft: #ffffff;
    --blue-soft: #ffffff;
    --panel-shadow: none;
}

html[data-high-contrast="true"] :where(.page-main, .workspace) { background-image: none; }
html[data-high-contrast="true"] :where(.calculator, .page-panel, .reference-card, .profile-group, .data-table-wrap, .accessibility-principles article) { border-color: var(--charcoal); }
html[data-high-contrast="true"] .job4all-launcher { border: 2px solid var(--snow); outline: 2px solid var(--charcoal); }

html[data-reading-comfort="true"] { --font-sans: Arial, Helvetica, sans-serif; }
html[data-reading-comfort="true"] body { letter-spacing: 0.012em; line-height: 1.72; }
html[data-reading-comfort="true"] :where(.page-hero__intro, .page-panel p, .page-panel li, .rail-intro, .faq-list p, .accessibility-content > section, .accessibility-limitations p) { max-width: 70ch; }
html[data-reading-comfort="true"] :where(h1, h2, h3) { letter-spacing: -0.025em; line-height: 1.12; }

html[data-clear-view="true"] { font-size: 19px; }
html[data-clear-view="true"] body { line-height: 1.7; }
html[data-clear-view="true"] :where(.page-main, .workspace) { background-image: none; }
html[data-clear-view="true"] .home-shell { display: block; }
html[data-clear-view="true"] .editorial-rail { position: relative; height: auto; min-height: 0; grid-template-rows: auto auto auto; border-right: 0; border-bottom: 1px solid var(--hairline); }
html[data-clear-view="true"] .rail-copy { min-height: 0; padding-block: 64px; }
html[data-clear-view="true"] :where(.calculator-core, .allowance-grid, .advanced-grid, .page-hero, .prose-layout, .table-section__header, .reference-grid, .profile-metrics, .feature-grid, .profile-group, .accessibility-principles, .accessibility-content) { grid-template-columns: 1fr; }
html[data-clear-view="true"] .calculator-core > * + * { border-top: 1px solid var(--hairline); border-left: 0; }
html[data-clear-view="true"] .feature-grid article:nth-child(even) { border-left: 0; }
html[data-clear-view="true"] .feature-grid article + article { border-top: 1px solid var(--hairline); }
html[data-clear-view="true"] .profile-links { grid-column: auto; justify-content: flex-start; }
html[data-clear-view="true"] .prose-nav { position: static; display: flex; flex-wrap: wrap; }
html[data-clear-view="true"] :where(button, input, select, summary) { min-height: 48px; }
html[data-clear-view="true"] :where(.eyebrow, .source-diagnostic dt, .workspace-nav a, .control-section legend, .field > span:first-child, .field small) { font-size: 0.75rem; line-height: 1.5; }
html[data-clear-view="true"] :where(.page-panel p, .page-panel li, .feature-grid p, .faq-list p, .reference-card p, .table-section__header p) { font-size: 1rem; }

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--snow); }
::-webkit-scrollbar-thumb { background: var(--hairline); }
::-webkit-scrollbar-thumb:hover { background: var(--charcoal); }

@media (max-width: 1180px) {
    .home-shell { grid-template-columns: 32% 68%; }
    .rail-header, .rail-copy { padding-inline: 24px; }
    .rail-footer { padding-inline: 24px; }
    .workspace-inner { padding-inline: 32px; }
    .workspace-footer { margin-inline: -32px; padding-inline: 32px; }
    .calculator-core { grid-template-columns: 1fr; }
    .calculator-core > * + * { border-top: 1px solid var(--hairline); border-left: 0; }
    .allowance-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1023px) {
    .home-shell { display: block; }
    .editorial-rail { position: relative; height: auto; min-height: 620px; border-right: 0; border-bottom: 1px solid var(--hairline); }
    .rail-copy { min-height: 450px; }
    .rail-copy h1 { font-size: clamp(42px, 8vw, 64px); }
    .workspace-inner { padding-top: 28px; }
    .calculator-core { grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr); }
    .calculator-core > * + * { border-top: 0; border-left: 1px solid var(--hairline); }
    .allowance-grid { grid-template-columns: 1.35fr 1fr 0.75fr; }
    .profile-group { grid-template-columns: 180px 1fr; }
    .profile-links { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 760px) {
    .site-header { min-height: 64px; flex-wrap: wrap; }
    .nav-toggle { display: block; }
    .nav-toggle[aria-expanded="false"] + .site-nav { display: none; }
    .site-nav { width: 100%; flex-direction: column; align-items: flex-start; gap: 0; padding: 10px 0 16px; }
    .site-nav a { width: 100%; padding: 8px 0; }
    .site-footer, .workspace-footer { grid-template-columns: 1fr; }
    .site-footer nav, .workspace-footer nav { flex-wrap: wrap; }
    .site-footer .family-signature, .workspace-footer .family-signature { grid-column: auto; }

    .editorial-rail { min-height: 560px; }
    .rail-header { padding: 24px; }
    .rail-copy { min-height: 390px; padding: 40px 24px; }
    .rail-copy h1 { font-size: 42px; }
    .rail-intro { font-size: 16px; }
    .rail-footer { padding: 22px 24px; }
    .workspace-inner { padding: 20px 16px 0; }
    .workspace-nav { justify-content: flex-start; gap: 14px; overflow-x: auto; padding-bottom: 4px; white-space: nowrap; }
    .calculator-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
    .calculator-actions { width: 100%; }
    .calculator-core { grid-template-columns: 1fr; }
    .calculator-core > * { padding: 20px; }
    .calculator-core > * + * { border-top: 1px solid var(--hairline); border-left: 0; }
    .allowance-grid { grid-template-columns: 1fr; padding: 20px; }
    .segment--categories { grid-template-columns: repeat(2, 1fr); }
    .segment--categories button + button { border-left: 0; }
    .segment--categories button:nth-child(even) { border-left: 1px solid var(--hairline); }
    .segment--categories button:nth-child(n + 3) { border-top: 1px solid var(--hairline); }
    .segment--categories button:last-child { grid-column: 1 / -1; }
    .grade-step-grid, .advanced-grid { grid-template-columns: 1fr; }
    .result-panel { padding: 54px 20px 36px; }
    .result-number strong { font-size: clamp(52px, 16vw, 72px); }
    .reference-extract { margin-top: 40px; }
    .reference-extract > header, .section-heading { align-items: flex-start; flex-direction: column; }
    .content-section { margin-top: 56px; padding-top: 40px; }
    .feature-grid { grid-template-columns: 1fr; }
    .feature-grid article:nth-child(even) { border-left: 0; }
    .feature-grid article + article { border-top: 1px solid var(--hairline); }
    .profile-group { grid-template-columns: 1fr; }
    .profile-links { grid-column: auto; }
    .workspace-footer { margin-inline: -16px; padding-inline: 16px; }

    .page-main { padding-block: 52px 72px; }
    .page-hero { grid-template-columns: 1fr; gap: 24px; }
    .page-hero h1 { font-size: 46px; }
    .reference-grid, .profile-metrics { grid-template-columns: 1fr; }
    .coefficient-timeline { grid-template-columns: 1fr; }
    .coefficient-guide { margin-top: 56px; }
    .job4all-launcher { bottom: 10px; left: 10px; width: 52px; padding: 6px; }
    .job4all-launcher > span:last-child { display: none; }
    .job4all-dialog { width: 100%; max-height: 94vh; margin: auto 0 0; border-radius: 2px 2px 0 0; }
    .job4all-dialog__header { gap: 13px; padding: 26px 18px 22px; }
    .job4all-dialog h2 { font-size: 38px; }
    .job4all-preferences { padding: 0 18px 22px; }
    .job4all-option { grid-template-columns: minmax(0, 1fr) 48px; gap: 10px; padding: 13px; }
    .job4all-option input { right: 13px; }
    .job4all-preferences__footer { align-items: stretch; flex-direction: column; }
    .job4all-preferences__footer > div { display: grid; grid-template-columns: 1fr 1fr; }
    .accessibility-hero { padding: 8px 0 52px; }
    .accessibility-hero h1 { font-size: 54px; }
    .accessibility-hero > p:not(.eyebrow) { font-size: 17px; }
    .accessibility-principles, .accessibility-content { grid-template-columns: 1fr; }
    .accessibility-principles article { min-height: 220px; }
    .accessibility-principles h2 { margin-top: 36px; }
    .accessibility-content { gap: 36px; padding: 60px 0; }
    .accessibility-limitations { padding: 32px 22px; }
    .profile-metrics div + div { border-top: 1px solid var(--hairline); border-left: 0; }
    .table-section__header, .prose-layout { grid-template-columns: 1fr; }
    .prose-nav { position: static; display: flex; flex-wrap: wrap; }
}

@media (max-width: 390px) {
    .job4all-option__copy small { font-size: 12px; }
    .job4all-dialog h2 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
