/* ════════════════════════════════════════════════════════════════════════
   eRadar — iOS-inspired dark design system ("night radar": cool blue-gray
   surfaces, one accent, semantic threat hues). Tokens + rules: docs/DESIGN.md.
   ════════════════════════════════════════════════════════════════════════ */

:root {
    color-scheme: dark;

    --bg: #04060a;
    --bg-soft: #0c0f14;
    --mat: rgba(15, 19, 25, 0.72);        /* translucent elevated material */
    --mat-solid: #13171e;                  /* opaque fallback / cards */
    --mat-hi: rgba(55, 62, 74, 0.55);      /* pressed / selected segment */
    --hair: rgba(150, 172, 205, 0.10);     /* hairline borders */
    --sep: rgba(112, 122, 138, 0.22);      /* segment track */

    --ink: #f2f6fb;
    --ink-2: rgba(230, 238, 247, 0.66);
    --ink-3: rgba(230, 238, 247, 0.38);

    --accent: #0a84ff;
    --accent-ink: #eaf4ff;
    --red: #ff453a;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --green: #32d74b;
    --purple: #bf5af2;
    --teal: #64d2ff;

    /* threat palette (drone=orange …) — used by inline styles in JS too */
    --t-drone: var(--orange);
    --t-ballistic: var(--red);
    --t-cruise: #ff6b35;
    --t-kab: var(--purple);
    --t-aviation: var(--accent);
    --t-recon: var(--teal);
    --t-unknown: #8e8e93;

    --radius-lg: 20px;
    --radius: 14px;
    --radius-sm: 10px;

    --font:
        -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.5), 0 18px 48px rgba(0, 0, 0, 0.55);
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);

    /* dock geometry: bottom row (timecard + legend strip) shares one
       baseline; the rail ends exactly above the legend strip */
    --dockB: calc(26px + var(--sab));  /* leaves a sliver for attribution */
    --metaH: 56px;
}

* { box-sizing: border-box; }

/* component display rules (flex/grid/inline-flex) beat the UA [hidden] rule —
   restore the expected invariant once, globally */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:active { opacity: 0.6; }

::selection { background: rgba(10, 132, 255, 0.35); }

/* thin, unobtrusive scrollbars (Firefox) */
* { scrollbar-width: thin; scrollbar-color: rgba(148,148,160,.25) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(148,148,160,.22); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── inline SVG icons ─────────────────────────────────────────────────── */

.ic {
    width: 1em; height: 1em;
    display: inline-block;
    vertical-align: -0.14em;
    flex: 0 0 auto;
}
.brand .logo .ic { font-size: 17px; }
.btn .ic, .iconbtn .ic { font-size: 15px; }
.iconbtn .ic { display: block; }
.seg a .ic { font-size: 13px; margin-right: 4px; }
.badge .ic { font-size: 10.5px; margin-right: 3px; }
.reply-quote .ic { font-size: 11px; }
.pop-goto .ic { font-size: 13px; }

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
    -webkit-appearance: none; appearance: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--hair);
    background: rgba(118, 118, 128, 0.16);
    color: var(--ink);
    font: inherit; font-weight: 600; font-size: 13px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(118, 118, 128, 0.3); }
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #2a95ff; }
.btn.danger { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.35); color: #ff6961; }
.btn.danger:hover { background: rgba(255, 69, 58, 0.24); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.btn.sm { padding: 5px 12px; font-size: 12px; }

/* icon-ish square buttons (play, speed, close…) */
.iconbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid var(--hair);
    background: rgba(118, 118, 128, 0.16);
    color: var(--ink);
    font: inherit; font-size: 15px; font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.iconbtn:hover { background: rgba(118, 118, 128, 0.32); }
.iconbtn:active { transform: scale(0.94); }
.iconbtn.on { background: rgba(10, 132, 255, 0.18); color: var(--accent); border-color: rgba(10, 132, 255, 0.4); }

/* ── segmented control (iOS style) ──────────────────────────────────────── */

.seg {
    display: inline-flex; align-items: stretch;
    padding: 2px; gap: 1px;
    background: var(--sep);
    border-radius: 11px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; background: transparent;
    padding: 6px 14px;
    border-radius: 9px;
    color: var(--ink-2);
    font: inherit; font-size: 12.5px; font-weight: 600;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.seg a.active, .seg button.active {
    background: #636366;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.seg a:hover:not(.active), .seg button:hover:not(.active) { color: var(--ink); }

/* ── cards & layout ─────────────────────────────────────────────────────── */

.card {
    background: var(--mat-solid);
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 16px 18px;
}

.card.no-pad { padding: 0; }

.glass {
    background: var(--mat);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    backdrop-filter: blur(22px) saturate(1.6);
    border: 1px solid var(--hair);
    box-shadow: var(--shadow-1);
}

/* inner pages */
.page { min-height: 100%; display: flex; flex-direction: column; }

.appbar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px calc(14px + var(--sar)) 10px calc(14px + var(--sal));
}
.appbar .brand { flex: 0 0 auto; }
.appbar .seg { flex: 0 1 auto; order: 0; }
.appbar .spacer { flex: 1 1 0; min-width: 0; }
.appbar .toolbar { flex: 0 0 auto; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
    display: grid; place-items: center;
    /* night-radar tile; the glyph carries the UA blue/yellow */
    background: linear-gradient(165deg, #152a45 0%, #0c1626 100%);
    box-shadow: inset 0 0 0 1px rgba(110, 160, 255, 0.22), 0 4px 14px rgba(10, 90, 200, 0.28);
}
.brand h1 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand p { margin: 0; font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.02em; }

.page-main {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 18px calc(14px + var(--sar)) calc(48px + var(--sab)) calc(14px + var(--sal));
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.page-head h2 { margin: 0 0 3px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-head .sub { color: var(--ink-2); font-size: 12.5px; max-width: 62ch; }

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

input[type="search"], input[type="text"], input[type="number"], input[type="password"], select {
    background: rgba(118, 118, 128, 0.14);
    border: 1px solid var(--hair);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    font: inherit; font-size: 13px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
input:focus, select:focus { outline: none; border-color: var(--accent); background: rgba(118, 118, 128, 0.22); }

/* ── feed (audit page + map ticker share these) ────────────────────────── */

.feed-list { display: flex; flex-direction: column; gap: 12px; }

.feed-card {
    background: var(--mat-solid);
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    padding: 14px 16px;
    animation: card-in 0.35s ease both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.feed-card .head, .tick .meta {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: 11px; color: var(--ink-3);
}
.feed-card .head { margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.feed-card .head .head-right { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.feed-card .head .ch, .tick .meta .ch { color: var(--ink-2); font-weight: 700; }
.feed-card .text, .tick .body {
    font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
    word-break: break-word; color: #dbe4f0;
}

.load-more-wrap { text-align: center; margin-top: 18px; padding-bottom: 20px; }

/* search input — flex-friendly width */
.search-wide { width: 220px; max-width: 100%; min-width: 140px; }

/* drawer header & title */
.drawer-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.drawer-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }

/* drawer section headings */
.drawer-h3 { font-size: 13px; font-weight: 700; margin: 20px 0 8px; letter-spacing: -0.01em; }
.drawer-h3:first-of-type { margin-top: 18px; }
.drawer-h3.danger { color: #ff6961; }

/* alias chips container */
.alias-chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }

/* alias form row */
.alias-form { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.alias-form input { flex: 1; min-width: 0; }

/* alias hint text */
.alias-hint { font-size: 10.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.4; }

/* generic drawer section spacing */
.drawer-section { margin-top: 14px; }

/* generic full-width utility for grid children */
.full-width { grid-column: 1 / -1; }

/* auth back link */
.auth-back { text-align: center; margin-top: 14px; }
.auth-back a { font-size: 12.5px; }

.mention-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.mention {
    background: rgba(118, 118, 128, 0.1);
    border: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
}
.mention .m-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.mention .m-head .frag { font-weight: 700; color: var(--ink); }
.mention .resolved { color: var(--ink-2); font-size: 11.5px; margin-top: 5px; line-height: 1.55; }
.mention .unresolved { color: var(--yellow); font-size: 11.5px; margin-top: 5px; }
.mention .reasoning {
    margin-top: 6px; font-size: 11px; color: var(--ink-3); font-style: italic;
    border-left: 2px solid var(--sep); padding-left: 8px;
}
.trace-toggle { margin-top: 8px; }
.trace-toggle summary { cursor: pointer; font-size: 11px; color: var(--accent); }
.trace-pre {
    margin-top: 6px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 10.5px; line-height: 1.5; color: var(--ink-2);
    background: rgba(0, 0, 0, 0.45); border: 1px solid var(--hair);
    border-radius: 8px; padding: 9px 11px;
    white-space: pre-wrap; word-break: break-word;
    max-height: 340px; overflow: auto;
}

.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; }
.pw-reveal {
    margin-top: 10px; padding: 12px 14px;
    background: rgba(0, 0, 0, 0.4); border: 1px solid var(--hair); border-radius: 10px;
    font-size: 16px; letter-spacing: 0.04em; word-break: break-all; user-select: all;
}

/* badges */
.badge {
    display: inline-flex; align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--hair);
    background: rgba(118, 118, 128, 0.12);
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
    color: var(--ink-2);
    white-space: nowrap;
}
.badge.src-static { color: #a8e06a; border-color: rgba(168, 224, 106, 0.4); }
.badge.src-cache { color: var(--teal); border-color: rgba(100, 210, 255, 0.4); }
.badge.src-nominatim { color: var(--orange); border-color: rgba(255, 159, 10, 0.45); }
.badge.src-llm { color: #d9a6f5; border-color: rgba(191, 90, 242, 0.45); }
.badge.src-manual { color: #7fb7ff; border-color: rgba(10, 132, 255, 0.5); }
.badge.tg { color: #8ec9ff; border-color: rgba(10, 132, 255, 0.35); }

a.tg-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
a.tg-link svg { flex: 0 0 auto; }

.place-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(118, 118, 128, 0.16);
    border: 1px solid var(--hair);
    font-size: 11px; font-weight: 600; color: var(--ink-2);
    white-space: nowrap;
}
.place-chip .alias-del { color: #ff6961; display: inline-flex; align-items: center; }
.place-chip .alias-del .ic { font-size: 11px; }
.alias-hint .ic { font-size: 10px; }

.empty { color: var(--ink-3); text-align: center; padding: 44px 0; font-size: 13px; }

/* reply + media */
.reply-quote {
    margin: 6px 0;
    padding: 6px 10px;
    border-left: 2px solid rgba(10, 132, 255, 0.55);
    background: rgba(10, 132, 255, 0.07);
    border-radius: 0 8px 8px 0;
    font-size: 11.5px; color: var(--ink-2);
    white-space: pre-wrap; word-break: break-word;
}
.reply-quote .ic { margin-right: 2px; }
.msg-img { max-width: 100%; max-height: 180px; border-radius: 10px; margin-top: 8px; display: block; border: 1px solid var(--hair); cursor: zoom-in; }

#imgModal {
    position: fixed; inset: 0; z-index: 3000;
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    cursor: zoom-out;
    padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab));
}
#imgModal.open { display: flex; }
#imgModal img { max-width: 92vw; max-height: 92vh; border-radius: 14px; border: 1px solid var(--hair); box-shadow: var(--shadow-2); }

/* ── tables (places) ───────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}

table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
table.grid th {
    position: sticky; top: 0; z-index: 2;
    background: var(--mat-solid);
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3);
}
table.grid tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* drawer / side panel (places) */
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 2000;
    width: min(480px, 94vw);
    background: var(--mat-solid);
    border-left: 1px solid var(--hair);
    box-shadow: var(--shadow-2);
    padding: 18px calc(18px + var(--sar)) calc(18px + var(--sab)) 18px;
    overflow-y: auto;
    transform: translateX(105%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.drawer.open { transform: none; }

.drawer-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.drawer-form label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.drawer-form label input { width: 100%; }
.drawer-form .full-width { grid-column: 1 / -1; }

.scrim {
    position: fixed; inset: 0; z-index: 1900;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* auth (operator login / account pages — no product UI uses these) */
.auth-wrap {
    min-height: 100dvh;
    display: grid; place-items: center;
    padding: 24px calc(24px + var(--sar)) calc(24px + var(--sab)) calc(24px + var(--sal));
    background:
        radial-gradient(1100px 650px at 18% -10%, rgba(10, 132, 255, 0.14), transparent 60%),
        radial-gradient(820px 560px at 108% 32%, rgba(100, 210, 255, 0.08), transparent 55%),
        var(--bg);
}
.auth-card {
    width: min(380px, 100%);
    background: var(--mat);
    -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid var(--hair);
    border-radius: 24px;
    padding: 28px 26px;
    box-shadow: var(--shadow-2);
}
.auth-card .brand-title { margin: 0; font-size: 17px; }
.auth-card .brand-sub { margin: 0; }
.auth-card h1 { margin: 14px 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--ink-3); font-size: 12.5px; margin-bottom: 18px; }
.auth-card form { display: grid; gap: 8px; }
.auth-card label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); margin-top: 10px; font-weight: 600; }
.auth-card input { width: 100%; font-size: 15px; padding: 11px 12px; border-radius: 12px; }
.auth-card .btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.auth-err { color: #ff6961; font-size: 12.5px; min-height: 18px; margin-top: 8px; text-align: center; }
.auth-ok { color: var(--green); font-size: 12.5px; min-height: 18px; margin-top: 8px; text-align: center; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-top: 14px; }
.auth-card .back-link { font-size: 12.5px; text-align: center; margin-top: 14px; }

/* account page */
.account-card { width: min(430px, 100%); }
.acct-id { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 14px; }
.acct-id b { font-weight: 600; word-break: break-all; }
#homeSearch { width: 100%; margin-top: 10px; }
.home-current { margin-top: 10px; min-height: 20px; }
.home-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 8px 6px 12px;
    border-radius: 999px;
    background: rgba(10, 132, 255, 0.12); border: 1px solid rgba(10, 132, 255, 0.35);
    font-size: 13px; font-weight: 600;
}
.home-chip .ic { color: var(--accent); }
.home-chip button { display: inline-flex; background: none; border: none; color: var(--ink-3); cursor: pointer; padding: 3px; border-radius: 50%; }
.home-chip button:hover { color: #ff6961; }
.home-none { color: var(--ink-3); font-size: 12.5px; }
/* iOS app settings block (account page, in-app only) */
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 6px; cursor: pointer; font-size: 14px; }
.check-row input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.app-widget-btn { width: 100%; margin-top: 10px; }
.home-results { display: grid; gap: 4px; margin-top: 6px; }
.home-results button {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    text-align: left; width: 100%;
    background: rgba(118, 118, 128, 0.1); border: 1px solid var(--hair); border-radius: 10px;
    padding: 9px 12px; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
}
.home-results button:hover { border-color: rgba(10, 132, 255, 0.45); }
.home-results .kind { color: var(--ink-3); font-size: 11px; flex: 0 0 auto; }

/* home marker on the map */
.home-marker {
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(10, 132, 255, 0.92); color: #fff;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.28), 0 2px 10px rgba(0, 0, 0, 0.5);
}
.home-marker .ic { font-size: 14px; }
.home-tip {
    background: rgba(19, 23, 30, 0.94) !important;
    border: 1px solid var(--hair) !important;
    color: var(--ink) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-1) !important;
    font-family: var(--font) !important;
    font-size: 11px !important; font-weight: 600;
}
.home-tip::before { border-top-color: rgba(19, 23, 30, 0.94) !important; }

/* ════════════════ MAP PAGE ════════════════ */

body.map-page { overflow: hidden; height: 100dvh; }

#map { position: absolute; inset: 0; background: #05070b; z-index: 0; }

/* floating brand chip — the only always-on chrome (desktop + mobile) */
.brandchip {
    position: absolute; z-index: 1000;
    top: calc(10px + var(--sat));
    left: calc(12px + var(--sal));
    display: flex; align-items: center; gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: 13px;
}
.brandchip h1 { font-size: 15px; }

/* desktop: nav above the live-events rail (bare seg, no card) */
.topside {
    position: absolute; z-index: 1000;
    top: calc(10px + var(--sat));
    right: calc(12px + var(--sar));
    width: 384px;
    display: flex; align-items: center; justify-content: flex-end;
}

/* connection state surfaces only on failure — calm by default */
.connpill {
    position: absolute; z-index: 1100;
    top: calc(12px + var(--sat)); left: 50%; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 69, 58, 0.14);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 69, 58, 0.4);
    color: #ff8a80; font-size: 11.5px; font-weight: 600;
    white-space: nowrap;
}
.connpill i {
    width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
    background: var(--red); box-shadow: 0 0 8px rgba(255, 69, 58, 0.8);
    animation: conn-blink 1.6s ease-in-out infinite;
}
@keyframes conn-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.connpill[hidden] { display: none; }

/* mobile: hamburger opens the side menu (nav/stats/legend/auth) */
.menu-btn {
    display: none;
    position: absolute; z-index: 1000;
    top: calc(10px + var(--sat));
    right: calc(12px + var(--sar));
}

.stat { text-align: center; min-width: 0; }
.stat b { display: block; font-size: 16px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); }

/* mobile side menu (one overlay at a time with the events sheet) */
.menu {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1300;
    width: min(320px, 88vw);
    display: flex; flex-direction: column; gap: 16px;
    background: var(--mat-solid);
    border-left: 1px solid var(--hair);
    box-shadow: var(--shadow-2);
    padding: 16px calc(16px + var(--sar)) calc(18px + var(--sab)) 16px;
    overflow-y: auto;
    transform: translateX(105%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
body.menu-open .menu { transform: none; }
body.menu-open .scrim { opacity: 1; pointer-events: auto; }
.menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.menu-head .brand p { margin-top: 1px; }
.menu .legend { display: block; margin-top: 0; }
.menu .legend summary { font-size: 12px; }

/* mobile menu: brand + vertical nav + city row + counters + legend */
.menu-stats { display: flex; gap: 8px; }
.menu-stats .stat {
    flex: 1 1 0; min-width: 0;
    background: rgba(118, 118, 128, 0.1);
    border: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    padding: 10px 4px;
}

/* vertical nav variant inside the menu */
.seg.vert { flex-direction: column; align-items: stretch; gap: 2px; padding: 4px; border-radius: var(--radius); }
.seg.vert a, .seg.vert button { justify-content: flex-start; padding: 10px 12px; font-size: 13.5px; border-radius: 10px; }

/* right rail / bottom sheet (live feed) */
.rail {
    position: absolute; z-index: 900;
    top: calc(62px + var(--sat));   /* under the topside strip */
    bottom: calc(26px + var(--metaH) + 10px + var(--sab)); /* clears .mapmeta */
    right: calc(12px + var(--sar));
    width: 384px;
    display: flex; flex-direction: column;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.rail-head { padding: 14px 16px 10px; }
.rail-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.rail-head .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.ticker {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 10px 12px 18px;
    display: flex; flex-direction: column; gap: 8px;
}

.tick {
    background: rgba(118, 118, 128, 0.1);
    border: 1px solid var(--hair);
    border-left: 3px solid var(--t-unknown);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    animation: tick-in 0.3s ease both;
}
@keyframes tick-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }
.tick .meta { margin-bottom: 4px; gap: 6px; }
.tick .meta .meta-right { display: inline-flex; align-items: center; gap: 6px; }
.tick .body { font-size: 12.5px; line-height: 1.45; }
.tick .places { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }

.tick.t-drone { border-left-color: var(--t-drone); }
.tick.t-ballistic { border-left-color: var(--t-ballistic); }
.tick.t-cruise { border-left-color: var(--t-cruise); }
.tick.t-kab { border-left-color: var(--t-kab); }
.tick.t-aviation { border-left-color: var(--t-aviation); }
.tick.t-recon { border-left-color: var(--t-recon); }

.tick.focusable { cursor: pointer; }
.tick.focusable:hover { border-color: rgba(10, 132, 255, 0.45); }
.tick.flash { animation: tick-flash 1.6s ease; }
@keyframes tick-flash { 0% { background: rgba(10, 132, 255, 0.32); } 100% { background: rgba(118, 118, 128, 0.1); } }

/* legend: in the rail header for the mobile sheet, and as an
   always-visible strip (bottom-right, desktop) — see .mapmeta */
.legend { display: none; margin-top: 10px; }
.legend summary {
    cursor: pointer; font-size: 11px; color: var(--ink-3);
    list-style: none; user-select: none;
}
.legend summary::-webkit-details-marker { display: none; }
.legend .items { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 6px; }
.legend .item, .legend-wide .item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.legend .swatch, .legend-wide .swatch { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 6px currentColor; flex: 0 0 auto; }

/* desktop bottom-right strip: legend + zoom. Fixed grid (3×2, compact
   labels) so the strip height never depends on wrapping — the rail above
   reserves exactly --metaH, so the two can never overlap the events. */
.mapmeta {
    position: absolute; z-index: 940;
    right: calc(12px + var(--sar));
    bottom: var(--dockB);
    width: 384px; height: var(--metaH);
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px 8px 14px;
    border-radius: var(--radius);
}
.legend-wide {
    flex: 1 1 auto; min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 10px;
    align-items: center;
}
.legend-wide .item { min-width: 0; font-size: 10.5px; }
.legend-wide .item .lbl { overflow: hidden; text-overflow: ellipsis; }
.zoomctl { display: flex; gap: 6px; flex: 0 0 auto; }
.zoomctl .iconbtn { width: 32px; height: 32px; }
.zoomctl .iconbtn .ic { font-size: 14px; }

/* map marker */
.danger-marker { position: relative; pointer-events: auto; width: 20px; height: 20px; }
.danger-marker .core {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 10px; height: 10px; border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor, 0 0 2px #000;
}
.danger-marker .ring {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 22px; height: 22px; border-radius: 50%;
    border: 1.5px solid currentColor; opacity: 0.55;
}
.danger-marker .ring.pulse { animation: ring-pulse 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite; }
@keyframes ring-pulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.9; }
    70% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; }
}
.danger-marker.fading { opacity: 0.45; }
.danger-marker.fading .ring { border-style: dashed; }
.danger-marker .tag {
    position: absolute; left: 50%; top: -20px; transform: translateX(-50%);
    background: rgba(12, 15, 20, 0.88);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid var(--hair);
    color: var(--ink); font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 999px;
    white-space: nowrap;
}

/* leaflet popups as glass cards */
.leaflet-popup-content-wrapper {
    background: rgba(19, 23, 30, 0.94) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
    color: var(--ink) !important;
    border: 1px solid var(--hair);
    border-radius: 16px !important;
    box-shadow: var(--shadow-2) !important;
}
.leaflet-popup-tip { background: rgba(19, 23, 30, 0.94) !important; }
.leaflet-popup-content { font-family: var(--font) !important; font-size: 12.5px !important; line-height: 1.5 !important; margin: 14px 16px !important; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-3) !important; width: 22px !important; height: 22px; }

.pop-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; letter-spacing: -0.01em; }
.pop-row { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); font-size: 11.5px; padding: 2px 0; }
.pop-row b { color: var(--ink); font-weight: 600; }
.pop-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pop-goto {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(10, 132, 255, 0.16);
    border: 1px solid rgba(10, 132, 255, 0.4);
    color: #bfe0ff; font-weight: 600; font-size: 12px;
    cursor: pointer; transition: background 0.15s ease, transform 0.12s ease;
}
.pop-goto:hover { background: rgba(10, 132, 255, 0.3); }
.pop-goto:active { transform: scale(0.95); }

/* ── timebar: the whole time entity (transport + histogram + slider) is one
      collapsible card, hidden by default — opened by the «Історія» dock
      button, closed by its own ✕ ── */
.timecard {
    position: absolute; z-index: 950;
    left: calc(12px + var(--sal));
    right: calc(408px + var(--sar)); /* 384 rail + 12 gap + 12 inset */
    bottom: calc(26px + 40px + 8px + var(--sab)); /* above the dock FAB */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 9px 12px 10px;
    border-radius: var(--radius);
    animation: card-in 0.22s ease both;
}
.timecard[hidden] { display: none; }
.tb-controls { display: flex; align-items: center; gap: 6px; }
.tb-controls #timeLabel { margin-left: auto; }
.timecard .iconbtn { width: 30px; height: 30px; min-width: 30px; padding: 0; }
.timecard .iconbtn .ic { font-size: 12.5px; }
#timeClose { margin-left: 2px; }

#timeChart { display: block; width: 100%; height: 48px; pointer-events: none; }
#timeSlider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 26px; margin: 0;
    background: transparent; cursor: pointer;
    touch-action: pan-y;
}
#timeSlider::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: rgba(118, 118, 128, 0.38); }
#timeSlider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; margin-top: -7px;
    border-radius: 50%; border: none;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
#timeSlider::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(118, 118, 128, 0.38); }
#timeSlider::-moz-range-thumb {
    width: 18px; height: 18px; border: none; border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
#timeLabel { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 68px; text-align: right; }
.timecard.history #timeLabel { color: var(--yellow); font-weight: 700; }
.timecard.history #timeSlider::-webkit-slider-thumb { background: var(--yellow); }
.timecard.history #timeSlider::-moz-range-thumb { background: var(--yellow); }

.tb-live {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 13px; border-radius: 999px;
    background: rgba(48, 209, 88, 0.13);
    border: 1px solid rgba(48, 209, 88, 0.32);
    color: #59e184; font-weight: 700; font-size: 12px;
    cursor: pointer; transition: all 0.18s ease;
    font-family: inherit;
}
/* calm state dot instead of a loud solid fill */
.tb-live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: currentColor; box-shadow: 0 0 8px currentColor; flex: 0 0 auto;
}
/* history mode: the same button reads “back to live” in amber */
.timecard.history .tb-live {
    background: rgba(255, 214, 10, 0.1);
    border-color: rgba(255, 214, 10, 0.32);
    color: var(--yellow);
}

/* ── flag popover ── */
.flag-wrap { position: relative; display: inline-flex; }
.flag-btn {
    width: 26px; height: 26px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--hair);
    background: rgba(118, 118, 128, 0.14);
    font-size: 12px; font-family: inherit; color: var(--ink-2);
    cursor: pointer; opacity: 0.65;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.flag-btn:hover, .flag-btn.flagged { opacity: 1; }
.flag-btn.flagged { background: rgba(255, 69, 58, 0.22); border-color: rgba(255, 69, 58, 0.45); color: #ff6961; }
.flag-pop {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 2500;
    display: grid; gap: 2px; padding: 6px;
    background: rgba(24, 29, 37, 0.96);
    -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid var(--hair);
    border-radius: 12px;
    box-shadow: var(--shadow-2);
    min-width: 170px;
    animation: card-in 0.16s ease both;
}
.flag-pop button {
    appearance: none; border: 0; background: transparent;
    color: var(--ink-2); font: inherit; font-size: 12px;
    text-align: left; padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.flag-pop button:hover { background: rgba(10, 132, 255, 0.16); color: var(--ink); }

/* ── stats page ── */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.card .k { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); font-weight: 700; }
.card .big { font-size: 27px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card .sub2 { font-size: 11.5px; color: var(--ink-2); margin-top: 5px; }

.sect { padding: 16px 18px; margin-bottom: 14px; }
.sect h2 { margin: 0 0 12px; font-size: 14px; letter-spacing: -0.01em; }

.bar-row { display: grid; grid-template-columns: minmax(96px, 190px) 1fr auto; align-items: center; gap: 10px; margin: 6px 0; font-size: 12px; }
.bar-row .lbl { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 8px; border-radius: 999px; background: rgba(118, 118, 128, 0.16); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.bar-row .val { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 11.5px; white-space: nowrap; }
.bar-row.src-static .fill { background: var(--green); }
.bar-row.src-cache .fill { background: var(--teal); }
.bar-row.src-nominatim .fill { background: var(--orange); }
.bar-row.src-llm .fill { background: var(--purple); }
.bar-row.src-manual .fill { background: var(--red); }
.bar-row.src-rejected .fill, .bar-row.src-unresolved .fill { background: #636366; }
.bar-row.src-flag .fill { background: var(--yellow); }

/* dock FABs — «Історія» (left, all viewports) and «Події» (right, phones):
   same baseline as the legend strip; each hides while its card is open.
   Base rules must precede the media queries below (same-specificity
   cascade: the ≤1023px block re-enables .rail-fab). */
.dockfab {
    position: fixed; z-index: 960;
    bottom: var(--dockB);
    /* opaque enough that map labels/attribution never bleed through */
    background: rgba(19, 23, 30, 0.88);
    -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
    transition: opacity 0.2s ease, transform 0.12s ease;
}
.time-fab { left: calc(12px + var(--sal)); }
.rail-fab { right: calc(12px + var(--sar)); display: none; }
.dockfab:active { transform: scale(0.95); }
body.rail-open .rail-fab, body.time-open .time-fab { opacity: 0; pointer-events: none; }
.fab-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 999px;
    background: var(--red); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
    font-variant-numeric: tabular-nums;
}

/* ── home city card: the map's only preference, stored on the device ──
   Opened by the topside pill (desktop) or the menu row (mobile). Rides the
   timebar's baseline, so nothing in the dock moves when it appears. */
.citycard {
    position: absolute; z-index: 950;
    left: calc(12px + var(--sal));
    right: calc(408px + var(--sar));   /* 384 rail + 12 gap + 12 inset */
    bottom: calc(26px + 40px + 8px + var(--sab));
    max-width: 340px;
    display: flex; flex-direction: column; gap: 6px;
    padding: 10px 12px 12px;
    border-radius: var(--radius);
    animation: card-in 0.22s ease both;
}
.citycard[hidden] { display: none; }
.citycard .iconbtn { width: 30px; height: 30px; min-width: 30px; padding: 0; }
.citycard .iconbtn .ic { font-size: 12.5px; }
.citycard input[type="search"] { width: 100%; }
.citycard .sub { color: var(--ink-3); font-size: 11.5px; line-height: 1.45; }
.cc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cc-title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.citycard .home-results { max-height: 32vh; overflow-y: auto; overscroll-behavior: contain; }

/* topside (desktop): the "my city" pill sits left of the nav seg — it is the
   map's only preference control, and with no accounts it has to live on the
   map itself, not on an account page */
.citypill {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
    height: 30px; padding: 0 11px; margin-right: 8px;
    border-radius: 999px;
    background: rgba(118, 118, 128, 0.16); border: 1px solid var(--hair);
    color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600;
    white-space: nowrap; cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}
.citypill .ic { font-size: 13px; }
/* a village name must not push the nav seg off-screen */
.citypill span { max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citypill:hover { color: var(--ink); }
.citypill:active { transform: scale(0.96); }
.citypill.has-home { color: var(--accent); background: rgba(10, 132, 255, 0.16); border-color: rgba(10, 132, 255, 0.4); }

/* mobile menu: «Моє місто» row (opens the same card) */
.menu-city { display: grid; gap: 6px; }
.rowbtn {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: rgba(118, 118, 128, 0.1); border: 1px solid var(--hair);
    border-radius: var(--radius-sm); padding: 11px 12px;
    color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600;
    text-align: left; cursor: pointer;
}
.rowbtn .ic { flex: 0 0 auto; font-size: 15px; color: var(--accent); }
.rowbtn-label { flex: 0 0 auto; }
.rowbtn-value {
    flex: 1 1 auto; min-width: 0; text-align: right;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500; color: var(--ink-3);
}
.rowbtn-chev { flex: 0 0 auto; font-size: 13px; color: var(--ink-3); }
/* app-only settings (region alerts, widget how-to) — moved out of /account,
   which required an account; gated on inERadarApp() in map.js */
.menu-app { display: grid; gap: 6px; }
.menu-app .drawer-h3 { margin: 2px 0 4px; }
.menu-app .sub { font-size: 11.5px; color: var(--ink-3); }

/* login: plain card on the auth background (see .auth-wrap) */
.login-card { max-width: 380px; }

/* ════════════════ RESPONSIVE ════════════════ */
#drawerClose { display: none; }

/* wide screens */
@media (min-width: 1400px) {
    .page-main { padding-left: calc(32px + var(--sal)); padding-right: calc(32px + var(--sar)); }
}

/* tablets */
@media (max-width: 1180px) {
    .rail { width: 330px; }
    .topside { width: 330px; }
    .timecard { right: calc(354px + var(--sar)); } /* 330 + 12 gap + 12 inset */
    .citycard { right: calc(354px + var(--sar)); }
    .mapmeta { width: 330px; }
}

/* single-column small screens: rail becomes bottom sheet */
@media (max-width: 1023px) {
    /* chrome collapses to: brand chip (left) + menu button (right) */
    .topside { display: none; }
    .menu-btn { display: inline-flex; }

    .seg a, .seg button { padding: 5px 10px; font-size: 11.5px; }

    /* legend strip yields to <details> in the sheet/menu; zoom is pinch */
    .mapmeta { display: none; }
    .legend { display: block; }

    .timecard { right: calc(12px + var(--sar)); }
    .citycard { right: calc(12px + var(--sar)); max-width: none; }
    .timecard .iconbtn { width: 36px; height: 36px; min-width: 36px; }
    #timeSlider { height: 32px; } /* fatter grab area for touch */
    #timeChart { height: 44px; }
    #drawerClose { display: inline-flex; }
    .rail-fab { display: inline-flex; }
    /* the events FAB rides above the open timecard */
    body.time-open .rail-fab { bottom: calc(26px + 40px + 8px + 135px + 8px + var(--sab)); }

    .rail {
        top: auto; bottom: 0; left: 0; right: 0;
        width: auto; height: min(72dvh, 560px);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-left: 1px solid var(--hair); border-right: 1px solid var(--hair); border-bottom: 0;
        transform: translateY(102%);
        transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
        padding-bottom: var(--sab);
        z-index: 1300;
    }
    body.rail-open .rail { transform: none; }
    body.rail-open .scrim { opacity: 1; pointer-events: auto; }
    .scrim { z-index: 1200; }

    /* Inner pages */
    .appbar { gap: 8px; padding: 8px calc(12px + var(--sar)) 8px calc(12px + var(--sal)); }
    .appbar .seg a, .appbar .seg button { padding: 5px 10px; font-size: 11.5px; }
    .page-main { padding: 14px calc(12px + var(--sar)) calc(48px + var(--sab)) calc(12px + var(--sal)); }
    .page-head { gap: 10px; }
    .page-head h2 { font-size: 20px; }
    .toolbar { gap: 6px; }
    .drawer-form { grid-template-columns: 1fr; }
}

/* phones */
@media (max-width: 620px) {
    .brandchip { padding: 4px 10px 4px 4px; }
    .stat b { font-size: 13px; }
    .stat span { font-size: 8px; }
    .conn { font-size: 10.5px; padding: 3px 8px; }

    .seg a, .seg button { padding: 5px 8px; font-size: 11px; }

    .timecard { padding: 8px 10px; }
    .tb-live { padding: 5px 11px; font-size: 11.5px; }
    .timecard .iconbtn { width: 34px; height: 34px; min-width: 34px; }
    
    .appbar .seg a, .appbar .seg button { padding: 5px 8px; font-size: 11px; }
    .page-head h2 { font-size: 18px; }
    .page-head .sub { font-size: 11.5px; }
    
    .cards { grid-template-columns: 1fr; }
    .card .big { font-size: 22px; }
    
    .feed-card { padding: 12px 14px; }
    .mention { padding: 8px 10px; }
    
    table.grid { font-size: 11.5px; }
    table.grid th, table.grid td { padding: 7px 8px; }
    
    .auth-card { padding: 22px 20px; border-radius: 20px; }
    .auth-card h1 { font-size: 20px; }
    
    .bar-row { grid-template-columns: minmax(70px, 140px) 1fr auto; gap: 8px; }
}

/* leaflet chrome tuned to the design system */
.leaflet-top, .leaflet-bottom { z-index: 800; }
.leaflet-control-attribution {
    background: rgba(8, 8, 11, 0.55) !important;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    color: var(--ink-3) !important;
    font-size: 9px !important;
    padding: 2px 8px !important;
    border-radius: 8px 0 0 0;
}
.leaflet-control-attribution a { color: var(--ink-2) !important; }
/* Administrative captions label footprints; they carry no threat-point glyph. */
.area-caption-wrap { background: none; border: 0; text-align: center; }
.area-caption { display: inline-block; max-width: 180px; font-size: 11px; line-height: 1.3;
    color: var(--ink); text-shadow: 0 1px 4px #000, 0 0 10px #000;
    background: rgba(4,6,10,.5); border-radius: 5px; padding: 3px 5px; }
.motion-toggle { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.motion-toggle input { accent-color: #8fbce8; width: 16px; height: 16px; }
.motion-hint { font-size: 11px; color: var(--ink-2); margin: 6px 0 0; }
.motion-target { background: none; border: 0; filter: drop-shadow(0 0 5px #7daed0); }
.motion-target svg { width: 28px; height: 28px; fill: #b4d5f1; stroke: #071424; stroke-width: .7; }
