:root {
    --green-900: #005a2f;
    --green-800: #0b6c3b;
    --green-700: #0f7d44;
    --green-100: #eaf5ee;
    --gray-50: #f4f6f7;
    --gray-100: #eceff1;
    --gray-200: #dfe4e7;
    --gray-500: #65727c;
    --ink: #1f2b34;
    --white: #ffffff;
    --orange: #f5a524;
    --blue: #2573c2;
    --shadow: 0 10px 28px rgba(17, 39, 28, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #f9fbfb 0%, var(--gray-50) 100%);
    overflow-x: hidden;
}

.dashboard-body {
    min-height: 100vh;
}

.dashboard-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
}

.topbar {
    background: linear-gradient(90deg, var(--green-900), #0b703d);
    color: var(--white);
    min-height: 76px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    gap: 20px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.topbar-left:link,
.topbar-left:visited,
.topbar-left:hover,
.topbar-left:active,
.topbar-left:focus {
    color: inherit;
    text-decoration: none;
}

.crest {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background:
        radial-gradient(circle at 65% 20%, #f8e97f 4px, transparent 5px),
        radial-gradient(circle at 40% 75%, #ffffff 6px, transparent 7px),
        linear-gradient(140deg, #0f5d34, #1c924f);
    border: 2px solid rgba(255, 255, 255, 0.45);
}

.agency-copy p {
    margin: 0;
    font-size: 0.78rem;
    opacity: 0.9;
}

.agency-copy h1 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.unit-name {
    margin-left: 10px;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.alert-wrap {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f3f7f4;
    position: relative;
}

.alert-dot {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: #de3f36;
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.65rem;
    font-weight: 800;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    max-width: 40vw;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.topbar-auth-link {
    text-decoration: none;
    color: #0d6a37;
    border: 1px solid #9fc9af;
    background: #f4fbf7;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 700;
}

.topbar-auth-link:link,
.topbar-auth-link:visited,
.topbar-auth-link:hover,
.topbar-auth-link:active,
.topbar-auth-link:focus {
    color: #0d6a37;
    text-decoration: none;
}

.topbar-auth-link:hover {
    background: #e8f5ee;
}

.topbar-auth-form {
    margin: 0;
}

.topbar-auth-button {
    color: #0d6a37;
    border: 1px solid #9fc9af;
    background: #f4fbf7;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.topbar-auth-button:hover {
    background: #e8f5ee;
}

.layout {
    display: grid;
    grid-template-columns: 248px 1fr;
    gap: 18px;
    padding: 14px;
    align-items: start;
}

.sidebar {
    background: #fafcfc;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px 0;
    box-shadow: var(--shadow);
    height: fit-content;
}

.sidebar ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    color: #2e3b44;
    padding: 11px 16px;
    font-weight: 700;
}

.sidebar a:link,
.sidebar a:visited,
.sidebar a:hover,
.sidebar a:active,
.sidebar a:focus {
    color: #2e3b44;
    text-decoration: none;
}

.sidebar a.active {
    background: var(--green-800);
    color: #fff;
    border-radius: 6px;
    margin: 0 8px;
}

.sidebar a.active:link,
.sidebar a.active:visited,
.sidebar a.active:hover,
.sidebar a.active:active,
.sidebar a.active:focus {
    color: #fff;
}

.menu-icon {
    display: none;
}

.content {
    background: #fcfdfd;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 14px;
    min-width: 0;
}

.content h2 {
    margin: 4px 0 14px;
    font-size: 2rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.summary-card {
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 6px;
    padding: 12px;
    min-height: 100px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.summary-card-body {
    min-width: 0;
    flex: 1;
}

.card-heading {
    margin: 0;
}

.card-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.3), 0 3px 10px rgba(21, 58, 37, 0.12);
}

.card-icon.green {
    background: linear-gradient(130deg, #059148, #0e6d3d);
}

.card-icon.orange {
    background: linear-gradient(130deg, #fdc145, #f08f00);
}

.card-icon.blue {
    background: linear-gradient(130deg, #3d8ad6, #1d5fa3);
}

.card-icon.people {
    background: linear-gradient(130deg, #27a844, #0d7a34);
}

.card-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.3;
    color: #22303a;
}

.card-value {
    margin: 6px 0 0;
    font-size: clamp(1.9rem, 2.3vw, 2.9rem);
    line-height: 1.05;
    font-weight: 800;
    color: #0d6a37;
}

.card-sub {
    margin: 4px 0 0;
    color: var(--gray-500);
    font-size: 0.78rem;
    font-weight: 700;
}

.charts-row {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 12px;
}

.chart-card {
    background: #fff;
    border: 2px solid #6bb070;
    border-radius: 4px;
    padding: 12px;
}

.chart-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.chart-card svg {
    width: 100%;
    height: 260px;
    display: block;
    background:
        repeating-linear-gradient(
            to top,
            #f7fbf8 0,
            #f7fbf8 43px,
            #edf4ef 43px,
            #edf4ef 44px
        );
}

.grid-line {
    stroke: #d7e2dc;
    stroke-width: 1;
}

.axis-line {
    stroke: #5f666d;
    stroke-width: 2;
}

.y-axis-label {
    fill: #65727c;
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 700;
}

.trend-line {
    fill: none;
    stroke: #148346;
    stroke-width: 4;
}

.trend-dots circle {
    fill: #148346;
    stroke: #ffffff;
    stroke-width: 2;
}

.x-labels text {
    fill: #65727c;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
}

.bars {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bar-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 56px;
    align-items: center;
    gap: 12px;
}

.bar-row span,
.bar-row em {
    font-size: 0.86rem;
    font-style: normal;
    font-weight: 700;
}

.bar {
    background: #e5efe8;
    border-radius: 999px;
    height: 13px;
    overflow: hidden;
}

.bar > div {
    height: 100%;
    background: linear-gradient(90deg, #117c42, #0e5f33);
}

.chart-note {
    margin: 10px 0 0;
    font-size: 0.84rem;
    color: #65727c;
    font-weight: 700;
}

.chart-wrapper {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    width: 40px;
    height: 290px;
    padding: 10px 4px 4px 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #65727c;
}

.y-tick {
    line-height: 1;
}

.compliance-chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.compliance-chart {
    height: 290px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
    align-items: end;
    padding: 10px 6px 4px;
    border: 1px solid #d9e2e9;
    border-radius: 6px;
    background:
        repeating-linear-gradient(
            to top,
            #f7f9fb 0,
            #f7f9fb 47px,
            #eaf0f4 47px,
            #eaf0f4 48px
        );
}

.compliance-labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
    padding: 8px 6px 0;
}

.compliance-bar-item {
    min-width: 0;
}

.compliance-bar-item-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
}

.compliance-bar-wrap {
    height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.compliance-bar-value {
    font-size: 1.65rem;
    line-height: 1;
    font-weight: 800;
    color: #1f2b34;
}

.compliance-bar {
    width: min(76px, 86%);
    min-height: 8px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #107307, #055029);
    border: 1px solid rgba(18, 61, 107, 0.35);
}

.compliance-bar-label {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #243844;
    line-height: 1.3;
    margin: 0;
}

.key-insights-card {
    border-color: #4d8a63;
}

.key-insights-card h3 {
    font-weight: 800;
    color: #4d8a63;
    margin: 0 0 8px;
}

.insight-list {
    margin: 8px 0 0;
    padding: 0 0 0 20px;
}

.insight-list li {
    margin: 0 0 12px;
    color: #1f2b34;
    font-weight: 700;
    line-height: 1.35;
}

.insight-list li:last-child {
    margin-bottom: 0;
}

.cta-row {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.cta-row a {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    background: #0e7f43;
    color: #fff;
    border-radius: 5px;
    font-weight: 800;
    text-align: center;
    padding: 6px 8px;
}

.cta-form {
    margin: 0;
}

.cta-button {
    width: 100%;
    min-height: 42px;
    border: none;
    border-radius: 5px;
    background: #0e7f43;
    color: #fff;
    font: inherit;
    font-weight: 800;
    text-align: center;
    padding: 6px 8px;
    cursor: pointer;
}

.cta-row a.light {
    background: #f2f7f4;
    color: #245838;
    border: 1px solid #bfdac7;
}

.cta-button.light {
    background: #f2f7f4;
    color: #245838;
    border: 1px solid #bfdac7;
}

.bottom-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.panel {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 12px;
}

.panel h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

svg,
input,
textarea,
video {
    max-width: 100%;
}

.checks,
.docs {
    list-style: none;
    margin: 0;
    padding: 0;
}

.checks li,
.docs li {
    padding: 8px 0;
    border-bottom: 1px dashed #d4dce0;
    color: #2e3b44;
    font-weight: 600;
}

.checks li:last-child,
.docs li:last-child {
    border-bottom: none;
}

.checks li::before {
    content: '✓';
    margin-right: 8px;
    color: #0f8647;
    font-weight: 900;
}

.docs li::before {
    content: '[]';
    margin-right: 8px;
    color: #5d6b75;
    font-weight: 900;
}

.data-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.data-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed #d4dce0;
    padding: 10px 0;
    font-weight: 700;
    flex-wrap: wrap;
}

.data-list li:last-child {
    border-bottom: none;
}

.empty-state {
    background: #f2f7f4;
    border: 1px solid #bfdac7;
    border-radius: 6px;
    padding: 12px;
    font-weight: 700;
    color: #245838;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.video-card {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.video-card h3 {
    margin: 0 0 6px;
}

.video-card p {
    margin: 0 0 8px;
    color: #4a5f54;
}

.video-card video {
    width: 100%;
    border-radius: 6px;
    background: #000;
}

.video-card small {
    display: block;
    margin-top: 8px;
    color: #65727c;
    font-weight: 700;
}

.flash {
    border-radius: 6px;
    padding: 10px 12px;
    font-weight: 700;
    margin: 0 0 12px;
}

.flash.success {
    background: #edf7f1;
    border: 1px solid #9fceac;
    color: #1e6a3e;
}

.flash.error {
    background: #feefef;
    border: 1px solid #efb3b3;
    color: #923232;
}

.form-panel {
    margin-bottom: 14px;
}

.admin-form {
    display: grid;
    gap: 10px;
}

.admin-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.admin-form input,
.admin-form textarea {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 10px;
    font: inherit;
}

.admin-form button {
    border: none;
    border-radius: 6px;
    background: #0e7f43;
    color: #fff;
    padding: 10px 14px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.center-page {
    min-height: 100vh;
    display: grid;
    place-items: start center;
    padding: 8vh 16px;
}

.simple-wrap,
.system-message {
    width: min(560px, 94vw);
    background: #fff;
    border: 1px solid #d5e4d9;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 14px 36px rgba(11, 57, 28, 0.12);
}

.simple-wrap h1,
.system-message h1 {
    margin: 0 0 10px;
    font-size: 1.5rem;
}

.simple-wrap p,
.system-message p {
    margin: 10px 0;
    color: #4a5f54;
    line-height: 1.6;
}

.simple-wrap a,
.system-message a,
.system-message code {
    color: #045c2c;
}

.simple-wrap a,
.system-message a {
    font-weight: 700;
    text-decoration: none;
}

.simple-wrap a:hover,
.system-message a:hover {
    text-decoration: underline;
}

.simple-wrap form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.simple-wrap input {
    border: 1px solid #bfdac7;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
}

.simple-wrap button {
    border: none;
    border-radius: 8px;
    background: #0e7f43;
    color: #fff;
    font-weight: 700;
    padding: 10px 12px;
    cursor: pointer;
}

.simple-wrap .error {
    margin-top: 0;
    color: #923232;
    background: #feefef;
    border: 1px solid #efb3b3;
    border-radius: 8px;
    padding: 8px 10px;
}

.summary-card,
.bar-row span,
.bar-row em,
.card-title,
.card-value,
.panel h3 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.system-message.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.system-message.error {
    background: #feefef;
    border-color: #efb3b3;
}

.system-message.success p {
    color: #166534;
}

.system-message.error p {
    color: #923232;
}

.system-message ul {
    margin: 0 0 10px 20px;
    padding: 0;
}

.system-message li {
    line-height: 1.5;
}

@media (max-width: 1250px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cta-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
        position: static;
    }

    .content {
        order: 1;
    }

    .bottom-grid,
    .video-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .unit-name {
        display: none;
    }

    .summary-grid,
    .cta-row {
        grid-template-columns: 1fr;
    }

    .content h2 {
        font-size: 1.6rem;
    }

    .topbar {
        padding: 10px 12px;
    }

    .layout {
        padding: 10px;
    }

    .topbar-right {
        flex-wrap: wrap;
        gap: 10px;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bar-row em {
        justify-self: start;
    }

    .chart-card svg {
        height: 220px;
    }
}

@media (max-width: 420px) {
    .simple-wrap,
    .system-message,
    .content,
    .panel,
    .chart-card,
    .video-card {
        padding: 12px;
    }

    .agency-copy h1 {
        font-size: 1rem;
    }

    .agency-copy p {
        font-size: 0.72rem;
    }
}
