/*
 * Lead Finder: black, one neon accent, one typeface.
 *
 * Pico supplies the element styles; everything below re-tokens it and adds
 * the few components it lacks. No inline styles anywhere: the CSP forbids them.
 * The neon is spent in few places -- focus, active filters, the score meter --
 * so it keeps meaning "this is live / this matters".
 */

@font-face {
  font-family: 'Archivo';
  src: url(/assets/archivo.woff2) format('woff2-variations');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

/* ------------------------------------------------------------ tokens */
/* :root[data-theme=dark] outranks Pico's own dark selectors. */
:root[data-theme=dark] {
  --ink: #000000;
  --panel: #0a0d0a;
  --panel-2: #111611;
  --line: #1c261c;
  --line-strong: #2c3a2c;
  --text: #e4ebe4;
  --muted: #7f8c7f;
  --neon: #39ff14;
  --neon-dim: rgba(57, 255, 20, 0.14);
  --neon-line: rgba(57, 255, 20, 0.45);
  --amber: #f5c542;
  --red: #ff4d6d;

  --pico-font-family: 'Archivo', system-ui, 'Segoe UI', 'Noto Sans Devanagari', sans-serif;
  /* The root follows the browser's setting (16px by default) -- never a px
     value, which would override a reader who asked for larger text. This also
     switches off Pico's width-based scaling (up to 131% on wide screens).
     Every size on the page is one of these four. */
  --pico-font-size: 100%;
  --fs-sm: 0.875rem;   /* 14px: labels, table text, badges, chips */
  --fs-base: 1rem;     /* 16px: body, and every form field (smaller zooms iOS on focus) */
  --fs-lg: 1.125rem;   /* 18px: section headings, brand, result count */
  --fs-xl: 1.25rem;    /* 20px: page titles */
  --pico-line-height: 1.45;
  --pico-border-radius: 6px;
  --pico-spacing: 0.9rem;
  --pico-typography-spacing-vertical: 0.9rem;

  --pico-background-color: var(--ink);
  --pico-color: var(--text);
  --pico-muted-color: var(--muted);
  --pico-muted-border-color: var(--line);
  --pico-h1-color: var(--text);
  --pico-h2-color: var(--text);
  --pico-h3-color: var(--text);

  --pico-primary: var(--neon);
  --pico-primary-background: var(--neon);
  --pico-primary-border: var(--neon);
  --pico-primary-underline: var(--neon-line);
  --pico-primary-hover: #7dff5e;
  --pico-primary-hover-background: #7dff5e;
  --pico-primary-hover-border: #7dff5e;
  --pico-primary-hover-underline: var(--neon);
  --pico-primary-focus: var(--neon-dim);
  --pico-primary-inverse: #000;

  --pico-secondary: var(--muted);
  --pico-secondary-background: var(--panel-2);
  --pico-secondary-border: var(--line-strong);
  --pico-secondary-hover: var(--text);
  --pico-secondary-hover-background: var(--line);
  --pico-secondary-hover-border: var(--muted);
  --pico-secondary-inverse: var(--text);

  --pico-card-background-color: var(--panel);
  --pico-card-sectioning-background-color: var(--panel-2);
  --pico-card-box-shadow: none;

  --pico-form-element-background-color: var(--ink);
  --pico-form-element-selected-background-color: var(--panel-2);
  --pico-form-element-border-color: var(--line-strong);
  --pico-form-element-color: var(--text);
  --pico-form-element-placeholder-color: #56615a;
  --pico-form-element-active-background-color: var(--ink);
  --pico-form-element-active-border-color: var(--neon);
  --pico-form-element-focus-color: var(--neon-dim);
  --pico-form-element-spacing-vertical: 0.45rem;
  --pico-form-element-spacing-horizontal: 0.7rem;

  --pico-table-border-color: var(--line);
  --pico-table-row-stripped-background-color: #060806;
  --pico-code-background-color: var(--panel);
  --pico-dropdown-background-color: var(--panel-2);
  --pico-switch-background-color: var(--line-strong);
  --pico-switch-checked-background-color: var(--neon);
  --pico-switch-color: #000;
  color-scheme: dark;
}

html, body { background: var(--ink); }
body { font-stretch: 100%; font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }

a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
h2 { font-size: var(--fs-xl); font-weight: 700; font-stretch: 85%; letter-spacing: -0.01em; margin-bottom: 0.4rem; }
h3 { font-size: var(--fs-lg); font-weight: 650; margin: 1.8rem 0 0.6rem; }

.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.error { color: var(--red); }

/* ------------------------------------------------------------- top bar */
.topbar { border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; background: var(--ink); position: sticky; top: 0; z-index: 5; }
.topbar nav { display: flex; align-items: center; justify-content: space-between; min-height: 3.4rem; gap: 1rem; }
.topbar ul { display: flex; align-items: center; gap: 0.2rem; margin: 0; padding: 0; }
.topbar li { list-style: none; padding: 0; }
.topbar li a { display: block; padding: 0.4rem 0.75rem; color: var(--muted); text-decoration: none; border-radius: 4px; }
.topbar li a:hover { color: var(--text); }
.topbar li a.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--neon); border-radius: 0; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none;
         font-weight: 800; font-stretch: 80%; font-size: var(--fs-lg); letter-spacing: -0.01em; }
.brand-mark { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--neon); box-shadow: 0 0 10px var(--neon); }

button.ghost, a.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--muted);
  padding: 0.35rem 0.8rem; font-size: var(--fs-sm); width: auto; margin: 0; }
button.ghost:hover, a.ghost:hover { color: var(--text); border-color: var(--muted); }

.foot { color: var(--muted); font-size: var(--fs-sm); padding-top: 2rem; padding-bottom: 2rem; }

/* -------------------------------------------------------------- filters */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1.5rem; margin-bottom: 1rem; }
.page-head p { margin: 0; color: var(--muted); font-size: var(--fs-sm); max-width: 70ch; }

.filters { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.filters label { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 0; }
.filters input:not([type=checkbox]), .filters select { margin: 0.25rem 0 0; height: 2.35rem; font-size: var(--fs-base); }

/* The first row: what people filter by most, always in view. */
.quick { display: grid; grid-template-columns: minmax(16rem, 2.4fr) minmax(9rem, 1fr) auto auto; gap: 0.75rem; align-items: end; }

/* Tier as a segmented control: three checkboxes in a row. */
.segmented { display: flex; width: fit-content; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; margin-top: 0.25rem; height: 2.35rem; }
.segmented label { margin: 0; display: flex; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: flex; align-items: center; padding: 0 0.85rem; cursor: pointer; color: var(--muted);
  font-weight: 650; font-size: var(--fs-sm); border-right: 1px solid var(--line-strong); user-select: none; }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--neon-dim); color: var(--neon); }
.segmented input:focus-visible + span { outline: 2px solid var(--neon); outline-offset: -2px; }

.toggle { display: flex; align-items: center; gap: 0.5rem; height: 2.35rem; margin-top: 0.25rem; white-space: nowrap;
  font-size: var(--fs-sm) !important; color: var(--text) !important; }
.toggle input { margin: 0; }
.field-label { display: block; font-size: var(--fs-sm); color: var(--muted); }

/* More filters: four named groups. */
.more { margin: 0.9rem 0 0; border-top: 1px solid var(--line); padding-top: 0.2rem; }
.more > summary { color: var(--muted); font-size: var(--fs-sm); padding: 0.5rem 0; list-style: none; cursor: pointer; }
.more > summary::after { display: none; }
.more > summary::before { content: '+'; display: inline-block; width: 1.1rem; color: var(--neon); font-weight: 700; }
.more[open] > summary::before { content: '−'; }
.more > summary:hover { color: var(--text); }
.more .count { color: var(--neon); }
.groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem 1.5rem; padding-top: 0.4rem; }
.group { display: grid; gap: 0.6rem; align-content: start; border: 0; padding: 0; margin: 0; }
.group legend { font-size: var(--fs-sm); font-weight: 650; color: var(--text); padding: 0 0 0.1rem; margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--line); width: 100%; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

/* Applied filters, each removable. */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.9rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; width: auto; padding: 0.2rem 0.3rem 0.2rem 0.65rem;
  border-radius: 999px; background: var(--neon-dim); border: 1px solid var(--neon-line); color: var(--text); font-size: var(--fs-sm); line-height: 1.4; }
.chip b { font-weight: 600; color: var(--neon); }
.chip .x { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; color: var(--muted); }
.chip:hover .x { background: var(--neon); color: #000; }
.chips .clear { background: none; border: 0; padding: 0.2rem 0.4rem; margin: 0; width: auto; color: var(--muted);
  font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 3px; }
.chips .clear:hover { color: var(--text); }

/* ------------------------------------------------------ results toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0 0 0.6rem; }
.toolbar .total { font-weight: 700; font-stretch: 88%; font-size: var(--fs-lg); margin-right: auto; }
.toolbar .total span { color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
.toolbar label { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.toolbar select { margin: 0; height: 2.1rem; padding-top: 0.2rem; padding-bottom: 0.2rem; font-size: var(--fs-base); width: auto; }
.toolbar button, .toolbar a[role=button] { margin: 0; width: auto; padding: 0.4rem 0.9rem; font-size: var(--fs-sm); }
a.export { font-weight: 650; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.8rem; }
.table-wrap table { margin: 0; font-size: var(--fs-sm); }
.table-wrap th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 600;
  font-size: var(--fs-sm); font-stretch: 88%; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
.table-wrap td, .table-wrap th { padding: 0.5rem 0.7rem; vertical-align: top; }
.table-wrap tbody tr:hover td { background: #0d140d; }
td.num, th.num { text-align: right; white-space: nowrap; }
.name-cell { display: block; min-width: 14rem; max-width: 28rem; }
.name-cell a:first-child { color: var(--text); font-weight: 400; text-decoration: none; }
.name-cell a:first-child:hover { color: var(--neon); }
.maps { margin-left: 0.4rem; font-size: var(--fs-sm); color: var(--muted); }
.nowrap { white-space: nowrap; }

/* The score meter: the one place the page glows. */
.score { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.meter { width: 3.2rem; height: 4px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--neon); box-shadow: 0 0 8px var(--neon); }
.meter i.w0 { width: 0 } .meter i.w1 { width: 10% } .meter i.w2 { width: 20% } .meter i.w3 { width: 30% } .meter i.w4 { width: 40% }
.meter i.w5 { width: 50% } .meter i.w6 { width: 60% } .meter i.w7 { width: 70% } .meter i.w8 { width: 80% } .meter i.w9 { width: 90% } .meter i.w10 { width: 100% }
.score.low .meter i { background: var(--muted); box-shadow: none; }

.badge { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 4px; font-size: var(--fs-sm); font-weight: 400;
  border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.tier-A { color: var(--neon); border-color: var(--neon-line); }
.tier-B { color: var(--amber); border-color: rgba(245, 197, 66, 0.45); }
.tier-C { color: var(--muted); }
.warn { color: var(--red); border-color: rgba(255, 77, 109, 0.5); }
/* Seen advertising on Maps: a priority call (owner, 17 Oct 2026), so the accent. */
.badge.ad { color: var(--neon); border-color: var(--neon-line); }

.pager { display: flex; gap: 0.6rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); }
.pager button { width: auto; margin: 0; padding: 0.35rem 0.8rem; font-size: var(--fs-sm); }

/* ------------------------------------------------------- tabs, detail */
.tabs { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.tabs button { width: auto; margin: 0; background: none; border: 0; border-radius: 0; color: var(--muted);
  padding: 0.55rem 0.9rem; font-size: var(--fs-base); }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected=true] { color: var(--text); box-shadow: inset 0 -2px 0 var(--neon); }
.view-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 0.8rem; }
.view-filters label { font-size: var(--fs-sm); color: var(--muted); margin: 0; }
.view-filters input, .view-filters select { margin: 0.25rem 0 0; height: 2.2rem; width: 12rem; }

.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 1rem; }
.detail-head h2 { margin: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.4rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; }
dl.facts dt { color: var(--muted); font-size: var(--fs-sm); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
pre.raw { max-height: 30rem; overflow: auto; font-size: var(--fs-sm); white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); }
/* The UI's only write path (invariant 21, docs/ui.md) -- a left border marks
   it as the one place on this page that changes something. */
section.override { border-left: 3px solid var(--neon); padding-left: 1rem; margin: 1.2rem 0; }
section.override h3 { margin-top: 0; }
section.override textarea { max-width: 32rem; }
section.override button { margin-top: 0.4rem; }
.back { font-size: var(--fs-sm); color: var(--muted); text-decoration: none; }
.back:hover { color: var(--neon); }

/* ----------------------------------------------------------------- login */
.login { max-width: 24rem; margin: 5rem auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; }
.login h2 { margin-bottom: 1.4rem; }
.login button { width: 100%; font-weight: 700; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem 1.5rem; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 1rem; }
  .quick { grid-template-columns: 1fr 1fr; }
  .quick .search { grid-column: 1 / -1; }
  .groups { grid-template-columns: 1fr; }
  .topbar nav { flex-wrap: wrap; padding: 0.4rem 0; }
  .topbar ul { flex-wrap: wrap; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dd { margin-bottom: 0.4rem; }
  .toolbar .total { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* "Mumbai search" under a Thane place: which grid found it, when not its own city. */
.via { display: block; color: var(--muted); font-size: var(--fs-sm); }

/* ------------------------------------- sort and column conditions (14 Oct 2026) */
/* A header that sorts is a button that looks like its header. */
.table-wrap th button.sort { display: inline-flex; align-items: center; gap: 0.35rem; width: auto; margin: 0; padding: 0;
  background: none; border: 0; box-shadow: none; color: inherit; font: inherit; font-stretch: inherit; cursor: pointer; white-space: nowrap; }
.table-wrap th button.sort:hover { color: var(--text); }
.table-wrap th button.sort .mark { font-size: 0.75em; color: var(--line-strong); }
.table-wrap th button.sort:hover .mark { color: var(--muted); }
.table-wrap th button.sort.on, .table-wrap th button.sort.on .mark { color: var(--neon); }
.table-wrap th .sort:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; }

/* The condition rows: column, condition, value. */
.cond-bar { margin: 0 0 0.8rem; }
.conds { display: grid; gap: 0.5rem; }
.cond { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.cond select, .cond input[type=text], .cond input[type=number], .cond input[type=date] {
  margin: 0; height: 2.2rem; padding-top: 0.2rem; padding-bottom: 0.2rem; width: auto; font-size: var(--fs-base); }
.cond input[type=text], .cond input[type=number] { min-width: 10rem; }
.cond .pair { display: inline-flex; grid-template-columns: none; align-items: center; gap: 0.5rem; }
.cond .picks { display: inline-flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; }
.cond .picks label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; font-size: var(--fs-sm); }
.cond .picks input { margin: 0; }
.cond button.remove { width: 2.2rem; height: 2.2rem; margin: 0; padding: 0; font-size: var(--fs-lg); line-height: 1; }
.cond-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.5rem; }
.cond-actions button { width: auto; margin: 0; padding: 0.35rem 0.8rem; font-size: var(--fs-sm); }
.cond-actions .clear { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.cond-actions .clear:hover { color: var(--text); }
.cond-actions [hidden] { display: none; }
.data-grid { margin-bottom: 1rem; }
@media (max-width: 720px) {
  .cond select, .cond input[type=text], .cond input[type=number] { flex: 1 1 8rem; }
}
