:root {
    color-scheme: dark;
    --bg: #12141a;
    --panel: #1b1e26;
    --panel-2: #232733;
    --line: #2e3342;
    --text: #e6e9ef;
    --muted: #8b93a7;
    --accent: #4ade80;
    --bad: #f87171;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Noto Sans TC", "Segoe UI", sans-serif;
    font-size: 15px;
}

.page { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }

/* ── top bar ─────────────────────────────────────────── */
.topbar {
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
.brand { font-size: 1.15rem; font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
    color: var(--muted); text-decoration: none; padding: 6px 12px;
    border-radius: 8px; font-weight: 500;
}
.topbar nav a:hover { background: var(--panel-2); color: var(--text); }
.topbar nav a.active { background: var(--accent); color: #0b0d12; }

footer { margin-top: 40px; color: var(--muted); font-size: .85rem; text-align: center; }

/* ── tiles ───────────────────────────────────────────── */
.tiles {
    display: grid; gap: 12px; margin-bottom: 24px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.tile-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 4px 0; }
.tile-value .unit { font-size: 1rem; font-weight: 500; color: var(--muted); }
.tile-sub { color: var(--muted); font-size: .85rem; }
.tile.ok .tile-value { color: var(--accent); }
.tile.bad .tile-value { color: var(--bad); }

/* ── panels & tables ─────────────────────────────────── */
.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 1.05rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.stamp { color: var(--muted); font-size: .8rem; margin: 14px 0 0; }

.banner {
    border-radius: 10px; padding: 12px 16px; margin-bottom: 20px;
    border: 1px solid var(--line); background: var(--panel);
}
.banner.error { border-color: var(--bad); color: var(--bad); }

/* ── blazor error ui ─────────────────────────────────── */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #b91c1c; color: #fff; padding: 12px 20px;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { color: #fff; cursor: pointer; margin-left: 12px; }

/* ── live map ────────────────────────────────────────── */
.map-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 70vh;
    margin: 0 auto 18px;
    background: #0e1926;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.map-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.map-grid { position: absolute; inset: 0; }
.grid-line { position: absolute; background: rgba(255,255,255,.07); }
.grid-line.vert { top: 0; bottom: 0; width: 1px; }
.grid-line.horz { left: 0; right: 0; height: 1px; }
.grid-line.axis { background: rgba(74,222,128,.35); }
.grid-label {
    position: absolute; color: var(--muted); font-size: 10px;
    font-variant-numeric: tabular-nums; pointer-events: none;
}
.grid-label.lbl-x { bottom: 2px; transform: translateX(2px); }
.grid-label.lbl-y { left: 3px; transform: translateY(-100%); }

.pin { position: absolute; transform: translate(-50%, -50%); z-index: 5; }
.pin .dot {
    display: block; width: 13px; height: 13px; border-radius: 50%;
    background: var(--accent); border: 2px solid #0b0d12;
    box-shadow: 0 0 0 4px rgba(74,222,128,.25);
}
.pin-label {
    position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
    white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--text);
    background: rgba(11,13,18,.8); padding: 1px 6px; border-radius: 6px;
}
