/* Design tokens: deep-navy navigation, light neutral canvas, white cards, indigo accent for interactive states and
   the assistant. Map colors never use the accent; they come from the indicator's color ramp. */
:root {
  --nav: #172a46;
  --bg: #f5f7fc;
  --panel: #ffffff;
  --ink: #14213d;
  --muted: #586379;
  --line: #dbe2ef;
  --line-soft: #e9edf5;
  --hover: #f2f4fa;
  --accent: #6554e8;
  --accent-strong: #4b3bc9;
  --accent-ink: #ffffff;
  --accent-soft: #f0edff;
  --focus: #e8a200;
  --nodata: #cfd4da;
  --select: #e4007c;
  --radius: 8px;
  --radius-card: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .05), 0 2px 10px rgba(20, 33, 61, .05);
  --shadow-pop: 0 12px 32px rgba(20, 33, 61, .18);
  --gap: 12px;
  --rail-w: 272px;
  --ai-w: 384px;
  --top-h: 60px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* App shell: the page itself never scrolls; each region (filters, workspace, assistant, dashboards) scrolls on its own. */
body { background: var(--bg); display: flex; flex-direction: column; height: 100dvh; overflow: hidden; font-size: 14.5px; line-height: 1.45; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--accent-strong); }
button, select, input, textarea { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, .button-like {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; line-height: 1.3;
}
button:hover, .button-like:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:disabled:hover { border-color: var(--line); }
.icon-btn { border: 0; background: transparent; padding: 7px; border-radius: var(--radius); color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn[hidden] { display: none; }
select, input[type=search], input[type=number], input[type=url], input[type=text] { border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; background: #fff; width: 100%; }
select:hover, input:hover { border-color: #c3cde0; }
code { font-size: 0.9em; background: #eef1f7; padding: 0 4px; border-radius: 4px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12.5px; margin: 4px 0 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Header */
.topbar { flex: none; display: flex; align-items: center; gap: 20px; padding: 0 16px 0 20px; min-height: 60px; background: var(--nav); color: #fff; position: relative; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark { width: 28px; height: 24px; flex: none; }
.brand-title { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.badge { font-size: 12px; background: #ffd479; color: #3a2a00; padding: 2px 8px; border-radius: 99px; }
.topbar > nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar > nav::-webkit-scrollbar { display: none; }
.views { display: flex; gap: 4px; }
.views [role=tab] { background: transparent; color: #d5ddeb; border: 0; border-radius: var(--radius); padding: 8px 13px; white-space: nowrap; flex: none; }
.views [role=tab]:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.views [role=tab][aria-selected=true] { background: var(--accent); color: #fff; font-weight: 600; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.ai-toggle { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .22); border-radius: 99px; padding: 6px 14px 6px 11px; font-weight: 600; }
.ai-toggle:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .4); }
.ai-toggle[aria-expanded=true] { background: #fff; color: var(--nav); border-color: #fff; }
.signout { margin: 0; }
.signout button { background: transparent; border: 1px solid transparent; color: #d5ddeb; font-size: 14px; }
.signout button:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }

.shell { flex: 1; min-height: 0; display: flex; position: relative; }
main { flex: 1; min-width: 0; min-height: 0; display: flex; }
.view { flex: 1; min-height: 0; min-width: 0; }
.view[hidden] { display: none !important; }

/* Explore: filters rail and the workspace, as cards on the canvas */
.explore { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: var(--gap); padding: var(--gap); }
.rail, .work-card, .ctx { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow); }
.rail { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 6px 18px; }
.rail-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.rail-close, .rail-open { display: none !important; }
.rail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 18px 8px; }
.rail-foot { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--line); }
.rail-foot > * { flex: 1 1 auto; font-size: 13px; padding: 6px 8px; }
.rail-foot .ic { width: 15px; height: 15px; }
.field { margin-bottom: 16px; }
.field > label, .field-h, summary { font-weight: 600; display: block; margin: 0 0 6px; font-size: 14px; }
summary { cursor: pointer; }
details.fold { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-bottom: 12px; }
details.fold > summary { margin: 0; }
details.fold[open] > summary { margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; }
.grid2 label { display: flex; flex-direction: column; gap: 2px; }
.file { display: block; font-size: 13px; margin: 6px 0; }
.file input { display: block; margin-top: 2px; font-size: 12px; max-width: 100%; }
.button-like input { display: none; }
.search-box { position: relative; }
.search-box .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.search-box input { padding-left: 34px; }

.results-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 6px 0 4px; min-height: 22px; }
.topic-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); color: var(--accent-strong); border-radius: 99px; padding: 1px 2px 1px 10px; font-size: 12px; font-weight: 600; max-width: 100%; }
.topic-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-chip button { border: 0; background: transparent; padding: 2px 4px; color: inherit; border-radius: 99px; }
.topic-chip button:hover { background: rgba(101, 84, 232, .14); }
.topic-chip .ic { width: 13px; height: 13px; }
.results { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.results li { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.results li:last-child { border-bottom: 0; }
.results li.active { background: var(--accent-soft); }
.results .lbl { font-size: 13.5px; font-weight: 500; }
.results .meta { font-size: 12px; color: var(--muted); }
.results .acts { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.results .acts button { font-size: 12px; padding: 2px 8px; }
.results .empty { color: var(--muted); font-size: 13px; }

/* Topic families (the catalog's own topics, grouped) */
.topic-groups { display: flex; flex-direction: column; gap: 1px; }
.tg > summary { display: flex; align-items: center; gap: 10px; padding: 7px 6px; margin: 0; border-radius: var(--radius); font-weight: 500; list-style: none; }
.tg > summary::-webkit-details-marker { display: none; }
.tg > summary:hover { background: var(--hover); }
.tg > summary .fam { color: var(--c); }
.tg > summary .n { color: var(--muted); font-weight: 400; font-size: 13px; }
.tg > summary .chev { margin-left: auto; width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.tg[open] > summary .chev { transform: rotate(180deg); }
.tg ul { list-style: none; margin: 2px 0 6px 30px; padding: 0; }
.tg li button { border: 0; background: transparent; padding: 4px 8px; width: 100%; justify-content: space-between; text-align: left; font-weight: 400; font-size: 13px; border-radius: 6px; }
.tg li button:hover { background: var(--hover); }
.tg li button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.tg li button .n { color: var(--muted); font-size: 12px; }
.active-ind { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; background: #fafbfe; }
.active-ind .lbl { font-weight: 600; }
.active-ind .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.active-ind .x { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }

/* Workspace */
.work { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; min-height: 0; }
.ctx-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); flex: none; }
.ctx-cards:empty { display: none; }
.ctx { padding: 14px 16px; display: flex; gap: 14px; align-items: center; min-width: 0; }
.ctx .ic-wrap { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 11%, #fff); color: var(--c); flex: none; }
.ctx .ic-wrap .ic { width: 23px; height: 23px; }
.ctx > div:last-child { min-width: 0; }
.ctx .v { font-size: 22px; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.ctx .l { font-size: 12.5px; color: var(--muted); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.work-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.work-head { display: flex; align-items: center; gap: 10px 14px; padding: 14px 16px 10px; flex-wrap: wrap; }
.map-title { flex: 1 1 300px; min-width: 0; font-size: 17px; margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.map-title small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; letter-spacing: 0; }
.work-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vtabs { display: flex; gap: 2px; background: #f0f2f8; padding: 3px; border-radius: 10px; }
.vtabs [role=tab] { border: 0; background: transparent; padding: 6px 12px; border-radius: var(--radius); color: var(--ink); }
.vtabs [role=tab]:hover { background: #fff; }
.vtabs [role=tab][aria-selected=true] { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(20, 33, 61, .2); }
.tool-btn { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 6px 12px; cursor: pointer; font-size: 14px; font-weight: 500; }
.tool-btn:hover { border-color: var(--accent); }
.tool-btn .ic { width: 16px; height: 16px; }
.menu { position: relative; }
.menu > summary { list-style: none; margin: 0; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--accent); background: var(--accent-soft); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 12px 14px; font-weight: 400; }
.menu-sec + .menu-sec { border-top: 1px solid var(--line-soft); margin-top: 10px; padding-top: 10px; }
.menu-sec h2 { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.menu-sec .row button { flex: 1; padding: 5px 8px; font-size: 13px; }
.meta-panel { padding: 0 16px 8px; font-size: 13px; }
.meta-panel > summary { display: inline-block; margin: 0; color: var(--accent-strong); font-weight: 500; font-size: 13px; }
.meta-panel[open] { max-height: 40vh; overflow: auto; }
.meta-dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 6px 0 4px; }
.meta-dl dt { color: var(--muted); }
.meta-dl dd { margin: 0; overflow-wrap: anywhere; }
.work-body { flex: 1; min-height: 0; display: flex; border-top: 1px solid var(--line); position: relative; }
.vpanels { flex: 1; min-width: 0; min-height: 0; display: flex; }
.vpanel { flex: 1; min-width: 0; min-height: 0; }
.vpanel[hidden] { display: none !important; }
.vpanel.pad { overflow: auto; padding: 16px; }
.map-panel { position: relative; display: flex; }
#map { flex: 1; min-height: 280px; }
#sp-table { display: flex; flex-direction: column; }
#sp-table .tablewrap { flex: 1; max-height: none; }
.area-card { width: 330px; flex: none; border-left: 1px solid var(--line); overflow-y: auto; padding: 12px 16px 16px; background: #fff; }
.area-card[hidden] { display: none; }
.area-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.area-head h2 { font-size: 15px; margin: 0; }
.search-filters { margin-top: 6px; }
.dl-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.dl-row button { font-size: 12px; padding: 2px 8px; }
.layer-sources { margin-top: 6px; font-size: 12px; }
.layer-sources summary { cursor: pointer; color: var(--muted); }
.layer-sources dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; margin: 6px 0; }
.layer-sources dt { font-weight: 600; }
.layer-sources dd { margin: 0; overflow-wrap: anywhere; color: var(--muted); }
.legend { position: absolute; left: 12px; bottom: 28px; background: rgba(255, 255, 255, .97); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; width: 260px; max-width: calc(100% - 24px); box-shadow: var(--shadow-pop); }
.legend h2 { margin: 0 0 6px; font-size: 13px; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-variant-numeric: tabular-nums; }
.legend .sw { width: 18px; height: 13px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .12); flex: none; }
.legend .ct { color: var(--muted); margin-left: auto; }
.maplibregl-popup-content { font-size: 13px; padding: 8px 10px; border-radius: 10px; font-family: inherit; }
.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: var(--shadow-pop) !important; }
.maplibregl-ctrl-group button { width: 34px; height: 34px; border-radius: 0; border: 0; padding: 0; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-soft); }
.maplibregl-ctrl-group button.ctrl-reset { display: grid; place-items: center; color: var(--ink); }
.maplibregl-ctrl-group button.ctrl-reset .ic { width: 18px; height: 18px; }
.maplibregl-ctrl-scale { border-radius: 3px; }
/* A map highlight from the assistant: briefly ring the controls it changed. */
.ai-flash { animation: ai-flash 1.8s ease-out; }
@keyframes ai-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }

.subtabs { display: flex; gap: 4px; margin-bottom: 8px; }
.subtabs [role=tab][aria-selected=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chart svg { display: block; max-width: 100%; height: auto; }
.chart .bar.dim, .chart .pt.dim { opacity: 0.18; }
.chart .pt { cursor: pointer; }
.chart .pt.sel { stroke: var(--select); stroke-width: 2.5; }
.chart .axis text { font-size: 11.5px; fill: var(--muted); }
.chart-opts { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.chart-opts label { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.range { border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; padding: 8px 12px 10px; margin-top: 12px; max-width: 640px; }
.range legend { padding: 0 4px; color: var(--muted); }
.range label { flex: 1 1 160px; }
.stat { font-size: 13px; color: var(--muted); }
.tablewrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: #f3f5fa; z-index: 1; }
th button { border: 0; background: none; padding: 0; font-weight: 600; text-align: inherit; display: inline; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f6f7fc; }
tbody tr.sel { background: #fde6f2; }

.filterbar[hidden] { display: none; }
.filterbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff7e0; border: 1px solid #f2d27a; border-radius: 10px; padding: 6px 8px 6px 12px; margin: 0 16px 10px; font-size: 13px; }
.filterbar .undo-ai { margin-left: auto; }
.tray h2, .summary h2 { font-size: 14px; margin: 14px 0 6px; }
.chips { list-style: none; padding: 0; margin: 0 0 4px; display: flex; flex-direction: column; gap: 4px; }
.chips li { display: flex; justify-content: space-between; gap: 6px; align-items: center; font-size: 12.5px; background: #f3f5fa; border-radius: 8px; padding: 4px 6px 4px 8px; }
.chips li button { padding: 0 6px; font-size: 12px; }
.chips li > span:first-child { flex: 1; min-width: 0; }
.chips li .row { flex-wrap: nowrap; gap: 4px; }
.check { font-size: 13px; display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font-size: 13px; margin: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.summary .moe { color: var(--muted); font-size: 12px; }

/* Data Assistant */
.assistant { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(var(--ai-w), 94vw); z-index: 40; display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); box-shadow: -14px 0 36px rgba(20, 33, 61, .16); }
.assistant[hidden] { display: none; }
.assistant.wide { --ai-w: 680px; }
/* Docked (set by the script on Explore at 1440px and wider): a card in the layout, beside the workspace. */
body.ai-docked .assistant { position: static; flex: none; width: var(--ai-w); margin: var(--gap) var(--gap) var(--gap) 0; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow); overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 14px 10px 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.ai-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.ai-mark .ic { width: 22px; height: 22px; }
.ai-title { flex: 1; min-width: 0; }
.ai-title h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.ai-sub { margin: 0; font-size: 12px; color: var(--muted); }
.ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.ai-intro p { margin: 0; font-size: 13.5px; color: var(--muted); }
.ai-intro strong { color: var(--ink); }
.chat-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.chat-log:empty { display: none; }
.msg.q { align-self: flex-end; max-width: 88%; background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; padding: 9px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.a { display: flex; gap: 10px; align-items: flex-start; }
.ai-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; margin-top: 2px; }
.ai-av .ic { width: 16px; height: 16px; }
.msg.a .bubble { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 11px 14px; box-shadow: var(--shadow); font-size: 14px; }
.msg.a .bubble p { margin: 0 0 6px; }
.msg.a .bubble p:last-child { margin-bottom: 0; }
.msg.pending .bubble { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .3; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.result-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; background: #fafbfe; }
.result-card h3 { display: flex; align-items: center; gap: 6px; font-size: 13.5px; margin: 0 0 6px; }
.result-card h3 .ic { width: 16px; height: 16px; color: var(--accent); }
.result-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.result-card dt { color: var(--muted); }
.result-card dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.ai-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ai-acts button { font-size: 13px; padding: 5px 10px; }
.ai-acts button .ic { width: 15px; height: 15px; }
.ai-acts .primary { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.ai-acts .primary:hover { background: #e6e1ff; }
.ai-acts .done { border-color: #b7e0c6; background: #effaf3; color: #166534; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; }
.steps li { display: inline-flex; align-items: center; gap: 4px; }
.steps .ic { width: 12px; height: 12px; color: #15803d; stroke-width: 2.4; }
.ai-err { color: #8c1d18; }
.ai-suggest h3 { font-size: 14px; margin: 0 0 8px; }
.ai-suggest ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-suggest button { width: 100%; justify-content: flex-start; text-align: left; border-radius: 10px; font-weight: 400; padding: 8px 12px; gap: 10px; font-size: 13.5px; }
.ai-suggest button .ic { width: 16px; height: 16px; color: var(--muted); }
.ai-suggest button:hover .ic { color: var(--accent); }
.ai-suggest[hidden] { display: none; }
.ai-compose { flex: none; margin: 0 12px; display: flex; gap: 8px; align-items: flex-end; border: 1px solid var(--line); border-radius: 14px; padding: 6px 6px 6px 14px; background: #fff; box-shadow: var(--shadow); }
.ai-compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ai-compose textarea { flex: 1; min-width: 0; border: 0; resize: none; max-height: 168px; padding: 8px 0; outline: none; background: transparent; line-height: 1.4; }
.ai-compose textarea:disabled { cursor: not-allowed; }
.ai-send { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; border: 0; padding: 0; flex: none; }
.ai-send:hover { background: var(--accent-strong); }
.ai-send.stop { background: var(--ink); }
.ai-foot { font-size: 11.5px; color: var(--muted); margin: 6px 16px 12px; flex: none; }
.scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(15, 23, 42, .32); z-index: 35; }
.scrim[hidden] { display: none; }

/* About and housing */
.about, .housing { overflow-y: auto; }
.prose { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.dash { max-width: 1280px; margin: 0 auto; padding: 16px; }
.dash h1 { font-size: 22px; margin: 4px 0; }
.dash .note { font-size: 13px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; }
.kpi .k-l { font-size: 13px; color: var(--muted); }
.kpi .k-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .k-c { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 8px; }
.dash-map { height: 500px; border-radius: 6px; }
.kpi .k-t { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi .k-t .spark { flex: none; }
.trend-block { margin: 10px 0; }
.trend-block h3 { font-size: 13px; margin: 0 0 4px; }
.trend-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.trend-table th, .trend-table td { text-align: left; padding: 2px 4px; border-bottom: 1px solid var(--line); }
.trend-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: 4px 0; }
.trend-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.trend-key i.k-line { width: 16px; height: 0; border-radius: 0; border-top: 2px solid; vertical-align: 3px; }
.trend-key i.k-line.k-dash { border-top-style: dashed; }
.goal { margin: 10px 0; }
.goal .bar { height: 14px; background: #e6eaf0; border-radius: 99px; overflow: hidden; }
.goal .fill { height: 100%; background: var(--accent); }
.goal .g-l { display: flex; justify-content: space-between; font-size: 13px; }
.illustrative { font-size: 12px; background: #fff7e0; border: 1px solid #f2d27a; border-radius: 6px; padding: 4px 8px; }

/* Requirements tracker */
.reqs { overflow-y: auto; }
.reqs .card { margin-bottom: 12px; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 20px; }
.sec .g-l { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #e6eaf0; }
.seg { display: block; height: 100%; }
.st-demo { background: #1a7f4b; }
.st-partial { background: #e0a100; }
.st-planned { background: #9aa4b1; }
.badge-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.badge-st { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-st.st-demo { background: #ddf3e6; color: #0f5a33; }
.badge-st.st-partial { background: #fff1c7; color: #6b4d00; }
.badge-st.st-planned { background: #eceff3; color: #3d4652; }
.chips-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.chips-filter [aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.req-table th, .req-table td { text-align: left; vertical-align: top; padding: 8px 6px; }
.req-table td:nth-child(1) { width: 34%; }
.req-table td:nth-child(2) { width: 1%; }
.req-table td:nth-child(4) { width: 1%; white-space: nowrap; }
.req-table tbody tr { cursor: default; }
.flash { outline: 3px solid var(--focus); outline-offset: 3px; transition: outline-color .3s; }

/* About: RFP828 coverage dashboard */
.prose.about-intro, .prose.about-rest { max-width: 1100px; }
.about-intro > *, .about-rest > * { max-width: 760px; }
.prose.about-intro { padding-bottom: 4px; }
.prose.about-rest { padding-top: 8px; }
.about-dash { max-width: 1100px; padding-top: 0; padding-bottom: 0; }
.about-dash .about-h { font-size: 20px; margin: 8px 0 2px; }
.about-dash .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.about-dash .card { margin-bottom: 12px; }
.about-dash .card h3 { font-size: 15px; margin: 0 0 10px; }
.about-grid { display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px; }
.sec-list { display: flex; flex-direction: column; gap: 14px; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 14px; }
.tag { display: inline-block; font-size: 11px; color: var(--muted); background: #eef1f5; border-radius: 4px; padding: 0 5px; margin-right: 6px; white-space: nowrap; }
.data-wrap { overflow-x: auto; margin-top: 10px; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 6px; }
.data-table td:nth-child(3) { width: 1%; }
.data-table tbody tr { cursor: default; }
.data-table tbody tr:hover { background: none; }
.data-table .muted { font-size: 12px; margin-top: 2px; }
.met-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.met-grid h4 { font-size: 14px; margin: 0 0 6px; }
.met-grid ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.met-grid li { padding: 5px 0; border-bottom: 1px solid var(--line); }

/* Admin prototype */
.admin-dash { max-width: 1180px; }
.admin-dash h2 { font-size: 15px; margin: 0 0 10px; }
.admin-dash .note { margin: 2px 0 12px; }
.admin-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; align-items: start; }
.admin-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.admin-side .card { margin: 0; }
#adm-form { margin: 0; }
#adm-form > div + div h2, #adm-details h2:not(:first-child) { margin-top: 16px; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; margin-right: 8px; }
.adm-field { margin-bottom: 10px; font-size: 14px; }
.adm-field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.adm-field input[type=text], .adm-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; font: inherit; }
.adm-field input[aria-invalid=true] { border-color: #b3261e; }
.adm-field .login-err { margin: 4px 0 0; font-size: 12px; color: #b3261e; }
.adm-cols { font-size: 14px; }
.adm-report { margin-top: 10px; }
.adm-msg { margin: 6px 0; padding: 6px 10px; border-radius: 6px; font-size: 13px; border: 1px solid; }
.adm-msg.good { background: #ddf3e6; border-color: #a7dcbd; color: #0f5a33; }
.adm-msg.warn { background: #fff7e0; border-color: #f2d27a; color: #5c4300; }
.adm-msg.bad { background: #fbe4e2; border-color: #eeb6b1; color: #8c1d18; }
.adm-msg button { margin-left: 6px; font-size: 12px; padding: 2px 8px; }
.adm-preview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.adm-map svg { display: block; width: 100%; height: auto; background: #f4f6f9; border-radius: 6px; }
.adm-map path { stroke: #fff; stroke-width: .25; }
.adm-stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; font-size: 13px; }
.adm-stats dt { color: var(--muted); }
.adm-stats dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.adm-actions { margin-top: 12px; }
.adm-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.adm-primary:hover { background: var(--accent-strong); }
.adm-status:focus { outline: none; }
.adm-pub { list-style: none; margin: 0; padding: 0; }
.adm-pub li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.adm-pub li:last-child { border-bottom: 0; }
.adm-pub .lbl { font-size: 14px; font-weight: 600; }
.adm-pub .meta { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.adm-pub .acts { display: flex; gap: 4px; flex-wrap: wrap; }
.adm-pub .acts button { font-size: 12px; padding: 2px 8px; }
.adm-log { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.adm-log li { padding: 3px 0; }
.adm-log .muted { font-size: 12px; display: block; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .met-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Housing dashboard map layers */
.h-layers { border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0 0; padding: 8px 12px 4px; }
.h-layers legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.h-layer-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.h-layer { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.h-layer input { margin: 0; }
.sw { display: inline-block; flex: none; width: 18px; height: 12px; }
.sw-area { background: color-mix(in srgb, var(--c) 25%, transparent); border: 2px solid var(--c); border-radius: 2px; }
.sw-line { height: 0; border-top: 3px solid var(--c); }
.sw-point { width: 11px; height: 11px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c); }
.h-pop { font-size: 13px; }
.h-pop strong { display: block; font-size: 14px; margin: 1px 0 3px; }
.h-pop .note { margin: 6px 0 2px; font-size: 12px; color: var(--muted); }
.h-pop-table td { text-align: left; padding: 2px 4px 2px 0; border: 0; }
.h-pop-table td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.h-pop-table tbody tr { cursor: default; }
.dash-map .maplibregl-popup { z-index: 3; }
.dash-map .maplibregl-popup-content { max-height: 320px; overflow-y: auto; }

/* Docs tab */
.docs h1 { margin: 4px 0 8px; }
.docs .card { margin-bottom: 14px; }
.docs h3 { margin: 16px 0 6px; font-size: 15px; }
.docs p, .docs li { max-width: 820px; line-height: 1.5; }
.docs-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 14px; }
.docs-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.docs-table th, .docs-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid #e3e6ea; }
.docs-table thead th { background: #f4f6f8; }
.docs-table tbody th { font-weight: 600; }
.docs code { font-size: 12px; background: #f4f6f8; padding: 1px 4px; border-radius: 3px; }
.phases li { margin-bottom: 4px; }

.chart-opts { margin-bottom: 6px; }
.arcgis-form { display: flex; gap: 6px; }
.arcgis-form input { flex: 1; min-width: 0; }
.arcgis-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.arcgis-list li { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: start; font-size: 13px; }
.arcgis-list .sw { width: 12px; height: 12px; border-radius: 2px; margin-top: 3px; }

@media (max-width: 720px) {
  .docs-table { font-size: 12px; }
}
.docs .tablewrap { max-height: none; }

.req-wrap { overflow-x: auto; }
@media (max-width: 720px) {
  .req-table { min-width: 560px; }
}

.prof-pick label { flex: 1 1 160px; }
.prof-pick select { width: 100%; }
.prof-table th[scope=row] { font-weight: 400; text-align: left; }
.prof-table td, .prof-table thead th { text-align: right; white-space: nowrap; padding-left: 8px; }
.prof-table thead th:first-child { text-align: left; }
.prof-wrap { max-height: none; border: 0; }

.adm-staff { margin-bottom: 12px; }
.adm-staff-form { align-items: flex-end; }
.adm-staff-form label { display: grid; gap: 2px; font-size: 13px; }

.goal .bar { position: relative; }
.goal .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #1b1f24; }
.tag-draft { background: #e8f3ec; color: #1d5c34; }

/* Docs: live server status, and printing one section (the guide or the training plan) as its own document. */
.status-table th { width: 220px; }
@media print {
  body[data-print] .topbar, body[data-print] .skip, body[data-print] .assistant, body[data-print] .docs-nav,
  body[data-print] .docs > h1, body[data-print] .no-print, body[data-print] .view:not(#view-docs) { display: none !important; }
  body[data-print="docs-admin"] .docs > .card:not(#docs-admin), body[data-print="docs-training"] .docs > .card:not(#docs-training) { display: none !important; }
  body[data-print], body[data-print] .shell, body[data-print] main { display: block; height: auto; overflow: visible; }
  body[data-print] .card { border: 0; box-shadow: none; padding: 0; }
  body[data-print] .tablewrap { overflow: visible; max-height: none; border: 0; }
  body[data-print] a { color: inherit; text-decoration: none; }
  body[data-print] h3 { break-after: avoid; }
  body[data-print] tr { break-inside: avoid; }
}

/* Responsive layout. 1440px and wider: filters, workspace and the docked assistant side by side. Below that the
   assistant is a drawer over the page; below 1100px the filters become a drawer too; on phones both are full sheets. */
@media (max-width: 1360px) {
  .topbar { gap: 14px; padding-left: 16px; }
  .brand-title { font-size: 15.5px; }
  .views [role=tab] { padding: 7px 9px; font-size: 13.5px; }
}
@media (max-width: 1280px) { .ctx .v { font-size: 19px; } .ctx { padding: 12px; gap: 10px; } .ctx .ic-wrap { width: 38px; height: 38px; } }
@media (max-width: 1099.98px) {
  .explore { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; top: var(--top-h); left: 0; bottom: 0; width: min(330px, 92vw); z-index: 40; border-radius: 0 var(--radius-card) var(--radius-card) 0;
    box-shadow: var(--shadow-pop); transform: translateX(-104%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
  body.filters-open .rail { transform: none; visibility: visible; }
  .rail-close, .rail-open { display: inline-flex !important; }
  .ctx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .area-card { position: absolute; right: 0; top: 0; bottom: 0; z-index: 6; box-shadow: var(--shadow-pop); }
}
@media (max-height: 780px) and (min-width: 1100px) { .ctx-cards { display: none; } }
@media (max-height: 700px) { .ctx-cards { display: none; } }
@media (max-width: 767.98px) {
  .topbar { flex-wrap: wrap; gap: 4px 8px; padding: 8px 10px 6px; }
  .brand { flex: 1 1 0; min-width: 0; }
  .brand-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .signout button { padding: 5px 8px; }
  .topbar > nav { order: 3; flex: 1 0 100%; }
  .ai-toggle span { display: none; }
  .ai-toggle { padding: 7px; }
  .explore { padding: 8px; gap: 8px; }
  .work { gap: 8px; }
  .ctx-cards { display: none; }
  .work-head { padding: 10px 12px 8px; }
  .map-title { font-size: 15px; flex-basis: 100%; order: -1; }
  /* One row of controls: icon-only Filters and Export around the view tabs, which scroll sideways if they must. */
  .btn-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rail-open, .menu > summary.tool-btn { padding: 7px 9px; }
  .work-tools { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; }
  .vtabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .vtabs [role=tab] { padding: 6px 8px; font-size: 13px; flex: none; }
  .legend { font-size: 11.5px; width: 210px; bottom: 30px; padding: 8px 10px; }
  .area-card { left: 0; top: auto; width: auto; max-height: 62%; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; }
  .assistant, body.ai-docked .assistant { top: 0; width: 100vw; z-index: 60; }
  .rail { width: 100vw; border-radius: 0; }
  .menu-pop { right: auto; left: 0; width: min(300px, calc(100vw - 40px)); }
  .vpanel.pad { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } .dots i { animation: none; opacity: .7; } }
