/* tough.services shared design system — served from https://tough.services/shared/tough.css
   Edit in the `shared` repo (/var/www/shared). Sites layer their own /css/style.css on top. */
/* Tough Weathersat — stylesheet
   Shares the Tough Weather design system: token-based light/dark theme. */

:root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --baseline: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);
    --accent: #2a78d6;
    --series-blue: #2a78d6;
    --series-orange: #eb6834;
    --series-aqua: #1baf7a;
    --series-violet: #4a3aa7;
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-serious: #ec835a;
    --status-critical: #d03b3b;
    --good: #0ca30c;
    --warn: #fab219;
    --bad: #d03b3b;
    --page-max: 1240px;
    --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
        color-scheme: dark;
        --page: #0d0d0d;
        --surface: #1a1a19;
        --ink: #ffffff;
        --ink-2: #c3c2b7;
        --muted: #898781;
        --grid: #2c2c2a;
        --baseline: #383835;
        --border: rgba(255, 255, 255, 0.10);
        --accent: #3987e5;
        --series-blue: #3987e5;
        --series-orange: #d95926;
        --series-aqua: #199e70;
        --series-violet: #9085e9;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --series-blue: #3987e5;
    --series-orange: #d95926;
    --series-aqua: #199e70;
    --series-violet: #9085e9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    overflow-x: clip;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1 1 auto; }

img, svg, canvas { max-width: 100%; }

.hero-grid > *, .tile-grid > *, .split-grid > *, .image-grid > *,
.sky-grid > *, .hero-main > * {
    min-width: 0;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
[hidden] { display: none !important; }
a { color: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 12px 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }

.topbar-nav {
    display: inline-flex;
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    overflow-x: auto;
    max-width: 100%;
}
.topbar-nav a {
    color: var(--ink-2);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 7px;
    white-space: nowrap;
}
.topbar-nav a:hover { color: var(--ink); }
.topbar-nav a.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.topbar-status { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--baseline); }
.theme-toggle svg { width: 18px; height: 18px; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) .icon-sun { display: block; }
    :root:not([data-theme="light"]):not([data-theme="dark"]) .icon-moon { display: none; }
}

/* ---------- Layout ---------- */
.page {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.card-source { font-size: 0.8rem; color: var(--muted); }
.card-footnote {
    margin: 14px 0 0;
    font-size: 0.76rem;
    color: var(--muted);
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.section-head h2 { font-size: 1.15rem; }
.placeholder { color: var(--muted); font-size: 0.9rem; padding: 8px 0; }

.meta-label { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-value { font-weight: 600; font-size: 0.95rem; }

/* ---------- Hero (next pass) ---------- */
.hero-grid {
    display: grid;
    grid-template-columns: minmax(300px, 1.2fr) 1.6fr;
    gap: 16px;
    align-items: stretch;
}
.hero-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    border-top: 3px solid var(--accent);
}
.hero-label { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hero-countdown {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.hero-desc { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; }
.hero-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    border-top: 1px solid var(--grid);
    padding-top: 14px;
}
.hero-meta-item { display: flex; flex-direction: column; gap: 1px; }

/* ---------- Tiles ---------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.tile { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; justify-content: center; }
.tile-label { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tile-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.tile-value small { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); }
.tile-sub { font-size: 0.78rem; color: var(--ink-2); }

.rate-meter {
    height: 6px;
    border-radius: 3px;
    background: var(--grid);
    overflow: hidden;
    margin: 6px 0 3px;
}
.rate-meter-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

/* ---------- Badges ---------- */
.badge {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--page);
    border: 1px solid var(--border);
    color: var(--ink-2);
    white-space: nowrap;
}
.badge-good { color: var(--status-good); border-color: currentColor; }
.badge-warn { color: var(--status-serious); border-color: currentColor; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--page);
    color: var(--ink-2);
    white-space: nowrap;
}
.status-badge::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
}
.st-received { color: var(--status-good); border-color: currentColor; }
.st-received::before { background: var(--status-good); }
.st-live { color: var(--status-critical); border-color: currentColor; }
.st-live::before { background: var(--status-critical); animation: pulse 1.2s ease-in-out infinite; }
.st-missed { color: var(--muted); }
.st-missed::before { background: var(--muted); }
.st-scheduled { color: var(--ink-2); }
.st-scheduled::before { background: var(--accent); }
@keyframes pulse { 50% { opacity: 0.35; } }

.elev {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 1px 9px;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-variant-numeric: tabular-nums;
}
.elev-high { color: var(--status-good); }
.elev-mid { color: var(--accent); }
.elev-low { color: var(--muted); }

/* ---------- SAGE briefing ---------- */
.sage-card { border-top: 3px solid var(--accent); }
.sage-mark {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 9px;
    vertical-align: 1px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.sage-summary {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.45;
}
.briefing-rows { display: flex; flex-direction: column; }
.briefing-row {
    display: flex;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--grid);
    font-size: 0.9rem;
}
.briefing-row:last-child { border-bottom: none; }
.briefing-when { flex: 0 0 80px; color: var(--muted); font-weight: 500; }
.briefing-text { color: var(--ink-2); }
.footnote-link { color: var(--accent); text-decoration: none; }
.footnote-link:hover { text-decoration: underline; }

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 9px 12px 9px 0;
    border-bottom: 1px solid var(--grid);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}
.data-table .cell-muted { color: var(--muted); }
.data-table .cell-strong { font-weight: 600; }
tr.row-soon td { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* ---------- Split layout ---------- */
.split-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    align-items: start;
}

/* ---------- Image grid ---------- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.image-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(11, 11, 11, 0.08), 0 8px 24px rgba(11, 11, 11, 0.08);
}
.image-card a.thumb {
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--grid);
}
.image-card a.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.image-info { padding: 10px 14px 12px; }
.image-satellite { font-weight: 600; font-size: 0.9rem; }
.image-time { font-size: 0.8rem; color: var(--ink-2); }
.image-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-2);
}
.empty-state h3 { margin-bottom: 4px; }
.empty-state p { margin: 2px 0; font-size: 0.9rem; color: var(--muted); }
.empty-icon {
    width: 44px; height: 44px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: var(--page);
    border: 1px solid var(--border);
    display: grid; place-items: center;
    color: var(--muted);
}
.empty-icon svg { width: 22px; height: 22px; }

/* ---------- Controls ---------- */
.select-control, .date-control {
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 12px;
}
.select-control:hover, .date-control:hover { border-color: var(--baseline); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-2);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 14px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { color: var(--ink); border-color: var(--baseline); }
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn.disabled { opacity: 0.45; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }
.btn-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

.control-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}
.pagination .page-info { font-size: 0.85rem; color: var(--muted); }

/* ---------- Timeline (schedule) ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
    display: flex;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--grid);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-time {
    flex: 0 0 56px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding-top: 1px;
}
.timeline-item.past .timeline-time { color: var(--muted); font-weight: 500; }
.timeline-content {
    flex: 1;
    min-width: 0;
    border-left: 3px solid var(--grid);
    padding-left: 14px;
}
.timeline-item.current .timeline-content { border-left-color: var(--status-critical); }
.timeline-item.future .timeline-content { border-left-color: var(--accent); }
.timeline-item.received-item .timeline-content { border-left-color: var(--status-good); }
.timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.timeline-sat { font-weight: 600; }
.timeline-item.past .timeline-sat { color: var(--ink-2); }
.timeline-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--ink-2);
}
.timeline-details .meta-label { margin-right: 5px; }
.timeline-details span { white-space: nowrap; }
.timeline-view { margin-top: 6px; }

.date-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 13px;
    background: var(--page);
    text-decoration: none;
    white-space: nowrap;
}
.date-chip:hover { color: var(--ink); border-color: var(--baseline); }
.date-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.date-chip .chip-note { font-size: 0.72rem; opacity: 0.75; }

/* ---------- Station / metadata grids ---------- */
.sky-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 16px;
}
.sky-item { display: flex; flex-direction: column; gap: 1px; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }

/* ---------- Image viewer ---------- */
.view-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.image-view {
    background: var(--page);
    border: 1px solid var(--grid);
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
}
.image-view img { display: block; width: 100%; height: auto; }
.view-title-sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.view-section { margin-top: 18px; }
.view-section h3 {
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 10px;
}

/* ---------- Footer (shared, rendered by tough_footer()) ---------- */
.site-footer {
    flex: 0 0 auto;
    margin-top: 28px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 12px 18px;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
}
.site-footer p, .footer-note { margin: 0; }
.site-footer a, .footer-note a { color: var(--accent); text-decoration: none; }
.site-footer a:hover, .footer-note a:hover { text-decoration: underline; }
.footer-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 36px;
    margin-bottom: 10px;
}
.footer-stat { display: flex; flex-direction: column; gap: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .hero-grid { grid-template-columns: 1fr; }
    .split-grid { grid-template-columns: 1fr; }
    .sky-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding-right: 8px; }
    .page { padding: 16px; gap: 22px; }
    .topbar-inner { padding: 10px 16px; }
    .brand-sub { display: none; }
    .hero-countdown { font-size: 2.4rem; }
    .sky-grid { grid-template-columns: repeat(2, 1fr); }
    .timeline-time { flex-basis: 46px; }
}
@media (max-width: 480px) {
    .card { padding: 14px 16px; }
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
    .tile-value { font-size: 1.25rem; }
    .hero-countdown { font-size: 2.1rem; }
    .image-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .chart-box { height: 220px; }
}

/* ---------- Mobile nav burger ---------- */
.nav-burger { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--ink); padding: 6px 9px; cursor: pointer; line-height: 0; }
.nav-burger svg { width: 18px; height: 18px; }
@media (max-width: 760px) {
    .nav-burger { display: inline-flex; }
    nav.topbar-nav { display: none; }
    nav.topbar-nav.open {
        display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
        background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
        padding: 10px 16px 14px; gap: 2px; z-index: 60;
    }
    nav.topbar-nav.open a { padding: 10px 12px; border-radius: 8px; font-size: .95rem; }
}

/* ---------- Top bar extras ---------- */
.upd { font-size: .78rem; color: var(--muted); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.live-pill:not(:has(.live-dot))::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--status-good); }
.live-pill.off::before { background: var(--muted); }
.live-pill.stale::before { background: var(--status-warning); }
.topbar-status .btn { white-space: nowrap; }

/* ---------- Compact layout (.wrap) — hero / tiles / chart / groups ---------- */
main.wrap, body > .wrap { flex: 1 1 auto; width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 22px 24px 30px; }
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 34px; margin-bottom: 10px; }
.hero .hero-label { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); width: 100%; }
.hero-big { font-size: 3.4rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.hero-big small { font-size: 1.4rem; color: var(--ink-2); font-weight: 600; }
.hero-sub { font-size: .9rem; color: var(--ink-2); max-width: 430px; }
.hero-sub b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.tiles > * { min-width: 0; }
.tiles .tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.tiles .tile b { display: block; font-size: 1.45rem; font-weight: 700; }
.tiles .tile span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tiles .tile .d { font-size: .74rem; color: var(--ink-2); margin-top: 2px; }
.wrap .card { padding: 18px; margin: 14px 0; }
.wrap .card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.wrap .card .sub { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.chart-wrap { position: relative; width: 100%; }
canvas.chart { width: 100%; height: 300px; display: block; touch-action: pan-y; }
canvas.chart.short { height: 200px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); padding: 7px 10px; font-size: .76rem; line-height: 1.45; display: none; z-index: 5; white-space: nowrap; }
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; font-size: .82rem; color: var(--ink-2); }
.chart-controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chart-controls i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.bullets { margin: 0; padding: 0; list-style: none; }
.bullets li { padding: 8px 0 8px 22px; position: relative; font-size: .9rem; color: var(--ink-2); border-bottom: 1px solid var(--grid); }
.bullets li:last-child { border-bottom: none; }
.bullets li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.groups { display: flex; flex-direction: column; gap: 2px; }
.grow { display: grid; grid-template-columns: 170px 1fr 52px; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: .86rem; }
.grow:last-child { border-bottom: none; }
.gname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); cursor: pointer; }
.gname:hover { color: var(--accent); }
.gbar { position: relative; height: 14px; background: color-mix(in srgb, var(--grid) 55%, transparent); border-radius: 7px; overflow: hidden; }
.gbar i { position: absolute; top: 0; bottom: 0; border-radius: 7px; }
.gval { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.gnote { grid-column: 1/-1; font-size: .8rem; color: var(--muted); padding: 2px 0 6px; display: none; }
.grow.open .gnote { display: block; }
details.hist { margin-top: 6px; }
details.hist summary { cursor: pointer; font-size: .85rem; color: var(--accent); font-weight: 600; }
.hist-scroll { overflow-x: auto; margin-top: 10px; }
table.hist-t { border-collapse: collapse; width: 100%; font-size: .8rem; font-variant-numeric: tabular-nums; }
.hist-t th, .hist-t td { padding: 5px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.hist-t th:first-child, .hist-t td:first-child { text-align: left; }
.hist-t th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .66rem; letter-spacing: .04em; }
@media (max-width: 760px) {
    main.wrap, body > .wrap { padding: 16px 16px 24px; }
    .hero-big { font-size: 2.6rem; }
    .tiles { grid-template-columns: repeat(2, 1fr); }
    .grow { grid-template-columns: 1fr 60px; grid-template-rows: auto auto; }
    .gname { grid-column: 1; } .gval { grid-column: 2; }
    .gbar { grid-column: 1/-1; grid-row: 2; }
    .grow .gnote { grid-column: 1/-1; }
    canvas.chart { height: 230px; }
}

/* ---------- Map apps (body.map-app: side panel + Leaflet map) ---------- */
body.map-app { height: 100vh; min-height: 0; overflow: hidden; }
body.map-app .topbar { flex: 0 0 auto; position: static; }
body.map-app .topbar-inner { max-width: 100%; padding: 10px 18px; }
body.map-app .site-footer { margin-top: 0; padding: 8px 18px; }
.rw-app { flex: 1 1 auto; display: grid; grid-template-columns: 400px 1fr; min-height: 0; max-width: 100%; overflow-x: hidden; }
.rw-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-x: hidden; padding: 14px 14px 0; max-width: 100%; }
.rw-stats { display: flex; gap: 6px; margin-bottom: 12px; width: 100%; max-width: 100%; }
.stat { flex: 1 1 0; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; text-align: center; overflow: hidden; }
.stat b { display: block; font-size: 1.3rem; font-weight: 700; }
.stat span { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-side #q { width: 100%; font: inherit; font-size: .9rem; padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--page); color: var(--ink); margin-bottom: 8px; }
.rw-side #q:focus { outline: none; border-color: var(--accent); }
.rw-filterbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; width: 100%; max-width: 100%; }
.rw-filterbar select { font: inherit; font-size: .82rem; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--page); color: var(--ink); min-width: 0; max-width: 100%; }
.chk { grid-column: 1/-1; display: flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.rw-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .72rem; color: var(--muted); margin-bottom: 10px; }
.lg { display: inline-flex; align-items: center; gap: 4px; } .lg i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.rw-list { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; margin: 0; padding: 0 0 14px; }
.item { display: flex; gap: 10px; padding: 10px 8px; border-radius: 9px; cursor: pointer; border-bottom: 1px solid var(--grid); }
.item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.item.sel { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; }
.it-body { min-width: 0; flex: 1; }
.it-top { display: flex; align-items: center; gap: 8px; }
.it-loc { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-live { flex: 0 0 auto; font-size: .6rem; font-weight: 700; letter-spacing: .04em; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); padding: 1px 6px; border-radius: 99px; }
.it-meta { font-size: .78rem; color: var(--ink-2); margin-top: 1px; }
.it-meta2 { font-size: .72rem; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { padding: 12px; text-align: center; color: var(--muted); font-size: .8rem; }
.rw-map { position: relative; min-height: 0; } .rw-map #map { position: absolute; inset: 0; }
.rw-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--page); color: var(--muted); z-index: 500; }
.pop b { font-size: .95rem; } .pop .pt { font-size: .8rem; color: #666; margin: 2px 0; } .pop p { margin: 6px 0; font-size: .85rem; } .pop .pm { font-size: .76rem; color: #888; }
.leaflet-popup-content { margin: 12px 14px; font-family: "Inter", sans-serif; }
/* dark map: filter only the basemap tiles, not our coloured vector lines */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); } }
@media (max-width: 820px) {
    /* phone: one normal scrolling page — map on top, then the panel; no nested scroll areas */
    body.map-app { height: auto; min-height: 100vh; overflow: visible; }
    .rw-app { display: flex; flex-direction: column; overflow: visible; min-height: 0; }
    .rw-map { order: 1; flex: 0 0 auto; height: 42vh; min-height: 240px; width: 100%; max-width: 100%; }
    .rw-side { order: 2; flex: 0 0 auto; display: block; height: auto; overflow: visible; border-right: none; border-top: 1px solid var(--border); width: 100%; max-width: 100%; padding-bottom: 14px; }
    .rw-list { max-height: none; overflow: visible; }
    .stat b { font-size: 1.15rem; }
}

/* ---------- Misc ---------- */
button, .btn, .btn-primary, .btn-danger, .btn-sm, .copy-btn, .speed-btn, .theme-toggle, .nav-burger, input[type=submit], .tool-tag { text-align: center; }
