/* Statistics page. Uses the archive's own colour tokens (style.css); the series colours come from stats.js. */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin: 0 0 10px; }
.card h2 { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: .01em; }
.card h3.sub { margin: 14px 0 4px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.range-out { font-family: var(--pixel); font-size: .95rem; color: var(--accent); }
.bar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 8px; }
.sel { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.sel select { font: inherit; font-size: .88rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 14px; }
.stat small { display: block; color: var(--muted); font-size: .72rem; margin-top: 1px; }

/* timeline */
.tl svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.tl .bar { shape-rendering: crispEdges; }
.tl .ax { fill: var(--muted); font: 11px var(--font); }
.tl .ax-y { fill: var(--fg); font: 600 12px var(--font); }
.tl .grid { stroke: var(--line); stroke-width: 1; }
.tl .shade { fill: var(--accent); opacity: .12; }
.tl .out { fill: var(--bg); opacity: .55; }
.tl .hd rect.knob { fill: var(--accent); }
.tl .hd rect.grip { fill: var(--on-accent); }
.tl .hd { cursor: ew-resize; }
.tl .hd:focus-visible rect.knob { stroke: var(--fg); stroke-width: 2; }
.tl .mid { cursor: grab; fill: transparent; }
.tl .edge { stroke: var(--accent); stroke-width: 2; }
.legend { margin: 6px 0 0; min-height: 30px; }
.legend .chip b { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

/* map */
.statmap { height: min(62vh, 560px); min-height: 320px; cursor: grab; touch-action: pan-y pinch-zoom; }
.statmap:active { cursor: grabbing; }
.statmap svg { width: 100%; height: 100%; display: block; }
.statmap .c { stroke: color-mix(in srgb, var(--fg) 22%, transparent); stroke-width: .6; vector-effect: non-scaling-stroke; fill: color-mix(in srgb, var(--fg) 5%, transparent); }
.statmap .c:hover { stroke: var(--fg); stroke-width: 1.4; }
.statmap .c.sel { stroke: var(--accent); stroke-width: 2.2; }
.statmap .p { vector-effect: non-scaling-stroke; stroke-width: .8; fill-opacity: .16; stroke-opacity: .65; pointer-events: none; }
.statmap .cityd { fill: var(--fg); }
.statmap .cityl { fill: var(--fg); font: 600 11px var(--font); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; pointer-events: none; }
.map-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: center; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.map-foot .note { margin: 0; min-height: 0; }
.ramp { display: inline-block; width: 110px; height: 8px; border-radius: 3px; vertical-align: middle; margin: 0 6px; background: linear-gradient(90deg, color-mix(in srgb, #2a78d6 12%, transparent), #2a78d6); }
.sw { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; background: var(--c); opacity: .6; }

/* horizontal bars */
.hbars { display: grid; gap: 7px; }
.hb { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: .86rem; cursor: default; }
.hb[role="button"] { cursor: pointer; }
.hb .n { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .n i { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--accent)); }
.hb .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.hb .t { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--fg) 8%, transparent); overflow: hidden; }
.hb .t u { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--accent)); text-decoration: none; }
.hb[role="button"]:hover .n { color: var(--accent); }
.hb.on .n { color: var(--accent); font-weight: 600; }
.empty { color: var(--muted); font-size: .86rem; padding: 6px 0; }

/* small charts */
svg#hours, svg#dows { width: 100%; height: auto; display: block; }
.mini rect { fill: var(--accent); }
.mini text { fill: var(--muted); font: 11px var(--font); }
.mini .hot { fill: var(--accent); }

/* gaps: stretches where the system was not recording */
.tl .gap { fill: url(#hatch); }
.tl .gap-edge { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.tl .hatch line { stroke: var(--muted); stroke-width: 1.2; opacity: .55; }
.gapnote { display: flex; align-items: center; gap: 8px; }
.gapnote i { flex: none; width: 22px; height: 12px; border: 1px dashed var(--muted); border-radius: 3px; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 55%, transparent) 0 1.5px, transparent 1.5px 5px); }
.zoomc { position: absolute; top: 10px; right: 10px; z-index: 5; display: grid; gap: 4px; }
.zoomc button { width: 32px; height: 32px; font: inherit; font-size: 1.1rem; line-height: 1; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.zoomc button:hover { border-color: var(--accent); }
.maphint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5; padding: 4px 12px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: .8rem; pointer-events: none; }

/* mini alert viewer (a county is selected) */
.viewer-sub { display: inline-flex; align-items: center; gap: 12px; }
.viewer-sub .note { margin: 0; min-height: 0; }
.viewer .btn-style { font: inherit; font-size: .8rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; cursor: pointer; }
.viewer .btn-style:hover { color: var(--fg); border-color: var(--accent); }
.vlist { display: grid; gap: 8px; max-height: 560px; overflow: auto; padding-right: 4px; }
.va { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); border-radius: 10px; background: var(--panel-2); padding: 9px 12px; cursor: pointer; }
.va:hover, .va.open { border-color: var(--c, var(--accent)); }
.va-t { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.va-t b { font-weight: 600; }
.va-t time { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.va-s { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.va-s span { font-size: .72rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.va-s .poly { color: var(--accent); border-color: var(--accent); }
.va-m { margin: 6px 0 0; font-size: .86rem; color: color-mix(in srgb, var(--fg) 85%, var(--muted)); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.va.open .va-m { display: block; -webkit-line-clamp: unset; }
.va-x { display: none; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.va.open .va-x { display: block; }
.va-x a { margin-left: 10px; }
.statmap .pf { vector-effect: non-scaling-stroke; fill-opacity: .28; stroke-width: 2.4; pointer-events: none; }
.listen { font: inherit; font-size: .74rem; font-weight: 600; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.listen:hover { background: var(--accent); color: var(--on-accent); }
.listen.on { background: var(--accent); color: var(--on-accent); }
.listen .ico { font-size: .7em; }
.card.wide { grid-column: 1 / -1; }
.tod { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 4px 28px; }
.tod h3.sub { margin-top: 0; }

.statmap .sw { vector-effect: non-scaling-stroke; stroke-width: 2.2; stroke-opacity: .9; stroke-linejoin: round; pointer-events: none; }
