:root {
    --bg: #f5efe4;
    --paper: rgba(255, 251, 243, 0.82);
    --paper-strong: rgba(255, 251, 243, 0.94);
    --line: rgba(83, 65, 37, 0.14);
    --text: #2a2419;
    --muted: #6e6453;
    --ok: #236b44;
    --wait: #8f6e2f;
    --danger: #b64a3b;
    --shadow: 0 18px 48px rgba(73, 53, 25, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(216, 111, 49, 0.2), transparent 26%),
        radial-gradient(circle at top right, rgba(31, 139, 139, 0.18), transparent 20%),
        linear-gradient(180deg, #f5efe4 0%, #f7f3ea 50%, #efe7d4 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(83, 65, 37, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(83, 65, 37, 0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

img {
    max-width: 100%;
    display: block;
}

.page-shell {
    width: min(1320px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
    gap: 20px;
    margin-bottom: 20px;
}

.hero-copy,
.hero-status,
.panel {
    border: 1px solid var(--line);
    background: var(--paper);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.hero-copy {
    padding: 28px 30px;
    border-radius: var(--radius-lg);
}

.eyebrow {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    color: var(--muted);
}

.hero h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1.05;
}

.hero-meta {
    margin: 18px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
}

.hero-meta span {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.54);
    border: 1px solid rgba(83, 65, 37, 0.08);
}

.hero-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: #1f5f8b;
    border: 1px solid #1f5f8b;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.hero-link:hover {
    background: #184c70;
    border-color: #184c70;
    transform: translateY(-1px);
}

.hero-status {
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    margin-bottom: 14px;
}

.status-pill.ok {
    background: rgba(35, 107, 68, 0.12);
    color: var(--ok);
}

.status-pill.waiting {
    background: rgba(143, 110, 47, 0.12);
    color: var(--wait);
}

.status-pill.danger {
    background: rgba(182, 74, 59, 0.12);
    color: var(--danger);
}

.status-label {
    margin: 0 0 6px;
    color: var(--muted);
}

.status-time {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.overview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.7fr);
    gap: 20px;
    align-items: stretch;
}

.panel {
    padding: 24px;
    border-radius: var(--radius-lg);
}

.metrics-panel,
.image-panel,
.chart-panel,
.table-panel {
    min-width: 0;
}

.metrics-panel,
.image-panel {
    display: flex;
    flex-direction: column;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.panel-head h2 {
    margin: 0;
    font-size: 22px;
}

.panel-head p {
    margin: 8px 0 0;
    color: var(--muted);
}

.panel-head-stack {
    align-items: flex-start;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 12px;
    flex: 1;
}

.metric-card {
    border-radius: var(--radius-md);
    padding: 18px 20px;
    min-height: 112px;
    height: 100%;
    background: var(--paper-strong);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.metric-label,
.metric-unit {
    color: var(--muted);
}

.metric-label {
    font-size: 18px;
    font-weight: 600;
}

.metric-reading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.metric-value {
    font-size: clamp(34px, 2.8vw, 46px);
    line-height: 1;
}

.metric-unit {
    font-size: 18px;
    font-weight: 600;
    color: var(--muted);
}

.image-stage {
    position: relative;
    min-height: 680px;
    flex: 1;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(9, 25, 43, 0.94), rgba(13, 42, 68, 0.86));
}

.image-stage img {
    width: 100%;
    height: 100%;
    min-height: 680px;
    object-fit: contain;
}

.image-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.72);
}

.image-empty.hidden,
.chart-empty.hidden {
    display: none;
}

.metric-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-switcher button {
    border: 0;
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--muted);
    cursor: pointer;
}

.metric-switcher button.active {
    background: #2f5f8d;
    color: #fff;
}

.chart-stage {
    position: relative;
    min-height: 320px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.58);
}

#chart-svg {
    width: 100%;
    height: 320px;
    display: block;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

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

.chart-summary div {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid var(--line);
}

.chart-summary span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.chart-summary strong {
    font-size: 24px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-weight: 600;
}

.table-empty {
    text-align: center;
    color: var(--muted);
}

@media (max-width: 1180px) {
    .hero,
    .overview-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .chart-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-card {
        flex-direction: column;
        align-items: flex-start;
        min-height: 0;
    }

    .metric-reading {
        justify-content: flex-start;
    }

    .metric-grid {
        grid-template-rows: none;
        flex: none;
    }

    .image-stage,
    .image-stage img {
        min-height: 460px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 18px, 100%);
        margin: 10px auto 24px;
    }

    .hero-copy,
    .hero-status,
    .panel {
        padding: 18px;
        border-radius: 22px;
    }

    .chart-summary {
        grid-template-columns: 1fr;
    }

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .image-stage,
    .image-stage img {
        min-height: 300px;
    }

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