/* TerasMap admin: design system. Tokens first, then layout, then components. Light and dark; the theme switch sets data-theme on <html>, with no
   value it follows the system. */
:root {
  --bg: #f5f7f6; --surface: #ffffff; --surface-2: #f8faf9; --hover: #f0f3f1;
  --line: #e5e9e7; --line-strong: #d3dad6;
  --text: #101828; --muted: #667085; --faint: #98a2b3;
  --brand: #0a7d57; --brand-600: #086a4a; --brand-50: #e7f5ee; --brand-100: #cfeadc; --on-brand: #ffffff;
  --ok: #067647; --ok-bg: #e7f6ee; --warn: #b54708; --warn-bg: #fef3e2; --bad: #d92d20; --bad-bg: #fdecea; --info: #1d6fb8; --info-bg: #e8f1fb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --ring: 0 0 0 3px rgba(10, 125, 87, .22);
  --r-sm: 8px; --r: 10px; --r-lg: 16px;
  --side: 264px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b100e; --surface: #131917; --surface-2: #171e1b; --hover: #1c2420;
  --line: #243029; --line-strong: #33423a;
  --text: #edf2ef; --muted: #98a59e; --faint: #6f7d76;
  --brand: #22b388; --brand-600: #3cc79c; --brand-50: rgba(34, 179, 136, .13); --brand-100: rgba(34, 179, 136, .24); --on-brand: #04170f;
  --ok: #47cd89; --ok-bg: rgba(71, 205, 137, .13); --warn: #fdb022; --warn-bg: rgba(253, 176, 34, .13); --bad: #f97066; --bad-bg: rgba(249, 112, 102, .14); --info: #6cb4f0; --info-bg: rgba(108, 180, 240, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .3); --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(34, 179, 136, .32);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b100e; --surface: #131917; --surface-2: #171e1b; --hover: #1c2420;
    --line: #243029; --line-strong: #33423a;
    --text: #edf2ef; --muted: #98a59e; --faint: #6f7d76;
    --brand: #22b388; --brand-600: #3cc79c; --brand-50: rgba(34, 179, 136, .13); --brand-100: rgba(34, 179, 136, .24); --on-brand: #04170f;
    --ok: #47cd89; --ok-bg: rgba(71, 205, 137, .13); --warn: #fdb022; --warn-bg: rgba(253, 176, 34, .13); --bad: #f97066; --bad-bg: rgba(249, 112, 102, .14); --info: #6cb4f0; --info-bg: rgba(108, 180, 240, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .3); --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
    --ring: 0 0 0 3px rgba(34, 179, 136, .32);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* on a phone the page never zooms with a pinch and never grows wider than the screen: a long name or link wraps or scrolls inside its own box */
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; max-width: 100%; overflow-x: clip; }
body { max-width: 100%; overflow-x: clip; }
.item { min-width: 0; overflow-wrap: anywhere; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; z-index: 30; }
.logo { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 6px 8px 14px; }
.logo small { display: block; margin-left: 2px; font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.brand-logo { display: block; }
.brand-img { display: block; height: auto; max-width: 100%; }
.brand-dark { display: none; }
:root[data-theme="dark"] .brand-light { display: none; }
:root[data-theme="dark"] .brand-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-light { display: none; }
  :root:not([data-theme="light"]) .brand-dark { display: block; }
}
.searchbtn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--muted); cursor: pointer; text-align: left; }
.searchbtn:hover { border-color: var(--line-strong); }
.searchbtn span { flex: 1; }
kbd { font: 600 11px/1 ui-sans-serif, system-ui; padding: 3px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--surface); }
.navgroup { margin: 12px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; color: var(--text); cursor: pointer; text-align: left; font-weight: 500; }
.nav .ico { color: var(--muted); }
.nav:hover { background: var(--hover); }
.nav.on { background: var(--brand-50); color: var(--brand); font-weight: 650; }
.nav.on .ico { color: var(--brand); }
.nav .label { flex: 1; }
.count { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--brand); color: var(--on-brand); font-size: 11.5px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); }
.me .who { min-width: 0; flex: 1; line-height: 1.25; }
.me .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { font-size: 11.5px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 13px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 32px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 15px; font-weight: 650; flex: 1; }
.btn.menu-btn { display: none; }
.page { width: 100%; max-width: 1240px; padding: 28px 32px 56px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .t { flex: 1; min-width: 240px; }
.page-head h2 { font-size: 25px; font-weight: 750; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.scrim { display: none; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px 0; }
.card-head h3 { font-size: 15px; font-weight: 650; flex: 1; min-width: 0; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 0; }
.card-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.grid { display: grid; gap: 16px; }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.c6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.grid > .card + .card { margin-top: 0; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.section-title:first-child { margin-top: 0; }

/* stat tiles */
.stat { display: block; padding: 18px 20px; color: inherit; text-decoration: none; position: relative; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .top-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 13px; }
.stat .chip { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.stat .chip.warn { background: var(--warn-bg); color: var(--warn); }
.stat .chip.info { background: var(--info-bg); color: var(--info); }
.stat .chip.bad { background: var(--bad-bg); color: var(--bad); }
.stat .arrow { margin-left: auto; color: var(--faint); }
.stat .value { display: block; margin-top: 12px; font-size: 32px; line-height: 1.05; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.stat.attn { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.input, .select, .textarea { width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; min-height: 120px; }
.field { margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.field .hint { margin: -2px 0 8px; color: var(--muted); font-size: 12.5px; }
.field .count-hint { margin-top: 5px; font-size: 12px; color: var(--faint); text-align: right; }
.inputwrap { position: relative; }
.inputwrap .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.inputwrap .input { padding-left: 34px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.toolbar .inputwrap .input { width: 100%; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--hover); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---------- status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--hover); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.brand { background: var(--brand-50); color: var(--brand); }
.banner { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--info-bg); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 25%, var(--line)); }
.banner .ico { color: var(--info); margin-top: 1px; }
.banner.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.banner.warn .ico { color: var(--warn); }
.banner.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.banner.bad .ico { color: var(--bad); }
.progress { height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #2fc79a); }
.dot-up { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.dot-up.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
.dot-up.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; padding: 10px 16px; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; vertical-align: top; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td .row { flex-wrap: nowrap; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user b { display: block; font-weight: 600; }
.cell-user span { color: var(--muted); font-size: 12.5px; }
.t-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.kind { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.kind .chip { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }

/* item cards: moderation lists */
.items > .item { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.items > .item:last-child { border-bottom: 0; }
.item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.item-head .grow { flex: 1; min-width: 0; }
.item-body { color: var(--text); }
.item-body .quote { padding: 10px 14px; border-left: 3px solid var(--brand-100); background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.item-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.item-foot .grow { flex: 1; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filechip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface); }
.filechip:hover { background: var(--hover); text-decoration: none; }
.thumb { max-width: 180px; max-height: 130px; border-radius: var(--r); border: 1px solid var(--line); display: block; }
.diff { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 12px; font-size: 13.5px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.diff .k { color: var(--muted); font-weight: 600; }
.diff .from { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.diff .to { color: var(--text); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--hover); color: var(--muted); }
.timeline .dot.ok { background: var(--ok-bg); color: var(--ok); }
.timeline .dot.bad { background: var(--bad-bg); color: var(--bad); }
.timeline .dot.warn { background: var(--warn-bg); color: var(--warn); }
.timeline .body { min-width: 0; flex: 1; }
.timeline .when { color: var(--faint); font-size: 12.5px; white-space: nowrap; }

.split { display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.split-list { padding: 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } .split-list { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; } .split-list .nav { width: auto; white-space: nowrap; } }

/* empty and loading */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; color: var(--muted); }
.empty .badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); margin-bottom: 4px; }
.empty b { color: var(--text); font-size: 15px; }
.empty p { max-width: 46ch; }
.skeleton { border-radius: var(--r); background: linear-gradient(90deg, var(--hover) 25%, var(--surface-2) 37%, var(--hover) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; }
.bars i { flex: 1; min-width: 3px; max-width: 14px; border-radius: 3px 3px 0 0; background: var(--brand-100); min-height: 4px; transition: background .12s; }
.bars i:hover { background: var(--brand); }
.bars i.bad { background: var(--bad); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 12vh 16px 16px; background: rgba(8, 14, 11, .5); backdrop-filter: blur(3px); animation: fade .14s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.modal { width: 100%; min-width: 0; max-width: 440px; max-height: calc(100dvh - 12vh - 24px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .16s ease; }
.modal .m-body, .modal .m-field { min-width: 0; overflow-wrap: anywhere; }
/* a long dialog scrolls inside itself and its buttons stay in reach */
.modal .m-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); }
/* a choice in a list: long names wrap instead of widening the dialog */
.btn.pick { display: block; width: 100%; height: auto; white-space: normal; text-align: left; overflow-wrap: anywhere; padding: 8px 12px; margin-bottom: 4px; }
.modal.wide { max-width: 560px; }
.modal h3 { padding: 20px 22px 0; font-size: 17px; font-weight: 700; }
.modal .m-body { padding: 8px 22px 4px; color: var(--muted); }
.modal .m-field { padding: 12px 22px 0; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 20px; }
.palette { max-width: 560px; padding: 0; overflow: hidden; }
.palette .input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 52px; padding-left: 46px; font-size: 15px; box-shadow: none; }
.palette .inputwrap .ico { left: 16px; }
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: 340px; overflow-y: auto; }
.palette li button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--r); background: none; text-align: left; cursor: pointer; }
.palette li button.on, .palette li button:hover { background: var(--brand-50); color: var(--brand); }
.palette .none { padding: 24px; text-align: center; color: var(--muted); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 11px 14px; border-radius: var(--r); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .16s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok .ico { color: #47cd89; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; color: #fff; background: radial-gradient(1200px 600px at 0% 0%, #12b283 0%, transparent 60%), linear-gradient(160deg, #0a7d57, #06402c); }
.auth-art::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .13) 1.2px, transparent 1.2px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, #000 70%, transparent); opacity: .8; pointer-events: none; }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h2 { font-size: 34px; line-height: 1.12; letter-spacing: -.025em; max-width: 14ch; }
.auth-art p { margin-top: 12px; color: rgba(255, 255, 255, .8); max-width: 38ch; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.auth-card > p { margin: 6px 0 24px; color: var(--muted); }
.mobile-logo { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid.c4, .grid.c5, .grid.c6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; }
  .shell.open .side { transform: none; box-shadow: var(--shadow-lg); }
  .shell.open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(8, 14, 11, .45); }
  .btn.menu-btn { display: inline-flex; }
  .searchbtn kbd { display: none; }
  .top, .page { padding-left: 16px; padding-right: 16px; }
  .page { padding-top: 20px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .mobile-logo { display: flex; margin-bottom: 28px; }
}
@media (max-width: 720px) {
  .grid.c3, .grid.c2 { grid-template-columns: minmax(0, 1fr); }
  .grid.c4, .grid.c5, .grid.c6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 28px; }
  .toolbar { padding: 12px 14px; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 14px; }
  .items > .item { padding: 16px 14px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dt { margin-top: 8px; font-size: 12px; }
  /* tables become stacked cards */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.stack td { padding: 4px 0; border: 0; }
  .table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-top: 6px; }
  .table.stack td.actions { text-align: left; padding-top: 10px; }
  .table.stack td.actions .row { justify-content: flex-start; }
  /* Users: a person is one compact card, the facts in two columns, not eight stacked rows */
  .table.users tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 16px; padding: 14px; }
  .table.users td { padding: 2px 0; min-width: 0; }
  .table.users td:first-child, .table.users td.actions { grid-column: 1 / -1; }
  .table.users td:first-child { padding-bottom: 8px; }
  .table.users td:first-child::before, .table.users td.actions::before { display: none; }
  .table.users td.actions { padding-top: 10px; }
  .table.users td.actions .btn { width: 100%; justify-content: center; }
  .table.users td[data-label]::before { margin-top: 8px; font-size: 10.5px; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }
}
@media print { .side, .top { display: none; } .shell { display: block; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* the pictures on the Traffic model > How it works tab */
.fig { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; margin: 0; }
.fig + .fig { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.fig img, .fig .fig-svg { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.fig .fig-svg { padding: 14px 14px 6px; box-sizing: border-box; color: var(--text, inherit); }
.fig .fig-svg svg { width: 100%; height: auto; display: block; }
.fig figcaption b { display: block; font-size: 15px; margin-bottom: 6px; }
.fig figcaption p { margin: 0 0 8px; color: var(--muted); line-height: 1.55; }
@media (max-width: 860px) { .fig { grid-template-columns: minmax(0, 1fr); } }

/* ---- date range filter (rangepicker.js) ---- */
.rp { position: relative; }
.rp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rp-label { color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rp-custom { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.rp-custom:hover { color: var(--text); border-color: var(--line-strong); }
.rp-custom.on { color: var(--brand); border-color: var(--brand); background: var(--brand-50); }
.rp-pop { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: 312px; max-width: calc(100vw - 32px); padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-lg); }
.rp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rp-nav { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; transform: scaleX(-1); }
.rp-nav.next { transform: none; }
.rp-nav:hover { background: var(--hover); color: var(--text); }
.rp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.rp-wd { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--faint); padding: 4px 0 6px; letter-spacing: .04em; }
.rp-day { height: 36px; border: 0; background: none; border-radius: 0; color: var(--text); font-size: 13px; font-weight: 550; cursor: pointer; position: relative; font-variant-numeric: tabular-nums; }
.rp-day:hover { background: var(--hover); border-radius: 8px; }
.rp-day.out { color: var(--faint); }
.rp-day.in { background: var(--brand-50); }
.rp-day.edge { background: var(--brand); color: var(--on-brand); border-radius: 8px; font-weight: 700; }
.rp-day.today:not(.edge)::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand); }
.rp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; flex-wrap: wrap; }
@media (max-width: 520px) { .rp-pop { left: 50%; transform: translateX(-50%); } }

/* ---------- lane card preview (community reports) ---------- */
.lane-chip { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--brand); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.lane-chip:hover, .lane-chip:focus-visible { background: var(--brand-100); outline: none; }
.lane-pop { position: fixed; z-index: 200; width: 320px; max-width: calc(100vw - 16px); padding: 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); pointer-events: none; }
.lane-part + .lane-part { margin-top: 12px; }
.lane-title { font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.lane-strip { display: flex; background: #066145; border-radius: 8px; padding: 8px 0; }
.lane-cell { flex: 1; min-height: 36px; display: flex; align-items: center; justify-content: center; gap: 1px; }
.lane-cell + .lane-cell { border-left: 1px solid rgba(255, 255, 255, .25); }
.lane-text { margin-top: 6px; font-size: 12.5px; color: var(--text); }

/* Community map hub (platform admins only) */
.hub-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.hub-stat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 110px; }
.hub-stat b { font-size: 18px; }
.hub-stat span { color: var(--muted); font-size: 12px; }
.hub-grid { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.hub-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hub-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hub-mapwrap { position: relative; min-width: 0; }
.hub-map { height: min(72vh, 680px); min-height: 380px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.hub-maptools { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.hub-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.hub-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.hub-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; font: inherit; width: 100%; flex-wrap: wrap; }
.hub-row:last-child { border-bottom: 0; }
button.hub-row { cursor: pointer; }
.hub-row.on, button.hub-row:hover { background: var(--hover, rgba(127, 127, 127, .12)); }
.hub-title { flex: 1; min-width: 120px; font-weight: 600; overflow-wrap: anywhere; }
.hub-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.hub-detail { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.hub-diff { border-collapse: collapse; font-size: 13px; }
.hub-diff th, .hub-diff td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); }
.hub-hist { font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 900px) { .hub-grid { grid-template-columns: minmax(0, 1fr); } }

/* Navigation voice: one voice is three short lines (name and voice, then language, first choice, show, remove), so a phone is not a column of labelled boxes */
.voice-row { display: flex; flex-wrap: wrap; gap: 10px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.voice-row label.mini { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.voice-row .voice-opts { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.voice-row .voice-opts .select { width: auto; min-width: 110px; }
.voice-row label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
