:root {
    --bg-a: #0f94ab;
    --bg-b: #8ed3dc;
    --ink: #10324c;
    --muted: #3d5e72;
    --line: rgba(16, 50, 76, 0.2);
    --panel: rgba(235, 248, 250, 0.82);
    --panel-strong: #e9f4f8;
    --low: #ea5f64;
    --medium: #146f8e;
    --high: #d88f16;
    --shadow: 0 18px 40px rgba(7, 65, 87, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Bricolage Grotesque', sans-serif;
    color: var(--ink);
    background: linear-gradient(120deg, var(--bg-a), var(--bg-b));
}

.atmo-shape {
    position: fixed;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(4px);
    z-index: 0;
}

.atmo-one {
    width: 22rem;
    height: 22rem;
    background: rgba(12, 77, 110, 0.2);
    left: -6rem;
    top: 8rem;
}

.atmo-two {
    width: 26rem;
    height: 26rem;
    background: rgba(255, 255, 255, 0.24);
    right: -7rem;
    bottom: 4rem;
}

.page-shell {
    width: min(1240px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.25rem 0 2rem;
    position: relative;
    z-index: 1;
}

.site-header {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-items: center;
    text-align: center;
}

.eyebrow,
.section-kicker {
    margin: 0;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: rgba(16, 50, 76, 0.8);
    font-weight: 700;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: 'Literata', serif;
    line-height: 1.1;
}

h1 {
    font-size: clamp(2.1rem, 4.8vw, 4rem);
    max-width: 22ch;
}

h1 span {
    display: block;
}

.page-nav {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.nav-btn {
    border: 1px solid rgba(10, 64, 92, 0.45);
    background: rgba(239, 249, 250, 0.88);
    color: var(--ink);
    border-radius: 12px;
    padding: 0.65rem 1.5rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.nav-btn:hover {
    transform: translateY(-1px);
    background: #fff;
}

.nav-btn.active {
    background: #2c7288;
    color: #f6e29a;
    border-color: #2c7288;
}

.view {
    display: none;
    animation: fade 0.4s ease;
}

.view.active {
    display: block;
}

.panel {
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    background: var(--panel);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow);
    padding: 1.1rem;
}

.panel-heading {
    margin-bottom: 1rem;
}

.landing-cover {
    min-height: calc(100vh - 150px);
    border-radius: 24px;
    padding: 1.2rem 1rem 1.5rem;
    display: grid;
    align-content: start;
    justify-items: center;
    background:
        radial-gradient(circle at 72% 54%, rgba(35, 171, 170, 0.36), transparent 26%),
        radial-gradient(circle at 24% 58%, rgba(34, 138, 181, 0.28), transparent 24%),
        linear-gradient(110deg, #1099b2 8%, #8fd6df 100%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.landing-cover::before {
    content: '';
    position: absolute;
    left: -12%;
    right: -12%;
    bottom: 6.4rem;
    height: 140px;
    background: linear-gradient(0deg, rgba(230, 245, 248, 0.92), rgba(230, 245, 248, 0.66));
}

.cover-brand-mark,
.cover-org,
.cover-title,
.cover-note-band,
.cover-footnote {
    position: relative;
    z-index: 1;
}

.cover-brand-mark {
    width: 74px;
    height: 74px;
    border-radius: 999px;
    border: 6px solid #f0bf4a;
    background: linear-gradient(180deg, #2f86aa, #1c546f);
    color: #edf8ff;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    display: grid;
    place-items: center;
}

.cover-org {
    margin: 0.5rem 0 0;
    color: #e8454f;
    font-size: 0.95rem;
}

.cover-title {
    margin: 1.45rem 0 0;
    text-align: center;
    max-width: 16ch;
    color: #17476e;
    font-size: clamp(2.4rem, 6vw, 5.4rem);
    letter-spacing: 0.01em;
    line-height: 1.02;
}

.cover-title span {
    display: block;
    margin-top: 0.2rem;
}

.cover-note-band {
    margin-top: 8.2rem;
    width: min(1100px, 98%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.cover-footnote {
    margin: 2rem 0 0;
    width: min(1100px, 98%);
    text-align: left;
    color: #e8f9ff;
    font-size: 1.06rem;
    font-style: italic;
}

.home-stat {
    background: transparent;
    border: none;
    border-radius: 14px;
    padding: 0.5rem 0.7rem;
    text-align: center;
}

.home-stat span {
    font-family: 'Literata', serif;
    font-size: clamp(1.8rem, 3.3vw, 3rem);
    color: #1a4061;
    font-weight: 700;
}

.home-stat strong {
    display: block;
    margin-top: 0.2rem;
    font-family: 'Literata', serif;
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    color: #222b35;
}

.layout-grid {
    display: grid;
    grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
    gap: 1rem;
}

.control-dock,
.visual-stack {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.spotlight-card strong {
    display: block;
    margin-top: 0.25rem;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    font-family: 'Literata', serif;
}

.spotlight-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    color: var(--muted);
}

.spotlight-values {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    margin-top: 0.45rem;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}

.stat-value {
    display: block;
    margin-top: 0.1rem;
    font-size: 1.45rem;
    font-family: 'Literata', serif;
}

.hero-growth-row {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}

.gr-badge {
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.8rem;
    border: 1px solid rgba(20, 111, 142, 0.3);
    background: rgba(20, 111, 142, 0.12);
    color: #0c5b74;
}

.region-grid {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.region-btn {
    border: 1px solid var(--line);
    background: #f4fafc;
    border-radius: 12px;
    padding: 0.55rem 0.4rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: 0.15s ease;
}

.region-btn:hover {
    background: #ffffff;
}

.region-btn.active {
    background: #2c7288;
    color: #f5e7ae;
    border-color: #2c7288;
}

.upload-panel input {
    width: 100%;
    margin-top: 0.35rem;
    margin-bottom: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.58rem 0.65rem;
    background: #f5fbfd;
    color: var(--ink);
    font: inherit;
}

.upload-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #31566a;
}

.upload-btn {
    width: 100%;
    margin-top: 0.15rem;
    border: 1px solid #2c7288;
    border-radius: 10px;
    background: #2c7288;
    color: #f8f1c8;
    font: inherit;
    font-weight: 700;
    padding: 0.62rem 0.8rem;
    cursor: pointer;
}

.upload-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.upload-status {
    min-height: 1.3rem;
    margin: 0.6rem 0 0;
    font-size: 0.84rem;
    color: #456275;
}

.upload-status[data-type='success'] {
    color: #19683a;
}

.upload-status[data-type='error'] {
    color: #9c2b37;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.metric-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-strong);
    padding: 0.9rem;
}

.metric-card span,
.metric-card small {
    display: block;
}

.metric-card small {
    color: var(--muted);
    line-height: 1.35;
}

.metric-card strong {
    display: block;
    margin: 0.35rem 0;
    font-family: 'Literata', serif;
    font-size: clamp(1.5rem, 3.2vw, 2.2rem);
}

.low strong {
    color: var(--low);
}

.medium strong {
    color: var(--medium);
}

.high strong {
    color: var(--high);
}

#projectionChart {
    width: 100%;
    height: auto;
    margin-top: 0.65rem;
    display: block;
}

.table-wrap {
    overflow: auto;
    max-height: 360px;
    margin-top: 0.65rem;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    table-layout: fixed;
}

thead {
    position: sticky;
    top: 0;
    background: #e5f0f4;
}

th,
td {
    text-align: left;
    padding: 0.72rem 0.6rem;
    border-bottom: 1px solid var(--line);
}

td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.base-row td {
    font-weight: 700;
    background: rgba(20, 111, 142, 0.08);
}

.col-low {
    color: var(--low);
}

.col-medium {
    color: var(--medium);
}

.col-high {
    color: var(--high);
}

.summary-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.8fr;
    gap: 1rem;
}

.summary-text p {
    margin: 0.85rem 0 0;
    color: #22465a;
    line-height: 1.55;
}

.rank-list {
    margin: 0;
    padding-left: 1.05rem;
    display: grid;
    gap: 0.45rem;
}

.rank-list li {
    border-bottom: 1px dashed rgba(10, 60, 84, 0.25);
    padding-bottom: 0.3rem;
}

.age-breakdown[hidden] {
    display: none;
}

.age-chart-wrap {
    margin-top: 0.35rem;
    overflow: hidden;
}

.age-chart-wrap svg {
    width: 100%;
    min-width: 0;
}

.chart-tooltip {
    position: fixed;
    z-index: 20;
    background: rgba(7, 34, 51, 0.92);
    color: #f7fcff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
    pointer-events: none;
    font-size: 0.82rem;
    line-height: 1.35;
}

.chart-tooltip strong {
    display: block;
    margin-bottom: 0.15rem;
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {

    .layout-grid,
    .summary-grid,
    .metric-grid,
    .cover-note-band {
        grid-template-columns: 1fr;
    }

    .region-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 1rem, 100%);
    }

    .nav-btn {
        flex: 1;
        min-width: 90px;
    }

    .cover-title {
        max-width: 12ch;
    }

    .cover-note-band {
        margin-top: 6.5rem;
    }

    .home-stat {
        text-align: left;
    }

    th,
    td {
        min-width: 110px;
    }
}