:root {
    color-scheme: light;
    --bg: #f6f7f8;
    --panel: #ffffff;
    --text: #1a2024;
    --muted: #66737b;
    --line: #dfe5e8;
    --pgd-red: #c91f2e;
    --pgd-red-dark: #961724;
    --green: #177245;
    --green-bg: #e3f6eb;
    --warning-bg: #fff0df;
    --stale: #7b6472;
    --stale-bg: #f0ecef;
    --shadow: 0 14px 34px rgba(26, 32, 36, 0.08);
}

@font-face {
    font-family: "Bahnschrift PGD";
    src: url("fonts/bahnschrift.woff2") format("woff2");
    font-weight: 300 900;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Bahnschrift PGD", Bahnschrift, Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 0;
    background: #071b3a;
    box-shadow: 0 10px 24px rgba(26, 32, 36, 0.16);
}

.nav {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px clamp(16px, 4vw, 32px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
}

.brand-mark img {
    display: block;
    width: 54px;
    height: 54px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: #ffffff;
    font-size: 21px;
    line-height: 1.05;
    font-weight: 900;
    text-transform: uppercase;
}

.brand small {
    margin-top: 6px;
    color: #aebdce;
    font-size: 15px;
    font-weight: 800;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 700;
}

.nav-links a,
.nav-links summary {
    cursor: pointer;
    text-decoration: none;
}

.nav-links details {
    position: relative;
}

.sensor-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.sensor-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
}

.sensor-menu a:hover {
    background: #f3f5f6;
}

.page-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 32px) 48px;
}

.hero,
.detail-hero {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
    padding: 24px 0 8px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--pgd-red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 42px;
    line-height: 1.08;
}

h2 {
    margin-bottom: 4px;
    font-size: 22px;
    font-weight: 900;
}

.sensor-card h2 {
    font-weight: 900;
}

.hero p,
.detail-hero p,
.status-message {
    color: var(--muted);
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.sensor-card,
.detail-panel,
.detail-summary,
.empty-state {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.sensor-card {
    padding: 18px;
}

.sensor-card.is-warning {
    border-color: rgba(201, 31, 46, 0.58);
    box-shadow: 0 16px 36px rgba(201, 31, 46, 0.12);
}

.sensor-card.is-stale {
    border-color: rgba(123, 100, 114, 0.38);
}

.card-head,
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.card-status {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 6px;
    text-align: right;
}

.status-age {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-ok {
    background: var(--green-bg);
    color: var(--green);
}

.status-warning {
    background: var(--warning-bg);
    color: var(--pgd-red-dark);
}

.status-stale {
    background: var(--stale-bg);
    color: var(--stale);
}

.status-message {
    min-height: 40px;
    margin: 12px 0 14px;
}

.chart-wrap {
    position: relative;
    height: 250px;
    margin: 0 0 16px;
}

.chart-large {
    height: 420px;
}

.metrics,
.detail-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.metrics div,
.detail-summary div {
    min-width: 0;
    padding: 12px;
    border-radius: 12px;
    background: #f7f9fa;
}

dt,
.detail-summary span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

dd span,
.muted {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-link,
.back-link {
    display: inline-flex;
    margin-top: 16px;
    color: var(--pgd-red-dark);
    font-weight: 800;
    text-decoration: none;
}

.detail-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 14px;
    margin-bottom: 18px;
}

.detail-summary strong {
    font-size: 22px;
}

.detail-panel,
.empty-state {
    padding: 18px;
    margin-top: 18px;
}

.range-tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    border-radius: 999px;
    background: #f0f3f4;
}

.range-tabs a {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 800;
    text-decoration: none;
}

.range-tabs a.active {
    background: var(--pgd-red);
    color: #ffffff;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

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

@media (max-width: 680px) {
    .nav {
        align-items: center;
        flex-direction: row;
    }

    .brand {
        gap: 13px;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
    }

    .brand-mark img {
        width: 48px;
        height: 48px;
    }

    .brand strong {
        font-size: 19px;
    }

    .brand small {
        font-size: 13px;
    }

    .hero,
    .detail-hero,
    .panel-head {
        display: block;
    }

    .card-head {
        align-items: flex-start;
    }

    .card-status {
        align-items: flex-start;
        margin-top: 10px;
        text-align: left;
    }

    h1 {
        font-size: 34px;
    }

    .detail-hero > .status {
        margin-top: 10px;
    }

    .metrics,
    .detail-summary {
        grid-template-columns: 1fr;
    }

    .chart-wrap {
        height: 220px;
    }

    .chart-large {
        height: 320px;
    }

    .range-tabs {
        margin-top: 12px;
        border-radius: 14px;
    }

    .range-tabs a {
        flex: 1;
        text-align: center;
    }
}
