/* SigRep: design tokens, components and page layouts. One stylesheet for the app, the sign-in page and the wall
   display. Colors come from the tokens below; dark mode follows the device, and the wall display can force either
   theme with .dark / .light on <html>. */

/* ---- tokens --------------------------------------------------------------------------------- */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f0f3f7; --surface-3: #e7ecf2;
  --border: #dde3ea; --border-strong: #c5ceda;
  --text: #111827; --text-muted: #5b6675; --text-faint: #8a94a3;
  --accent: #1d4ed8; --accent-hover: #1e40af; --accent-subtle: #e8eefc; --accent-text: #ffffff;
  --danger: #c92a2a; --danger-subtle: #fdecec; --warning: #b45309; --warning-subtle: #fdf3e2;
  --success: #2b8a3e; --success-subtle: #e9f6ec; --info: var(--accent); --info-subtle: var(--accent-subtle);
  --series-1: #2a78d6; --st-none: #c3c2b7; --st-good: #0ca30c; --st-warning: #fab219; --st-serious: #ec835a; --st-critical: #d03b3b;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06); --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .16);
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --appbar-h: 56px;
  --control-h: 36px;  /* every text box, dropdown, button and chip, small ones included */
  color-scheme: light;
  /* Names the older tab styles use, until phase 2 moves them onto the tokens above. */
  --card: var(--surface); --fg: var(--text); --muted: var(--text-muted);
}
@media (prefers-color-scheme: dark) { :root:not(.light) {
  --bg: #0d1117; --surface: #151b23; --surface-2: #1b2330; --surface-3: #232d3b;
  --border: #29333f; --border-strong: #3a4656;
  --text: #e6edf3; --text-muted: #96a3b3; --text-faint: #6c7886;
  --accent: #5b8cff; --accent-hover: #7aa2ff; --accent-subtle: #17233b; --accent-text: #0b1220;
  --danger: #ff6b6b; --danger-subtle: #3a1a1c; --warning: #f5a524; --warning-subtle: #3a2a12;
  --success: #51cf66; --success-subtle: #15301d;
  --series-1: #3987e5; --st-none: #52514e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 14px rgba(0, 0, 0, .45); --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
  color-scheme: dark;
} }
:root.dark {  /* the wall display's own theme setting */
  --bg: #0d1117; --surface: #151b23; --surface-2: #1b2330; --surface-3: #232d3b;
  --border: #29333f; --border-strong: #3a4656;
  --text: #e6edf3; --text-muted: #96a3b3; --text-faint: #6c7886;
  --accent: #5b8cff; --accent-hover: #7aa2ff; --accent-subtle: #17233b; --accent-text: #0b1220;
  --danger: #ff6b6b; --danger-subtle: #3a1a1c; --warning: #f5a524; --warning-subtle: #3a2a12;
  --success: #51cf66; --success-subtle: #15301d;
  --series-1: #3987e5; --st-none: #52514e;
  color-scheme: dark;
}

/* ---- base ----------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--fs-md)/1.5 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-2) 0; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--text-muted); font-size: var(--fs-xs); }
.err { color: var(--danger); }
.ok { color: var(--success); }
main { padding: var(--space-5) var(--space-4) 96px; max-width: 1320px; margin: 0 auto; }
pre { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); padding: 10px; border-radius: var(--radius); max-height: 60vh; overflow: auto; font: var(--fs-sm)/1.5 var(--mono); }

/* ---- controls ------------------------------------------------------------------------------- */
input, select, textarea, .btn { font: inherit; color: var(--text); }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=email], input[type=date], input:not([type]), select, textarea {
  height: var(--control-h); padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 72px; font: var(--fs-sm)/1.45 var(--mono); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { padding-right: 28px; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a94a3' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn.danger:hover:not(:disabled) { background: var(--danger-subtle); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 0 10px; font-size: var(--fs-sm); }
a.btn { display: inline-flex; }

/* A switch for booleans: a checkbox drawn as a toggle. */
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: 10px; background: var(--border-strong); transition: background .15s; position: relative; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* ---- surfaces ------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: var(--space-4); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-title { font-size: var(--fs-lg); font-weight: 600; margin: 0 0 var(--space-1); }
.card-sub { color: var(--text-muted); margin: 0 0 var(--space-4); font-size: var(--fs-sm); }
.page-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; margin: 0 0 var(--space-5); }
.page-head h1 { font-size: var(--fs-2xl); margin: 0; letter-spacing: -.01em; }
.page-head p { margin: var(--space-1) 0 0; color: var(--text-muted); max-width: 72ch; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head .actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.stack { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
.card { overflow-x: auto; }  /* a wide table scrolls inside its card instead of widening the page */
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; }
.empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-muted); }
.empty strong { display: block; color: var(--text); font-size: var(--fs-lg); margin-bottom: var(--space-1); }

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.plain { border: 0; background: transparent; }
table.plain th { background: transparent; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 500;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface); white-space: nowrap; }
.pill.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-subtle); }
.pill.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-subtle); }
.pill.warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-subtle); }
.pill.info { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-subtle); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.risk { display: inline-block; min-width: 34px; text-align: center; padding: 2px 6px; border-radius: 10px; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }

.banner { display: flex; gap: var(--space-2); align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); margin-bottom: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-subtle); color: var(--text); }
.banner::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--warning); color: #fff; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.banner.error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-subtle); }
.banner.error::before { background: var(--danger); }
.banner.info { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-subtle); }
.banner.info::before { content: "i"; background: var(--accent); }

/* ---- app bar ---------------------------------------------------------------------------------- */
.appbar { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: var(--space-4); height: var(--appbar-h);
  padding: 0 var(--space-4); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.01em; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; display: block; }
.navlinks { display: flex; align-items: center; gap: 2px; height: 100%; }
.navlinks a, .menu-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.navlinks a:hover, .menu-btn:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.navlinks a[aria-current=page], .menu-btn.current { color: var(--text); }
.navlinks a[aria-current=page]::after, .menu-btn.current::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -10px; height: 2px; border-radius: 2px; background: var(--accent); }
.appbar .spacer { flex: 1; }
.appbar-end { display: flex; align-items: center; gap: var(--space-1); }
.getapp { display: inline-flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.getapp:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.caret { width: 10px; height: 6px; flex: none; opacity: .7; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-subtle); color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; flex: none; }
.menu-btn.account { padding: 0 8px 0 4px; }
.menu-btn.account .who { color: var(--text); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); display: none; z-index: 1100; }
.menu.open .menu-list { display: block; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.menu-list a:hover, .menu-list a:focus-visible, .menu-list button:hover { background: var(--surface-2); text-decoration: none; box-shadow: none; }
.menu-list a[aria-current=page] { background: var(--accent-subtle); color: var(--accent); }
.menu-list .badge { margin-left: auto; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-toggle { display: none; }
/* Phones and narrow windows: everything moves into a sheet opened from the menu button. */
.sheet { position: fixed; inset: var(--appbar-h) 0 0 0; z-index: 990; background: var(--surface); overflow-y: auto; padding: var(--space-3) var(--space-4) var(--space-8); }
.sheet h4 { margin: var(--space-4) 0 var(--space-1); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.sheet a { display: flex; align-items: center; gap: var(--space-2); padding: 12px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-lg); }
.sheet a[aria-current=page] { background: var(--accent-subtle); color: var(--accent); }
.sheet a .badge { margin-left: auto; }
@media (max-width: 860px) {
  main { padding-left: var(--space-3); padding-right: var(--space-3); }
  .card { padding: var(--space-4); }
  .navlinks, .appbar-end .menu { display: none; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
}

/* ---- dialogs and toasts ------------------------------------------------------------------------ */
dialog.dlg { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
/* A wide one for tables (an account's places): as wide as the table needs, scrolling down rather than across. */
dialog.dlg.wide { width: min(820px, calc(100vw - 32px)); }
dialog.dlg.wide .dlg-body { max-height: calc(100vh - 180px); overflow-y: auto; }
dialog.dlg.wide .placetable { width: 100%; }
@media (max-width: 700px) { dialog.dlg.wide .dlg-body { padding-left: var(--space-3); padding-right: var(--space-3); } }
dialog.dlg::backdrop { background: rgba(10, 15, 25, .45); }
.dlg-body { padding: var(--space-5) var(--space-5) var(--space-4); }
.dlg-body h2 { font-size: var(--fs-lg); margin: 0 0 var(--space-2); }
.dlg-body p { margin: 0 0 var(--space-3); color: var(--text-muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.toasts { position: fixed; z-index: 5000; left: 50%; bottom: var(--space-5); transform: translateX(-50%); display: grid; gap: var(--space-2); pointer-events: none; }
.toast { pointer-events: auto; min-width: 240px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  background: var(--text); color: var(--surface); font-weight: 500; animation: toast-in .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- forms ---------------------------------------------------------------------------------- */
.form { display: grid; gap: 2px; }
.field { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 4px var(--space-5); padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start; }
.field:last-child { border-bottom: 0; }
.field > span { padding-top: 7px; font-weight: 500; }
.field > .ctl { min-width: 0; }
.field input[type=text], .field input[type=number], .field input[type=password], .field select, .field textarea { width: 100%; max-width: 560px; }
.field > .switch { padding-top: 8px; justify-self: start; }
.field .help { grid-column: 2; color: var(--text-muted); font-size: var(--fs-sm); max-width: 72ch; }
.field .checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 8px; }
.field .checks label { display: inline-flex; gap: 6px; align-items: center; }
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent) !important; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: var(--space-3) 0; padding: var(--space-2) var(--space-4) var(--space-3); background: var(--surface-2); }
fieldset > legend { font-weight: 600; font-size: var(--fs-sm); padding: 0 6px; color: var(--text); }
fieldset .field { border-bottom-color: var(--border); }
@media (max-width: 760px) {
  .field { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .field > span { padding-top: 0; }
  .field .help { grid-column: 1; }
}

/* ---- settings ------------------------------------------------------------------------------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.setnav { position: sticky; top: calc(var(--appbar-h) + var(--space-4)); display: grid; gap: 2px; }
.setnav h4 { margin: var(--space-4) 0 var(--space-1); padding: 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.setnav h4:first-child { margin-top: 0; }
.setnav button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); font: inherit; cursor: pointer; }
.setnav button:hover { background: var(--surface-2); color: var(--text); }
.setnav button.active { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.setnav-select { display: none; width: 100%; margin-bottom: var(--space-4); }
.setbody { min-width: 0; }
.setbody .card { padding: var(--space-2) var(--space-5); }
#settingsBody > .form, #settingsBody > div > .form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-1) var(--space-5); box-shadow: var(--shadow-sm); }
#settingsBody > .form + *, #settingsBody > .banner + .form { margin-top: var(--space-4); }
.setbody .card.pad { padding: var(--space-5); }
.listtools { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.listtools input[type=search] { flex: 1 1 240px; }
details.card { padding: 0; margin-bottom: var(--space-2); box-shadow: none; }
details.card + details.card { margin-top: 0; }
details.card > summary { cursor: pointer; padding: 10px 14px; display: flex; gap: var(--space-2); align-items: center; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; flex: none; }
details.card[open] > summary::before { transform: rotate(45deg); }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
details.card > summary .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.card > .body { padding: var(--space-2) var(--space-4) var(--space-4); }
h3.group { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: var(--space-5) 0 var(--space-2); display: flex; align-items: center; gap: var(--space-2); }
h3.group:first-child { margin-top: var(--space-1); }
.savebar { position: fixed; z-index: 900; left: 50%; bottom: var(--space-4); transform: translate(-50%, calc(100% + 40px)); transition: transform .2s ease;
  display: flex; gap: var(--space-2); align-items: center; width: min(760px, calc(100vw - 32px)); padding: 10px 12px 10px 16px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.savebar.show { transform: translate(-50%, 0); }
.savebar .msg { flex: 1; font-weight: 500; }
.savebar .msg.err { color: var(--danger); font-weight: 400; font-size: var(--fs-sm); }
.yamlbar { display: flex; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); flex-wrap: wrap; }
.yamlbar select { width: auto; }
#yamlText { margin-top: var(--space-2); width: 100%; min-height: 62vh; font: 12px/1.5 var(--mono); padding: 12px; border-radius: var(--radius); }
@media (max-width: 900px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .setnav { display: none; }
  .setnav-select { display: block; }
}

/* ---- my locations, my account, requests ------------------------------------------------------- */
.locgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--space-2); margin: var(--space-3) 0; }
.loccard { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.loccard:hover { border-color: var(--border-strong); }
.loccard:has(input:checked) { border-color: var(--accent); background: var(--accent-subtle); }
.loccard .name { font-weight: 500; }
.formrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: var(--space-2); align-items: end; }
.formrow label, .stackfield { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 500; }
.formrow label input, .formrow label select, .stackfield input, .stackfield select { width: 100%; }
.tokenbox { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.tokenbox input { flex: 1; font-family: var(--mono); }
.reqmap { height: 120px; width: 200px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.reqrow input { width: 7.5em; }

/* ---- sign-in page --------------------------------------------------------------------------- */
body.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4);
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%), var(--bg); }
.signin-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px 28px 24px; }
.signin-card .brand { font-size: 22px; margin-bottom: var(--space-5); }
.signin-card .brand img { width: 36px; height: 36px; }
.signin-card h1 { font-size: var(--fs-xl); margin: 0 0 var(--space-1); }
.signin-card p.sub { margin: 0 0 var(--space-5); color: var(--text-muted); }
.signin-card label { display: block; font-weight: 500; font-size: var(--fs-sm); margin: var(--space-4) 0 6px; }
.signin-card input { width: 100%; height: 42px; font-size: var(--fs-lg); }
.signin-card .btn { width: 100%; height: 42px; margin-top: var(--space-5); font-size: var(--fs-lg); }
.signin-card .banner { margin: 0 0 var(--space-2); }
.signin-foot { margin-top: var(--space-5); text-align: center; color: var(--text-faint); font-size: var(--fs-xs); }

/* ---- roles ---------------------------------------------------------------------------------- */
/* A user (not an admin) changes nothing but their own account and what they acknowledge; the server refuses the rest. */

/* ---- data pages: dashboard, items, areas, map, sources, queue, stats, item details ------- */
body.user .adminonly { display: none !important; }
section > .card + .card, section > .card, section > .chartcard { margin-top: var(--space-4); }
section > .page-head + .card, section > .page-head + .tiles + .card { margin-top: 0; }
.cardhead { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); margin: 0; color: var(--text-muted); }
.cardhead h2 { font-size: var(--fs-md); margin: 0; color: var(--text); }
.cardhead .grow { flex: 1; font-size: var(--fs-sm); }
.panelcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.panelcard.flush { padding: 0; }
.tablecard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow-x: auto; }
.tablecard > table { border: 0; border-radius: 0; }
.scroll { overflow-x: auto; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.handled td { opacity: .6; }
tr.group th { background: var(--surface-3); color: var(--text); font-size: var(--fs-sm); text-transform: none; letter-spacing: 0; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.status { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ext { font-size: var(--fs-xs); margin-left: 4px; }
.show-sm { display: none; }
.rownote { margin-top: 4px; max-width: 360px; overflow-wrap: anywhere; white-space: normal; }
a.navlink { color: inherit; }
a.navlink:hover { color: var(--accent); }

/* Filters: a search box, then dropdowns in a grid; a filter that's set is outlined in the accent color. */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); display: grid; gap: var(--space-3); }
.frow { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.frow input[type=search] { flex: 1 1 260px; min-width: 0; padding-left: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%238a94a3' stroke-width='1.6'/%3E%3Cpath d='M11 11l3.5 3.5' stroke='%238a94a3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 11px center; }
.frow .sort { display: flex; gap: 6px; align-items: center; color: var(--text-muted); font-size: var(--fs-sm); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-2) var(--space-3); }
.fgrid label { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; }
.fgrid select { width: 100%; min-width: 0; font-size: var(--fs-md); }
.filters select.on, .filters input[type=search].on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; height: var(--control-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-muted); font-size: var(--fs-sm); cursor: pointer; user-select: none; background: var(--surface); }
.chip input { margin: 0; width: 14px; height: 14px; }
.chip:has(input:checked) { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }
.ftoggle { display: none; }
.ftoggle::before { content: "Filters"; }
.ftoggle:not([data-n=""])::after { content: attr(data-n); display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700; }
.ftoggle[data-n=""]::after, .ftoggle:not([data-n])::after { display: none; }
@media (max-width: 700px) {
  .ftoggle { display: inline-flex; }
  .ftoggle { font-size: 0; }  /* the label comes from ::before and ::after */
  .ftoggle::before, .ftoggle::after { font-size: var(--fs-md); }
  .ftoggle::after { font-size: 11px; }
  .filters:not(.open) .fgrid, .filters:not(.open) .chips, .filters:not(.open) .sort { display: none; }
  .frow input[type=search] { flex: 1 1 0; }
}
.fnote { color: var(--text-muted); font-size: var(--fs-sm); }
.fnote:empty { display: none; }
.fnote .pill { margin-right: 4px; }
.resultbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--text-muted); }
.resultbar .grow { flex: 1; }

/* Stat tiles: they wrap and grow, so every row, the last one too, spans the full width. */
.tiles { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.tiles > .tile { flex: 1 1 160px; min-width: 0; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.tile .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.tile .k { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }
.tile.warn .v { color: var(--warning); }
a.tile:hover { border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; }

/* Items: a table on wide screens, one card per row on phones. */
@media (max-width: 700px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  table.rows thead { display: none; }
  table.rows, table.rows tbody, table.rows tr, table.rows td { display: block; width: 100%; }
  table.rows tr { padding: 10px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; }
  table.rows tr:last-child { border-bottom: 0; }
  table.rows td { padding: 0; border: 0; }
  table.rows td:first-child { grid-row: span 3; }
  table.rows td:not(:first-child) { grid-column: 2; }
  table.rows td.hide-sm { display: none; }
  table.sources .acts { white-space: normal; }
}
table.sources th.grow { width: 50%; }
table.sources td.name { overflow-wrap: anywhere; min-width: 120px; font-weight: 500; }

/* Maps */
#map { height: 70vh; min-height: 420px; }
#areasMap { height: 320px; }
#itemMap { height: 280px; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 10px; }
.maplibregl-map { font: inherit; background: #f2efe9; }  /* the map's own land colour, behind tiles still loading */
.maplibregl-map.mapdark { background: #1c2026; }
/* A map loading (map.js SigMap): the base map first, then its controls fade in with it. */
.maplibregl-control-container { transition: opacity .25s; }
.map-loading .maplibregl-control-container { opacity: 0; }
.mapwrap:not(.ready) > .mapctl, .mapwrap:not(.ready) > .maptools { display: none; }
.maplibregl-ctrl-group { background: var(--surface); box-shadow: var(--shadow-md); }
.maplibregl-ctrl-group button { color: var(--text); }
.maplibregl-ctrl-group button + button { border-top-color: var(--border); }
.maplibregl-ctrl-group button:not(:disabled):hover { background: var(--surface-2); }
/* The zoom buttons follow the page's theme (their icons are dark drawings): light on a dark page. */
@media (prefers-color-scheme: dark) { :root:not(.light) .maplibregl-ctrl-icon { filter: invert(1); } }
:root.dark .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-popup-content { background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); border-radius: var(--radius); padding: 10px 14px; }
.maplibregl-popup-close-button { color: var(--text-muted); font-size: 18px; padding: 0 6px; }
.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.maptip .maplibregl-popup-content { padding: 4px 8px; font-size: var(--fs-xs); pointer-events: none; }
.mapdark .maplibregl-ctrl-attrib, .mapdark .maplibregl-ctrl-scale { background: rgba(21, 27, 35, .8); color: #c9d1d9; border-color: #96a3b3; }
.mapdark .maplibregl-ctrl-attrib a { color: #7aa2ff; }
.maptheme button.maptheme-btn { display: flex; align-items: center; gap: 5px; width: auto; height: 29px; padding: 0 8px; font-size: var(--fs-xs); white-space: nowrap; }
/* A tab showing what it had last time while its new data comes in (boot.js refresh). */
.stalebar { position: sticky; top: 0; z-index: 20; margin: 0 0 10px; padding: 6px 12px; border-radius: 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-size: var(--fs-xs); }
.stalebar::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--accent, #1d4ed8); animation: stalepulse 1s ease-in-out infinite alternate; }
.stalebar.failed::before { background: #c92a2a; animation: none; }
@keyframes stalepulse { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stalebar::before { animation: none; } }
section.stale > :not(.stalebar) { opacity: .55; transition: opacity .15s; }
/* Why the Crime layer shows no blocks here (zoom in, no city data, still coming in). */
.mapnote { max-width: min(320px, 70vw); padding: 6px 10px; background: var(--surface); color: var(--text); border-radius: 6px; box-shadow: var(--shadow-md); font-size: var(--fs-xs); line-height: 1.35; }
.mapnote[hidden] { display: none; }
/* Directions: the start, the end, and the turn being looked at. */
.routemark { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.routemark.start { background: #1d4ed8; }
.routemark.end { background: #111827; }
.routemark.turn { width: 20px; height: 20px; background: rgba(245, 159, 0, .35); border-color: #f59f00; }
.mapwrap:fullscreen { background: var(--bg); padding: 10px; display: flex; flex-direction: column; }
.mapwrap:fullscreen .maplibregl-map { flex: 1; height: auto !important; }  /* over #map and #dashMap's fixed heights */
.maplegend { background: var(--surface); color: var(--text); padding: 6px 10px; border-radius: var(--radius-sm); font-size: var(--fs-xs); line-height: 1.6; box-shadow: var(--shadow-md); }
.maplegend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
/* The dashboard map's controls sit on the map: filters in a panel that opens from the top-right corner, zoom and
   full-screen buttons under + and -. */
.mapopts { background: var(--surface); color: var(--text); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); font-size: var(--fs-sm); }
.mapopts > button { border: 0; background: none; color: inherit; font: inherit; font-weight: 500; padding: 6px 12px; cursor: pointer; }
.mapopts .mapctl { display: none; padding: 0 8px 8px; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 300px; }
.mapopts.open .mapctl { display: grid; }
.mapctl select { height: 30px; font-size: var(--fs-sm); padding: 2px 24px 2px 8px; min-width: 0; background-position: right 8px center; }
.maptools button { display: block; width: 30px; height: 30px; padding: 0; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; line-height: 30px; cursor: pointer; }
.maptools button:last-child { border-bottom: 0; }
.maptools button:hover { background: var(--surface-2); }

/* Dashboard */
.dashtop { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-4); margin-bottom: var(--space-4); }
.dashtop.single { grid-template-columns: minmax(0, 1fr); }
#dashMap { height: 440px; }
#dashAreasWrap { display: flex; flex-direction: column; }
.dashareas { display: flex; flex-wrap: wrap; gap: var(--space-2); max-height: 440px; overflow-y: auto; align-content: flex-start; padding: var(--space-3); }
.dashareas > .area { flex: 1 1 340px; min-width: 0; }
.dashareas .area { padding: 10px 12px; }
.dashareas .area h3 { margin: 4px 0 2px; font-size: var(--fs-md); }
.dashareas .area .sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0; }
.dashareas > p { margin: var(--space-2); }
.dashpanels { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-4); }
.chartcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-sm); min-width: 0; }
.chartcard h3 { margin: 0 0 var(--space-3); font-size: var(--fs-md); }
.dashpanels .chartcard { margin: 0; }
.dashpanel h3 { margin: 0 0 2px; display: flex; gap: 8px; align-items: baseline; }
.dashpanel h3 .grow { flex: 1; }
.dashpanel .panelrows { margin-top: 6px; overflow-y: auto; scrollbar-width: thin; }
.dashpanel table { border: 0; }
.dashpanel td { vertical-align: top; padding: 8px 6px; }
.dashpanel tbody tr:hover td { background: none; }

/* Areas */
.arealist { display: grid; gap: var(--space-3); margin-top: var(--space-4); }
.area { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.area h3 { margin: 0 0 4px; font-size: var(--fs-lg); }
.area .pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.area ul { margin: 6px 0 0; padding-left: 18px; }
.leftout { margin-top: var(--space-4); padding: 12px 16px; }
.leftout summary { cursor: pointer; font-weight: 600; }
.leftout ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }

/* Stats */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.grid2 .chartcard { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-muted); font-size: var(--fs-xs); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.timeline { display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid var(--border); }
.timeline .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; cursor: default; }
.timeline .col:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.timeline .seg { min-height: 2px; }
.timeline .col .seg:last-child { border-radius: 4px 4px 0 0; }
.timeline a.col { text-decoration: none; cursor: pointer; }
.statsec { font-size: var(--fs-lg, 18px); margin: var(--space-5) 0 var(--space-3); }
.page-head + .statsec { margin-top: 0; }
.statpair { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.statpair .chartcard { margin: 0; }
td.warn { color: var(--warning); font-weight: 600; }
.tlaxis { display: flex; gap: 2px; color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.tlaxis span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.hbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 6px 10px; align-items: center; }
.hbar .track { height: 14px; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--text); }
.mini { display: inline-block; height: 8px; background: var(--series-1); border-radius: 0 4px 4px 0; vertical-align: middle; margin-right: 6px; }
.viztip { position: fixed; z-index: 20; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; font-size: var(--fs-xs); box-shadow: var(--shadow-md); max-width: 280px; }
.viztip b { font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .mini { display: none; } }

/* Item details */
.back { margin-bottom: var(--space-3); }
.back a { display: inline-flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 500; }
.back a:hover { background: var(--surface-2); text-decoration: none; }
.detail { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
.detail .card { margin: 0; }
.detail .card > h3, .detail details.card > summary { font-size: var(--fs-md); }
.detail .card > h3 { margin: 0 0 var(--space-3); }
.detail h2 { font-size: var(--fs-xl); margin: var(--space-2) 0 6px; line-height: 1.3; }
.detail .lead { font-size: var(--fs-lg); margin: 4px 0 12px; }
.detail .why { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 10px 0; }
.detail .pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.detail pre { margin: 0; max-height: 50vh; }
.detail details.card { padding: 0; }
.detail details.card > summary { padding: var(--space-4) var(--space-5); }
.detail details.card > *:not(summary) { margin: 0 var(--space-5) var(--space-4); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; }
.facts .k { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 800px) { .dashtop { grid-template-columns: minmax(0, 1fr); } #dashMap { height: 320px; } .dashpanels { grid-template-columns: minmax(0, 1fr); } }

/* ---- the wall display ---------------------------------------------------------------------------- */
/* The dashboard alone, filling the screen without scrolling. The page is zoomed to the width (see wallFit), so these
   sizes are for a 1920-pixel-wide layout at any resolution. */
#wallBar { display: none; }
body.wall header, body.wall #warnings, body.wall .resultbar .btn, body.wall .page-head, body.wall .devnote { display: none; }
body.wall main { padding: 12px 14px; max-width: none; }
body.wall { overflow: hidden; }
body.wall .hidden { display: none !important; }  /* over the layout rules below */
body.wall #tab-dashboard:not(.hidden) { display: grid; height: calc(var(--wallh, 100vh) - 24px); gap: 10px 12px;
  grid-template: "bar bar" auto "tiles tiles" auto "map areas" auto "map panels" minmax(0, 1fr) / minmax(0, var(--mapw, 40%)) minmax(0, 1fr); }
body.wall #tab-dashboard.nomap { grid-template: "bar" auto "tiles" auto "areas" auto "panels" minmax(0, 1fr) / minmax(0, 1fr); }
body.wall .dashtop { display: contents; }
body.wall #wallBar { grid-area: bar; display: flex; align-items: baseline; gap: 16px; }
body.wall #wallBar h1 { font-size: 20px; margin: 0; flex: 1; }
body.wall #wallBar h1 img { width: 26px; height: 26px; }
body.wall #wallClock { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.wall #wallUpdated.stale { color: #fff; background: var(--danger); padding: 2px 10px; border-radius: var(--radius-sm); font-size: 14px; }
body.wall #dashTiles { grid-area: tiles; margin: 0; }
body.wall .tile { padding: 10px 12px; box-shadow: none; }
body.wall .tile .v { font-size: 22px; }
body.wall #dashMapWrap { grid-area: map; display: flex; flex-direction: column; min-height: 0; }
body.wall #dashMap { flex: 1; height: auto; min-height: 0; zoom: var(--unzoom, 1); }  /* the map at the screen's own pixels: zoomed tiles show hairline gaps */
body.wall #dashAreasWrap { grid-area: areas; min-height: 0; }
body.wall .dashareas { max-height: calc(var(--wallh, 100vh) * .3); overflow: hidden; }
body.wall #dashPanels { grid-area: panels; min-height: 0; overflow-y: auto; align-content: start; scrollbar-width: thin; }
body.wall #tab-dashboard:not(.nomap) #dashPanels { grid-template-columns: repeat(4, minmax(0, 1fr)); }  /* four across beside the map */
body.wall .chartcard { padding: 10px 12px; box-shadow: none; }
body.wall a { color: inherit; text-decoration: none; }
body.wall a:hover { text-decoration: underline; }
/* An item's details open over the dashboard, which keeps updating underneath. */
body.wall #tab-item:not(.hidden) { position: fixed; inset: 0; z-index: 3000; overflow-y: auto; background: var(--bg); padding: 16px 24px; }
body.wall #itemDetail { max-width: 1400px; margin: 0 auto; }
.citypicker { display: grid; gap: var(--space-3); margin-top: var(--space-3); padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.citypicker .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paneltoggle { grid-column: 1 / -1; justify-self: start; }
.placetable th.tick, .placetable td.tick { text-align: center; width: 1%; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.placetable th.tick label { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; }
.placetable .placename { display: flex; align-items: center; gap: 4px; }
.placetable .caret { width: 26px; padding: 0; }
.placetable .caret-gap { display: inline-block; width: 26px; }
.placetable tr.kind-global td, .placetable tr.kind-continent td { font-weight: 600; }
.placetable th.tick .short { display: none; }
@media (max-width: 700px) {
  .placetable th.tick .long, .placetable .placename .muted { display: none; }
  .placetable th.tick .short { display: inline; }
  .placetable th.tick, .placetable td.tick { padding-left: 4px; padding-right: 4px; }
}
.tablewrap { overflow-x: auto; }
.kwtable tr.changed td { background: var(--accent-subtle); }
.kwtable td { padding-top: 4px; padding-bottom: 4px; }

/* Funding: how much of the month is covered, and the bar across the top while it's short. */
.meter { height: 10px; border-radius: 999px; background: var(--surface-2, var(--border)); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
.funding-bar { align-items: center; }
.funding-bar::before { align-self: center; }

/* Directions on the Map page. */
.routepanel { margin-bottom: var(--space-3); }
.routeform { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.routeform label { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 500; flex: 1 1 220px; }
.transnote { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-muted); }
.transpill { font-size: 11px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.suggestwrap { position: relative; display: block; }
.suggestwrap input { width: 100%; }
.suggest { position: absolute; z-index: 1200; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .18);
  max-height: 260px; overflow-y: auto; font-weight: 400; }
.suggest li { padding: 7px 10px; cursor: pointer; line-height: 1.3; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--surface-2, var(--hover, rgb(127 127 127 / .12))); }
.routedir { margin-top: 8px; }
.routechoices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.routechoice { display: grid; gap: 2px; text-align: left; padding: 8px 12px; min-width: 160px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.routechoice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.routechoice .ok { color: var(--success); } .routechoice .warn { color: var(--warning); }
.routesteps { margin: 0; padding-left: 24px; display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.routesteps li { cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.routesteps li:hover { background: var(--surface-2, var(--border)); }
.routesteps li > span:first-child { margin-right: 8px; }
.routesteps li > .muted { float: right; font-size: var(--fs-sm); white-space: nowrap; }

/* Tabs within a page (My Places). */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); overflow-x: auto; }
.tabbar button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; margin-bottom: -1px;
  color: var(--text-muted); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tabbar button:hover { color: var(--text); }
.tabbar button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.stickysave { position: sticky; bottom: 0; z-index: 2; background: var(--surface); padding: 12px 0 4px; border-top: 1px solid var(--border); margin-top: 8px; }
.placetable tr.morerow td { padding-top: 2px; padding-bottom: 2px; }

/* Settings → Sources → Add Source Packs: the countries, a collapsed section per continent. */
.presetregion { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.presetregion > summary { cursor: pointer; }
.presetregion[open] > summary { margin-bottom: 8px; }
.presetregion .presetset h4 { margin: 10px 0 4px; }

/* A watched location's popup on the maps: what's been inside its circle lately. */
.placepop { display: grid; gap: 6px; font-size: var(--fs-sm); min-width: 220px; }
.placepop-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.placepop-list li { display: flex; gap: 6px; align-items: baseline; }
.placepop-links { display: flex; gap: 12px; }

/* Settings → Locations → Countries and States. */
.regiongroup { display: grid; gap: 8px; margin-top: var(--space-4); }
.regiongroup .regionhead { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.regiongroup .chips { margin: 0; }
.regiongroup .row { gap: 8px; align-items: center; }
.regiongroup input[list] { width: 260px; max-width: 100%; }
.chip .chip-x { border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 15px; line-height: 1;
  padding: 0 0 0 2px; margin-left: 2px; cursor: pointer; border-radius: 50%; }
.chip .chip-x:hover { color: var(--danger); }

/* Under active development: a note at the foot of every page, and on the sign-in pages. */
.devnote { margin: var(--space-6) 0 var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: var(--fs-xs); text-align: center; }
.devnote-short { margin-top: var(--space-2); }

/* Survival guides (guides.js): cards by category, a guide to read and print, "What to do" links elsewhere. */
.guidecat { font-size: var(--fs-lg); margin: var(--space-5) 0 var(--space-2); }
.guidegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.guidecard { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none; }
.guidecard:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.guidecard .muted { font-size: var(--fs-sm); line-height: 1.45; }
.guidecard .pill { justify-self: start; }
.guidecat-sub { margin: -4px 0 var(--space-3); color: var(--text-muted); font-size: var(--fs-sm); }
.guidegrid.start .guidecard { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-subtle); }
.guidemeta { color: var(--text-muted); font-size: var(--fs-xs); }
.guidemeta .ok { color: var(--success); font-weight: 600; }
.guidepage { display: block; }
.guidepage.withtoc { display: grid; grid-template-columns: minmax(0, 780px) 220px; gap: var(--space-5); align-items: start; }
.guideaside { position: sticky; top: 76px; }
.guidetoc { font-size: var(--fs-sm); border-left: 2px solid var(--border); padding: 2px 0 2px 14px; }
.guidetoc ol { list-style: none; margin: 6px 0 0; padding: 0; }
.guidetoc li { margin: 6px 0; line-height: 1.35; }
.guidetoc a { color: var(--text-muted); }
.guidetoc a:hover { color: var(--accent); }
@media (max-width: 1080px) { .guidepage.withtoc { display: block; } .guideaside { display: none; } }
.guidecatline { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; margin-top: var(--space-3); }
.guide h1 + .lead { margin-top: 0; }
.pocketpreview { margin: var(--space-3) 0; padding: 12px 16px; border-radius: 10px; background: var(--surface-2, var(--accent-subtle));
  border: 1px solid var(--border); }
.pocketpreview ul { margin: 6px 0 0; padding-left: 20px; }
.pocketpreview li { margin: 2px 0; }
.guidetext h3 { scroll-margin-top: 76px; }
.guidetext ol li { padding-left: 2px; }
.guidetext ul.checklist { list-style: none; padding-left: 0; }
.guidetext ul.checklist li { margin: 2px 0; }
.guidetext ul.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.guidetext ul.checklist label:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.guidetext ul.checklist input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--success); }
.guidetext ul.checklist input:checked + span { color: var(--text-muted); text-decoration: line-through; }
.guidetext .callout { margin: var(--space-3) 0; padding: 10px 14px; border-radius: 8px; border-left: 4px solid var(--accent);
  background: var(--accent-subtle); }
.guidetext .callout p { margin: 0; }
.guidetext .callout.warn { border-left-color: var(--danger); background: var(--danger-subtle); }
.guidetext .callout.tip { border-left-color: var(--success); background: var(--success-subtle); }
.guidetext .tablewrap { overflow-x: auto; margin: var(--space-3) 0; }
.guidetable { border-collapse: collapse; min-width: 60%; font-size: var(--fs-sm); }
.guidetable th, .guidetable td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.guidetable th { background: color-mix(in srgb, var(--text) 5%, transparent); font-weight: 600; }
.guiderel { margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.guiderel .guidegrid { margin-top: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.pocketcard { display: none; }
.guide { max-width: 780px; }
.guide h1 { margin: var(--space-3) 0 var(--space-1); }
.guide .lead { font-weight: 600; font-size: var(--fs-lg); }
.guidetext { line-height: 1.6; }
.guidetext h3 { margin: var(--space-4) 0 var(--space-1); font-size: var(--fs-lg); }
.guidetext li { margin: 4px 0; }
.guidesrc { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.whattodo { margin-top: 6px; font-size: var(--fs-sm); }
.guidelist { margin-bottom: var(--space-6); }  /* room between the last guides and the library below */
.guidelib h3 { margin: var(--space-4) 0 var(--space-1); }
.guidelib table { table-layout: fixed; width: 100%; }
.guidelib .librow td:nth-child(2) { width: 90px; text-align: right; color: var(--text-muted); }
.guidelib .librow td:nth-child(3) { width: 220px; }
@media (max-width: 640px) {
  .guidelib table, .guidelib tbody, .guidelib .librow, .guidelib .librow td { display: block; width: auto !important; }
  .guidelib .librow { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .guidelib .librow td { border: 0; padding: 2px 0; text-align: left !important; }
}
.whattodo a { font-weight: 600; }
@media print {
  body:has(#tab-guides:not(.hidden)) :is(header, .sheet, #fundingBar, #warnings, .devnote, .guide .row, .guideaside, .guiderel) { display: none !important; }
  .guide { border: 0; box-shadow: none; max-width: none; }
  .guidepage.withtoc { display: block; }
  .guidetext .callout, .pocketpreview { break-inside: avoid; }
  body.printcard > *:not(.pocketcard) { display: none !important; }
  body.printcard .pocketcard { display: block; width: 3.37in; min-height: 2.12in; box-sizing: border-box; padding: 0.12in 0.16in;
    border: 1px dashed #888; font: 9pt/1.3 system-ui, sans-serif; color: #000; }
  body.printcard .pocketcard b { font-size: 10pt; }
  body.printcard .pocketcard ul { margin: 4px 0; padding-left: 14px; }
  body.printcard .pc-foot { margin-top: 4px; font-size: 7pt; color: #444; }
}

/* The public home page (home.html): the sign-in page's look, roomier. */
.home-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 36px 28px; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,.08)); }
.home-card h1 { font-size: clamp(24px, 4.5vw, 32px); line-height: 1.2; margin: var(--space-5) 0 var(--space-2); }
.home-card .sub { color: var(--text-muted); font-size: var(--fs-lg); margin: 0 0 var(--space-5); }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.home-actions .btn { padding-left: 20px; padding-right: 20px; }
.home-more { margin-top: var(--space-5); font-size: var(--fs-sm); }

.donatebtns { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* The Terms of Service page (terms.html): the sign-in look, wide enough to read. */
body.terms { place-items: start center; }
.terms-card { width: 100%; max-width: 780px; margin: var(--space-5) auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 36px; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,.08)); }
.terms-card h1 { margin: var(--space-4) 0 0; }
.terms-accept { position: sticky; bottom: 0; background: var(--surface); padding: 14px 0 6px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: var(--space-4); }
.signin-card label.signin-agree { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: var(--space-4) 0 var(--space-3); }
.signin-card label.signin-agree input { width: 18px; height: 18px; flex: none; margin: 0; }

/* Reported crime on the dashboard */
.dashcrime { margin-top: var(--space-4); }
.crimelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.crimeplace h3 { margin: 0 0 6px; font-size: var(--fs-md, 1rem); }
.crimerow { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin: 4px 0; }
.crimekind { min-width: 72px; font-weight: 600; }
.crimesrc, .crimenote { font-size: var(--fs-xs); }
.crimenote { padding: 0 var(--space-4) var(--space-3); margin: 0; }
@media (max-width: 800px) { .crimelist { grid-template-columns: minmax(0, 1fr); } }
