/* Neuralytica analytics admin.
   Operational rather than decorative (spec §25): dense, legible, fast to scan.
   Shares the brand palette with the public site but none of its motion. */

:root {
  --bg: #0b0518;
  --panel: #130a28;
  --panel-2: #0e0720;
  --line: #241640;
  --line-soft: #1c1136;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --dim: #64748b;
  --cyan: #22d3ee;
  --cyan-soft: #67e8f9;
  --violet: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* The sign-in gate and app shell both set an explicit display, which would
   otherwise beat the hidden attribute and leave both on screen at once. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-soft); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #0891b2;
  outline-offset: 2px;
}

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

/* ---- header ---- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  position: sticky; top: 0; z-index: 20;
}
.topbar-in {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 0; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand img { height: 20px; display: block; }
.brand span { font-size: 13px; color: var(--muted); font-weight: 500; }
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--muted); }

/* ---- nav ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 600 14px Inter, sans-serif;
  padding: 12px 16px; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ---- controls ---- */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 20px 0; }
select, input[type="text"], input[type="email"], textarea {
  background: var(--panel-2); color: var(--text);
  border: 1px solid #3f3061; border-radius: 9px;
  padding: 9px 12px; font: 14px Inter, sans-serif; min-width: 0;
}
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }

.btn {
  appearance: none; cursor: pointer;
  border: 0; border-radius: 999px;
  background: var(--cyan); color: #08131f;
  font: 600 14px Inter, sans-serif; padding: 10px 20px;
}
.btn:hover { background: var(--cyan-soft); }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--cyan); background: none; }
.btn.small { padding: 6px 13px; font-size: 12.5px; }

/* ---- panels ---- */
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h3 {
  margin: 0 0 14px; font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.metric { font-size: clamp(24px, 3vw, 34px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.metric-label { font-size: 12px; color: var(--dim); margin-top: 6px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(34, 211, 238, 0.04); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* ---- section funnel ---- */
.funnel-row {
  display: grid; grid-template-columns: 220px 1fr 90px 90px 90px;
  gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.funnel-name { font-size: 13.5px; font-weight: 600; }
.funnel-key { font-size: 11px; color: var(--dim); font-family: ui-monospace, monospace; }
.bar { height: 22px; background: var(--panel-2); border-radius: 6px; overflow: hidden; position: relative; }
.bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}
.bar em {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding-left: 8px; font-style: normal; font-size: 11.5px; font-weight: 700;
  color: #061018; mix-blend-mode: normal;
}

/* ---- misc ---- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.pill.prospect { background: rgba(167, 139, 250, 0.18); color: #c4b5fd; }
.pill.anon { background: rgba(148, 163, 184, 0.14); color: var(--muted); }
.pill.internal { background: rgba(251, 191, 36, 0.16); color: var(--amber); }
.pill.revoked { background: rgba(248, 113, 113, 0.16); color: var(--red); }
.pill.live { background: rgba(52, 211, 153, 0.16); color: var(--green); }

.note {
  font-size: 12.5px; line-height: 1.55; color: var(--muted);
  border-left: 2px solid var(--violet); padding-left: 12px; margin: 12px 0;
}
.empty { padding: 40px 20px; text-align: center; color: var(--dim); font-size: 14px; }
.error {
  border: 1px solid rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08);
  color: #fecaca; padding: 14px 16px; border-radius: 10px; font-size: 13.5px; margin: 16px 0;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---- sign in ---- */
.signin { min-height: 78vh; display: grid; place-items: center; text-align: center; }
.signin-box { max-width: 420px; }
.signin h1 { font-size: 26px; letter-spacing: -0.03em; margin: 0 0 10px; }
.signin p { color: var(--muted); font-size: 14.5px; margin: 0 0 24px; }

/* ---- timelines ---- */
.session { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.session-head {
  padding: 12px 16px; background: var(--panel-2);
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.session-body { padding: 6px 16px 14px; }
.pageblock { padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.pageblock:last-child { border-bottom: 0; }
.pagehead { font-weight: 700; font-size: 14px; }
.seclist { margin: 8px 0 0; padding: 0 0 0 16px; list-style: none; }
.seclist li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; color: var(--muted); padding: 3px 0;
  border-left: 2px solid var(--line); padding-left: 10px;
}
.seclist li.q { border-left-color: var(--cyan); color: var(--text); }

@media (max-width: 760px) {
  .funnel-row { grid-template-columns: 1fr; gap: 6px; }
  .funnel-row .num { text-align: left; }
}
