:root {
  color-scheme: light;
  --paper: #ededed;
  --paper-2: #e2e2e2;
  --ink: #222222;
  --ink-2: #575757;
  --rule: #c4c4c4;
  --rule-2: #d8d8d8;
  --tint: #d4d4d4;
  --solid: #222222;
  --solid-2: #444444;
  --on-solid: #f5f5f5;
  --scrim: rgb(0 0 0 / 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", sans-serif;
  --lh: 1.6;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ptabs-h: 60px;
}

/* Night paper: the cell and the call button turn off-white so they stay the
   brightest things on the page, as they are the darkest in daylight. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1a1a1a;
    --paper-2: #242424;
    --ink: #ededed;
    --ink-2: #a3a3a3;
    --rule: #424242;
    --rule-2: #2e2e2e;
    --tint: #363636;
    --solid: #ededed;
    --solid-2: #c2c2c2;
    --on-solid: #1a1a1a;
    --scrim: rgb(0 0 0 / 0.62);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a1a1a;
  --paper-2: #242424;
  --ink: #ededed;
  --ink-2: #a3a3a3;
  --rule: #424242;
  --rule-2: #2e2e2e;
  --tint: #363636;
  --solid: #ededed;
  --solid-2: #c2c2c2;
  --on-solid: #1a1a1a;
  --scrim: rgb(0 0 0 / 0.62);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: var(--lh);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-color: var(--rule) var(--paper);
  caret-color: var(--ink);
  accent-color: var(--ink);
}
html:lang(en) { --lh: 1.5; }
html.no-scroll { overflow: hidden; }
body { margin: 0; min-height: 100dvh; }
::selection { background: var(--rule); color: var(--ink); }

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.xs { width: 14px; height: 14px; }
.icon.chevron { width: 20px; height: 20px; color: var(--ink-2); }
.noscript { padding: 24px 16px; }

/* The cell: a booth number set like the date on a wall calendar. */
.cell {
  display: inline-grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--tint);
  color: var(--ink);
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
}
.drawer-install { margin-top: 12px; padding: 0 8px; display: grid; gap: 8px; }
.drawer-install .drawer-title { margin: 12px 0 0; }
.drawer-install .btn { min-height: 44px; border-width: 1px; border-color: var(--rule); border-radius: 999px; font-size: 15px; font-weight: 600; }
.install-steps { padding-left: 20px; list-style: decimal; display: grid; gap: 4px; font-size: 14px; }
.people-group + .people-group { margin-top: 20px; }
.group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0 6px; border-bottom: 1px solid var(--rule); color: var(--ink-2); font-size: 14px; font-weight: 600; }
.cell { position: relative; }
/* A booth's grade: a small letter on a ring at the tile's top right corner. */
.cell-cat { position: absolute; top: -1px; right: -1px; display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid var(--rule); border-radius: 0 8px 0 8px; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 700; line-height: 1; }
.cell-md.graded, .cell-sm.graded { align-items: end; padding-bottom: 5px; }
.cell-md.graded { height: 48px; }
.cell-lg .cell-cat { width: 20px; height: 20px; font-size: 12px; }
.cell-xs { width: 36px; height: 32px; font-size: 14px; }
.cell-sm { width: 40px; height: 40px; font-size: 17px; }
.cell-md { width: 52px; height: 44px; font-size: 20px; }
.cell-xs.len-3 { font-size: 13px; }
.cell-xs.len-4 { font-size: 11px; }
.cell-sm.len-3 { font-size: 15px; }
.cell-sm.len-4 { font-size: 12px; }
.cell-md.len-4 { font-size: 16px; }
.cell-lg { width: 56px; height: 56px; grid-template-rows: auto 1fr; align-self: flex-start; }
.cell-lg .cell-cap {
  width: 100%;
  padding: 2px 0 1px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}
.cell-lg .cell-no { font-size: 26px; }
.cell-lg.len-3 .cell-no { font-size: 22px; }
.cell-lg.len-4 .cell-no { font-size: 18px; }
.cell-lg .icon { width: 22px; height: 22px; stroke-width: 1.5; }
.cell-outline { background: none; color: var(--ink-2); }
.cell-outline.cell-xs .icon { width: 17px; height: 17px; stroke-width: 1.5; }
.cell-outline.cell-sm .icon { width: 19px; height: 19px; stroke-width: 1.5; }
.cell-outline .cell-cap { background: none; }

.mark {
  position: relative;
  display: inline-block;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--solid);
  overflow: hidden;
}
.mark::before { content: ""; position: absolute; inset: 0 0 auto; height: 30%; background: var(--solid-2); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { width: 48px; height: 48px; border-radius: 4px; background: var(--solid); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 6px 18px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--solid); color: var(--on-solid); }
.btn-primary:active { background: var(--solid-2); }
.btn-call:active::before { background: var(--rule-2); }
.btn-secondary { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.btn-secondary:active, .btn-wa:active::before { background: var(--tint); }
.btn-quiet { color: var(--ink); text-decoration: underline; }
.btn-danger { background: var(--solid); color: var(--on-solid); }
.btn-danger-quiet { border-color: var(--ink); color: var(--ink); }
.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
}
.icon-btn:active { background: var(--tint); }

/* Shell: top bar, drawer, view */
.view { max-width: 520px; margin: 0 auto; min-height: 100dvh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 8px 0 4px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-2);
}
.topbar-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title:first-child { padding-left: 12px; }
.topbar-mandal { padding-left: 8px; }
.topbar-mark { display: grid; place-items: center; flex: none; width: 48px; height: 48px; }
.topbar-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
}
.topbar-switch:active, .switcher-open .topbar-switch { background: var(--tint); }
.topbar-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-switch .icon.chevron { color: var(--ink); }
.topbar:has(+ .tabs) { border-bottom: 0; }

/* Sector tabs: they scroll sideways; the selected one is the solid member
   of the set, as a pressed chip is. */
.tabs {
  position: sticky;
  top: calc(56px + var(--safe-top));
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 2px 12px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-2);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  isolation: isolate;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
}
.tab::before { content: ""; position: absolute; inset: 4px 0; z-index: -1; border: 1px solid transparent; border-radius: 999px; }
.tab:active::before { background: var(--tint); }
.tab[aria-current] { color: var(--ink); font-weight: 600; }
.tab[aria-current]::before { border-color: var(--rule); background: var(--tint); }
.tab[aria-current]:active::before { background: var(--rule-2); }
.tab:focus-visible { outline-offset: -3px; }

.strip { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 14px; line-height: 1.5; }
.strip-offline { background: var(--paper-2); color: var(--ink-2); }
.strip-update { background: var(--tint); color: var(--ink); }
.strip-update .strip-text { flex: 1; }
.strip-update .strip-btn { border-width: 1px; border-color: var(--rule); border-radius: 999px; font-weight: 600; }
.strip-warn { background: var(--solid); color: var(--on-solid); font-weight: 700; }
.strip-text { flex: 1; }
.strip-btn { flex: none; min-height: 44px; padding: 0 12px; border: 1.5px solid currentColor; border-radius: 6px; background: none; color: inherit; font-weight: 700; }
.strip-preview { justify-content: center; padding: 4px 16px; background: var(--solid); color: var(--on-solid); font-size: 13px; font-weight: 700; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 19;
  padding: 0;
  border: 0;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}
.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: min(86vw, 320px);
  padding-top: var(--safe-top);
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.22s var(--ease), visibility 0s 0.22s;
}
.drawer-open .scrim { opacity: 1; pointer-events: auto; }
.drawer-open .drawer { transform: none; visibility: visible; transition-delay: 0s; }
.switcher-open .scrim { opacity: 1; pointer-events: auto; }

/* The mandal switcher drops from the top bar over the scrim. */
.switcher {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  max-width: 520px;
  max-height: 100dvh;
  margin: 0 auto;
  padding: var(--safe-top) 16px 8px;
  overflow-y: auto;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.22s var(--ease), visibility 0s 0.22s;
}
.switcher-open .switcher { transform: none; visibility: visible; transition-delay: 0s; }
.switcher-head { display: flex; align-items: center; justify-content: space-between; height: 56px; margin-right: -8px; }
.switcher-title { font-size: 16px; font-weight: 700; line-height: 1.5; }
.mandal-list { border-top: 1px solid var(--rule); }
.switcher .row { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.switcher .row[aria-current] { background: var(--tint); }
.switcher .row[aria-current] .row-title { font-weight: 700; }
.switcher .row[aria-current] .icon.chevron { color: var(--ink); }
.switcher li:last-child .row { border-bottom: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 4px 0 16px; }
.drawer-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 16px; }
.drawer-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 15px;
  text-decoration: none;
}
.drawer-search .icon { width: 20px; height: 20px; color: var(--ink-2); }
.drawer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
}
.drawer-row > .icon, .drawer-row > .mark { margin: 0 6px; }
.drawer-row:active { background: var(--tint); }
.drawer-row[aria-current="page"] { background: var(--tint); font-weight: 700; }
.drawer-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-title { margin: 20px 8px 4px; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.drawer-hint { margin: 0 8px; color: var(--ink-2); font-size: 14px; }
.side-sector { margin-top: 4px; }
.side-main { flex: 1; min-width: 0; display: grid; }
.side-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-meta { color: var(--ink-2); font-size: 13px; font-weight: 400; }
.side-groups { margin-top: 8px; border-top: 1px solid var(--rule); }
.side-group { padding: 6px 0; }
.side-group + .side-group { border-top: 1px solid var(--rule-2); }
.side-gaon { font-weight: 700; }
.side-booths { padding-left: 20px; }
.side-booth { font-weight: 500; }
.side-label { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.side-group > .drawer-title { margin: 10px 8px 2px; }
.drawer-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 16px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.drawer-foot:active, .drawer-foot[aria-current="page"] { background: var(--tint); }
.avatar { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: var(--tint); color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1; }
.foot-main { flex: 1; min-width: 0; display: grid; }
.foot-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-sub { color: var(--ink-2); font-size: 13px; }

/* Pages */
.page { padding: 0 16px calc(40px + var(--safe-bottom)); }
.page.enter { animation: enter 0.18s var(--ease); }
@keyframes enter { from { opacity: 0.4; transform: translateY(6px); } }

.finder .search { padding-top: 12px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 2px 0 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
}
.search-box .search-icon { width: 20px; height: 20px; color: var(--ink-2); }
.search-box:focus-within { border-color: var(--ink-2); }
.search-input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; font-size: 16px; }
.recent ul { display: grid; }
.recent-row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 8px; border-radius: 8px; color: var(--ink); font-size: 15px; text-decoration: none; }
.recent-row:active { background: var(--tint); }
.recent-row .icon { color: var(--ink-2); }
.recent-q { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.finder-recent { margin-top: 12px; }
/* The mandal's own lists in the sidebar: one slim box, a row per list, its count as a pill. */
.info-mandals { display: grid; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); overflow: hidden; }
.info-mandal + .info-mandal { border-top: 1px solid var(--rule-2); }
.info-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 4px 10px; border: 0; background: none; color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; }
.info-head:active { background: var(--tint); }
.info-head .icon { color: var(--ink-2); }
.info-mandal.open .info-head { border-bottom: 1px solid var(--rule-2); }
.info-lists { display: grid; background: var(--paper-2); }
.info-lists li + li { border-top: 1px solid var(--rule-2); }
.info-lists .info-row { padding-left: 18px; font-size: 14px; }
.info-row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 10px; color: var(--ink); font-size: 15px; text-decoration: none; }
.info-row:active, .info-row[aria-current="page"] { background: var(--tint); }
.info-row[aria-current="page"] .info-label { font-weight: 700; }
.info-row .icon { color: var(--ink-2); }
.info-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.info-n { min-width: 28px; padding: 0 8px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-2); font-size: 13px; line-height: 22px; text-align: center; }
.finder-recent .drawer-title { margin-left: 8px; }
.search-input::placeholder { color: var(--ink-2); opacity: 1; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 6px; background: none; }

.block { margin-top: 24px; }
.block-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 4px;
  border-top: 3px solid var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}
.block-count { color: var(--ink-2); font-size: 14px; font-weight: 600; }
h3.block-title { border-top-width: 2px; font-size: 15px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-2);
  color: var(--ink);
  text-decoration: none;
}
.block > .list { border-top: 1px solid var(--rule); }
.outline { margin-top: 20px; border-top: 1px solid var(--rule); }
.outline-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 12px; padding: 6px 0; border-bottom: 1px solid var(--rule-2); }
.outline-gaon { flex: 1 1 140px; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.outline-gaon:active { background: var(--tint); }
.outline-title { flex: 1 1 140px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.outline-nos { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 2px; }
/* Booth numbers on the sector page: slim outlined pills, the grade a small
   letter after the number. The link around each keeps a full-size tap area. */
.outline-nos .cell-link { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
.outline-nos .cell, .outline-nos .cell.graded { display: inline-flex; align-items: baseline; justify-content: center; gap: 3px; width: auto; min-width: 38px; height: 28px; padding: 0 9px; border-radius: 999px; background: none; font-size: 14px; font-weight: 600; line-height: 26px; }
.outline-nos .cell-cat { position: static; width: auto; height: auto; border: 0; border-radius: 0; background: none; color: var(--ink-2); font-size: 10px; font-weight: 700; }
.outline-nos .cell-link:active .cell { background: var(--tint); }
.row:active { background: var(--tint); }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-title { font-size: 16px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; text-wrap: balance; }
.row-meta { color: var(--ink-2); font-size: 14px; line-height: 1.5; }


.empty { padding: 40px 0 8px; color: var(--ink-2); }
.empty-title { margin-bottom: 4px; color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1.5; }
.empty .btn { margin-top: 20px; }

.pending { padding: 32px 0 8px; color: var(--ink-2); }
.pending .progress { margin: 16px 0; }
.pending .btn { margin-top: 20px; }
.chooser-title { padding-top: 20px; font-size: 22px; font-weight: 700; line-height: 1.45; text-wrap: balance; }
.chooser-lead { margin: 4px 0 16px; font-size: 15px; color: var(--ink-2); }
.results-none { margin-top: 24px; color: var(--ink-2); }
.search-note { margin-top: 12px; padding: 10px 14px; border-radius: 6px; background: var(--paper-2); color: var(--ink-2); font-size: 14px; }
.search-note.idle { display: none; }

/* Booth and gaon pages */
.place-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0 10px; }
.place-names { min-width: 0; }
.place-name { font-size: 20px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; text-wrap: balance; }
.place-alt { color: var(--ink-2); font-size: 14px; line-height: 1.45; text-wrap: balance; }
.place-meta { margin-top: 2px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }

.context { border-top: 1px solid var(--rule); }
.ctx-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.ctx-row:active { background: var(--tint); }
.ctx-k { flex: none; width: 56px; color: var(--ink-2); font-size: 14px; }
.ctx-v { flex: 1; min-width: 0; font-weight: 700; line-height: 1.45; }

.booth-strip { padding: 12px 0 14px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.strip-title { margin-bottom: 8px; color: var(--ink-2); font-size: 14px; font-weight: 700; }
.strip-cells { display: flex; flex-wrap: wrap; gap: 8px; }
.cell-link { display: block; border-radius: 4px; text-decoration: none; }
.cell-link:active .cell { background: var(--rule-2); }

.card { padding: 10px 0; border-top: 1px solid var(--rule); }
.card-title { font-size: 16px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.card-pramukh .card-title { font-size: 17px; }
.card-role { color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
.phone { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.phone-no { flex: 1; min-width: 0; color: var(--ink-2); font-size: 15px; white-space: nowrap; user-select: text; }
.phone .btn { position: relative; isolation: isolate; flex: none; width: auto; min-height: 44px; border: 0; background: none; }
.phone .btn::before { content: ""; position: absolute; inset: 4px 0; z-index: -1; border: 1px solid var(--rule); border-radius: 999px; }
.btn-call { gap: 6px; padding: 0 14px 0 11px; color: var(--ink); font-size: 14px; font-weight: 600; }
.btn-call::before { background: var(--tint); }
.btn-call .icon { width: 16px; height: 16px; }
.phone .btn-wa { width: 44px; padding: 0; color: var(--ink); }
.phone .btn-wa::before { inset: 4px; }
.btn-wa .icon { width: 18px; height: 18px; }
.card-body { margin-top: 8px; overflow-wrap: anywhere; }
.card-body.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.more { min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-align: left; }
.card-pramukh .card-body.clamp { -webkit-line-clamp: 2; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.year { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--ink-2); font-size: 13px; }

/* Results: one block per election, a table whose labels wrap and whose
   numbers never do, so long Devanagari names fit 360 px. */
.booth-form { display: grid; gap: 14px; padding-top: 10px; }
.form-heading { font-size: 16px; font-weight: 700; }
.form-facts { display: grid; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); overflow: hidden; }
.form-facts div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-height: 40px; padding: 8px 12px; }
.form-facts div + div { border-top: 1px solid var(--rule-2); }
.form-facts dt { flex: none; color: var(--ink-2); font-size: 14px; }
.form-facts dd { min-width: 0; font-size: 15px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.form-title { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.form-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0; }
/* A 44px tap area around a small pill. */
.pct-toggle { position: relative; isolation: isolate; flex: none; width: 48px; height: 44px; border: 0; background: none; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.pct-toggle::before { content: ""; position: absolute; inset: 8px 4px; z-index: -1; border: 1px solid var(--rule); border-radius: 999px; }
.pct-toggle[aria-pressed="true"] { color: var(--ink); }
.pct-toggle[aria-pressed="true"]::before { background: var(--tint); border-color: var(--ink-2); }
.form-table-wrap { margin-top: -6px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); overflow-x: auto; }
.form-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.4; }
.form-table th, .form-table td { padding: 6px 8px; border-top: 1px solid var(--rule-2); font-weight: 400; text-align: left; white-space: nowrap; }
.form-table thead th { border-top: 0; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.form-table th:first-child { padding-left: 12px; }
.form-table .n { text-align: right; }
.form-table td:last-child, .form-table th:last-child { padding-right: 12px; }
.form-notes { display: grid; gap: 4px; margin-top: -6px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.form-note-k { color: var(--ink); font-weight: 600; }
.form-text { display: grid; gap: 6px; }
.form-text p { padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-text p.muted { color: var(--ink-2); }
.result { padding: 12px 0 14px; border-top: 1px solid var(--rule); }
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font-size: 16px; font-weight: 600; line-height: 1.45; }
.result-year { font-size: 18px; font-weight: 800; }
.result-election { overflow-wrap: anywhere; }
.result-facts { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 2px; color: var(--ink-2); font-size: 14px; }
.result-facts div { display: flex; gap: 6px; }
.result-facts dd { color: var(--ink); font-weight: 700; }
.result-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.result-table th, .result-table td { padding: 8px 0; border-top: 1px solid var(--rule-2); font-weight: 400; text-align: left; vertical-align: top; }
.result-table thead th { padding: 0 0 4px; border-top: 0; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.result-table .n { width: 1%; padding-left: 14px; text-align: right; white-space: nowrap; }
.result-table tbody th { overflow-wrap: anywhere; }
.result-table .lead th, .result-table .lead td { font-weight: 800; }
.bar { display: block; width: var(--w); height: 4px; margin-top: 6px; border-radius: 2px; background: var(--ink-2); }
.older > summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  list-style: none;
  cursor: pointer;
}
.older > summary::-webkit-details-marker { display: none; }
.block-note { margin: 2px 0 8px; color: var(--ink-2); font-size: 14px; }
.card-result .result { padding-top: 0; border-top: 0; }

/* The gaon's cards on a booth page sit on their own tinted ground, so they
   cannot be mistaken for the booth's. */
.band { margin: 32px -16px 0; padding: 16px 16px 4px; background: var(--paper-2); }
.band-title { font-size: 16px; font-weight: 700; line-height: 1.5; }
.band-note { margin-top: 2px; color: var(--ink-2); font-size: 14px; }
.band .block { margin-top: 16px; }
.band-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin-top: 16px; border-top: 1px solid var(--rule); font-weight: 700; }
.tab-body > .band:first-child { margin-top: 12px; }

.group { margin-top: 4px; }
.group-head { display: flex; align-items: center; gap: 10px; min-height: 52px; margin: 0 -16px; padding: 8px 16px; background: var(--paper-2); color: var(--ink); font-weight: 700; line-height: 1.45; text-decoration: none; }
.group-name { flex: 1; min-width: 0; }
.group .card:first-child { border-top: 0; }

.context + .block { margin-top: 20px; }
.band-other { margin-top: 32px; }


/* Booth and gaon pages: one part at a time, picked from a bar fixed to the
   bottom. The selected tab's icon sits in a tinted pill, as the selected
   sector tab does at the top. */
.page.has-ptabs { padding-bottom: calc(48px + var(--ptabs-h) + var(--safe-bottom)); }
.place-tabs {
  position: fixed;
  inset: auto 0 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 520px;
  min-height: calc(var(--ptabs-h) + var(--safe-bottom));
  margin: 0 auto;
  padding: 2px 4px var(--safe-bottom);
  background: var(--paper);
  border-top: 1px solid var(--rule-2);
}
.ptab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  min-height: 56px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  line-height: var(--lh);
  text-decoration: none;
}
.ptab-icon { display: grid; place-items: center; width: 52px; height: 28px; border: 1px solid transparent; border-radius: 999px; }
.ptab-icon .icon { width: 20px; height: 20px; }
.ptab-label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ptab-n { color: var(--ink-2); font-weight: 500; }
.ptab:active .ptab-icon { background: var(--tint); }
.ptab[aria-current] { color: var(--ink); font-weight: 600; }
.ptab[aria-current] .ptab-icon { border-color: var(--rule); background: var(--tint); }
.ptab:focus-visible { outline-offset: -3px; }
.tab-body { padding-top: 4px; }
.tab-section > .cards > .card:first-child, .tab-section > .result-list > .result:first-child { border-top-color: var(--rule-2); }
.tab-section .block-note { margin-top: 12px; }
.quiet { padding: 20px 0 8px; color: var(--ink-2); font-size: 15px; }

/* Notes: a slim composer over the place's notes, newest first. */
.composer { padding: 14px 0 6px; }
.composer-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; margin-bottom: 6px; }
.composer-label { font-size: 15px; font-weight: 700; }
.composer-shared { color: var(--ink-2); font-size: 13px; }
.note-input {
  display: block;
  width: 100%;
  min-height: 104px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: var(--lh);
  resize: vertical;
}
.note-input::placeholder { color: var(--ink-2); opacity: 1; }
.note-input:focus { outline: 0; border-color: var(--ink-2); }
.note-input:disabled { background: var(--paper-2); }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.pill .icon { width: 18px; height: 18px; }
.pill:active, .pill-tint { background: var(--tint); }
.pill-tint:active { background: var(--rule-2); }
.pill-on { border-color: var(--ink-2); background: var(--tint); }
.pill:disabled { opacity: 0.55; cursor: default; }
.note-save { margin-left: auto; }
.note-status { display: grid; gap: 4px; margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.note-status:empty { display: none; }
.listening { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.rec-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--ink); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: 0.25; } }
.note-list { margin-top: 10px; border-top: 1px solid var(--rule); }
.note-item { padding: 12px 0 10px; border-bottom: 1px solid var(--rule-2); }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 4px; color: var(--ink-2); font-size: 13px; }
.note-author { color: var(--ink); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 1px solid var(--rule); border-radius: 999px; font-size: 12px; line-height: 20px; }
.tag-wait { background: var(--tint); color: var(--ink); }
.note-foot { display: flex; justify-content: flex-end; margin: -6px -8px -8px 0; }
.quiet-btn { display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.quiet-btn:active { background: var(--tint); }
.note-confirm { display: grid; gap: 8px; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-2); font-size: 15px; }
.note-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Settings */
.setting { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--rule-2); }
.setting:last-child { border-bottom: 0; }
.setting-label { color: var(--ink-2); font-size: 14px; font-weight: 700; }
.setting-value { font-size: 16px; font-weight: 600; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.segmented button { min-height: 44px; padding: 4px 6px; border: 0; background: none; color: var(--ink-2); font-size: 15px; font-weight: 500; line-height: 1.4; }
.segmented button + button { border-left: 1px solid var(--rule); }
.segmented button[aria-pressed="true"] { background: var(--tint); color: var(--ink); font-weight: 600; }
.drawer-lang { margin-top: 12px; padding: 0 8px; }
.drawer-lang .drawer-title { margin: 12px 0 8px; }
.segmented button:focus-visible { outline-offset: -5px; }
.confirm { display: grid; gap: 12px; padding: 16px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper-2); }
.confirm-actions { display: grid; gap: 8px; }
.note { color: var(--ink-2); font-size: 14px; }
.note.strong { padding: 12px 14px; border-radius: 6px; background: var(--paper-2); color: var(--ink); font-size: 15px; font-weight: 600; }

/* Before the data: install, register, wait, code, locked, ended */
.sheet { display: flex; flex-direction: column; max-width: 520px; min-height: 100dvh; margin: 0 auto; padding-top: var(--safe-top); }
.brand-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--rule-2); }
.lang-switch { flex: none; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper); font-size: 14px; font-weight: 700; }
.sheet-body { flex: 1; padding: 24px 16px 24px; }
.sheet-icon { position: relative; display: grid; place-items: center; width: 56px; height: 56px; padding-top: 12px; border-radius: 4px; background: var(--solid); color: var(--on-solid); overflow: hidden; }
.sheet-icon::before { content: ""; position: absolute; inset: 0 0 auto; height: 12px; background: var(--solid-2); }
.sheet-icon .icon { width: 24px; height: 24px; }
/* A warning is the outlined cell; an ending is the filled one with its icon. */
.sheet-icon.warn { border: 2px solid var(--ink); background: var(--paper); color: var(--ink); }
.sheet-icon.warn::before { inset: -2px -2px auto; background: var(--ink); }
.sheet-title { font-size: 22px; font-weight: 700; line-height: 1.45; text-wrap: balance; }
.sheet-icon + .sheet-title { margin-top: 16px; }
.lead { margin-top: 6px; font-size: 16px; }
.body-text { margin-top: 12px; color: var(--ink-2); }
.sheet-body > .note { margin-top: 16px; }
.sheet-actions { display: grid; gap: 8px; padding: 12px 16px calc(16px + var(--safe-bottom)); background: var(--paper); }

.field { margin-top: 20px; }
.field label { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 700; }
.field input { width: 100%; height: 56px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); font-size: 18px; }
.field input[aria-invalid="true"] { border-width: 4px; }
.field .code-input { height: 64px; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.3em; text-align: center; }
.hint { margin-top: 6px; color: var(--ink-2); font-size: 14px; }
.field-error { margin-top: 6px; color: var(--ink); font-size: 15px; font-weight: 700; }
.form-error { margin-top: 20px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper-2); color: var(--ink); font-weight: 700; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; margin-top: 24px; border-top: 3px solid var(--ink); }
.facts dt, .facts dd { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-2); font-size: 14px; align-self: stretch; display: flex; align-items: center; }
.facts dd { font-size: 16px; font-weight: 700; }

.steps-title { margin-top: 24px; padding: 8px 0 4px; border-top: 3px solid var(--ink); font-size: 16px; font-weight: 700; }
.step { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--rule); }
/* Round, so a step number cannot be read as a booth cell. */
.step-n { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 2px solid var(--ink); border-radius: 50%; font-weight: 700; line-height: 1; }
.step-main { flex: 1; min-width: 0; }
.drawing { margin-top: 10px; padding: 10px; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--paper-2); color: var(--ink-2); }
.d-bar { display: flex; align-items: center; justify-content: space-around; }
.d-top { justify-content: space-between; }
.d-glyph { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; }
.d-hit { background: var(--solid); color: var(--on-solid); }
.d-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 8px; border-radius: 6px; }
.d-line { height: 8px; border-radius: 4px; background: var(--rule); }
.w30 { width: 30%; }
.w40 { width: 40%; }
.w60 { width: 60%; }
.d-label { font-size: 14px; font-weight: 700; }
.d-pill { padding: 4px 14px; border-radius: 6px; font-size: 14px; font-weight: 700; }

.progress { position: relative; height: 4px; margin-top: 24px; background: var(--rule-2); overflow: hidden; }
.progress::after { content: ""; position: absolute; inset: 0 60% 0 0; background: var(--ink); animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { to { inset: 0 0 0 60%; } }

@media (prefers-reduced-motion: reduce) {
  .drawer, .switcher, .scrim { transition: none; }
  .page.enter { animation: none; }
  .progress::after, .rec-dot { animation: none; }
}
