/* Flight Explorer · visual system ("clean product"). Tokens first; light by default; dark when the system asks
   (unless the user chose light) or when the user chose dark. The two dark blocks must stay identical (no preprocessor).
   Rules, anatomy and states: docs/02-ux-design.md. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f1f3f6; --fg: #111418; --muted: #59616c; --faint: #8a929c;
  --line: #e3e6eb; --line-strong: #cfd4db;
  --accent: #1a5fd6; --accent-weak: #e8f0fd; --on-accent: #ffffff;
  --success: #137333; --warn: #a15c00; --danger: #c5221f;
  --on: #1a5fd6; --off: #e6e9ee; --hover: #eef3fd; --mark: #fff1a8; --mark-fg: #111418;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-2: 0 10px 30px rgba(16, 24, 40, .12);
  --r-1: 8px; --r-2: 12px; --radius: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --ease: 140ms ease;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f13; --surface: #141920; --surface-2: #1a2029; --fg: #e8eaed; --muted: #a0a8b2; --faint: #7d8691;
    --line: #262d37; --line-strong: #343c47;
    --accent: #7ba7ff; --accent-weak: #18243a; --on-accent: #0c0f13;
    --success: #6dd58c; --warn: #f3c15b; --danger: #f28b82;
    --on: #7ba7ff; --off: #262d37; --hover: #1a2433; --mark: #4a3f0f; --mark-fg: #ffe9a3;
    --shadow-1: 0 0 0 1px var(--line); --shadow-2: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f13; --surface: #141920; --surface-2: #1a2029; --fg: #e8eaed; --muted: #a0a8b2; --faint: #7d8691;
  --line: #262d37; --line-strong: #343c47;
  --accent: #7ba7ff; --accent-weak: #18243a; --on-accent: #0c0f13;
  --success: #6dd58c; --warn: #f3c15b; --danger: #f28b82;
  --on: #7ba7ff; --off: #262d37; --hover: #1a2433; --mark: #4a3f0f; --mark-fg: #ffe9a3;
  --shadow-1: 0 0 0 1px var(--line); --shadow-2: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); overflow-x: hidden; }
a { color: var(--accent); }
svg { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:where(button, a, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.meta { color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Header ---------- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--fg); text-decoration: none; }
.brand .mark { width: 28px; height: 28px; padding: 5px; border-radius: 8px; background: var(--accent); fill: var(--on-accent); }
.actions { margin-left: auto; display: flex; gap: var(--s2); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--fg); cursor: pointer; transition: background var(--ease), border-color var(--ease); }
.icon-btn:hover { background: var(--hover); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#theme svg { display: none; }
#theme[data-mode="system"] .i-system, #theme[data-mode="light"] .i-light, #theme[data-mode="dark"] .i-dark { display: block; }

/* ---------- Hero + search card ---------- */
.hero { max-width: 960px; margin: 0 auto; padding: var(--s4) var(--s4) var(--s3); }
.hero-text { text-align: center; padding: var(--s5) 0 var(--s4); }
.hero-text h1 { margin: 0 0 6px; font-size: clamp(24px, 4.2vw, 34px); line-height: 1.15; letter-spacing: -.02em; }
.hero-text p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 15px; }
body:not(.is-landing) .hero-text, body:not(.is-landing) .landing { display: none; }
body.is-landing .controls { display: none; }

.search { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); padding: var(--s3); }
body.is-landing .search { box-shadow: var(--shadow-2); }
.od { position: relative; display: flex; gap: var(--s2); align-items: stretch; }
.field { position: relative; flex: 1; min-width: 0; }
.field label { position: absolute; top: 7px; left: 42px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.field .fi { position: absolute; left: 14px; top: 28px; translate: 0 -50%; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
/* 16px stops iOS from zooming into the field on focus. */
.field input { width: 100%; height: 56px; padding: 20px 12px 6px 42px; font: inherit; font-size: 16px; font-weight: 500; color: var(--fg);
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-2); text-overflow: ellipsis; transition: border-color var(--ease), background var(--ease); }
.field input::placeholder { color: var(--faint); font-weight: 400; }
.field input:hover { border-color: var(--line-strong); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-weak); }
#swap { position: relative; z-index: 2; align-self: center; display: grid; place-items: center; width: 36px; height: 36px; margin: 0 -22px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); cursor: pointer; box-shadow: var(--shadow-1); transition: transform var(--ease), background var(--ease); }
#swap:hover { background: var(--hover); transform: rotate(180deg); }
#swap svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--surface); }
.pill select { height: 30px; border: 0; background: transparent; color: var(--fg); font: inherit; font-weight: 500; cursor: pointer; }
.pill.check { padding-right: 12px; cursor: pointer; color: var(--fg); }
.pill.check input { accent-color: var(--accent); margin: 0; }
@media (max-width: 640px) {
  .od { flex-direction: column; gap: 6px; }
  #swap { position: absolute; right: 14px; top: 50%; translate: 0 -50%; margin: 0; }
  #swap:hover { transform: none; }
  .field input { padding-right: 56px; }
}

/* Autocomplete listbox */
.lb { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; min-width: 280px; max-height: min(60vh, 420px); overflow-y: auto;
  margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-2); }
.lb[hidden] { display: none; }
.lb li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-1); cursor: pointer; }
.lb li[aria-selected="true"] { background: var(--hover); }
.lb li.note { color: var(--muted); cursor: default; }
.lb .code { flex: none; width: 3.2em; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.lb .place { display: grid; min-width: 0; }
.lb .city { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .aname { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .tag { margin-left: auto; flex: none; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); }
.lb mark { background: var(--mark); color: var(--mark-fg); border-radius: 2px; }

/* ---------- Landing ---------- */
.landing { padding: var(--s4) 0 var(--s6); }
.quick { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: center; }
.quick .lbl { color: var(--muted); font-size: 13px; margin-right: 2px; }
.qs { height: 32px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 500; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: background var(--ease), border-color var(--ease); }
.qs:hover { background: var(--hover); border-color: var(--accent); }
.qs.last { border-style: dashed; }
.qs[hidden] { display: none; }
.how { list-style: none; margin: var(--s6) 0 0; padding: 0; display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.how li { display: flex; gap: var(--s3); padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
.how svg { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--accent-weak); fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.how strong { display: block; font-size: 14px; }
.how span { color: var(--muted); font-size: 13px; }

/* ---------- Controls (Fly on + view) ---------- */
.controls { max-width: 960px; margin: 0 auto; padding: 0 var(--s4); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; justify-content: space-between; }
.flyon { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 2px; }
.flyon::-webkit-scrollbar { display: none; }
.flyon .lbl { font-size: 13px; color: var(--muted); margin-right: 2px; white-space: nowrap; }
.flyon .meta { white-space: nowrap; }
.daychip { flex: none; height: 30px; font: inherit; font-size: 13px; font-weight: 500; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); cursor: pointer; transition: background var(--ease), border-color var(--ease); }
.daychip:hover { border-color: var(--line-strong); background: var(--hover); }
.daychip .n { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; margin-left: 2px; }
.daychip[data-empty] { color: var(--faint); }
.daychip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.daychip[aria-pressed="true"] .n { color: var(--on-accent); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; font: inherit; font-size: 13px; font-weight: 500; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }
body.exploring .seg { display: none; }

/* ---------- Results ---------- */
main { max-width: 960px; margin: 0 auto; padding: var(--s3) var(--s4) var(--s6); min-height: 40vh; }
.status { margin: var(--s2) 0 var(--s3); color: var(--muted); }
.status:empty { display: none; }
.status strong { color: var(--fg); font-weight: 600; }
.sect { position: sticky; top: 59px; z-index: 5; display: flex; align-items: baseline; gap: var(--s2); margin: var(--s4) 0 var(--s2); padding: 6px 0;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg); }
.sect .n { font-weight: 500; color: var(--faint); }

/* Option card: route | airlines | time, then strips; expands to day detail + leg timeline */
.opt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); margin-bottom: var(--s2); box-shadow: var(--shadow-1);
  transition: border-color var(--ease), box-shadow var(--ease); }
.opt:not([open]) { content-visibility: auto; contain-intrinsic-size: auto 104px; }
.opt:hover { border-color: var(--line-strong); }
.opt[open] { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.opt > summary { list-style: none; cursor: pointer; padding: var(--s3) var(--s4); display: grid; gap: var(--s2); }
.opt > summary::-webkit-details-marker { display: none; }
.o-main { display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; gap: var(--s4); align-items: center; }
.o-route { min-width: 0; display: grid; gap: 4px; }
.o-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.o-path .arr { color: var(--faint); font-weight: 400; }
.o-path .hub { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.o-air { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.al { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 5px; font-size: 11px; font-weight: 700; border-radius: 5px; background: var(--accent-weak); color: var(--accent); }
.o-time { text-align: right; display: grid; gap: 2px; }
.o-time strong { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stops { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stops.s0 { color: var(--success); }
.chev { width: 20px; height: 20px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--ease); }
.opt[open] .chev { transform: rotate(180deg); }
.o-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; }
.o-body { border-top: 1px solid var(--line); padding: var(--s3) var(--s4) var(--s4); display: grid; gap: var(--s3); }
@media (max-width: 560px) {
  .o-main { grid-template-columns: minmax(0, 1fr) auto; }
  .o-main .chev { display: none; }
  .opt > summary { padding: var(--s3); }
  .o-body { padding: var(--s3); }
}

.season, .dow { display: inline-grid; gap: 2px; }
.season { grid-template-columns: repeat(12, 12px); }
.dow { grid-template-columns: repeat(7, 14px); }
.season span, .dow span { height: 14px; border-radius: 3px; font-size: 9px; line-height: 14px; text-align: center; color: var(--muted); }
.season span { background: color-mix(in srgb, var(--on) calc(var(--f) * 100%), var(--off)); }
.season span.hi { color: var(--on-accent); }
.season span.assumed { opacity: .45; background-image: repeating-linear-gradient(45deg, transparent 0 3px, var(--surface) 3px 4px); }
.dow span { background: var(--off); }
.dow span.on { background: var(--on); color: var(--on-accent); }
.dow span.q { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.days { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dlabel { font-size: 13px; }
.flag { font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.flag.seasonal { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.lookup { font-style: italic; }
.lookup.checking { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* Leg timeline inside an expanded option */
.legs { list-style: none; margin: 0; padding: 0; }
.leg { position: relative; padding: 0 0 var(--s3) 26px; }
.leg::before { content: ""; position: absolute; left: 5px; top: 5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); }
.leg::after { content: ""; position: absolute; left: 10px; top: 21px; bottom: 0; width: 2px; background: var(--line-strong); }
.leg:last-child { padding-bottom: 0; }
.leg:last-child::after { display: none; }
.leg-head { display: flex; flex-wrap: wrap; gap: 4px var(--s3); align-items: baseline; }
.leg-head strong { font-size: 14px; }
.leg-info { font-size: 13px; color: var(--muted); }
.leg .days { margin-top: 6px; }
.layover { display: inline-block; margin: 0 0 var(--s3); padding: 3px 10px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: var(--r-1); }
.leg.stop { padding-bottom: var(--s3); }
.leg.stop::before { width: 8px; height: 8px; left: 7px; top: 8px; border-width: 0; background: var(--faint); }

/* Timetable + day detail */
.tt { border-collapse: collapse; margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tt th, .tt td { padding: 3px 14px 3px 0; text-align: left; }
.tt th { color: var(--muted); font-weight: 500; }
.tt tr.today td { font-weight: 700; }
.tt sup, .dd sup { font-size: 9px; color: var(--muted); margin-left: 1px; }
.dow.mini { grid-template-columns: repeat(7, 11px); }
.dow.mini span { height: 11px; line-height: 11px; font-size: 8px; }
.tt-none { margin: 6px 0 0; }
.dd { padding: var(--s3); border-radius: var(--r-1); background: var(--accent-weak); font-size: 13px; }
.dd h3 { margin: 0 0 6px; font-size: 13px; }
.dd p { margin: 0; }
.dd ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.dd li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-variant-numeric: tabular-nums; }
.dd .lay { color: var(--muted); font-size: 12px; }
.dd .lay::before { content: "· "; }
.dd .lay::after { content: " ·"; }

/* States: skeleton, empty, error, hints */
.skel { height: 96px; margin-bottom: var(--s2); border-radius: var(--r-2); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty, .hint, .errbox { display: grid; gap: var(--s2); justify-items: start; padding: var(--s4); margin-bottom: var(--s3); border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); }
.empty { justify-items: center; text-align: center; padding: var(--s6) var(--s4); }
.empty svg { width: 40px; height: 40px; fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty strong { font-size: 15px; }
.empty p, .hint p, .errbox p { margin: 0; color: var(--muted); }
.acts { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; }
.errbox { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.errbox strong { color: var(--danger); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 600; border-radius: var(--r-1);
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; justify-self: start; }
.btn.quiet { background: var(--surface); color: var(--accent); border-color: var(--line-strong); }
.btn:disabled { opacity: .6; cursor: default; }
.linkbtn { font: inherit; padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.unknown { margin-top: var(--s4); }
.unknown > summary { cursor: pointer; color: var(--muted); padding: var(--s2) 0; }

/* Week grid: scrolls inside its own box on small screens, never the page */
.gridwrap { position: relative; /* contains the .sr spans */ overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-2); margin-top: var(--s3); background: var(--surface); box-shadow: var(--shadow-1); }
.week { width: 100%; border-collapse: collapse; font-size: 13px; }
.week th, .week td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.week thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
.week tbody th { text-align: left; font-weight: 400; min-width: 200px; }
.week tbody th .path { display: block; font-weight: 600; }
.week td.on { color: var(--on); font-weight: 700; }
.week td.q { color: var(--muted); }
.week tbody tr:hover { background: var(--hover); }
.week tfoot th, .week tfoot td { color: var(--muted); font-variant-numeric: tabular-nums; border-bottom: 0; }
.week thead .linkbtn { text-decoration: none; color: var(--fg); }
.week thead .linkbtn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); padding: 1px 6px; border-radius: 6px; }

/* Month calendar: heat by options flying that date */
.calwrap { overflow-x: auto; margin: var(--s2) 0; padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-1); }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; min-width: 330px; }
.cal caption { text-align: left; caption-side: bottom; padding: 6px 4px 0; }
.cal th { font-size: 12px; font-weight: 600; color: var(--muted); }
.cal td { padding: 0; }
.cal button { width: 100%; min-height: 54px; display: grid; align-content: space-between; justify-items: start; gap: 2px; padding: 6px 7px; font: inherit; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-1); color: var(--fg); background: color-mix(in srgb, var(--on) calc(var(--f) * 45%), var(--surface)); transition: transform var(--ease); }
.cal button:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--accent); }
.cal button .d { color: var(--muted); font-size: 11px; }
.cal button .mon { font-weight: 700; color: var(--fg); }
.cal button .c { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.cal button .m { font-size: 10px; color: var(--muted); }
.cal button.past { opacity: .35; cursor: default; }
.cal button.today { box-shadow: inset 0 0 0 2px var(--fg); }
.cal button.col { border-color: var(--accent); }
.cal button.sel { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cal button.sel .d, .cal button.sel .m, .cal button.sel .mon { color: var(--on-accent); }

/* ---------- Anywhere (To empty) ---------- */
.xfilter { position: relative; margin-bottom: var(--s2); }
.xfilter svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.xfilter input { width: 100%; height: 44px; padding: 0 12px 0 38px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }
.xfilter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.cont > summary { list-style: none; cursor: pointer; }
.cont > summary::-webkit-details-marker { display: none; }
.cont > summary .sect::before { content: "▾"; margin-right: 2px; }
.cont:not([open]) > summary .sect::before { content: "▸"; }
.xlist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.xlist > li { content-visibility: auto; contain-intrinsic-size: auto 96px; }
.xrow { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; height: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--surface); color: var(--fg); text-decoration: none; box-shadow: var(--shadow-1); transition: border-color var(--ease), background var(--ease); }
.xrow:hover { border-color: var(--accent); background: var(--hover); }
.xrow .code { font-weight: 700; font-size: 15px; grid-row: span 3; align-self: start; padding-top: 1px; }
.xrow .place { display: grid; min-width: 0; }
.xrow .city { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xrow .place .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.xrow .time { text-align: right; display: grid; justify-items: end; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xrow .xhow { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }
.xrow .xd { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.more { margin: var(--s3) 0 0; }

/* ---------- Footer ---------- */
.foot { max-width: 960px; margin: 0 auto; text-align: center; color: var(--muted); font-size: 12px; padding: var(--s5) var(--s4) var(--s6); border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }
.foot a { color: var(--muted); }

/* ---------- Settings page (admin.html) ---------- */
.admin { max-width: 760px; }
.admin [hidden] { display: none !important; }
.admin h1 { font-size: 22px; margin: var(--s4) 0; letter-spacing: -.01em; }
.admin form.login, .admin .card { display: grid; gap: var(--s3); padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); box-shadow: var(--shadow-1); margin-bottom: var(--s4); }
.admin form.login { max-width: 380px; margin: var(--s6) auto; }
.admin label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.admin input { height: 42px; padding: 0 12px; font: inherit; font-size: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface); color: var(--fg); }
.admin input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.admin input[aria-invalid="true"] { border-color: var(--danger); }
.admin .err { color: var(--danger); margin: 0; }
.admin .ok { color: var(--success); margin: 0; }
.admin h2 { margin: 0; font-size: 15px; }
.admin .row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: baseline; justify-content: space-between; }
.admin .big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.meter { height: 10px; border-radius: 999px; background: var(--off); overflow: hidden; display: flex; }
.meter span { height: 100%; }
.k-od { background: var(--accent); }
.k-in { background: #8b5cf6; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.chart { width: 100%; height: 170px; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: var(--line); }
.chart .od { fill: var(--accent); }
.chart .in { fill: #8b5cf6; }
.limits { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.warn { color: var(--warn); }
