:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --ink: #20242c;
    --muted: #6b7280;
    --line: #e3e7ee;
    --accent: #f2b134;
    --blue: #3a7bd5;
    --green: #2bb673;
    --red: #d9453b;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15181e;
        --card: #1e222a;
        --ink: #e8eaee;
        --muted: #9aa3b2;
        --line: #2d333d;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
h1 small, h2 small { color: var(--muted); font-weight: normal; font-size: 13px; margin-left: 6px; }
main { padding: 20px 24px 48px; max-width: 1400px; margin: 0 auto; }
.muted { color: var(--muted); }
.error { color: var(--red); }

.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: #20242c; color: #f0f0f0; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; }
.brand span, .login h1 span { color: var(--accent); font-weight: 400; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #c9cdd4; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: #343a46; color: #fff; }
.topbar .status { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: #c9cdd4; }
.logout { color: #c9cdd4; margin-left: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; display: flex; flex-direction: column; }
.label { color: var(--muted); font-size: 12px; }
.big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.chart { padding: 12px 14px; }
.chart svg { width: 100%; height: 120px; display: block; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .axis { stroke: var(--line); }
.chart-head, .chart-foot { display: flex; justify-content: space-between; align-items: baseline; }
.chart-head .value { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.chart-foot { color: var(--muted); font-size: 11px; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
button { background: var(--blue); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px; font: inherit; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: default; }
button.danger { background: var(--red); }
button.small { padding: 3px 10px; font-size: 12px; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.filter { margin-bottom: 10px; width: 260px; max-width: 100%; }
.toolbar .filter { margin-bottom: 0; }
button.selected { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); filter: brightness(0.85); }
tr.offline td { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.dead td { opacity: 0.45; }
td.warn { color: #b35c00; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.pill { padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--line); }
.pill.ready { background: #d6f5e6; color: #146c43; }
.pill.starting { background: #fff1cc; color: #7a5a00; }
.pill.draining { background: #ffe0cc; color: #8a3b00; }
.pill.dead { background: #f8d7d5; color: #842029; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.world { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.map-wrap { padding: 12px; overflow: auto; }
.map { width: 100%; height: auto; display: block; }
.map .cell { cursor: pointer; }
.map .cell:hover { fill-opacity: 0.8; }
.side { padding: 4px 16px 16px; }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { padding: 3px 0; }
.side label { display: block; margin: 8px 0; }

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { padding: 28px; width: 340px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }

@media (max-width: 800px) {
    main { padding: 16px; }
    .world { grid-template-columns: 1fr; }
}
.live { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.live .dot:not(.ok):not(.bad) { background: var(--muted); }
td.good { color: var(--green); font-weight: 600; }
td.bad { color: var(--red); font-weight: 600; }
td.good small, td.bad small { font-weight: 400; }

/* Flights: the curves' legend, the energy bars, the track seen from above, clickable rows. */
.legend { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 3px; margin-right: 4px; vertical-align: middle; }
.bar { background: var(--line); border-radius: 3px; height: 8px; min-width: 120px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.chart.track svg { width: auto; height: 140px; aspect-ratio: 1; margin: 0 auto; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: var(--line); }
