:root {
    color-scheme: light;
    --bg: #eef2f6;
    --card: #ffffff;
    --text: #17212b;
    --muted: #667281;
    --border: #dce3ea;
    --green: #187a46;
    --green-soft: #eaf6ef;
    --yellow: #a86b00;
    --yellow-soft: #fff4d6;
    --red: #bd2029;
    --red-soft: #fdecee;
    --navy: #0f172a;
    --shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-shell {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(20px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
}

.overall-card {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    min-height: 172px;
    padding: 28px 34px;
    border-radius: var(--radius);
    color: #fff;
    box-shadow: var(--shadow);
    transition: background-color 180ms ease;
}

.overall-card.status-green {
    background: var(--green);
}

.overall-card.status-yellow {
    background: var(--yellow);
}

.overall-card.status-red {
    background: var(--red);
}

.overall-dot {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.eyebrow {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.eyebrow-light {
    color: rgba(255, 255, 255, 0.76);
}

.overall-copy h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.15rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
}

.overall-copy > p {
    margin: 10px 0 0;
    max-width: 900px;
    font-size: 1.02rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.94);
}

.overall-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 13px;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.82);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.metric-card,
.component-card {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.metric-card {
    min-width: 0;
    padding: 20px 22px 18px;
    border-radius: 14px;
}

.metric-label {
    min-height: 2.1em;
    color: var(--muted);
    font-size: 0.79rem;
    font-weight: 800;
    letter-spacing: 0.055em;
    line-height: 1.25;
}

.metric-value {
    margin-top: 3px;
    font-size: clamp(2rem, 4vw, 3.05rem);
    line-height: 1;
    font-weight: 780;
    letter-spacing: -0.045em;
    font-variant-numeric: tabular-nums;
}

.metric-detail {
    min-height: 1.25em;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.3;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.component-card {
    min-width: 0;
    border-radius: 14px;
    overflow: hidden;
}

.component-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.component-heading h2 {
    margin: 0;
    font-size: 1.06rem;
    line-height: 1.25;
}

.status-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.045em;
}

.status-badge.status-green {
    color: var(--green);
    background: var(--green-soft);
}

.status-badge.status-yellow {
    color: var(--yellow);
    background: var(--yellow-soft);
}

.status-badge.status-red {
    color: var(--red);
    background: var(--red-soft);
}

.badge-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
}

.component-body {
    padding: 18px 20px 20px;
}

.status-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 22px;
    margin: 0;
}

.status-list > div {
    min-width: 0;
}

.status-list dt {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.status-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.96rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.component-summary {
    margin: 18px 0 0;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 14px;
    padding: 13px 4px 0;
    color: var(--muted);
    font-size: 0.83rem;
}

.footer-copy {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
}

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

.footer-actions form {
    margin: 0;
}

.primary-button,
.secondary-button,
.ghost-button {
    border-radius: 10px;
    padding: 10px 15px;
    font-weight: 750;
    transition:
        transform 100ms ease,
        background-color 100ms ease,
        border-color 100ms ease;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active {
    transform: translateY(1px);
}

.primary-button {
    width: 100%;
    border: 1px solid #0f5e38;
    color: #fff;
    background: var(--green);
}

.secondary-button {
    border: 1px solid #b8c4cf;
    color: var(--text);
    background: #fff;
}

.ghost-button {
    border: 1px solid transparent;
    color: var(--muted);
    background: transparent;
}

.secondary-button:hover,
.ghost-button:hover {
    background: #f8fafc;
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding:
        max(24px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(24px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 18% 10%, rgba(24, 122, 70, 0.14), transparent 32rem),
        var(--bg);
}

.login-shell {
    width: min(430px, 100%);
}

.login-card {
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.login-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 22px;
    border-radius: 15px;
    background: var(--navy);
}

.login-mark span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(24, 122, 70, 0.2);
}

.login-heading h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: -0.035em;
}

.login-heading p {
    margin: 9px 0 25px;
    color: var(--muted);
    line-height: 1.45;
}

.login-card form {
    display: grid;
    gap: 9px;
}

.login-card label {
    margin-top: 5px;
    font-size: 0.83rem;
    font-weight: 750;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #bcc8d3;
    border-radius: 10px;
    outline: none;
    background: #fff;
}

.login-card input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(24, 122, 70, 0.12);
}

.login-card .primary-button {
    margin-top: 13px;
}

.login-error {
    margin: -6px 0 16px;
    padding: 11px 12px;
    border: 1px solid #efb0b5;
    border-radius: 10px;
    color: #84151c;
    background: var(--red-soft);
    font-size: 0.88rem;
    line-height: 1.4;
}

.login-footnote {
    margin: 21px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

@media (max-width: 1050px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding: 10px;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .overall-card {
        grid-template-columns: 44px minmax(0, 1fr);
        min-height: 0;
        gap: 13px;
        padding: 22px 18px;
        border-radius: 14px;
    }

    .overall-dot {
        width: 38px;
        height: 38px;
    }

    .overall-copy h1 {
        font-size: clamp(1.65rem, 8vw, 2.35rem);
    }

    .overall-copy > p {
        font-size: 0.91rem;
    }

    .overall-meta {
        gap: 6px 13px;
        font-size: 0.77rem;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 10px;
    }

    .metric-card {
        padding: 16px 15px 14px;
    }

    .metric-label {
        min-height: 2.4em;
        font-size: 0.71rem;
    }

    .metric-value {
        font-size: 2.2rem;
    }

    .metric-detail {
        font-size: 0.76rem;
    }

    .component-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 10px;
    }

    .component-heading {
        align-items: flex-start;
        padding: 15px 16px;
    }

    .component-body {
        padding: 15px 16px 17px;
    }

    .status-list {
        gap: 12px 15px;
    }

    .dashboard-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 10px 2px 0;
    }

    .footer-actions {
        width: 100%;
    }

    .footer-actions button,
    .footer-actions form {
        flex: 1;
    }

    .footer-actions form button {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    .status-list {
        grid-template-columns: 1fr;
    }

    .overall-card {
        grid-template-columns: 1fr;
    }

    .overall-dot {
        display: none;
    }

    .login-card {
        padding: 27px 22px;
    }
}


/* ============================================================
   MOBILE-FIRST ENHANCEMENTS
   The dashboard is primarily used on a phone.
   ============================================================ */

.mobile-status-bar {
    display: none;
}

.status-item-wide {
    grid-column: 1 / -1;
}

@media (max-width: 760px) {
    body.dashboard-body {
        padding-bottom: calc(74px + env(safe-area-inset-bottom));
    }

    .page-shell {
        width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }

    .overall-card {
        position: relative;
        display: block;
        padding: 20px 18px 18px;
        border-radius: 14px;
    }

    .overall-dot {
        display: none;
    }

    .eyebrow-light {
        margin-bottom: 7px;
        font-size: 0.68rem;
        letter-spacing: 0.13em;
    }

    .overall-copy h1 {
        max-width: 100%;
        font-size: clamp(1.7rem, 9.5vw, 2.45rem);
        line-height: 1.02;
        overflow-wrap: anywhere;
    }

    .overall-copy > p {
        margin-top: 8px;
        font-size: 0.88rem;
        line-height: 1.38;
    }

    .overall-meta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px 12px;
        margin-top: 12px;
        font-size: 0.73rem;
    }

    .overall-meta span:first-child {
        grid-column: 1 / -1;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 10px;
    }

    .metric-card {
        min-height: 112px;
        padding: 14px 13px 12px;
        border-radius: 12px;
        box-shadow: none;
    }

    .metric-card:last-child {
        grid-column: 1 / -1;
        min-height: 94px;
    }

    .metric-label {
        min-height: 2.25em;
        font-size: 0.67rem;
        line-height: 1.16;
        letter-spacing: 0.035em;
    }

    .metric-value {
        margin-top: 5px;
        font-size: clamp(1.95rem, 10vw, 2.55rem);
        line-height: 0.95;
    }

    .metric-detail {
        margin-top: 7px;
        font-size: 0.72rem;
        line-height: 1.22;
    }

    .component-grid {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-top: 9px;
    }

    .component-card {
        border-radius: 12px;
        box-shadow: none;
    }

    .component-heading {
        align-items: center;
        padding: 14px 14px 12px;
        gap: 10px;
    }

    .component-heading h2 {
        font-size: 0.98rem;
    }

    .status-badge {
        padding: 5px 8px;
        font-size: 0.67rem;
    }

    .badge-dot {
        width: 8px;
        height: 8px;
    }

    .component-body {
        padding: 13px 14px 15px;
    }

    .status-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px 14px;
    }

    .status-list dt {
        font-size: 0.70rem;
        line-height: 1.15;
    }

    .status-list dd {
        margin-top: 2px;
        font-size: 0.91rem;
        line-height: 1.2;
    }

    .component-summary {
        margin-top: 14px;
        padding-top: 12px;
        font-size: 0.79rem;
        line-height: 1.38;
    }

    .dashboard-footer {
        display: none;
    }

    .mobile-status-bar {
        position: fixed;
        z-index: 50;
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 58px;
        padding: 8px 9px 8px 12px;
        border: 1px solid rgba(15, 23, 42, 0.10);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 14px 40px rgba(15, 23, 42, 0.20);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .mobile-status-indicator {
        display: flex;
        min-width: 0;
        align-items: center;
        gap: 10px;
    }

    .mobile-status-indicator > div {
        display: grid;
        min-width: 0;
        gap: 1px;
    }

    .mobile-status-indicator strong {
        overflow: hidden;
        font-size: 0.82rem;
        line-height: 1.15;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .mobile-status-indicator span:last-child {
        color: var(--muted);
        font-size: 0.69rem;
    }

    .mobile-status-dot {
        width: 14px;
        height: 14px;
        flex: 0 0 14px;
        border-radius: 50%;
        background: var(--red);
        box-shadow: 0 0 0 4px var(--red-soft);
    }

    html[data-status="green"] .mobile-status-dot {
        background: var(--green);
        box-shadow: 0 0 0 4px var(--green-soft);
    }

    html[data-status="yellow"] .mobile-status-dot {
        background: var(--yellow);
        box-shadow: 0 0 0 4px var(--yellow-soft);
    }

    html[data-status="red"] .mobile-status-dot {
        background: var(--red);
        box-shadow: 0 0 0 4px var(--red-soft);
    }

    .mobile-refresh-button {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 8px 13px;
        border: 1px solid #b8c4cf;
        border-radius: 11px;
        color: var(--text);
        background: #fff;
        font-size: 0.78rem;
        font-weight: 800;
    }

    .mobile-refresh-button:disabled {
        opacity: 0.55;
        cursor: default;
    }
}

@media (max-width: 390px) {
    .page-shell {
        padding-left: 8px;
        padding-right: 8px;
    }

    .overall-card {
        padding: 18px 15px 16px;
    }

    .overall-copy h1 {
        font-size: 1.75rem;
    }

    .metric-card {
        min-height: 108px;
        padding-left: 11px;
        padding-right: 11px;
    }

    .metric-value {
        font-size: 2rem;
    }

    .component-heading {
        padding-left: 12px;
        padding-right: 12px;
    }

    .component-body {
        padding-left: 12px;
        padding-right: 12px;
    }

    .status-list {
        gap: 10px 11px;
    }
}

@media (display-mode: standalone) and (max-width: 760px) {
    .page-shell {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .eyebrow-light {
        display: none;
    }
}


.metric-period {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    color: #44505e;
    background: #edf1f5;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

@media (max-width: 760px) {
    .metric-period {
        margin-top: 3px;
        padding: 2px 6px;
        font-size: 0.62rem;
    }

    .metric-card:has(.metric-period) .metric-value {
        margin-top: 4px;
    }
}
