/**
 * MoALD - National SACCO & FPO Reporting Dashboard
 * Landing page styles
 */

:root {
    --green: #2d6a30;
    --green-dark: #17402a;
    --green-mid: #40916c;
    --green-tint: #eef6ef;
    --green-tint-border: #cfe6d2;
    --gold: #d1a63a;
    --brown: #7a5230;
    --brown-mid: #99693d;
    --brown-tint: #f7f0e8;
    --brown-tint-border: #e7d6c2;
    --cream: #f7f6f2;
    --ink: #16130f;
    --ink-soft: #4a463f;
    --ink-muted: #857f74;
    --surface: #ffffff;
    --border: #e8e5df;
    --shadow-sm: 0 1px 2px rgba(22, 19, 15, 0.05);
    --shadow-md: 0 10px 30px -12px rgba(22, 19, 15, 0.18);
    --shadow-lg: 0 24px 60px -20px rgba(22, 19, 15, 0.28);
    --radius: 18px;
    --radius-sm: 12px;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--cream);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

svg { display: block; }

/* ── Kenya tricolor ── */
.tricolor { display: flex; height: 4px; }
.tricolor span:nth-child(1) { flex: 1; background: #111; }
.tricolor span:nth-child(2) { flex: 1; background: #b3261e; }
.tricolor span:nth-child(3) { flex: 1; background: var(--green); }

/* ── Top bar ── */
.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.topbar-brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.topbar-brand img { height: 34px; width: auto; flex-shrink: 0; }
.topbar-brand-text strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--ink);
    line-height: 1.15;
}
.topbar-brand-text span {
    display: block;
    font-size: 0.68rem;
    color: var(--ink-muted);
    line-height: 1.3;
    max-width: 260px;
}

.topbar-projects { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.topbar-projects img {
    height: 30px;
    width: auto;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 3px 6px;
}

/* ── Shell ── */
.landing { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Hero ── */
.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(120% 120% at 100% 0%, #1f5a3a 0%, transparent 55%),
        linear-gradient(155deg, var(--green-dark) 0%, #235536 55%, #1a4a2e 100%);
    color: #fff;
    isolation: isolate;
}

.hero-bg { position: absolute; inset: 0; z-index: -1; }
.hero-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(120% 100% at 30% 0%, #000 0%, transparent 75%);
}
.hero-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; }
.hero-glow--gold { width: 380px; height: 380px; background: rgba(209, 166, 58, 0.35); top: -120px; right: -60px; }
.hero-glow--mint { width: 320px; height: 320px; background: rgba(64, 145, 108, 0.4); bottom: -160px; left: -80px; }

.hero-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 3.25rem 1.5rem 3.75rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: center;
}

@media (min-width: 900px) {
    .hero-inner {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 3rem;
        padding: 4.25rem 1.5rem 4.75rem;
    }
}

.hero h1 {
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.1rem;
}

.hero-lead {
    font-size: clamp(1rem, 1.4vw, 1.12rem);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    max-width: 48ch;
    margin-bottom: 1.9rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ── Hero cycle card ── */
.hero-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    color: var(--ink);
}

.hero-card-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-bottom: 1.1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}
.hero-card-logos img { height: 40px; width: auto; object-fit: contain; }
.hero-card-div { width: 1px; height: 30px; background: var(--border); }

.hero-card-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.85rem;
}

.cycle { list-style: none; display: flex; flex-direction: column; gap: 0.65rem; }
.cycle-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.cycle-item--sacco { background: var(--green-tint); border-color: var(--green-tint-border); }
.cycle-item--fpo { background: var(--brown-tint); border-color: var(--brown-tint-border); }
.cycle-icon {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
}
.cycle-icon svg { width: 22px; height: 22px; }
.cycle-item--sacco .cycle-icon { color: var(--green); }
.cycle-item--fpo .cycle-icon { color: var(--brown); }
.cycle-text { display: flex; flex-direction: column; line-height: 1.3; }
.cycle-text strong { font-size: 0.95rem; font-weight: 700; }
.cycle-text span { font-size: 0.82rem; color: var(--ink-soft); }

.cycle-foot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green);
}
.cycle-foot svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.15rem;
    border-radius: 11px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.15s ease, color 0.15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-2px); }
.btn-lg { padding: 0.9rem 1.65rem; font-size: 0.98rem; }

.btn-white {
    background: #fff;
    color: var(--green-dark);
    box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.35);
}
.btn-white:hover { background: #f8faf8; }

.btn-hero-outline {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    box-shadow: none;
}
.btn-hero-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.65);
}

/* ── Main ── */
.main {
    flex: 1;
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.5rem 0.5rem;
}

.section { margin-bottom: 3rem; }

.section-title {
    font-size: clamp(1.25rem, 2.5vw, 1.55rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 1.35rem;
    color: var(--ink);
}

/* ── How it works ── */
.steps {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }

.step {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--green-dark);
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}
.step:nth-child(2) .step-num { background: var(--gold); color: #3a2c07; }
.step:nth-child(3) .step-num { background: var(--brown); }
.step-body h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; }
.step-body p { color: var(--ink-soft); font-size: 0.9rem; }

@media (min-width: 760px) {
    .step:not(:last-child)::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -0.9rem;
        width: 1.25rem;
        height: 2px;
        background: var(--border);
        transform: translateY(-50%);
    }
    .step:not(:last-child)::before {
        content: "";
        position: absolute;
        top: 50%;
        right: -0.95rem;
        width: 7px; height: 7px;
        border-top: 2px solid var(--border);
        border-right: 2px solid var(--border);
        transform: translateY(-50%) rotate(45deg);
        z-index: 1;
    }
}

/* ── Form buttons ── */
.form-links {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.form-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1.35rem;
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    color: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-btn svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.form-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.form-btn--sacco {
    background: var(--green);
    box-shadow: 0 6px 18px -6px rgba(45, 106, 48, 0.55);
}
.form-btn--sacco:hover { background: var(--green-mid); }

.form-btn--fpo {
    background: var(--brown);
    box-shadow: 0 6px 18px -6px rgba(122, 82, 48, 0.5);
}
.form-btn--fpo:hover { background: var(--brown-mid); }

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 19, 15, 0.45);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    width: min(100%, 380px);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.22s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--cream);
    color: var(--ink-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { background: var(--border); color: var(--ink); }

.modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    padding-right: 2rem;
}

.modal-sub {
    font-size: 0.88rem;
    color: var(--ink-muted);
    margin-bottom: 1.25rem;
}

.modal-options { display: flex; flex-direction: column; gap: 0.65rem; }

.modal-option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--ink);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.modal-option:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.modal-option--sacco:hover { border-color: var(--green-tint-border); background: var(--green-tint); }
.modal-option--fpo:hover { border-color: var(--brown-tint-border); background: var(--brown-tint); }

.modal-option-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
}
.modal-option-icon svg { width: 22px; height: 22px; }
.modal-option--sacco .modal-option-icon { color: var(--green); background: var(--green-tint); }
.modal-option--fpo .modal-option-icon { color: var(--brown); background: var(--brown-tint); }

.modal-option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}
.modal-option-text strong { font-size: 0.95rem; font-weight: 700; }
.modal-option-text span { font-size: 0.78rem; color: var(--ink-muted); }

.modal-option-arrow {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--ink-muted);
    transition: transform 0.15s;
}
.modal-option:hover .modal-option-arrow { transform: translateX(2px); color: var(--ink-soft); }

/* ── Top nav ── */
.topbar-nav {
    display: none;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.82rem;
    font-weight: 600;
}
.topbar-nav a {
    color: var(--ink-soft);
    text-decoration: none;
}
.topbar-nav a:hover { color: var(--green); }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.btn-top-login {
    display: none;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    border: none;
    background: var(--green);
    color: #fff;
    cursor: pointer;
}
@media (min-width: 768px) {
    .topbar-nav { display: flex; }
    .btn-top-login { display: inline-block; }
}

/* ── Atlas: reported position below the hero ── */
.atlas {
    background: var(--cream);
    padding: 2.5rem 1.25rem 3rem;
    border-bottom: 1px solid var(--border);
}
.atlas-wrap { max-width: 1120px; margin: 0 auto; }
.atlas-intro {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
@media (min-width: 800px) {
    .atlas-intro { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 2rem; }
}
.atlas-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--green-mid);
    margin-bottom: 0.35rem;
}
.atlas-intro h2, .county-head h3 {
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--ink);
}
.atlas-lead {
    margin-top: 0.55rem;
    max-width: 58ch;
    color: var(--ink-soft);
    font-size: 0.98rem;
}
.atlas-stamp {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    text-align: center;
}
.intro-meta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    flex-shrink: 0;
}
@media (min-width: 480px) {
    .intro-meta { align-items: flex-end; min-width: 12rem; }
}
.impact-header + .data-shell { margin-top: 0.25rem; }

.data-shell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.35rem 1.15rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
@media (min-width: 640px) {
    .data-shell { padding: 1.65rem 1.5rem 1.75rem; gap: 1.65rem; }
}
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border) 12%, var(--border) 88%, transparent);
    margin: 0.15rem 0;
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 900px) {
    .detail-grid { grid-template-columns: 1fr 1fr; gap: 1.15rem; }
}
.chart-grid--landing {
    margin-top: 0;
}
.chart-grid--landing .dash-card--wide-chart {
    grid-column: 1 / -1;
}
@media (min-width: 768px) {
    .chart-grid--landing {
        grid-template-columns: 1.35fr 0.85fr;
    }
    .chart-grid--landing .dash-card--wide-chart {
        grid-column: auto;
    }
}
.dash-card--detail {
    min-height: 0;
    box-shadow: none;
    background: #fafaf8;
    border-color: #ebe8e2;
}
.dash-card--detail .dash-card-head {
    background: linear-gradient(180deg, #fff 0%, #fafaf8 100%);
}
.dash-card--sacco .dash-card-head h3 { color: var(--green-dark); }
.dash-card--fpo .dash-card-head h3 { color: var(--brown); }
.dash-card-body--facts {
    padding: 1rem 1.15rem 1.1rem;
    flex: 1;
}
.dash-card--chart {
    min-height: 300px;
}
.dash-card--chart .chart-body--tall {
    min-height: 300px;
}
.dash-card--chart .chart-body--tall canvas { max-height: none; }
.county-head h3 {
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--ink);
    margin-top: 0.25rem;
}

.headline-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
}
@media (min-width: 720px) { .headline-grid { grid-template-columns: repeat(4, 1fr); } }
.metric {
    background: #fff;
    border-radius: 16px;
    padding: 1rem 1rem 0.9rem;
    border: 1px solid rgba(22, 19, 15, 0.06);
    box-shadow: 0 10px 30px -22px rgba(23, 64, 42, 0.45);
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.metric--sacco { box-shadow: inset 3px 0 0 var(--green); }
.metric--fpo { box-shadow: inset 3px 0 0 var(--brown-mid), 0 10px 30px -22px rgba(23, 64, 42, 0.45); }
.metric--reach { box-shadow: inset 3px 0 0 var(--gold), 0 10px 30px -22px rgba(23, 64, 42, 0.45); }
.metric-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.metric-value {
    margin-top: 0.35rem;
    font-size: clamp(1.35rem, 2.4vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    line-height: 1.1;
}
.metric-value--kes { font-size: clamp(1.05rem, 2vw, 1.35rem); }
.metric-caption {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
    line-height: 1.35;
}
.metric-value.is-loading {
    color: transparent;
    background: linear-gradient(90deg, #eee 25%, #f7f7f7 50%, #eee 75%);
    background-size: 200% 100%;
    animation: stat-shimmer 1.2s infinite;
    border-radius: 6px;
    min-height: 1.5rem;
    max-width: 70%;
}
@keyframes stat-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.form-panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.25rem;
}
@media (min-width: 900px) { .form-panels { grid-template-columns: 1.15fr 0.85fr; } }
.form-panel {
    background: #fff;
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 1.25rem 1.25rem 1.1rem;
    box-shadow: var(--shadow-sm);
}
.form-panel-head p {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green);
}
.form-panel--fpo .form-panel-head p { color: var(--brown); }
.form-panel-head h3 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.2rem 0 1rem;
}
.fact-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem 1rem; }
.fact-list div {
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #f0eee9;
}
.fact-list dt {
    font-size: 0.72rem;
    color: var(--ink-muted);
    font-weight: 600;
}
.fact-list dd {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.rank-block { margin-top: 1.1rem; }
.rank-block h4 {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.45rem;
}
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.rank-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.88rem;
    padding: 0.4rem 0;
    border-bottom: 1px dashed #efece6;
}
.rank-list li span:last-child { font-weight: 700; color: var(--green-dark); }
.rank-empty { color: var(--ink-muted); border: none !important; }

.viz-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.25rem;
}
@media (min-width: 900px) { .viz-grid { grid-template-columns: 1.4fr 0.8fr; } }
.viz-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    min-height: 320px;
    display: flex;
    flex-direction: column;
}
.viz-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
    padding: 1rem 1.15rem 0.7rem;
}
.viz-head h3 { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
.viz-head span { font-size: 0.75rem; color: var(--ink-muted); text-align: right; }
.viz-body { position: relative; flex: 1; min-height: 240px; padding: 0 0.85rem 1rem; }
.viz-body--tall { min-height: 340px; }

.stat-note {
    position: relative;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--ink-muted);
    line-height: 1.35;
    max-width: 14rem;
}
.report-table-stack {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}
.report-table-block { display: flex; flex-direction: column; gap: 0.65rem; }
.county-head--solo { margin-bottom: 0.35rem; }
.table-kicker {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}
.table-kicker--sacco { color: var(--green-dark); }
.table-kicker--fpo { color: var(--brown); }
.county-block { margin-top: 0; padding-top: 0.25rem; }
.county-head {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}
@media (min-width: 720px) {
    .county-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}
/* County DataTables (aligned with SACCO list pages) */
.filter-panel {
    background: #fafaf8;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 0.85rem;
}
.filter-panel--compact { flex-wrap: nowrap; }
.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.75rem;
    flex: 1;
    min-width: 0;
    align-items: flex-end;
}
.filter-field label {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    margin-bottom: 0.22rem;
}
.landing-field {
    font-family: var(--font);
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
    min-height: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}
.filter-field--search { flex: 1 1 140px; max-width: 220px; }
.filter-field--county { flex: 0 0 150px; max-width: 180px; }
.btn-filter-clear {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink-soft);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    min-height: 2rem;
    flex-shrink: 0;
}
.btn-filter-clear:hover { background: var(--green-tint); color: var(--green-dark); }
@media (max-width: 640px) {
    .filter-panel--compact { flex-wrap: wrap; }
    .filter-field--search, .filter-field--county { flex: 1 1 100%; max-width: none; }
}

.data-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.landing-data-card { box-shadow: none; background: #fff; }
.data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafaf8 0%, #fff 100%);
}
.data-card-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.data-card-title--sacco { color: var(--green-dark); }
.data-card-title--fpo { color: var(--brown); }
.data-card-count {
    font-size: 0.78rem;
    color: var(--ink-muted);
    font-weight: 600;
    white-space: nowrap;
}

.dashboard-table-scroll {
    max-height: min(520px, calc(100vh - 240px));
    overflow: auto;
    position: relative;
}
.landing-table-scroll table.landing-dt {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}
.landing-table-scroll table.landing-dt thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f7f6f2;
    box-shadow: 0 1px 0 var(--border);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid var(--border);
}
.landing-table-scroll table.landing-dt td {
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid #f3f1ec;
    color: var(--ink-soft);
}
.landing-table-scroll table.landing-dt td.dt-num,
.landing-table-scroll table.landing-dt thead th:not(.col-county-sticky) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.landing-table-scroll table.landing-dt tbody tr:hover td {
    background: #f8fbf8;
}
.landing-table-scroll .col-county-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    font-weight: 700;
    color: var(--ink);
    text-align: left !important;
    min-width: 120px;
    box-shadow: 2px 0 6px rgba(22, 19, 15, 0.04);
}
.landing-table-scroll thead th.col-county-sticky { z-index: 5; background: #f7f6f2; }

.data-card > .navcdp-dt-footer,
.landing-dt-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border);
    background: #fafaf8;
    font-size: 0.8rem;
    color: var(--ink-muted);
}
.navcdp-dt-footer .dataTables_length label,
.navcdp-dt-footer .dataTables_info { margin: 0; }
.navcdp-dt-footer .dataTables_length select {
    font-family: var(--font);
    font-size: 0.8rem;
    margin: 0 0.35rem;
    padding: 0.15rem 1.4rem 0.15rem 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.navcdp-dt-footer .dataTables_paginate .paginate_button {
    font-family: var(--font);
    font-size: 0.78rem;
    padding: 0.2rem 0.55rem !important;
    border-radius: 6px !important;
    border: 1px solid var(--border) !important;
    margin-left: 0.25rem;
}
.navcdp-dt-footer .dataTables_paginate .paginate_button.current {
    background: var(--green-tint) !important;
    border-color: var(--green-tint-border) !important;
    color: var(--green-dark) !important;
}
.landing-table-scroll .dataTables_wrapper { padding: 0; }
.landing-table-scroll .dataTables_filter,
.landing-table-scroll .dataTables_length { display: none; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

.impact-section { display: none; }

.impact-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}
@media (min-width: 768px) {
    .impact-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 2rem;
    }
}
.impact-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--green-mid);
    margin-bottom: 0.35rem;
}
.impact-header h2 {
    font-size: clamp(1.35rem, 2.8vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 0.4rem;
}
.impact-lead {
    font-size: 0.92rem;
    color: var(--ink-soft);
    max-width: 52ch;
    line-height: 1.55;
}
.verified-callout {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: var(--surface);
    border: 1px solid var(--green-tint-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--green-dark);
}
.verified-callout i {
    color: var(--green-mid);
    font-size: 1.1rem;
}

.stats-rows {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}
.stats-row-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.65rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}
.stats-row--sacco .stats-row-heading { color: var(--green-dark); border-bottom-color: var(--green-tint-border); }
.stats-row--fpo .stats-row-heading { color: var(--brown); border-bottom-color: var(--brown-tint-border); }

.stats-row-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
}
.stats-row-grid > .stat-card { height: 100%; }
.stats-row-grid--3 {
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .stats-row-grid--3 { grid-template-columns: repeat(3, 1fr); }
}
.stats-row-grid--4 {
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) {
    .stats-row-grid--4 { grid-template-columns: repeat(4, 1fr); }
}
.stats-row-grid--6 {
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) {
    .stats-row-grid--6 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .stats-row-grid--6 { grid-template-columns: repeat(6, 1fr); }
}
.programme-rows {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
}
.stat-value--kes {
    font-size: clamp(1rem, 2vw, 1.28rem) !important;
    letter-spacing: -0.03em;
}
.stats-row-grid--1 {
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .stats-row--reach .stats-row-grid--1 { max-width: 320px; }
}
.stat-card--wide .stat-value {
    font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 1.35rem 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 108px;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(45, 106, 48, 0.09) 0%, transparent 100%);
    border-radius: 50%;
    transform: translate(30%, -30%);
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
    position: relative;
    line-height: 1.35;
    max-width: 11rem;
}
.stat-card .stat-value {
    font-size: clamp(1.2rem, 2.2vw, 1.45rem);
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
    position: relative;
}
.stat-card .stat-icon {
    position: absolute;
    top: 1.15rem;
    right: 1.15rem;
    font-size: 1.55rem;
    opacity: 0.11;
    color: var(--green);
    pointer-events: none;
}
.stat-card.info .stat-icon { color: #0d6efd; }
.stat-card.warning .stat-icon { color: var(--gold); }
.stat-card.success .stat-icon { color: var(--green-mid); }

.stat-value.is-loading {
    color: transparent !important;
    background: linear-gradient(90deg, #e8e6e1 25%, #f3f2ef 50%, #e8e6e1 75%);
    background-size: 200% 100%;
    animation: stat-shimmer 1.2s infinite;
    border-radius: 6px;
    min-height: 1.45rem;
    max-width: 72%;
}
@keyframes stat-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.impact-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    margin: 1.35rem 0 1.5rem;
    padding: 0.8rem 1.05rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--ink-soft);
    line-height: 1.45;
}
.impact-meta-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-mid);
    flex-shrink: 0;
}
.impact-meta-sep { color: var(--ink-muted); opacity: 0.45; }
.impact-meta-muted { color: var(--ink-muted); font-size: 0.78rem; }

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) {
    .chart-grid { grid-template-columns: repeat(2, 1fr); gap: 1.15rem; }
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}
.dash-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem 0.65rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafaf8 0%, var(--surface) 100%);
}
.dash-card-head h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.01em;
}
.dash-card-hint {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-align: right;
    line-height: 1.3;
    max-width: 9rem;
}
.dash-card-body.chart-body {
    flex: 1;
    padding: 0.85rem 1rem 1rem;
    position: relative;
    min-height: 220px;
}
.dash-card-body canvas { max-height: 240px; }
.dash-card--wide {
    margin-top: 1rem;
    min-height: 320px;
}
.chart-grid--landing .dash-card--wide { margin-top: 0; }
.chart-body--tall { min-height: 260px; }

/* ── Partners ── */
.partners { text-align: center; padding: 2.5rem 1.5rem 1.5rem; }
.partners img { max-width: 100%; height: auto; max-height: 52px; object-fit: contain; opacity: 0.82; }
@media (min-width: 640px) { .partners img { max-height: 64px; } }

/* ── Footer ── */
.landing-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.1rem 1.5rem;
    text-align: center;
}
.landing-footer p { font-size: 0.78rem; color: var(--ink-muted); }
