:root {
    /* Climate brand green retained. Typography matches timeanddate.com's
       approach — Helvetica/Arial system stack, 14px body @ 400, #454545 on
       pure white, line-height 1.45. The earlier Roboto-Condensed @ 300
       failed because *condensed + light* compounds illegibility; the fix
       is correct font + weight, not "bigger pixels". */
    --c-primary: #0f7b6c;
    --c-primary-hover: #0b6055;
    --c-accent: #5cc0a4;
    --c-bg: #eef1f2;
    --c-surface: #ffffff;
    --c-text: #1c2024;
    --c-text-secondary: #3c4651;
    --c-text-muted: #8a949a;
    --c-border: #e2e6e8;
    --c-border-soft: #eef1f2;
    --c-pos: #0f7b6c;
    --c-neg: #c0392b;

    --c-font: 'Segoe UI', Helvetica, Arial, sans-serif;
    --c-radius: 8px;
}

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

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--c-font);
    font-size: 14px;
    line-height: 1.45;
    font-weight: 400;
    color: var(--c-text);
    background-color: var(--c-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* WCAG 2.4.7 — visible focus across all interactive elements. */
:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

/* The page h1 receives programmatic focus after navigation (FocusOnNavigate,
   for screen-reader users). It isn't keyboard-reachable, so the visible focus
   ring on it is just noise — suppress it; the focus move still happens. */
h1:focus, h1:focus-visible { outline: none; }

/* WCAG 2.4.1 — skip link revealed only on focus. */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 100;
}
.skip-link:focus {
    position: fixed;
    left: 12px;
    top: 12px;
    width: auto;
    height: auto;
    padding: 10px 16px;
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--c-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 10px;
    width: 100%;
}

.clearfix::after { content: ""; display: table; clear: both; }

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

/* === Header — mirrors www.exchange-rates.org === */
header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 15px 0;
    position: relative;
}

.header-blocks {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.navbar-brand {
    color: var(--c-primary);
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    line-height: 1;
    transition: opacity .3s ease;
    /* drop the parent-site logo into wwwroot/img/logo.svg to enable the icon: */
    /* background: url('/img/logo.svg') no-repeat left center / 55px 55px; padding-left: 70px; */
}
.navbar-brand:hover { opacity: .7; text-decoration: none; }

/* Round 20 — port the desktop logo so it reads the same way the mobile
   .navbar-brand--compact one does: a single tight wordmark with the .com
   suffix dimmed (not enlarged), plus an unshouty tagline below. The mockup
   "Climate-Zone.com / climate normals · Köppen · warming deltas" treatment. */
.navbar-brand .logo-text { margin: 0; line-height: 1.05; }
.navbar-brand strong {
    font-size: 28px;
    font-weight: 800;
    display: block;
    letter-spacing: -.015em;
}
.navbar-brand strong span { font-size: .68em; opacity: .62; font-weight: 700; }
.navbar-brand .brand-product {
    /* Product name within the Exchange-Rates.org family. Own line between
       the parent brand and tagline; brand-green accent + tracked uppercase
       gives it a wordmark feel without dwarfing the parent ".org". */
    display: block;
    margin-top: 4px;
    color: var(--c-primary);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.main-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 18px;
}

.main-nav .nav-item a {
    color: #555;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: .03em;
    padding: 6px 4px;
    display: inline-block;
}
.main-nav .nav-item a:hover { color: var(--c-primary); text-decoration: none; }

.btn-white {
    background-color: #fff;
    border: 1px solid #ddd;
    color: #555;
    padding: 6px 14px;
    font-size: 13px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    line-height: 1;
}
.btn-white:hover {
    background-color: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

/* Hamburger toggle — hidden on desktop, visible at <=769px. WCAG 1.4.10. */
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    color: #333;
    font: inherit;
    font-size: 13px;
    line-height: 1;
}
.nav-toggle:hover { border-color: var(--c-primary); color: var(--c-primary); }
.nav-toggle-icon {
    display: inline-block;
    width: 18px;
    height: 12px;
    position: relative;
    vertical-align: middle;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after,
.nav-toggle-icon span {
    content: "";
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: currentColor;
}
.nav-toggle-icon::before { top: 0; }
.nav-toggle-icon span    { top: 5px; }
.nav-toggle-icon::after  { bottom: 0; }

@media (max-width: 50em) {
    header { padding: 10px 0; }
    .navbar-brand strong { font-size: 22px; }
    .navbar-brand strong span { font-size: .68em; }
    .nav-toggle { display: inline-block; }
    .main-nav {
        position: absolute;
        top: 100%;
        right: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 6px 18px rgba(0,0,0,.08);
        padding: 6px 0;
        min-width: 200px;
        z-index: 50;
    }
    .main-nav[hidden] { display: none; }
    .main-nav .nav-item { display: block; }
    .main-nav .nav-item a {
        display: block;
        padding: 10px 16px;
        font-size: 14px;
    }
    .main-nav .nav-lang { padding: 6px 12px; border-top: 1px solid #eee; margin-top: 4px; }
}

/* === Main content === */
main.container {
    flex: 1;
    padding-top: 30px;
    padding-bottom: 40px;
}

main h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--c-text);
    line-height: 1.2;
}

main .lead {
    font-size: 15px;
    color: var(--c-text-secondary);
    max-width: 720px;
    line-height: 1.5;
}

.series-description {
    margin: 0 0 18px;
    padding: 12px 16px;
    background: #f7faf8;
    border-left: 3px solid var(--c-accent);
    color: #444;
    font-size: 15px;
    line-height: 1.5;
    max-width: 820px;
}

/* === Footer — darkened from var(--c-accent) (2.3:1) to var(--c-primary) for AA contrast. === */
footer {
    background-color: var(--c-primary);
    color: #fff;
    min-height: 150px;
    padding: 25px 0 2em;
    margin-top: auto;
}

footer .container { position: relative; }

footer .left { float: left; max-width: calc(100% - 120px); }

footer .links-container { margin-bottom: 25px; }

footer ul {
    list-style: none;
    float: left;
    padding: 0;
    margin: 0;
}
footer ul + ul { margin-left: 1em; }

footer ul li {
    line-height: 1;
    padding: 5px 8px;
}

footer ul li a {
    color: #fff !important;
    font-size: 16px;
    text-decoration: none;
}
footer ul li a:hover { text-decoration: underline !important; }

footer span {
    display: block;
    clear: both;
    color: #ffffff;
    font-size: 14px;
}

footer .logo {
    width: 100px;
    height: 100px;
    float: right;
    opacity: .7;
    /* drop the parent-site footer logo into wwwroot/img/logo-footer.svg to enable: */
    /* background: url('/img/logo-footer.svg') no-repeat center; background-size: contain; */
}

@media (max-width: 481px) {
    footer .logo { display: none; }
    footer .left { float: none !important; max-width: none; }
    footer ul { float: none; text-align: center; }
    footer ul + ul { margin-left: 0; }
    footer ul li { padding: 14px 8px; }
    footer span { text-align: center; }
}

/* === Series pages === */
.crumbs {
    font-size: 12px;
    color: var(--c-text-muted);
    margin: 0 0 10px;
}
.crumbs a { color: var(--c-text-muted); }
.crumbs-actions {
    float: right;
}
.crumbs-actions a {
    color: var(--c-primary);
    font-weight: 700;
}

.series-section {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-text);
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--c-border);
}

.series-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-bottom: 8px;
}
.series-table th {
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--c-text-muted);
    border-bottom: 2px solid var(--c-border);
    padding: 8px 10px;
    letter-spacing: .04em;
}
.series-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--c-border-soft);
    font-size: 13px;
    color: var(--c-text);
}
.series-table th, .series-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}
.series-table .col-scope,
.series-table .col-currency,
.series-table .col-frequency,
.series-table .col-coverage,
.series-table .col-source {
    white-space: nowrap;
}
.series-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.series-table tr:hover td { background: #fafafa; }
/* Fixed column widths so every section's table aligns. The Series column
   has no explicit width and absorbs whatever remains. */
.series-table .col-scope     { width: 16%; }
.series-table .col-currency  { width: 9%; }
.series-table .col-frequency { width: 11%; }
.series-table .col-coverage  { width: 13%; }
.series-table .col-source    { width: 18%; }

.series-section-count {
    font-size: 14px;
    color: #666;
    font-weight: 300;
    margin-left: 6px;
}

/* === Hub /series — preview cards + global search === */
.series-search-wrap {
    position: relative;
    margin: 18px 0 28px;
    max-width: 640px;
}
.series-search-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid #cfd6d2;
    background: #fff;
    color: #333;
    font-family: inherit;
}
.series-search-input:focus-visible {
    border-color: var(--c-primary);
    outline: 2px solid var(--c-primary);
    outline-offset: 1px;
}
.series-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #cfd6d2;
    border-top: none;
    max-height: 360px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
}
.series-search-results li { border-bottom: 1px solid #f0f0f0; }
.series-search-results li:last-child { border-bottom: none; }
.series-search-results a {
    display: block;
    padding: 9px 14px;
    color: #333;
}
.series-search-results a:hover {
    background: #f3f8f6;
    color: var(--c-primary);
    text-decoration: none;
}
.series-search-empty {
    margin: 8px 0 0;
    color: #666;
    font-size: 14px;
}

.series-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 0 0 36px;
}
.hub-card {
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    padding: 18px 20px 16px;
    display: flex;
    flex-direction: column;
    border-radius: var(--c-radius);
    transition: border-color .15s, box-shadow .15s;
}
.hub-card:hover { border-color: var(--c-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.hub-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}
.hub-card-head h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    border: none;
    padding: 0;
    color: var(--c-text);
}
.hub-card-head h2 a { color: var(--c-text); }
.hub-card-head h2 a:hover { color: var(--c-primary); text-decoration: none; }
.hub-count {
    font-size: 14px;
    color: var(--c-text-muted);
    font-variant-numeric: tabular-nums;
}
.hub-hint {
    font-size: 14px;
    color: var(--c-text-muted);
    margin: 0 0 10px;
}
.hub-preview {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    flex: 1;
}
.hub-preview li { padding: 4px 0; font-size: 15px; }
.hub-cta {
    font-size: 13px;
    color: var(--c-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    align-self: flex-start;
}

/* === /series/by/{class} — filter bar + section defaults === */
.series-defaults {
    display: inline;
    color: #666;
    font-size: 14px;
    margin-left: 6px;
}
.series-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0 24px;
    padding: 12px 14px;
    background: #fafafa;
    border-left: 3px solid var(--c-accent);
}
.series-filter-input {
    flex: 1 1 240px;
    min-width: 180px;
    padding: 8px 10px;
    border: 1px solid #cfd6d2;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: #333;
}
.series-filter-input:focus-visible {
    border-color: var(--c-primary);
    outline: 2px solid var(--c-primary);
    outline-offset: 1px;
}
.series-filter-select {
    padding: 8px 10px;
    border: 1px solid #cfd6d2;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: #333;
}
.series-filter-count {
    margin-left: auto;
    color: #666;
    font-size: 13px;
}
.fx-jumpnav {
    margin: 6px 0 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fx-jumpnav a {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid #cfd6d2;
    color: var(--c-primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}
.fx-jumpnav a:hover { background: #f3f8f6; text-decoration: none; }

.back-link {
    margin: 36px 0 24px;
    font-size: 14px;
}

/* === Series-table mobile card layout === */
@media (max-width: 37.5em) {
    .series-table thead { display: none; }
    .series-table,
    .series-table tbody,
    .series-table tr,
    .series-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .series-table tr {
        border: 1px solid #e6e6e6;
        margin-bottom: 10px;
        padding: 10px 12px;
    }
    .series-table tr:hover td { background: transparent; }
    .series-table td {
        padding: 3px 0;
        border: none;
        font-size: 14px;
    }
    .series-table td[data-label="Series"] {
        font-size: 16px;
        font-weight: 400;
        margin-bottom: 4px;
    }
    .series-table td[data-label]:not([data-label="Series"])::before {
        content: attr(data-label) ": ";
        color: #666;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .04em;
        margin-right: 6px;
    }
    .series-search-input { font-size: 15px; }
}

.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 24px;
    margin: 18px 0 28px;
    padding: 16px 20px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-accent);
    border-radius: var(--c-radius);
}
.kv-grid > div { display: flex; flex-direction: column; gap: 3px; }
.kv-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--c-text-muted);
}
.kv-value { font-size: 14px; color: var(--c-text); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 0 0 28px;
}
.stat {
    padding: 18px 20px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    border-radius: var(--c-radius);
}
.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--c-text-muted);
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-value.pos { color: var(--c-pos); }
.stat-value.neg { color: var(--c-neg); }
.stat-sub {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 3px;
}

.chart-wrap {
    margin: 0 0 32px;
    padding: 16px 18px 12px;
    border: 1px solid #e6e6e6;
    background: #fff;
    height: 460px;
    position: relative;
}
.chart-wrap canvas { width: 100% !important; height: calc(100% - 60px) !important; }
/* Mini-legend the chart JS injects when an inflation-adjusted view extends
   past the last published CPI month with a 12mo-YoY projection. Sits at
   the bottom-left inside chart-wrap so it reads as part of the chart, not
   page-level chrome. */
.chart-estimate-legend {
    position: absolute;
    left: 18px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6b7280;
    line-height: 1;
    pointer-events: none;
}
.chart-estimate-legend svg { display: block; }
.chart-wrap figcaption {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

.chart-header-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    padding: 10px 14px;
    margin: 0 0 10px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 3px;
    font-size: 13px;
    /* When the user changes a selector, the new page navigates with
       #chart-controls so the dropdown bar stays in the viewport. The
       margin-top keeps it from sitting flush against the top edge. */
    scroll-margin-top: 12px;
}
.chc-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #555;
}
.chc-name {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 11px;
    color: #666;
}
.chc-select {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: 4px 8px;
    font: inherit;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    min-width: 120px;
}
.chc-select:hover { border-color: var(--c-primary); }
.chc-select:focus-visible {
    border-color: var(--c-primary);
    outline: 2px solid var(--c-primary);
    outline-offset: 1px;
}

.chart-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 8px;
    min-height: 26px;
    flex-wrap: wrap;
}
.scale-toggle {
    display: inline-flex;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
    font-size: 11px;
}
.scale-toggle button,
.scale-toggle a {
    background: #fff;
    border: 0;
    border-right: 1px solid #ddd;
    padding: 4px 12px;
    color: #666;
    cursor: pointer;
    font: inherit;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1.4;
    text-decoration: none;
    display: inline-block;
}
.scale-toggle button:last-child,
.scale-toggle a:last-child { border-right: 0; }
.scale-toggle button:hover,
.scale-toggle a:hover { background: #f5f5f5; color: var(--c-primary); }
.scale-toggle button.active,
.scale-toggle a.active {
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
}

.source-attribution {
    margin: 24px 0 12px;
    padding: 18px 22px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 3px solid #c0e7d1;
    border-radius: var(--c-radius);
}
.source-attribution h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--c-text);
}
.source-attribution p { margin: 0 0 8px; font-size: 15px; color: var(--c-text-secondary); line-height: 1.55; }
.source-attribution .attribution { font-style: italic; color: var(--c-text-muted); }
.meta-dl {
    margin: 10px 0 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    font-size: 14px;
}
.meta-dl dt { color: #666; }
.meta-dl dd { margin: 0; color: #333; }
.meta-dl code { font-size: 13px; background: #fff; padding: 1px 5px; border: 1px solid #e6e6e6; }

/* === Slice page extras === */
.title-period {
    font-weight: 300;
    color: var(--c-primary);
}
/* Unit subtitle that sits directly under the H1 — "USD / barrel",
   "EUR / metric ton". Slash form translates better than "USD per
   barrel" since "per" is a grammatical preposition that doesn't
   template cleanly across CJK / Arabic / Hindi. */
.title-unit {
    margin: -8px 0 18px;
    color: #666;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.period-clamp-note {
    margin: -10px 0 18px;
    padding: 10px 14px;
    background: #fff8e1;
    border-left: 3px solid #f0c674;
    font-size: 14px;
    color: #6b5d2a;
}

/* === Period selector === */
.periods {
    margin: 28px 0 24px;
    padding: 16px 18px;
    background: #fafafa;
    border: 1px solid #eee;
}
.periods-heading {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: #666;
    letter-spacing: .04em;
    margin: 0 0 12px;
}
.period-group { margin-bottom: 14px; }
.period-group:last-child { margin-bottom: 0; }
.period-group h3 {
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    color: #666;
    letter-spacing: .04em;
    margin: 0 0 8px;
}
.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.period-btn {
    display: inline-block;
    padding: 5px 11px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #444;
    font-size: 13px;
    text-decoration: none;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    transition: background-color .12s ease, border-color .12s ease;
}
.period-btn:hover {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
    text-decoration: none;
}
.period-btn.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    font-weight: 700;
}

.period-older {
    margin-top: 10px;
    font-size: 12px;
}
.period-older > summary {
    cursor: pointer;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 4px 0;
    user-select: none;
}
.period-older > summary:hover { color: var(--c-primary); }
.period-older[open] > summary { color: #444; }
.period-older .period-buttons { margin-top: 8px; }

/* === Page actions (toggle + CSV download) === */
.page-actions {
    margin: 0 0 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.action-link {
    display: inline-block;
    padding: 7px 13px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    line-height: 1.3;
}
.action-link:hover {
    background: #f5f5f5;
    border-color: #b8b8b8;
    color: #333;
    text-decoration: none;
}

/* Inflation-adjustment toggle. Two-state segmented control rendered as
   a <span> (active) + <a> (inactive link to the other view). Active
   state is always positionally first (left in LTR, right in RTL — the
   inactive <a> is rendered second). The links navigate to the canonical
   .../real and .../<slug> URLs; no JS state. Brand greens drive the
   active fill so the toggle reads as a primary control next to the
   quieter CSV ghost link. */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--c-primary);
    border-radius: 4px;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.3;
}
.view-toggle-option {
    display: inline-block;
    padding: 7px 14px;
    text-decoration: none;
    color: var(--c-primary);
    background: #fff;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.view-toggle-option + .view-toggle-option {
    border-left: 1px solid var(--c-primary);
}
.view-toggle-option:hover:not(.view-toggle-option--active) {
    background: var(--c-accent);
    color: #fff;
    text-decoration: none;
}
.view-toggle-option--active {
    background: var(--c-primary);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

@media (max-width: 480px) {
    .view-toggle {
        width: 100%;
    }
    .view-toggle-option {
        flex: 1 1 50%;
        text-align: center;
        padding: 8px 6px;
    }
}

/* === Data tables === */
.data-table-actions {
    display: flex;
    justify-content: flex-end;
    margin: 24px 0 0;
}
.data-table-actions + .data-table-wrap {
    margin-top: 6px;
}
.table-csv-link {
    font-size: 13px;
    padding: 5px 12px;
    /* Match the inflation-adjustment toggle's brand-green outline so the
       export action reads as a primary control rather than a muted link.
       Subtle hover — fill on hover, white text, like the toggle. */
    color: var(--c-primary);
    border-color: var(--c-primary);
    font-weight: 600;
}
.table-csv-link:hover {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}
.data-table-wrap {
    /* Horizontal scroll container — annual summary tables have 7 columns
       of currency-formatted values that won't fit on phones. The first
       column (Year/Month/Date) is sticky so users keep their bearings
       while scrolling sideways. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0 28px;
    /* Subtle right-edge gradient to hint at scrollable content. */
    background:
        linear-gradient(to right, white, rgba(255,255,255,0)) left center / 12px 100% no-repeat,
        linear-gradient(to left,  white, rgba(255,255,255,0)) right center / 12px 100% no-repeat,
        linear-gradient(to right, rgba(0,0,0,.06), rgba(255,255,255,0)) left center / 6px 100% no-repeat,
        linear-gradient(to left,  rgba(0,0,0,.06), rgba(255,255,255,0)) right center / 6px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}
.data-table thead th:first-child,
.data-table tbody td:first-child {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
}
.data-table thead th:first-child { background: #fafafa; }
@media (max-width: 700px) {
    .data-table { font-size: 13px; }
    .data-table thead th, .data-table tbody td { padding: 6px 8px; }
    .data-table .cell-when { font-size: 11px; }
    /* Drop lower-priority columns (January/Average on the annual table) so
       the essentials (Year/December/High/Low/Change) fit on phones. The
       horizontal-scroll wrapper still kicks in if a single row gets too
       wide, but most slices won't need it. */
    .data-table .mobile-hide { display: none; }
}
.data-table thead th {
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    padding: 8px 10px;
    background: #fafafa;
    border-bottom: 2px solid #e6e6e6;
    letter-spacing: .03em;
}
.data-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-variant-numeric: tabular-nums;
}
.data-table tbody tr:hover td { background: #fafafa; }
.data-table .num { text-align: right; }
.data-table .num.pos { color: var(--c-primary); }
.data-table .num.neg { color: #c0392b; }
.data-table .cell-when {
    /* Date label for High/Low cells. On its own line, right-aligned below
       the value (the parent .num cell already text-aligns right), so the
       month name is easy to scan instead of being crammed against the
       number it qualifies. */
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 2px;
}
.data-table a { color: var(--c-primary); }

.error-suggestions {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}
.error-suggestions li { margin-bottom: 6px; }
.error-suggestions a { color: var(--c-primary); }

/* === Calculator pages === */
:root {
    --brand:        var(--c-primary);
    --brand-light:  var(--c-accent);
    --brand-pale:   #f0f9f5;
    --brand-pale-2: #e3f2eb;
    --text:         #2c3e50;
    --muted:        #666;
    --border:       #e6e6e6;
    --danger:       #c0392b;
}

/* Form (used by all calc pages and the embedded widget) */
.compare-form {
    margin: 8px 0 24px;
    padding: 18px 20px;
    background: #fafafa;
    border: 1px solid #e6e6e6;
    border-left: 4px solid var(--brand-light);
    border-radius: 3px;
}
.compare-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px 16px;
    align-items: end;
}
.compare-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #555;
}
.compare-form input[type="number"],
.compare-form input[type="date"],
.compare-form input[type="month"],
.compare-form select {
    appearance: none;
    -webkit-appearance: none;
    height: 42px;
    padding: 8px 12px;
    font-size: 15px;
    font-family: inherit;
    color: #333;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.compare-form select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8" fill="%23666"><path d="M0 0h12L6 8z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 6px;
    padding-right: 32px;
}
.compare-form input:focus-visible,
.compare-form select:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 1px;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(33,111,91,.25);
}
.compare-form button[type="submit"] {
    height: 42px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
    background: var(--brand);
    border: 1px solid var(--brand);
    border-radius: 3px;
    cursor: pointer;
    transition: background .15s ease;
    white-space: nowrap;
}
.compare-form button[type="submit"]:hover {
    background: #267a63;
    border-color: #267a63;
}

@media (max-width: 640px) {
    .compare-form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .compare-form input[type="number"],
    .compare-form input[type="date"],
    .compare-form input[type="month"],
    .compare-form select,
    .compare-form button[type="submit"] {
        width: 100%;
        height: 48px;
        font-size: 16px;     /* prevent iOS zoom on focus */
    }
}

/* ---- Portfolios builder (single-column linear flow) ---- */
.portfolio-builder { padding: 4px 22px 22px; }
.portfolio-builder-section-h {
    margin: 22px 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #555;
    border-bottom: 1px solid #e6e6e6;
    padding-bottom: 6px;
}
.portfolio-builder-help { margin: 0 0 12px; font-size: 13px; }
.portfolio-builder-scenario {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 16px;
    align-items: end;
}
.portfolio-builder-legs { margin-top: 4px; }
.portfolio-builder-leg {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 110px 28px;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}
.portfolio-builder-leg-pct { font-size: 14px; color: #666; }
.portfolio-builder-total {
    margin-top: 8px;
    padding: 10px 0 4px;
    border-top: 2px solid #ddd;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.portfolio-builder-total-label { color: #555; }
.portfolio-builder-total-value {
    text-align: right;
    padding-right: 12px;
    font-variant-numeric: tabular-nums;
    color: #555;
}
.portfolio-builder-total.warn .portfolio-builder-total-label,
.portfolio-builder-total.warn .portfolio-builder-total-value,
.portfolio-builder-total.warn .portfolio-builder-leg-pct { color: #b91c1c; }
.portfolio-builder-total.warn {
    border-top-color: #b91c1c;
    background: rgba(185, 28, 28, .04);
    box-shadow: inset 4px 0 0 #b91c1c;
}
.portfolio-builder-total.ok .portfolio-builder-total-value,
.portfolio-builder-total.ok .portfolio-builder-total-label,
.portfolio-builder-total.ok .portfolio-builder-leg-pct {
    color: var(--brand, #2f9472);
}
.portfolio-builder-advanced {
    margin: 18px 0 8px;
    padding: 0;
}
.portfolio-builder-advanced > summary {
    cursor: pointer;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    user-select: none;
}
.portfolio-builder-advanced > summary::marker { color: #666; }
.portfolio-builder-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px 16px;
    margin-top: 8px;
}
.portfolio-builder-submit {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.portfolio-builder-submit button[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* Allocation tabs (1-3 portfolios) */
.portfolio-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 22px 0 0;
    border-bottom: 1px solid #ddd;
}
.portfolio-tab {
    appearance: none;
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    padding: 7px 14px;
    margin-bottom: -1px;
    font: inherit;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    user-select: none;
}
.portfolio-tab:hover { background: #ebebeb; color: #1a1a1a; }
.portfolio-tab.active {
    background: #fff;
    color: #1a1a1a;
    font-weight: 600;
    border-bottom: 1px solid #fff;
}
.portfolio-tab-add,
.portfolio-tab-remove {
    background: transparent;
    border-color: transparent;
    color: var(--c-primary);
}
.portfolio-tab-add:hover { color: #237858; background: #f0faf6; }
.portfolio-tab-remove   { color: #b91c1c; margin-left: auto; }
.portfolio-tab-remove:hover { background: #fdf3f3; }

.portfolio-tab-panel { display: none; padding-top: 16px; }
.portfolio-tab-panel.active { display: block; }

/* Ephemeral-link banner */
.ephemeral-banner {
    margin: 6px 0 14px;
    padding: 10px 14px;
    background: #fff8e1;
    border-left: 3px solid #d4a017;
    border-radius: 0 4px 4px 0;
    font-size: 13.5px;
    color: #4a3400;
}
.ephemeral-banner-text strong { font-weight: 600; }

/* Compare view */
.portfolio-compare-stats td:not(:first-child),
.portfolio-compare-stats th:not(:first-child) { font-variant-numeric: tabular-nums; }

.portfolio-compare-allocations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.portfolio-compare-allocation h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #555;
    margin: 0 0 8px;
}
.portfolio-compare-allocation h3 a { font-size: 12px; font-weight: 400; margin-left: 8px; }

@media (max-width: 768px) {
    /* On mobile, show one tab's allocation at a time (the active one). The
       compare result page also keeps its multi-line chart but stacks the
       allocation tables. */
    .portfolio-compare-allocations { grid-template-columns: 1fr; }
}

.preset-card-button {
    appearance: none;
    background: #fff;
    border: 1px solid #e6e6e6;
    text-align: left;
    cursor: pointer;
    padding: 14px 16px;
    font-family: inherit;
    width: 100%;
    transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
    display: block;
}
.preset-card-button:hover {
    border-color: var(--brand, #2f9472);
    box-shadow: 0 1px 6px rgba(46,139,115,0.08);
}
.preset-card-button:active { transform: translateY(1px); }
.preset-card-button .preset-card-query  { display: block; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; }
.preset-card-button .preset-card-answer { display: block; color: #555; font-size: 13px; }

.quickstart-tier {
    margin: 0 0 14px;
}
.quickstart-tier-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #666;
    margin: 0 0 6px;
}
.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}
.quickstart-card {
    padding: 10px 12px;
}
.quickstart-card .preset-card-query  { font-size: 14px; }
.quickstart-card .preset-card-answer { font-size: 12px; }

@keyframes highlight-flash {
    0%   { background: rgba(46,139,115,0.18); }
    100% { background: transparent; }
}
.highlight-flash { animation: highlight-flash .8s ease-out; }

/* ---- Portfolio detail page ---- */
.seg-toggle {
    display: inline-flex;
    margin: 0 0 18px;
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
}
.seg-toggle-btn {
    padding: 8px 16px;
    font-size: 13px;
    color: #555;
    background: #fff;
    text-decoration: none;
    border-right: 1px solid #ddd;
    transition: background .12s, color .12s;
}
.seg-toggle-btn:last-child { border-right: 0; }
.seg-toggle-btn:hover { background: #f5f5f5; color: #1a1a1a; }
.seg-toggle-btn.active {
    background: var(--brand, #2f9472);
    color: #fff;
    cursor: default;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 18px;
}

/* Collapsed result-page sections — visually mirrors a section heading;
   click anywhere on the summary row to expand. */
.result-section-collapsed {
    margin: 28px 0 12px;
    border-bottom: 1px solid #e6e6e6;
    padding-bottom: 6px;
}
.result-section-collapsed > summary {
    cursor: pointer;
    list-style: none;          /* hide default disclosure triangle */
    padding: 0 0 6px 22px;
    position: relative;
    user-select: none;
}
.result-section-collapsed > summary::-webkit-details-marker { display: none; }
.result-section-collapsed > summary::before {
    content: '▸';
    color: #666;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 16px;
    transition: transform .15s ease;
}
.result-section-collapsed[open] > summary::before {
    transform: rotate(90deg);
}
.result-section-collapsed > summary .series-section-title {
    font-size: 22px;
    font-weight: 400;
    color: #2c3e50;
}
.result-section-collapsed > summary:hover .series-section-title {
    color: var(--brand, #2f9472);
}
.btn {
    display: inline-block;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
    white-space: nowrap;
    font-family: inherit;
}
.btn-outline {
    background: #fff;
    color: var(--brand, #2f9472);
    border: 1.5px solid var(--brand, #2f9472);
}
.btn-outline:hover {
    background: var(--brand, #2f9472);
    color: #fff;
}
.btn-outline:active { transform: translateY(1px); }

.audit-block {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 360px);
    gap: 24px;
    margin: 24px 0 28px;
}
.audit-block h2 {
    margin: 0 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #555;
}
.audit-list {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 14px;
    row-gap: 6px;
    font-size: 13px;
}
.audit-list dt { color: #666; font-weight: 600; }
.audit-list dd { margin: 0; color: #1a1a1a; }
.data-table-tight th, .data-table-tight td { padding: 6px 8px; font-size: 13px; }

.stat-help {
    display: inline-block;
    margin-left: 4px;
    width: 14px; height: 14px;
    line-height: 13px;
    text-align: center;
    border-radius: 50%;
    background: #e6e6e6;
    color: #666;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
}

@media (max-width: 720px) {
    .audit-block { grid-template-columns: 1fr; }
    .portfolio-builder-leg { grid-template-columns: 1fr 80px 24px; }
}

/* Hero result panel (top of every calc page when a result exists) */
.calc-hero {
    margin: 0 0 22px;
    padding: 28px 28px 24px;
    background: linear-gradient(135deg, #f5fbf8 0%, #ffffff 70%);
    border: 1px solid #d6ebe1;
    border-left: 4px solid var(--brand);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 22px;
}
.calc-hero-kicker {
    flex: 1 1 100%;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin: 0 0 4px;
}
.calc-hero-eq {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}
.calc-hero-from,
.calc-hero-to {
    font-size: 48px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.calc-hero-from { color: #666; font-weight: 400; }
.calc-hero-arrow {
    font-size: 32px;
    color: #666;
    font-weight: 300;
    line-height: 1;
}
.calc-hero-badge {
    display: inline-block;
    padding: 8px 14px;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border-radius: 3px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.calc-hero-badge.neg { background: var(--danger); }
.calc-hero-meta {
    flex: 1 1 100%;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-top: 10px;
}
.calc-hero-meta strong { color: #444; font-weight: 600; }
.calc-hero-meta .link-button {
    background: transparent;
    border: 1px solid var(--c-primary);
    color: var(--c-primary);
    padding: 4px 10px;
    margin-left: 10px;
    font: inherit;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
}
.calc-hero-meta .link-button:hover { background: var(--c-primary); color: #fff; }
.calc-hero-sub {
    flex: 1 1 100%;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #e6f0eb;
}
.calc-hero-sub strong { color: #444; font-weight: 600; }
@media (max-width: 640px) {
    .calc-hero { padding: 20px 18px; }
    .calc-hero-from,
    .calc-hero-to { font-size: 32px; }
    .calc-hero-arrow { font-size: 22px; }
    .calc-hero-badge { font-size: 20px; padding: 6px 10px; }
}

/* Compact one-line context strip directly under the hero — replaces the
   full stats grid for the single most-useful comparison (benchmark). */
.calc-context {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
    margin: -6px 0 22px;
    padding: 10px 14px;
    font-size: 14px;
    color: #555;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 3px;
}
.calc-context-label { color: #666; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.calc-context-value { font-weight: 600; color: #333; font-variant-numeric: tabular-nums; }
.calc-context-delta { font-weight: 600; }
.calc-context-delta.pos { color: var(--c-primary); }
.calc-context-delta.neg { color: var(--danger); }

/* Collapsible secondary section (risk metrics, drawdown, year-by-year,
   assumptions). Search-friendly: <details> content stays in the DOM. */
.fold {
    margin: 18px 0;
    border: 1px solid var(--border);
    background: #fff;
}
.fold > summary {
    cursor: pointer;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    background: #fafafa;
    border-bottom: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
    content: "▸";
    color: var(--brand);
    font-size: 12px;
    transition: transform .15s;
}
.fold[open] > summary::before { content: "▾"; }
.fold[open] > summary { border-bottom-color: var(--border); }
.fold > .fold-body { padding: 14px 16px; }
.fold-summary-hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
}

/* Inline pill row for the chart toolbar (Try-different-years next to the
   Portfolio-value chart heading). Keeps the exploration affordance from
   interrupting the hero → chart flow. */
.chart-toolbar {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin: 24px 0 6px;
}
.chart-toolbar-h2 { margin: 0; font-size: 16px; font-weight: 600; color: #2c3e50; }
.chart-toolbar-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chart-toolbar-pills-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.chart-toolbar-pills .period-btn { padding: 4px 10px; font-size: 13px; }
@media (max-width: 640px) {
    .chart-toolbar { gap: 6px 10px; }
    .chart-toolbar-pills-label { display: none; }
}

/* Stats grid hierarchy: hero tiles get bolder border + bigger value;
   secondary tiles muted background + smaller value. */
.stat.stat-hero {
    border: 2px solid var(--brand-light);
    background: #f9fffe;
}
.stat.stat-hero .stat-value { font-size: 30px; font-weight: 700; }
.stat.stat-secondary { background: #fafafa; border-color: #eee; }
.stat.stat-secondary .stat-value { font-size: 22px; }
.stat.stat-secondary .stat-label { color: #666; }

/* Preset / popular-examples cards */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 12px 0 24px;
    list-style: none;
    padding: 0;
}
.preset-card {
    display: block;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.preset-card:hover {
    border-color: var(--brand-light);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transform: translateY(-1px);
    text-decoration: none;
}
.preset-card-query {
    font-size: 13px;
    color: #666;
    line-height: 1.35;
    margin-bottom: 6px;
}
.preset-card-answer {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.preset-card-delta {
    display: inline-block;
    margin-left: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand);
}
.preset-card-delta.neg { color: var(--danger); }

/* Embedded calc widget on /series pages — distinct mint panel so it
   reads as "interactive tool" against the surrounding content blocks. */
.calc-widget {
    margin: 28px 0;
    padding: 18px 20px 16px;
    background: var(--brand-pale);
    border: 1px solid var(--brand-pale-2);
    border-top: 3px solid var(--brand-light);
    border-radius: 3px;
    border-bottom: none;
}
.calc-widget > h2 {
    font-size: 18px;
    color: var(--brand);
    margin: 0 0 10px;
    padding-bottom: 0;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.calc-widget > h2::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%232e8b73" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="2" width="16" height="20" rx="2"/><line x1="8" y1="6" x2="16" y2="6"/><line x1="8" y1="10" x2="16" y2="10"/><line x1="8" y1="14" x2="10" y2="14"/><line x1="14" y1="14" x2="16" y2="14"/><line x1="8" y1="18" x2="10" y2="18"/><line x1="14" y1="18" x2="16" y2="18"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}
.calc-widget .series-description { color: #555; margin-bottom: 12px; }
.calc-widget .compare-form {
    background: #fff;
    border-color: #d4ede1;
    border-left-color: var(--brand);
    margin-bottom: 12px;
}
.calc-widget .action-link {
    background: #fff;
    border-color: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
}
.calc-widget .action-link:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* Purchasing-power grid inside .calc-widget — used for non-investment
   commodity pages where "$1,000 invested" is nonsensical and we instead
   show how many physical units that money buys at different points. */
.pp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 0 0 8px;
}
.pp-cell {
    background: #fff;
    border: 1px solid #d4ede1;
    border-left: 3px solid var(--brand-light);
    padding: 14px 16px 12px;
    border-radius: 3px;
}
.pp-cell--latest {
    border-left-color: var(--brand);
    background: #f8fdf9;
}
.pp-cell-when {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    margin-bottom: 4px;
}
.pp-cell-units {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.1;
}
.pp-cell-unit-label {
    font-size: 13px;
    color: #555;
    margin-top: 2px;
}
.pp-cell-price {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}
.pp-summary {
    margin: 8px 0 0;
    color: #444;
}

/* Two-date price decomposition — USD price + currency effect = total.
   Layout uses flex (not grid) so the cells stay in document order with
   `+` and `=` glyphs interleaved between them. Wraps on narrow screens
   where the operators rotate to read top-to-bottom alongside vertical
   stacking. Renders only on cross-currency views. */
.decomp-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin: 0 0 8px;
}
.decomp-cell {
    flex: 1 1 200px;
    min-width: 0;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-left: 3px solid #d0d0d0;
    padding: 14px 16px 12px;
    border-radius: 3px;
}
.decomp-cell--total {
    border-left-color: var(--brand);
    background: #f8fdf9;
}
.decomp-op {
    flex: 0 0 auto;
    align-self: center;
    font-size: 22px;
    font-weight: 700;
    color: #666;
    padding: 0 4px;
    user-select: none;
    line-height: 1;
}
.decomp-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    margin-bottom: 4px;
}
.decomp-value {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.decomp-value.pos { color: var(--success, var(--c-primary)); }
.decomp-value.neg { color: var(--danger, #b54b4b); }
.decomp-detail {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 700px) {
    /* On narrow screens the cells stack vertically; `+` and `=` slide
       into their own row, centered, so the math relationship still
       reads cleanly top-to-bottom. */
    .decomp-grid { flex-direction: column; }
    .decomp-op {
        align-self: center;
        padding: 0;
    }
}

/* Cross-currency × decades grid. Inline scrollable on narrow screens —
   the table itself is dense (6 currency columns × ~6 decades) so we
   give it the same scroll-shadow treatment as the data table. */
.ccy-decades-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0 24px;
    background:
        linear-gradient(to right, white, rgba(255,255,255,0)) left center / 12px 100% no-repeat,
        linear-gradient(to left,  white, rgba(255,255,255,0)) right center / 12px 100% no-repeat,
        linear-gradient(to right, rgba(0,0,0,.06), rgba(255,255,255,0)) left center / 6px 100% no-repeat,
        linear-gradient(to left,  rgba(0,0,0,.06), rgba(255,255,255,0)) right center / 6px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
}
.ccy-decades-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}
.ccy-decades-table thead th {
    background: #fafafa;
    border-bottom: 2px solid #e6e6e6;
    text-align: right;
    padding: 10px 12px;
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ccy-decades-table thead th:first-child { text-align: left; }
.ccy-decades-table tbody th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #1a1a1a;
    background: #fafafa;
    position: sticky;
    left: 0;
}
.ccy-decades-table tbody td {
    text-align: right;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-variant-numeric: tabular-nums;
}
.ccy-decades-table td.empty { color: #bbb; }

/* Compressed sitemap-style footer — replaces the three big pill rows
   (Currency / Browse-by-period / Inflation-adjustment) with a tighter
   inline-link block at the bottom of each series page. Same set of
   crawlable links, ~20% of the vertical footprint. */
.link-footer {
    margin: 32px 0 24px;
    padding: 14px 0;
    border-top: 1px solid #e6e6e6;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    line-height: 1.7;
    color: #555;
}
.link-footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 2px 0;
}
.link-footer-label {
    flex: 0 0 auto;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .04em;
    padding-top: 3px;
    min-width: 70px;
}
.link-footer-links {
    flex: 1 1 0;
    min-width: 0;
}
.link-footer-links a {
    color: var(--brand);
    text-decoration: none;
}
.link-footer-links a:hover { text-decoration: underline; }
.link-footer-current {
    color: #1a1a1a;
    font-weight: 600;
}
.link-footer-sep {
    color: #ccc;
    margin: 0 4px;
    user-select: none;
}

/* Investment growth chart on /calc/investment */
.calc-growth-chart {
    margin: 0 0 24px;
    padding: 16px 18px 12px;
    background: #fff;
    border: 1px solid var(--border);
    height: 320px;
    position: relative;
}
.calc-growth-chart canvas { width: 100% !important; height: 100% !important; }

/* Home page small section labels above each pill row (Featured markets,
   Top currencies, Countries). Compact uppercase to read as section dividers
   without competing with H1 or the country panel title. */
.home-section-label {
    margin: 22px 0 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    font-weight: 600;
}

/* Home country-pills navigation. Pills are server-side links that
   re-render the page with ?country=<code>; the selected pill is
   highlighted. nofollow on the inactive pills to keep the homepage's
   crawl signal focused. */
.country-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 18px 0 8px;
    padding: 0;
}
.country-pill {
    display: inline-block;
    padding: 6px 14px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}
.country-pill:hover { background: #ebebeb; color: var(--c-primary); border-color: var(--c-primary); }
.country-pill--active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
    font-weight: 600;
}
.country-pill--active:hover { background: var(--c-primary); color: #fff; }
.country-pill--more {
    background: transparent;
    color: #666;
    border-color: transparent;
    font-style: italic;
}

.country-panel-title {
    margin-top: 18px;
    margin-bottom: 12px;
    font-size: 22px;
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 6px;
}
.country-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin: 0 0 24px;
}
.country-panel-group {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 12px 16px 14px;
}
.country-panel-group h3 {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #666;
    font-weight: 600;
}
.country-panel-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.country-panel-list li {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.country-panel-list li:last-child { border-bottom: 0; }
.country-panel-list a { color: var(--c-primary); text-decoration: none; }
.country-panel-list a:hover { text-decoration: underline; }
.country-panel-meta {
    color: #666;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Time Machine — checkbox row in the form. Rest of the form
   reuses .compare-form / .compare-form-row / inputs. */
.compare-form-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-top: 18px;  /* align with the input boxes' label-on-top layout */
    font-size: 14px;
    color: #444;
}
.compare-form-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Single-line headline above the chart on /series/{slug}/ — replaces
   the prior 5-card stats grid. View-aware: Price view shows latest
   value + %-since-inception; Growth views show the cumulative %. */
.hero-line {
    margin: 12px 0 14px;
    font-size: 17px;
    color: #2c3e50;
    line-height: 1.4;
}
.hero-line .pos { color: #1f7f4d; font-weight: 600; }
.hero-line .neg { color: #b7332a; font-weight: 600; }

/* Story headline above the chart on /compare/{family}/{a}/{b}.
   Auto-generated from data — no editorial copy ever lives here. */
.story-headline {
    margin: 14px 0 16px;
    padding: 12px 14px;
    background: #f6faf8;
    border-left: 3px solid var(--c-primary);
    border-radius: 2px;
}
.story-headline p {
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.45;
}
.story-headline p:last-child { margin-bottom: 0; }
.story-headline .story-punchline {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #d8e6e0;
    font-style: italic;
    color: #555;
}

/* Story-in-numbers KV grid (replaces the prior "Series in this comparison"
   table). One card per series; hidden rows when the underlying fact is
   undefined (no drawdown, window <10y, etc.). */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin: 0 0 24px;
}
.story-grid-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 12px 16px 14px;
}
.story-grid-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #2c3e50;
}
.story-grid-card h3 a { color: inherit; text-decoration: none; }
.story-grid-card h3 a:hover { color: var(--c-primary); }
.story-grid-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 14px;
    font-size: 14px;
}
.story-grid-card dt {
    color: #666;
    font-weight: 500;
}
.story-grid-card dd {
    margin: 0;
    color: #222;
}
.story-grid-card dd .text-muted {
    color: #666;
    font-size: 12px;
    font-weight: 400;
}
.story-grid-card dd.pos { color: #1f7f4d; }
.story-grid-card dd.neg { color: #b7332a; }

/* Compare-page supplemental widgets — spread mini-chart, current-vs-avg
   callout, real-rate snapshot, inversion stats. Rendered below the main
   chart by CompareSupplementalWidgets.razor. */
.compare-supplemental {
    margin-top: 24px;
}
.compare-supplemental h2 {
    margin-bottom: 8px;
}
.compare-supplemental-stats {
    display: flex;
    gap: 24px;
    margin: 8px 0 12px 0;
    flex-wrap: wrap;
}
.compare-supplemental-stats > div {
    display: flex;
    flex-direction: column;
}
.compare-supplemental-stats .stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.compare-supplemental-stats .stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}
.chart-wrap--mini {
    height: 180px;
    margin: 0;
}
