/* ============================================================
   Joyce Project Map - design system
   Dark-first. The basemap is muted so project data is the only
   saturated thing on screen.
   ============================================================ */

:root {
  --bg:            #070b14;
  --bg-deep:       #04070d;
  --surface:       rgba(14, 21, 36, 0.82);
  --surface-solid: #0e1524;
  --surface-hi:    rgba(30, 42, 66, 0.72);
  --line:          rgba(140, 172, 235, 0.14);
  --line-strong:   rgba(140, 172, 235, 0.26);

  --text:          #e9eefb;
  --text-dim:      #93a4c4;
  --text-faint:    #64748f;

  --accent:        #0fb5a8;
  --accent-soft:   rgba(15, 181, 168, 0.14);
  --accent-line:   rgba(15, 181, 168, 0.42);
  --accent-deep:   #0b8f85;   /* gradient end + hover */
  --on-accent:     #04211f;   /* text on an accent fill: 6.5:1 on #0fb5a8 */
  --info:          #4cc9f0;
  --danger:        #ff6b6b;
  --ok:            #52d98a;

  --radius:   14px;
  --radius-s: 9px;
  --radius-l: 20px;

  --shadow:    0 18px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.4);
  --blur: saturate(150%) blur(22px);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

:root[data-theme='daylight'] {
  --bg:            #eef1f6;
  --bg-deep:       #dfe4ec;
  --surface:       rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-hi:    rgba(228, 234, 244, 0.9);
  --line:          rgba(30, 52, 96, 0.12);
  --line-strong:   rgba(30, 52, 96, 0.22);
  --text:          #16203a;
  --text-dim:      #4d5c7a;
  --text-faint:    #7c8aa5;
  --accent:        #0f766e;
  --accent-soft:   rgba(15, 118, 110, 0.12);
  --accent-line:   rgba(15, 118, 110, 0.4);
  --accent-deep:   #0c5f59;
  --on-accent:     #ffffff;   /* 5.4:1 on #0f766e */
  --shadow:    0 18px 44px rgba(30, 45, 80, 0.16), 0 2px 6px rgba(30, 45, 80, 0.1);
  --shadow-sm: 0 6px 16px rgba(30, 45, 80, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ---------- glass ---------- */
.glass {
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- map shell ---------- */
#map { position: fixed; inset: 0; background: var(--bg); }
.maplibregl-ctrl-attrib { font-size: 10px !important; }
.maplibregl-ctrl-bottom-right { margin-bottom: 4px; }
.maplibregl-ctrl-group {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm) !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button span { filter: invert(1) opacity(0.75); }
:root[data-theme='daylight'] .maplibregl-ctrl-group button span { filter: none; }

/* ---------- brand bar ---------- */
.topbar {
  position: fixed; top: 14px; left: 14px; right: 14px;
  display: flex; gap: 10px; align-items: center;
  pointer-events: none; z-index: 20;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px 9px 11px;
}
/* The mark is a complete tile - its own amber background and rounded corners -
   so it renders identically in both themes. No gradient or accent fill behind
   it: --accent darkens to #0f766e in daylight and would show through. */
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 181, 168, 0.3);
}
.brand-mark img, .brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: 0.02em; }

.spacer { flex: 1; }

/* ---------- generic controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 14px; border-radius: var(--radius-s);
  background: var(--surface-hi); border: 1px solid var(--line);
  color: var(--text); font-size: 13px; font-weight: 520;
  cursor: pointer; transition: background .16s, border-color .16s, transform .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-solid); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  border-color: transparent; color: var(--on-accent); font-weight: 640;
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255, 107, 107, 0.3); }
.btn.danger:hover { background: rgba(255, 107, 107, 0.12); }
.btn.icon { padding: 9px; width: 38px; height: 38px; }
.btn[aria-pressed='true'] {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.seg { display: flex; padding: 3px; gap: 3px; border-radius: var(--radius-s); }
.seg button {
  border: 0; background: transparent; color: var(--text-dim); white-space: nowrap;
  padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent); }
.seg button:hover:not([aria-pressed='true']) { color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11.5px; font-weight: 600; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; }
.input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-s);
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .16s, box-shadow .16s;
}
:root[data-theme='daylight'] .input { background: rgba(255,255,255,.8); }
.input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-faint); }
select.input { appearance: none; cursor: pointer; }

/* ---------- filter rail ---------- */
.rail {
  position: fixed; top: 72px; left: 14px; bottom: 14px; width: 316px;
  display: flex; flex-direction: column; z-index: 18;
  overflow: hidden; transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .25s;
}
.rail.collapsed { transform: translateX(calc(-100% - 20px)); opacity: 0; pointer-events: none; }
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; border-bottom: 1px solid var(--line); flex: none;
}
.rail-title { font-size: 12px; font-weight: 640; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); }
.rail-body { overflow-y: auto; overflow-x: hidden; padding: 6px 0 10px; flex: 1; }
.rail-body::-webkit-scrollbar { width: 9px; }
.rail-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 9px; border: 3px solid transparent; background-clip: content-box; }
.rail-body::-webkit-scrollbar-track { background: transparent; }

.group { border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; background: none; border: 0; cursor: pointer; text-align: left;
}
.group-head:hover { background: rgba(255,255,255,.03); }
:root[data-theme='daylight'] .group-head:hover { background: rgba(0,0,0,.03); }
.group-head h3 { margin: 0; font-size: 12.5px; font-weight: 620; letter-spacing: .02em; flex: 1; }
.group-head .chev { width: 13px; height: 13px; color: var(--text-faint); transition: transform .22s; }
.group[data-open='false'] .chev { transform: rotate(-90deg); }
.group[data-open='false'] .group-body { display: none; }
.group-body { padding: 2px 14px 14px; }
.pill-count {
  font-size: 10.5px; font-weight: 620; padding: 2px 7px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums;
}

/* checkbox rows */
.opt {
  display: flex; align-items: center; gap: 9px; padding: 6px 7px;
  border-radius: 8px; cursor: pointer; user-select: none;
  transition: background .13s;
}
.opt:hover { background: rgba(255,255,255,.045); }
:root[data-theme='daylight'] .opt:hover { background: rgba(0,0,0,.04); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .box {
  width: 16px; height: 16px; border-radius: 5px; flex: none;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  transition: background .14s, border-color .14s;
}
.opt .box svg { width: 10px; height: 10px; opacity: 0; transform: scale(.6); transition: .14s; color: #12180a; }
.opt input:checked + .box { background: var(--accent); border-color: var(--accent); }
.opt input:checked + .box svg { opacity: 1; transform: scale(1); }
.opt input:focus-visible + .box { box-shadow: 0 0 0 3px var(--accent-soft); }
.opt .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.opt .name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .num { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.mini-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.mini {
  font-size: 11px; padding: 4px 9px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--text-dim);
}
.mini:hover { border-color: var(--line-strong); color: var(--text); }
.scroll-list { max-height: 232px; overflow-y: auto; margin: 0 -7px; padding: 0 7px; }
.scroll-list::-webkit-scrollbar { width: 8px; }
.scroll-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2.5px solid transparent; background-clip: content-box; }

/* year range */
.range-wrap { padding-top: 4px; }
.range-vals {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--text-dim); font-variant-numeric: tabular-nums; margin-bottom: 9px;
}
.range-vals b { color: var(--accent); font-weight: 640; }
.dual { position: relative; height: 26px; }
.dual input[type='range'] {
  position: absolute; inset: 0; width: 100%; margin: 0; height: 26px;
  -webkit-appearance: none; appearance: none; background: none; pointer-events: none;
}
.dual input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto;
  width: 16px; height: 16px; border-radius: 50%; cursor: grab;
  background: var(--accent); border: 2.5px solid var(--surface-solid);
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.dual input[type='range']::-moz-range-thumb {
  pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; cursor: grab;
  background: var(--accent); border: 2.5px solid var(--surface-solid); box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.dual .track {
  position: absolute; top: 11px; left: 0; right: 0; height: 4px;
  border-radius: 4px; background: var(--line-strong);
}
.dual .track .fill { position: absolute; height: 100%; border-radius: 4px; background: var(--accent); }


/* ---------- search dropdown + radius ---------- */
.search-wrap { position: relative; }
.search-wrap .input { padding-right: 34px; }
.search-clear {
  position: absolute; top: 50%; right: 7px; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 6px; border: 0; cursor: pointer;
  background: var(--surface-hi); color: var(--text-dim);
  display: grid; place-items: center; padding: 0;
}
.search-clear:hover { color: var(--text); }
.search-clear svg { width: 11px; height: 11px; }
.search-clear[hidden] { display: none; }

/* Fixed, not absolute: the rail is a scroll container and would clip it. */
.dropdown {
  position: fixed; z-index: 34; display: flex; flex-direction: column;
  overflow: hidden; animation: pop .15s ease-out;
}
.dropdown[hidden] { display: none; }
.dropdown-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  border-bottom: 1px solid var(--line); flex: none;
}
.dropdown-head .t {
  flex: 1; font-size: 11px; font-weight: 620; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-dim);
}
.dropdown-close {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.dropdown-close:hover { background: var(--surface-hi); color: var(--text); }
.dropdown-close svg { width: 11px; height: 11px; }

.dd-cols, .dd-row {
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr);
}
.dd-cols {
  padding: 7px 12px; border-bottom: 1px solid var(--line); flex: none;
  font-size: 9.5px; font-weight: 640; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-faint);
}
.dd-body { overflow-y: auto; overscroll-behavior: contain; }
.dd-body::-webkit-scrollbar { width: 9px; }
.dd-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 9px; border: 3px solid transparent; background-clip: content-box; }
.dd-row {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 9px 12px; min-height: 42px; color: var(--text);
  border-bottom: 1px solid rgba(140, 172, 235, .07);
}
.dd-row:last-child { border-bottom: 0; }
.dd-row:hover, .dd-row:focus-visible { background: var(--surface-hi); outline: none; }
.dd-row .c1 { font-size: 13px; font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-row .c2 { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); overflow: hidden; }
.dd-row .c2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-row .c2 .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
.dd-row .c3 { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-empty { padding: 22px 14px; text-align: center; color: var(--text-faint); font-size: 12.5px; }
.dd-more { padding: 8px 12px; text-align: center; font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--line); flex: none; }

.radius-row {
  display: flex; align-items: center; gap: 9px; margin-top: 10px;
  padding: 7px 8px; border-radius: 9px; cursor: pointer; user-select: none;
  border: 1px solid transparent; transition: background .13s, border-color .13s;
}
.radius-row:hover { background: rgba(255,255,255,.045); }
:root[data-theme='daylight'] .radius-row:hover { background: rgba(0,0,0,.04); }
.radius-row.on { background: var(--accent-soft); border-color: var(--accent-line); }
.radius-row input[type='checkbox'] { position: absolute; opacity: 0; pointer-events: none; }
.radius-row .box {
  width: 16px; height: 16px; border-radius: 5px; flex: none;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  transition: background .14s, border-color .14s;
}
.radius-row .box svg { width: 10px; height: 10px; opacity: 0; transform: scale(.6); transition: .14s; color: #12180a; }
.radius-row input:checked + .box { background: var(--accent); border-color: var(--accent); }
.radius-row input:checked + .box svg { opacity: 1; transform: scale(1); }
.radius-row input:focus-visible + .box { box-shadow: 0 0 0 3px var(--accent-soft); }
.radius-text { flex: 1; font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.radius-row.on .radius-text { color: var(--text); }
.radius-miles {
  width: 52px; padding: 4px 6px; border-radius: 6px; text-align: center;
  background: rgba(0,0,0,.28); border: 1px solid var(--line); color: var(--text);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; outline: none;
  -moz-appearance: textfield;
}
:root[data-theme='daylight'] .radius-miles { background: rgba(255,255,255,.8); }
.radius-miles::-webkit-outer-spin-button, .radius-miles::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.radius-miles:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.radius-note {
  margin: 6px 2px 0; font-size: 11px; color: var(--text-faint); line-height: 1.45;
}
.radius-note b { color: var(--accent); font-weight: 620; }
.radius-note[hidden] { display: none; }

/* ---------- stats ---------- */
.statbar {
  display: flex; align-items: center; gap: 14px; padding: 11px 16px; flex: none;
  border-top: 1px solid var(--line);
}
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat .v { font-size: 19px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .07em; }
.stat.accent .v { color: var(--accent); }

/* ---------- detail card ---------- */
.detail {
  position: fixed; right: 14px; top: 72px; width: 318px; z-index: 22;
  overflow: hidden; transform-origin: top right;
  animation: pop .22s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.detail-head { padding: 15px 16px 13px; border-bottom: 1px solid var(--line); position: relative; }
.detail-type {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 660;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 7px;
}
.detail-type .dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 9px currentColor; }
.detail-title { font-size: 16.5px; font-weight: 640; letter-spacing: -.015em; line-height: 1.3; }
.detail-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.detail-close {
  position: absolute; top: 12px; right: 12px; width: 27px; height: 27px;
  border-radius: 7px; border: 1px solid var(--line); background: transparent;
  color: var(--text-dim); cursor: pointer; display: grid; place-items: center;
}
.detail-close:hover { background: var(--surface-hi); color: var(--text); }
.detail-close svg { width: 13px; height: 13px; }
.detail-rows { padding: 6px 0; }
.drow { display: flex; gap: 12px; padding: 8px 16px; font-size: 13px; align-items: baseline; }
.drow dt { color: var(--text-faint); flex: none; width: 84px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.drow dd { margin: 0; flex: 1; color: var(--text); }
.locked { color: var(--text-faint); font-style: italic; font-size: 12.5px; }
.detail-foot { padding: 11px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

/* ---------- legend ---------- */
.legend {
  position: fixed; left: 14px; bottom: 34px; z-index: 15; padding: 11px 13px;
  max-width: 340px; transition: left .3s cubic-bezier(.4,0,.2,1), opacity .25s;
}
body.rail-open .legend { left: 344px; }
@media (max-width: 1080px) { body.rail-open .legend { opacity: 0; pointer-events: none; } }
.legend h4 { margin: 0 0 8px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); font-weight: 640; }
.legend-items { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-dim); }
.legend-item .dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 7px currentColor; }

/* ---------- toasts / overlays ---------- */
.toast-wrap { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 11px 17px; font-size: 13px; font-weight: 520;
  animation: rise .26s cubic-bezier(.2,.9,.3,1.1);
}
.toast.err { border-color: rgba(255,107,107,.4); color: #ffc9c9; }
.toast.ok { border-color: rgba(82,217,138,.4); color: #b6f2cf; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.boot {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--bg); transition: opacity .5s, visibility .5s;
}
.boot.gone { opacity: 0; visibility: hidden; }
.boot-in { display: flex; flex-direction: column; align-items: center; gap: 17px; }
.boot-mark {
  width: 54px; height: 54px; border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  display: grid; place-items: center; box-shadow: 0 10px 34px rgba(15,181,168,.4);
  animation: breathe 2.1s ease-in-out infinite;
}
.boot-mark svg { width: 28px; height: 28px; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.boot-txt { font-size: 13px; color: var(--text-dim); letter-spacing: .02em; }
.boot-bar { width: 190px; height: 3px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 34%; border-radius: 3px; background: var(--accent); animation: slide 1.15s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(390%); } }

/* ---------- menus ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 7px); right: 0; min-width: 214px;
  padding: 6px; z-index: 40; animation: pop .16s ease-out;
}
.menu[hidden] { display: none; }
.menu-user { padding: 9px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.menu-user .n { font-size: 13.5px; font-weight: 620; }
.menu-user .r { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.menu button, .menu a {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 11px; border-radius: 8px; border: 0; background: none;
  color: var(--text); font-size: 13px; cursor: pointer; text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--surface-hi); }
.menu svg { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

/* ---------- popup override ---------- */
.maplibregl-popup-content {
  background: var(--surface) !important; color: var(--text) !important;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--radius-s) !important;
  box-shadow: var(--shadow) !important; padding: 9px 12px !important; font-size: 12.5px;
}
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }

/* ---------- auth pages ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 620px at 18% -8%, rgba(15,181,168,.14), transparent 62%),
    radial-gradient(900px 560px at 108% 108%, rgba(76,201,240,.11), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 402px; padding: 32px; }
.auth-head { text-align: center; margin-bottom: 25px; }
.auth-head .brand-mark { width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 15px; }
.auth-head .brand-mark img, .auth-head .brand-mark svg { width: 100%; height: 100%; }
.auth-head h1 { margin: 0 0 6px; font-size: 21px; font-weight: 660; letter-spacing: -.022em; }
.auth-head p { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .btn { width: 100%; padding: 12px; }
.auth-msg {
  padding: 10px 13px; border-radius: var(--radius-s); font-size: 12.5px;
  background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.3); color: #ffc9c9;
}
.auth-msg.ok { background: rgba(82,217,138,.12); border-color: rgba(82,217,138,.3); color: #b6f2cf; }
.auth-msg[hidden] { display: none; }
.auth-foot { margin-top: 19px; text-align: center; font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }
.hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }

/* ---------- admin ---------- */
.admin-shell { max-width: 1120px; margin: 0 auto; padding: 24px 22px 64px; }
.admin-top { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.admin-top h1 { margin: 0; font-size: 20px; font-weight: 660; letter-spacing: -.02em; }
.admin-grid { display: grid; grid-template-columns: minmax(0,1fr) 366px; gap: 18px; align-items: start; }
@media (max-width: 940px) { .admin-grid { grid-template-columns: 1fr; } }
.panel { padding: 0; overflow: hidden; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 640; flex: 1; letter-spacing: -.01em; }
.panel-body { padding: 18px; }
.table-wrap { overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: 13px; }
table.users th {
  text-align: left; padding: 10px 14px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-faint); font-weight: 640;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.users td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users tr:last-child td { border-bottom: 0; }
table.users tr:hover td { background: rgba(255,255,255,.028); }
:root[data-theme='daylight'] table.users tr:hover td { background: rgba(0,0,0,.025); }
.u-name { font-weight: 585; }
.u-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--line-strong); color: var(--text-dim);
  white-space: nowrap;
}
.tag.admin { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.tag.on { background: rgba(82,217,138,.13); border-color: rgba(82,217,138,.35); color: var(--ok); }
.tag.off { background: rgba(255,107,107,.11); border-color: rgba(255,107,107,.3); color: var(--danger); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions .btn { padding: 6px 10px; font-size: 12px; }
table.users td:last-child { width: 1%; white-space: nowrap; }
.switch-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 36px; height: 21px; border-radius: 21px; background: var(--line-strong); position: relative; flex: none; transition: background .18s; margin-top: 1px; }
.switch::after { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(15px); }
.switch-row .t { font-size: 13px; font-weight: 520; }
.switch-row .d { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; line-height: 1.45; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 13px; }
.gen-row { display: flex; gap: 7px; }
.gen-row .input { flex: 1; font-family: var(--mono); font-size: 12.5px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .seg button { padding: 6px 9px; font-size: 12px; }
  #userName { display: none; }
}
@media (max-width: 720px) {
  .rail { width: auto; right: 14px; top: 66px; bottom: 14px; }
  .detail { left: 14px; right: 14px; width: auto; top: auto; bottom: 14px; }
  .legend { display: none; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
