/* Squeegee Bros Territory Tracker: black glass + silver, Mac-style windows.
   Status colours keep their meaning (variables are read by app.js for map dots and bars). */
:root {
  color-scheme: dark;
  --ink: #f5f5f7; --ink-2: rgba(235, 235, 245, .78); --muted: rgba(235, 235, 245, .58); --faint: rgba(235, 235, 245, .32);
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .14);
  --glass: rgba(26, 26, 28, .78); --glass-thin: rgba(36, 36, 40, .55); --fill: rgba(255, 255, 255, .06); --fill-2: rgba(255, 255, 255, .1);
  --silver-1: #fbfbfd; --silver-2: #d4d4d9; --silver-ink: #0b0b0c;
  --red: #ff453a; --gray: #8e8e93; --blue: #0a84ff; --yellow: #ffd60a; --teal: #40c8e0; --purple: #bf5af2; --green: #30d158;
  --brown: #ac8e68; --black: #1c1c1e; --slate: #636366; --amber: #ff9f0a; --danger: #ff6961;
  --radius: 12px; --win-radius: 14px;
  --mb-h: 40px; --dock-space: 0px; --sheet-h: 46dvh;
  --ease: cubic-bezier(.2, .8, .2, 1);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink); background: #000;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: #000; }
::selection { background: rgba(255, 255, 255, .24); }
a { color: #e5e5ea; text-decoration: underline; text-decoration-color: rgba(229, 229, 234, .35); text-underline-offset: 2px; }
a:hover { text-decoration-color: rgba(229, 229, 234, .9); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 14.5px; }
p { margin: 6px 0; }
ul { padding-left: 20px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.error { color: var(--danger); }
:focus-visible { outline: 2px solid rgba(255, 255, 255, .75); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 1px solid var(--line-2); background: var(--fill-2); color: var(--ink);
  border-radius: 9px; padding: 6px 13px; min-height: 34px; font-weight: 500; letter-spacing: -.005em;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
button:where(:not(.badge, .light, .primary, .danger, .dock-item)):hover { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .2); }
button:active:not(:disabled) { transform: scale(.98); }
button.primary {
  background: linear-gradient(180deg, var(--silver-1), var(--silver-2)); color: var(--silver-ink); border-color: rgba(255, 255, 255, .55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(0, 0, 0, .5); font-weight: 600;
}
button.primary:hover { background: linear-gradient(180deg, #fff, #e0e0e5); }
button.danger { color: var(--danger); background: rgba(255, 69, 58, .1); border-color: rgba(255, 69, 58, .28); }
button.danger:hover { background: rgba(255, 69, 58, .18); }
button.small { padding: 3px 10px; min-height: 28px; font-size: 12.5px; border-radius: 8px; }
button:disabled { opacity: .4; cursor: not-allowed; }
:where(input:not([type=checkbox], [type=radio], [type=file], [type=range]), select, textarea) {
  border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 10px; background: rgba(0, 0, 0, .28); min-height: 34px; max-width: 100%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); transition: border-color .15s, box-shadow .15s;
}
:where(input, select, textarea):focus { outline: none; border-color: rgba(255, 255, 255, .4); box-shadow: 0 0 0 3px rgba(255, 255, 255, .14); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23aeaeb2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
select:disabled { opacity: .5; cursor: not-allowed; }
option { background: #1c1c1e; color: var(--ink); }
textarea { width: 100%; min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: #d1d1d6; width: 16px; height: 16px; margin: 0; }
input[type=file] { font-size: 12.5px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; color: var(--ink); background: var(--fill-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 12px; margin-right: 10px; cursor: pointer;
}
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 10px 0 4px; }
details > summary { cursor: pointer; }
.notice { background: rgba(255, 159, 10, .1); border: 1px solid rgba(255, 159, 10, .28); color: #ffd28a; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; }
.ok { background: rgba(48, 209, 88, .09); border: 1px solid rgba(48, 209, 88, .26); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; }
.ok input { margin-top: 6px; }

/* Grouped sections inside windows (System Settings style) */
.card { background: rgba(255, 255, 255, .035); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.notice { background: rgba(255, 159, 10, .08); }
.card.ok { background: rgba(48, 209, 88, .07); }
.card h3:first-child, .card > summary { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.stat {
  font-size: 34px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 20%, #a1a1a6); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 70px 20px; }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; margin-bottom: 6px; color: var(--ink-2); background: var(--fill); border: 1px solid var(--line); }
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: 16px; font-weight: 600; }
.page-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .lead { flex: 1; color: var(--muted); font-size: 13px; margin: 0; min-width: 200px; }

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; min-height: 40px;
  display: flex; align-items: center; gap: 14px; padding: 0 12px 0 14px;
  background: rgba(16, 16, 18, .66); -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  border-bottom: 1px solid rgba(255, 255, 255, .07); box-shadow: 0 1px 0 rgba(0, 0, 0, .6);
}
.mb-brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 650; font-size: 13.5px; letter-spacing: -.01em; }
.mb-logo, .auth-logo {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #1c1c1e;
  background: linear-gradient(180deg, #f5f5f7, #b9b9be); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, .6);
}
.mb-logo svg { width: 15px; height: 15px; }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  background: transparent; color: var(--ink-2); border: 0; border-radius: 7px; white-space: nowrap;
  min-height: 28px; padding: 3px 11px; font-size: 13px; font-weight: 500;
}
nav.tabs button:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }
nav.tabs button[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #fff; }
.mb-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 12.5px; color: var(--ink-2); }
.mb-right button { background: transparent; border-color: rgba(255, 255, 255, .16); min-height: 26px; padding: 2px 10px; font-size: 12px; }
.mb-right button.install { background: linear-gradient(180deg, var(--silver-1), var(--silver-2)); color: var(--silver-ink); border-color: rgba(255, 255, 255, .5); font-weight: 600; }
.mb-right button.install:hover { background: linear-gradient(180deg, #fff, #e0e0e5); }
.mb-clock { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }

/* ---------- Desktop (the map) ---------- */
#view-map { position: fixed; top: var(--mb-h); left: 0; right: 0; bottom: 0; z-index: 0; isolation: isolate; background: #0b0b0c; }
#map { position: absolute; inset: 0; background: #0e0e10; }
.leaflet-container { font: inherit; background: #0e0e10; }
/* Dimmed, greyscale tiles; zone colours and dots (overlay pane) stay bright */
.leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.92) contrast(.88); }
body.page-open #view-map .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.6) contrast(.88); }
.leaflet-bar { border: 1px solid var(--line-2) !important; border-radius: 10px !important; overflow: hidden; box-shadow: 0 6px 20px rgba(0, 0, 0, .45) !important; }
.leaflet-bar a, .leaflet-bar a:hover {
  background: rgba(30, 30, 32, .78); color: var(--ink); border-bottom-color: var(--line) !important;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); width: 34px; height: 34px; line-height: 34px;
}
.leaflet-bar a:hover { background: rgba(50, 50, 54, .85); }
.leaflet-bar a.leaflet-disabled { background: rgba(30, 30, 32, .6); color: var(--faint); }
.leaflet-top.leaflet-left { margin: 4px 0 0 4px; }
.leaflet-control-attribution { background: rgba(0, 0, 0, .55) !important; color: #aeaeb2 !important; border-radius: 6px 6px 0 0; padding: 1px 6px !important; font-size: 10.5px; }
.leaflet-control-attribution a { color: #d1d1d6 !important; }
.leaflet-tooltip {
  background: rgba(28, 28, 30, .9); color: var(--ink); border: 1px solid var(--line-2); border-radius: 9px; padding: 6px 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font-size: 12.5px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.leaflet-tooltip-top::before { border-top-color: rgba(28, 28, 30, .9); }
.leaflet-tooltip-bottom::before { border-bottom-color: rgba(28, 28, 30, .9); }
.leaflet-tooltip-left::before { border-left-color: rgba(28, 28, 30, .9); }
.leaflet-tooltip-right::before { border-right-color: rgba(28, 28, 30, .9); }
.mapbar { position: absolute; z-index: 800; top: 14px; left: 60px; display: flex; gap: 8px; align-items: center; pointer-events: none; width: min(380px, calc(100vw - 500px)); min-width: 220px; }
.mapbar > * { pointer-events: auto; }
.mapbar input {
  flex: 1; height: 36px; border-radius: 11px; padding-left: 34px;
  background: rgba(30, 30, 32, .72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23aeaeb2' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
}
.mapbar .hint {
  background: rgba(30, 30, 32, .78); padding: 7px 11px; border-radius: 10px; font-size: 12.5px; white-space: nowrap;
  border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
details.legend {
  position: absolute; z-index: 800; bottom: 30px; left: 12px; max-width: 290px; padding: 8px 12px; font-size: 12px;
  background: rgba(30, 30, 32, .74); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
}
details.legend summary { font-weight: 600; font-size: 12.5px; }
.legend .item { display: flex; align-items: center; gap: 7px; margin: 4px 0; }
.swatch { display: inline-block; width: 13px; height: 13px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .25); flex: none; }
.zone-label {
  background: rgba(20, 20, 22, .78); border: 1px solid rgba(255, 255, 255, .14); border-radius: 7px; padding: 2px 6px;
  font-size: 11px; line-height: 1.25; white-space: nowrap; text-align: center; color: var(--ink); font-weight: 500; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.zone-label .bar { display: flex; height: 4px; margin-top: 3px; border-radius: 2px; overflow: hidden; min-width: 40px; background: rgba(255, 255, 255, .1); }

/* ---------- Windows ---------- */
.window {
  position: fixed; display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass); -webkit-backdrop-filter: blur(40px) saturate(170%); backdrop-filter: blur(40px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--win-radius);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .7), 0 28px 70px rgba(0, 0, 0, .55), 0 6px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: win-in .22s var(--ease);
}
.window.no-anim { animation: none; }
@keyframes win-in { from { opacity: 0; transform: translateY(8px) scale(.975); } }
.window.minimizing { transition: transform .28s cubic-bezier(.5, 0, .9, .6), opacity .28s; transform: translateY(42vh) scale(.12); opacity: 0; }
.window.closing { transition: transform .16s ease-in, opacity .16s; transform: scale(.97); opacity: 0; }
.titlebar {
  flex: none; height: 42px; display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: 10px;
  padding: 0 14px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .025); user-select: none; -webkit-user-select: none;
}
.wt { font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.005em; }
.lights { display: flex; gap: 8px; justify-self: start; align-items: center; }
.light {
  position: relative; width: 12px; height: 12px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center;
  border: .5px solid rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12); cursor: default;
}
button.light { cursor: pointer; }
.light::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.light.close { background: #ff5f57; } .light.min { background: #febc2e; } .light.zoom { background: #28c840; }
.light svg { width: 8px; height: 8px; opacity: 0; color: rgba(0, 0, 0, .6); transition: opacity .1s; pointer-events: none; }
.lights:hover .light svg, .light:focus-visible svg { opacity: 1; }
.light:active { filter: brightness(.82); }
.win-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 26px; }

.window.page {
  z-index: 10; top: calc(var(--mb-h) + 16px); bottom: calc(18px + var(--dock-space));
  left: max(20px, calc((100vw - 1320px) / 2)); right: max(20px, calc((100vw - 1320px) / 2));
}
.window.page.zoomed, .window.drawer.zoomed { top: var(--mb-h); bottom: var(--dock-space); left: 0; right: 0; width: auto; border-radius: 0; border-width: 0; }

.side-win { position: absolute; z-index: 900; top: 14px; right: 14px; bottom: calc(14px + var(--dock-space)); width: 390px; max-width: calc(100vw - 28px); }
.side-win.zoomed { width: min(700px, calc(100vw - 28px)); }
.side-win .win-body { padding: 16px 18px 22px; }

.window.drawer { z-index: 30; top: calc(var(--mb-h) + 12px); right: 12px; bottom: calc(12px + var(--dock-space)); width: min(640px, calc(100vw - 24px)); }
.window.drawer.zoomed .win-body { padding-left: max(22px, calc((100% - 920px) / 2)); padding-right: max(22px, calc((100% - 920px) / 2)); }
.scrim { position: fixed; inset: 0; top: var(--mb-h); background: rgba(0, 0, 0, .3); z-index: 25; animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Dock ---------- */
.dock {
  position: fixed; z-index: 40; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px 8px;
  background: rgba(44, 44, 48, .5); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
  max-width: calc(100vw - 20px); overflow-x: auto; animation: fade-in .2s ease;
}
@media (hover: hover) { .dock { overflow: visible; } }
body.has-dock { --dock-space: 78px; }
.dock-item {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 3px; width: 54px; min-height: 52px; padding: 2px 0 6px;
  background: none; border: 0; border-radius: 12px; transition: transform .18s var(--ease);
}
.dock-item:hover, .dock-item:focus-visible { transform: translateY(-5px) scale(1.1); }
.dock-tile {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #1c1c1e;
  background: linear-gradient(180deg, #f6f6f8, #c4c4c9); box-shadow: inset 0 1px 0 #fff, 0 3px 8px rgba(0, 0, 0, .45);
}
.dock-tile svg { width: 23px; height: 23px; }
.dock-item::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(255, 255, 255, .75); }
.dock-label {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); pointer-events: none; opacity: 0; transition: opacity .12s;
  background: rgba(40, 40, 44, .9); border: 1px solid var(--line-2); color: var(--ink); padding: 3px 10px; border-radius: 7px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.dock-item:hover .dock-label, .dock-item:focus-visible .dock-label { opacity: 1; }
@media (hover: none) {
  .dock-label { position: static; transform: none; opacity: 1; background: none; border: 0; padding: 0; font-size: 10px; color: var(--ink-2); max-width: 54px; overflow: hidden; text-overflow: ellipsis; }
  .dock-item::after { display: none; }
  .light svg { opacity: 1; }
  body.has-dock { --dock-space: 86px; }
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.5; letter-spacing: 0;
}
button.badge { min-height: 0; cursor: pointer; }
button.badge:hover { filter: brightness(1.2); }
.c-red { background: rgba(255, 69, 58, .15); color: #ff8b82; border-color: rgba(255, 69, 58, .32); } .bg-red { background: var(--red); }
.c-gray { background: rgba(142, 142, 147, .16); color: #c7c7cc; border-color: rgba(142, 142, 147, .3); } .bg-gray { background: var(--gray); }
.c-blue { background: rgba(10, 132, 255, .16); color: #70b7ff; border-color: rgba(10, 132, 255, .34); } .bg-blue { background: var(--blue); }
.c-yellow { background: rgba(255, 214, 10, .14); color: #ffe066; border-color: rgba(255, 214, 10, .3); } .bg-yellow { background: var(--yellow); }
.c-teal { background: rgba(64, 200, 224, .14); color: #7fdcee; border-color: rgba(64, 200, 224, .3); } .bg-teal { background: var(--teal); }
.c-purple { background: rgba(191, 90, 242, .15); color: #da9bf8; border-color: rgba(191, 90, 242, .32); } .bg-purple { background: var(--purple); }
.c-green { background: rgba(48, 209, 88, .14); color: #6fe08f; border-color: rgba(48, 209, 88, .3); } .bg-green { background: var(--green); }
.c-brown { background: rgba(172, 142, 104, .16); color: #d2b994; border-color: rgba(172, 142, 104, .32); } .bg-brown { background: var(--brown); }
.c-black { background: #000; color: #f5f5f7; border-color: rgba(255, 255, 255, .3); } .bg-black { background: var(--black); border-color: rgba(255, 255, 255, .45); }
.c-slate { background: rgba(99, 99, 102, .22); color: #aeaeb2; border-color: rgba(142, 142, 147, .3); } .bg-slate { background: var(--slate); }
.c-amber { background: rgba(255, 159, 10, .14); color: #ffbd5c; border-color: rgba(255, 159, 10, .32); } .bg-amber { background: var(--amber); }
.stack { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .08); margin: 8px 0; gap: 1px; }
.counts { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .02); }
.table-wrap.card { padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: rgba(255, 255, 255, .03); white-space: nowrap; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover, tr.clickable:focus-visible { background: rgba(255, 255, 255, .05); }
tr.clickable:focus-visible { outline-offset: -2px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.filters > div { min-width: 140px; }
.filters > div > input, .filters > div > select { width: 100%; }
.filters label { margin-top: 0; }
#view-import .card > input:not([type=file]) { width: 100%; }
#biz-count { margin: 0 2px 8px; }
td.mono, #view-businesses td:nth-child(5) { white-space: nowrap; }
#biz-more { text-align: center; }

/* ---------- Business details ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line-2); padding: 3px 12px; margin-bottom: 8px; font-size: 13.5px; }
.contact { border: 1px solid var(--line); background: rgba(255, 255, 255, .025); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.contact > * + * { margin-top: 3px; }
.biz-head { margin-bottom: 14px; }
.mono-title { font-variant-numeric: tabular-nums; letter-spacing: -.01em; font-size: 20px; }
#view-settings > .grid2 { grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr)); }
.grid2.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 14px; }
.stats .card { padding: 16px 18px; }
.biz-head h2 { font-size: 22px; letter-spacing: -.02em; }
pre, pre.req { white-space: pre-wrap; max-height: 260px; overflow: auto; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); padding: 10px; border-radius: 9px; font-size: 12px; }
.list-row { padding: 7px 0; border-top: 1px solid var(--line); }
.list-row.clickable { cursor: pointer; border-radius: 6px; }
.list-row.clickable:hover { background: rgba(255, 255, 255, .04); }

/* ---------- Toast (notification banner) ---------- */
.toast {
  position: fixed; top: calc(var(--mb-h) + 12px); right: 14px; z-index: 60; max-width: min(380px, calc(100vw - 28px));
  background: rgba(40, 40, 44, .82); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--line-2); color: var(--ink); padding: 11px 15px; border-radius: 14px; font-size: 13px; font-weight: 500;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5); animation: toast-in .28s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }
.boot-error { position: fixed; top: calc(var(--mb-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 60; }

/* ---------- Sign-in pages ---------- */
body.auth-page {
  overflow: auto; height: auto; min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(255, 255, 255, .11), transparent 62%),
    radial-gradient(700px 460px at 105% 110%, rgba(170, 170, 180, .07), transparent 60%),
    linear-gradient(180deg, #0a0a0b, #000);
}
.auth.window { position: relative; width: min(400px, 100%); animation: win-in .3s var(--ease); }
.auth .win-body { padding: 26px 28px 26px; }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-logo { width: 52px; height: 52px; border-radius: 13px; margin: 2px auto 14px; }
.auth-logo svg { width: 30px; height: 30px; }
.auth-head h1 { font-size: 21px; margin-bottom: 2px; }
.auth-head p { margin: 0; }
.auth input:not([type=checkbox]) { width: 100%; }
.auth button[type=submit] { width: 100%; margin-top: 18px; min-height: 38px; }
.auth #msg { margin: 12px 0 0; font-size: 13px; text-align: center; }
.auth #msg:empty { display: none; }
.auth form p.small { text-align: center; margin-top: 14px; }

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

/* ---------- Phone ---------- */
@media (max-width: 820px) {
  :root { --mb-h: 84px; }
  .menubar { flex-wrap: wrap; gap: 4px 10px; padding: 6px 10px 6px 12px; }
  .mb-brand { flex: 1; }
  .mb-clock { display: none; }
  nav.tabs { order: 3; flex-basis: 100%; padding-bottom: 2px; }
  nav.tabs button { padding: 4px 12px; }
  .mapbar { left: 56px; right: 12px; width: auto; min-width: 0; top: 12px; }
  .window.page, .window.drawer, .window.page.zoomed, .window.drawer.zoomed { top: var(--mb-h); left: 0; right: 0; bottom: 0; width: auto; border-radius: 0; border-width: 0; }
  .window.page .win-body, .window.drawer .win-body, .side-win .win-body { padding-bottom: calc(22px + var(--dock-space)); }
  nav.tabs { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .window.page .light.zoom, .window.drawer .light.zoom { display: none; }   /* already full screen on a phone */
  .win-body { padding: 14px 14px 22px; }
  .side-win, .side-win.zoomed { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: var(--sheet-h); border-radius: 16px 16px 0 0; border-bottom-width: 0; }
  body.side-zoomed { --sheet-h: 84dvh; }
  body.side-open .leaflet-bottom { bottom: var(--sheet-h); }
  body.side-open details.legend { bottom: calc(var(--sheet-h) + 26px); }
  body:not(.side-open).has-dock .leaflet-bottom { bottom: var(--dock-space); }
  body:not(.side-open).has-dock details.legend { bottom: calc(var(--dock-space) + 26px); }
  details.legend { max-width: calc(100vw - 24px); }
  .kv { grid-template-columns: 110px 1fr; }
  #view-businesses th:nth-child(n+5), #view-businesses td:nth-child(n+5) { display: none; }
  .toast { left: 12px; right: 12px; max-width: none; }
  .filters > div { min-width: calc(50% - 5px); flex: 1; }
}
