:root {
    --bg: #f6f7f9; --panel: #ffffff; --line: #e5e7eb; --text: #1f2937; --mute: #6b7280;
    --accent: #2563eb; --accent-soft: #eaf1ff; --bad: #b91c1c; --bad-soft: #fdecec; --warn: #d97706;
    --age0: #bfdbfe; --age1: #7fb0f5; --age2: #3b82f6; --age3: #1e3a8a;
    --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
h1 { font-size: 22px; margin: 0 0 16px; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 14px; margin: 0 0 12px; font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
small, .small { font-size: 12px; } .mute { color: var(--mute); font-weight: 400; } .bad { color: var(--bad); }

.shell { display: flex; min-height: 100vh; }
.side { width: 220px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; padding: 4px 10px 18px; font-size: 15px; }
.brand small { display: block; font-weight: 500; color: var(--mute); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav:hover { background: var(--bg); text-decoration: none; }
.nav.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.content { padding: 24px; max-width: 1400px; display: flex; flex-direction: column; gap: 16px; }
.updated { margin-left: auto; color: var(--mute); font-size: 12px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; display: inline-block; } .dot.bad { background: var(--bad); }
.banner { background: var(--bad-soft); color: var(--bad); padding: 8px 24px; font-size: 13px; }

.search { position: relative; flex: 1; max-width: 560px; }
.search input, .filter { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px 0 36px; font: inherit; background: var(--bg); }
.filter { padding-left: 12px; background: var(--panel); max-width: 420px; }
.search input:focus, .filter:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); background: #fff; }
.search-icon { position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; fill: none; stroke: var(--mute); stroke-width: 1.8; stroke-linecap: round; }
.suggest { position: absolute; top: 42px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.12); padding: 6px; max-height: 420px; overflow: auto; }
.s-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); padding: 8px 8px 2px; }
.s-item, .s-all { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 6px; color: var(--text); }
.s-item:hover, .s-all:hover { background: var(--accent-soft); text-decoration: none; }
.s-item small { color: var(--mute); } .s-empty { padding: 10px 8px; color: var(--mute); } .s-all { color: var(--accent); border-top: 1px solid var(--line); margin-top: 4px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.grid { display: grid; gap: 16px; } .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.kpi:hover { text-decoration: none; border-color: var(--accent); }
.kpi-label { font-size: 12px; color: var(--mute); font-weight: 500; } .kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; } .kpi-hint { font-size: 12px; color: var(--mute); }
.kpi.alert .kpi-value { color: var(--bad); }
.empty { color: var(--mute); margin: 4px 0; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.bars li { display: grid; grid-template-columns: minmax(70px, 38%) 1fr 36px; gap: 8px; align-items: center; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .bar-track { background: var(--bg); border-radius: 4px; height: 12px; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; } .bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--mute); }
.more { color: var(--mute); font-size: 12px; margin: 8px 0 0; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mute); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl.compact td { padding: 6px 8px; } .tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--accent-soft); }
.tbl tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--bad); } .tbl tr.late td { background: var(--bad-soft); }
.card { overflow-x: auto; }

.agebar { display: flex; height: 18px; min-width: 110px; border-radius: 4px; overflow: hidden; background: var(--bg); }
.seg { display: grid; place-items: center; font-size: 11px; color: #0f172a; min-width: 18px; }
.seg.age0 { background: var(--age0); } .seg.age1 { background: var(--age1); } .seg.age2 { background: var(--age2); color: #fff; } .seg.age3 { background: var(--age3); color: #fff; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--mute); font-size: 12px; margin: 10px 0 0; } .legend span { display: flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; } .sw.age0 { background: var(--age0); } .sw.age1 { background: var(--age1); } .sw.age2 { background: var(--age2); } .sw.age3 { background: var(--age3); }
.pri, .sev { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--bg); }
.pri.P1, .sev.Critical { background: var(--bad-soft); color: var(--bad); } .pri.P2, .sev.High { background: #fff3e0; color: #b45309; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-family: inherit; }
.chip:hover { text-decoration: none; background: #dbe8ff; }
.chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 28px; }
.filterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: -4px; }
.btn { height: 36px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 12px; font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); } .btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.sites-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.map-card { padding: 0; overflow: hidden; } .map { height: 520px; width: 100%; }
.list-card { max-height: 520px; overflow: auto; }
.list-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.note { font-size: 12px; color: var(--mute); background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.area-del { font: 600 12px/1 inherit; font-family: inherit; background: #fff; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 4px 9px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.area-del:hover { background: var(--accent); color: #fff; }
/* While drawing, the DOM markers (the delete buttons too) and popups take no clicks: the click belongs to the drawing. */
.drawing .maplibregl-marker, .drawing .maplibregl-popup { pointer-events: none; }
.drawing .maplibregl-canvas-container { touch-action: none; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; } .feed time { color: var(--mute); font-variant-numeric: tabular-nums; margin-right: 6px; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 340px; }
.toast { background: #111827; color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: slide .2s ease-out; }
.toast b { text-transform: capitalize; font-size: 12px; opacity: .8; } .toast small { opacity: .75; }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

#blazor-error-ui { display: none; }

@media (max-width: 1000px) {
    .grid.two, .grid.three, .sites-layout { grid-template-columns: 1fr; }
    .side { width: 64px; padding: 12px 6px; } .side .nav span, .brand span:last-child { display: none; } .nav { justify-content: center; }
}
