/* ============ tokens ============ */
:root {
  --top-h: 60px;
  --side-w: 300px;
  --drawer-w: 480px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f3;
  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --text: #0f1729;
  --text-2: #4a5567;
  --text-3: #8791a3;
  --accent: #e8590c;
  --accent-hover: #d14f09;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e6;
  --ring: rgba(232, 89, 12, 0.28);

  --open: #0c8a5f;       --open-soft: #e3f5ec;
  --soon: #a86200;       --soon-soft: #fff3d6;
  --closed: #5e6878;     --closed-soft: #edf0f3;
  --past: #8a93a3;       --past-soft: #f0f2f5;
  --cancel: #c02a1e;     --cancel-soft: #fdeceb;
  --full: #d42d1f;       --warm: #d98200;

  --f-ipsc: #e8590c; --f-sra: #2563eb; --f-prs: #7c3aed; --f-nrof: #0d9488; --f-idpa: #db2777;
  --f-steel: #64748b; --f-ntsa: #ca8a04; --f-dmr: #4f46e5; --f-resul: #059669; --f-other: #94a3b8;

  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.06);
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.05), 0 4px 12px rgba(15, 23, 41, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 41, 0.18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e15; --surface: #111722; --surface-2: #151c29; --surface-3: #1c2433;
    --border: #222b3b; --border-strong: #303b50; --text: #e7ebf2; --text-2: #a9b3c4; --text-3: #6f7a8e;
    --accent: #ff7a2e; --accent-hover: #ff8d4a; --accent-ink: #1a0a00; --accent-soft: rgba(255, 122, 46, 0.14); --ring: rgba(255, 122, 46, 0.35);
    --open: #34d399; --open-soft: rgba(52, 211, 153, 0.13); --soon: #fbbf24; --soon-soft: rgba(251, 191, 36, 0.13);
    --closed: #9aa6b9; --closed-soft: rgba(154, 166, 185, 0.12); --past: #6f7a8e; --past-soft: rgba(111, 122, 142, 0.12);
    --cancel: #f87171; --cancel-soft: rgba(248, 113, 113, 0.13); --full: #f87171; --warm: #fbbf24;
    --f-ipsc: #ff7a2e; --f-sra: #60a5fa; --f-prs: #a78bfa; --f-nrof: #2dd4bf; --f-idpa: #f472b6;
    --f-steel: #94a3b8; --f-ntsa: #facc15; --f-dmr: #818cf8; --f-resul: #34d399; --f-other: #7c879b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0e15; --surface: #111722; --surface-2: #151c29; --surface-3: #1c2433;
  --border: #222b3b; --border-strong: #303b50; --text: #e7ebf2; --text-2: #a9b3c4; --text-3: #6f7a8e;
  --accent: #ff7a2e; --accent-hover: #ff8d4a; --accent-ink: #1a0a00; --accent-soft: rgba(255, 122, 46, 0.14); --ring: rgba(255, 122, 46, 0.35);
  --open: #34d399; --open-soft: rgba(52, 211, 153, 0.13); --soon: #fbbf24; --soon-soft: rgba(251, 191, 36, 0.13);
  --closed: #9aa6b9; --closed-soft: rgba(154, 166, 185, 0.12); --past: #6f7a8e; --past-soft: rgba(111, 122, 142, 0.12);
  --cancel: #f87171; --cancel-soft: rgba(248, 113, 113, 0.13); --full: #f87171; --warm: #fbbf24;
  --f-ipsc: #ff7a2e; --f-sra: #60a5fa; --f-prs: #a78bfa; --f-nrof: #2dd4bf; --f-idpa: #f472b6;
  --f-steel: #94a3b8; --f-ntsa: #facc15; --f-dmr: #818cf8; --f-resul: #34d399; --f-other: #7c879b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  overflow: clip; /* the app shell never scrolls; sidebar, results and drawer scroll themselves */
  font: 14px/1.45 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: var(--text); }
kbd {
  font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; background: var(--surface); color: var(--text-2);
}
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.pad { padding: 6px 2px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.flip { transform: rotate(180deg); }
.i.up { transform: rotate(-90deg); }
.i.down { transform: rotate(90deg); }
.i.tiny { width: 13px; height: 13px; vertical-align: -2px; }
.i.tiny.on { fill: var(--warm); stroke: var(--warm); }

/* ============ buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--text); white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.btn:hover { border-color: var(--text-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.icon { width: 36px; padding: 0; }
.btn.sm { height: 28px; width: 28px; }
.btn.sm .i { width: 15px; height: 15px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.linkish:disabled { color: var(--text-3); cursor: default; text-decoration: none; opacity: .6; }
.badge:not(:empty) {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
}

/* ============ top bar ============ */
.top {
  height: var(--top-h); display: flex; align-items: center; gap: 18px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); width: calc(var(--side-w) - 36px); flex: none; }
.brand:hover { text-decoration: none; }
/* brand tile: always the dark ink, like the app icon (favicon.svg / icons/) */
.logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: #0f1729; color: #ff7a2e; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.logo .i { width: 30px; height: 30px; stroke: none; }
.brand-t { display: flex; flex-direction: column; line-height: 1.15; }
.brand-t b { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-t small { font-size: 11.5px; color: var(--text-3); }
.search {
  flex: 1; min-width: 0; max-width: 640px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text-3);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--surface); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14.5px; min-width: 0; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search:focus-within kbd { display: none; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.sync {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.sync:hover { border-color: var(--border-strong); color: var(--text); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--open); box-shadow: 0 0 0 3px var(--open-soft); }
.sync[data-mode="status"] { cursor: pointer; }
.sync[data-mode="status"]:hover { border-color: var(--border); color: var(--text-2); }
.sync[data-state="stale"] .dot { background: var(--soon); box-shadow: 0 0 0 3px var(--soon-soft); }
.sync[data-state="error"] .dot { background: var(--cancel); box-shadow: 0 0 0 3px var(--cancel-soft); }
.sync[data-state="running"] .dot { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ============ layout ============ */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: calc(100dvh - var(--top-h)); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; transition: margin-right .22s ease; }
@media (min-width: 1440px) { body.drawer-open .main { margin-right: var(--drawer-w); } }

/* ============ sidebar ============ */
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.side-head h2 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex: 1; }
.side-scroll { overflow-y: auto; padding: 4px 0 24px; overscroll-behavior: contain; scrollbar-width: thin; }
.side-foot { padding: 14px 18px 0; line-height: 1.6; }

.fs { border-bottom: 1px solid var(--border); }
.fs-h {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 13px 18px; background: none; border: 0; cursor: pointer;
  font-weight: 700; font-size: 13.5px; text-align: left;
}
.fs-h:hover { background: var(--surface-2); }
.fs-h > span:first-child { flex: 1; }
.fs-h .chev { width: 15px; height: 15px; color: var(--text-3); transform: rotate(90deg); transition: transform .15s; }
.fs.collapsed .chev { transform: rotate(0deg); }
.fs.collapsed .fs-b { display: none; }
.fs-b { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.sub-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-top: 8px; }

.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip-btn {
  height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2);
}
.chip-btn:hover { border-color: var(--border-strong); color: var(--text); }
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.date-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
input[type="date"], input[type="text"], .fs-search, select {
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; min-width: 0; width: 100%;
}
input[type="date"]:focus, input[type="text"]:focus, .fs-search:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.fs-search { height: 30px; font-size: 13px; background: var(--surface-2); border-color: var(--border); }

.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-btn {
  display: flex; flex-direction: column; align-items: center; padding: 5px 0 4px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text-2);
}
.day-btn small { font-size: 10px; font-weight: 600; color: var(--text-3); }
.day-btn:hover { border-color: var(--border-strong); }
.day-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-btn[aria-pressed="true"] small { color: inherit; opacity: .8; }
.day-btn.zero { opacity: .45; }

.opts { display: flex; flex-direction: column; }
.opt {
  display: flex; align-items: center; gap: 9px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; user-select: none;
}
.opt:hover { background: var(--surface-2); }
.opt.indent { padding-left: 30px; font-size: 13px; color: var(--text-2); }
.opt.zero { opacity: .45; }
.opt-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-n { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.opt input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex: none; }
.sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.more { align-self: flex-start; margin-top: 4px; }

.tone-bg-open { background: var(--open); } .tone-bg-soon { background: var(--soon); } .tone-bg-closed { background: var(--closed); }
.tone-bg-past { background: var(--past); } .tone-bg-cancel { background: var(--cancel); }

/* the real checkbox stays inside its row: an unanchored absolute input escapes the sidebar's
   scroll area, and focusing it used to scroll the whole page */
.switch { position: relative; display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; padding: 4px 0; user-select: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.sw-track { width: 32px; height: 18px; border-radius: 999px; background: var(--border-strong); position: relative; flex: none; transition: background .15s; }
.sw-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .sw-track { background: var(--accent); }
.switch input:checked + .sw-track::after { transform: translateX(14px); }
.switch input:focus-visible + .sw-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.near { display: flex; flex-direction: column; gap: 8px; }
.near-row { display: flex; gap: 6px; }
.ac-wrap { position: relative; flex: 1; }
.ac {
  position: absolute; top: calc(100% + 4px); left: 0; right: -42px; z-index: 20; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; max-height: 320px; overflow: auto;
}
.ac-it { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; }
.ac-it.on, .ac-it:hover { background: var(--accent-soft); }
.near-pin { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.near-pin { align-items: flex-start; }
.near-pin > .i { margin-top: 2px; }
.near-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.near-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.near-t small { overflow-wrap: anywhere; line-height: 1.35; }
.near-t small { color: var(--text-2); font-size: 12px; }
.near-t .near-c { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.near-pin.rough { background: var(--soon-soft); color: var(--soon); }
.near-warn { margin: 0; font-size: 12px; line-height: 1.45; color: var(--soon); }
.near-adjust { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; }
.near-adjust .i { width: 14px; height: 14px; }
.ac-osm { flex-direction: row !important; align-items: center !important; gap: 8px; border-top: 1px solid var(--border) !important; border-radius: 0 0 7px 7px !important; }
.ac-osm .i { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.ac-osm > span { display: flex; flex-direction: column; }
.ac-empty { padding: 8px 10px; }
.mk-center-pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); cursor: grab; }
.near-pin .i { width: 16px; height: 16px; }
.km { display: flex; flex-direction: column; gap: 2px; }
.km input[type="range"] { accent-color: var(--accent); flex: 1; min-width: 0; }
.km-row { display: flex; align-items: center; gap: 8px; }
.km-num { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); }
.km-num input { width: 64px; height: 30px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); text-align: right; font-variant-numeric: tabular-nums; }
.km-num input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); outline: none; }

/* ============ results bar ============ */
.bar { padding: 14px 22px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); background: var(--bg); }
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -22px; padding: 0 22px; }
.quick::-webkit-scrollbar { display: none; }
.qchip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2);
}
.qchip .i { width: 14px; height: 14px; }
.qchip:hover { color: var(--text); border-color: var(--text-3); }
.qchip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.qchip.on .i { fill: currentColor; }
.qdot { width: 8px; height: 8px; border-radius: 50%; }
.bar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.count { flex: 1; min-width: 220px; font-size: 14px; }
.count b { font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin-right: 4px; }
.bar-tools { display: flex; align-items: center; gap: 8px; }
.sort { display: flex; align-items: center; gap: 6px; }
.sort select { width: auto; height: 34px; font-weight: 600; font-size: 13px; background: var(--surface); cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 2px; gap: 2px; }
.seg button, .seg .btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 6px;
  background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.seg button:hover { color: var(--text); background: var(--surface-3); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg .i { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fchip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 6px 0 10px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid transparent; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; max-width: 280px;
}
.fchip:hover { border-color: var(--accent); }
.fchip .i { width: 13px; height: 13px; stroke-width: 2.4; }

.menu { position: relative; }
.menu-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 290px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.menu.open .menu-pop { display: block; }
.menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; font-size: 13.5px; }
.menu-pop button:hover { background: var(--surface-3); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }

/* ============ views ============ */
.view { flex: 1; overflow-y: auto; padding: 8px 22px 40px; scroll-behavior: auto; overscroll-behavior: contain; container: results / inline-size; }
.map-view { flex: 1; min-height: 0; }

.skeleton { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.sk { height: 78px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.group-h {
  position: sticky; top: -8px; z-index: 2; display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 -22px; padding: 16px 22px 8px; background: linear-gradient(var(--bg) 75%, transparent);
  font-size: 15px; font-weight: 800; letter-spacing: -.01em;
}
.group-h .muted { font-weight: 500; font-size: 12.5px; }
.list { display: flex; flex-direction: column; gap: 8px; }

.ev {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) 200px 150px 66px; gap: 16px; align-items: center;
  padding: 12px 14px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; position: relative;
}
.ev:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ev.is-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.ev.is-focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ev.is-past { opacity: .72; }
.ev.is-cancelled .ev-name a { text-decoration: line-through; color: var(--text-3); }

.datetile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; height: 58px; border-radius: 10px;
  background: var(--surface-3); line-height: 1; gap: 2px; position: relative; overflow: hidden;
}
.datetile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, transparent); }
.datetile.tone-open { --c: var(--open); } .datetile.tone-soon { --c: var(--soon); }
.dt-dow { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.dt-d { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.dt-m { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-2); }

.ev-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ev-name { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; display: flex; align-items: center; gap: 8px; }
.ev-name a, .t-name a { color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev-name a:hover, .t-name a:hover { color: var(--accent); text-decoration: none; }
.ev-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.ev-where { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); min-width: 0; }
.ev-where > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-where .i { width: 14px; height: 14px; color: var(--text-3); }
.dist { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dist .i { width: 12px; height: 12px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.tag i { width: 8px; height: 8px; border-radius: 2px; background: var(--hue); }
.lvl { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-aud { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap; flex: none; background: var(--surface-3); color: var(--text-2); }
.badge-aud.aud-members, .badge-aud.aud-test { background: var(--cancel-soft); color: var(--cancel); }
.hidden-note { color: var(--text-3); font-size: 13px; }
.hidden-note .linkish { font-size: 13px; }
.hn-short { display: none; }
.muted-list { display: flex; flex-wrap: wrap; gap: 6px; }
.aud-note { margin: 4px 0 0; line-height: 1.45; }
.d-aud { gap: 8px; }
.aud-why { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.badge-series { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; flex: none; }
.badge-series.comp { background: var(--surface-3); color: var(--text-2); }
.mini-ev.next { background: var(--accent-soft); }
.badge-new { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; background: var(--f-sra); color: #fff; flex: none; }

.cap { display: flex; flex-direction: column; gap: 8px; }
.cap-part { display: flex; flex-direction: column; gap: 5px; }
.cap-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cap-num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.cap-est { color: var(--text-3); margin-left: 2px; font-weight: 600; }
.cap-lbl { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--text-3); margin-right: 6px; }
.cap-note { font-size: 12px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.cap-part.tone-full .cap-note { color: var(--full); }
.cap-part.tone-warm .cap-note { color: var(--warm); }
.cap-part.sub { gap: 3px; }
.cap-part.sub .cap-num { font-size: 12.5px; font-weight: 600; }
.cap-part.sub .cap-note { font-size: 11.5px; font-weight: 500; }
.cap-part.sub .meter { height: 3px; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--open); }
.cap-part.tone-warm .meter i { background: var(--warm); }
.cap-part.tone-full .meter i { background: var(--full); }
.cap.compact { gap: 6px; }
.cap.compact .meter { height: 4px; }
.cap.compact .cap-part.sub .meter { height: 3px; }

.ev-reg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.tone-open { background: var(--open-soft); color: var(--open); }
.pill.tone-soon { background: var(--soon-soft); color: var(--soon); }
.pill.tone-closed { background: var(--closed-soft); color: var(--closed); }
.pill.tone-past { background: var(--past-soft); color: var(--past); }
.pill.tone-cancel { background: var(--cancel-soft); color: var(--cancel); }
.pill.tone-open::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; }
.pill-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; padding-left: 2px; }

.ev-act, .row-act { display: flex; align-items: center; gap: 2px; }
.ssi-link { width: 30px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); }
.ssi-link:hover { background: var(--surface-3); color: var(--accent); text-decoration: none; }
.ssi-link .i { width: 16px; height: 16px; }
.d-ssi { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 20px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; font-weight: 600; }
.d-ssi a { white-space: nowrap; }
.mk-pop-row { display: flex; flex-direction: column; }
.mk-pop-links { display: flex; gap: 14px; margin: -2px 0 4px 8px; font-weight: 600; }
.mk-pop-links .reg { color: var(--open); }
.star { width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: var(--text-3); }
.star:hover { background: var(--surface-3); color: var(--text); }
.star.on { color: var(--warm); }
.star.on .i { fill: currentColor; }
.star.big .i { width: 20px; height: 20px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 70px 20px; gap: 6px; }
.empty h3 { margin: 6px 0 0; font-size: 17px; }
.empty p { max-width: 420px; margin: 0; }
.empty-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty-ico .i { width: 32px; height: 32px; }
.empty-act { display: flex; gap: 8px; margin-top: 14px; }

/* table */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; margin-top: 8px; }
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom: 1px solid var(--border);
  padding: 10px;
}
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover, .grid th.active { color: var(--accent); }
.grid .arrow { margin-left: 4px; }
.grid td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid tbody tr.is-open { background: var(--accent-soft); }
.grid tbody tr.is-focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.grid tr.is-past { opacity: .7; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .narrow { width: 66px; padding: 0 4px; }
.t-name { min-width: 200px; font-weight: 600; }
.t-sport .tag { white-space: normal; }
.t-name a { display: inline; }
.t-name .badge-aud, .t-name .badge-series, .t-name .badge-new { margin-left: 6px; display: inline-block; margin-top: 2px; }
.t-where { min-width: 140px; }
.t-cap { min-width: 180px; }
.t-reg { white-space: nowrap; }
.t-reg .pill-sub { display: block; }

/* calendar */
.cal { padding-top: 10px; }
.cal-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.cal-bar h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; min-width: 180px; }
.cal-bar .seg .btn { height: 30px; }
.cal-bar .seg .btn.icon { width: 32px; padding: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-h { background: var(--surface-2); padding: 8px 10px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.cal-cell { background: var(--surface); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out > * { opacity: .55; }
.cal-d { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--text-2); padding: 2px 4px; }
.cal-cell.today .cal-d { color: var(--accent); }
.cal-cell.today .cal-d::before { content: "Today"; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; order: 2; }
.cal-n { display: none; }
.cal-ev {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 6px; border: 0; border-radius: 5px; cursor: pointer;
  font-size: 12px; font-weight: 600; text-align: left; background: var(--surface-3); color: var(--text); min-width: 0;
}
.cal-ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.cal-ev.tone-open { background: var(--open-soft); }
.cal-ev.tone-soon { background: var(--soon-soft); }
.cal-ev.tone-past { color: var(--text-3); }
.cal-ev.starred span::after { content: " ★"; color: var(--warm); }
.cal-ev:hover { outline: 1px solid var(--border-strong); }
.cal-more { border: 0; background: none; color: var(--accent); font-size: 11.5px; font-weight: 700; text-align: left; padding: 1px 6px; cursor: pointer; }

/* ============ map ============ */
.leaflet-container { background: var(--surface-3); font: inherit; }
:root[data-resolved-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3); }
.leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--text-3); }
.mk { width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 2.5px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.35); display: grid; place-items: center; }
.mk span { font-size: 11px; font-weight: 800; color: #fff; }
.mk:has(span) { width: 26px; height: 26px; }
.mk.starred { outline: 2px solid var(--warm); outline-offset: 1px; }
.mk.tone-open, .mk-cluster.tone-open { --c: var(--open); }
.mk.tone-soon, .mk-cluster.tone-soon { --c: var(--soon); }
.mk.tone-closed, .mk-cluster.tone-closed { --c: var(--closed); }
.mk.tone-past, .mk-cluster.tone-past { --c: var(--past); }
.mk.tone-cancel, .mk-cluster.tone-cancel { --c: var(--cancel); }
.mk-cluster {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--c);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent), 0 2px 6px rgba(0,0,0,.3);
}
.mk-cluster span { color: #fff; font-weight: 800; font-size: 13px; }
.mk-center { fill: var(--accent); fill-opacity: 1; stroke: #fff; stroke-width: 3; }
.mk-radius { fill: var(--accent); fill-opacity: .06; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 5; }
/* no negative margins inside the scroller: they made it scroll sideways under the links */
.mk-pop { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: hidden auto; scrollbar-gutter: stable; }
.mk-pop-ev { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 8px; margin: 0; width: 100%; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text); }
.mk-pop-ev:hover { background: var(--surface-3); }
.mk-pop-ev b { font-size: 13.5px; line-height: 1.3; }
.mk-pop-ev .pill { height: 20px; font-size: 11px; margin-top: 2px; }

/* ============ drawer ============ */
.drawer {
  position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(var(--drawer-w), 100vw); z-index: 25;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
@media (min-width: 1440px) { .drawer { box-shadow: none; } }
.drawer-body { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.d-head { padding: 10px 20px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.d-tools { display: flex; align-items: center; gap: 2px; margin: 0 -10px; }
.d-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.d-title { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.d-when { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.d-when .i { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.d-actions .btn .i { width: 16px; height: 16px; }
.btn.countdown b { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: left; }
.btn-sub { font-weight: 500; opacity: .8; font-size: 12px; }
.btn.pulse { animation: pulse-ring 1.2s ease-out 4; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 var(--ring); } 100% { box-shadow: 0 0 0 14px transparent; } }
.d-note { margin: 0; padding: 10px 20px; border-bottom: 1px solid var(--border); line-height: 1.5; }
.d-sec { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.d-sec h4 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.d-sec h4 .pill-wrap { text-transform: none; letter-spacing: 0; display: flex; gap: 6px; align-items: center; }
.d-map-sec { padding: 0; gap: 0; }
.d-map { height: 190px; }
.d-map-links { padding: 8px 20px 12px; }
.d-foot { padding: 14px 20px 24px; line-height: 1.7; word-break: break-word; }

.bd { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.bd-h { display: flex; justify-content: space-between; font-size: 13px; }
.bd-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.bd-bar i.a, .bd-legend i.a { background: var(--open); }
.bd-bar i.p, .bd-legend i.p { background: color-mix(in srgb, var(--open) 40%, transparent); }
.bd-legend i.w { background: var(--warm); }
.bd-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.bd-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bd-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.bd-legend .warn { color: var(--warm); font-weight: 600; }

.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; position: relative; padding-bottom: 14px; font-size: 13.5px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: 8px; top: 16px; bottom: -2px; width: 2px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; margin: 4px 0 0 3px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); position: relative; z-index: 1; }
.tl li.done .tl-dot { background: var(--text-3); border-color: var(--text-3); }
.tl li.done b { color: var(--text-2); font-weight: 600; }
.tl li.next .tl-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.tl li.match .tl-dot { border-radius: 3px; }

.mini-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.mini-ev { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; }
.mini-ev:hover { background: var(--surface-2); }
.mini-date { font-size: 12px; font-weight: 700; color: var(--text-2); }
.mini-name { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; min-width: 0; }
.mini-name small { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-ev .pill { height: 20px; font-size: 11px; padding: 0 8px; }
.mini-ev .pill-sub { display: none; }

/* ============ modal / toast / scrim ============ */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 20, .45); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(2px); }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 85vh; overflow: auto; padding: 20px 22px; }
.modal-card h3 { margin: 0 0 12px; font-size: 16px; }
.modal-card h3 + .tips, .modal-card .keys + h3 { margin-top: 18px; }
.modal-x { position: absolute; top: 10px; right: 10px; }
.modal-card.alerts { width: min(560px, 100%); }
.modal-card.alerts h3 { display: flex; align-items: center; gap: 8px; }
.modal-card.alerts > p { margin: 0 0 12px; line-height: 1.55; }
.seg.scope { margin-bottom: 6px; }
.seg.scope button:disabled { opacity: .45; cursor: not-allowed; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.alert-actions .btn .i { width: 16px; height: 16px; }
.alerts-preview { border-top: 1px solid var(--border); padding-top: 12px; margin-bottom: 8px; }
.alerts-preview .pop-ev { grid-template-columns: 118px 1fr; }
.howto { border-top: 1px solid var(--border); padding-top: 10px; }
.howto summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.howto ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.6; color: var(--text-2); font-size: 13px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; align-items: center; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--text-2); }
.tips { margin: 0; padding-left: 18px; line-height: 1.9; color: var(--text-2); }
.pop-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.pop-ev { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 9px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.pop-ev:hover { background: var(--surface-2); }
.pop-name { display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.pop-ev .pill-sub { display: none; }

#toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; white-space: pre-line;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { position: fixed; inset: 0; z-index: 44; background: rgba(8, 12, 20, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }

.only-narrow { display: none !important; }

/* ============ responsive ============ */
/* cards respond to the space they get (sidebar and drawer eat into it), not the window */
@container results (max-width: 980px) {
  .ev { grid-template-columns: 54px minmax(0, 1fr) 190px 130px 64px; gap: 12px; }
}
@container results (max-width: 820px) {
  .ev { grid-template-columns: 54px minmax(0, 1fr) 190px 64px; grid-template-areas: "d m c s" "d m r s"; row-gap: 6px; }
  .ev .datetile { grid-area: d; } .ev-main { grid-area: m; } .ev-cap { grid-area: c; } .ev-reg { grid-area: r; flex-direction: row; align-items: center; gap: 6px; } .ev-act { grid-area: s; }
}
@container results (max-width: 520px) {
  .ev { grid-template-columns: 46px minmax(0, 1fr) 60px; grid-template-areas: "d m s" "c c c" "r r r"; padding: 11px; gap: 10px; row-gap: 10px; }
  .datetile { height: 50px; }
  .dt-d { font-size: 18px; }
  .ev-name { font-size: 14px; }
}
@media (max-width: 1180px) { .views span { display: none; } }
body.drawer-open .views span { display: none; }
@media (max-width: 900px) {
  :root { --top-h: 56px; }
  .only-narrow { display: inline-flex !important; }
  .hide-narrow { display: none !important; }
  .top { gap: 8px; padding: 0 10px; }
  .brand { width: auto; }
  .brand-t { display: none; }
  .search kbd { display: none; }
  .sync .sync-t { display: none; }
  .sync { padding: 0; width: 32px; justify-content: center; }
  .top-actions { gap: 0; }
  .top-actions .btn.icon { width: 32px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 45; top: 0; bottom: 0; left: 0; width: min(360px, 92vw); transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  body.filters-open .side { transform: none; }
  body.filters-open .scrim { opacity: 1; pointer-events: auto; }
  .bar { padding: 10px 14px 8px; }
  .quick { margin: 0 -14px; padding: 0 14px; }
  .view { padding: 4px 14px 40px; }
  .group-h { margin: 0 -14px; padding: 14px 14px 6px; }
  .count { min-width: 0; flex-basis: 100%; }
  .bar-tools { width: 100%; }
  .sort { flex: 1; }
  .sort select { width: 100%; }
  .drawer { top: 0; z-index: 50; width: 100vw; border-left: 0; }
  .d-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .cal-cell { min-height: 76px; padding: 3px; }
  .cal-ev { padding: 2px 4px; font-size: 10.5px; }
  .cal-ev i { display: none; }
  .cal-h { padding: 6px 4px; font-size: 10px; text-align: center; }
}
/* ---- phones: give the results the screen ---- */
@media (max-width: 900px) {
  .bar { padding: 8px 12px 8px; gap: 8px; max-height: 140px; transition: max-height .2s ease, padding .2s ease, opacity .15s; }
  body.bar-collapsed .bar { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; overflow: hidden; border-bottom-color: transparent; }
  .quick { margin: 0 -12px; padding: 0 12px; }
  .quick-active { display: inline-flex; gap: 6px; align-items: center; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border-strong); }
  .quick-active .fchip, .quick-active .linkish { white-space: nowrap; flex: none; }
  .quick-active .fchip { height: 30px; }
  .bar-row { flex-wrap: nowrap; gap: 6px; }
  .count { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  .count b { font-size: 15px; margin-right: 0; }
  .count-extra, .hidden-note { display: none; }
  .hidden-chip { background: var(--surface-3); color: var(--text-2); }
  .bar-tools { width: auto; flex: none; gap: 6px; }
  .sort { flex: none; position: relative; width: 36px; height: 34px; }
  .sort .sort-ico { position: absolute; inset: 0; margin: auto; pointer-events: none; color: var(--text-2); z-index: 1; }
  .sort select { position: absolute; inset: 0; width: 36px; height: 34px; padding: 0; color: transparent; background: var(--surface); cursor: pointer; }
  .sort select option { color: var(--text); }
  .views button { padding: 0 8px; }
  .view { padding-top: 2px; }
}
/* phones: registration status beside the date tile instead of its own row */
@container results (max-width: 520px) {
  .ev { grid-template-areas: "d m s" "r r r" "c c c"; row-gap: 8px; padding: 10px 10px 12px; gap: 10px; }
  .ev-reg { flex-direction: row; align-items: center; gap: 6px; }
  .ev-main { gap: 2px; }
  .ev-name { flex-wrap: wrap; row-gap: 4px; }
  .ev-name a { flex: 1 1 100%; }
  .ev .cap { gap: 6px; }
  .list { gap: 6px; }
  .group-h { padding-top: 10px; padding-bottom: 4px; }
}
@media (max-width: 560px) {
  .cal-ev span { display: none; }
  .cal-ev { height: 8px; padding: 0; }
  .cal-cell { min-height: 58px; }
  .cal-more { font-size: 10px; padding: 0 2px; }
  .cal-n { display: inline; font-size: 10px; color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
