/* LeadSource web - same design tokens as the desktop app (theme.py). */
:root {
  --bg: #F6F7F9; --surface: #FFFFFF; --surface2: #F2F4F7; --border: #E4E7EC; --border-strong: #D0D5DD;
  --text: #101828; --muted: #667085; --subtle: #98A2B3; --accent: #2563EB; --accent-hover: #1D4ED8;
  --accent-soft: #EFF4FF; --selection: #E8F0FE; --hover: #F7F9FC; --new-dot: #16A34A; --danger: #B42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --pill-nc-fg: #067647; --pill-nc-bg: #ECFDF3; --pill-add-fg: #175CD3; --pill-add-bg: #EFF8FF;
  --pill-rem-fg: #B54708; --pill-rem-bg: #FFFAEB; --pill-td-fg: #6941C6; --pill-td-bg: #F4F3FF;
  --pill-es-fg: #0E7490; --pill-es-bg: #ECFEFF; --pill-demo-fg: #B42318; --pill-demo-bg: #FEF3F2;
  --pill-other-fg: #344054; --pill-other-bg: #F2F4F7;
  --row-h: 40px;
  color-scheme: light;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1116; --surface: #161A21; --surface2: #1C212A; --border: #262C36; --border-strong: #353C48;
    --text: #E7EAF0; --muted: #98A2B3; --subtle: #6B7280; --accent: #4C8DFF; --accent-hover: #6AA1FF;
    --accent-soft: #1A2740; --selection: #1E2A40; --hover: #1A1F27; --new-dot: #22C55E; --danger: #F87171;
    --shadow: none;
    --pill-nc-fg: #4ADE80; --pill-nc-bg: #0F2A1C; --pill-add-fg: #7CB4FF; --pill-add-bg: #13243D;
    --pill-rem-fg: #FBBF24; --pill-rem-bg: #2B2112; --pill-td-fg: #C4A5FF; --pill-td-bg: #241A3D;
    --pill-es-fg: #67E8F9; --pill-es-bg: #0B2A33; --pill-demo-fg: #F87171; --pill-demo-bg: #2D1616;
    --pill-other-fg: #CBD5E1; --pill-other-bg: #232833;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1116; --surface: #161A21; --surface2: #1C212A; --border: #262C36; --border-strong: #353C48;
  --text: #E7EAF0; --muted: #98A2B3; --subtle: #6B7280; --accent: #4C8DFF; --accent-hover: #6AA1FF;
  --accent-soft: #1A2740; --selection: #1E2A40; --hover: #1A1F27; --new-dot: #22C55E; --danger: #F87171;
  --shadow: none;
  --pill-nc-fg: #4ADE80; --pill-nc-bg: #0F2A1C; --pill-add-fg: #7CB4FF; --pill-add-bg: #13243D;
  --pill-rem-fg: #FBBF24; --pill-rem-bg: #2B2112; --pill-td-fg: #C4A5FF; --pill-td-bg: #241A3D;
  --pill-es-fg: #67E8F9; --pill-es-bg: #0B2A33; --pill-demo-fg: #F87171; --pill-demo-bg: #2D1616;
  --pill-other-fg: #CBD5E1; --pill-other-bg: #232833;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.4;
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
      stroke-linejoin: round; flex: none; }
.ic.big { width: 40px; height: 40px; color: var(--subtle); stroke-width: 1.5; }

/* ---- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; cursor: pointer;
  white-space: nowrap; font-weight: 600;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface2); }
.btn.icon { width: 34px; padding: 0; color: var(--muted); }
.btn.wide { width: 100%; height: 40px; margin-top: 8px; }
select, input[type="search"], input:not([type]), input[type="password"] {
  height: 34px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px;
  padding: 0 10px; outline: none;
}
select:focus, input:focus, .btn:focus-visible, .chip:focus-visible, .table:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.chip {
  height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-weight: 600; white-space: nowrap; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---- app bar */
.appbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex: none;
}
.logo { border-radius: 8px; }
.app-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.app-subtitle { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }
.updated { margin-right: 4px; white-space: nowrap; }
.progress { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat; animation: slide 1.1s linear infinite; flex: none; }
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 170px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
}
.menu.right { left: auto; right: 0; }
.menu.floating { position: fixed; top: 0; left: 0; max-height: 70vh; overflow: auto; }
.menu button, .menu label {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none;
  border-radius: 6px; cursor: pointer; text-align: left; white-space: nowrap;
}
.menu a.menu-link { display: flex; padding: 7px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.menu button:hover, .menu label:hover, .menu a.menu-link:hover { background: var(--surface2); }
.menu input[type="checkbox"] { accent-color: var(--accent); margin: 0; }
.menu-note { padding: 7px 10px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ---- layout */
.shell { flex: 1; min-height: 0; display: flex; }
.content { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; flex: none; }
.stat { padding: 12px 16px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.stat-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search .ic { position: absolute; left: 10px; top: 9px; color: var(--subtle); }
.search input { width: 100%; padding-left: 32px; }
.multi { position: relative; }
.multi > .btn { font-weight: 400; min-width: 120px; justify-content: space-between; }
.multi > .btn.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.multi .menu { max-height: 340px; overflow: auto; }
.value-slider {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.value-slider.active { border-color: var(--accent); }
.vs-label { color: var(--muted); }
.vs-text { min-width: 44px; font-weight: 600; }
.value-slider input { width: 110px; accent-color: var(--accent); }

.workspace { flex: 1; min-height: 0; display: flex; gap: 14px; }
.table-card { flex: 1; min-width: 0; position: relative; overflow: hidden; display: flex; }
.detail { width: 380px; flex: none; overflow: auto; }

/* ---- table (virtual: only rows on screen exist in the DOM) */
.table { flex: 1; overflow: auto; position: relative; outline: none; border-radius: 12px; }
.thead {
  position: sticky; top: 0; z-index: 2; display: flex; background: var(--surface2); border-bottom: 1px solid var(--border);
  width: max-content; min-width: 100%;
}
.th {
  position: relative; flex: none; height: 36px; display: flex; align-items: center; gap: 4px; padding: 0 12px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap;
}
.th:hover { color: var(--text); }
.th.num { justify-content: flex-end; }
.th .ic { width: 12px; height: 12px; color: var(--accent); }
.th.asc .ic { transform: rotate(180deg); }
.th.drop-before { box-shadow: inset 2px 0 0 var(--accent); }
.th .grip { position: absolute; right: 0; top: 6px; bottom: 6px; width: 7px; cursor: col-resize; border-right: 1px solid var(--border); }
.th:last-child { flex: 1 0 auto; }
.tbody { position: relative; }
.tr {
  position: absolute; left: 0; display: flex; height: var(--row-h); border-bottom: 1px solid var(--border);
  cursor: default; width: max-content; min-width: 100%;
}
.tr:hover { background: var(--hover); }
.tr.sel { background: var(--selection); }
.td {
  flex: none; padding: 0 12px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; gap: 6px;
}
.td > span.t { overflow: hidden; text-overflow: ellipsis; }
.td:last-child { flex: 1 0 auto; }
.td.num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.td.m { color: var(--muted); }
.td.strong { font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--new-dot); }
.dot.changed { background: var(--accent); }
.badge { margin-left: auto; color: var(--accent); display: inline-flex; align-items: center; gap: 2px; font-weight: 400; flex: none; }
.badge .ic { width: 12px; height: 12px; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  color: var(--pill-other-fg); background: var(--pill-other-bg);
}
.pill.w-new-construction { color: var(--pill-nc-fg); background: var(--pill-nc-bg); }
.pill.w-addition { color: var(--pill-add-fg); background: var(--pill-add-bg); }
.pill.w-remodel-alteration { color: var(--pill-rem-fg); background: var(--pill-rem-bg); }
.pill.w-teardown { color: var(--pill-td-fg); background: var(--pill-td-bg); }
.pill.w-early-signal { color: var(--pill-es-fg); background: var(--pill-es-bg); }
.pill.w-demolition { color: var(--pill-demo-fg); background: var(--pill-demo-bg); }
.pill.plain { color: var(--muted); background: var(--surface2); }
.pill.state-new { color: var(--new-dot); background: var(--surface2); }
.pill.state-updated { color: var(--accent); background: var(--surface2); }

.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; background: var(--surface); text-align: center; padding: 20px; }
.empty .btn { margin-top: 8px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- detail panel */
.detail-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 20px; }
.detail-body { padding: 20px 22px; }
.detail-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.detail-head { display: flex; align-items: flex-start; gap: 8px; }
.detail-head .detail-title { flex: 1; user-select: text; }
.detail-close { display: none; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.actions { display: flex; gap: 6px; margin-top: 14px; }
.actions .btn:not(.icon) { flex: 1; }
.actions a.btn { text-decoration: none; }
.hint { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 12px; }
.section-label { margin-top: 20px; margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--subtle); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 16px; }
.kv .k { color: var(--muted); }
.kv .v { overflow-wrap: anywhere; user-select: text; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; line-height: 1.5; }
.description mark { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-radius: 3px; padding: 0 1px; }
.related { display: flex; flex-direction: column; gap: 6px; }
.related button {
  text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2);
  cursor: pointer;
}
.related button:hover { border-color: var(--accent); }
.related .r-head { font-weight: 600; }
.related .r-desc { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- status bar, toast, dialog */
.statusbar { display: flex; justify-content: space-between; gap: 12px; padding: 6px 20px; color: var(--muted); font-size: 12px; flex: none; }
.statusbar #status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shortcuts { white-space: nowrap; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100vw - 32px);
}
.dialog-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(16, 24, 40, .45); display: flex;
  align-items: center; justify-content: center; padding: 16px; }
.dialog { width: 480px; max-width: 100%; padding: 20px 22px; }
.dialog h2 { margin: 0 0 10px; font-size: 16px; }
.dialog ul { margin: 0; padding-left: 18px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ---- sign-in page */
.login-body { align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.login-card { width: 360px; max-width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand img { border-radius: 9px; }
.login-brand h1 { margin: 0; font-size: 19px; }
.login-brand p { margin: 0; font-size: 12px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-weight: 600; margin-top: 6px; }
.login-card input { height: 40px; }
.login-error { color: var(--danger); margin: 6px 0 0; }
.login-card textarea { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px;
  padding: 8px 10px; font: inherit; color: inherit; resize: vertical; outline: none; }
.login-card textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-card a { color: var(--accent); }
.login-card a.btn { color: #fff; text-decoration: none; }
.login-alt { text-align: center; margin: 10px 0 0; }
.login-card .hint { margin: 0 0 8px; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.temp-password { display: flex; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 12px; border-radius: 8px;
  background: var(--surface2); font: 600 18px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .04em; user-select: all; }
.temp-password span { flex: 1; overflow-wrap: anywhere; }
.request .r-tags { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- admin: account requests */
.notify-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; pointer-events: none; }
.menu .count { margin-left: auto; color: var(--danger); font-weight: 700; }
.requests { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; }
.request { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.request .r-who { font-weight: 600; }
.request .r-meta { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.request .r-note { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.request .r-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ---- left menu (collapses to icons; an overlay on phones) */
.nav { flex: none; width: 196px; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px;
  background: var(--surface); border-right: 1px solid var(--border); transition: width .15s ease; overflow: hidden; }
.nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 11px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .ic { width: 18px; height: 18px; }
body.nav-collapsed .nav { width: 58px; }
body.nav-collapsed .nav span { display: none; }
.nav-scrim { display: none; }
.chip.only { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* ---- Top contractors */
.people-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 7px; background: none; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.weight { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); }
.weight input { width: 130px; accent-color: var(--accent); }
.w-end { font-weight: 600; font-size: 12px; }
.insights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; flex: none; }
.insight { padding: 12px 16px; min-width: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.insight:hover { border-color: var(--accent); }
.insight .stat-value { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.people-work { flex: 1; min-height: 0; display: flex; gap: 14px; }
.people-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.chart-card { padding: 14px 16px 8px; flex: none; }
.chart-title { font-weight: 700; }
.chart-sub { font-size: 12px; }
.chart { position: relative; height: 300px; margin-top: 6px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .axis text, .chart .quad text { fill: var(--muted); font-size: 11px; }
.chart .quad text { font-weight: 600; fill: var(--subtle); }
.chart .quad line { stroke: var(--border-strong); stroke-width: 1; }
.chart .dot { fill: var(--subtle); stroke: var(--surface); stroke-width: 2; opacity: .75; }
.chart .dot.top { fill: var(--accent); opacity: 1; }
.chart .dot.sel { fill: var(--text); opacity: 1; }
.chart .hover-ring { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 10px; border-radius: 8px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 8px 24px rgba(16, 24, 40, .14); font-size: 12px; }
.chart-tip strong { display: block; font-size: 13px; }
.people-table-card { flex: none; overflow: hidden; }
.p-table { overflow-x: auto; }
.p-table table { width: 100%; border-collapse: collapse; }
.p-table th { position: sticky; top: 0; background: var(--surface2); text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 9px 12px; white-space: nowrap; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
.p-table th.num, .p-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.p-table th.sorted { color: var(--accent); }
.p-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.p-table tr.row { cursor: pointer; }
.p-table tr.row:hover { background: var(--hover); }
.p-table tr.row.sel { background: var(--selection); }
.p-table .rank { color: var(--subtle); width: 1%; }
.p-table .who { white-space: normal; min-width: 220px; }
.p-table .who .n { font-weight: 600; }
.p-table .who .s { color: var(--muted); font-size: 12px; }
.scorebar { display: inline-flex; align-items: center; gap: 8px; }
.scorebar .track { width: 70px; height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.scorebar .fill { height: 100%; border-radius: 3px; background: var(--accent); }
.p-table .more { padding: 10px 12px; color: var(--muted); font-size: 12px; }
.tag-top { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); vertical-align: 1px; }
.mix { display: flex; flex-wrap: wrap; gap: 6px; }
.permit-list { display: flex; flex-direction: column; gap: 6px; }
.permit-list button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); cursor: pointer; }
.permit-list button:hover { border-color: var(--accent); }
.permit-list .pl-head { display: flex; gap: 8px; justify-content: space-between; font-weight: 600; }
.permit-list .pl-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail .btn.wide { margin-top: 12px; }
.detail a.tel { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---- narrow screens: details become a full-screen sheet */
@media (max-width: 1100px) {
  .stats, .insights { grid-template-columns: repeat(2, 1fr); }
  .nav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 45; width: 230px; transform: translateX(-100%);
    transition: transform .15s ease; padding-top: 18px; }
  body.nav-open .nav { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(16, 24, 40, .35); }
  body.nav-collapsed .nav { width: 230px; }
  body.nav-collapsed .nav span { display: inline; }
  .shortcuts { display: none; }
  .detail { position: fixed; inset: 0; width: auto; z-index: 40; border-radius: 0; border: 0; }
  .detail.closed { display: none; }
  .detail-close { display: inline-flex; }
}
@media (max-width: 700px) {
  /* The page scrolls; the table gets nearly a full screen of its own below the stats and filters. */
  body { overflow: auto; }
  .content { flex: none; }
  .workspace { flex: none; height: calc(100dvh - 72px); }
  .shell { flex: none; display: block; }
  .people-work, .people-main { flex: none; display: block; overflow: visible; }
  .people-main > .card { margin-bottom: 10px; }
  .chart { height: 240px; }
  .weight input { width: 90px; }
  .appbar { flex-wrap: wrap; padding: 10px 16px; }
  .titles .app-subtitle, .updated, .logo { display: none; }
  .appbar .spacer { flex-basis: 0; }
  #fetch-btn span, #export-btn span { display: none; }
  #fetch-btn, #export-btn { width: 34px; padding: 0; }
  .content { padding: 12px 16px 4px; gap: 10px; }
  .stats { gap: 8px; }
  .stat { padding: 8px 12px; }
  .stat-value { font-size: 18px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .search { flex: 0 0 220px; }
  .statusbar { padding: 4px 16px; }
}
