:root {
    --violet-900: #4c1d95;
    --violet-700: #6d28d9;
    --violet-500: #8b5cf6;
    --violet-100: #ede9fe;
    --violet-50: #f5f3ff;
    --ink: #25324b;
    --muted: #64748b;
    --line: #dbe1ea;
    --surface: #ffffff;
    --page: #f5f4f8;
    --shadow: 0 10px 30px rgba(63, 45, 90, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    font-family: Tahoma, "Noto Sans Thai", sans-serif;
    color: var(--ink);
    background: var(--page);
}

.bg-soft,
.dashboard-body {
    background:
        radial-gradient(circle at 10% 0%, rgba(139, 92, 246, 0.08), transparent 30%),
        var(--page);
}

.app-navbar {
    background: linear-gradient(120deg, #4c1d95, #6d28d9 60%, #7c3aed);
    box-shadow: 0 4px 18px rgba(76, 29, 149, 0.22);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-right: 8px;
    border-radius: 10px;
    color: #5b21b6;
    background: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--violet-700);
}

.btn-primary {
    --bs-btn-bg: #6d28d9;
    --bs-btn-border-color: #6d28d9;
    --bs-btn-hover-bg: #5b21b6;
    --bs-btn-hover-border-color: #5b21b6;
}

.btn-outline-primary {
    --bs-btn-color: #6d28d9;
    --bs-btn-border-color: #8b5cf6;
    --bs-btn-hover-bg: #6d28d9;
    --bs-btn-hover-border-color: #6d28d9;
}

.form-control:focus,
.form-select:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.15);
}

.card {
    border-radius: 18px;
}

.login-card {
    margin-top: 4vh;
}

.install-summary {
    padding: 16px 18px;
    border: 1px solid #ddd6fe;
    border-radius: 14px;
    background: #faf8ff;
    line-height: 1.8;
}

.validation-list {
    display: grid;
    gap: 14px;
}

.validation-list > div {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid #e7e3ef;
    border-radius: 13px;
    background: #fbfaff;
}

.step-number {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--violet-100);
    color: var(--violet-700);
    font-weight: 800;
}

.dashboard-shell {
    min-height: calc(100vh - 60px);
}

.report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(1680px, calc(100% - 28px));
    margin: 18px auto 10px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-page {
    width: min(1680px, calc(100% - 28px));
    margin: 0 auto 32px;
    padding: 16px;
    border: 1px solid #dedbe6;
    background: #fff;
    box-shadow: var(--shadow);
}

.report-header {
    margin-bottom: 10px;
}

.report-title-strip {
    padding: 10px 18px;
    text-align: center;
    background: #eee6fa;
    border-top: 1px solid #e4d8f7;
    border-bottom: 1px solid #e4d8f7;
}

.report-title-strip h1 {
    margin: 0;
    color: #3f3153;
    font-size: clamp(1rem, 1.35vw, 1.4rem);
    font-weight: 700;
}

.report-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px 28px;
    padding: 8px 10px 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.kpi-card {
    position: relative;
    min-height: 96px;
    padding: 14px 16px;
    overflow: hidden;
    border: 1px solid #e6e3eb;
    border-radius: 12px;
    background: #fff;
}

.kpi-card::after {
    position: absolute;
    right: -18px;
    bottom: -24px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    content: "";
    opacity: 0.16;
    background: currentColor;
}

.kpi-violet { color: #6d28d9; background: #faf8ff; }
.kpi-orange { color: #ea580c; background: #fff9f2; }
.kpi-green { color: #15803d; background: #f4fbf6; }
.kpi-blue { color: #2563eb; background: #f4f8ff; }

.kpi-label {
    display: block;
    color: #596579;
    font-size: 0.78rem;
    font-weight: 700;
}

.kpi-value {
    display: inline-block;
    margin-top: 6px;
    font-size: clamp(1.5rem, 2.1vw, 2.35rem);
    line-height: 1;
}

.kpi-unit {
    margin-left: 4px;
    color: #67748a;
    font-size: 0.74rem;
}

.top-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.9fr);
    gap: 10px;
    margin-bottom: 10px;
}

.panel {
    border: 1px solid #dfe3ea;
    background: #fff;
}

.panel-chart {
    padding: 12px;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    margin-bottom: 5px;
}

.panel-heading.compact {
    min-height: 26px;
}

.panel-heading h2,
.detail-title-strip h2 {
    margin: 0;
    color: #5b2b84;
    font-size: 0.9rem;
    font-weight: 700;
}

.panel-heading p {
    margin: 3px 0 0;
    color: #7a8495;
    font-size: 0.68rem;
}

.panel-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    color: #5b21b6;
    background: #f3e8ff;
    font-size: 0.68rem;
    font-weight: 700;
}

.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap > .plot-chart {
    width: 100%;
    height: 100%;
}

.plot-chart .modebar {
    display: none !important;
}

.chart-xl { height: 360px; }
.chart-lg { height: 270px; }
.chart-md { height: 235px; }

.district-summary-table {
    margin-top: 4px;
}

.district-summary-table table {
    width: 100%;
    min-width: 940px;
    border-collapse: collapse;
    font-size: 0.62rem;
    text-align: center;
}

.district-summary-table th,
.district-summary-table td {
    padding: 4px 5px;
    border: 1px solid #e4e0e8;
}

.district-summary-table thead th {
    color: #58377a;
    background: #f8f2ff;
}

.district-summary-table tbody th {
    min-width: 115px;
    color: #6b4e32;
    background: #fff8ed;
    text-align: left;
}

.summary-column {
    display: grid;
    align-content: start;
    gap: 10px;
}

.comparison-card {
    overflow: hidden;
}

.comparison-title {
    padding: 9px 10px;
    color: #356447;
    background: #c7f5d4;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 0.95fr 1.25fr 0.8fr;
    text-align: center;
}

.comparison-grid > div {
    display: grid;
    place-items: center;
    min-height: 38px;
    padding: 5px;
    border-right: 1px solid #e1e6e4;
    border-bottom: 1px solid #e1e6e4;
    font-size: 0.7rem;
}

.comparison-label {
    color: #70663f;
    background: #fffbc2;
    font-weight: 700;
}

.comparison-value {
    font-weight: 700;
}

.previous-year { background: #dceef8; }
.current-year { background: #cfe9fa; }

.comparison-reduction {
    grid-column: 3;
    grid-row: 2 / span 2;
    color: #675d2a;
    background: #f5f6b7;
    font-size: 1rem !important;
    font-weight: 800;
}

.rate-card,
.target-box {
    display: flex;
    min-height: 84px;
    padding: 12px 16px;
    border: 1px solid #eadfb9;
    background: #fff8dd;
}

.rate-card > div,
.target-box {
    width: 100%;
}

.rate-card span,
.target-box span {
    display: block;
    color: #66583e;
    font-size: 0.75rem;
    font-weight: 700;
}

.rate-card strong,
.target-box strong {
    display: inline-block;
    margin: 6px 10px 0 0;
    color: #5641c2;
    font-size: 1.55rem;
}

.rate-card small,
.target-box small {
    color: #776e5d;
    font-size: 0.64rem;
}

.rate-card-muted {
    border-color: #e3e0e7;
    background: #f7f6f8;
}

.target-box {
    min-height: 75px;
    border-color: #d8e8cb;
    background: #eefbe7;
}

.target-box strong {
    color: #198754;
}

.charts-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.charts-grid-demographic {
    grid-template-columns: 0.9fr 1fr 1.6fr;
}

.charts-grid-factors {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.charts-grid-history {
    grid-template-columns: 0.85fr 1.45fr;
}

.detail-section {
    border: 1px solid #dbe0e7;
    background: #fff;
}

.detail-title-strip {
    padding: 7px 12px;
    text-align: center;
    background: #efffb9;
    border-bottom: 1px solid #dce89d;
}

.detail-title-strip h2 {
    color: #65731f;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.5fr) minmax(270px, 0.8fr);
    gap: 14px;
    padding: 12px;
}

.detail-table-wrap {
    overflow: auto;
}

.detail-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-size: 0.62rem;
    text-align: center;
}

.detail-table th,
.detail-table td {
    height: 24px;
    padding: 3px 5px;
    border: 1px solid #4f4f4f;
}

.detail-table thead th {
    color: #fff;
    background: #5b1c84;
}

.detail-table tbody th {
    min-width: 120px;
    background: #f0e7f8;
    text-align: left;
}

.detail-table tbody tr:nth-child(n+1) td {
    background: #f7f0fb;
}

.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td {
    color: #183b62;
    background: #9fdcf5;
    font-weight: 700;
}

.insight-column {
    display: grid;
    align-content: start;
    gap: 10px;
}

.insight-card {
    min-height: 100px;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.insight-card span {
    display: block;
    color: #594f65;
    font-size: 0.72rem;
}

.insight-card strong {
    display: block;
    margin: 10px 0 2px;
    color: #3d2f49;
    font-size: 0.95rem;
}

.insight-card small {
    color: #604d68;
    font-size: 0.75rem;
    font-weight: 700;
}

.insight-yellow {
    background: #fff4b8;
    border: 1px solid #f0df84;
}

.insight-pink {
    background: #f6c9ef;
    border: 1px solid #e9aee1;
}

.insight-note {
    padding: 12px 14px;
    border: 1px dashed #d3cbdc;
    border-radius: 10px;
    color: #635c69;
    font-size: 0.68rem;
}

.insight-note ul {
    margin: 7px 0 0;
    padding-left: 18px;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 2px 0;
    color: #808896;
    font-size: 0.62rem;
}

.empty-icon {
    margin-bottom: 10px;
    font-size: 3rem;
}

.table thead th {
    color: #566074;
    background: #f5f3f8;
    font-size: 0.78rem;
    white-space: nowrap;
}

@media (max-width: 1199.98px) {
    .top-layout,
    .charts-grid-history {
        grid-template-columns: 1fr;
    }

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

    .detail-layout {
        grid-template-columns: 1fr;
    }

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

    .insight-note {
        grid-column: 1 / -1;
    }
}

/* Themed page shortcuts: health/home and dashboard icons instead of arrows */
.page-jump-controls {
    position: fixed;
    right: clamp(14px, 1.8vw, 28px);
    bottom: clamp(18px, 2.2vw, 34px);
    z-index: 1040;
    display: grid;
    gap: 10px;
}
.page-jump-controls.is-hidden { display: none; }
.page-jump-button {
    display: inline-grid;
    width: clamp(48px, 3.4vw, 56px);
    height: clamp(48px, 3.4vw, 56px);
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(145deg, #0f766e, #2dd4bf);
    box-shadow: 0 12px 28px rgba(15,118,110,.24);
    font-size: clamp(1.25rem, .55vw + 1rem, 1.55rem);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}
.page-jump-down {
    background: linear-gradient(145deg, #be185d, #ec4899);
    box-shadow: 0 12px 28px rgba(190,24,93,.24);
}
.page-jump-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 16px 34px rgba(15,118,110,.3);
}
.page-jump-down:hover:not(:disabled) { box-shadow: 0 16px 34px rgba(190,24,93,.3); }
.page-jump-button:focus-visible {
    outline: 3px solid rgba(56,189,248,.45);
    outline-offset: 3px;
}
.page-jump-button:disabled {
    opacity: .34;
    cursor: default;
    box-shadow: none;
}

@media (max-width: 767.98px) {
    .page-jump-controls { right: 12px; bottom: 14px; gap: 8px; }
    .page-jump-button { width: 46px; height: 46px; border-radius: 15px; }
}

@media print {
    .page-jump-controls { display: none !important; }
}

/* Uploaded organization logo and admin branding preview */
.brand-mark {
    overflow: hidden;
    padding: 3px;
    border-color: rgba(15,118,110,.16) !important;
    background: #fff !important;
}
.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 13px;
    object-fit: contain;
    animation: logo-breathe 3.8s ease-in-out infinite;
    will-change: transform, filter;
}
.branding-settings-card {
    border-left: 5px solid #0f766e !important;
}
.branding-preview {
    display: grid;
    width: clamp(132px, 12vw, 178px);
    aspect-ratio: 1;
    place-items: center;
    padding: 12px;
    border: 1px solid #cce9e3;
    border-radius: 24px;
    background: linear-gradient(145deg, #fff, #ecfdf8);
    box-shadow: 0 14px 32px rgba(15,118,110,.1);
}
.branding-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 767.98px) {
    .branding-preview { margin-inline: auto; }
    .branding-settings-card .btn { width: 100%; }
}

@media (max-width: 767.98px) {
    html {
        font-size: 14px;
    }

    .report-toolbar,
    .report-page {
        width: calc(100% - 16px);
    }

    .report-page {
        padding: 8px;
    }

    .report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .form-select,
    .toolbar-actions .btn {
        flex: 1;
    }

    .kpi-grid,
    .charts-grid-demographic,
    .charts-grid-factors {
        grid-template-columns: 1fr;
    }

    .chart-xl { height: 330px; }
    .chart-lg { height: 300px; }
    .chart-md { height: 250px; }

    .insight-column {
        grid-template-columns: 1fr;
    }

    .report-footer {
        flex-direction: column;
    }
}

@media print {
    @page {
        size: A3 landscape;
        margin: 7mm;
    }

    html,
    body {
        width: auto;
        min-width: 0;
        background: #fff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .no-print,
    .app-navbar {
        display: none !important;
    }

    .dashboard-shell {
        min-height: 0;
    }

    .report-page {
        width: 100%;
        margin: 0;
        padding: 4mm;
        border: 0;
        box-shadow: none;
    }

    .report-title-strip h1 {
        font-size: 13pt;
    }

    .kpi-card {
        min-height: 65px;
        padding: 7px 10px;
    }

    .kpi-value {
        font-size: 18pt;
    }

    .chart-xl { height: 235px !important; }
    .chart-lg { height: 190px !important; }
    .chart-md { height: 165px !important; }

    .top-layout,
    .charts-grid-history {
        grid-template-columns: minmax(0, 2.2fr) minmax(235px, 0.9fr);
    }

    .charts-grid-demographic {
        grid-template-columns: 0.9fr 1fr 1.6fr;
    }

    .charts-grid-factors {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .detail-layout {
        grid-template-columns: minmax(0, 2.5fr) minmax(240px, 0.8fr);
    }

    .panel,
    .kpi-card,
    .detail-section {
        break-inside: avoid;
    }

    .report-footer {
        padding-top: 3px;
    }
}

/* Pastel dashboard direction inspired by the supplied DMHT reference */
:root {
    --ui-pink: #e83e96;
    --ui-pink-deep: #c81e68;
    --ui-pink-soft: #fce7f3;
    --ui-blue: #60a5fa;
    --ui-blue-soft: #eaf3ff;
    --ui-mint: #5eead4;
    --ui-mint-soft: #e9fbf7;
    --ui-lilac: #c4b5fd;
    --ui-lilac-soft: #f3efff;
    --ui-ink: #3f4d68;
}

body.dashboard-body,
body.bg-soft {
    background:
        radial-gradient(circle at 4% 6%, rgba(252,231,243,.9), transparent 28%),
        radial-gradient(circle at 96% 0%, rgba(224,242,254,.84), transparent 32%),
        linear-gradient(135deg, #fff7fb, #f7f4ff 48%, #effcf9);
}

.sidebar {
    width: 320px;
    padding: 22px 18px;
    border-right: 1px solid rgba(236,72,153,.14);
    background: rgba(255,252,254,.96);
    box-shadow: 14px 0 40px rgba(190,24,93,.06);
    backdrop-filter: blur(18px);
}
.main-content { margin-left: 320px; width: calc(100% - 320px); }
.sidebar-brand {
    margin-bottom: 24px;
    padding: 0 2px 18px;
    border-bottom: 1px solid #f7d9e8;
}
.brand-mark {
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(145deg, #ef4ba3, #c084fc 65%, #60a5fa);
    box-shadow: 0 12px 24px rgba(232,62,150,.24);
    font-size: 1.45rem;
}
.brand-copy strong { color: #b91c63; font-size: 1.18rem; font-weight: 900; }
.brand-copy small { color: #73809a; font-size: .76rem; }
.sidebar-collapse-btn {
    width: 38px;
    height: 38px;
    border: 1px solid #f5d7e7;
    color: #d92d80;
    background: #fff0f7;
    font-size: 1rem;
}
.sidebar-nav { gap: 5px; }
.sidebar-nav-label {
    display: block;
    margin: 16px 12px 6px;
    color: #a87a93;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.sidebar-link {
    min-height: 52px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: #58657d;
    font-size: 1rem;
    font-weight: 780;
    transition: transform 180ms ease, color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.sidebar-link:hover {
    color: #b91c63;
    background: #fff2f8;
    transform: translateX(3px);
}
.sidebar-link.active {
    border-color: rgba(236,72,153,.1);
    color: #b91c63;
    background: linear-gradient(105deg, #fde7f2, #e4efff);
    box-shadow: inset 4px 0 0 #ec4899, 0 8px 20px rgba(232,62,150,.08);
}
.nav-icon {
    display: inline-grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    color: #e83e96;
    background: rgba(252,231,243,.7);
    font-size: 1.05rem;
}
.sidebar-link.active .nav-icon {
    color: #fff;
    background: linear-gradient(145deg, #ec4899, #a78bfa);
    box-shadow: 0 7px 14px rgba(236,72,153,.2);
}
.sidebar-user {
    border: 1px solid #f6deea;
    border-radius: 20px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 14px 34px rgba(190,24,93,.08);
}
.sidebar-user .btn-primary,
.sidebar-user .btn-outline-primary {
    border-color: #ec4899;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(90deg, #d92d80, #ec4899);
}

.dashboard-filter {
    margin-bottom: 20px;
    padding: 18px 20px 20px;
    border: 1px solid rgba(255,255,255,.95);
    border-left: 5px solid var(--ui-pink);
    border-radius: 22px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 16px 38px rgba(129,87,156,.1);
    backdrop-filter: blur(18px);
    transition: box-shadow 220ms ease, transform 220ms ease;
}
.dashboard-filter.filter-applied {
    box-shadow: 0 18px 44px rgba(232,62,150,.14);
}
.filter-summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}
.filter-summary-row h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 2px;
    color: #b91c63;
    font-size: 1.08rem;
    font-weight: 900;
}
.filter-summary-row p { margin: 0; color: #66738a; font-size: .92rem; font-weight: 650; }
.filter-reset {
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    color: #b91c63;
    background: linear-gradient(90deg, #fdf2f8, #eff6ff);
    font-size: .88rem;
    font-weight: 800;
}
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr 1.45fr auto;
    gap: 12px;
    align-items: end;
}
.filter-field label {
    display: block;
    margin: 0 0 6px 2px;
    color: #4e5d75;
    font-size: .9rem;
    font-weight: 800;
}
.filter-field .form-select {
    min-height: 46px;
    border: 1px solid #f3c8dd;
    border-radius: 13px;
    color: #4c5870;
    background-color: #fff;
    font-size: .96rem;
    box-shadow: 0 5px 15px rgba(190,24,93,.035);
}
.filter-field .form-select:focus {
    border-color: #ec4899;
    box-shadow: 0 0 0 .22rem rgba(236,72,153,.11);
}
.filter-field .form-select:disabled { color: #9aa4b5; background-color: #f7f8fb; }
.filter-apply {
    display: inline-flex;
    min-width: 154px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(100deg, #d92d80, #ec4899);
    box-shadow: 0 10px 22px rgba(232,62,150,.2);
    font-size: .96rem;
    font-weight: 900;
    transition: transform 180ms ease, box-shadow 180ms ease;
}
.filter-apply:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(232,62,150,.26); }
.dashboard-filter-hidden { display: none !important; }

.kpi-card {
    border: 1px solid rgba(236,72,153,.15);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(252,231,243,.58));
    box-shadow: 0 15px 34px rgba(129,87,156,.09);
}
.kpi-orange { border-color: rgba(96,165,250,.2); background: linear-gradient(145deg, #fff, rgba(219,234,254,.68)); }
.kpi-green { border-color: rgba(52,211,153,.2); background: linear-gradient(145deg, #fff, rgba(209,250,229,.66)); }
.kpi-blue { border-color: rgba(167,139,250,.2); background: linear-gradient(145deg, #fff, rgba(237,233,254,.68)); }
.kpi-card::after { display: none; }
.kpi-icon-bg {
    position: absolute;
    right: -8px;
    bottom: -18px;
    z-index: -1;
    color: currentColor;
    font-size: 7.5rem;
    line-height: 1;
    opacity: .055;
    transform: rotate(-8deg);
}
.kpi-icon {
    border: 0;
    color: #fff;
    background: linear-gradient(145deg, currentColor, color-mix(in srgb, currentColor 65%, #fff));
    box-shadow: 0 9px 20px color-mix(in srgb, currentColor 22%, transparent);
}
.kpi-violet .kpi-icon { background: linear-gradient(145deg, #d92d80, #f472b6); }
.kpi-orange .kpi-icon { background: linear-gradient(145deg, #3b82f6, #7dd3fc); }
.kpi-green .kpi-icon { background: linear-gradient(145deg, #10b981, #6ee7b7); }
.kpi-blue .kpi-icon { background: linear-gradient(145deg, #8b5cf6, #c4b5fd); }

.panel,
.detail-section {
    border: 1px solid rgba(236,72,153,.11) !important;
    border-radius: 24px;
    background: rgba(255,255,255,.88) !important;
    box-shadow: 0 18px 44px rgba(129,87,156,.09) !important;
    backdrop-filter: blur(14px);
}
.district-panel {
    border-top: 5px solid #ec4899 !important;
    background: linear-gradient(160deg, rgba(253,242,248,.94), rgba(255,255,255,.94) 38%) !important;
}
.panel-heading h2 { color: #a71d5d; }
.panel-heading p { color: #68748a; }
.plot-chart .gridlayer path { stroke: rgba(148,163,184,.16) !important; }
.plot-chart .cartesianlayer .axistext { fill: #617087 !important; }
.chart-wrap {
    border-radius: 18px;
    background: rgba(255,255,255,.42);
}

@media (max-width: 1199.98px) {
    .filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .filter-apply { width: 100%; }
}
@media (max-width: 900px) {
    .sidebar { width: min(86vw, 320px); }
    .main-content { width: 100%; margin-left: 0; }
}
@media (max-width: 767.98px) {
    .dashboard-filter { padding: 16px; border-radius: 18px; }
    .filter-summary-row { flex-direction: column; }
    .filter-grid { grid-template-columns: 1fr; }
    .filter-apply { min-width: 0; }
}
@media print {
    .dashboard-filter { display: none !important; }
    .kpi-icon-bg { display: none; }
}

/* Staff management and account workspace */
.staff-management-page,
.account-page {
    width: min(1480px, calc(100% - 40px));
    max-width: 1480px;
    margin-inline: auto;
}
.staff-management-page > .mb-4 h1,
.account-page > .mb-4 h1 {
    color: #174f4b;
    font-size: clamp(2rem, 2.6vw, 2.8rem);
    font-weight: 900;
}
.staff-management-page .card,
.account-page .card {
    border-top: 5px solid #14b8a6 !important;
    border-radius: 22px;
}
.staff-management-page .form-label,
.account-page .form-label {
    color: #285653;
    font-size: 1.05rem;
    font-weight: 800;
}
.staff-management-page .form-control,
.account-page .form-control,
.staff-management-page .form-select {
    min-height: 52px;
    font-size: 1.05rem;
    border-radius: 12px;
}
.staff-management-page .table th,
.staff-management-page .table td {
    padding: 1rem 1.15rem;
    font-size: 1rem;
}
.account-role {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    color: #285653;
    background: linear-gradient(120deg, #ecfdf5, #ecfeff);
}
.account-role strong {
    padding: 6px 12px;
    border-radius: 999px;
    color: #0f766e;
    background: #ccfbf1;
}
.dataset-actions {
    padding: 18px;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    background: linear-gradient(135deg, #f0f9ff, #f0fdfa);
}
.sidebar-role {
    display: inline-flex;
    width: fit-content;
    margin-top: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    color: #0f766e;
    background: #ccfbf1;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
}

@media (max-width: 767.98px) {
    .staff-management-page,
    .account-page { width: calc(100% - 24px); }
}

/* dashboard-DMHT compatible theme --------------------------------------- */
:root {
    --pink: #ec4899;
    --blue: #60a5fa;
    --purple: #a78bfa;
    --violet-900: #831843;
    --violet-700: #be185d;
    --violet-500: #ec4899;
    --violet-100: #fce7f3;
    --violet-50: #fdf2f8;
    --ink: #334155;
    --muted: #64748b;
    --line: rgba(148,163,184,.2);
    --page: #fce7f3;
    --shadow-sm: 0 14px 32px rgba(129,87,156,.1);
    --shadow: 0 20px 55px rgba(129,87,156,.14);
}

html, body, button, input, select, textarea {
    font-family: "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif;
}

body,
.bg-soft,
.dashboard-body {
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(135deg, #fce7f3 0%, #dbeafe 100%);
}

::selection { background: var(--pink); }
:focus-visible { outline-color: rgba(236,72,153,.34); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: 260px;
    padding: 22px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 55px rgba(148,61,116,.16);
    transition: width .25s ease, transform .25s ease, padding .25s ease;
}

.sidebar-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.sidebar-brand > a { min-width: 0; display: flex; align-items: center; gap: 10px; color: #be185d; text-decoration: none; }
.brand-mark {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    color: #fff;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    box-shadow: 0 12px 28px rgba(236,72,153,.28);
    animation: logo-float 3.8s ease-in-out infinite;
}
.brand-copy { min-width: 0; display: grid; line-height: 1.2; white-space: nowrap; }
.brand-copy strong { font-size: 1rem; font-weight: 900; }
.brand-copy small { margin-top: 3px; color: #64748b; font-size: .62rem; font-weight: 700; }
.sidebar-collapse-btn {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: 0;
    border-radius: 12px;
    color: #be185d;
    background: #fce7f3;
    font-size: 1.4rem;
    line-height: 1;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 5px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    overflow: hidden;
    border-radius: 16px;
    color: #475569;
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.sidebar-link:hover,
.sidebar-link.active {
    color: #be185d;
    background: linear-gradient(90deg, #fce7f3, #dbeafe);
    transform: translateX(2px);
}
.nav-icon { flex: 0 0 26px; display: grid; place-items: center; color: var(--pink); font-size: 1.15rem; font-weight: 900; }
.sidebar-user {
    position: absolute;
    right: 22px;
    bottom: 22px;
    left: 22px;
    display: grid;
    padding: 14px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(236,72,153,.13);
}
.sidebar-user small { color: #64748b; }
.sidebar-user strong { color: #334155; }
.sidebar-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 140;
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    box-shadow: 0 14px 30px rgba(190,24,93,.24);
    font-size: 1.25rem;
}
.sidebar-overlay { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(15,23,42,.34); backdrop-filter: blur(2px); }
.main-content {
    width: calc(100% - 260px);
    min-width: 0;
    min-height: 100vh;
    margin-left: 260px;
    transition: margin-left .25s ease, width .25s ease;
}

body.sidebar-collapsed .sidebar { width: 86px; padding: 18px 12px; }
body.sidebar-collapsed .main-content { width: calc(100% - 86px); margin-left: 86px; }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .sidebar-collapse-btn,
body.sidebar-collapsed .sidebar-user { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; }
body.sidebar-collapsed .sidebar-brand > a { gap: 0; }
body.sidebar-collapsed .sidebar-link { justify-content: center; width: 48px; height: 48px; margin-inline: auto; padding: 0; }
body.sidebar-collapsed .sidebar-link span:last-child { display: none; }
body.sidebar-collapsed .sidebar-link:hover { transform: none; }

.report-toolbar,
.report-page { width: min(1540px, calc(100% - 56px)); }
.report-toolbar { margin-top: 24px; }
.report-page {
    border: 1px solid rgba(255,255,255,.88);
    background: rgba(255,255,255,.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}
.report-title-strip,
.report-meta { background: linear-gradient(135deg, #be185d, #ec4899 58%, #a78bfa); }
.report-title-strip { padding-top: 26px; }
.report-title-strip h1 { font-weight: 900; }
.report-meta { color: rgba(255,255,255,.78); }

.btn-primary {
    --bs-btn-bg: #ec4899;
    --bs-btn-border-color: #ec4899;
    --bs-btn-hover-bg: #db2777;
    --bs-btn-hover-border-color: #db2777;
    --bs-btn-active-bg: #be185d;
    --bs-btn-active-border-color: #be185d;
}
.btn-primary:hover { box-shadow: 0 12px 24px rgba(236,72,153,.25); }
.btn-outline-primary {
    --bs-btn-color: #be185d;
    --bs-btn-border-color: #f9a8d4;
    --bs-btn-hover-bg: #ec4899;
    --bs-btn-hover-border-color: #ec4899;
}
.form-control:focus,
.form-select:focus { border-color: #ec4899; box-shadow: 0 0 0 .22rem rgba(236,72,153,.13); }
.form-check-input:checked { background-color: #ec4899; border-color: #ec4899; }
.eyebrow { color: #be185d; font-weight: 900; letter-spacing: 0; }

.card,
.panel,
.detail-section {
    border: 1px solid rgba(255,255,255,.88) !important;
    background: rgba(255,255,255,.9);
    box-shadow: 0 18px 45px rgba(129,87,156,.13) !important;
}
.kpi-grid { gap: 14px; overflow: visible; border: 0; background: transparent; }
.kpi-card {
    min-height: 122px;
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 20px;
    box-shadow: 0 16px 34px rgba(129,87,156,.12);
}
.kpi-card::before { width: 44px; height: 8px; border-radius: 999px; }
.kpi-card:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 20px 40px rgba(236,72,153,.13); }
.kpi-violet { color: #be185d; background: linear-gradient(145deg, #fff, rgba(252,231,243,.65)); }
.kpi-orange { color: #ea580c; background: linear-gradient(145deg, #fff, rgba(255,237,213,.7)); }
.kpi-green { color: #15803d; background: linear-gradient(145deg, #fff, rgba(220,252,231,.65)); }
.kpi-blue { color: #2563eb; background: linear-gradient(145deg, #fff, rgba(219,234,254,.72)); }
.kpi-value { color: #1e293b; font-weight: 900; }

.panel-heading h2,
.detail-title-strip h2 { color: #9d174d; font-weight: 900; }
.panel-badge { color: #9d174d; background: linear-gradient(135deg, #fce7f3, #dbeafe); font-weight: 850; }
.district-summary-table thead th { color: #9d174d; background: #fce7f3; }
.detail-title-strip { background: linear-gradient(90deg, #fce7f3, #dbeafe); }
.detail-title-strip h2 { color: #9d174d; }
.detail-table thead th { background: linear-gradient(135deg, #be185d, #ec4899); }
.detail-table tbody th { color: #9d174d; background: #fce7f3; }
.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td { color: #1d4ed8; background: #dbeafe; }
.comparison-title { color: #9d174d; background: linear-gradient(90deg, #fce7f3, #dbeafe); }
.rate-card strong,
.target-box strong { color: #be185d; }
.step-number { color: #be185d; background: #fce7f3; }
.validation-list > div:hover { border-color: #f9a8d4; }
.table thead th { color: #9d174d; background: linear-gradient(90deg, #fce7f3, #eff6ff); }
.table tbody tr:hover > * { background: #fff7fb; }

@keyframes logo-float {
    0%, 100% {
        transform: translateY(0) rotate(0) scale(1);
        box-shadow: 0 12px 28px rgba(15,118,110,.18);
    }
    25% { transform: translateY(-3px) rotate(-1deg) scale(1.02); }
    50% {
        transform: translateY(-5px) rotate(0) scale(1.05);
        box-shadow: 0 18px 34px rgba(15,118,110,.3);
    }
    75% { transform: translateY(-3px) rotate(1deg) scale(1.02); }
}

@keyframes logo-breathe {
    0%, 100% {
        transform: scale(1);
        filter: saturate(1) brightness(1);
    }
    50% {
        transform: scale(1.055);
        filter: saturate(1.08) brightness(1.04);
    }
}

@media (max-width: 900px) {
    .app-shell { display: block; }
    .sidebar { width: min(82vw, 300px); min-height: 100vh; transform: translateX(-110%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-overlay { display: block; }
    .sidebar-toggle { display: grid; }
    .sidebar-collapse-btn { display: none; }
    .sidebar-user { position: static; margin-top: 18px; }
    .main-content,
    body.sidebar-collapsed .main-content { width: 100%; margin-left: 0; padding-top: 62px; }
    body.sidebar-collapsed .sidebar { width: min(82vw, 300px); padding: 22px; }
    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .sidebar-user { display: grid; }
    body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; }
    body.sidebar-collapsed .sidebar-link { justify-content: flex-start; width: auto; height: auto; margin: 0; padding: 11px 13px; }
    body.sidebar-collapsed .sidebar-link span:last-child { display: inline; }
}

@media (max-width: 767.98px) {
    .report-toolbar,
    .report-page { width: calc(100% - 24px); }
    .kpi-grid { gap: 10px; }
}

@media print {
    .app-shell { display: block; }
    .main-content { width: 100%; margin: 0; }
    .report-page { background: #fff; backdrop-filter: none; }
}

/* 2026 visual refresh ----------------------------------------------------- */
:root {
    --violet-900: #153d3a;
    --violet-700: #176b62;
    --violet-500: #2c8d80;
    --violet-100: #dcefeb;
    --violet-50: #f1f8f6;
    --ink: #172b2a;
    --muted: #657876;
    --line: #dbe5e2;
    --surface: #fff;
    --page: #f3f7f5;
    --accent: #d97745;
    --accent-soft: #fff1e8;
    --shadow-sm: 0 1px 2px rgba(20,56,52,.05), 0 8px 22px rgba(20,56,52,.05);
    --shadow: 0 18px 50px rgba(20,56,52,.09);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: "Leelawadee UI", "Noto Sans Thai", Tahoma, system-ui, sans-serif;
    color: var(--ink);
    font-size: .9375rem;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

::selection { color: #fff; background: var(--violet-700); }
a { text-underline-offset: 3px; }
:focus-visible { outline: 3px solid rgba(44,141,128,.28); outline-offset: 2px; }

.bg-soft,
.dashboard-body {
    background:
        radial-gradient(circle at 8% 0%, rgba(44,141,128,.09), transparent 28rem),
        linear-gradient(180deg, #f8faf9 0, var(--page) 28rem),
        var(--page);
}

.app-navbar {
    min-height: 68px;
    padding-block: 10px;
    background: rgba(18,57,53,.98);
    border-bottom: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 8px 28px rgba(12,43,40,.18);
}

.app-navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1rem;
    letter-spacing: -.01em;
}

.app-navbar .nav-link {
    padding: 7px 11px !important;
    border-radius: 9px;
    color: rgba(255,255,255,.76);
    font-size: .86rem;
    transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.09);
    transform: translateY(-1px);
}

.app-navbar .navbar-text { color: rgba(255,255,255,.62); }
.app-navbar .btn-light { color: #153d3a; background: #fff; border-color: #fff; }

.brand-mark {
    width: 38px;
    height: 38px;
    margin-right: 0;
    border-radius: 12px;
    color: #153d3a;
    background: #e9f6f2;
}

.eyebrow { color: var(--violet-700); text-transform: uppercase; }

.btn {
    border-radius: 10px;
    font-weight: 650;
    letter-spacing: .005em;
    box-shadow: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary {
    --bs-btn-bg: #176b62;
    --bs-btn-border-color: #176b62;
    --bs-btn-hover-bg: #12584f;
    --bs-btn-hover-border-color: #12584f;
    --bs-btn-active-bg: #0f4b44;
    --bs-btn-active-border-color: #0f4b44;
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(23,107,98,.18); }
.btn-outline-primary {
    --bs-btn-color: #176b62;
    --bs-btn-border-color: #7fb6ae;
    --bs-btn-hover-bg: #176b62;
    --bs-btn-hover-border-color: #176b62;
}

.form-control,
.form-select {
    min-height: 43px;
    color: var(--ink);
    border-color: #cfdbd7;
    border-radius: 10px;
    background-color: rgba(255,255,255,.94);
}
.form-control-lg { min-height: 50px; font-size: 1rem; }
.form-select-sm { min-height: 36px; }
.form-control:focus,
.form-select:focus { border-color: #64a99f; box-shadow: 0 0 0 .2rem rgba(44,141,128,.13); }
.form-label { margin-bottom: .42rem; color: #334d4a; font-size: .86rem; font-weight: 700; }
.form-text { color: #72827f; line-height: 1.55; }
.form-check-input:checked { background-color: var(--violet-700); border-color: var(--violet-700); }

.card {
    border: 1px solid rgba(203,218,214,.78) !important;
    border-radius: 22px;
    box-shadow: var(--shadow-sm) !important;
}
.card-body { color: #29413f; }
.card h1, .card h2, .card h3 { color: var(--ink); letter-spacing: -.02em; }
.text-secondary { color: var(--muted) !important; }
.alert { border: 1px solid transparent; border-radius: 12px; box-shadow: none !important; }
.alert-success { color: #1f5f43; background: #edf8f2; border-color: #c7e7d5; }
.alert-warning { color: #77561c; background: #fff8e8; border-color: #f0dfb6; }
.alert-danger { color: #8a3535; background: #fff1f1; border-color: #efcaca; }

.dashboard-shell { min-height: calc(100vh - 68px); }
.report-toolbar,
.report-page { width: min(1540px, calc(100% - 48px)); }

.report-toolbar {
    margin-top: 24px;
    margin-bottom: 12px;
}

.report-toolbar .badge {
    padding: 7px 11px;
    border: 1px solid rgba(0,0,0,.06);
    font-weight: 650;
}

.toolbar-actions { gap: 10px; }

.report-page {
    margin-bottom: 44px;
    padding: clamp(16px, 2vw, 30px);
    overflow: hidden;
    border: 1px solid rgba(203,218,214,.82);
    border-radius: 24px;
    box-shadow: var(--shadow);
    animation: page-in 520ms cubic-bezier(.2,.7,.2,1) both;
}

.report-header { margin: calc(-1 * clamp(16px, 2vw, 30px)); margin-bottom: 20px; }
.report-title-strip {
    padding: 24px clamp(18px, 3vw, 44px) 10px;
    text-align: left;
    background: linear-gradient(115deg, #153d3a, #1d5b55 72%, #286d65);
    border: 0;
}
.report-title-strip h1 {
    color: #fff;
    font-size: clamp(1.22rem, 1.7vw, 1.7rem);
    font-weight: 750;
    letter-spacing: -.025em;
}
.report-meta {
    justify-content: flex-start;
    gap: 8px 24px;
    padding: 10px clamp(18px, 3vw, 44px) 20px;
    color: rgba(255,255,255,.68);
    background: linear-gradient(115deg, #153d3a, #1d5b55 72%, #286d65);
    font-size: .78rem;
}
.report-meta strong { color: #fff; font-weight: 700; }

.kpi-grid { gap: 1px; margin-bottom: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.kpi-card {
    min-height: 112px;
    padding: 18px 20px;
    border: 0;
    border-radius: 0;
    background: #fff;
    transition: background-color 180ms ease;
}
.kpi-card:hover { background: #f9fbfa; }
.kpi-card::after { display: none; }
.kpi-card::before {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}
.kpi-violet { color: #176b62; }
.kpi-orange { color: #d36d3d; }
.kpi-green { color: #38845c; }
.kpi-blue { color: #467a9f; }
.kpi-label { color: #667875; font-size: .78rem; letter-spacing: .01em; }
.kpi-value { margin-top: 12px; color: currentColor; font-size: clamp(1.7rem, 2.25vw, 2.45rem); font-weight: 760; letter-spacing: -.04em; }
.kpi-unit { color: #72827f; font-size: .72rem; }

.top-layout,
.charts-grid { gap: 16px; margin-bottom: 16px; }
.top-layout { grid-template-columns: minmax(0, 2.15fr) minmax(280px, .85fr); }

.panel,
.detail-section {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(20,56,52,.025);
}
.panel-chart { padding: 18px; }
.panel-heading { min-height: 48px; margin-bottom: 8px; }
.panel-heading.compact { min-height: 34px; }
.panel-heading h2,
.detail-title-strip h2 { color: #244441; font-size: .92rem; font-weight: 750; letter-spacing: -.01em; }
.panel-heading p { color: #7a8987; font-size: .7rem; }
.panel-badge { padding: 5px 9px; color: #176b62; background: #e9f5f2; font-size: .68rem; }
.plot-chart .main-svg { font-family: "Leelawadee UI", "Noto Sans Thai", Tahoma, sans-serif !important; }

.district-summary-table { margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.district-summary-table table { font-size: .65rem; }
.district-summary-table th,
.district-summary-table td { padding: 7px 6px; border: 0; border-right: 1px solid #e7eeec; border-bottom: 1px solid #e7eeec; }
.district-summary-table thead th { color: #315b56; background: #edf6f3; }
.district-summary-table tbody th { color: #6d573f; background: #fff8f1; }

.summary-column { gap: 12px; }
.comparison-card { border-radius: 16px; }
.comparison-title { padding: 12px; color: #244d47; background: #e3f3ed; font-size: .79rem; }
.comparison-grid > div { min-height: 43px; border-color: #e1e9e7; font-size: .72rem; }
.comparison-label { color: #5f5c46; background: #faf7e8; }
.previous-year { background: #edf4f6; }
.current-year { background: #e5f0f3; }
.comparison-reduction { color: #70592c; background: #fbf0c8; }

.rate-card,
.target-box {
    min-height: 90px;
    padding: 15px 18px;
    border-color: #eadfcf;
    border-radius: 14px;
    background: #fff9f1;
}
.rate-card strong,
.target-box strong { margin-top: 8px; color: #176b62; font-size: 1.65rem; letter-spacing: -.03em; }
.rate-card-muted { border-color: #dfe7e5; background: #f6f8f7; }
.target-box { border-color: #cae2d5; background: #edf8f1; }
.target-box strong { color: #287a55; }

.detail-section { overflow: hidden; }
.detail-title-strip { padding: 11px 14px; text-align: left; background: #edf6f3; border-bottom-color: #dbe9e5; }
.detail-title-strip h2 { color: #315b56; }
.detail-layout { gap: 18px; padding: 18px; }
.detail-table-wrap { border: 1px solid var(--line); border-radius: 10px; }
.detail-table { font-size: .66rem; }
.detail-table th,
.detail-table td { height: 29px; padding: 5px 7px; border-color: #dce5e2; }
.detail-table thead th { background: #285f59; }
.detail-table tbody th { background: #edf6f3; }
.detail-table tbody tr:nth-child(n+1) td { background: #fbfcfc; }
.detail-table tbody tr:nth-child(even) td { background: #f5f8f7; }
.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td { color: #285452; background: #dcefed; }

.insight-card { min-height: 110px; padding: 18px; border-radius: 14px; text-align: left; }
.insight-card span { color: #687774; }
.insight-card strong { margin: 12px 0 2px; color: #273f3d; font-size: 1rem; }
.insight-yellow { background: #fff8e8; border-color: #eee0b9; }
.insight-pink { background: #f9eef2; border-color: #ead3dc; }
.insight-note { padding: 14px 16px; border-style: solid; border-color: var(--line); background: #fafcfb; line-height: 1.65; }
.report-footer { padding-top: 12px; color: #7f8c89; border-top: 1px solid #edf1f0; font-size: .66rem; }

.table { --bs-table-color: #2d4441; --bs-table-striped-bg: #f7faf9; }
.table > :not(caption) > * > * { padding: .8rem .9rem; border-bottom-color: #e6edeb; }
.table thead th { color: #4d6562; background: #f0f5f3; border-bottom-width: 1px; font-size: .76rem; font-weight: 750; letter-spacing: .015em; }
.table tbody tr { transition: background-color 160ms ease; }
.table tbody tr:hover > * { background: #f6faf8; }
.badge { font-weight: 650; letter-spacing: .01em; }
.install-summary { border-color: #d6e4e0; background: #f6faf8; }
.validation-list > div { border-color: #dde8e5; background: #fafcfb; transition: transform 160ms ease, border-color 160ms ease; }
.validation-list > div:hover { transform: translateX(3px); border-color: #abcfc8; }
.step-number { color: #176b62; background: #dcefeb; }

@keyframes page-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse { padding-top: 12px; }
    .app-navbar .navbar-nav { align-items: stretch !important; }
    .app-navbar .navbar-text { padding: 8px 11px; }
}

@media (max-width: 767.98px) {
    body { font-size: .9rem; }
    .report-toolbar,
    .report-page { width: calc(100% - 20px); }
    .report-toolbar { margin-top: 14px; }
    .report-page { padding: 10px; border-radius: 17px; }
    .report-header { margin: -10px -10px 14px; }
    .report-title-strip { padding: 18px 16px 8px; }
    .report-meta { gap: 5px 14px; padding: 7px 16px 16px; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .kpi-card { min-height: 98px; padding: 14px; }
    .kpi-value { margin-top: 9px; }
    .panel-chart { padding: 14px; }
    .detail-layout { padding: 12px; }
}

@media (max-width: 420px) {
    .app-navbar .navbar-brand { font-size: .9rem; }
    .brand-mark { width: 34px; height: 34px; }
    .kpi-grid { grid-template-columns: 1fr; }
}

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

@media print {
    body { font-family: Tahoma, "Noto Sans Thai", sans-serif; font-size: 10pt; }
    .report-page { border-radius: 0; animation: none; }
    .report-header { margin: -4mm -4mm 3mm; }
    .report-title-strip { padding: 3mm 4mm 1mm; }
    .report-meta { padding: 1mm 4mm 2mm; }
    .kpi-grid { gap: 1px; margin-bottom: 3mm; }
    .kpi-card { min-height: 65px; padding: 7px 10px; }
}

/* Final DMHT layout scale overrides */
:root {
    --pink: #ec4899;
    --blue: #60a5fa;
    --purple: #a78bfa;
    --violet-700: #be185d;
    --violet-100: #fce7f3;
    --ink: #334155;
    --muted: #64748b;
    --page: #fce7f3;
}

html { font-size: 17px; }
body, .bg-soft, .dashboard-body {
    color: var(--ink);
    background: linear-gradient(135deg, #fce7f3 0%, #dbeafe 100%);
    font-family: "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif;
    font-size: 1rem;
}

.sidebar { width: 320px; padding: 28px; }
.main-content { width: calc(100% - 320px); margin-left: 320px; }
.sidebar-brand { margin-bottom: 30px; }
.brand-mark { width: 52px; height: 52px; border-radius: 17px; color: #fff; background: linear-gradient(135deg, var(--pink), var(--purple)); }
.brand-copy strong { font-size: 1.18rem; }
.brand-copy small { font-size: .72rem; }
.sidebar-link { gap: 12px; padding: 14px 16px; font-size: 1.04rem; }
.nav-icon { flex-basis: 30px; font-size: 1.35rem; }
.sidebar-user { right: 28px; bottom: 28px; left: 28px; padding: 18px; font-size: .94rem; }

body.sidebar-collapsed .main-content { width: calc(100% - 94px); margin-left: 94px; }
body.sidebar-collapsed .sidebar { width: 94px; }

.report-toolbar,
.report-page { width: calc(100% - 36px); max-width: none; }
.report-toolbar { margin: 22px 18px 12px; }
.report-page { margin: 0 18px 38px; padding: clamp(18px, 1.6vw, 34px); }
.report-header { margin: calc(-1 * clamp(18px, 1.6vw, 34px)); margin-bottom: 24px; }
.report-title-strip,
.report-meta { background: linear-gradient(135deg, #be185d, #ec4899 58%, #a78bfa); }
.report-title-strip { padding: 28px clamp(22px, 2.5vw, 48px) 12px; }
.report-title-strip h1 { font-size: clamp(1.45rem, 1.7vw, 2rem); font-weight: 900; }
.report-meta { padding: 10px clamp(22px, 2.5vw, 48px) 22px; font-size: .92rem; }

.kpi-grid { gap: 16px; margin-bottom: 22px; overflow: visible; border: 0; background: transparent; }
.kpi-card { min-height: 138px; padding: 22px 24px; border-radius: 22px; box-shadow: 0 16px 34px rgba(129,87,156,.12); }
.kpi-card::before { width: 46px; height: 9px; border-radius: 999px; }
.kpi-label { font-size: .96rem; }
.kpi-value { margin-top: 15px; font-size: clamp(2rem, 2.2vw, 2.8rem); font-weight: 900; }
.kpi-unit { font-size: .86rem; }
.kpi-violet { color: #be185d; background: linear-gradient(145deg, #fff, rgba(252,231,243,.7)); }
.kpi-orange { color: #ea580c; background: linear-gradient(145deg, #fff, rgba(255,237,213,.75)); }
.kpi-green { color: #15803d; background: linear-gradient(145deg, #fff, rgba(220,252,231,.7)); }
.kpi-blue { color: #2563eb; background: linear-gradient(145deg, #fff, rgba(219,234,254,.78)); }

.top-layout, .charts-grid { gap: 20px; margin-bottom: 20px; }
.panel, .detail-section { border-color: rgba(255,255,255,.88); box-shadow: 0 18px 45px rgba(129,87,156,.12); }
.panel-chart { padding: 22px; }
.panel-heading { min-height: 58px; }
.panel-heading.compact { min-height: 42px; }
.panel-heading h2, .detail-title-strip h2 { color: #9d174d; font-size: 1.12rem; font-weight: 900; }
.panel-heading p { font-size: .84rem; }
.panel-badge { padding: 7px 11px; color: #9d174d; background: linear-gradient(135deg, #fce7f3, #dbeafe); font-size: .82rem; }
.chart-xl { height: 480px; }
.chart-lg { height: 360px; }
.chart-md { height: 320px; }

.district-summary-table table { font-size: .82rem; }
.district-summary-table th, .district-summary-table td { padding: 9px 8px; }
.district-summary-table thead th { color: #9d174d; background: #fce7f3; }
.comparison-title { padding: 15px; color: #9d174d; background: linear-gradient(90deg, #fce7f3, #dbeafe); font-size: .95rem; }
.comparison-grid > div { min-height: 50px; font-size: .88rem; }
.comparison-reduction { font-size: 1.15rem !important; }
.rate-card, .target-box { min-height: 108px; padding: 18px 22px; }
.rate-card span, .target-box span { font-size: .9rem; }
.rate-card strong, .target-box strong { font-size: 2rem; }
.rate-card small, .target-box small { font-size: .78rem; }

.detail-title-strip { padding: 14px 18px; background: linear-gradient(90deg, #fce7f3, #dbeafe); }
.detail-layout { gap: 22px; padding: 22px; }
.detail-table { font-size: .82rem; }
.detail-table th, .detail-table td { height: 36px; padding: 7px 9px; }
.detail-table thead th { background: linear-gradient(135deg, #be185d, #ec4899); }
.detail-table tbody th { color: #9d174d; background: #fce7f3; }
.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td { color: #1d4ed8; background: #dbeafe; }
.insight-card span { font-size: .88rem; }
.insight-card strong { font-size: 1.18rem; }
.insight-card small { font-size: .9rem; }
.insight-note { font-size: .84rem; }
.report-footer { font-size: .78rem; }

.table thead th { color: #9d174d; background: linear-gradient(90deg, #fce7f3, #eff6ff); font-size: .9rem; }
.table tbody td { font-size: .92rem; }
.form-label { font-size: .94rem; }
.eyebrow { color: #be185d; font-size: .92rem; }
.btn-primary {
    --bs-btn-bg: #ec4899;
    --bs-btn-border-color: #ec4899;
    --bs-btn-hover-bg: #db2777;
    --bs-btn-hover-border-color: #db2777;
}
.btn-outline-primary {
    --bs-btn-color: #be185d;
    --bs-btn-border-color: #f9a8d4;
    --bs-btn-hover-bg: #ec4899;
    --bs-btn-hover-border-color: #ec4899;
}

@media (max-width: 1199.98px) {
    .sidebar { width: 280px; padding: 22px; }
    .main-content { width: calc(100% - 280px); margin-left: 280px; }
    .sidebar-link { font-size: .96rem; }
    .chart-xl { height: 420px; }
}

@media (max-width: 900px) {
    html { font-size: 16px; }
    .sidebar { width: min(86vw, 330px); }
    .main-content,
    body.sidebar-collapsed .main-content { width: 100%; margin-left: 0; padding-top: 64px; }
    body.sidebar-collapsed .sidebar { width: min(86vw, 330px); }
    .report-toolbar, .report-page { width: calc(100% - 24px); }
    .report-toolbar { margin-inline: 12px; }
    .report-page { margin-inline: 12px; }
}

@media (max-width: 767.98px) {
    .report-page { padding: 12px; }
    .report-header { margin: -12px -12px 16px; }
    .report-title-strip { padding: 20px 18px 9px; }
    .report-meta { padding: 8px 18px 18px; font-size: .82rem; }
    .kpi-card { min-height: 112px; padding: 16px; }
    .panel-chart { padding: 15px; }
    .panel-heading h2, .detail-title-strip h2 { font-size: 1rem; }
    .chart-xl { height: 380px; }
    .chart-lg { height: 330px; }
    .chart-md { height: 290px; }
}

@media print {
    html { font-size: 15px; }
    .main-content { width: 100%; margin: 0; }
    .report-page { width: 100%; margin: 0; }
    .chart-xl { height: 235px !important; }
    .chart-lg { height: 190px !important; }
    .chart-md { height: 165px !important; }
}

/* Aquatic mint palette */
:root {
    --pink: #14b8a6;
    --blue: #38bdf8;
    --purple: #5eead4;
    --violet-900: #134e4a;
    --violet-700: #0f766e;
    --violet-500: #14b8a6;
    --violet-100: #ccfbf1;
    --violet-50: #f0fdfa;
    --ink: #173b3b;
    --muted: #5f7c7b;
    --line: rgba(94, 158, 154, .2);
    --page: #ecfeff;
    --shadow-sm: 0 14px 32px rgba(15,118,110,.09);
    --shadow: 0 20px 55px rgba(14,116,144,.12);
}

body,
.bg-soft,
.dashboard-body {
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 5%, rgba(255,255,255,.9), transparent 27rem),
        linear-gradient(135deg, #e0f7ff 0%, #d9fbf3 52%, #c7f9e9 100%);
}

::selection { background: #0d9488; }
:focus-visible { outline-color: rgba(20,184,166,.35); }

.sidebar {
    background: rgba(248,255,254,.84);
    box-shadow: 0 20px 55px rgba(14,116,144,.14);
}
.brand-mark {
    background: linear-gradient(135deg, #38bdf8, #14b8a6 58%, #5eead4);
    box-shadow: 0 12px 28px rgba(20,184,166,.25);
}
.sidebar-brand > a,
.sidebar-link:hover,
.sidebar-link.active { color: #0f766e; }
.sidebar-collapse-btn { color: #0f766e; background: #ccfbf1; }
.sidebar-link:hover,
.sidebar-link.active { background: linear-gradient(90deg, #cffafe, #d1fae5); }
.nav-icon { color: #0d9488; }
.sidebar-user { box-shadow: 0 12px 30px rgba(14,116,144,.12); }
.sidebar-toggle { background: linear-gradient(135deg, #38bdf8, #14b8a6); box-shadow: 0 14px 30px rgba(13,148,136,.22); }

.report-page,
.card,
.panel,
.detail-section {
    border-color: rgba(255,255,255,.9) !important;
    background: rgba(255,255,255,.9);
    box-shadow: 0 18px 45px rgba(14,116,144,.1) !important;
}
.report-title-strip,
.report-meta { background: linear-gradient(115deg, #155e75, #0f766e 52%, #14b8a6 100%); }

.btn-primary {
    --bs-btn-bg: #0f766e;
    --bs-btn-border-color: #0f766e;
    --bs-btn-hover-bg: #0d9488;
    --bs-btn-hover-border-color: #0d9488;
    --bs-btn-active-bg: #115e59;
    --bs-btn-active-border-color: #115e59;
}
.btn-primary:hover { box-shadow: 0 12px 24px rgba(13,148,136,.22); }
.btn-outline-primary {
    --bs-btn-color: #0f766e;
    --bs-btn-border-color: #5eead4;
    --bs-btn-hover-bg: #0f766e;
    --bs-btn-hover-border-color: #0f766e;
}
.form-control:focus,
.form-select:focus { border-color: #14b8a6; box-shadow: 0 0 0 .22rem rgba(20,184,166,.13); }
.form-check-input:checked { background-color: #0f766e; border-color: #0f766e; }
.eyebrow { color: #0f766e; }

.kpi-card { box-shadow: 0 16px 34px rgba(14,116,144,.09); }
.kpi-card:hover { box-shadow: 0 20px 40px rgba(20,184,166,.13); }
.kpi-violet { color: #0f766e; background: linear-gradient(145deg, #fff, rgba(204,251,241,.76)); }
.kpi-orange { color: #0284c7; background: linear-gradient(145deg, #fff, rgba(224,242,254,.82)); }
.kpi-green { color: #059669; background: linear-gradient(145deg, #fff, rgba(209,250,229,.78)); }
.kpi-blue { color: #0369a1; background: linear-gradient(145deg, #fff, rgba(207,250,254,.82)); }

.panel-heading h2,
.detail-title-strip h2 { color: #0f766e; }
.panel-badge { color: #0f766e; background: linear-gradient(135deg, #cffafe, #d1fae5); }
.district-summary-table thead th { color: #0f766e; background: #ccfbf1; }
.comparison-title,
.detail-title-strip { color: #0f766e; background: linear-gradient(90deg, #cffafe, #d1fae5); }
.comparison-label { color: #155e75; background: #ecfeff; }
.previous-year { background: #e0f2fe; }
.current-year { background: #ccfbf1; }
.comparison-reduction { color: #115e59; background: #d1fae5; }
.rate-card { border-color: #bae6fd; background: #f0f9ff; }
.rate-card-muted { border-color: #cce9e4; background: #f0fdfa; }
.target-box { border-color: #a7f3d0; background: #ecfdf5; }
.rate-card strong,
.target-box strong { color: #0f766e; }

.detail-table thead th { background: linear-gradient(135deg, #155e75, #0f766e); }
.detail-table tbody th { color: #0f766e; background: #ccfbf1; }
.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td { color: #075985; background: #dff7fb; }
.insight-yellow { background: #ecfeff; border-color: #bae6fd; }
.insight-pink { background: #ecfdf5; border-color: #a7f3d0; }
.step-number { color: #0f766e; background: #ccfbf1; }
.validation-list > div:hover { border-color: #5eead4; }
.table thead th { color: #0f766e; background: linear-gradient(90deg, #ccfbf1, #e0f2fe); }
.table tbody tr:hover > * { background: #f0fdfa; }

/* Section color coding and clearer descriptions */
.district-panel {
    border-top: 5px solid #06b6d4 !important;
    background: linear-gradient(160deg, rgba(236,254,255,.96), rgba(255,255,255,.94) 34%) !important;
}

.summary-column .comparison-card {
    border-top: 5px solid #0ea5e9 !important;
    background: linear-gradient(155deg, #f0f9ff, #fff 48%) !important;
}
.summary-column .rate-card:nth-child(2) {
    border-left: 5px solid #14b8a6;
    background: linear-gradient(115deg, #f0fdfa, #fff);
}
.summary-column .rate-card:nth-child(3) {
    border-left: 5px solid #38bdf8;
    background: linear-gradient(115deg, #f0f9ff, #fff);
}
.summary-column .target-box {
    border-left: 5px solid #34d399;
    background: linear-gradient(115deg, #ecfdf5, #fff);
}

.charts-grid-demographic > .panel:nth-child(1) {
    border-top: 5px solid #06b6d4 !important;
    background: linear-gradient(160deg, #ecfeff, #fff 40%) !important;
}
.charts-grid-demographic > .panel:nth-child(2) {
    border-top: 5px solid #38bdf8 !important;
    background: linear-gradient(160deg, #f0f9ff, #fff 40%) !important;
}
.charts-grid-demographic > .panel:nth-child(3) {
    border-top: 5px solid #34d399 !important;
    background: linear-gradient(160deg, #ecfdf5, #fff 40%) !important;
}

.charts-grid-factors > .panel:nth-child(1) {
    border-top: 5px solid #2dd4bf !important;
    background: linear-gradient(160deg, #f0fdfa, #fff 40%) !important;
}
.charts-grid-factors > .panel:nth-child(2) {
    border-top: 5px solid #0ea5e9 !important;
    background: linear-gradient(160deg, #eff6ff, #fff 40%) !important;
}
.charts-grid-factors > .panel:nth-child(3) {
    border-top: 5px solid #10b981 !important;
    background: linear-gradient(160deg, #ecfdf5, #fff 40%) !important;
}

.charts-grid-history > .panel:nth-child(1) {
    border-top: 5px solid #0284c7 !important;
    background: linear-gradient(160deg, #f0f9ff, #fff 38%) !important;
}
.charts-grid-history > .panel:nth-child(2) {
    border-top: 5px solid #0d9488 !important;
    background: linear-gradient(160deg, #f0fdfa, #fff 38%) !important;
}

.detail-section {
    border-top: 5px solid #0f766e !important;
    background: linear-gradient(160deg, #f0fdfa, #fff 30%) !important;
}

.panel-heading h2,
.detail-title-strip h2 { font-size: 1.22rem; line-height: 1.4; }
.panel-heading p {
    margin-top: 6px;
    color: #496d6b;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.55;
}
.kpi-label { color: #365f5d; font-size: 1.06rem; font-weight: 800; }
.kpi-unit { color: #527370; font-size: .96rem; font-weight: 650; }
.report-meta { font-size: 1rem; }
.comparison-title { font-size: 1.08rem; font-weight: 900; }
.comparison-grid > div { font-size: .98rem; }
.rate-card span,
.target-box span { color: #365f5d; font-size: 1rem; font-weight: 800; }
.rate-card small,
.target-box small { color: #527370; font-size: .9rem; font-weight: 650; }
.insight-card span { color: #426764; font-size: 1rem; font-weight: 750; }
.insight-card small { font-size: 1rem; }
.insight-note { color: #456965; font-size: .96rem; line-height: 1.75; }
.report-footer { color: #527370; font-size: .9rem; font-weight: 600; }
.text-secondary { color: #527370 !important; font-size: 1rem; line-height: 1.7; }
.form-text { color: #5b7774; font-size: .9rem; line-height: 1.65; }
.validation-list > div { font-size: 1rem; line-height: 1.7; }

.district-summary-table {
    border-color: #a5e7e5;
    box-shadow: 0 8px 20px rgba(6,182,212,.07);
}
.district-summary-table thead th {
    color: #155e75;
    background: linear-gradient(180deg, #cffafe, #a5f3fc);
}
.district-summary-table tbody tr:nth-child(1) th,
.district-summary-table tbody tr:nth-child(1) td { background: #f0fdfa; }
.district-summary-table tbody tr:nth-child(2) th,
.district-summary-table tbody tr:nth-child(2) td { background: #f0f9ff; }
.district-summary-table table { font-size: .92rem; }

.detail-table thead th {
    color: #fff;
    background: linear-gradient(135deg, #155e75, #0f766e 72%, #14b8a6);
}
.detail-table tbody th { color: #115e59; background: #ccfbf1; }
.detail-table tbody tr:nth-child(odd) td { background: #f8fffe; }
.detail-table tbody tr:nth-child(even) td { background: #f0f9ff; }
.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td {
    color: #075985;
    background: linear-gradient(90deg, #cffafe, #dbeafe);
}
.detail-table { font-size: .92rem; }

.table thead th {
    color: #075985;
    background: linear-gradient(90deg, #bae6fd, #ccfbf1);
    font-size: 1rem;
}
.table tbody td { font-size: 1rem; }
.table tbody tr:nth-child(odd) > * { background-color: rgba(236,254,255,.5); }
.table tbody tr:nth-child(even) > * { background-color: rgba(236,253,245,.55); }

.bg-soft .card { border-top-width: 5px !important; }
.card:nth-of-type(3n + 1) { border-top-color: #06b6d4 !important; }
.card:nth-of-type(3n + 2) { border-top-color: #38bdf8 !important; }
.card:nth-of-type(3n) { border-top-color: #34d399 !important; }

@media (max-width: 767.98px) {
    .panel-heading h2,
    .detail-title-strip h2 { font-size: 1.1rem; }
    .panel-heading p { font-size: .92rem; }
    .kpi-label { font-size: .98rem; }
    .district-summary-table table,
    .detail-table { font-size: .86rem; }
}

/* DMHT-inspired chart and table palette */
:root {
    --chart-pink: #ec4899;
    --chart-pink-soft: #fce7f3;
    --chart-blue: #60a5fa;
    --chart-blue-soft: #dbeafe;
    --chart-purple: #a78bfa;
    --chart-purple-soft: #ede9fe;
    --chart-green: #22c55e;
    --chart-green-soft: #dcfce7;
    --chart-yellow: #eab308;
    --chart-yellow-soft: #fef9c3;
    --chart-rose: #fb7185;
    --chart-rose-soft: #ffe4e6;
}

.district-panel {
    border-top-color: var(--chart-pink) !important;
    background: linear-gradient(160deg, rgba(252,231,243,.72), rgba(255,255,255,.96) 34%) !important;
}
.district-panel .panel-heading h2 { color: #9d174d; }
.district-panel .panel-badge { color: #9d174d; background: var(--chart-pink-soft); }

.charts-grid-demographic > .panel:nth-child(1) {
    border-top-color: var(--chart-pink) !important;
    background: linear-gradient(160deg, rgba(252,231,243,.78), #fff 42%) !important;
}
.charts-grid-demographic > .panel:nth-child(1) h2 { color: #9d174d; }
.charts-grid-demographic > .panel:nth-child(2) {
    border-top-color: var(--chart-blue) !important;
    background: linear-gradient(160deg, rgba(219,234,254,.82), #fff 42%) !important;
}
.charts-grid-demographic > .panel:nth-child(2) h2 { color: #1d4ed8; }
.charts-grid-demographic > .panel:nth-child(3) {
    border-top-color: var(--chart-purple) !important;
    background: linear-gradient(160deg, rgba(237,233,254,.82), #fff 42%) !important;
}
.charts-grid-demographic > .panel:nth-child(3) h2 { color: #6d28d9; }

.charts-grid-factors > .panel:nth-child(1) {
    border-top-color: var(--chart-rose) !important;
    background: linear-gradient(160deg, rgba(255,228,230,.8), #fff 42%) !important;
}
.charts-grid-factors > .panel:nth-child(1) h2 { color: #be123c; }
.charts-grid-factors > .panel:nth-child(2) {
    border-top-color: var(--chart-yellow) !important;
    background: linear-gradient(160deg, rgba(254,249,195,.78), #fff 42%) !important;
}
.charts-grid-factors > .panel:nth-child(2) h2 { color: #a16207; }
.charts-grid-factors > .panel:nth-child(3) {
    border-top-color: var(--chart-purple) !important;
    background: linear-gradient(160deg, rgba(237,233,254,.82), #fff 42%) !important;
}
.charts-grid-factors > .panel:nth-child(3) h2 { color: #6d28d9; }

.charts-grid-history > .panel:nth-child(1) {
    border-top-color: var(--chart-blue) !important;
    background: linear-gradient(160deg, rgba(219,234,254,.74), #fff 40%) !important;
}
.charts-grid-history > .panel:nth-child(1) h2 { color: #1d4ed8; }
.charts-grid-history > .panel:nth-child(2) {
    border-top-color: var(--chart-green) !important;
    background: linear-gradient(160deg, rgba(220,252,231,.72), #fff 40%) !important;
}
.charts-grid-history > .panel:nth-child(2) h2 { color: #15803d; }

.district-summary-table { border-color: #f9a8d4; }
.district-summary-table thead th {
    color: #9d174d;
    background: linear-gradient(180deg, #fce7f3, #fbcfe8);
}
.district-summary-table tbody tr:nth-child(1) th,
.district-summary-table tbody tr:nth-child(1) td { background: #fdf2f8; }
.district-summary-table tbody tr:nth-child(2) th,
.district-summary-table tbody tr:nth-child(2) td { background: #eff6ff; }

.detail-title-strip { background: linear-gradient(90deg, #dbeafe, #ede9fe, #dcfce7); }
.detail-title-strip h2 { color: #4c1d95; }
.detail-table thead th {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #8b5cf6);
}
.detail-table tbody th { color: #5b21b6; background: #ede9fe; }
.detail-table tbody tr:nth-child(4n + 1) td { background: #fdf2f8; }
.detail-table tbody tr:nth-child(4n + 2) td { background: #eff6ff; }
.detail-table tbody tr:nth-child(4n + 3) td { background: #f5f3ff; }
.detail-table tbody tr:nth-child(4n) td { background: #f0fdf4; }
.detail-table tbody tr.detail-section-row th,
.detail-table tbody tr.detail-section-row td {
    color: #1e40af;
    background: linear-gradient(90deg, #dbeafe, #ede9fe);
}

.insight-yellow { background: #fefce8; border-color: #fde68a; }
.insight-yellow strong { color: #854d0e; }
.insight-pink { background: #fdf2f8; border-color: #f9a8d4; }
.insight-pink strong { color: #9d174d; }

.table thead th {
    color: #4c1d95;
    background: linear-gradient(90deg, #fce7f3, #dbeafe, #ede9fe);
}
.table tbody tr:nth-child(4n + 1) > * { background-color: rgba(253,242,248,.72); }
.table tbody tr:nth-child(4n + 2) > * { background-color: rgba(239,246,255,.78); }
.table tbody tr:nth-child(4n + 3) > * { background-color: rgba(245,243,255,.76); }
.table tbody tr:nth-child(4n) > * { background-color: rgba(240,253,244,.76); }
.table tbody tr:hover > * { background-color: #fff !important; }

/* Monthly detail table: category bands from the reference workbook */
.detail-table {
    border-collapse: separate;
    border-spacing: 0;
}
.detail-table th,
.detail-table td { border-color: #9eb6c8; }
.detail-table thead th {
    color: #fff;
    background: linear-gradient(90deg, #2563eb, #6657e8, #7c3aed);
    font-weight: 900;
}
.detail-table tbody tr.detail-section-row > th {
    padding: 9px 14px;
    color: #fff;
    text-align: left;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: .01em;
}

.detail-table .section-occupation > th { background: linear-gradient(90deg, #5b21b6, #7c3aed); }
.detail-table .section-demographic > th { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.detail-table .section-method > th { background: linear-gradient(90deg, #059669, #10b981); }
.detail-table .section-risk > th { color: #713f12; background: linear-gradient(90deg, #facc15, #fde047); }
.detail-table .section-trigger > th { background: linear-gradient(90deg, #db2777, #ec4899); }

.detail-table tbody tr.detail-category-occupation > th {
    color: #5b21b6;
    background: #ddd6fe !important;
}
.detail-table tbody tr.detail-category-occupation > td { background: #f5f3ff !important; }
.detail-table tbody tr.detail-category-occupation:nth-child(even) > td { background: #ede9fe !important; }

.detail-table tbody tr.detail-category-demographic > th {
    color: #075985;
    background: #bae6fd !important;
}
.detail-table tbody tr.detail-category-demographic > td { background: #e0f2fe !important; }
.detail-table tbody tr.detail-category-demographic:nth-child(even) > td { background: #dbeafe !important; }

.detail-table tbody tr.detail-category-method > th {
    color: #065f46;
    background: #a7f3d0 !important;
}
.detail-table tbody tr.detail-category-method > td { background: #ecfdf5 !important; }
.detail-table tbody tr.detail-category-method:nth-child(even) > td { background: #d1fae5 !important; }

.detail-table tbody tr.detail-category-risk > th {
    color: #854d0e;
    background: #fde68a !important;
}
.detail-table tbody tr.detail-category-risk > td { background: #fefce8 !important; }

.detail-table tbody tr.detail-category-trigger > th {
    color: #9d174d;
    background: #fbcfe8 !important;
}
.detail-table tbody tr.detail-category-trigger > td { background: #fdf2f8 !important; }

.detail-table tbody tr[class*="detail-category-"] > th { font-weight: 850; }
.detail-table tbody tr[class*="detail-category-"] > td { color: #243b53; font-weight: 650; }

/* Strong category headers and demographic summary row */
.detail-table tbody tr.detail-section-row.section-occupation > th {
    color: #fff !important;
    background: linear-gradient(90deg, #4c1d95, #6d28d9, #7c3aed) !important;
    text-shadow: 0 1px 2px rgba(46,16,101,.25);
}
.detail-table tbody tr.detail-section-row.section-demographic > th {
    color: #fff !important;
    background: linear-gradient(90deg, #0369a1, #0284c7, #38bdf8) !important;
    text-shadow: 0 1px 2px rgba(7,89,133,.25);
}
.detail-table tbody tr.detail-section-row.section-method > th {
    color: #fff !important;
    background: linear-gradient(90deg, #047857, #059669, #10b981) !important;
    text-shadow: 0 1px 2px rgba(6,78,59,.25);
}
.detail-table tbody tr.detail-section-row.section-risk > th {
    color: #422006 !important;
    background: linear-gradient(90deg, #eab308, #facc15, #fde047) !important;
}
.detail-table tbody tr.detail-section-row.section-trigger > th {
    color: #fff !important;
    background: linear-gradient(90deg, #be185d, #db2777, #ec4899) !important;
}

.detail-table tbody tr.detail-demographic-summary > th,
.detail-table tbody tr.detail-demographic-summary > td {
    color: #fff !important;
    background: linear-gradient(90deg, #0369a1, #0284c7, #0ea5e9) !important;
    border-color: #075985 !important;
    font-weight: 900 !important;
    text-shadow: 0 1px 2px rgba(7,89,133,.2);
}
.detail-table tbody tr.detail-demographic-summary > th {
    background: #075985 !important;
}

/* Muted table bands: softer fit with the aqua-mint template */
.detail-table thead th {
    color: #fff !important;
    background: linear-gradient(90deg, #527fbd, #7186c9, #8b79cf) !important;
    border-color: #adc3d3 !important;
    text-shadow: 0 1px 1px rgba(30,58,95,.16);
}
.detail-table tbody tr.detail-section-row.section-occupation > th {
    color: #38275f !important;
    background: linear-gradient(90deg, #a99ace, #b9aad8, #c6b9e2) !important;
    border-color: #9283bc !important;
    text-shadow: none;
}
.detail-table tbody tr.detail-section-row.section-demographic > th {
    color: #174c63 !important;
    background: linear-gradient(90deg, #8fc3db, #a2cfe2, #b5dbea) !important;
    border-color: #79abc2 !important;
    text-shadow: none;
}
.detail-table tbody tr.detail-section-row.section-method > th {
    color: #175c46 !important;
    background: linear-gradient(90deg, #86c9b0, #9ed5c1, #b5e2d1) !important;
    border-color: #6db297 !important;
    text-shadow: none;
}
.detail-table tbody tr.detail-section-row.section-risk > th {
    color: #684f18 !important;
    background: linear-gradient(90deg, #e8d18a, #efdda5, #f5e9bf) !important;
    border-color: #d3ba6d !important;
}
.detail-table tbody tr.detail-section-row.section-trigger > th {
    color: #713b57 !important;
    background: linear-gradient(90deg, #dca8c1, #e7bad0, #efcddd) !important;
    border-color: #c78ca9 !important;
    text-shadow: none;
}

.detail-table tbody tr.detail-demographic-summary > th,
.detail-table tbody tr.detail-demographic-summary > td {
    color: #123f52 !important;
    background: linear-gradient(90deg, #76aec7, #89bdd3, #9bcadd) !important;
    border-color: #679bb2 !important;
    text-shadow: none;
}
.detail-table tbody tr.detail-demographic-summary > th {
    color: #103b4d !important;
    background: #6ea5be !important;
}

.detail-table tbody tr.detail-category-occupation > th { background: #d9d1eb !important; }
.detail-table tbody tr.detail-category-occupation > td { background: #f3f0fa !important; }
.detail-table tbody tr.detail-category-occupation:nth-child(even) > td { background: #ece8f6 !important; }
.detail-table tbody tr.detail-category-demographic > th { background: #b8dceb !important; }
.detail-table tbody tr.detail-category-demographic > td { background: #edf7fb !important; }
.detail-table tbody tr.detail-category-demographic:nth-child(even) > td { background: #e3f1f7 !important; }
.detail-table tbody tr.detail-category-method > th { background: #b8e2d2 !important; }
.detail-table tbody tr.detail-category-method > td { background: #eff9f5 !important; }
.detail-table tbody tr.detail-category-method:nth-child(even) > td { background: #e3f3ed !important; }

/* Match table category colors to their corresponding charts */
.detail-table tbody tr.detail-section-row.section-occupation > th {
    color: #493573 !important;
    background: linear-gradient(90deg, #b3a5d3, #c2b5de, #cec4e6) !important;
    border-color: #9c8bc3 !important;
}
.detail-table tbody tr.detail-section-row.section-demographic > th {
    color: #274c69 !important;
    background: linear-gradient(90deg, #9ec9e1, #b6d8e9 54%, #e5bdd2) !important;
    border-color: #8eb5cb !important;
}
.detail-table tbody tr.detail-section-row.section-method > th {
    color: #763e4b !important;
    background: linear-gradient(90deg, #e3aeb7, #eabdc5, #f1cdd3) !important;
    border-color: #cf939f !important;
}
.detail-table tbody tr.detail-section-row.section-risk > th {
    color: #684f18 !important;
    background: linear-gradient(90deg, #e8d18a, #efdda5, #f5e9bf) !important;
}
.detail-table tbody tr.detail-section-row.section-trigger > th {
    color: #513976 !important;
    background: linear-gradient(90deg, #b9a9d8, #c8bae1, #d7cce9) !important;
    border-color: #a18dc8 !important;
}

.detail-table tbody tr.detail-demographic-summary > th,
.detail-table tbody tr.detail-demographic-summary > td {
    color: #713652 !important;
    background: linear-gradient(90deg, #dba5bf, #e5b5ca, #edc5d6) !important;
    border-color: #c78fa9 !important;
}
.detail-table tbody tr.detail-demographic-summary > th {
    color: #663047 !important;
    background: #d39ab5 !important;
}

.detail-table tbody tr.detail-category-method > th {
    color: #763746 !important;
    background: #e8b7c0 !important;
}
.detail-table tbody tr.detail-category-method > td { background: #fdf1f3 !important; }
.detail-table tbody tr.detail-category-method:nth-child(even) > td { background: #f8e7ea !important; }

.detail-table tbody tr.detail-category-risk > th {
    color: #715614 !important;
    background: #ecda9e !important;
}
.detail-table tbody tr.detail-category-risk > td { background: #fdf9e8 !important; }
.detail-table tbody tr.detail-category-trigger > th {
    color: #513976 !important;
    background: #cfc2e5 !important;
}
.detail-table tbody tr.detail-category-trigger > td { background: #f5f2fa !important; }

/* Demographic layout: occupation chart on its own row */
.charts-grid-demographic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}
.charts-grid-demographic > .panel:nth-child(3) {
    grid-column: 1 / -1;
}
.charts-grid-demographic > .panel:nth-child(3) .chart-md {
    height: 420px;
}
.charts-grid-demographic > .panel:nth-child(3) .panel-heading h2 {
    font-size: 1.34rem;
}

@media (max-width: 767.98px) {
    .charts-grid-demographic { grid-template-columns: 1fr; }
    .charts-grid-demographic > .panel:nth-child(3) { grid-column: auto; }
    .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 350px; }
}

/* Larger, clearer typography and chart spacing across every card */
.panel-chart { padding: 26px; }
.panel-heading {
    min-height: 64px;
    margin-bottom: 14px;
}
.panel-heading.compact {
    min-height: 52px;
    margin-bottom: 10px;
}
.panel-heading h2,
.detail-title-strip h2 {
    font-size: 1.42rem;
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -.015em;
}
.panel-heading p {
    margin-top: 7px;
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.6;
}
.panel-badge { font-size: .96rem; font-weight: 850; }

.chart-xl { height: 500px; }
.chart-lg { height: 390px; }
.chart-md { height: 360px; }
.charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 460px; }
.charts-grid-demographic > .panel:nth-child(3) .panel-heading h2 { font-size: 1.52rem; }

.kpi-label { font-size: 1.12rem; }
.kpi-value { font-size: clamp(2.2rem, 2.45vw, 3rem); }
.kpi-unit { font-size: 1rem; }
.comparison-title { font-size: 1.16rem; }
.comparison-grid > div { font-size: 1.06rem; font-weight: 750; }
.rate-card span,
.target-box span { font-size: 1.08rem; }
.rate-card strong,
.target-box strong { font-size: 2.25rem; }
.rate-card small,
.target-box small { font-size: .96rem; }
.insight-card span { font-size: 1.06rem; }
.insight-card strong { font-size: 1.32rem; }
.insight-card small { font-size: 1.08rem; }

@media (max-width: 767.98px) {
    .panel-chart { padding: 18px; }
    .panel-heading { min-height: 54px; }
    .panel-heading h2,
    .detail-title-strip h2 { font-size: 1.2rem; }
    .panel-heading p { font-size: .96rem; }
    .chart-xl { height: 410px; }
    .chart-lg { height: 350px; }
    .chart-md { height: 320px; }
    .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 380px; }
}

@media print {
    .panel-chart { padding: 8px; }
    .panel-heading { min-height: 26px; margin-bottom: 3px; }
    .panel-heading.compact { min-height: 22px; margin-bottom: 2px; }
    .panel-heading h2,
    .detail-title-strip h2 { font-size: 9pt; }
    .panel-heading p { margin-top: 2px; font-size: 6pt; }
    .chart-xl { height: 235px !important; }
    .chart-lg { height: 190px !important; }
    .chart-md,
    .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 165px !important; }
}

/* Dashboard responsive layout base */
@media screen {
    html {
        max-width: 100%;
        overflow-x: clip;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    .dashboard-body {
        --dashboard-sidebar-width: clamp(250px, 18vw, 300px);
        min-width: 0;
        max-width: 100%;
        overflow-x: clip;
    }

    .dashboard-body .app-shell {
        display: grid;
        grid-template-columns: var(--dashboard-sidebar-width) minmax(0, 1fr);
        align-items: start;
        width: 100%;
        min-width: 0;
        min-height: 100vh;
    }

    .dashboard-body .sidebar {
        position: sticky;
        inset: auto;
        top: 0;
        display: flex;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .dashboard-body .sidebar-nav {
        flex: 1 1 auto;
        min-height: 0;
    }

    .dashboard-body .sidebar-user {
        position: static;
        inset: auto;
        flex: 0 0 auto;
        margin-top: auto;
    }

    .dashboard-body .main-content {
        grid-column: 2;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
    }

    .dashboard-body .dashboard-shell,
    .dashboard-body .report-toolbar,
    .dashboard-body .report-page,
    .dashboard-body .panel,
    .dashboard-body .chart-wrap,
    .dashboard-body .plot-chart,
    .dashboard-body .plot-container,
    .dashboard-body .svg-container {
        min-width: 0;
        max-width: 100%;
    }

    .dashboard-body .report-toolbar,
    .dashboard-body .report-page {
        width: min(1680px, calc(100% - clamp(24px, 3vw, 48px)));
        margin-inline: auto;
    }

    .dashboard-body .filter-grid {
        grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    }

    .dashboard-body .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-body .kpi-card {
        min-width: 0;
        min-height: clamp(126px, 9vw, 164px);
    }

    .dashboard-body .kpi-label {
        font-size: clamp(.9rem, .72rem + .22vw, 1.08rem);
        line-height: 1.35;
    }

    .dashboard-body .kpi-value {
        max-width: 100%;
        font-size: clamp(2rem, 1.2rem + 1.55vw, 3.25rem);
        overflow-wrap: anywhere;
    }

    .dashboard-body .district-summary-table,
    .dashboard-body .detail-table-wrap {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-body .plot-chart,
    .dashboard-body .plot-container,
    .dashboard-body .svg-container {
        width: 100% !important;
    }

    .dashboard-body.sidebar-collapsed {
        --dashboard-sidebar-width: 94px;
    }

    .dashboard-body.sidebar-collapsed .main-content {
        width: 100%;
        margin-left: 0;
    }
}

@media screen and (max-width: 1399.98px) {
    .dashboard-body .report-toolbar,
    .dashboard-body .report-page {
        width: calc(100% - 28px);
    }

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

    .dashboard-body .filter-apply,
    .dashboard-body .filter-grid > button:last-child {
        grid-column: 1 / -1;
        width: 100%;
    }

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

    .dashboard-body .top-layout,
    .dashboard-body .charts-grid-demographic,
    .dashboard-body .charts-grid-factors,
    .dashboard-body .charts-grid-history,
    .dashboard-body .detail-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media screen and (max-width: 900px) {
    .dashboard-body .app-shell {
        display: block;
        width: 100%;
    }

    .dashboard-body .sidebar,
    .dashboard-body.sidebar-collapsed .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1045;
        width: min(88vw, 320px);
        height: 100vh;
        height: 100dvh;
        padding: 22px;
        transform: translateX(-105%);
    }

    .dashboard-body.sidebar-open .sidebar,
    .dashboard-body.sidebar-collapsed.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .dashboard-body .sidebar-toggle {
        display: grid;
    }

    .dashboard-body .main-content,
    .dashboard-body.sidebar-collapsed .main-content {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding-top: 64px;
    }

    .dashboard-body.sidebar-collapsed .brand-copy,
    .dashboard-body.sidebar-collapsed .sidebar-user,
    .dashboard-body.sidebar-collapsed .sidebar-nav-label,
    .dashboard-body.sidebar-collapsed .sidebar-submenu {
        display: initial;
    }

    .dashboard-body.sidebar-collapsed .sidebar-nav-label {
        display: block;
    }

    .dashboard-body.sidebar-collapsed .sidebar-submenu {
        display: grid;
    }

    .dashboard-body.sidebar-collapsed .sidebar-link,
    .dashboard-body.sidebar-collapsed .sidebar-group-link {
        justify-content: flex-start;
        width: auto;
        height: auto;
        margin-inline: 0;
        padding: 11px 13px;
    }

    .dashboard-body.sidebar-collapsed .sidebar-link span:last-child,
    .dashboard-body.sidebar-collapsed .sidebar-group-link > span:last-child {
        display: inline;
    }

    .dashboard-body .report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-body .toolbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .dashboard-body .toolbar-actions > * {
        flex: 1 1 180px;
    }

    .dashboard-body .plot-container,
    .dashboard-body .svg-container {
        overflow: hidden !important;
    }
}

@media screen and (max-width: 599.98px) {
    .dashboard-body .report-toolbar,
    .dashboard-body .report-page {
        width: calc(100% - 16px);
    }

    .dashboard-body .report-page {
        padding: 12px;
    }

    .dashboard-body .filter-grid,
    .dashboard-body .kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-body .filter-apply,
    .dashboard-body .filter-grid > button:last-child {
        grid-column: auto;
    }

    .dashboard-body .kpi-card {
        min-height: 126px;
    }

    .dashboard-body .kpi-value {
        font-size: clamp(2.15rem, 10vw, 3rem);
    }

    .dashboard-body .gallery-section-heading,
    .dashboard-body .filter-summary-row,
    .dashboard-body .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-body .gallery-controls {
        align-self: flex-end;
    }

    .dashboard-body .chart-xl { height: 400px; }
    .dashboard-body .chart-lg { height: 350px; }
    .dashboard-body .chart-md { height: 330px; }
    .dashboard-body .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 410px; }
}

/* Keep the prominent monthly counts clear of the decorative divider. */
@media screen {
    .dashboard-body .insight-card small {
        position: relative;
        justify-content: center;
        padding-left: clamp(30px, 2vw, 42px);
        border-left: 0;
        overflow: hidden;
    }
    .dashboard-body .insight-card small::before {
        position: absolute;
        top: 10%;
        bottom: 10%;
        left: clamp(10px, .8vw, 16px);
        width: 2px;
        border-radius: 999px;
        background: currentColor;
        content: "";
        opacity: .72;
    }
}

/* Configurable animated dashboard footer. */
.dashboard-site-footer {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(18px, 2.2vw, 34px);
    width: min(1680px, calc(100% - clamp(24px, 3vw, 48px)));
    margin: 0 auto 28px;
    padding: clamp(24px, 3vw, 42px);
    overflow: hidden;
    align-items: center;
    border: 1px solid rgba(45, 212, 191, .35);
    border-radius: 28px;
    color: #eafffb;
    background:
        radial-gradient(circle at 88% 20%, rgba(96, 165, 250, .28), transparent 28%),
        linear-gradient(125deg, #075f58, #0f766e 55%, #0b7285);
    box-shadow: 0 20px 45px rgba(15, 118, 110, .2);
    isolation: isolate;
}
.dashboard-site-footer::after {
    position: absolute;
    z-index: -1;
    inset: -80% auto -80% -35%;
    width: 28%;
    content: "";
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
    transform: rotate(15deg);
    animation: dashboard-footer-shine 7s ease-in-out infinite;
}
.dashboard-footer-orbit {
    display: grid;
    width: clamp(68px, 6vw, 94px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 28px;
    color: #0f766e;
    background: rgba(255,255,255,.94);
    box-shadow: 0 14px 30px rgba(0,0,0,.16);
    font-size: clamp(2rem, 3vw, 3rem);
    animation: dashboard-footer-float 4.2s ease-in-out infinite;
}
.dashboard-footer-content { min-width: 0; }
.dashboard-footer-kicker {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    color: #99f6e4;
    font-size: clamp(.84rem, 1vw, 1rem);
    font-weight: 800;
    letter-spacing: .02em;
}
.dashboard-footer-content h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.45rem, 2.2vw, 2.25rem);
    font-weight: 900;
    line-height: 1.25;
}
.dashboard-footer-content p {
    max-width: 78ch;
    margin: 8px 0 16px;
    color: #d9fffa;
    font-size: clamp(.95rem, 1.1vw, 1.12rem);
    line-height: 1.7;
}
.dashboard-footer-meta {
    display: flex;
    gap: 10px 24px;
    flex-wrap: wrap;
    color: #ccfbf1;
    font-size: clamp(.86rem, 1vw, 1rem);
    font-weight: 700;
}
.dashboard-footer-meta span { display: inline-flex; gap: 8px; align-items: center; }
.footer-settings-card,
.gallery-heading-settings {
    border-top: 4px solid #14b8a6 !important;
}

@keyframes dashboard-footer-shine {
    0%, 35% { left: -35%; opacity: 0; }
    45% { opacity: 1; }
    65%, 100% { left: 125%; opacity: 0; }
}
@keyframes dashboard-footer-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

@media screen and (max-width: 599.98px) {
    .dashboard-site-footer {
        grid-template-columns: minmax(0, 1fr);
        width: calc(100% - 16px);
        padding: 24px 20px;
        border-radius: 22px;
        text-align: center;
    }
    .dashboard-footer-orbit { margin-inline: auto; }
    .dashboard-footer-content p { margin-inline: auto; }
    .dashboard-footer-meta { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-site-footer::after,
    .dashboard-footer-orbit { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-body .kpi-card,
    .dashboard-body .sidebar,
    .dashboard-body .main-content {
        animation: none !important;
        transition-duration: .01ms !important;
    }
}

/* Public-relations gallery: dashboard slider inspired by TeenCare */
.public-relations-gallery {
    position: relative;
    margin: 22px 0;
    padding: clamp(18px, 1.7vw, 26px);
    overflow: hidden;
    border: 1px solid rgba(20,184,166,.16);
    border-radius: 26px;
    background:
        radial-gradient(circle at 92% 10%, rgba(96,165,250,.14), transparent 28%),
        radial-gradient(circle at 4% 90%, rgba(45,212,191,.12), transparent 26%),
        linear-gradient(135deg, rgba(240,253,250,.95), rgba(239,246,255,.92));
    box-shadow: 0 18px 44px rgba(15,118,110,.09);
}
.gallery-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}
.gallery-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: #0f766e;
    font-size: clamp(.86rem, .2vw + .78rem, 1rem);
    font-weight: 900;
    letter-spacing: .035em;
}
.gallery-section-heading h2 {
    margin: 0;
    color: #134e4a;
    font-size: clamp(1.45rem, .8vw + 1.12rem, 2rem);
    font-weight: 900;
    line-height: 1.3;
}
.gallery-section-heading p {
    margin: 5px 0 0;
    color: #5d7472;
    font-size: clamp(.94rem, .18vw + .86rem, 1.08rem);
    font-weight: 650;
}
.gallery-controls { display: flex; gap: 9px; }
.gallery-controls button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(15,118,110,.16);
    border-radius: 14px;
    color: #0f766e;
    background: rgba(255,255,255,.88);
    box-shadow: 0 8px 18px rgba(15,118,110,.1);
    font-size: 1.1rem;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}
.gallery-controls button:hover:not(:disabled) { color: #fff; background: #0f766e; transform: translateY(-2px); }
.gallery-controls button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.gallery-viewport { overflow: hidden; }
.gallery-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide-card {
    display: flex;
    flex: 0 0 calc((100% - 56px) / 5);
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    scroll-snap-align: start;
    border: 1px solid rgba(255,255,255,.92);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(31,84,80,.1);
    transition: transform 280ms cubic-bezier(.2,.75,.25,1), box-shadow 280ms ease;
}
.gallery-slide-card:hover { transform: translateY(-7px); box-shadow: 0 16px 36px rgba(15,118,110,.18); }
.gallery-slide-image {
    position: relative;
    display: grid;
    aspect-ratio: 3 / 4;
    place-items: center;
    overflow: hidden;
    isolation: isolate;
    background: #e8f4f1;
}
.gallery-slide-image img {
    display: block;
    width: 100%;
    height: 100%;
    transition: transform 520ms cubic-bezier(.2,.7,.2,1);
}
.gallery-slide-backdrop {
    position: absolute;
    inset: -8%;
    z-index: 0;
    width: 116% !important;
    height: 116% !important;
    object-fit: cover;
    filter: blur(24px) saturate(.78);
    opacity: .28;
    transform: scale(1.06);
}
.gallery-slide-poster {
    position: relative;
    z-index: 1;
    object-fit: contain;
}
.gallery-slide-card:hover .gallery-slide-poster { transform: scale(1.018); }
.gallery-slide-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    z-index: 2;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    color: #fff;
    background: linear-gradient(to top, rgba(6,78,59,.86), rgba(15,118,110,.18) 62%, transparent);
    opacity: 0;
    transition: opacity 260ms ease;
}
.gallery-slide-card:hover .gallery-slide-overlay,
.gallery-slide-card:focus-within .gallery-slide-overlay { opacity: 1; }
.gallery-slide-overlay a,
.gallery-slide-overlay span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border-radius: 999px;
    color: #0f766e;
    background: #fff;
    font-size: .8rem;
    font-weight: 850;
    text-decoration: none;
}
.gallery-slide-body { flex: 1; padding: 12px 13px 10px; }
.gallery-category {
    display: inline-flex;
    margin-bottom: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #0f766e;
    background: #ccfbf1;
    font-size: .7rem;
    font-weight: 850;
}
.gallery-slide-body h3 {
    display: -webkit-box;
    min-height: 2.7em;
    margin: 0;
    overflow: hidden;
    color: #213e3b;
    font-size: clamp(.88rem, .14vw + .84rem, 1rem);
    font-weight: 850;
    line-height: 1.38;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.gallery-slide-body p {
    display: -webkit-box;
    margin: 8px 0 0;
    overflow: hidden;
    color: #687d7a;
    font-size: .78rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.gallery-slide-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 0 12px 12px;
}
.gallery-slide-actions a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    color: #0f766e;
    background: #e9faf6;
    font-size: .76rem;
    font-weight: 850;
    text-decoration: none;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}
.gallery-slide-actions a:hover { color: #fff; background: #0f766e; transform: translateY(-1px); }
.gallery-slide-actions .gallery-download-action { width: 36px; color: #2563eb; background: #eff6ff; }
.gallery-pagination {
    display: flex;
    min-height: 10px;
    justify-content: center;
    gap: 7px;
    margin-top: 20px;
}
.gallery-pagination button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(15,118,110,.25);
    transition: width 180ms ease, background 180ms ease;
}
.gallery-pagination button.active { width: 24px; background: #14b8a6; }
.gallery-autoplay-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    background: rgba(20,184,166,.1);
}
.gallery-autoplay-progress span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg,#0f766e,#2dd4bf,#60a5fa); transform-origin: left; }
@keyframes gallery-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Gallery administration */
.gallery-admin-current-image {
    display: block;
    width: min(100%, 520px);
    max-height: 620px;
    margin-inline: auto;
    border: 1px solid rgba(15,118,110,.12);
    border-radius: 16px;
    object-fit: contain;
    background: #edf8f6;
    box-shadow: 0 10px 24px rgba(15,118,110,.12);
}
.gallery-category-list { display: grid; gap: 10px; }
.gallery-category-row { display: grid; grid-template-columns: minmax(130px,1fr) 78px auto auto auto auto; gap: 8px; align-items: center; }
.gallery-category-sort { min-width: 0; }
.gallery-admin-thumb { width: 92px; height: 92px; border-radius: 11px; object-fit: contain; background: #edf8f6; }
.gallery-admin-description { max-width: 34ch; }

.gallery-upload-guide {
    padding: 16px 18px;
    border: 1px solid rgba(15,118,110,.16);
    border-radius: 16px;
    color: #3f5f5b;
    background: linear-gradient(135deg, #f0fdfa, #eff6ff);
}
.gallery-upload-guide-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #0f766e;
    font-size: 1.02rem;
    font-weight: 850;
}
.gallery-upload-specs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.gallery-upload-specs span {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,.84);
    font-size: .88rem;
}
.gallery-upload-guide ul { margin: 0; padding-left: 1.2rem; font-size: .9rem; line-height: 1.7; }
.gallery-file-feedback {
    display: none;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.5;
}
.gallery-file-feedback.is-success,
.gallery-file-feedback.is-warning,
.gallery-file-feedback.is-error { display: block; }
.gallery-file-feedback.is-success { color: #075f54; background: #d1fae5; }
.gallery-file-feedback.is-warning { color: #854d0e; background: #fef3c7; }
.gallery-file-feedback.is-error { color: #991b1b; background: #fee2e2; }

.gallery-notice-modal {
    border: 0;
    border-radius: 1.5rem;
    box-shadow: 0 1.5rem 4rem rgba(20, 50, 70, 0.2);
    overflow: hidden;
}

.gallery-notice-modal::before {
    content: "";
    display: block;
    height: 0.4rem;
    background: #16a085;
}

.gallery-notice-modal.is-error::before { background: #dc3545; }

.gallery-notice-icon {
    color: #16a085;
    font-size: clamp(3rem, 7vw, 4.5rem);
    line-height: 1;
}

.gallery-notice-modal.is-error .gallery-notice-icon { color: #dc3545; }
.gallery-admin-table th,
.gallery-admin-table td { padding: 12px 14px; }

@media (max-width: 1399.98px) {
    .gallery-slide-card { flex-basis: calc((100% - 42px) / 4); }
}
@media (max-width: 1199.98px) {
    .gallery-slide-card { flex-basis: calc((100% - 28px) / 3); }
}
@media (max-width: 767.98px) {
    .public-relations-gallery { margin: 18px 0; padding: 20px 16px 24px; border-radius: 20px; }
    .gallery-section-heading { align-items: center; margin-bottom: 17px; }
    .gallery-section-heading p { display: none; }
    .gallery-controls button { width: 40px; height: 40px; }
    .gallery-track { gap: 14px; }
    .gallery-slide-card { flex-basis: calc((100% - 14px) / 2); }
    .gallery-upload-specs { grid-template-columns: 1fr; }
    .gallery-category-row { grid-template-columns: minmax(120px,1fr) 68px auto; }
    .gallery-category-row .badge { display: none; }
}
@media (max-width: 479.98px) {
    .gallery-slide-card { flex-basis: 84%; }
    .gallery-section-heading h2 { font-size: 1.3rem; }
    .gallery-controls { gap: 6px; }
    .gallery-controls button { width: 37px; height: 37px; border-radius: 12px; }
    .gallery-category-row { grid-template-columns: 1fr 64px auto; }
    .gallery-category-row .form-check { display: none; }
}
@media print {
    .public-relations-gallery { display: none !important; }
}

/* Imported-data sidebar navigation in the original aqua/mint theme */
html { scroll-behavior: smooth; }
#reportPage,
#district-overview,
#demographic-overview,
#factor-overview,
#trend-overview,
#monthly-detail { scroll-margin-top: 24px; }

body .sidebar {
    border-right-color: rgba(20,184,166,.16);
    background: rgba(250,255,254,.97);
    box-shadow: 14px 0 40px rgba(15,118,110,.07);
}
body .brand-mark {
    color: #fff;
    background: linear-gradient(145deg,#0f766e,#2dd4bf 68%,#38bdf8);
    box-shadow: 0 12px 24px rgba(20,184,166,.22);
}
body .brand-copy strong { color: #0f766e; }
body .sidebar-brand { border-bottom-color: #d9f2ec; }
body .sidebar-collapse-btn { border-color: #cceee7; color: #0f766e; background: #e8faf6; }
body .sidebar-nav-label { color: #6e9792; }
body .sidebar-link,
body .sidebar-group-link { color: #506a68; }
body .sidebar-link:hover,
body .sidebar-group-link:hover { color: #0f766e; background: #ecfdf8; }
body .sidebar-link.active {
    border-color: rgba(20,184,166,.12);
    color: #0f766e;
    background: linear-gradient(105deg,#ccfbf1,#e0f2fe);
    box-shadow: inset 4px 0 0 #14b8a6,0 8px 20px rgba(15,118,110,.08);
}
body .nav-icon { color: #0f9488; background: rgba(204,251,241,.78); }
body .sidebar-link.active .nav-icon {
    color: #fff;
    background: linear-gradient(145deg,#0f766e,#2dd4bf);
    box-shadow: 0 7px 14px rgba(20,184,166,.2);
}
.sidebar-menu-group { display: grid; gap: 3px; }
.sidebar-group-link {
    display: flex;
    min-height: 50px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 850;
    text-decoration: none;
    transition: color 180ms ease,background 180ms ease,transform 180ms ease;
}
.sidebar-group-link:hover { transform: translateX(3px); }
.sidebar-submenu {
    display: grid;
    gap: 4px;
    margin: 0 0 7px 29px;
    padding: 3px 0 3px 20px;
    border-left: 2px solid #b9ece2;
}
.sidebar-submenu a {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 12px;
    padding: 7px 9px;
    border-radius: 11px;
    color: #657b79;
    font-size: .92rem;
    font-weight: 760;
    text-decoration: none;
    transition: color 160ms ease,background 160ms ease,transform 160ms ease;
}
.sidebar-submenu a i { width: 19px; color: #14b8a6; text-align: center; }
.sidebar-submenu a:hover,
.sidebar-submenu a.active { color: #0f766e; background: #eafaf6; transform: translateX(2px); }
body .sidebar-user { border-color: #d8eee9; box-shadow: 0 14px 34px rgba(15,118,110,.08); }
body .sidebar-user .btn-primary,
body .sidebar-user .btn-outline-primary { border-color: #14b8a6; background: linear-gradient(90deg,#0f766e,#14b8a6); }

body .dashboard-filter { border-left-color: #14b8a6; box-shadow: 0 16px 38px rgba(15,118,110,.09); }
body .filter-summary-row h2 { color: #0f766e; }
body .filter-reset { color: #0f766e; background: linear-gradient(90deg,#ecfdf5,#e0f2fe); }
body .filter-field .form-select { border-color: #bde9df; box-shadow: 0 5px 15px rgba(15,118,110,.035); }
body .filter-field .form-select:focus { border-color: #14b8a6; box-shadow: 0 0 0 .22rem rgba(20,184,166,.11); }
body .filter-apply { background: linear-gradient(100deg,#0f766e,#14b8a6); box-shadow: 0 10px 22px rgba(20,184,166,.2); }
body .filter-apply:hover { box-shadow: 0 14px 28px rgba(20,184,166,.26); }

@media (max-width: 900px) {
    body.sidebar-collapsed .sidebar-submenu { display: grid; }
}
@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar-nav-label,
    body.sidebar-collapsed .sidebar-submenu { display: none; }
    body.sidebar-collapsed .sidebar-menu-group { display: block; }
    body.sidebar-collapsed .sidebar-group-link {
        justify-content: center;
        width: 50px;
        height: 50px;
        margin-inline: auto;
        padding: 0;
    }
    body.sidebar-collapsed .sidebar-group-link > span:last-child { display: none; }
    body.sidebar-collapsed .sidebar-group-link:hover { transform: none; }
}

/* Chart card breathing room and unclipped cumulative labels */
.charts-grid-history {
    gap: 24px;
    margin-block: 24px;
}
.charts-grid-history > .panel {
    padding: 32px 34px 28px;
    border-radius: 26px;
}
.charts-grid-history > .panel .panel-heading {
    min-height: 76px;
    margin-bottom: 20px;
}
.charts-grid-history > .panel .panel-heading h2 {
    margin-bottom: 7px;
    line-height: 1.35;
}
.charts-grid-history > .panel .panel-heading p {
    line-height: 1.6;
}
.charts-grid-history > .panel .chart-lg {
    height: 500px;
    margin-top: 8px;
    padding-top: 4px;
    overflow: visible;
}
.charts-grid-history > .panel .plot-chart,
.charts-grid-history > .panel .plot-container,
.charts-grid-history > .panel .svg-container {
    overflow: visible !important;
}

@media (max-width: 1199.98px) {
    .charts-grid-history > .panel { padding: 26px 24px 22px; }
    .charts-grid-history > .panel .chart-lg { height: 470px; }
}
@media (max-width: 767.98px) {
    .charts-grid-history { gap: 18px; margin-block: 18px; }
    .charts-grid-history > .panel { padding: 20px 16px 18px; }
    .charts-grid-history > .panel .panel-heading { min-height: 64px; margin-bottom: 12px; }
    .charts-grid-history > .panel .chart-lg { height: 420px; }
}
@media print {
    .charts-grid-history { gap: 3mm; margin-block: 3mm; }
    .charts-grid-history > .panel { padding: 3mm; }
    .charts-grid-history > .panel .chart-lg { height: 190px !important; margin: 0; padding: 0; }
}

/* Final pastel UI cascade */
.sidebar {
    width: 320px;
    padding: 22px 18px;
    border-right: 1px solid rgba(236,72,153,.14);
    background: rgba(255,252,254,.97);
    box-shadow: 14px 0 40px rgba(190,24,93,.06);
}
.main-content { margin-left: 320px; width: calc(100% - 320px); }
.sidebar-brand { margin-bottom: 22px; padding: 0 2px 18px; border-bottom: 1px solid #f7d9e8; }
.brand-mark { width: 52px; height: 52px; border: 0; border-radius: 17px; color: #fff; background: linear-gradient(145deg,#ef4ba3,#c084fc 65%,#60a5fa); box-shadow: 0 12px 24px rgba(232,62,150,.24); font-size: 1.45rem; }
.brand-copy strong { color: #b91c63; font-size: 1.18rem; }
.brand-copy small { color: #73809a; font-size: .76rem; }
.sidebar-collapse-btn { width: 38px; height: 38px; color: #d92d80; background: #fff0f7; border: 1px solid #f5d7e7; font-size: 1rem; }
.sidebar-nav { gap: 5px; }
.sidebar-nav-label { display: block; margin: 16px 12px 6px; color: #a87a93; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-link { min-height: 52px; padding: 9px 12px; border: 1px solid transparent; border-radius: 16px; color: #58657d; font-size: 1rem; font-weight: 780; }
.sidebar-link:hover { color: #b91c63; background: #fff2f8; transform: translateX(3px); }
.sidebar-link.active { border-color: rgba(236,72,153,.1); color: #b91c63; background: linear-gradient(105deg,#fde7f2,#e4efff); box-shadow: inset 4px 0 0 #ec4899,0 8px 20px rgba(232,62,150,.08); }
.nav-icon { display: inline-grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: #e83e96; background: rgba(252,231,243,.7); font-size: 1.05rem; }
.sidebar-link.active .nav-icon { color: #fff; background: linear-gradient(145deg,#ec4899,#a78bfa); box-shadow: 0 7px 14px rgba(236,72,153,.2); }
.sidebar-user { border: 1px solid #f6deea; border-radius: 20px; background: rgba(255,255,255,.95); box-shadow: 0 14px 34px rgba(190,24,93,.08); }
.sidebar-user .btn-primary,.sidebar-user .btn-outline-primary { border-color: #ec4899; border-radius: 12px; color: #fff; background: linear-gradient(90deg,#d92d80,#ec4899); }

.dashboard-filter { margin-bottom: 22px; padding: 18px 20px 20px; border: 1px solid rgba(255,255,255,.96); border-left: 5px solid #ec4899; border-radius: 22px; background: rgba(255,255,255,.9); box-shadow: 0 16px 38px rgba(129,87,156,.1); }
.filter-summary-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.filter-summary-row h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; color: #b91c63; font-size: 1.08rem; font-weight: 900; }
.filter-summary-row p { margin: 0; color: #66738a; font-size: .92rem; font-weight: 650; }
.filter-reset { padding: 8px 12px; border: 0; border-radius: 12px; color: #b91c63; background: linear-gradient(90deg,#fdf2f8,#eff6ff); font-size: .88rem; font-weight: 800; }
.filter-grid { display: grid; grid-template-columns: 1fr 1.15fr 1fr 1.45fr auto; gap: 12px; align-items: end; }
.filter-field label { display: block; margin: 0 0 6px 2px; color: #4e5d75; font-size: .9rem; font-weight: 800; }
.filter-field .form-select { min-height: 46px; border: 1px solid #f3c8dd; border-radius: 13px; color: #4c5870; background-color: #fff; font-size: .96rem; box-shadow: 0 5px 15px rgba(190,24,93,.035); }
.filter-field .form-select:disabled { color: #9aa4b5; background-color: #f7f8fb; }
.filter-apply { display: inline-flex; min-width: 154px; min-height: 46px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 13px; color: #fff; background: linear-gradient(100deg,#d92d80,#ec4899); box-shadow: 0 10px 22px rgba(232,62,150,.2); font-size: .96rem; font-weight: 900; }
.dashboard-filter-hidden { display: none !important; }

.kpi-card { border: 1px solid rgba(236,72,153,.15); border-radius: 24px; background: linear-gradient(145deg,rgba(255,255,255,.96),rgba(252,231,243,.58)); box-shadow: 0 15px 34px rgba(129,87,156,.09); }
.kpi-orange { border-color: rgba(96,165,250,.2); background: linear-gradient(145deg,#fff,rgba(219,234,254,.68)); }
.kpi-green { border-color: rgba(52,211,153,.2); background: linear-gradient(145deg,#fff,rgba(209,250,229,.66)); }
.kpi-blue { border-color: rgba(167,139,250,.2); background: linear-gradient(145deg,#fff,rgba(237,233,254,.68)); }
.kpi-card::after { display: none; }
.kpi-icon-bg { position: absolute; right: -8px; bottom: -18px; z-index: -1; color: currentColor; font-size: 7.5rem; line-height: 1; opacity: .055; transform: rotate(-8deg); }
.kpi-violet .kpi-icon { color:#fff; background:linear-gradient(145deg,#d92d80,#f472b6); }
.kpi-orange .kpi-icon { color:#fff; background:linear-gradient(145deg,#3b82f6,#7dd3fc); }
.kpi-green .kpi-icon { color:#fff; background:linear-gradient(145deg,#10b981,#6ee7b7); }
.kpi-blue .kpi-icon { color:#fff; background:linear-gradient(145deg,#8b5cf6,#c4b5fd); }

.panel,.detail-section { border: 1px solid rgba(236,72,153,.11) !important; border-radius: 24px; background: rgba(255,255,255,.9) !important; box-shadow: 0 18px 44px rgba(129,87,156,.09) !important; }
.district-panel { border-top: 5px solid #ec4899 !important; background: linear-gradient(160deg,rgba(253,242,248,.94),rgba(255,255,255,.94) 38%) !important; }
.district-panel .panel-heading h2,.panel-heading h2 { color: #a71d5d; }
.panel-heading p { color: #68748a; }
.chart-wrap { border-radius: 18px; background: rgba(255,255,255,.42); }
.comparison-title { display:flex; align-items:center; justify-content:center; gap:8px; }
.rate-card,.target-box { position:relative; gap:16px; overflow:hidden; }
.summary-card-icon { display:inline-grid !important; flex:0 0 46px; width:46px; height:46px; place-items:center; border-radius:15px; color:#fff !important; background:linear-gradient(145deg,#14b8a6,#67e8f9); box-shadow:0 9px 20px rgba(20,184,166,.18); font-size:1.25rem !important; }
.rate-card-muted .summary-card-icon { background:linear-gradient(145deg,#60a5fa,#a5b4fc); }
.target-box .summary-card-icon { background:linear-gradient(145deg,#34d399,#86efac); }

@media (max-width:1199.98px) { .filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.filter-apply{width:100%;} }
@media (max-width:900px) { .sidebar{width:min(86vw,320px);}.main-content{width:100%;margin-left:0;} }
@media (max-width:767.98px) { .dashboard-filter{padding:16px;border-radius:18px;}.filter-summary-row{flex-direction:column;}.filter-grid{grid-template-columns:1fr;}.filter-apply{min-width:0;}.summary-card-icon{flex-basis:40px;width:40px;height:40px;} }
@media print { .dashboard-filter{display:none!important;}.kpi-icon-bg,.summary-card-icon{display:none!important;} }

/* Persistent return path for signed-in administrators on the public dashboard */
.sidebar-link.sidebar-admin-return {
    border-color: rgba(15,118,110,.14);
    color: #0f766e;
    background: linear-gradient(105deg, #ecfdf5, #e0f2fe);
}
.sidebar-link.sidebar-admin-return .nav-icon {
    color: #fff;
    background: linear-gradient(145deg, #0f766e, #14b8a6);
    box-shadow: 0 7px 14px rgba(15,118,110,.2);
}
.sidebar-user .sidebar-control-panel-btn,
.dashboard-admin-return {
    border: 1px solid #0f766e;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(15,118,110,.16);
}
.sidebar-user .sidebar-control-panel-btn:hover,
.dashboard-admin-return:hover {
    border-color: #115e59;
    color: #fff;
    background: linear-gradient(90deg, #115e59, #0d9488);
    transform: translateY(-1px);
}
.sidebar-user .sidebar-logout-btn {
    border: 1px solid #d7e5e2;
    border-radius: 12px;
    color: #526965;
    background: #fff;
    font-weight: 750;
}
.sidebar-user .sidebar-logout-btn:hover { color: #9f1239; border-color: #fecdd3; background: #fff1f2; }
.dashboard-admin-return { display: inline-flex; align-items: center; gap: 7px; }

/* KPI motion, top-summary clarity, and year comparison refinement */
.kpi-grid {
    perspective: 1200px;
}
.kpi-card {
    min-height: 164px;
    padding: 22px 24px 24px;
    isolation: isolate;
    animation: kpi-card-enter 620ms cubic-bezier(.2,.75,.25,1) both;
}
.kpi-card:nth-child(2) { animation-delay: 80ms; }
.kpi-card:nth-child(3) { animation-delay: 160ms; }
.kpi-card:nth-child(4) { animation-delay: 240ms; }
.kpi-card::after {
    display: block;
    position: absolute;
    right: 14px;
    bottom: -38px;
    z-index: -1;
    content: attr(data-icon);
    color: currentColor;
    background: none;
    font-family: "Segoe UI Symbol", sans-serif;
    font-size: 8.5rem;
    font-weight: 900;
    line-height: 1;
    opacity: .075;
    transform: rotate(-8deg);
    pointer-events: none;
}
.kpi-heading,
.kpi-metric-row {
    position: relative;
    z-index: 1;
    display: flex;
}
.kpi-heading {
    align-items: center;
    gap: 12px;
}
.kpi-icon {
    display: inline-grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 14px;
    color: currentColor;
    background: rgba(255,255,255,.76);
    box-shadow: 0 8px 18px rgba(15,118,110,.09);
    font-family: "Segoe UI Symbol", sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
}
.kpi-label {
    color: #244d49;
    font-size: 1.22rem;
    font-weight: 900;
    line-height: 1.35;
}
.kpi-metric-row {
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 20px;
}
.kpi-value {
    margin: 0;
    color: currentColor;
    font-size: clamp(2.75rem, 3vw, 3.65rem);
    font-variant-numeric: tabular-nums;
    line-height: .95;
    letter-spacing: -.045em;
}
.kpi-unit {
    color: #426a66;
    font-size: 1.05rem;
    font-weight: 750;
    line-height: 1.35;
}
.kpi-card:hover .kpi-icon {
    transform: translateY(-2px) rotate(-3deg);
    transition: transform 180ms ease;
}

@keyframes kpi-card-enter {
    from { opacity: 0; transform: translateY(18px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.district-panel .panel-heading h2 {
    font-size: clamp(1.7rem, 1.8vw, 2rem);
}
.district-panel .panel-heading p {
    margin-top: 8px;
    color: #426a66;
    font-size: 1.22rem;
    font-weight: 700;
}
.district-summary-table {
    overflow-x: auto;
    scrollbar-color: #7dd3fc #ecfeff;
}
.district-summary-table table {
    font-size: 1.04rem;
    line-height: 1.4;
}
.district-summary-table th,
.district-summary-table td {
    min-width: 90px;
    padding: 12px 10px;
    font-variant-numeric: tabular-nums;
}
.district-summary-table thead th {
    color: #9d174d;
    background: linear-gradient(180deg, #fce7f3, #fbcfe8);
    font-size: 1.06rem;
    font-weight: 900;
}
.district-summary-table tbody th {
    min-width: 185px;
    font-size: 1.02rem;
    font-weight: 850;
}

.summary-column {
    gap: 14px;
}
.comparison-card {
    overflow: hidden;
    border-top-color: #38bdf8 !important;
}
.comparison-title {
    padding: 17px 14px;
    color: #0f5f62;
    background: linear-gradient(90deg, #cffafe, #d1fae5);
    font-size: 1.24rem;
    font-weight: 900;
    line-height: 1.45;
}
.comparison-grid {
    grid-template-columns: 1fr 1.15fr .9fr;
}
.comparison-grid > div {
    min-height: 60px;
    padding: 10px 8px;
    border-color: #cbdedc;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.35;
}
.comparison-label {
    color: #285c61;
    background: #ecfeff;
    font-size: 1rem !important;
}
.previous-year {
    color: #1e4f87;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}
#previousYearLabel {
    border-left: 6px solid #60a5fa;
}
.current-year {
    color: #116149;
    background: linear-gradient(135deg, #ecfdf5, #ccfbf1);
}
#currentYearLabel {
    border-left: 6px solid #34d399;
}
#previousYearTotal,
#currentYearTotal {
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
}
.comparison-reduction {
    color: #145a55;
    background: linear-gradient(145deg, #fef9c3, #d1fae5);
    font-size: 1.5rem !important;
    font-variant-numeric: tabular-nums;
}

.rate-card,
.target-box {
    min-height: 126px;
    padding: 20px 24px;
    align-items: center;
}
.rate-card span,
.target-box span {
    color: #285653;
    font-size: 1.18rem;
    font-weight: 900;
    line-height: 1.4;
}
.rate-card strong,
.target-box strong {
    margin: 10px 12px 0 0;
    color: #0f766e;
    font-size: 2.85rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -.035em;
}
.rate-card small,
.target-box small {
    color: #4c6d69;
    font-size: 1rem;
    font-weight: 700;
}

@media (max-width: 1199.98px) {
    .kpi-card { min-height: 150px; padding: 20px; }
    .kpi-label { font-size: 1.08rem; }
    .kpi-value { font-size: clamp(2.35rem, 3.5vw, 3rem); }
    .district-summary-table table { font-size: .96rem; }
}

@media (max-width: 767.98px) {
    .kpi-card { min-height: 142px; padding: 18px; }
    .kpi-icon { flex-basis: 38px; width: 38px; height: 38px; }
    .kpi-value { font-size: 2.45rem; }
    .kpi-unit { font-size: .94rem; }
    .district-panel .panel-heading h2 { font-size: 1.35rem; }
    .district-panel .panel-heading p { font-size: 1rem; }
    .district-summary-table table { font-size: .9rem; }
    .comparison-grid > div { min-height: 54px; font-size: .94rem; }
    .rate-card strong,
    .target-box strong { font-size: 2.35rem; }
}

@media print {
    .kpi-card { min-height: 65px; padding: 7px 10px; animation: none; }
    .kpi-card::after,
    .kpi-icon { display: none; }
    .kpi-value { font-size: 16pt; }
    .kpi-label { font-size: 7pt; }
    .kpi-metric-row { margin-top: 5px; }
    .district-summary-table table { font-size: 5.7pt; }
    .district-summary-table th,
    .district-summary-table td { min-width: 0; padding: 2px; }
    .rate-card,
    .target-box { min-height: 46px; padding: 5px 8px; }
}

/* Consistent breathing room around every Plotly chart */
.panel-chart .chart-wrap {
    margin-top: 10px;
    padding-inline: 6px;
}
.panel-chart .chart-wrap::before {
    display: block;
    height: 4px;
    content: "";
}

@media (max-width: 767.98px) {
    .panel-chart .chart-wrap { margin-top: 6px; padding-inline: 0; }
}

@media print {
    .panel-chart .chart-wrap { margin-top: 0; padding-inline: 0; }
    .panel-chart .chart-wrap::before { display: none; }
}

/* Responsive readability for the monthly detail table and insight cards */
@media screen {
    .detail-table {
        font-size: clamp(.86rem, .22vw + .74rem, 1.02rem);
        line-height: 1.4;
    }
    .detail-table th,
    .detail-table td {
        height: clamp(36px, 2.35vw, 46px);
        padding: clamp(7px, .45vw, 11px) clamp(8px, .55vw, 13px);
    }
    .detail-table thead th,
    .detail-table tbody th {
        font-size: clamp(.88rem, .24vw + .76rem, 1.05rem);
    }
    .detail-table tbody td {
        color: #20364f;
        font-size: clamp(.98rem, .32vw + .80rem, 1.2rem);
        font-weight: 800;
        font-variant-numeric: tabular-nums;
    }
    .detail-table tbody tr.detail-section-row > th {
        font-size: clamp(1rem, .32vw + .84rem, 1.2rem);
    }

    .insight-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(118px, .48fr);
        grid-template-rows: auto 1fr;
        column-gap: clamp(16px, 1.35vw, 26px);
        min-height: clamp(138px, 9vw, 174px);
        padding: clamp(16px, 1.15vw, 22px);
        text-align: left;
    }
    .insight-card span {
        grid-column: 1;
        grid-row: 1;
        font-size: clamp(1.06rem, .32vw + .88rem, 1.28rem);
        font-weight: 800;
        line-height: 1.45;
    }
    .insight-card strong {
        grid-column: 1;
        grid-row: 2;
        align-self: center;
        margin: clamp(10px, .75vw, 15px) 0 0;
        font-size: clamp(1.34rem, .5vw + 1.04rem, 1.7rem);
        line-height: 1.35;
    }
    .insight-card small {
        display: flex;
        grid-column: 2;
        grid-row: 1 / 3;
        min-width: 0;
        align-items: center;
        justify-content: flex-end;
        padding-left: clamp(15px, 1.1vw, 22px);
        border-left: 2px solid currentColor;
        font-size: clamp(2.1rem, 1.35vw + 1.42rem, 3.2rem);
        font-weight: 900;
        font-variant-numeric: tabular-nums;
        line-height: 1;
        letter-spacing: -.04em;
        white-space: nowrap;
        opacity: .9;
    }
    .insight-note {
        padding: clamp(14px, 1vw, 19px);
        font-size: clamp(.96rem, .26vw + .82rem, 1.14rem);
        line-height: 1.6;
    }
    .insight-note > strong {
        display: block;
        margin-bottom: 5px;
        font-size: clamp(1.05rem, .3vw + .88rem, 1.25rem);
    }
    .insight-note li + li { margin-top: 3px; }

    @media (max-width: 420px) {
        .insight-card {
            grid-template-columns: minmax(0, 1fr) 118px;
            column-gap: 12px;
        }
        .insight-card small {
            box-sizing: border-box;
            justify-content: center;
            padding-left: 10px;
            font-size: clamp(1.7rem, 7.5vw, 2rem);
        }
    }

    @media (max-width: 340px) {
        .insight-card {
            grid-template-columns: minmax(0, 1fr) 104px;
            column-gap: 10px;
        }
        .insight-card small {
            padding-left: 8px;
            font-size: 1.6rem;
        }
    }
}

/* Admin typography scale */
.bg-soft main { font-size: 1.08rem; }
.bg-soft main .eyebrow {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: .035em;
}
.bg-soft main h1.h3,
.bg-soft main .h3 {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.3;
}
.bg-soft main h2.h5,
.bg-soft main .h5 {
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.4;
}
.bg-soft main h3.h6,
.bg-soft main .h6 {
    font-size: 1.18rem;
    font-weight: 850;
}
.bg-soft main .text-secondary {
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.75;
}

.bg-soft .form-label {
    margin-bottom: .55rem;
    font-size: 1.05rem;
    font-weight: 850;
}
.bg-soft .form-control,
.bg-soft .form-select {
    min-height: 52px;
    padding: .72rem .9rem;
    font-size: 1.05rem;
}
.bg-soft .form-text {
    margin-top: .48rem;
    font-size: .98rem;
    font-weight: 600;
    line-height: 1.65;
}
.bg-soft .form-check-label {
    font-size: 1.02rem;
    font-weight: 650;
}
.bg-soft .form-check-input {
    width: 1.15em;
    height: 1.15em;
    margin-top: .3em;
}

.bg-soft .btn {
    min-height: 44px;
    padding: .62rem 1rem;
    font-size: 1.04rem;
    font-weight: 850;
}
.bg-soft .btn-lg {
    min-height: 54px;
    font-size: 1.12rem;
}
.bg-soft .badge {
    padding: .48rem .75rem;
    font-size: .94rem;
}

.bg-soft .validation-list { gap: 16px; }
.bg-soft .validation-list > div {
    padding: 16px 18px;
    font-size: 1.06rem;
    font-weight: 650;
    line-height: 1.7;
}
.bg-soft .step-number {
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
}

.bg-soft .table thead th {
    padding: 1rem;
    font-size: 1.05rem;
    line-height: 1.4;
}
.bg-soft .table tbody td {
    padding: .95rem 1rem;
    font-size: 1.02rem;
    line-height: 1.6;
}
.bg-soft .table tbody td.small,
.bg-soft .small { font-size: .96rem !important; }
.bg-soft .alert {
    padding: 1rem 1.15rem;
    font-size: 1.04rem;
    line-height: 1.65;
}

@media (max-width: 767.98px) {
    .bg-soft main { font-size: 1rem; }
    .bg-soft main h1.h3,
    .bg-soft main .h3 { font-size: 1.75rem; }
    .bg-soft main h2.h5,
    .bg-soft main .h5 { font-size: 1.28rem; }
    .bg-soft main .text-secondary { font-size: 1rem; }
    .bg-soft .form-label,
    .bg-soft .form-control,
    .bg-soft .form-select { font-size: 1rem; }
}

/* Expanded dashboard settings workspace */
.admin-settings-page {
    width: min(1320px, calc(100% - 48px));
    max-width: 1320px;
    padding-block: 48px 64px;
}
.admin-settings-page > .mb-4 { margin-bottom: 2rem !important; }
.admin-settings-page .eyebrow { font-size: 1.12rem; }
.admin-settings-page h1.h3 {
    margin-top: .65rem !important;
    font-size: 2.55rem;
    letter-spacing: -.025em;
}
.admin-settings-page > .mb-4 > p {
    margin-top: .55rem;
    font-size: 1.2rem;
}
.admin-settings-page > .card {
    overflow: hidden;
    border-top: 6px solid #14b8a6 !important;
    border-radius: 24px;
}
.admin-settings-page > .card > .card-body {
    padding: 2.35rem 2.5rem !important;
}
.admin-settings-page form[method="get"] {
    margin-bottom: 2.25rem !important;
    padding-bottom: 2.25rem;
    border-bottom: 1px solid #d9e9e5;
}
.admin-settings-page .form-label {
    margin-bottom: .65rem;
    font-size: 1.16rem;
}
.admin-settings-page .form-control,
.admin-settings-page .form-select {
    min-height: 58px;
    padding: .85rem 1rem;
    font-size: 1.16rem;
    border-radius: 13px;
}
.admin-settings-page .btn {
    min-height: 52px;
    padding: .75rem 1.25rem;
    font-size: 1.12rem;
    border-radius: 12px;
}
.admin-settings-page form[method="post"] { row-gap: 1.35rem; }
.admin-settings-page form[method="post"] .btn-primary {
    min-width: 190px;
    margin-top: .4rem;
}

@media (max-width: 767.98px) {
    .admin-settings-page {
        width: calc(100% - 24px);
        padding-block: 24px 40px;
    }
    .admin-settings-page h1.h3 { font-size: 1.9rem; }
    .admin-settings-page > .mb-4 > p { font-size: 1.02rem; }
    .admin-settings-page > .card > .card-body { padding: 1.4rem !important; }
    .admin-settings-page .form-label,
    .admin-settings-page .form-control,
    .admin-settings-page .form-select { font-size: 1.02rem; }
}

/* High-legibility chart pass */

/* Dashboard-aligned brand and semantic navigation icon system */
body .sidebar-brand > a {
    min-width: 0;
    gap: 12px;
}
body .brand-mark {
    position: relative;
    isolation: isolate;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(145deg,#0b7f75 2%,#14b8a6 56%,#67e8f9 100%);
    box-shadow: 0 12px 26px rgba(13,148,136,.24),inset 0 1px 0 rgba(255,255,255,.42);
    font-size: 1.62rem;
}
body .brand-mark i {
    filter: drop-shadow(0 2px 3px rgba(7,82,75,.22));
    transform: translateY(-1px);
}
body .brand-copy {
    gap: 2px;
    line-height: 1.14;
}
body .brand-copy strong {
    color: #0c756d;
    font-size: 1.16rem;
    font-weight: 900;
    letter-spacing: -.015em;
}
body .brand-copy small {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
    color: #6b807d;
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .01em;
}
body .brand-copy small b {
    color: #0f8f84;
    font-weight: 900;
}
body .nav-icon {
    border: 1px solid rgba(20,184,166,.08);
    color: #0f968a;
    background: #def8f2;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.74);
}
body .sidebar-group-link .nav-icon {
    color: #0b8c81;
    background: #d7f6ef;
}
body .sidebar-submenu a i {
    width: 21px;
    color: #0fa99a;
    font-size: 1.02rem;
}
body .sidebar-link.active .nav-icon {
    border-color: rgba(255,255,255,.34);
    color: #fff;
    background: linear-gradient(145deg,#08786f,#14b8a6 68%,#5eead4);
    box-shadow: 0 8px 18px rgba(13,148,136,.24),inset 0 1px 0 rgba(255,255,255,.32);
}
body .sidebar-link:hover .nav-icon,
body .sidebar-group-link:hover .nav-icon {
    transform: translateY(-1px);
}
body .nav-icon,
body .sidebar-submenu a i {
    transition: color 180ms ease,background-color 180ms ease,transform 180ms ease,box-shadow 180ms ease;
}

@media (max-width: 360px) {
    body .brand-mark {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
        font-size: 1.42rem;
    }
    body .brand-copy strong { font-size: 1.04rem; }
    body .brand-copy small { font-size: .66rem; }
}

/* High-visibility comparison and rate summary cards */
body .summary-column {
    gap: 16px;
}
body .summary-column .comparison-card {
    border-radius: 22px;
    box-shadow: 0 14px 32px rgba(15,118,110,.09) !important;
}
body .summary-column .comparison-title {
    min-height: 64px;
    padding: 16px 18px;
    gap: 10px;
    color: #0c5f5d;
    font-size: 1.3rem;
    line-height: 1.4;
}
body .summary-column .comparison-title i {
    flex: 0 0 auto;
    color: #0f766e;
    font-size: 1.24em;
}
body .summary-column .comparison-grid > div {
    min-height: 64px;
    padding: 12px 10px;
    font-size: 1.15rem;
    line-height: 1.35;
}
body .summary-column .comparison-label {
    font-size: 1.05rem !important;
    font-weight: 850;
}
body .summary-column .comparison-value {
    font-size: 1.22rem;
    font-weight: 900;
}
body .summary-column #previousYearTotal,
body .summary-column #currentYearTotal {
    font-size: 1.46rem;
}
body .summary-column .comparison-reduction {
    font-size: 1.82rem !important;
    font-weight: 900;
    letter-spacing: -.025em;
}
body .summary-column .rate-card,
body .summary-column .target-box {
    display: flex;
    min-height: 136px;
    gap: 18px;
    padding: 22px 24px;
    align-items: center;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(15,118,110,.055);
}
body .summary-column .summary-card-icon {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 1.42rem !important;
}
body .summary-column .rate-card > div,
body .summary-column .target-box > div {
    display: flex;
    min-width: 0;
    width: 100%;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 14px;
    row-gap: 7px;
}
body .summary-column .rate-card > div > span,
body .summary-column .target-box > div > span {
    flex: 0 0 100%;
    color: #245754;
    font-size: 1.24rem;
    font-weight: 900;
    line-height: 1.35;
}
body .summary-column .rate-card strong,
body .summary-column .target-box strong {
    margin: 0;
    color: #0f766e;
    font-size: clamp(3rem,3.1vw,3.45rem);
    font-weight: 900;
    line-height: .98;
    letter-spacing: -.045em;
}
body .summary-column .rate-card small,
body .summary-column .target-box small {
    color: #4f716e;
    font-size: 1.03rem;
    font-weight: 750;
    line-height: 1.35;
}
body .summary-column .target-box {
    min-height: 146px;
    border-color: #86e7bd;
    background: linear-gradient(115deg,#e9fbf3,#f8fffc 70%);
}
body .summary-column .target-box > div > span {
    color: #176b50;
}
body .summary-column .target-box strong {
    color: #12805f;
    font-size: clamp(3.15rem,3.25vw,3.6rem);
}

@media (max-width: 767.98px) {
    body .summary-column .comparison-title {
        min-height: 58px;
        padding: 14px 12px;
        font-size: 1.12rem;
    }
    body .summary-column .comparison-grid > div {
        min-height: 58px;
        padding: 10px 6px;
        font-size: 1rem;
    }
    body .summary-column .comparison-label { font-size: .9rem !important; }
    body .summary-column .comparison-reduction { font-size: 1.5rem !important; }
    body .summary-column .rate-card,
    body .summary-column .target-box {
        min-height: 128px;
        gap: 14px;
        padding: 19px 16px;
    }
    body .summary-column .rate-card > div > span,
    body .summary-column .target-box > div > span { font-size: 1.1rem; }
    body .summary-column .rate-card strong,
    body .summary-column .target-box strong { font-size: 2.75rem; }
    body .summary-column .rate-card small,
    body .summary-column .target-box small { font-size: .94rem; }
}

@media print {
    body .summary-column .rate-card,
    body .summary-column .target-box { min-height: 46px; padding: 5px 8px; box-shadow: none; }
    body .summary-column .rate-card strong,
    body .summary-column .target-box strong { font-size: 14pt; }
    body .summary-column .rate-card > div > span,
    body .summary-column .target-box > div > span { font-size: 7pt; }
    body .summary-column .rate-card small,
    body .summary-column .target-box small { font-size: 6pt; }
}

.panel-heading,
.panel-heading.compact {
    min-height: 70px;
    margin-bottom: 18px;
}
.panel-heading h2,
.detail-title-strip h2 {
    font-size: 1.7rem;
    line-height: 1.3;
}
.panel-heading p {
    max-width: 70ch;
    font-size: 1.16rem;
    line-height: 1.65;
}
.panel-chart { padding: 30px; }
.chart-xl { height: 540px; }
.chart-lg { height: 440px; }
.chart-md { height: 420px; }
.charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 540px; }
.charts-grid-demographic > .panel:nth-child(3) .panel-heading h2 { font-size: 1.82rem; }

@media (max-width: 1199.98px) {
    .panel-heading h2,
    .detail-title-strip h2 { font-size: 1.5rem; }
    .panel-heading p { font-size: 1.05rem; }
}

@media (max-width: 767.98px) {
    .panel-chart { padding: 20px 16px; }
    .panel-heading,
    .panel-heading.compact { min-height: 58px; margin-bottom: 12px; }
    .panel-heading h2,
    .detail-title-strip h2 { font-size: 1.3rem; }
    .chart-xl { height: 440px; }
    .chart-lg { height: 380px; }
    .chart-md { height: 360px; }
    .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 440px; }
}

@media print {
    .panel-chart { padding: 8px; }
    .panel-heading,
    .panel-heading.compact { min-height: 24px; margin-bottom: 2px; }
    .panel-heading h2,
    .detail-title-strip h2 { font-size: 9pt; }
    .chart-xl { height: 235px !important; }
    .chart-lg { height: 190px !important; }
    .chart-md,
    .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 165px !important; }
}

/* Final responsive authority for the public dashboard. */
@media screen {
    .dashboard-body {
        --dashboard-sidebar-width: clamp(250px, 18vw, 300px);
        max-width: 100%;
        overflow-x: clip;
    }
    .dashboard-body .app-shell {
        display: grid;
        grid-template-columns: var(--dashboard-sidebar-width) minmax(0, 1fr);
        align-items: start;
        width: 100%;
        min-width: 0;
    }
    .dashboard-body .sidebar {
        position: sticky;
        inset: auto;
        top: 0;
        display: flex;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .dashboard-body .sidebar-nav { flex: 1 1 auto; min-height: 0; }
    .dashboard-body .sidebar-user { position: static; inset: auto; margin-top: auto; }
    .dashboard-body .main-content,
    .dashboard-body.sidebar-collapsed .main-content {
        grid-column: 2;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin-left: 0;
    }
    .dashboard-body.sidebar-collapsed { --dashboard-sidebar-width: 94px; }
    .dashboard-body .report-toolbar,
    .dashboard-body .report-page {
        width: min(1680px, calc(100% - clamp(24px, 3vw, 48px)));
        margin-inline: auto;
    }
    .dashboard-body .dashboard-shell,
    .dashboard-body .report-page,
    .dashboard-body .panel,
    .dashboard-body .chart-wrap,
    .dashboard-body .plot-chart,
    .dashboard-body .plot-container,
    .dashboard-body .svg-container { min-width: 0; max-width: 100%; }
    .dashboard-body .plot-chart,
    .dashboard-body .plot-container,
    .dashboard-body .svg-container { width: 100% !important; }
    .dashboard-body .filter-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
    .dashboard-body .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dashboard-body .kpi-card { min-width: 0; min-height: clamp(126px, 9vw, 164px); }
    .dashboard-body .kpi-label { font-size: clamp(.9rem, .72rem + .22vw, 1.08rem); line-height: 1.35; }
    .dashboard-body .kpi-value {
        max-width: 100%;
        font-size: clamp(2rem, 1.2rem + 1.55vw, 3.25rem);
        overflow-wrap: anywhere;
    }
    .dashboard-body .district-summary-table,
    .dashboard-body .detail-table-wrap {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }
}

@media screen and (max-width: 1399.98px) {
    .dashboard-body .report-toolbar,
    .dashboard-body .report-page { width: calc(100% - 28px); }
    .dashboard-body .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-body .filter-apply,
    .dashboard-body .filter-grid > button:last-child { grid-column: 1 / -1; width: 100%; }
    .dashboard-body .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-body .top-layout,
    .dashboard-body .charts-grid-demographic,
    .dashboard-body .charts-grid-factors,
    .dashboard-body .charts-grid-history,
    .dashboard-body .detail-layout { grid-template-columns: minmax(0, 1fr); }
}

@media screen and (max-width: 900px) {
    .dashboard-body .app-shell { display: block; }
    .dashboard-body .sidebar,
    .dashboard-body.sidebar-collapsed .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1045;
        width: min(88vw, 320px);
        height: 100vh;
        height: 100dvh;
        padding: 22px;
        transform: translateX(-105%);
    }
    .dashboard-body.sidebar-open .sidebar,
    .dashboard-body.sidebar-collapsed.sidebar-open .sidebar { transform: translateX(0); }
    .dashboard-body .sidebar-toggle { display: grid; }
    .dashboard-body .main-content,
    .dashboard-body.sidebar-collapsed .main-content {
        width: 100%;
        margin-left: 0;
        padding-top: 64px;
    }
    .dashboard-body.sidebar-collapsed .brand-copy,
    .dashboard-body.sidebar-collapsed .sidebar-user { display: grid; }
    .dashboard-body.sidebar-collapsed .sidebar-nav-label { display: block; }
    .dashboard-body.sidebar-collapsed .sidebar-submenu { display: grid; }
    .dashboard-body.sidebar-collapsed .sidebar-link,
    .dashboard-body.sidebar-collapsed .sidebar-group-link {
        justify-content: flex-start;
        width: auto;
        height: auto;
        margin-inline: 0;
        padding: 11px 13px;
    }
    .dashboard-body.sidebar-collapsed .sidebar-link span:last-child,
    .dashboard-body.sidebar-collapsed .sidebar-group-link > span:last-child { display: inline; }
    .dashboard-body .report-toolbar { align-items: stretch; flex-direction: column; }
    .dashboard-body .toolbar-actions { width: 100%; flex-wrap: wrap; }
    .dashboard-body .toolbar-actions > * { flex: 1 1 180px; }
    .dashboard-body .plot-container,
    .dashboard-body .svg-container { overflow: hidden !important; }
}

@media screen and (max-width: 599.98px) {
    .dashboard-body .report-toolbar,
    .dashboard-body .report-page { width: calc(100% - 16px); }
    .dashboard-body .report-page { padding: 12px; }
    .dashboard-body .filter-grid,
    .dashboard-body .kpi-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-body .filter-apply,
    .dashboard-body .filter-grid > button:last-child { grid-column: auto; }
    .dashboard-body .kpi-card { min-height: 126px; }
    .dashboard-body .kpi-value { font-size: clamp(2.15rem, 10vw, 3rem); }
    .dashboard-body .gallery-section-heading,
    .dashboard-body .filter-summary-row,
    .dashboard-body .panel-heading { align-items: flex-start; flex-direction: column; }
    .dashboard-body .gallery-controls { align-self: flex-end; }
    .dashboard-body .chart-xl { height: 400px; }
    .dashboard-body .chart-lg { height: 350px; }
    .dashboard-body .chart-md { height: 330px; }
    .dashboard-body .charts-grid-demographic > .panel:nth-child(3) .chart-md { height: 410px; }
}

/* Public dashboard masthead and compact footer. */
.dashboard-site-header {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(18px, 2vw, 32px);
    width: min(1680px, calc(100% - clamp(24px, 3vw, 48px)));
    margin: 18px auto 14px;
    padding: clamp(24px, 2.5vw, 40px);
    overflow: hidden;
    align-items: center;
    border: 1px solid rgba(45, 212, 191, .35);
    border-radius: clamp(22px, 2vw, 30px);
    color: #eafffb;
    background:
        radial-gradient(circle at 88% 18%, rgba(56, 189, 248, .38), transparent 30%),
        linear-gradient(125deg, #075f58, #0f766e 56%, #0b7285);
    box-shadow: 0 18px 42px rgba(15, 118, 110, .18);
    isolation: isolate;
}
.dashboard-site-header::after {
    position: absolute;
    z-index: -1;
    right: -8%;
    bottom: -70%;
    width: 38%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 50%;
    content: "";
}
.dashboard-header-mark {
    display: grid;
    width: clamp(72px, 6vw, 96px);
    aspect-ratio: 1;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .46);
    border-radius: 26px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .14);
}
.dashboard-header-mark img {
    width: 72%;
    height: 72%;
    object-fit: contain;
}
.dashboard-header-content { min-width: 0; }
.dashboard-header-kicker {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 5px;
    color: #99f6e4;
    font-size: clamp(.82rem, .3vw + .74rem, 1rem);
    font-weight: 800;
}
.dashboard-header-content h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.55rem, 1.2vw + 1rem, 2.45rem);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -.025em;
}
.dashboard-header-content p {
    max-width: 78ch;
    margin: 7px 0 13px;
    color: #d9fffa;
    font-size: clamp(.93rem, .25vw + .84rem, 1.08rem);
    line-height: 1.6;
}
.dashboard-header-meta {
    display: flex;
    gap: 8px 22px;
    flex-wrap: wrap;
    color: #ccfbf1;
    font-size: clamp(.84rem, .22vw + .78rem, .98rem);
    font-weight: 700;
}
.dashboard-header-meta span { display: inline-flex; gap: 8px; align-items: center; }

.dashboard-site-footer-compact {
    display: flex;
    gap: 18px 28px;
    width: min(1680px, calc(100% - clamp(24px, 3vw, 48px)));
    margin: 0 auto 24px;
    padding: 16px 20px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    border: 1px solid #d7e7e3;
    border-radius: 18px;
    color: #486965;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 10px 28px rgba(39, 86, 80, .08);
}
.dashboard-footer-brand,
.dashboard-footer-legal {
    display: flex;
    gap: 12px;
    align-items: center;
}
.dashboard-footer-brand img {
    width: 42px;
    height: 42px;
    padding: 5px;
    object-fit: contain;
    border: 1px solid #cfe4df;
    border-radius: 12px;
    background: #fff;
}
.dashboard-footer-brand div { display: grid; gap: 1px; }
.dashboard-footer-brand strong { color: #1f5751; font-size: .98rem; }
.dashboard-footer-brand span,
.dashboard-footer-legal { font-size: .88rem; font-weight: 650; }
.dashboard-footer-legal { gap: 10px 20px; flex-wrap: wrap; }
.dashboard-footer-legal span,
.dashboard-footer-legal a { display: inline-flex; gap: 7px; align-items: center; }
.dashboard-footer-legal a {
    padding: 8px 11px;
    border-radius: 10px;
    color: #0f766e;
    background: #ecfdf5;
    font-weight: 800;
    text-decoration: none;
    transition: background-color 160ms ease, transform 160ms ease;
}
.dashboard-footer-legal a:hover { color: #075f58; background: #ccfbf1; transform: translateY(-1px); }

/* Ensure the large monthly count keeps enough usable width for Thai units. */
@media screen {
    .dashboard-body .insight-card {
        grid-template-columns: minmax(0, 1fr) minmax(126px, .48fr);
    }
    .dashboard-body .insight-card small {
        box-sizing: border-box;
        justify-content: center;
        padding-left: clamp(16px, 1.25vw, 22px);
        overflow: hidden;
    }
}

@media screen and (max-width: 900px) {
    .dashboard-site-header,
    .dashboard-site-footer-compact { width: calc(100% - 28px); }
    .dashboard-site-header { margin-top: 12px; }
}

@media screen and (max-width: 599.98px) {
    .dashboard-site-header {
        grid-template-columns: minmax(0, 1fr);
        width: calc(100% - 16px);
        padding: 24px 20px;
        text-align: center;
    }
    .dashboard-header-mark { width: 70px; margin-inline: auto; border-radius: 20px; }
    .dashboard-header-kicker { justify-content: center; }
    .dashboard-header-meta { justify-content: center; }
    .dashboard-site-footer-compact {
        width: calc(100% - 16px);
        align-items: stretch;
        flex-direction: column;
    }
    .dashboard-footer-brand { align-items: flex-start; }
    .dashboard-footer-legal { justify-content: space-between; }
    .dashboard-body .insight-card {
        grid-template-columns: minmax(0, 1fr) 124px;
        column-gap: 12px;
    }
    .dashboard-body .insight-card small {
        padding-left: 14px;
        font-size: clamp(1.7rem, 7.5vw, 2rem);
    }
}

@media screen and (max-width: 340px) {
    .dashboard-body .insight-card { grid-template-columns: minmax(0, 1fr) 104px; }
    .dashboard-body .insight-card small { padding-left: 10px; font-size: 1.55rem; }
    .dashboard-footer-legal { align-items: stretch; flex-direction: column; }
}
/* Insight count cleanup and animated compact footer. */
@media screen {
    .dashboard-body .insight-card {
        grid-template-columns: minmax(0, 1fr) minmax(112px, .42fr);
        column-gap: clamp(12px, 1vw, 20px);
    }
    .dashboard-body .insight-card small {
        justify-content: center;
        padding-left: 0;
        overflow: visible;
        font-size: clamp(1.65rem, .8vw + 1.24rem, 2.4rem);
        letter-spacing: -.025em;
    }
    .dashboard-body .insight-card small::before { display: none; }
}

.dashboard-site-footer-compact {
    position: relative;
    overflow: hidden;
    border-color: rgba(255, 255, 255, .34);
    color: #f0fdfa;
    background: linear-gradient(120deg, #0f766e, #0284c7, #7c3aed, #db2777, #0f766e);
    background-size: 300% 300%;
    box-shadow: 0 16px 36px rgba(30, 64, 175, .18);
    isolation: isolate;
    animation: dashboardCompactFooterGradient 14s ease-in-out infinite;
}
.dashboard-site-footer-compact::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    background:
        radial-gradient(circle at 12% 25%, rgba(255, 255, 255, .22), transparent 24%),
        radial-gradient(circle at 88% 70%, rgba(45, 212, 191, .2), transparent 28%);
}
.dashboard-site-footer-compact::after {
    position: absolute;
    z-index: -1;
    top: -80%;
    bottom: -80%;
    left: -28%;
    width: 20%;
    content: "";
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent);
    transform: rotate(16deg);
    animation: dashboardCompactFooterShine 8s ease-in-out infinite;
}
.dashboard-site-footer-compact .dashboard-footer-brand img {
    border-color: rgba(255, 255, 255, .68);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .2);
    animation: dashboardCompactFooterLogo 4.6s ease-in-out infinite;
}
.dashboard-site-footer-compact .dashboard-footer-brand strong { color: #fff; }
.dashboard-site-footer-compact .dashboard-footer-brand span { color: #dffcf7; }
.dashboard-site-footer-compact .dashboard-footer-legal { color: #fff; }
.dashboard-footer-copyright {
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
    backdrop-filter: blur(8px);
}

@keyframes dashboardCompactFooterGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes dashboardCompactFooterShine {
    0%, 30% { left: -28%; opacity: 0; }
    42% { opacity: 1; }
    62%, 100% { left: 118%; opacity: 0; }
}
@keyframes dashboardCompactFooterLogo {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-3px) rotate(2deg); }
}

@media screen and (max-width: 599.98px) {
    .dashboard-body .insight-card {
        grid-template-columns: minmax(0, 1fr) 110px;
        column-gap: 10px;
    }
    .dashboard-body .insight-card small {
        font-size: clamp(1.5rem, 6vw, 1.8rem);
    }
    .dashboard-site-footer-compact .dashboard-footer-legal { justify-content: flex-start; }
}

@media screen and (max-width: 340px) {
    .dashboard-body .insight-card { grid-template-columns: minmax(0, 1fr) 94px; }
    .dashboard-body .insight-card small { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-site-footer-compact,
    .dashboard-site-footer-compact::after,
    .dashboard-site-footer-compact .dashboard-footer-brand img { animation: none !important; }
}
/* Independent header/footer settings and editable footer copy. */
.header-settings-card { border-top: 4px solid #38bdf8 !important; }
.footer-settings-card { border-top: 4px solid #a855f7 !important; }
.dashboard-footer-brand div { min-width: 0; max-width: 82ch; }
.dashboard-site-footer-compact .dashboard-footer-brand span {
    overflow-wrap: anywhere;
    line-height: 1.45;
}
.dashboard-site-footer-compact .dashboard-footer-brand small {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    margin-top: 3px;
    color: #ccfbf1;
    font-size: .82rem;
    font-weight: 700;
}

@media screen and (max-width: 599.98px) {
    .dashboard-footer-brand div { max-width: 100%; }
}
/* Keep every dashboard filter control on one desktop row. */
@media screen and (min-width: 1200px) {
    .dashboard-body .filter-grid {
        grid-template-columns:
            minmax(0, .9fr)
            minmax(0, 1fr)
            minmax(0, .9fr)
            minmax(0, 1.15fr)
            minmax(150px, .65fr);
        align-items: end;
    }
    .dashboard-body .filter-apply,
    .dashboard-body .filter-grid > button:last-child {
        grid-column: auto;
        width: 100%;
        min-width: 0;
    }
}

/* Admin sidebar: keep the signed-in card from covering menu links. */
@media screen {
    body.bg-soft .sidebar {
        display: flex;
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        overflow: hidden;
        box-sizing: border-box;
    }

    body.bg-soft .sidebar-brand {
        flex: 0 0 auto;
    }

    body.bg-soft .sidebar-nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 4px;
        padding-bottom: 10px;
        overscroll-behavior: contain;
    }

    body.bg-soft .sidebar-user {
        position: static;
        inset: auto;
        flex: 0 0 auto;
        margin-top: 12px;
        padding: 12px;
        border-radius: 16px;
    }

    body.bg-soft .sidebar-user small {
        font-size: .78rem;
        line-height: 1.25;
    }

    body.bg-soft .sidebar-user strong {
        line-height: 1.25;
    }

    body.bg-soft .sidebar-user .sidebar-role {
        width: fit-content;
        margin-top: 6px;
        padding: 5px 10px;
    }

    body.bg-soft .sidebar-user .sidebar-logout-btn,
    body.bg-soft .sidebar-user .sidebar-control-panel-btn {
        min-height: 40px;
        margin-top: 8px !important;
    }

    body.sidebar-collapsed.bg-soft .sidebar {
        overflow: visible;
    }

    body.sidebar-collapsed.bg-soft .sidebar-user {
        display: none;
    }
}

/* Public dashboard sidebar: user card is a footer, never an overlay. */
@media screen {
    body.dashboard-body .sidebar {
        display: flex !important;
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        overflow: hidden !important;
        box-sizing: border-box;
    }

    body.dashboard-body .sidebar-brand {
        flex: 0 0 auto;
    }

    body.dashboard-body .sidebar-nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 4px;
        padding-bottom: 12px;
        overscroll-behavior: contain;
    }

    body.dashboard-body .sidebar-user {
        position: relative !important;
        inset: auto !important;
        z-index: 1;
        flex: 0 0 auto;
        order: 3;
        margin: 12px 0 0 !important;
        padding: 12px;
        border-radius: 16px;
    }

    body.dashboard-body .sidebar-user small {
        font-size: .78rem;
        line-height: 1.25;
    }

    body.dashboard-body .sidebar-user strong {
        line-height: 1.25;
    }

    body.dashboard-body .sidebar-user .sidebar-role {
        width: fit-content;
        margin-top: 6px;
        padding: 5px 10px;
    }

    body.dashboard-body .sidebar-user .sidebar-control-panel-btn,
    body.dashboard-body .sidebar-user .sidebar-logout-btn {
        min-height: 40px;
        margin-top: 8px !important;
    }

    body.dashboard-body.sidebar-collapsed .sidebar-user {
        display: none !important;
    }
}

/* Import warning explanation. */
.import-warning-help {
    padding: 14px 16px;
    border: 1px solid rgba(180, 83, 9, .2);
    border-radius: 14px;
    color: #70480d;
    background: rgba(255, 251, 235, .72);
}
.import-warning-help strong {
    display: block;
    margin-bottom: 4px;
    color: #7c4a03;
}
.import-warning-help p,
.import-warning-help li {
    line-height: 1.65;
}
.import-warning-help ul {
    padding-left: 1.25rem;
}

/* Manual data entry workspace. */
.manual-entry-page {
    max-width: 1720px;
}
.manual-toolbar,
.manual-card {
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid rgba(204, 251, 241, .95);
    border-top: 4px solid #14b8a6;
    border-radius: 18px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 16px 38px rgba(15, 118, 110, .08);
}
.manual-category-map {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.manual-category-map a {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px 12px;
    align-items: center;
    min-height: 96px;
    padding: 15px;
    border: 1px solid #cceee7;
    border-radius: 18px;
    color: #123d3a;
    background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(240,253,250,.92));
    text-decoration: none;
    box-shadow: 0 12px 26px rgba(15, 118, 110, .07);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.manual-category-map a:hover {
    border-color: #14b8a6;
    box-shadow: 0 16px 32px rgba(15, 118, 110, .12);
    transform: translateY(-2px);
}
.manual-category-map i {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    color: #0f766e;
    background: #ccfbf1;
    font-size: 1.2rem;
}
.manual-category-map span {
    color: #0f3f3b;
    font-size: 1.02rem;
    font-weight: 900;
}
.manual-category-map small {
    grid-column: 2;
    color: #64748b;
    font-weight: 700;
    line-height: 1.4;
}
.manual-section-tabs {
    position: sticky;
    z-index: 4;
    top: 0;
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px;
    overflow-x: auto;
    border: 1px solid rgba(204, 251, 241, .9);
    border-radius: 16px;
    background: rgba(240, 253, 250, .94);
    backdrop-filter: blur(12px);
}
.manual-section-tabs a,
.manual-year-pills a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #cceee7;
    border-radius: 999px;
    color: #0f766e;
    background: #fff;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}
.manual-section-tabs a {
    gap: 7px;
}
.manual-year-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.manual-section-tabs a:hover,
.manual-year-pills a:hover,
.manual-year-pills a.active {
    color: #fff;
    border-color: #0f766e;
    background: linear-gradient(90deg, #0f766e, #14b8a6);
}
.manual-card-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    margin-bottom: 18px;
}
.manual-card-heading .manual-step {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: #0f766e;
    background: #ccfbf1;
    font-weight: 900;
}
.manual-card-heading h2 {
    margin: 0;
    color: #123d3a;
    font-size: 1.45rem;
    font-weight: 900;
}
.manual-card-heading p {
    margin: 4px 0 0;
    color: #64748b;
    font-weight: 700;
}
.manual-card-heading > small {
    align-self: center;
    padding: 7px 11px;
    border: 1px solid #dbeeea;
    border-radius: 999px;
    color: #0f766e;
    background: #f0fdfa;
    font-weight: 900;
    white-space: nowrap;
}
.manual-detail-grid {
    display: grid;
    grid-template-columns: minmax(260px, .55fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.manual-subpanel {
    padding: 16px;
    border: 1px solid #dbeeea;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(248,253,252,.9));
}
.manual-subpanel-title {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.manual-subpanel-title i {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    color: #0f766e;
    background: #ccfbf1;
    font-size: 1.1rem;
}
.manual-subpanel-title strong {
    display: block;
    color: #123d3a;
    font-size: 1.02rem;
    font-weight: 900;
}
.manual-subpanel-title small {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-weight: 700;
}
.manual-header-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}
.manual-header-preview span {
    padding: 6px 10px;
    border: 1px solid #cceee7;
    border-radius: 999px;
    color: #0f766e;
    background: #f0fdfa;
    font-size: .86rem;
    font-weight: 800;
}
.manual-kpi-editor {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
    border: 1px solid #cdece7;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(240, 253, 250, .92), rgba(255, 247, 250, .72)),
        #fff;
}
.manual-kpi-note {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px dashed #8ddfd3;
    border-radius: 16px;
    color: #174743;
    background: rgba(255, 255, 255, .76);
}
.manual-kpi-note i {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    box-shadow: 0 12px 24px rgba(20, 184, 166, .2);
}
.manual-kpi-note strong,
.manual-kpi-note span {
    display: block;
}
.manual-kpi-note strong {
    font-size: 1.02rem;
}
.manual-kpi-note span {
    color: #5b7774;
    font-weight: 700;
}
.manual-kpi-field {
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(204, 226, 222, .9);
    border-radius: 18px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 14px 32px rgba(15, 118, 110, .08);
}
.manual-kpi-chip {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    margin-bottom: 10px;
    border-radius: 15px;
    color: #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .12);
}
.manual-kpi-chip.kpi-pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.manual-kpi-chip.kpi-blue { background: linear-gradient(135deg, #60a5fa, #0284c7); }
.manual-kpi-chip.kpi-green { background: linear-gradient(135deg, #34d399, #059669); }
.manual-kpi-chip.kpi-purple { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.manual-kpi-field .form-label {
    display: block;
    margin-bottom: 8px;
    color: #183f3b;
    font-size: .98rem;
}
.manual-kpi-field .form-control {
    font-size: 1.05rem;
    font-weight: 800;
}
.manual-data-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 8px;
    padding: 14px 16px;
    border: 1px solid #dbeeea;
    border-radius: 14px;
    background: #f8fffd;
}
.manual-data-title strong {
    display: block;
    color: #123d3a;
    font-weight: 900;
}
.manual-data-title span {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-weight: 700;
}
.manual-save-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}
.manual-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid #dbeeea;
    border-radius: 14px;
    background: #fff;
}
.manual-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}
.manual-month-table {
    min-width: 1500px;
}
.manual-detail-table {
    min-width: max(980px, 100%);
}
.manual-table th,
.manual-table td {
    padding: 10px;
    border-bottom: 1px solid #e6f2ef;
    vertical-align: middle;
}
.manual-table th {
    color: #42625e;
    background: #f4fbf9;
    font-size: .88rem;
    font-weight: 900;
    white-space: nowrap;
}
.manual-table td:first-child,
.manual-table th:first-child {
    min-width: 180px;
}
.manual-month-table td:not(:first-child) .form-control {
    min-width: 76px;
}
.manual-inline-help {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid #cceee7;
    border-radius: 14px;
    color: #42625e;
    background: #f8fffd;
    font-weight: 700;
}
.manual-inline-help i {
    color: #0f766e;
    font-size: 1.05rem;
    margin-top: 2px;
}
.manual-detail-table th:not(:first-child),
.manual-detail-table td:not(:first-child) {
    min-width: 112px;
}
.manual-detail-table .form-control {
    min-width: 96px;
}
.manual-detail-table .manual-sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 210px;
    background: #fff;
    box-shadow: 8px 0 14px rgba(15, 118, 110, .06);
}
.manual-detail-table thead .manual-sticky-col {
    z-index: 3;
    background: #f4fbf9;
}
.manual-table tbody tr:last-child td {
    border-bottom: 0;
}

@media screen and (max-width: 900px) {
    .manual-category-map,
    .manual-detail-grid,
    .manual-kpi-editor {
        grid-template-columns: minmax(0, 1fr);
    }
    .manual-card-heading {
        grid-template-columns: auto minmax(0, 1fr);
    }
    .manual-card-heading > small {
        grid-column: 1 / -1;
        justify-self: start;
    }
    .manual-data-title {
        align-items: stretch;
        flex-direction: column;
    }
    .manual-save-row {
        justify-content: stretch;
    }
    .manual-save-row .btn {
        width: 100%;
    }
    .manual-entry-page {
        padding-inline: 14px !important;
    }
    .manual-toolbar,
    .manual-card {
        padding: 16px;
        border-radius: 14px;
    }
    .manual-section-tabs {
        top: 64px;
    }
}

@media screen and (min-width: 901px) and (max-width: 1300px) {
    .manual-category-map,
    .manual-kpi-editor {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
