/* ChunavDesk — shared shell styles. Tokens, shell, cards, tables (density), filter bar, page header,
   pastel avatars, skeleton / empty states, motion (drawer, toast, buttons). Tailwind CDN carries the rest. */
:root { --cd-blue: #2563eb; --cd-blue-d: #1d4ed8; --cd-border: #e5e7eb; --cd-ink: #0f172a; --cd-muted: #6b7280; --cd-bg: #f6f7fb;
  --c1: #2563eb; --c2: #0d9488; --c3: #db2777; --c4: #7c3aed; --c5: #d97706; --c6: #16a34a; --c7: #ea580c; --c8: #0891b2; --c9: #475569;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --dur: 220ms; --dur-fast: 160ms;
  --topbar-h: 56px; --row-h: 40px; --row-pad: 6px; }
html { font-family: Hind, Poppins, "Noto Sans Devanagari", system-ui, sans-serif; font-size: 15px; }
body { background: var(--cd-bg); color: var(--cd-ink); font-size: 14px; line-height: 1.5; }
h1, h2, h3, .font-h, .stat .val, .num-big { font-family: Poppins, Hind, "Noto Sans Devanagari", sans-serif; }
.brand { font-family: Poppins, sans-serif; font-weight: 700; letter-spacing: -.01em; }
.grad { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #7c3aed 100%); }
.tint-1 { background: #eff6ff; color: #1d4ed8; } .tint-2 { background: #f0fdfa; color: #0f766e; } .tint-3 { background: #fdf2f8; color: #be185d; }
.tint-4 { background: #f5f3ff; color: #6d28d9; } .tint-5 { background: #fffbeb; color: #b45309; } .tint-6 { background: #f0fdf4; color: #15803d; }
.tint-7 { background: #fff7ed; color: #c2410c; } .tint-8 { background: #ecfeff; color: #0e7490; } .tint-9 { background: #f1f5f9; color: #334155; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
a.lnk, .lnk { color: var(--cd-blue); }
@media (hover: hover) { a.lnk:hover, .lnk:hover { text-decoration: underline; cursor: pointer; } }
p a.lnk { text-decoration: underline; text-underline-offset: 2px; }   /* a link inside running text is not told apart by colour alone */

/* ---- icons (CD.icon) ---- */
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; display: inline-block; vertical-align: -.2em; }
.btn .ic { width: 15px; height: 15px; } .btn-sm .ic { width: 14px; height: 14px; }
.ico .ic { width: 18px; height: 18px; }
.side a .ic { width: 17px; height: 17px; color: #6b7280; } .side a.on .ic { color: #1d4ed8; }
.tab-ic { width: 20px; height: 20px; margin-bottom: 2px; }
.pill .ic { width: 11px; height: 11px; vertical-align: -.1em; }

/* ---- shell ---- */
.side-wrap { background: #fff; border-right: 1px solid var(--cd-border); }
.topbar { background: rgba(255,255,255,.9); backdrop-filter: blur(6px); border-bottom: 1px solid var(--cd-border); }
.side a { display: flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 6px; font-size: 13px; color: #374151; }
@media (hover: hover) { .side a:hover { background: #f3f4f6; } }
.side a.on { background: linear-gradient(90deg, #dbeafe, #ede9fe); color: #1d4ed8; font-weight: 600; }
.side .sec { padding: 12px 12px 4px; font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: .08em; }
.btabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10.5px; color: #6b7280; gap: 1px; flex: 1; }
.btabs a.on { color: var(--cd-blue); font-weight: 600; }

/* ---- cards / stat tiles ---- */
.card { background: #fff; border: 1px solid var(--cd-border); border-radius: 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--cd-border); font-size: 13px; font-weight: 600; }
.card-h .legend { font-size: 12px; font-weight: 400; color: var(--cd-muted); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.card-b { padding: 12px 14px; }
.ico { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.stat { display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-width: 0; }
.stat .lbl { font-size: 11px; color: var(--cd-muted); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .val { font-size: 22px; font-weight: 700; color: var(--cd-blue); margin-top: 2px; line-height: 1.2; }
.stat .sub { font-size: 12px; color: var(--cd-muted); margin-top: 2px; overflow-wrap: anywhere; }
.stat.c1 .val { color: var(--c1); } .stat.c2 .val { color: var(--c2); } .stat.c3 .val { color: var(--c3); } .stat.c4 .val { color: var(--c4); }
.stat.c5 .val { color: var(--c5); } .stat.c6 .val { color: var(--c6); } .stat.c7 .val { color: var(--c7); } .stat.c8 .val { color: var(--c8); } .stat.c9 .val { color: var(--c9); }
/* contrast (WCAG AA 4.5:1 — the tile value is 18–22 px bold, below the "large text" size): the lighter tile hues step one shade darker for the number */
.stat.c2 .val { color: #0f766e; } .stat.c3 .val { color: #be185d; } .stat.c5 .val { color: #b45309; } .stat.c6 .val { color: #15803d; } .stat.c7 .val { color: #c2410c; } .stat.c8 .val { color: #0e7490; }
/* …and the light Tailwind text colours used for small text (grey hints, green / amber numbers) one shade darker everywhere (html + class beats the utility; hover: variants still win) */
html .text-gray-400 { color: #6b7280; } html .text-green-600 { color: #15803d; } html .text-amber-600 { color: #b45309; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stats-4, .stats-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } .stats-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.bar { height: 6px; background: #eff6ff; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--c1), var(--c4)); }

/* ---- tables: comfortable 44 px rows (default), compact 40 px (body.density-compact) — the values are in the layout section at the end; sticky head, zebra + hover ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 2; background: #f9fafb; text-align: left; font-weight: 600; font-size: 12px; color: #4b5563; padding: 0 10px; height: 36px; border-bottom: 1px solid var(--cd-border); white-space: nowrap; }
.tbl td { padding: var(--row-pad) 10px; height: var(--row-h); border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: #fafbfd; }
@media (hover: hover) { .tbl tbody tr:hover td { background: #f1f5f9; } }
/* relation split (2026-10-03): a family's members grouped by house (CD.fh) — the house row above each group */
.tbl tbody tr.fh-house td { background: #fffbeb; color: #92400e; font-size: 12px; font-weight: 600; height: 30px; padding-top: 4px; padding-bottom: 4px; }
.tbl tbody tr.fh-house td .sub { font-weight: 400; }
.fh-badge, .fh-lineage { white-space: nowrap; }
.fh-unconf { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 999px; background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; white-space: nowrap; vertical-align: middle; }
.fh-review { margin: 8px 12px; padding: 8px 10px; border: 1px solid #fde68a; background: #fffbeb; color: #92400e; border-radius: 10px; font-size: 13px; }
.fh-review ul { margin: 4px 0 0 18px; list-style: disc; color: #78350f; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl .name { font-size: 14px; font-weight: 500; }
.tbl .sub { font-size: 12px; color: var(--cd-muted); }
.tbl-wrap { overflow-x: auto; }
.tbl-wrap.scroll { overflow: auto; max-height: var(--tbl-max, calc(100vh - 180px)); }
@media (min-width: 768px) { .tbl-wrap:not(.scroll) { overflow: visible; } .tbl-wrap:not(.scroll) .tbl th { top: var(--topbar-h); } }
.tbl-wrap.scroll .tbl th { top: 0; }
.col-hide { display: none !important; }
.mono-tag { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; background: #f3f4f6; color: #4b5563; border-radius: 4px; padding: 1px 6px; letter-spacing: .02em; white-space: nowrap; }
.tbl-cards > .crow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
@media (min-width: 768px) { .tbl-cards { display: none; } }
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.pager .info { color: var(--cd-muted); margin-right: auto; }
.pager .pg { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--cd-border); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; cursor: pointer; }
.pager .pg.on { background: var(--cd-blue); color: #fff; border-color: transparent; }
.pager .pg[disabled] { opacity: .4; cursor: default; }
.pager .dots { padding: 0 4px; color: #9ca3af; }
@media (max-width: 767px) { .pager .pg:not(.nav) { display: none; } }
@media (min-width: 768px) { .pager .pager-more { display: none; } }

/* ---- pills / tags / chips / buttons / inputs ---- */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill-grey { background: #f3f4f6; color: #374151; }
.pill-blue { background: #dbeafe; color: #1d4ed8; }
.pill-amber { background: #fef3c7; color: #92400e; }
.pill-green { background: #dcfce7; color: #166534; }
.pill-red { background: #fee2e2; color: #991b1b; }
.pill-purple { background: #ede9fe; color: #5b21b6; }
.tag { display: inline-flex; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; line-height: 1; white-space: nowrap; flex-shrink: 0; }
/* voter tags (CD.vt): own tags filled, tags that come from a linked organisation post outlined; the toggle popover */
.vtags { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; vertical-align: middle; }
.vtags .tag.org { background: #fff !important; box-shadow: inset 0 0 0 1.5px currentColor; }
.vtags.sm .tag { min-width: 15px; height: 15px; font-size: 9.5px; padding: 0 3px; border-radius: 3px; }
.vt-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; border: 1px dashed #cbd5e1; color: #64748b; background: #fff; cursor: pointer; vertical-align: middle; flex-shrink: 0; }
.vt-btn .ic { width: 13px; height: 13px; }
@media (hover: hover) { .vt-btn:hover { border-color: #6366f1; color: #4f46e5; background: #eef2ff; } }
.tagpop { position: fixed; z-index: 1250; width: 270px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid var(--cd-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,.18); padding: 6px; animation: cd-pop var(--dur-fast) var(--ease-out); }
.tagpop .tp-h { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; font-size: 12px; color: #64748b; border-bottom: 1px solid #f1f5f9; margin-bottom: 4px; }
.tagpop .tp-h b { color: #0f172a; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagpop label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; min-height: 36px; }
@media (hover: hover) { .tagpop label:hover { background: #f8fafc; } }
.tagpop label input { width: 16px; height: 16px; accent-color: #4f46e5; flex-shrink: 0; }
.tagpop label .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagpop .tp-org { font-size: 10.5px; color: #6d28d9; background: #f5f3ff; border-radius: 999px; padding: 1px 6px; white-space: nowrap; }
.tagpop .tp-f { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px 2px; border-top: 1px solid #f1f5f9; margin-top: 4px; font-size: 11.5px; color: #94a3b8; }
.tagpop.busy { opacity: .7; pointer-events: none; }
@media (max-width: 639px) { .tagpop { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-width: none; border-radius: 14px 14px 0 0; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); } .tagpop label { min-height: 44px; } }
.vt-pick label { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; min-height: 40px; }
@media (hover: hover) { .vt-pick label:hover { background: #f8fafc; } }
.vt-pick label input { width: 16px; height: 16px; accent-color: #4f46e5; }
/* surname categories (CD.cat): the estimate banner, the chip (label + source), the mini stacked bar, the chooser options, the five counts of the share card */
.cat-note { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; color: #475569; font-size: 12.5px; line-height: 1.45; }
.cat-note .ic { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: #64748b; }
.cat-note b { color: #334155; font-weight: 600; margin-right: 6px; }
.cat-note.compact { padding: 5px 9px; font-size: 11.5px; } .cat-note.compact .ic { width: 13px; height: 13px; margin-top: 1px; }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff; font-size: 12px; color: #334155; white-space: nowrap; vertical-align: middle; line-height: 1.6; }
.cat-chip i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.cat-chip b { font-weight: 600; } .cat-chip small { color: #64748b; font-size: 11px; } .cat-chip.unk { color: #64748b; } .cat-chip.unk b { font-weight: 500; }
.cat-chip.sm { padding: 0 6px 0 5px; font-size: 10.5px; gap: 4px; line-height: 1.55; } .cat-chip.sm i { width: 6px; height: 6px; }
.cat-btn .ic { width: 14px; height: 14px; }
.cat-bar { display: inline-flex; gap: 2px; width: 96px; height: 8px; border-radius: 3px; overflow: hidden; vertical-align: middle; background: #fff; }
.cat-bar.wide { display: flex; width: 100%; height: 14px; border-radius: 4px; }
.cat-bar.empty { background: #f1f5f9; }
#cat-card-rows { font-size: 14px; }
#cat-card-rows td.cat-rowbar { width: 34%; min-width: 120px; }
#cat-card-rows .cat-bar.wide { height: 10px; }
.cat-bar i { display: block; min-width: 2px; flex-basis: 0; }
.cat-sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: middle; flex-shrink: 0; }
.cat-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cat-opt { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--cd-border); border-radius: 10px; background: #fff; text-align: left; font-size: 13px; cursor: pointer; transition: background-color 150ms, border-color 150ms; }
.cat-opt i { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.cat-opt.on { border-color: #6366f1; box-shadow: 0 0 0 2px #e0e7ff; font-weight: 600; }
@media (hover: hover) { .cat-opt:hover { background: #f8fafc; } }
#cat-pick.busy { opacity: .7; pointer-events: none; }
.cat-counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.cat-counts > div { display: grid; grid-template-columns: auto 1fr; column-gap: 5px; align-items: center; padding: 6px 8px; border-radius: 8px; background: #f8fafc; min-width: 0; }
.cat-counts .lb { font-size: 11px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-counts b { grid-column: 1 / -1; font-size: 15px; font-weight: 600; color: #0f172a; } .cat-counts small { grid-column: 1 / -1; font-size: 11px; color: #64748b; }
@media (max-width: 639px) { .cat-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cat-opts { grid-template-columns: 1fr; } }
.stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tag-B { background: #f97316; } .tag-C { background: #2563eb; } .tag-P { background: #ca8a04; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--cd-border); border-radius: 999px; font-size: 12px; background: #fff; white-space: nowrap; cursor: pointer; transition: background-color 150ms, border-color 150ms; }
.chip.on { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.chip .ic { width: 12px; height: 12px; opacity: .7; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--cd-border); font-size: 13px; background: #fff; cursor: pointer; white-space: nowrap; transition: background-color 150ms, transform 120ms var(--ease-out), box-shadow 150ms; }
@media (hover: hover) { .btn:hover { background: #f9fafb; } .btn-p:hover { background: #1a5fd0; } }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[disabled] { transform: none; cursor: default; }
.btn-p { background: linear-gradient(90deg, var(--c1), #4f46e5); color: #fff; border-color: transparent; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-ic { padding: 6px; } .btn-sm.btn-ic { padding: 4px; }
.inp { border: 1px solid var(--cd-border); border-radius: 6px; padding: 6px 10px; font-size: 13px; background: #fff; transition: border-color 150ms, box-shadow 150ms; }
.inp:focus { outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px #dbeafe; }
.btn:focus-visible, .chip:focus-visible, .pg:focus-visible, .seg span:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--cd-border); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; font-size: 13px; color: #4b5563; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.tabs a.on { color: var(--cd-blue); border-color: var(--cd-blue); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--cd-border); border-radius: 6px; overflow: hidden; font-size: 12px; }
.seg span { padding: 3px 9px; cursor: pointer; }
.seg span.on { background: linear-gradient(90deg, var(--c1), var(--c4)); color: #fff; }
.cnt { background: var(--cd-blue); color: #fff; border-radius: 999px; font-size: 10px; min-width: 16px; height: 16px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; }

/* ---- avatars (pastel) ---- */
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; flex-shrink: 0; line-height: 1; overflow: hidden; }
.av.has-img { background: #f3f4f6 !important; color: transparent; }
.av.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame .av.has-img { border-radius: 0; width: 100% !important; height: 100% !important; font-size: 0; }
.ph-cap { font-size: 10px; color: #6b7280; text-align: center; margin-top: 3px; white-space: nowrap; }
.photo-frame { border-radius: 8px; overflow: hidden; border: 1px solid var(--cd-border); display: flex; align-items: center; justify-content: center; }

/* ---- page header (CD.pageHeader) ---- */
.page-head { display: flex; align-items: flex-start; gap: 8px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ph-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1 1 0; }
.ph-back { display: inline-flex; width: 32px; height: 32px; border-radius: 8px; align-items: center; justify-content: center; color: #4b5563; border: 1px solid var(--cd-border); background: #fff; flex-shrink: 0; margin-top: 1px; }
.ph-crumbs { font-size: 12px; color: var(--cd-muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ph-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 600; line-height: 1.3; margin: 0; }
.ph-sub { font-size: 13px; color: var(--cd-muted); margin-top: 1px; }
.ph-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; position: relative; }
.ph-actions .sec { display: none; }
.ph-more { position: relative; }
.ph-menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--cd-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.12); min-width: 190px; padding: 4px; z-index: 30; display: none; transform-origin: top right; }
.ph-menu.open { display: block; animation: cd-pop var(--dur-fast) var(--ease-out); }
.ph-menu a, .ph-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; font-size: 13px; border-radius: 6px; text-align: left; background: none; border: 0; color: inherit; cursor: pointer; }
@media (hover: hover) { .ph-menu a:hover, .ph-menu button:hover { background: #f3f4f6; } }
@media (min-width: 768px) { .ph-actions .sec { display: inline-flex; } .ph-more { display: none; } }
@keyframes cd-pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- filter bar (CD.filterBar) ---- */
.fbar { background: #fff; border: 1px solid var(--cd-border); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.fbar-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
.fbar-search { grid-column: 1 / -1; position: relative; }
.fbar-search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: #9ca3af; width: 16px; height: 16px; pointer-events: none; }
.fbar-search .inp { width: 100%; padding-left: 30px; }
.fctl > .flbl { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--cd-muted); margin-bottom: 2px; line-height: 1.2; white-space: nowrap; }
.fctl .inp { width: 100%; }
.fctl .chips { padding-bottom: 0; }
.fbar-more { grid-column: 1 / -1; justify-content: center; }
@media (max-width: 767px) { .fbar-row > .fctl { display: none; } .fbar-row > .fbar-search { display: block; } .card-h .seg { white-space: nowrap; overflow-x: auto; max-width: 100%; } }
.fbar-chips { margin-top: 8px; flex-wrap: wrap; }
.fbar-chips:empty { display: none; }
@media (min-width: 768px) {
  .fbar-row { display: flex; flex-wrap: wrap; }
  .fbar-search { flex: 1 1 240px; max-width: 340px; }
  .fbar-row > .fctl { flex: 0 1 auto; min-width: 130px; max-width: 220px; }
  .fbar-row > .fctl.w-chips { min-width: 0; }
  .fbar-more { margin-left: auto; grid-column: auto; }
}
.fgrid-more { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid-more .fctl.wide { grid-column: 1 / -1; }
/* searchable select (CD.combo): a text box + ✕ / caret, a floating list on PC, an inline full-width list under 768 px */
.combo { position: relative; scroll-margin-top: 72px; }   /* opened on a phone it scrolls to the top of the drawer, below its sticky header */
.combo .combo-inp { width: 100%; padding-right: 30px; text-overflow: ellipsis; }
.combo .combo-inp::placeholder { color: #374151; }
.combo.open .combo-inp::placeholder, .combo .combo-inp:focus::placeholder { color: #9ca3af; }
.combo-x, .combo-caret { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: #9ca3af; background: none; border: 0; padding: 0; cursor: pointer; }
.combo-x .ic, .combo-caret .ic { width: 14px; height: 14px; }
.combo-x { display: none; }
.combo.has-v .combo-x { display: inline-flex; }
.combo.has-v .combo-caret { display: none; }
@media (hover: hover) { .combo-x:hover { background: #f1f5f9; color: #111827; } }
.combo-list { position: absolute; z-index: 60; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(360px, 92vw); max-height: 320px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--cd-border); border-radius: 8px; box-shadow: 0 12px 28px rgba(15,23,42,.14); animation: cd-pop 140ms cubic-bezier(.23,1,.32,1); }
.combo-list li { padding: 6px 8px; border-radius: 6px; font-size: 13px; line-height: 1.35; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-list li.all { color: #6b7280; }
.combo-list li[aria-selected="true"] { font-weight: 600; color: #1d4ed8; }
.combo-list li.act { background: #eff6ff; }
.combo-list li mark { background: #fef3c7; color: inherit; border-radius: 2px; padding: 0; }
.combo-list li.combo-note { color: #9ca3af; font-size: 12px; cursor: default; white-space: normal; }
.combo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.combo-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; overflow: hidden; }   /* the driven native select: hidden, still in the form */
.combo-host { position: relative; }
@media (max-width: 767px) {
  .combo-list { position: static; width: 100%; max-width: none; max-height: 45vh; margin-top: 4px; box-shadow: none; animation: none; }
  .combo-list li { padding: 10px 8px; font-size: 14px; white-space: normal; }
  .fgrid-more .fctl.f-combo { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .combo-list { animation: none; } }

/* ---- skeleton / empty ---- */
.sk { display: block; background: linear-gradient(90deg, #f1f5f9 25%, #e5e7eb 37%, #f1f5f9 63%); background-size: 400% 100%; animation: cd-sk 1.4s ease infinite; border-radius: 6px; }
.sk-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f1f5f9; }
@keyframes cd-sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.empty { text-align: center; padding: 36px 16px; color: var(--cd-muted); }
.empty-ic { display: inline-flex; width: 48px; height: 48px; border-radius: 50%; background: #f1f5f9; color: #64748b; align-items: center; justify-content: center; margin-bottom: 10px; }
.empty-ic .ic { width: 22px; height: 22px; }
.empty-t { font-size: 14px; font-weight: 600; color: #374151; }
.empty-h { font-size: 12.5px; margin-top: 2px; }

/* ---- drawer (slide-in 220 ms / out 160 ms) + toast ---- */
.drawer { position: fixed; inset: 0; z-index: 1200; visibility: hidden; transition: visibility 0s linear var(--dur-fast); }
.drawer.open { visibility: visible; transition-delay: 0s; }
.drawer .bg { position: absolute; inset: 0; background: rgba(15,23,42,.35); opacity: 0; transition: opacity var(--dur-fast) ease-out; }
.drawer.open .bg { opacity: 1; transition-duration: var(--dur); }
.drawer .panel { position: absolute; top: 0; bottom: 0; right: 0; width: min(520px, 100%); background: #fff; overflow: auto; box-shadow: -1px 0 0 var(--cd-border), -12px 0 32px rgba(15,23,42,.12); transform: translateX(100%); transition: transform var(--dur-fast) ease-in; }
.drawer.open .panel { transform: none; transition: transform var(--dur) var(--ease-out); }
.cd-toast { position: fixed; left: 50%; bottom: 24px; z-index: 1300; display: none; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; font-size: 13px; color: #fff; background: #0f172a; box-shadow: 0 8px 24px rgba(15,23,42,.25); transform: translate(-50%, 12px); opacity: 0; transition: opacity var(--dur) ease-out, transform var(--dur) ease-out; max-width: 92vw; }
.cd-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 767px) { .cd-toast { bottom: 76px; } }
/* ---- confirm / alert dialog (CD.confirm / CD.alert): centered card, bottom sheet under 640 px; enter 160 ms ease-out scale .97 → 1 + fade ---- */
.cd-confirm { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cd-confirm .bg { position: absolute; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity var(--dur-fast) ease-out; }
.cd-confirm.open .bg { opacity: 1; }
.cd-confirm .dlg { position: relative; width: 100%; max-width: 420px; background: #fff; border-radius: 14px; box-shadow: 0 24px 64px rgba(15,23,42,.28), 0 0 0 1px rgba(15,23,42,.06); padding: 20px 20px 16px; transform-origin: center; transform: scale(.97); opacity: 0; transition: transform var(--dur-fast) ease-out, opacity var(--dur-fast) ease-out; }
.cd-confirm.open .dlg { transform: none; opacity: 1; }
.cd-confirm .head { display: flex; gap: 14px; align-items: flex-start; }
.cd-confirm .ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: #eff6ff; color: #1d4ed8; }
.cd-confirm .ico .ic { width: 22px; height: 22px; }
.cd-confirm.danger .ico { background: #fef2f2; color: #dc2626; }
.cd-confirm .ttl { font-family: Poppins, Hind, "Noto Sans Devanagari", sans-serif; font-weight: 600; font-size: 15px; color: var(--cd-ink); line-height: 1.3; padding-top: 8px; }
.cd-confirm .txt { margin-top: 6px; font-size: 13.5px; color: #374151; white-space: pre-line; overflow-wrap: anywhere; }
.cd-confirm .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.cd-confirm .acts .btn { padding: 7px 16px; font-weight: 500; }
.btn-danger { background: #dc2626; color: #fff; border-color: transparent; }
@media (hover: hover) { .btn-danger:hover { background: #b91c1c; } }
@media (max-width: 639px) {
  .cd-confirm { align-items: flex-end; padding: 0; }
  .cd-confirm .dlg { max-width: none; border-radius: 18px 18px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(16px) scale(.99); }
  .cd-confirm .acts { flex-direction: column-reverse; gap: 8px; margin-top: 20px; }
  .cd-confirm .acts .btn { width: 100%; justify-content: center; padding: 10px 16px; font-size: 14px; }
}
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--cd-muted); } .kv dd { margin: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-g { background: #16a34a; } .dot-a { background: #d97706; } .dot-r { background: #dc2626; }
.dash-card.dragging { opacity: .4; }
.dash-card .grip { cursor: grab; color: #9ca3af; }
.leaflet-container { font: inherit; border-radius: 8px; }
@media (max-width: 767px) {
  .tbl th, .tbl td { padding: 6px 8px; font-size: 12.5px; }
  .stat .val { font-size: 18px; }
  .card-h .legend { flex-basis: 100%; order: 9; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---- public website ---- */
.site-nav { background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cd-border); }
.site-link { padding: 6px 10px; border-radius: 6px; font-size: 14px; color: #374151; }
.site-link:hover, .site-link.on { color: var(--cd-blue); background: #eff6ff; }
.site-footer { background: #fff; border-top: 1px solid var(--cd-border); }
.hero { background: radial-gradient(1200px 500px at 20% -10%, #dbeafe 0%, transparent 60%), radial-gradient(900px 400px at 90% 10%, #ede9fe 0%, transparent 60%); }
.h-xl { font-family: Poppins, Hind, sans-serif; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.feat { border: 1px solid var(--cd-border); border-radius: 12px; padding: 18px; background: #fff; transition: transform .15s, box-shadow .15s; }
.feat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.08); }
.step-n { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-family: Poppins; font-weight: 700; background: linear-gradient(135deg, #2563eb, #7c3aed); }
.plan { border: 1px solid var(--cd-border); border-radius: 14px; padding: 20px; background: #fff; display: flex; flex-direction: column; }
.plan.hot { border: 2px solid #7c3aed; box-shadow: 0 10px 30px rgba(124,58,237,.15); position: relative; }
.plan.hot::before { content: attr(data-badge); position: absolute; top: -12px; left: 16px; background: linear-gradient(90deg,#2563eb,#7c3aed); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.price { font-family: Poppins; font-size: 30px; font-weight: 700; }
.mock { border: 1px solid var(--cd-border); border-radius: 12px; background: #fff; box-shadow: 0 20px 50px rgba(15,23,42,.12); overflow: hidden; }
.mock .bar-top { height: 28px; background: #f1f5f9; display: flex; gap: 6px; align-items: center; padding: 0 10px; }
.mock .bar-top i { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; display: block; }
.faq details { border: 1px solid var(--cd-border); border-radius: 10px; padding: 12px 16px; background: #fff; }
.faq summary { cursor: pointer; font-weight: 600; }
.band { background: linear-gradient(135deg, #1e3a8a, #2563eb 55%, #7c3aed); color: #fff; border-radius: 16px; }
.check li { padding-left: 22px; position: relative; }
.check li::before { content: "✓"; position: absolute; left: 0; color: #16a34a; font-weight: 700; }
.band .btn { background: #fff; color: #1e3a8a; border-color: #fff; font-weight: 600; }
.band .btn.bg-transparent { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }

/* scope selector (district > assembly) */
.scope-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--cd-border); border-radius: 10px; background: #fff; font-size: 13px; max-width: 360px; white-space: nowrap; overflow: hidden; transition: border-color 160ms ease, transform 160ms ease-out; }
.scope-btn b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.scope-btn .ic { width: 16px; height: 16px; color: #6366f1; flex: none; }
.scope-btn:active { transform: scale(.97); }
@media (hover: hover) { .scope-btn:hover { border-color: #a5b4fc; } }
@media (max-width: 767px) { .scope-btn { max-width: 150px; padding: 0 8px; } }
.drawer .panel.wide { width: min(1040px, 100%); }
/* scope picker: district groups flow into 2–3 columns on wide screens (one column on phones) */
.scope-cols { columns: 1; column-gap: 14px; }
.scope-cols .scope-d { break-inside: avoid; margin-bottom: 14px; }
@media (min-width: 720px) { .panel.wide .scope-cols { columns: 2; } }
@media (min-width: 1000px) { .panel.wide .scope-cols { columns: 3; } }
.scope-a { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--cd-border); border-radius: 10px; background: #fff; margin-bottom: 6px; }
.scope-a.on { border-color: #818cf8; background: #eef2ff; }
@media (hover: hover) { .scope-a:hover { border-color: #a5b4fc; } }
.scope-a .ic { width: 16px; height: 16px; color: #6366f1; }
.scope-head { position: sticky; top: -16px; z-index: 2; background: #fff; padding: 2px 0 10px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 8px; }
.scope-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 720px) { .panel.wide .scope-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .panel.wide .scope-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.scope-grid .scope-a { margin-bottom: 0; }
.scope-flow { columns: 1; column-gap: 6px; }
.scope-flow .scope-a { break-inside: avoid; margin-bottom: 6px; }
@media (min-width: 720px) { .panel.wide .scope-flow { columns: 2; } }
@media (min-width: 1000px) { .panel.wide .scope-flow { columns: 3; } }
.scope-dh { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; margin: 0 0 6px; }
.scope-dh span { font-weight: 400; text-transform: none; }
.scope-a.kb { border-color: #6366f1; box-shadow: 0 0 0 2px #c7d2fe; }
.scope-a .scope-no { min-width: 30px; }

.scope-no { width: 30px; height: 30px; border-radius: 8px; background: #eef2ff; color: #4338ca; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
/* super multi-assembly scope (docs/specs/super-multi-scope.md): All Chhattisgarh, whole districts, "Select several" + the chip */
.scope-btn-multi { border-color: #c7d2fe; background: #eef2ff; }
.scope-btn-multi b { color: #3730a3; }
.scope-super { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.scope-allcg { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #c7d2fe; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #f5f3ff); min-height: 52px; transition: border-color 160ms ease, transform 160ms ease-out; }
.scope-allcg .ic { width: 18px; height: 18px; color: #4f46e5; flex: none; }
.scope-allcg.on { border-color: #6366f1; box-shadow: 0 0 0 2px #c7d2fe; }
.scope-allcg:active { transform: scale(.98); }
@media (hover: hover) { .scope-allcg:hover { border-color: #818cf8; } }
.scope-multi-t { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--cd-border); border-radius: 12px; background: #fff; font-size: 13px; cursor: pointer; min-height: 44px; }
.scope-multi-t input { width: 16px; height: 16px; accent-color: #4f46e5; }
.scope-dhb { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin: 0 0 6px; border: 1px dashed #c7d2fe; border-radius: 10px; background: #f8fafc; font-size: 12.5px; min-height: 36px; transition: border-color 160ms ease, background-color 160ms ease; }
.scope-dhb .ic { width: 15px; height: 15px; color: #6366f1; flex: none; }
.scope-dhb.on { border-style: solid; border-color: #818cf8; background: #eef2ff; }
.scope-dhb-go { font-size: 11px; color: #4f46e5; white-space: nowrap; }
@media (hover: hover) { .scope-dhb:hover { border-color: #818cf8; background: #eef2ff; } }
.scope-ck { width: 18px; height: 18px; border: 1.5px solid #a5b4fc; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: #fff; }
.scope-ck.on { background: #4f46e5; border-color: #4f46e5; }
.scope-ck.on .ic { color: #fff; width: 13px; height: 13px; }
.scope-foot { position: sticky; bottom: -16px; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0 12px; margin-top: 8px; background: #fff; border-top: 1px solid var(--cd-border); }
.scope-block { max-width: 720px; }
.ms-note { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; background: #eef2ff; color: #3730a3; font-size: 13px; }
.ms-note .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
/* booth map clusters (many booths: All CG / a district) */
.mc-pin { display: flex; align-items: center; justify-content: center; border-radius: 9999px; background: rgba(37, 99, 235, .82); color: #fff; font: 600 11px/1 Poppins, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15,23,42,.3); }
.map-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 500; background: #fff; border: 1px solid var(--cd-border); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: #475569; display: flex; gap: 6px; align-items: center; box-shadow: 0 4px 12px rgba(15,23,42,.08); }

/* brand: logo mark + wordmark (assets/brand/, built by web/tools/brand_assets.py); collapsed rail = mark only */
.side-logo img { display: block; }
.side-word { height: 18px; width: auto; }
.top-word { height: 15px; width: auto; }
@media (max-width: 359px) { .top-word { display: none; } }

/* collapsible PC sidebar: 228 px ↔ 64 px icon rail (body.side-collapsed) */
.side-wrap { transition: width 200ms cubic-bezier(.23,1,.32,1); }
#wrap { transition: padding-left 200ms cubic-bezier(.23,1,.32,1); }
.side-toggle .ic { width: 16px; height: 16px; color: #6b7280; }
@media (min-width: 768px) {
  body.side-collapsed .side-wrap { width: 64px !important; }
  body.side-collapsed #wrap { padding-left: 64px !important; }
  body.side-collapsed .side-label { display: none; }
  body.side-collapsed .side-head { flex-direction: column; justify-content: center; gap: 4px; height: auto; padding: 8px 0; }
  body.side-collapsed .side-head > a { flex: none; justify-content: center; }
  body.side-collapsed .side a { justify-content: center; padding: 8px 0; }
  body.side-collapsed .side a .ic { width: 19px; height: 19px; }
  body.side-collapsed .side .sec { padding: 8px 0 4px; margin: 4px 10px 0; border-top: 1px solid var(--cd-border); }
  body.side-collapsed .side-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) { .side-wrap, #wrap { transition: none; } }
/* The app pages are drawn by script (CD.init: sidebar, top bar, page header, filter bar, then the page's own render). With the
   deferred scripts of the deploy build the bare HTML would paint first and then jump (layout shift), so #app stays invisible
   until CD.init marks it .cd-ready; if a script fails, the 3 s animation shows it anyway. */
#app:not(.cd-ready) { visibility: hidden; animation: cd-show 0s 3s forwards; }
@keyframes cd-show { to { visibility: visible; } }
/* "Demo data" pill (CD.demoPill on a card header that previews a feature with sample values; CD.demoBadge next to the page title in demo mode) */
.demo-pill { display: inline-flex; align-items: center; gap: 4px; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; margin-left: 8px; vertical-align: middle; align-self: center; flex: none; line-height: 1.5; text-transform: none; letter-spacing: 0; }
.demo-pill .ic { width: 12px; height: 12px; vertical-align: 0; }
/* sortable tables (CD.sortable): <th data-sort="key"> + ▲ / ▼; the mobile "Sort by" select (.sort-m) shows under 768 px only */
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort] .sort-ic { display: inline-block; margin-left: 4px; font-size: 9px; color: #cbd5e1; min-width: 9px; vertical-align: 1px; }
.tbl th[aria-sort="ascending"], .tbl th[aria-sort="descending"] { color: #1d4ed8; }
.tbl th[aria-sort="ascending"] .sort-ic, .tbl th[aria-sort="descending"] .sort-ic { color: #2563eb; }
.tbl th[data-sort]:focus-visible { outline: 2px solid #60a5fa; outline-offset: -2px; }
@media (hover: hover) { .tbl th[data-sort]:hover { color: #111827; } .tbl th[data-sort]:hover .sort-ic { color: #64748b; } }
.sort-m { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 12px; color: #4b5563; border-bottom: 1px solid #f1f5f9; }
.sort-m select { flex: 1; min-width: 0; height: 32px; border: 1px solid #d1d5db; border-radius: 8px; padding: 0 8px; background: #fff; font-size: 13px; color: #111827; }
.sort-m .btn { height: 32px; min-width: 32px; justify-content: center; }
@media (min-width: 768px) { .sort-m { display: none; } }

/* ---- laptop screens (14" / 15", 2026-10-08, docs/reports/laptop-ui-audit.md) ----
   Target viewports after Windows scaling: 1280×650, 1366×657, 1440×760, 1536×730. Two ranges, each its own media query:
   width 768–1599 px = narrower sidebar, tighter grids / tiles / tables; height ≤ 820 px (PC) = tighter vertical rhythm.
   1920-wide desktops (unless short) and phones keep the rules above. --side-w = the current sidebar width (fixed bars follow it). */
:root { --topbar-h: 3.5rem; --side-w: 228px; }   /* the topbar is h-14 = 3.5rem (html is 15 px) — the sticky table heads sit right under it */
@media (min-width: 768px) { body.side-collapsed { --side-w: 64px; } }
@media (max-width: 767px) { :root { --side-w: 0px; } }
.side a.on { scroll-margin: 40px; }
/* tables wider than their card: CD.fitTables() marks the wrapper .hx → horizontal scroll inside the card + sticky first column */
@media (min-width: 768px) {
  .tbl-wrap.hx { overflow-x: auto; overflow-y: hidden; }
  .tbl-wrap.hx .tbl th { top: 0; }
  .tbl-wrap.hx .tbl:not(.no-stick) > thead > tr > th:first-child, .tbl-wrap.hx .tbl:not(.no-stick) > tbody > tr > td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 #eef0f3; }
  .tbl-wrap.hx .tbl:not(.no-stick) > thead > tr > th:first-child { z-index: 3; }
  .tbl-wrap.hx .tbl:not(.no-stick) > tbody > tr > td:first-child { background: #fff; }
  .tbl-wrap.hx .tbl:not(.no-stick) > tbody > tr:nth-child(even) > td:first-child { background: #fafbfd; }
  .tbl-wrap.hx .tbl:not(.no-stick) > tbody > tr.fh-house > td:first-child { background: #fffbeb; position: static; }
  .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > thead > tr > th:first-child, .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > tbody > tr > td:first-child { box-shadow: none; }
  .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > thead > tr > th:nth-child(2), .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > tbody > tr > td:nth-child(2) { position: sticky; left: var(--hx1, 40px); z-index: 1; background: #fff; box-shadow: inset -1px 0 0 #eef0f3; }
  .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > thead > tr > th:nth-child(2) { z-index: 3; background: #f9fafb; }
  .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > tbody > tr:nth-child(even) > td:nth-child(2) { background: #fafbfd; }
  .fbar .seg span, .card-h .seg span { white-space: nowrap; }
  .fbar-row.fbar-tight .fbar-more > span { display: none; }   /* CD.filterBar: the label goes when the button would wrap alone (icon + count stay; title = the label) */
  .fbar-row > .fctl:has(.seg), .fbar-row > .fctl:has(.chips) { max-width: none; }
}

@media (hover: hover) and (min-width: 768px) { .tbl-wrap.hx .tbl:not(.no-stick) > tbody > tr:hover > td:first-child, .tbl-wrap.hx.hx2 .tbl:not(.no-stick) > tbody > tr:hover > td:nth-child(2) { background: #f1f5f9; } }
@media (min-width: 768px) and (max-width: 1599.98px) {
  :root { --side-w: 212px; }
  body.side-collapsed { --side-w: 64px; }
  body:not(.side-collapsed) .side-wrap { width: 212px !important; }
  body:not(.side-collapsed) #wrap { padding-left: 212px !important; }
  .side-head { gap: 6px !important; padding-left: 10px !important; padding-right: 8px !important; }
  .side-head .side-logo > img:first-child { width: 30px; height: 30px; }
  .side-word { height: 16px; }
  .side-foot { padding: 8px 12px !important; }
  .scope-btn { max-width: 300px; }
  /* tiles: 8 → 4 columns under 1600 px (fallback; CD.fitLayout sets the real count); long text cells clamp narrower */
  .stats-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tbl td.max-w-xs { max-width: 14rem; }
  /* filter bar: controls shrink before they wrap, so the search + 4 controls + More fit one row more often */
  .fbar-row > .fctl { min-width: 110px; max-width: 200px; }
  .fbar-row > .fctl:not(.fbar-search):not(:has(.seg, .chips, input[type=checkbox])) { flex: 0 1 130px; }   /* a select's own width = its longest option; a fixed basis lets the row fit before it wraps */
  .fbar-row > .fctl.f-combo:not(.fbar-search):not(:has(.seg, .chips, input[type=checkbox])) { flex: 0 1 118px; min-width: 104px; }   /* combos (text + ✕): a bit narrower, so six controls + More still fit at 1280 */
  .fbar-row > .fbar-search { flex: 1 1 150px; min-width: 150px; max-width: 300px; }
  .fbar-row { gap: 8px; }
  /* a crowded bar (search + 6 controls + More — voters with the samaj filter: booth · sex · age · surname · samaj · tag): narrower bases, so
     "More filters" stays on the row at 1280 (a flex row wraps on the bases, it never shrinks first) */
  .fbar-row:has(> :nth-child(8)) > .fctl:not(.fbar-search):not(:has(.seg, .chips, input[type=checkbox])) { flex-basis: 108px; min-width: 96px; }
  .fbar-row:has(> :nth-child(8)) > .fbar-search { flex-basis: 128px; min-width: 128px; }
  /* page header: the title keeps at least 300 px before the actions squeeze it (they wrap below instead) */
  .ph-main { flex: 1 1 300px; }
  .ph-actions .sec.sx { display: none; }
  .ph-actions.has-sx .ph-more { display: block; }
  .ph-actions.has-sx .ph-menu .mm { display: none; }
}
@media (min-width: 768px) and (max-width: 1359.98px) { .stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1600px) and (max-width: 1699.98px) { .stats-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) and (max-height: 820px) { .side-foot .mt-2 { margin-top: 4px; } }   /* short laptop screens: the layout section takes 4 px off the top padding and the sidebar items only */
/* drawers / dialogs never taller than the screen: the dialog body scrolls, the buttons stay visible */
.cd-confirm .dlg { max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.cd-confirm .head { min-height: 0; flex: 1 1 auto; overflow: hidden; }
.cd-confirm .head > .min-w-0 { min-height: 0; max-height: 100%; overflow-y: auto; }
.cd-confirm .acts { flex: none; }
@media (max-width: 639px) { .cd-confirm .dlg { max-height: calc(100vh - 24px); } }

/* nav count badge (super: new website enquiries — CD.navBadges) */
.side a .nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e11d48; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; flex: none; }
.side a .nav-badge.hidden { display: none; }
body.side-collapsed .side a { position: relative; }
body.side-collapsed .side a .nav-badge { position: absolute; top: 2px; right: 6px; min-width: 15px; height: 15px; line-height: 15px; font-size: 9px; padding: 0 3px; }

/* "Not set up yet" strip: the empty cards of a page as one slim row of links (dashboard; CD.setupStrip) */
.setup-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; }
.setup-strip .ss-h { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #374151; margin-right: 4px; }
.setup-strip .ss-h .ic { width: 16px; height: 16px; color: #9ca3af; }
.setup-strip .ss-note { flex-basis: 100%; font-size: 12px; color: var(--cd-muted); margin-top: -2px; }
.setup-strip a.ss-i { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--cd-border); border-radius: 999px; font-size: 12.5px; color: #374151; background: #fff; text-decoration: none; white-space: nowrap; }
.setup-strip a.ss-i .ic { width: 14px; height: 14px; color: #6b7280; }
.setup-strip a.ss-i .go { color: var(--cd-blue); font-weight: 500; }
@media (hover: hover) { .setup-strip a.ss-i:hover { border-color: #93c5fd; background: #f8fbff; } }
/* a card title always starts at the left, its links at the right (a grip or a text title used to centre it in a 3-item row) */
.card-h.lh { justify-content: flex-start; }
.card-h.lh:not(:has(> .ml-auto)) > :last-child:not(:nth-child(-n+2)) { margin-left: auto; }   /* grip, title, … link */
/* empty states inside a card / chart stay compact (a "nothing yet" box used to be as tall as a chart); hints keep a readable width */
.card-b > .empty, .viz-host .empty, .card > .empty { padding: 22px 14px; }
.card-b > .empty .empty-ic, .viz-host .empty .empty-ic, .card > .empty .empty-ic { width: 40px; height: 40px; margin-bottom: 8px; }
.empty-h { max-width: 52ch; margin-left: auto; margin-right: auto; }

/* ==== layout + spacing (2026-10-26, docs/specs/layout-spacing.md) ====
   One scale (4 · 8 · 12 · 16 · 24 · 32 · 48), four width bands, a centred content column (max 1680 px), the same gap between
   every card / section. Columns of tile strips, the dashboard grid and chart + table cards follow their OWN width (CD.fitLayout
   writes data-cols / data-split); the media queries above stay as the fallback before the script runs. */
:root { --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --content-max: 1680px; --page-px: 16px; --page-pt: 16px; --page-pb: 80px; --gap: 16px; --tile-gap: 12px;
  --card-hy: 12px; --card-hx: 14px; --card-p: 14px; --tile-p: 14px; --tile-val: 20px; --h1: 20px; --cell-px: 10px; }
@media (max-width: 399.98px) { :root { --page-px: 12px; } }
@media (min-width: 768px) { :root { --page-pt: 16px; --page-pb: 32px; --gap: 16px; --tile-gap: 16px; --card-hy: 12px; --card-hx: 16px; --card-p: 16px; --tile-p: 16px; --tile-val: 22px; --h1: 22px; } }
@media (min-width: 1024px) { :root { --page-px: 20px; --page-pt: 16px; --page-pb: 40px; --gap: 16px; --card-hy: 12px; --card-hx: 16px; --card-p: 16px; --tile-p: 14px; --tile-val: 24px; --h1: 24px; } }
@media (min-width: 1440px) { :root { --page-px: 24px; --page-pt: 20px; --page-pb: 48px; --gap: 20px; --card-hy: 12px; --card-hx: 16px; --card-p: 16px; --tile-p: 16px; --tile-val: 26px; --cell-px: 12px; } }
@media (min-width: 768px) and (max-height: 820px) { :root { --page-pt: 16px; } }

/* the content column: centred right of the sidebar, max 1680 px of content (profile keeps its 1100 px form) */
#wrap > main { width: 100%; max-width: calc(var(--content-max) + 2 * var(--page-px)); margin-left: auto; margin-right: auto; padding: var(--page-pt) var(--page-px) var(--page-pb); }
#wrap > main.max-w-\[1100px\] { max-width: calc(1100px + 2 * var(--page-px)); }
header.topbar { padding-left: var(--page-px); padding-right: var(--page-px); }
@media (max-width: 767.98px) { header.topbar { padding-left: 12px; padding-right: 12px; } }

/* vertical rhythm: the blocks of a page are one gap apart (margins collapse: a page's own mb-3 never adds up; an empty slot adds nothing) */
#wrap > main > * + * { margin-top: var(--gap); }
#wrap > main > .fbar + *, #wrap > main > .tabs + * { margin-top: var(--s4); }
#wrap > main > .page-head { margin-bottom: 0; }
/* card grids / stacks inside pages: the same gap (grid gap-3 / gap-4 of cards, space-y-3 / 4 columns of cards, stacked cards with mb-3) */
#wrap > main :is(.gap-3, .gap-4, .gap-5).grid:is(:has(> .card), :has(> * > .card), :has(> .stats)) { gap: var(--gap); }
#wrap > main :is(.space-y-3, .space-y-4):has(> .card) > :not([hidden]) ~ :not([hidden]) { margin-top: var(--gap); }
#wrap > main :is(.card, .stats):is(.mb-3, .mb-4):not(:last-child) { margin-bottom: var(--gap); }
#wrap > main :is(.card, .stats):is(.mt-3, .mt-4) { margin-top: var(--gap); }

/* cards */
.card { border-radius: 10px; }
.card-h { padding: var(--card-hy) var(--card-hx); min-height: 48px; gap: 8px 12px; font-size: 15px; line-height: 1.35; }
.card-h .lnk { font-size: 12.5px; font-weight: 500; }
.card-b { padding: var(--card-p); }
.card .tbl tr > :first-child { padding-left: var(--card-hx); }
.card .tbl tr > :last-child { padding-right: var(--card-hx); }
.card .card-b .tbl tr > :first-child { padding-left: var(--cell-px); }
.card .card-b .tbl tr > :last-child { padding-right: var(--cell-px); }
@media (max-width: 767.98px) { .card-h { font-size: 14px; min-height: 44px; } }

/* stat tiles */
.stats { gap: var(--tile-gap); }
.stats[data-cols] { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)) !important; }
.stat { padding: var(--tile-p); gap: 14px; }
.stat .ico { width: 40px; height: 40px; border-radius: 10px; }
.stat .ico .ic { width: 19px; height: 19px; }
.stat .lbl { font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; line-height: 1.5; }
.stat .val { font-size: var(--tile-val); font-weight: 600; margin-top: 2px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .sub { line-height: 1.45; margin-top: 4px; }

/* the dashboard grid (and any card grid that wants it): 1 / 2 / 3 columns of ≥ 400 px; dc-full = the row, dc-2 = two columns, dc-tall = two rows at 3 columns */
.dash-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); grid-auto-flow: row dense; }
@media (min-width: 1024px) { .dash-grid:not([data-cols]) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .dash-grid:not([data-cols]) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dash-grid[data-cols] { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.dash-grid > .dc-full { grid-column: 1 / -1; }
.dash-grid:not([data-cols="1"]) > .dc-2 { grid-column: span 2; }
.dash-grid[data-cols="3"] > .dc-tall { grid-row: span 2; }
.dash-grid > * { min-width: 0; }

/* chart + table in one card: side by side from 820 px of card width (a divider, each pane its own padding), else stacked */
.split { display: grid; grid-template-columns: minmax(0, 1fr); }
.split > * { min-width: 0; }
.split > * + * { border-top: 1px solid var(--cd-border); }
.split[data-split="row"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split[data-split="row"] > * + * { border-top: 0; border-left: 1px solid var(--cd-border); }

/* page header (CD.pageHeader): crumbs above; title + pills left, actions right; chips on their own row */
.page-head { display: block; margin-bottom: 0; }
.page-head > .ph-crumbs { margin-bottom: 6px; }
.ph-top { display: flex; align-items: flex-start; gap: 12px 16px; flex-wrap: wrap; }
.ph-main { flex: 1 1 320px; gap: 12px; }
.ph-title-row { gap: 8px 12px; min-height: 32px; }
.page-head h1 { font-size: var(--h1); line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.ph-sub { margin-top: 4px; line-height: 1.5; }
.ph-actions { flex-wrap: wrap; justify-content: flex-end; }
.ph-row { margin-top: var(--s3); }
.ph-row:empty { display: none; }
.ph-row .chips { flex-wrap: wrap; gap: var(--s2); overflow: visible; padding-bottom: 0; }
.ph-row .chip { padding: 5px 12px; font-size: 12.5px; }
.ph-crumbs { font-size: 12px; line-height: 1.5; gap: 6px; }

/* filter bar */
.fbar { padding: var(--s3) var(--s4); border-radius: 10px; margin-bottom: var(--s4); }
.fbar-chips { margin-top: var(--s3); gap: var(--s2); }
.fbar-chips .chip { padding: 4px 10px; }
@media (min-width: 1440px) { .fbar-row { gap: var(--s3); } }

/* tables: comfortable (default) 44 px rows · compact (the old feel) 40 px */
:root { --row-h: 44px; --row-pad: 10px; }
body.density-compact { --row-h: 40px; --row-pad: 6px; --cell-px: 10px; }
.tbl th { padding: 0 var(--cell-px); height: 40px; }
.tbl td { padding: var(--row-pad) var(--cell-px); }
body.density-compact .tbl th { height: 36px; }

/* sidebar: 38 px items (34 on short screens), calmer section labels */
.side a { padding: 9px 12px; gap: 10px; font-size: 13.5px; line-height: 20px; border-radius: 8px; }
.side a + a { margin-top: 1px; }
.side .sec { padding: 16px 12px 6px; font-size: 10.5px; }
.side .sec:first-child { padding-top: 6px; }
@media (min-width: 768px) and (max-height: 820px) { .side a { padding-top: 7px; padding-bottom: 7px; } .side .sec { padding: 12px 12px 4px; } }
@media (min-width: 768px) { body.side-collapsed .side a { padding: 9px 0; } body.side-collapsed .side .sec { padding: 6px 0 4px; margin: 6px 10px 0; } }

/* setup strip + empty states on the scale */
.setup-strip { padding: var(--card-hy) var(--card-hx); gap: var(--s2) var(--s3); }
.split[data-split="row"].s57 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
/* a tile strip inside a card (dashboard "Headline numbers"): padded like a card body, the tiles quieter (no second shadow) */
.card > .stats { padding: var(--card-p); }
.card > .stats > .stat { box-shadow: none; border-color: #eef0f3; }
@media (max-width: 767.98px) { .stat { gap: 10px; } .stat .ico { width: 32px; height: 32px; border-radius: 8px; } .stat .ico .ic { width: 16px; height: 16px; } }
@media (max-width: 1439.98px) { .card-h { font-size: 14px; } }
@media (max-width: 767.98px) { .ph-main { flex: 1 1 0; min-width: 45%; } }   /* phones: a short title shares its line with the actions, a long one pushes them below */
.ph-title-row > * { max-width: 100%; }
.ph-title-row .cat-chip { flex-wrap: wrap; row-gap: 0; border-radius: 12px; }   /* a long "Not confirmed · could not be worked out" chip wraps inside itself on a phone (no page h-scroll) */
.stats.t-narrow .stat .ico { display: none; }

/* ==== layout leftovers (2026-10-26, docs/specs/layout-spacing.md §4b) ==== */
/* a page's main column + side column (a wide table + side cards, a chart + a card, two tables): side by side only when the grid's
   own width reaches data-min (CD.fitLayout → data-split="row"), else stacked — the main block first at full width, the side
   column's cards then share the row (2–3 across) instead of each taking the full width. Cards keep their own height. */
.side-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.side-grid > * { min-width: 0; }
.side-grid[data-split="row"] { grid-template-columns: var(--sg-cols, minmax(0, 1fr) minmax(320px, 25%)); }
.side-grid.sg-21 { --sg-cols: minmax(0, 2fr) minmax(320px, 1fr); } .side-grid.sg-32 { --sg-cols: minmax(0, 3fr) minmax(0, 2fr); } .side-grid.sg-23 { --sg-cols: minmax(0, 2fr) minmax(0, 3fr); }
.side-grid.sg-75 { --sg-cols: minmax(0, 7fr) minmax(0, 5fr); } .side-grid.sg-57 { --sg-cols: minmax(0, 5fr) minmax(0, 7fr); }
.side-grid[data-split="col"] > .sg-side { columns: 340px; column-gap: var(--gap); }   /* masonry-like: each card its own height, the columns balance */
.side-grid[data-split="col"] > .sg-side > * { margin-top: 0 !important; margin-bottom: var(--gap); break-inside: avoid; }
.side-grid[data-split="col"] > .sg-side > :last-child { margin-bottom: 0; }
@media (min-width: 1440px) { .side-grid:not([data-split]) { grid-template-columns: var(--sg-cols, minmax(0, 1fr) minmax(320px, 25%)); } }   /* before the script runs */
/* card headers that would wrap (CD.fitLayout → .ch-fold / .ch-seg): the chart tools fold into "⋯" with a small popover; a segment switch
   goes to its own row under the title */
.viz-pop { display: contents; }
.viz-tools .viz-more { display: none; }
.card-h.ch-fold .viz-tools { position: relative; }
.card-h.ch-fold .viz-tools .viz-more { display: inline-flex; }
.card-h.ch-fold .viz-pop { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--cd-border); border-radius: 10px; box-shadow: 0 10px 28px rgba(15,23,42,.14); transform-origin: top right; }
.card-h.ch-fold .viz-tools.open .viz-pop { display: flex; animation: cd-pop var(--dur-fast) var(--ease-out); }
.card-h.ch-fold .viz-pop .btn { width: 36px; height: 36px; justify-content: center; }
.card-h.ch-seg::after { content: ''; flex-basis: 100%; height: 0; order: 8; }
.card-h.ch-seg > .seg { order: 9; margin-left: 0; }
/* dashboard packing (CD.fitLayout pack): 4 px rows, each card spans its own height; vertical gaps are the cards' bottom margin */
.dash-grid[data-masonry] { grid-auto-rows: 4px; row-gap: 0; align-items: start; margin-bottom: calc(-1 * var(--gap)); }
.dash-grid[data-masonry] > * { margin-bottom: var(--gap); }
.dash-grid[data-masonry] > [data-grow] { align-self: stretch; }
.dash-grid[data-masonry] > .dc-tall { grid-row: auto; }
.dash-grid[data-masonry] > [data-grow] { display: flex; flex-direction: column; }
.dash-grid[data-masonry] > [data-grow] > :last-child { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
