:root {
    --bg: #eef2f4;
    --card: #ffffff;
    --ink: #0e2a3f;
    --muted: #536b7b;
    --border: #c9d5dd;
    --line: #17364d;
    --accent: #145d86;
    --soft: #f7f9fa;
    --warn: #a15c00;
    --danger: #a53131;
    --ok: #6c7b84;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
.page-shell { width: min(1500px, calc(100% - 28px)); margin: 0 auto; padding: 22px 0 34px; }
.page-header { display: flex; justify-content: space-between; gap: 28px; align-items: center; padding: 0 0 18px; margin-bottom: 18px; border-bottom: 2px solid var(--line); }
.eyebrow, .card-kicker { margin: 0 0 6px; color: var(--muted); font-size: .88rem; }
h1 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 8px; font-size: clamp(2.15rem, 4vw, 3.55rem); line-height: 1.02; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 1.15rem; }
.retrieved { margin: 0; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.status-box { display: flex; gap: 12px; align-items: center; min-width: 330px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.status-dot { width: 17px; height: 17px; flex: 0 0 auto; border-radius: 50%; background: var(--ok); }
.status-box small, .status-box strong { display: block; }
.status-box small { color: var(--muted); margin-bottom: 2px; }
.button { border: 1px solid var(--border); background: var(--card); color: var(--ink); border-radius: 9px; padding: 12px 16px; font: inherit; cursor: pointer; white-space: nowrap; }
.button:hover { border-color: #9dafba; }
.button:disabled { cursor: wait; opacity: .65; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 1px 2px rgba(15, 42, 63, .025); }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card { min-height: 176px; }
.metric { margin: 12px 0 7px; font-size: clamp(2.2rem, 3vw, 3rem); font-weight: 650; line-height: 1; letter-spacing: -.025em; }
.unit { font-size: .55em; font-weight: 600; }
.metric-detail { margin: 0; min-height: 42px; line-height: 1.35; }
.source-line { margin: 10px 0 0; color: var(--muted); font-size: .8rem; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.chart-card { min-width: 0; }
.card-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 14px; }
.text-link { white-space: nowrap; font-size: .88rem; }
.gangline-frame { display: flex; align-items: center; justify-content: center; min-height: 330px; border: 1px solid #d9e2e8; background: #fbfcfd; overflow: hidden; }
.gangline-frame img { display: block; width: 100%; height: auto; object-fit: contain; }
.chart-note { margin: 12px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.lower-grid { display: grid; grid-template-columns: 1.45fr .8fr; gap: 16px; margin-bottom: 18px; }
.empty-state { margin: 8px 0; padding: 18px; background: var(--soft); border-radius: 9px; }
.warning-item { border-left: 5px solid #9cabb4; background: var(--soft); padding: 13px 15px; margin: 10px 0; border-radius: 6px; }
.warning-item.level-2 { border-left-color: #d0a100; }
.warning-item.level-3 { border-left-color: #d56a00; }
.warning-item.level-4, .warning-item.level-5 { border-left-color: var(--danger); }
.warning-item > strong, .warning-item > span, .warning-item > small { display: block; }
.warning-item span, .warning-item small { margin-top: 3px; color: var(--muted); }
.warning-item p { margin: 8px 0 0; }
.link-list { display: grid; gap: 10px; margin-top: 15px; }
.link-list a { display: block; text-decoration: none; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--soft); }
.link-list a:hover { border-color: #9dafba; }
.link-list span, .link-list small { display: block; }
.link-list span { font-weight: 700; margin-bottom: 4px; }
.link-list small { color: var(--muted); line-height: 1.35; }
.method-card { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; margin-bottom: 18px; }
.method-card p { line-height: 1.55; }
.method-links { display: grid; align-content: start; gap: 10px; }
.method-links a { padding: 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; }
.diagnostic-card { margin-bottom: 18px; color: var(--muted); }
.diagnostic-card summary { cursor: pointer; font-weight: 650; color: var(--ink); }
.page-footer { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: .8rem; padding: 6px 2px; }
@media (max-width: 1200px) {
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
    .page-header { align-items: flex-start; flex-direction: column; }
    .header-actions { width: 100%; }
    .status-box { min-width: 0; flex: 1; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .lower-grid, .method-card { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .page-shell { width: min(100% - 18px, 1500px); padding-top: 14px; }
    .header-actions { align-items: stretch; flex-direction: column; }
    .status-box { width: 100%; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 0; }
    .card { padding: 16px; }
    .card-title-row { align-items: flex-start; flex-direction: column; gap: 6px; }
    .gangline-frame { min-height: 220px; }
    .page-footer { flex-direction: column; gap: 6px; }
}
.history-chart { min-height: 330px; border: 1px solid #d9e2e8; background: #fbfcfd; overflow: hidden; }
.history-chart svg { display: block; width: 100%; height: 330px; }
.history-chart .chart-empty { min-height: 330px; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.original-gangline { margin-top: 12px; }
.original-gangline summary { cursor: pointer; color: var(--accent); font-size: .88rem; }
.original-gangline .gangline-frame { margin-top: 10px; min-height: 250px; }
