/* Leads Platform — web tier visual identity (T48; T151 overhaul).
   T151: the palette + type system move to the admin-analytics prototype's
   contract (design/prototypes/admin-analytics.html): light-first neutral
   surfaces, indigo accent, dark mode via [data-theme="dark"] custom
   properties, sans body at 0.875rem, 11px caps table headers, tabular
   numerals. JetBrains Mono stays self-hosted for mono accents.
   Re-brand surface: every color/font/border is a custom property below —
   change the brand by editing :root + [data-theme] (plus BrandName in
   internal/web/web.go). No JS beyond the theme toggle; no external
   requests: fonts self-hosted (static/fonts/, SIL OFL 1.1 — see
   static/fonts/OFL.txt). */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* brand tokens — the re-brand surface (T151: prototype palette, light) */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --hairline: #e3e6ec;
  --hairline-2: #eef0f4;
  --text: #191e27;    /* primary text: AAA on --bg and --surface */
  --muted: #575f70;   /* secondary text: AA in both themes */
  --faint: #8a93a3;
  --accent: #4338ca;
  --accent-2: #eceafd; /* accent-soft (prototype --accent-soft) */
  --btn-border: var(--hairline);
  --danger: #b42318;
  --ok: #0a7d4b;
  --shadow: 0 6px 24px rgba(20,24,40,.07);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-body: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-w: 1100px;   /* fluid: --max-w grows with the viewport (media bands below) */
}

/* T151 dark mode — the prototype's [data-theme="dark"] block verbatim. */
[data-theme="dark"] {
  --bg: #121419;
  --surface: #1a1e26;
  --surface-2: #232833;
  --hairline: #2b313c;
  --hairline-2: #232833;
  --text: #e8ebf1;
  --muted: #a5aebd;
  --faint: #6d7686;
  --accent: #8b93ff;   /* lighter indigo for dark contrast */
  --accent-2: #252a3d;
  --danger: #ff7d6e;
  --ok: #3ecf8e;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 .875rem/1.55 var(--font-body);  /* T151 type system: 14px base */
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }

/* T151 theme toggle (nav, every user) */
.theme-toggle {
  min-width: 44px; min-height: 36px;
  border: 1px solid var(--btn-border); border-radius: 8px;
  background: var(--surface); color: var(--muted);
  font: inherit; cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ---- kicker / label style ------------------------------------------------ */
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent);
}

h1 {
  font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.15;
  margin: .2rem 0 1rem;
}
h2 {
  font-size: clamp(1.25rem, 1.05rem + .8vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.2;
  margin: .2rem 0 .7rem;
}
h2::before {
  content: "";
  display: inline-block;
  width: 10px; height: 2px;
  background: var(--accent-2);
  margin-right: .55rem;
  vertical-align: middle;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }
p { max-width: 72ch; }
code { font-family: var(--font-mono); font-size: .92em; color: var(--accent); }

/* ---- header / brand ------------------------------------------------------ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  padding: .65rem 1rem;
  position: sticky; top: 0; z-index: 10;
}
nav {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em;
  color: var(--text);
}
.brand svg { display: block; }
nav .links { display: flex; gap: .1rem; flex-wrap: wrap; }
nav .links a {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint);
  padding: .3rem .55rem;
  border: 1px solid transparent;
  border-radius: 3px;
}
nav .links a:hover { color: var(--text); }
nav .links a.here { color: var(--accent); border-color: var(--hairline-2); background: var(--surface-2); }
nav .spacer { flex: 1; }
nav .who {
  color: var(--muted); font-size: 12.5px; font-family: var(--font-mono);
}
nav .who strong { color: var(--accent); font-weight: 600; }

/* T156: anonymous nav — brand + links centered as one group (operator
   directive). header is sticky, i.e. positioned, so the theme toggle can
   stay at the right edge without leaving the header box. */
header.anon nav { justify-content: center; }
header.anon nav .spacer { display: none; }
header.anon .theme-toggle {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
}
@media (max-width: 720px) {
  header.anon .theme-toggle { position: static; transform: none; margin-left: .25rem; }
}

/* ---- layout --------------------------------------------------------------- */
main { max-width: var(--max-w); margin: 1.6rem auto 2.5rem; padding: 0 1rem; }
main.tight { margin-bottom: 0; } /* banner sits directly above the page main (CSP: class, not style=) */
footer {
  max-width: var(--max-w); margin: 0 auto 2rem; padding: 0 1rem;
}
.page-head { margin-bottom: 1.2rem; }
.page-head .kicker { display: block; margin-bottom: .3rem; }

/* ---- components ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;      /* T151 type system: prototype card radius */
  padding: .85rem 1rem;     /* T151: tighter card padding */
  margin: 0 0 1rem;
}
.card.narrow { max-width: 460px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
/* T50: grid children default to min-width:auto — a wide table inside a cell
   would force the column past 1fr and blow the grid out of the centered
   container (the /explore overflow main.agent screenshot-verified). Cells
   must be allowed to shrink; .table-wrap then scrolls the content instead. */
.grid > * { min-width: 0; }
.grid .card { margin: 0; border-top: 2px solid var(--accent-2); }

/* callout / note: left cyan rule (compliance, sold-kind, hints, flashes) */
.note {
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 6px 6px 0;
  padding: .7rem 1rem;
  margin: .8rem 0;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 100%;
}
.note strong, .note b { color: var(--text); }
.note.warn { border-left-color: var(--danger); }
.note.ok { border-left-color: var(--ok); }
.note .kicker { display: block; margin-bottom: .15rem; }

.flash { margin: 0 0 1rem; }
.flash.strong { font-weight: 600; color: var(--text); word-break: break-all; }

/* buttons: bordered, not filled */
button, .btn {
  font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  padding: .5rem 1rem;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
form.inline { display: inline; }
form.inline button { margin: 0; padding: .18rem .55rem; font-size: 11px; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover { border-color: var(--danger); }

/* forms */
label { display: block; margin: .6rem 0; font-size: 14px; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: .45rem; margin: .2rem .8rem .2rem 0; }
input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }

/* T54: sector jump collapsed by default; expanded = compact columns */
details.sector-jump { margin: .6rem 0; }
details.sector-jump summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent);
}
details.sector-jump .jump-cols {
  columns: 3; column-gap: 1.5rem;
  margin-top: .5rem;
  font-size: 13.5px;
}
details.sector-jump .jump-cols a {
  display: block; padding: .1rem 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 1024px) { details.sector-jump .jump-cols { columns: 2; } }
@media (max-width: 640px)  { details.sector-jump .jump-cols { columns: 1; } }
input, select {
  width: 100%;
  margin-top: .25rem;
  padding: .5rem .65rem;
  font: 400 14px/1.5 var(--font-mono);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--hairline-2);
  border-radius: 4px;
}
input::placeholder { color: var(--faint); }
input.num { width: 6rem; display: inline-block; margin: 0; }
.hint { color: var(--faint); font-size: 13.5px; }

/* tables: hairline rows, sans data (T151 type system), 11px caps headers,
   tabular numerals — right-aligned in data columns via td.r/th.r + .num */
table {
  border-collapse: collapse;
  width: 100%;
  margin: .8rem 0;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
thead th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--faint);
  text-align: left;
  padding: .4rem .6rem;
  border-bottom: 1px solid var(--hairline-2);
  white-space: nowrap; /* T50: no vertical letter-stacking in narrow cells */
}
tbody td {
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--hairline-2);
  color: var(--text);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
td.actions form { margin-left: .2rem; }
td.eps { white-space: nowrap; }
table { table-layout: auto; }
td.num, td .num { text-align: right; }
table.kv th { width: 11rem; font-weight: 600; }
/* T53: horizontal scrolling exists ONLY in the mobile band. Above 640px
   tables must FIT their container (fluid measure + ellipsis truncation +
   nowrap numerals make that true); a desktop slider is a bug. */
.table-wrap { overflow-x: visible; }
/* T156: the landing's anonymized sample table scrolls INSIDE its card at
   every band — digits stay complete (T73 full-digits contract), but the
   page itself never scrolls horizontally. Data tables elsewhere keep the
   T73 visible-wrap behavior. */
.table-wrap.sample { overflow-x: auto; }
@media (max-width: 640px) {
  .table-wrap { overflow-x: auto; }
  /* the scroll needs somewhere to go: fixed-layout tables keep a min width
     so headers never clip on phones */
  .grid .card table, .table-wrap table { min-width: 480px; }
}
.pos { color: var(--ok); }
.neg { color: var(--danger); }

.tile-row {
  display: flex;
  flex-wrap: wrap;      /* tiles share one row on desktop; the row is wide
                           enough because the measure grows with the viewport */
  gap: .5rem;
  align-items: center;
}

.searchbar {
  display: flex;
  gap: .5rem;
  margin: .4rem 0 .5rem;
  max-width: 540px; /* T58: reads as a search control, not a screen-spanning strip */
}
/* T58: launchpad — heading left, searchbar right; bar drops below on mobile */
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.head-row .page-head { margin-bottom: 0; }
.head-row h2 { margin: 0; } /* T156: replaces dead inline style= (CSP drops it) */

/* T156a (landing only — no global .card change): the chips row centers in
   its card; the How-it-works box shrinks to its text and centers as a
   distinct box instead of spanning full width. The header block stays
   left and the sample table keeps its full-width layout. */
.tile-row.chips-center { justify-content: center; }
.card.how-box {
  width: fit-content;
  max-width: min(100%, 36rem);
  margin-inline: auto;
}
.head-row .searchbar { margin: 0; flex: 0 1 540px; }
@media (max-width: 640px) {
  .head-row { flex-direction: column; align-items: stretch; }
  .head-row .searchbar { flex: none; }
}
.searchbar input {
  flex: 1;
  min-width: 0;
  height: 46px;
  margin: 0;
  font-size: 15px;
}
.searchbar input:focus { border-color: var(--accent); }
.searchbar button { height: 46px; padding: 0 1.3rem; flex-shrink: 0; }
/* T66 gate: the global 'input, select { width: 100% }' beats flex:1 inside
   the flex bar — the mode select rendered ~400px and crushed the input to a
   sliver. Auto width + no shrink: the bar reads [input flex][mode][button]. */
.searchbar select { width: auto; flex-shrink: 0; }
.searchbar + .hint, .searchbar-hint { margin-top: .3rem; }
@media (max-width: 640px) {
  .searchbar { flex-direction: column; }
  .searchbar button { width: 100%; }
}

/* T56: sectors grid — spread across the measure, counts beside names */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .5rem .8rem;
  margin: .8rem 0;
}
.sector-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: .45rem .7rem;
  min-width: 0;
}
.sector-item a {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sector-item .count {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: .05rem .5rem;
  flex-shrink: 0;
}

/* T56: E·P·S hover breakdown — pure CSS tooltip (zero-JS) */
.tip { position: relative; cursor: help; }
.tip::after {
  content: "E emails · P phones · S socials — held per company, revealed only after a metered search";
  position: absolute;
  left: 0; top: calc(100% + 6px);
  z-index: 30;
  width: max-content;
  max-width: 30rem;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: .5rem .8rem;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
  pointer-events: none;
  white-space: normal;
}
.tip:hover::after, .tip:focus-visible::after { opacity: 1; visibility: visible; }

.filters-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem;
  padding: .7rem 1rem;
}
.filters-row label { margin: 0; font-size: 13px; }
.filters-row select { width: auto; margin: 0; padding: .3rem .5rem; font-size: 13px; }
/* T159: the search input joined the filters form (one rectangle) — it takes
   the rectangle's first line in full (placeholder is long; a truncated
   placeholder reads as a broken control), the facets wrap below it. */
.filters-row input[type="text"] {
  width: auto; flex: 1 1 100%; margin: 0; padding: .3rem .5rem; font-size: 13px;
}

/* T66: footer options spread across the bar — brand left, links
   distributed, Compliance Policy right; stacks centered <=640 */
footer.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1.5rem;
  border-top: 1px solid var(--hairline);
  padding: .9rem 1rem;
  color: var(--faint);
  font-size: 13px;
}
footer.site-footer .foot-brand {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
}
footer.site-footer .foot-links { display: inline-flex; gap: 1.4rem; }
footer.site-footer .foot-posture { margin-left: auto; }
@media (max-width: 640px) {
  footer.site-footer { flex-direction: column; justify-content: center; text-align: center; }
  footer.site-footer .foot-posture { margin-left: 0; }
}

/* T70: header counts ride the page-head row, same size as their labels */
.page-head .avail-bar { margin: 0; }
.avail-num { font-size: inherit; font-weight: 600; color: var(--text); }

/* T67: profile availability bar — slim inline strip, content-fitted */
.avail-bar {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 2rem;
  margin: 0 0 1.1rem;
}
.avail-item { display: inline-flex; align-items: baseline; gap: .5rem; }
.avail-item .cost { font-size: 1.2rem; }

/* empty state */
.empty {
  border: 1px dashed var(--hairline-2);
  border-radius: 6px;
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .06em;
}

/* reveal cost: visually prominent, per T48 */
.cost {
  font-family: var(--font-mono);
  font-size: clamp(1rem, .9rem + .6vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--accent);
}
.cost.free { color: var(--ok); }
.cost.blocked { color: var(--danger); }
.costline { display: block; margin: .4rem 0 .2rem; }

/* balance chip in the header */
.chip {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  padding: .12rem .55rem;
  color: var(--accent);
}

/* login page */
.login-wrap { max-width: 420px; margin: 8vh auto 0; }
.login-wrap .kicker { text-align: center; display: block; margin-bottom: .4rem; }

/* T127 quota-unlock badge + nav chip */
.badge-unlock {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  padding: .1rem .5rem;
  color: var(--accent);
  white-space: nowrap;
}
.chip-unlock { color: var(--accent); }

/* ---- responsive bands (T53: explicit per device family) ------------------
   mobile     ≤640   — single-column grids; horizontal scroll is allowed HERE
                       ONLY (.table-wrap), never above 640
   tablet     641–1024 — two-column grids hold; tables fit (truncation below)
   laptop     1025–1919 — full layout, 1100px measure
   ultrawide  ≥1920   — the measure grows so content uses the screen instead
                       of sliding horizontally inside a narrow column */
@media (min-width: 1920px) {
  /* T99 (operator, ultrawide 2026-11-25): the container used to freeze at
     1560px while the screen kept growing — dead margins plus ellipsized
     cells despite free space. --max-w is now fluid to a 2560px ceiling:
     the page scales with the browser/device, narrow bands untouched. */
  :root { --max-w: min(calc(100vw - 4rem), 2560px); }
  h1 { font-size: clamp(1.7rem, 1.3rem + 1.8vw, 2.6rem); }
  main { padding: 0 2rem; }
  header { padding: .65rem 2rem; }
  /* Directory cells stop ellipsizing at this band — full strings wrap
     (data present, no '...'), mirroring the T73 preview-card treatment.
     Narrow bands keep the T53 tight plans (fit-the-container guarantee). */
  td.ellip, th.ellip { max-width: none; }
  td.ellip { white-space: normal; overflow-wrap: anywhere; }
}
@media (min-width: 1440px) and (max-width: 1919px) {
  /* T99b: fluid here too — half of an ultrawide (~1720px) lives in this band
     and previously froze at 1320px with margins on both sides. */
  :root { --max-w: min(calc(100vw - 4rem), 1760px); }
}
@media (max-width: 1024px) {
  .grid { gap: .8rem; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  nav { gap: .5rem; }
  nav .who { display: none; }
  main { margin-top: 1rem; padding: 0 .75rem; }
  table.kv th { width: 7.5rem; }
  .login-wrap { margin-top: 3vh; }
  .tile-row { flex-direction: column; align-items: stretch; }
  /* T99b: preview cards use the same sanctioned sub-640 slider as the
     directory (T53: "no horizontal slider ABOVE 640px") — cramming 5 fixed
     columns into 330px stacked characters vertically once ellipsis was gone.
     560px + a mobile-specific plan: every column's share covers its worst
     real string (E·P·S 14ch, CONTACTS 8ch header), prof link wraps instead
     of clipping its arrow. */
  .grid .card { overflow-x: auto; }
  .grid .card table { min-width: 560px; }
  .grid .card th:nth-child(1), .grid .card td:nth-child(1) { width: 26%; }
  .grid .card th:nth-child(2), .grid .card td:nth-child(2) { width: 24%; }
  .grid .card th:nth-child(3), .grid .card td:nth-child(3) { width: 14%; }
  .grid .card th:nth-child(4), .grid .card td:nth-child(4) { width: 22%; }
  .grid .card th:nth-child(6), .grid .card td:nth-child(6) { width: 14%; }
  .grid .card td.prof { white-space: normal; }
}

/* ---- table fit (T53: tables FIT their content at desktop widths) ---------
   T99b rework (operator, 2026-11-25: 'styled incorrectly' at half-screen):
   ellipsis is GONE as a data-cell mechanism at every width. Cells carry
   overflow-wrap:anywhere, so the auto layout's min-content collapses and the
   table can always fit its container (the T53 no-border-crossing guarantee),
   while free space is distributed to content — full strings whenever the
   window has room, wrap (never '...') when it doesn't. The old fixed
   max-width:16rem ellipsized cells even when the row had free space. */
td.ellip, th.ellip {
  overflow: hidden;
  overflow-wrap: anywhere;
  min-width: 14ch; /* T50 guard: never stack characters vertically in a squeezed cell */
}
td a { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
td.prof { white-space: nowrap; }
td a { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
td.prof { white-space: nowrap; }
/* T53 delta (main.agent pixel gate): inside GRID PREVIEW CARDS the table is
   FIXED-layout — it structurally cannot exceed the card (the auto-layout
   minimum-width painted row-lines 15px past the border at 1440). Cells
   clip+ellipsize their own content instead of pushing the table out.
   Column plans are per band, sized so the widest E·P·S value (~19ch,
   '6504 / 8801 / 3322') fits with padding: 26% of a 1440 card ≈ 149px > 148px. */
.grid .card table { table-layout: fixed; width: 100%; }
.grid .card td { overflow: hidden; text-overflow: ellipsis; }
/* T73 preview-card tables (person: 'styling is fucked' — text snipped
   everywhere on ultra-wide). Fix, per band:
   - table-layout:fixed stays (the no-border-crossing guarantee, T53);
   - HEADERS never truncate: nowrap, min-content width, no ellipsis;
   - <1920: tight plan (Updated hidden, person-sanctioned), company/sector
     WRAP within their shares (T99b: ellipsis removed everywhere — data
     present at every width; 1440 cards are ~615px);
   - >=1920: cards are ~700px of content — Updated column dropped in previews
     too (the full /companies directory keeps it), and company+sector get
     room for their FULL strings (worst cases 26ch/29ch fit or wrap):
     NO ellipsis at this band, all data present, no '...' anywhere. */
.grid .card table { table-layout: fixed; width: 100%; }
.grid .card td { overflow: hidden; overflow-wrap: anywhere; padding: .5rem .4rem; }
.grid .card th { white-space: nowrap; overflow: hidden; padding: .5rem .4rem; }
.grid .card td.ellip, .grid .card th.ellip { max-width: none; }
.grid .card td.prof a { max-width: 100%; white-space: nowrap; }
/* <1920: Updated hidden — 5 columns; E·P·S 26% fits the widest 19ch value */
/* T99b rebalance for wrap-not-snip: company+sector get the space the old
   ellipsis plan gave to truncation slack; CONTACTS keeps enough for its
   8ch header even in a 615px card (12% ≈ 74px > 78px? no — but the header
   wraps nowhere: th nowrap + 12% of 615px = 74px ≈ 9ch @12px — verified
   by pixel gate at 1440 and 1720) */
.grid .card th:nth-child(1), .grid .card td:nth-child(1) { width: 20%; }
.grid .card th:nth-child(2), .grid .card td:nth-child(2) { width: 20%; }
.grid .card th:nth-child(3), .grid .card td:nth-child(3) { width: 13%; }
.grid .card th:nth-child(4), .grid .card td:nth-child(4) { width: 26%; }
.grid .card th:nth-child(6), .grid .card td:nth-child(6) { width: 21%; }
.grid .card td.eps { white-space: nowrap; }
.grid .card .upd { display: none; }
/* >=1920: full strings — company+sector wrap (never snip), wide shares */
@media (min-width: 1920px) {
  .grid .card td.ellip {
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
  /* ch-based plan (13px mono: 1ch ≈ 7.8px): CONTACTS header (8ch + spacing)
     fits its 12ch column — headers never clip; company gets 30ch so the
     worst domain (26ch) stays on one line; sector auto-shares the rest and
     long labels wrap at spaces (data present, no '...'). */
  /* table font drops to 12px at this band: every column's ch budget then
     covers its worst real string (26ch domain fits 30ch incl. padding) */
  .grid .card table { font-size: 12px; }
  .grid .card .hint { font-size: inherit; } /* .hint(13.5px) would re-widen the domain line */
  .grid .card th:nth-child(1), .grid .card td:nth-child(1) { width: 30ch; }
  .grid .card th:nth-child(2), .grid .card td:nth-child(2) { width: auto; }
  .grid .card th:nth-child(3), .grid .card td:nth-child(3) { width: 12ch; }
  .grid .card th:nth-child(4), .grid .card td:nth-child(4) { width: 26ch; }
  .grid .card th:nth-child(6), .grid .card td:nth-child(6) { width: 12ch; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* T79: landing hero (anonymous home) */
.hero h1 { font-size: 1.4rem; margin: .2rem 0 .5rem; max-width: 60ch; }
.hero p { max-width: 70ch; margin: 0 0 .6rem; color: var(--muted); }
.hero .tile-row { margin: .4rem 0 .2rem; }
.btn.lead { border-color: var(--accent); color: var(--accent); }
.btn.lead:hover { background: var(--accent); color: #fff; }

/* T84: one-time raw API key display (welcome page + rotate flash) */
pre.key-reveal {
  font-size: 1.05rem;
  letter-spacing: .04em;
  padding: .8rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: rgba(0, 229, 255, .06);
  user-select: all;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* ---- T105: persona-card styling sweep ------------------------------------
   The dataset pivot: every pre-purchase surface shows a PERSONA (pseudonym +
   flag slot + sector + stats). Hierarchy: the pseudonym is the stable
   identifier, flag + sector are scannable metadata, the stats strip is the
   value signal. No-flag / unlabeled states render as deliberate marks, never
   as holes (T101's country_code and sector labeling populate gradually). */

/* the flag slot: fixed advance so a flag never wraps per-character
   (regional-indicator pairs break badly in narrow cells) and reads as a
   metadata chip, not body text */
.flag {
  display: inline-block;
  min-width: 1.5em;
  text-align: center;
  font-size: 1.08em;
  line-height: 1;
  vertical-align: -0.14em;
  letter-spacing: 0;
}

/* the stable identifier cell: strongest text in the row; never wraps —
   'Co #120952' breaking at its space reads as two different identifiers.
   overflow-wrap:normal is REQUIRED: .grid .card td's 'anywhere' creates
   soft-wrap opportunities that override white-space:nowrap (verified by
   pixel gate: 'Co #120952' split into 'Co'/'#120952' at 1440). */
td.persona {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow-wrap: normal;
}

/* unlabeled/absent metadata: a deliberate dim mark, same color as the
   input placeholder so 'no data' reads as designed emptiness */
.unlabeled { color: var(--faint); }

/* dark scrollbars — the sub-640 sanctioned slider used to paint the OS
   default light bar inside dark cards (operator: 'messed up') */
.table-wrap, .grid .card { scrollbar-width: thin; scrollbar-color: var(--hairline-2) transparent; }
.table-wrap::-webkit-scrollbar, .grid .card::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track, .grid .card::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb, .grid .card::-webkit-scrollbar-thumb {
  background: var(--hairline-2);
  border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb:hover, .grid .card::-webkit-scrollbar-thumb:hover { background: var(--btn-border); }

/* E·P·S joins the never-wrap set with the same 'anywhere' override: its
   nowrap (base band :578) was being defeated too — the value wrapped and
   overflow:hidden + ellipsis painted '17906 / 1826 / 31…' */
.grid .card td.eps { overflow-wrap: normal; }

/* T105 persona-era column plans: the identifier is now short but must stay
   on ONE line ('Co #120952', 10ch + padding needs ~17% of a 615px card)
   while sector labels are long ('Photography Studio Management'). E·P·S
   needs its full 19ch worst case: 19ch × 7.8px (13px mono) = 148px content;
   26% gave 152px − 12.8px padding = 139px → clipped by 9px (pixel-gated at
   1440: '17906 / 1826 / 31…'). 28% = 163px − 12.8px = 150px ✓. Sector pays
   for both (25→22): its labels wrap to 2 lines, which is sanctioned. Sums
   stay 100. */
.grid .card th:nth-child(1), .grid .card td:nth-child(1) { width: 17%; }
.grid .card th:nth-child(2), .grid .card td:nth-child(2) { width: 22%; }
.grid .card th:nth-child(3), .grid .card td:nth-child(3) { width: 13%; }
.grid .card th:nth-child(4), .grid .card td:nth-child(4) { width: 28%; }
.grid .card th:nth-child(6), .grid .card td:nth-child(6) { width: 20%; }
@media (min-width: 1920px) {
  .grid .card th:nth-child(1), .grid .card td:nth-child(1) { width: 13ch; }
  .grid .card th:nth-child(3), .grid .card td:nth-child(3) { width: 12ch; }
  .grid .card th:nth-child(4), .grid .card td:nth-child(4) { width: 24ch; }
  .grid .card th:nth-child(6), .grid .card td:nth-child(6) { width: 12ch; }
}
@media (max-width: 640px) {
  /* the sub-640 slider keeps the table at min-width 560px, so ch math holds:
     E·P·S worst case '27675 / 12 / 1' = 14ch ≈ 109px; 24% of 560 = 134px ✓ */
  .grid .card th:nth-child(1), .grid .card td:nth-child(1) { width: 18%; }
  .grid .card th:nth-child(2), .grid .card td:nth-child(2) { width: 30%; }
  .grid .card th:nth-child(3), .grid .card td:nth-child(3) { width: 14%; }
  .grid .card th:nth-child(4), .grid .card td:nth-child(4) { width: 24%; }
  .grid .card th:nth-child(6), .grid .card td:nth-child(6) { width: 14%; }
}

/* profile identity row: the pseudonym is the card's subject */
.kv .pid { color: var(--text); font-weight: 600; }

/* buy CTA (T104 markup may refine this; the block must read as THE action
   on the page even before that lands) */
.card.cta { border-top: 2px solid var(--accent); }
.card.cta .hint strong { color: var(--text); }
.card.cta button {
  border-color: var(--accent-2);
  color: var(--accent);
  font-weight: 700;
}
.card.cta button:hover { background: var(--accent); color: #fff; }

/* footer links never wrap mid-link at 390 ('Opt out' used to break) —
   each link is nowrap, the LIST wraps between links */
footer.site-footer .foot-links { flex-wrap: wrap; row-gap: .3rem; justify-content: center; }
footer.site-footer .foot-links a { white-space: nowrap; }

/* profile kv table: 2 columns — values WRAP instead of riding the sub-640
   slider (the slider's min-width:480px put 'Photography Studio Management'
   and the status label past the 390px edge; sideways-scrolling a profile's
   own identity card is the wrong affordance — pixel-gated at 390) */
@media (max-width: 640px) {
  .table-wrap table.kv { min-width: 0; }
  .table-wrap table.kv td { overflow-wrap: anywhere; }
}

/* stats strip: the value signal — numbers carry the weight */
.avail-item .kicker { color: var(--muted); }
.avail-bar .avail-num { font-size: 1.05rem; }


/* ---- T132: pixel-gate closeout (3440/1720 completion of T127's gate) ---- */

@media (max-width: 640px) {
  /* T159: the facet-note ("of N contact-bearing, M unassigned") is removed
     with its sub-640 wrap rule; the label flex-wrap stays harmless. */
  .filters-row label.inline { flex-wrap: wrap; }
  /* a select with width:auto sizes to its LONGEST option ("manufacturing &
     industrial equipment" ≈ 350px) and blew the fixed page width (pixel-gated:
     443px at 390). 11rem keeps the closed control in-frame; long options
     scroll inside the open dropdown. */
  .filters-row select { max-width: 11rem; }
}

/* ---- T134/T135: /my/topup compact — one viewport, cards fit content ---- */

/* T135 (operator, verbatim: 'everything should be visible without
   scrolling … reduce the width of the boxes to actually match the text …
   clean crisp and neatly uniformed'). The page was five near-full-width
   cards (~1570px tall at 2560 — every package below the fold). Now:
   - .topup scopes every compaction (padding, type, margins) to this page;
   - the package grid is 6 tracks at >=1024: the three credit cards span 2
     each (row one) — two rows instead of five stacked cards;
   - T157 operator decision: ONE dataset SKU. The T104 price-on-application
     card is gone; the bulk card (`.card.bulk`) is the sole whole-platform
     SKU and centers itself on row two (span 4 from track 2 in the 6-track
     grid, full row sub-1024);
   - sub-1024 the grid keeps its 2-col plan with the T134 odd-last-card
     full-width reflow; .half is scoped to the >=1024 block so it can
     never force implicit columns in a 2-col grid.
   Copy is FROZEN (dual-pricing-card question with the operator) — layout
   and size only. */

.topup .page-head { margin-bottom: 1.4rem; } /* T157: balance card + checkout note removed — gap compensated (was .8rem + two blocks) so the grid keeps its distance */
.topup h1 { margin: .2rem 0 .4rem; }
.topup .card { padding: .75rem .95rem; margin-bottom: .8rem; }
.topup .card h2 { font-size: 1.05rem; margin: 0 0 .3rem; }
.topup .cost { font-size: 1.1rem; }
.topup .costline { margin: .1rem 0; }
.topup .card p.hint { margin: .25rem 0 .6rem; }

@media (min-width: 1024px) {
  .topup .grid.packages { grid-template-columns: repeat(6, 1fr); }
  .topup .grid.packages > .card:nth-child(-n+3) { grid-column: span 2; }
  /* T157: the bulk card is row two's only item — centered (tracks 2–5 of 6) */
  .topup .grid.packages > .card.bulk { grid-column: 2 / span 4; }
}
.topup .grid.packages > .card.full { grid-column: 1 / -1; }

@media (max-width: 1023px) {
  /* T134 reflow, sub-1024 band only: in the 2-col grid an odd last card
     spans full width instead of stranding an empty cell. */
  .grid.packages > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* T157: the lone bulk card takes the row on narrow bands too */
  .grid.packages > .card.bulk { grid-column: 1 / -1; }
}

/* ---- T151: admin analytics panel (/admin/analytics) -----------------------
   Visual contract: design/prototypes/admin-analytics.html — KPI strip on
   top, panels top-down left-anchored, share bars in-row, color never alone
   (every delta carries its arrow glyph + signed number). */

.atop { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; flex-wrap: wrap; }
.atop h1 { margin: 0 auto 0 0; font-size: 1.125rem; letter-spacing: -.01em; }
.atop .sub { color: var(--faint); font-size: .8125rem; font-weight: 400; }
.seg { display: flex; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg .segbtn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 14px;
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; text-decoration: none;
}
.seg .segbtn.on { background: var(--accent); color: #fff; }
[data-theme="dark"] .seg .segbtn.on { color: #121419; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px; }
.kpi .l { font-size: .6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.kpi .v { font-size: 1.5rem; font-weight: 700; margin-top: 2px; }
.kpi .d { font-size: .75rem; margin-top: 2px; color: var(--faint); }
.kpi .up { color: var(--ok); }
.kpi .down { color: var(--danger); }
.up { color: var(--ok); }
.down { color: var(--danger); }

.panel { margin-bottom: 14px; }
.panel h2 { font-size: .875rem; font-weight: 600; margin: 0 0 10px; letter-spacing: -.01em; }
.panel h2::before { display: none; } /* prototype has no h2 tick marks */
.panel h2 .sub { color: var(--faint); font-size: .75rem; font-weight: 400; margin-left: 8px; }
.panel h2.mt, table.mt { margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.panel .empty { color: var(--faint); }

.legend { display: flex; gap: 16px; font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-acc { background: var(--accent); }
.sw-prev { background: var(--faint); opacity: .4; }
.sw-up { background: var(--ok); }

.barcell { width: 38%; }
svg.bar { display: block; width: 100%; height: 8px; }
.bar { height: 8px; border-radius: 4px; background: var(--accent-2); position: relative; min-width: 60px; }
.bar i { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); border-radius: 4px; }

/* T152 enriched sectors (contract: design/prototypes/sectors-enriched.html).
   Tokens map onto the site palette: --line→--hairline, --line-2→--hairline-2,
   --ink-2→--muted, --ink-3→--faint. */
.kpis.k4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .kpis.k4 { grid-template-columns: repeat(2, 1fr); } }
.sector { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 14px 18px 6px; margin-bottom: 14px; }
.sec-head { display: flex; align-items: baseline; gap: 10px;
  border-bottom: 1px solid var(--hairline); padding-bottom: 8px; }
.sec-head h2 { font-size: .875rem; font-weight: 600; margin: 0; }
.sec-head .sub { color: var(--faint); font-size: .75rem; }
.sec-count { margin-left: auto; font-weight: 700; font-size: .9375rem; color: var(--accent); }
.genres { list-style: none; margin: 0; padding: 0; }
.genres li { display: grid; grid-template-columns: 220px 1fr 56px; gap: 12px;
  align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--hairline-2); }
.genres li:last-child { border-bottom: 0; }
.g-name { font-weight: 600; font-size: .8125rem; }
.g-desc { color: var(--muted); font-size: .8125rem; }
.g-count { text-align: right; font-weight: 600; font-size: .8125rem; color: var(--text); }
.g-count.zero { color: var(--faint); font-weight: 400; }
@media (max-width: 720px) {
  .genres li { grid-template-columns: 1fr 44px; }
  .g-desc { grid-column: 1 / -1; order: 3; }
}

/* ---- T164: /sectors single-viewport dashboard (operator: zero page scroll
   at 390 / 1440 / 2560 / 3440) ------------------------------------------ */

/* body.fit-vp (layout.html, sectors page only) turns the document into a
   fixed-height column: header, flexible main, footer — nothing overflows,
   the dashboard grid absorbs the slack. Every other page scrolls normally. */
body.fit-vp {
  overflow: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.fit-vp > main {
  flex: 1 1 auto;
  min-height: 0;          /* let the grid, not the page, take the height */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: none;
  padding: 0;
  width: 100%;
}
.sdash {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(.25rem, .8dvh, .7rem);
  padding: clamp(.4rem, 1.2dvh, 1rem) clamp(.7rem, 2vw, 2.5rem);
  max-width: 2150px;      /* ultrawide: centered poster, not a stretched line */
  margin: 0 auto;
  width: 100%;
}
.sd-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .3rem 1rem;
}
.sd-head .page-head { margin: 0; }
.sd-head h1 { font-size: clamp(1.05rem, 3.2dvh, 1.9rem); margin: 0; }
.sd-head .kicker { font-size: clamp(.55rem, 1.2dvh, .7rem); }
.sd-kpis { display: flex; flex-wrap: wrap; gap: .3rem .45rem; }
.sd-kpis .chip { font-size: clamp(.6rem, 1.35dvh, .8rem); }

/* the tile grid: auto-fill columns so 390 gets 2, laptop 5-6, desktop 8+,
   ultrawide denser but one screen; rows stretch to share the full height */
.sd-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(9.2rem, 16.5vw, 15.5rem), 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(.3rem, .8dvh, .8rem);
}
.sd-tile {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .12rem;
  padding: clamp(.3rem, .9dvh, .8rem) clamp(.45rem, 1vw, .9rem);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
}
.sd-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  min-width: 0;
}
.sd-name {
  font-size: clamp(.68rem, 1.75dvh, 1.05rem);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-count {
  font-size: clamp(.95rem, 2.8dvh, 1.8rem);
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1.15;      /* 1.55 base would eat the tile's vertical budget */
}
.sd-key {
  /* max-height clip, not -webkit-line-clamp: Firefox computes
     display:-webkit-box to flow-root and the key renders zero-height */
  font-size: clamp(.58rem, 1.35dvh, .82rem);
  line-height: 1.25;
  color: var(--muted);
  overflow: hidden;
  max-height: 2.55em;
}
.sd-tile.zero { opacity: .55; }
.sd-tile.zero .sd-count { color: var(--faint); }

/* T164 mobile budget: at 390 the header + footer + head must leave ~550px
   for 11 tile rows — one keyword line per tile (two clip), tighter chrome. */
body.fit-vp > footer.site-footer { margin-bottom: .4rem; }
@media (max-width: 480px) {
  .sd-key { max-height: 1.3em; }
  .sd-count { font-size: 1.05rem; }
  .sd-tile { padding: .2rem .45rem; gap: .05rem; }
  .sd-head h1 { font-size: 1.1rem; }
  /* one chip row: the head must give the 11 tile rows every px it can */
  .sd-kpis .chip { padding: .08rem .4rem; font-size: .55rem; }
  .sd-kpis { gap: .2rem .3rem; }
}
