/* A-Group Field. Tokens from ../AGroup/DESIGN.md via agroup-marketing: holding black is the brand default,
   Mikado Yellow for focus. The light theme (derived: same roles, inverted) is for reading in the sun. */
@font-face { font-family: 'Montserrat'; font-weight: 100 900; font-display: swap; src: url(/fonts/montserrat-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Montserrat'; font-weight: 100 900; font-display: swap; src: url(/fonts/montserrat-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url(/fonts/IBMPlexSansArabic-Regular.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url(/fonts/IBMPlexSansArabic-Medium.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url(/fonts/IBMPlexSansArabic-Bold.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }

:root {
  color-scheme: dark;
  --bg: #212121; --s1: #272727; --s2: #2e2e2e; --s3: #363636;
  --line: rgb(233 234 239 / 0.1); --line-strong: rgb(233 234 239 / 0.18);
  --fg: #e9eaef; --muted: #a3a4a7; --dim: #85868a;
  --accent: #ffc107; --danger: #ff8a7a; --warn: #ffc107; --ok: #4cd694;
  --gap: #ff8a5c; --bar: #a98aff; --bar-neutral: #6b6c70;
  --scrim: rgb(0 0 0 / 0.65);
  --font: 'Plex Arabic', 'Montserrat', ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hdr: 3.5rem; --tabs: 3.75rem;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f4f6; --s1: #ffffff; --s2: #ececf0; --s3: #e1e1e7;
    --line: rgb(33 33 33 / 0.12); --line-strong: rgb(33 33 33 / 0.25);
    --fg: #212121; --muted: #54555a; --dim: #6f7075;
    --accent: #7033ff; --danger: #b3261e; --warn: #8a5a00; --ok: #0b7a4b;
    --gap: #d9480f; --bar: #7033ff; --bar-neutral: #9a9ba1;
    --scrim: rgb(0 0 0 / 0.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font: 400 1rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
bdi, .num { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 0.875rem; }
.miss { color: var(--dim); }
.i { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-xl { width: 2.5rem; height: 2.5rem; stroke-width: 1.5; }
.mark { width: 1.625rem; height: 1.5rem; fill: currentColor; flex: none; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 1.125rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:hover { background: var(--s2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { background: var(--fg); opacity: 0.88; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger.is-armed { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-wide { width: 100%; }
.btn-lg { min-height: 3.25rem; font-size: 1.0625rem; font-weight: 700; }
.input {
  width: 100%; min-height: 2.75rem; padding: 0.375rem 0.875rem; border: 1px solid var(--line-strong); border-radius: 0.75rem; background: var(--s1);
}
textarea.input { min-height: 6rem; resize: vertical; line-height: 1.6; }
.input::placeholder { color: var(--dim); }
.input:focus-visible { outline-offset: 0; border-color: transparent; }
select.input { appearance: none; padding-inline-end: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 0.875rem 50%; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; cursor: pointer; }
.check input { width: 1.375rem; height: 1.375rem; accent-color: var(--accent); margin: 0; }
.err { color: var(--danger); font-weight: 500; font-size: 0.875rem; }
.err:empty { display: none; }
.warn { color: var(--warn); font-size: 0.875rem; }
.hint { color: var(--muted); font-size: 0.8125rem; }
.empty { color: var(--muted); padding: 1rem 0; }
.tag { display: inline-block; font-size: 0.75rem; line-height: 1.6; padding: 0 0.5rem; border-radius: 999px; background: var(--s2); color: var(--muted); font-weight: 500; white-space: nowrap; }
.tag.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.tag.bad { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: 0.875rem; padding: 1rem; }

/* ---------- Shell ---------- */
.hdr {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.625rem; min-height: calc(var(--hdr) + var(--sat)); padding: var(--sat) max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; text-decoration: none; margin-inline-end: auto; }
.brand b { font-family: 'Montserrat', sans-serif; font-weight: 700; letter-spacing: -0.01em; }
.pill { display: inline-flex; align-items: center; gap: 0.4375rem; min-height: 2rem; padding: 0 0.75rem; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.pill::before { content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted); }
.pill-ok::before { background: var(--ok); }
.pill-wait::before { background: var(--warn); }
.pill-off::before, .pill-bad::before { background: var(--danger); }
.avatar { width: 2.75rem; height: 2.75rem; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--s2); font-weight: 700; display: grid; place-items: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; inset-inline-start: 1rem; top: calc(100% - 0.25rem); min-width: 14rem; padding: 0.375rem; border: 1px solid var(--line-strong); border-radius: 0.875rem; background: var(--s1); box-shadow: 0 12px 32px rgb(0 0 0 / 0.35); }
.menu-head { padding: 0.5rem 0.75rem 0.625rem; border-bottom: 1px solid var(--line); margin-bottom: 0.375rem; display: grid; }
.menu-head span { color: var(--muted); font-size: 0.8125rem; }
.menu button { display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 2.75rem; padding: 0 0.75rem; border: 0; border-radius: 0.5rem; background: none; text-align: start; }
.menu button:hover { background: var(--s2); }

.tabs { display: flex; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem; min-height: 2.75rem; padding: 0.25rem 0.25rem; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.tab[aria-current='page'] { color: var(--fg); font-weight: 700; }
.tab[aria-current='page'] .i { stroke-width: 2.25; }
.tabs-bottom {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; min-height: calc(var(--tabs) + var(--sab)); padding: 0 env(safe-area-inset-right) var(--sab) env(safe-area-inset-left);
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabs-bottom .tab[aria-current='page'] { box-shadow: inset 0 2px 0 var(--fg); }
.tabs-top { display: none; }

.view { margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) calc(var(--tabs) + var(--sab) + 2.5rem) max(1rem, env(safe-area-inset-left)); }
.view.narrow { max-width: 34rem; }
.view.wide { max-width: 90rem; }
.ptitle { font-size: 1.5rem; line-height: 1.4; font-weight: 700; margin-bottom: 0.75rem; }
.stitle { font-size: 1.0625rem; font-weight: 700; margin: 1.25rem 0 0.5rem; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.625rem max(1rem, env(safe-area-inset-right)) 0; padding: 0.625rem 0.875rem; border: 1px solid var(--line-strong); border-radius: 0.875rem; background: var(--s1); }
.banner-fixed { position: fixed; inset-inline: 0; bottom: calc(var(--tabs) + var(--sab) + 4rem); z-index: 50; max-width: 30rem; margin-inline: auto; box-shadow: 0 8px 24px rgb(0 0 0 / 0.35); }
.banner-warn { border-color: var(--warn); }
.banner-card { align-items: flex-start; flex-wrap: wrap; }
.banner-card p { color: var(--muted); font-size: 0.875rem; }
#banners { max-width: 34rem; margin: 0 auto; }
.toast {
  position: fixed; inset-inline: 1rem; bottom: calc(var(--tabs) + var(--sab) + 1rem); z-index: 40; width: fit-content; max-width: calc(100vw - 2rem); margin-inline: auto; padding: 0.75rem 1.25rem; border-radius: 999px;
  background: var(--fg); color: var(--bg); font-weight: 500; opacity: 0; translate: 0 0.5rem; pointer-events: none; transition: opacity 200ms var(--ease), translate 200ms var(--ease);
}
.toast.show { opacity: 1; translate: 0 0; }

/* ---------- Login ---------- */
.login { position: relative; min-height: 100dvh; display: grid; align-items: center; overflow: hidden; padding: calc(2rem + var(--sat)) 1.5rem calc(2rem + var(--sab)); }
.login-mark { position: absolute; inset-inline-end: -20vw; top: 50%; translate: 0 -50%; width: 90vw; max-width: 44rem; aspect-ratio: 737 / 667; fill: var(--s2); pointer-events: none; }
.login-box { position: relative; display: grid; gap: 1rem; width: min(100%, 22rem); margin-inline: auto; }
.login-box .mark { width: 3rem; height: 2.75rem; }
.login-box h1 { font-family: 'Montserrat', sans-serif; font-size: 2rem; line-height: 1.2; font-weight: 700; }
.lead { color: var(--muted); }
.gbtn { min-height: 2.75rem; max-height: 3rem; max-width: 280px; overflow: hidden; }
/* Google's fallback markup (shown until its iframe loads) must never blow up: keep the G at icon size. */
.gbtn svg { width: 18px; height: 18px; }

/* ---------- Visit form ---------- */
.form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: 0.375rem; }
.lbl { font-weight: 700; font-size: 0.9375rem; }
.req { color: var(--danger); font-style: normal; }
.photo-btn {
  display: grid; justify-items: center; align-content: center; gap: 0.25rem; min-height: 11rem; border: 2px dashed var(--line-strong); border-radius: 1rem; background: var(--s1); color: var(--fg);
}
.photo-btn span { color: var(--muted); font-size: 0.875rem; }
.preview { display: grid; gap: 0.5rem; }
.preview img { width: 100%; max-height: 22rem; object-fit: cover; border-radius: 1rem; background: var(--s2); }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.5rem; }
.seg button { min-height: 2.875rem; padding: 0 0.75rem; border: 1px solid var(--line-strong); border-radius: 0.75rem; background: var(--s1); font-weight: 500; }
.seg button[aria-pressed='true'] { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 700; }
.locres { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.625rem 0.875rem; border-radius: 0.75rem; background: var(--s1); border: 1px solid var(--line); }
.locres .acc { font-size: 1.125rem; }
.locres p { flex-basis: 100%; }
.locres a { color: var(--accent); }
.foot { text-align: center; color: var(--muted); font-size: 0.8125rem; }

/* ---------- My visits ---------- */
.vlist { display: grid; gap: 0.625rem; }
.vcard { display: flex; gap: 0.75rem; padding: 0.625rem; border: 1px solid var(--line); border-radius: 0.875rem; background: var(--s1); }
.vcard.is-failed { border-color: var(--danger); }
.vthumb { width: 4.5rem; height: 4.5rem; flex: none; border-radius: 0.625rem; object-fit: cover; background: var(--s2); }
.vthumb.nothumb { display: none; }
.vbody { min-width: 0; display: grid; gap: 0.125rem; align-content: start; }
.tags { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.acts { display: flex; gap: 0.5rem; margin-top: 0.375rem; flex-wrap: wrap; }

/* ---------- Dashboard ---------- */
.dhead-page .sub { color: var(--muted); margin-top: -0.5rem; margin-bottom: 0.5rem; }
.view h2 { font-size: 1.0625rem; font-weight: 700; margin-bottom: 0.25rem; }
.view h3 { font-size: 0.9375rem; font-weight: 700; }
.view section { margin-top: 1.75rem; }
.filters { position: sticky; top: calc(var(--hdr) + var(--sat)); z-index: 5; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.625rem 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.filters .input { flex: 0 1 9.5rem; width: auto; min-height: 2.75rem; }
.filters .f-q { flex: 1 1 14rem; }
.filters .dt { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--muted); font-size: 0.875rem; }
.filters .dt .input { flex-basis: 9rem; }
.count { margin-inline-start: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.5rem; }
.kpi { background: var(--s1); border: 1px solid var(--line); border-radius: 0.875rem; padding: 0.625rem 0.875rem; }
.kpi b { display: block; font-size: 1.75rem; line-height: 1.3; font-weight: 700; }
.kpi span { color: var(--muted); font-size: 0.8125rem; }
.scroll { overflow-x: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
.heat th, .heat td { padding: 0.4375rem 0.75rem; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
.heat th { font-weight: 500; color: var(--muted); font-size: 0.8125rem; }
.heat th:first-child, .heat td:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--s1); z-index: 1; font-weight: 500; }
.heat td.h { background: color-mix(in srgb, var(--gap) calc((100 - var(--p, 100)) * 0.5%), var(--s1)); }
.heat tr.total td { border-top: 2px solid var(--line-strong); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 0.75rem; margin-top: 0.5rem; }
.bars { display: grid; gap: 0.3125rem; margin-top: 0.75rem; }
.brow { display: grid; grid-template-columns: minmax(4.5rem, 9.5rem) 1fr 2.25rem; align-items: center; gap: 0.625rem; font-size: 0.875rem; }
.brow .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .t { height: 0.875rem; }
.brow .t i { display: block; height: 100%; min-width: 2px; background: var(--bar); border-radius: 4px 0 0 4px; }
.brow .v { text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl { width: 100%; height: 11rem; display: block; margin-top: 0.5rem; }
.tl rect { fill: var(--bar); }
.tl text { fill: var(--muted); font: 400 11px var(--font); }
.tl line { stroke: var(--line-strong); }
.list th { text-align: start; font-weight: 500; color: var(--muted); font-size: 0.8125rem; padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.list th button { border: 0; background: none; padding: 0; font-weight: 500; color: inherit; }
.list th[aria-sort='ascending'] button, .list th[aria-sort='descending'] button { color: var(--fg); }
.list th[aria-sort='ascending'] button::after { content: ' ▲'; font-size: 0.6rem; }
.list th[aria-sort='descending'] button::after { content: ' ▼'; font-size: 0.6rem; }
.list td { padding: 0.625rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tr:hover td { background: var(--s1); }
.thumb { display: block; width: 4rem; height: 4rem; padding: 0; border: 1px solid var(--line); border-radius: 0.5rem; overflow: hidden; background: var(--s2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.biz { font-weight: 700; cursor: pointer; }
.note { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.8125rem; }
.ph { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.ph a { text-decoration: none; }
.ph a.tel { direction: ltr; unicode-bidi: isolate; border-bottom: 1px solid var(--line-strong); }
.ph a.wa { font-size: 0.75rem; padding: 0.25rem 0.625rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); }
.ph.invalid bdi { text-decoration: line-through; color: var(--danger); direction: ltr; }
.mapl { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.ts { white-space: nowrap; color: var(--muted); font-size: 0.8125rem; }
dialog { width: min(60rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 1px solid var(--line-strong); border-radius: 1rem; background: var(--s1); color: var(--fg); overflow: auto; }
dialog::backdrop { background: var(--scrim); }
.dhead { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.625rem 1rem; background: var(--s1); border-bottom: 1px solid var(--line); z-index: 1; }
.dbody { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; padding: 1rem; }
.pics img { width: 100%; height: auto; border-radius: 0.625rem; display: block; background: var(--s2); }
dl { margin: 0 0 1rem; display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.375rem 0.75rem; align-content: start; font-size: 0.875rem; }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; }
.confirm { display: grid; gap: 0.5rem; justify-items: start; padding: 0.75rem; border: 1px solid var(--danger); border-radius: 0.75rem; }

/* ---------- Map ---------- */
.maplay { display: grid; gap: 0.75rem; }
/* OSM tiles are light only: invert them for the dark theme. */
.map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
@media (prefers-color-scheme: light) { .map .leaflet-tile-pane { filter: none; } }
.map { height: 58dvh; min-height: 22rem; border-radius: 1rem; border: 1px solid var(--line); background: var(--s2); z-index: 0; }
.agents { display: grid; gap: 0.5rem; align-content: start; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; color: var(--muted); font-size: 0.8125rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; display: inline-block; }
.dot.live, .ag-live { background: #2fbf71; color: #fff; }
.dot.recent, .ag-recent { background: #f2b01e; color: #212121; }
.dot.stale, .ag-stale { background: #8c8d92; color: #fff; }
.ag { display: grid; place-items: center; width: 2.125rem; height: 2.125rem; border-radius: 50%; border: 2px solid #fff; font: 700 0.9375rem/1 var(--font); box-shadow: 0 2px 6px rgb(0 0 0 / 0.4); }
.ag-sm { width: 2rem; height: 2rem; flex: none; box-shadow: none; }
.alist { display: grid; gap: 0.375rem; }
.arow { display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 3rem; padding: 0.375rem 0.625rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--s1); text-align: start; }
.ainfo { display: grid; flex: 1; min-width: 0; line-height: 1.4; }
.cnt { min-width: 1.75rem; text-align: center; font-weight: 700; }
.ptumb { width: 9rem; max-width: 100%; border-radius: 0.5rem; margin-top: 0.375rem; display: block; }
.leaflet-container { font-family: var(--font); }

/* ---------- Users ---------- */
.add { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.addrow { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.addrow input { flex: 1 1 14rem; width: auto; }
.addrow select { flex: 0 1 8rem; width: auto; }
.utable select { min-width: 8rem; }

/* ---------- Mobile: tables become cards ---------- */
@media (max-width: 56rem) {
  .list thead { display: none; }
  .list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { background: var(--s1); border: 1px solid var(--line); border-radius: 0.875rem; padding: 0.5rem 0.875rem; margin-bottom: 0.625rem; }
  .list td { padding: 0.375rem 0; border: 0; display: grid; grid-template-columns: 5rem 1fr; gap: 0.5rem; }
  .list td::before { content: attr(data-l); color: var(--muted); font-size: 0.8125rem; }
  .list td.c0 { grid-template-columns: 1fr; }
  .list td.c0::before { display: none; }
  .list tr:hover td { background: none; }
  .note { max-width: 100%; }
  .count { margin-inline-start: 0; flex-basis: 100%; }
  .filters { position: static; }
  .filters .input { flex: 1 1 8rem; }
  .dbody { grid-template-columns: 1fr; }
  .pill { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Desktop: tabs move into the header, wide views breathe ---------- */
@media (min-width: 56rem) {
  .tabs-bottom { display: none; }
  .tabs-top { display: flex; gap: 0.25rem; margin-inline-end: auto; }
  .tabs-top .tab { flex-direction: row; gap: 0.5rem; padding: 0 0.875rem; border-radius: 999px; font-size: 0.9375rem; }
  .tabs-top .tab[aria-current='page'] { background: var(--s2); }
  .brand { margin-inline-end: 1rem; }
  .view { padding-bottom: 3rem; }
  .toast { bottom: 1.5rem; }
  .maplay { grid-template-columns: minmax(0, 1fr) 20rem; }
  .map { height: calc(100dvh - 11rem); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
