/* INVISIBLE MARKET — visual system.
 *
 * The reference is the ride-hailing/delivery app family: black as the
 * action colour rather than a blue accent, a near-white ground, white
 * cards with hairline borders, oversized tightly-tracked headings, and
 * filled (not outlined) form fields. Colour is spent almost nowhere, so
 * the few places that do carry it — a confirmed consent, an error —
 * read instantly.
 *
 * No webfont is loaded on purpose. The face this style descends from is
 * proprietary, and a product intended for sale should not ship a font it
 * has no licence to redistribute; the system stack below is the closest
 * neutral grotesque available on every platform, and it costs no request.
 *
 * Everything is driven by the tokens in :root. Components never hardcode
 * a colour, so the dark theme is a token swap and nothing else.
 */

:root {
  color-scheme: light dark;

  --ink: #000000;          /* primary text AND primary action colour */
  --ink-hover: #262626;
  --paper: #ffffff;        /* cards, elevated surfaces */
  --ground: #f6f6f6;       /* page background, filled inputs, quiet buttons */
  --ground-hover: #ededed;
  --line: #e2e2e2;
  --muted: #545454;        /* secondary text — still passes contrast on paper */
  --faint: #8a8a8a;

  --go: #06c167;           /* consent given, contact unlocked */
  --go-soft: #e7f8ef;
  --stop: #e11900;         /* errors, refusals */
  --stop-soft: #fdeceb;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shell: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ffffff;
    --ink-hover: #d9d9d9;
    --paper: #1c1c1c;
    --ground: #000000;
    --ground-hover: #2a2a2a;
    --line: #333333;
    --muted: #b0b0b0;
    --faint: #7d7d7d;

    --go: #23d67f;
    --go-soft: #10301f;
    --stop: #ff5a4d;
    --stop-soft: #331512;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────────────────── */

h1, h2, h3 {
  margin: 0 0 0.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); line-height: 1.15; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 0.75rem; }
a { color: var(--ink); }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.error { color: var(--stop); font-weight: 600; }

/* Small uppercase label used above values and section groups. */
.eyebrow {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.25rem;
}

.lede { font-size: 1.0625rem; color: var(--muted); max-width: 60ch; }

/* Digits that stack in columns must not wobble between rows. */
.tnum { font-variant-numeric: tabular-nums; }

/* ── Top navigation ─────────────────────────────────────────────────── */

header.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.25rem;
  height: 64px;
  background: #000000;
  color: #ffffff;
}

.wordmark {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: #b8b8b8;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: #ffffff; }
.nav-links a.current { color: #ffffff; border-bottom-color: #ffffff; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.nav-user {
  font-size: 0.875rem;
  color: #b8b8b8;
  white-space: nowrap;
}

/* Log out sits on black, so it inverts the usual button treatment. */
.btn-on-dark {
  background: transparent;
  color: #ffffff;
  border: 1px solid #4a4a4a;
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-on-dark:hover { border-color: #ffffff; }

/* ── Layout ─────────────────────────────────────────────────────────── */

main {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.banner-demo {
  background: var(--ink);
  color: var(--paper);
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .banner-demo { background: #1c1c1c; color: #ffffff; }
}

/* ── Cards ──────────────────────────────────────────────────────────── */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card > h2:first-child, .card > h1:first-child { margin-top: 0; }

/* ── Stat tiles ─────────────────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
a.tile:hover { border-color: var(--ink); }

.tile-value {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tile-label { margin-top: 0.375rem; font-size: 0.9375rem; color: var(--muted); }

/* ── Row lists ──────────────────────────────────────────────────────── */

.rows {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.row:last-child { border-bottom: none; }
a.row:hover { background: var(--ground); }

.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 600; letter-spacing: -0.01em; }
.row-sub { font-size: 0.875rem; color: var(--muted); }
.row-end { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

.chevron { color: var(--faint); font-size: 1.25rem; line-height: 1; }

/* ── Pills ──────────────────────────────────────────────────────────── */

.pill {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--ground);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill.ink { background: var(--ink); color: var(--paper); }
.pill.go { background: var(--go-soft); color: var(--go); }
.pill.stop { background: var(--stop-soft); color: var(--stop); }

/* ── Score display ──────────────────────────────────────────────────── */

.score {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--ink); }

.factor {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.factor:last-child { border-bottom: none; }
.factor .bar { grid-column: 1 / -1; }
.factor-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Definition pairs (detail screens) ──────────────────────────────── */

.pairs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.pair-value { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }

/* ── Forms ──────────────────────────────────────────────────────────── */

form { margin: 0; }

label {
  display: block;
  margin-top: 1.25rem;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ground);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
}

input::placeholder { color: var(--faint); }

select {
  /* Chevron drawn inline so no image request is needed. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 55%, calc(100% - 1rem) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

/* ── Buttons ────────────────────────────────────────────────────────── */

button, .btn {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--ink-hover); }

button.secondary, .btn.secondary {
  background: var(--ground);
  color: var(--ink);
}
button.secondary:hover, .btn.secondary:hover { background: var(--ground-hover); }

/* Forms submit with one decisive full-width action, phone-first. Scoped to
   `main` so the log-out form in the black header keeps its pill shape. */
main form > button[type="submit"] { margin-top: 1.75rem; width: 100%; }
@media (min-width: 560px) {
  main form > button[type="submit"] { width: auto; min-width: 200px; }
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── Tables (kept for dense registries) ─────────────────────────────── */

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
td {
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: none; }

/* ── Empty states ───────────────────────────────────────────────────── */

.empty {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty p { color: var(--muted); max-width: 44ch; margin: 0 auto 1.25rem; }

/* ── Footer ─────────────────────────────────────────────────────────── */

.site-foot {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--muted);
}
.site-foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
