/* Release 1H — owner dashboard. A quiet, professional tool sharing the
   Ranked Cappers brand palette (site/assets/site.css): warm ledger paper,
   LIGHT DEFAULT, ledger-green accent, monospace for every figure. Dark is a
   peer via the toggle or system preference. Self-contained: system font
   stacks, no CDN, no webfonts. Token values mirror site.css — keep in sync. */

:root {
  color-scheme: light;
  --bg: #F4F1EA;
  --surface: #FCFBF7;
  --surface-2: #F1EDE3;
  --border: #D8D1C2;
  --border-strong: #C7BEA9;
  --text: #15181D;
  --muted: #6A6F79;
  --faint: #9A9488;
  --accent: #1E7A32;
  --accent-ink: #FCFBF7;
  --accent-dim: rgba(30, 122, 50, 0.09);
  --win: #1E7A32;
  --loss: #BE3A2B;
  --push: #6A6F79;
  --pending: #8F6212;
  --shadow: 0 1px 2px rgba(30, 24, 12, 0.05), 0 14px 34px -20px rgba(30, 24, 12, 0.24);

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --r: 8px;
  --r-sm: 6px;
  --pad: 20px;
}

/* system DARK preference — honored only when no explicit toggle choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0B0E13;
    --surface: #11151D;
    --surface-2: #0E121A;
    --border: #1E2530;
    --border-strong: #2A3340;
    --text: #E8EDF4;
    --muted: #8A93A3;
    --faint: #5D6675;
    --accent: #3FB950;
    --accent-ink: #0B0E13;
    --accent-dim: rgba(63, 185, 80, 0.12);
    --win: #3FB950;
    --loss: #F85149;
    --push: #8A93A3;
    --pending: #D29922;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
  }
}
/* Explicit toggle wins over the OS preference in both directions. */
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #0B0E13; --surface: #11151D; --surface-2: #0E121A; --border: #1E2530; --border-strong: #2A3340;
  --text: #E8EDF4; --muted: #8A93A3; --faint: #5D6675; --accent: #3FB950; --accent-ink: #0B0E13; --accent-dim: rgba(63,185,80,0.12);
  --win: #3FB950; --loss: #F85149; --push: #8A93A3; --pending: #D29922; --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.28); }
:root[data-theme="light"] { color-scheme: light;
  --bg: #F4F1EA; --surface: #FCFBF7; --surface-2: #F1EDE3; --border: #D8D1C2; --border-strong: #C7BEA9;
  --text: #15181D; --muted: #6A6F79; --faint: #9A9488; --accent: #1E7A32; --accent-ink: #FCFBF7; --accent-dim: rgba(30,122,50,0.09);
  --win: #1E7A32; --loss: #BE3A2B; --push: #6A6F79; --pending: #8F6212; --shadow: 0 1px 2px rgba(30,24,12,0.05), 0 14px 34px -20px rgba(30,24,12,0.24); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- boot + login ---------------------------------------------------------*/
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 40px 36px; box-shadow: var(--shadow); text-align: left;
}
.login-card h1 { font-size: 22px; margin: 18px 0 10px; letter-spacing: -0.01em; }
.login-lede { color: var(--muted); margin: 0 0 24px; }
.login-actions { display: flex; flex-direction: column; gap: 10px; }
.login-note { color: var(--faint); font-size: 12.5px; margin: 22px 0 0; }
.login-note em { color: var(--muted); font-style: normal; font-weight: 600; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: var(--r);
  padding: 11px 16px; font-weight: 600; text-decoration: none; transition: filter 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--r); padding: 10px 16px; text-decoration: none;
}
.btn-secondary:hover { border-color: var(--accent); }
.login-hint { color: var(--faint); font-size: 12px; margin-top: 2px; }
.login-hint code { font-family: var(--font-mono); color: var(--muted); }

/* ---- logo mark ------------------------------------------------------------*/
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 5px; height: 2px; background: var(--accent-ink); opacity: 0.85;
  clip-path: polygon(0 100%, 22% 40%, 46% 66%, 74% 8%, 100% 42%, 100% 100%); height: 11px; }
.mark-lg { width: 34px; height: 34px; border-radius: 9px; }

/* ---- app shell ------------------------------------------------------------*/
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  border-right: 1px solid var(--border); background: var(--surface);
  padding: 22px 18px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.rail-brand { display: flex; align-items: center; gap: 11px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: 0.01em; }
.brand-sub { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.09em; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.field-window { margin-top: auto; }
.select {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; font: inherit;
}
.select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  text-align: left; background: transparent; color: var(--muted); border: none;
  border-radius: var(--r-sm); padding: 9px 11px; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--accent-dim); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }

.rail-foot { display: flex; flex-direction: column; gap: 12px; }
.who { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.who-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: var(--r-sm); padding: 6px 10px; font-size: 12px; text-decoration: none;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--text); }

/* ---- main -----------------------------------------------------------------*/
.main { min-width: 0; padding: 26px 30px 60px; }
.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.view-title { font-size: 20px; letter-spacing: -0.01em; }
.view-meta { color: var(--faint); font-size: 12.5px; }
.view-meta .num { color: var(--muted); }

/* ---- cards + stat tiles ---------------------------------------------------*/
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.panel-note { color: var(--faint); font-size: 12px; }
.panel-body { padding: 18px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--r); overflow: hidden; }
.tile { background: var(--surface); padding: 15px 16px; display: flex; flex-direction: column; gap: 6px; }
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.tile-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; letter-spacing: -0.01em; }
.tile-sub { font-size: 12px; color: var(--muted); }
.pos { color: var(--win); }
.neg { color: var(--loss); }

.record-line { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 15px; }
.record-line .wlp b { font-weight: 600; }

/* ---- pills ----------------------------------------------------------------*/
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-win { color: var(--win); background: color-mix(in srgb, var(--win) 14%, transparent); }
.pill-loss { color: var(--loss); background: color-mix(in srgb, var(--loss) 14%, transparent); }
.pill-push { color: var(--push); background: color-mix(in srgb, var(--push) 16%, transparent); }
.pill-void { color: var(--faint); background: var(--surface-2); }
.pill-pending { color: var(--pending); background: color-mix(in srgb, var(--pending) 14%, transparent); }
.pill-live { color: var(--accent); background: var(--accent-dim); }

/* ---- gate / disclosure ----------------------------------------------------*/
.gate-note { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); color: var(--muted); font-size: 13px; }
.gate-note strong { color: var(--text); }
.disclosure { color: var(--faint); font-size: 12px; line-height: 1.6; }
.disclosure p { margin: 0 0 8px; }
.disclosure p:last-child { margin: 0; }

/* ---- tables ---------------------------------------------------------------*/
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.matchup { color: var(--text); }
.matchup small { display: block; color: var(--faint); font-size: 11px; margin-top: 1px; }
.capper-tag { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.spark { width: 108px; height: 26px; display: block; }
.spark-empty { color: var(--faint); font-size: 11px; }

/* ---- pagination -----------------------------------------------------------*/
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.pager-btns { display: flex; gap: 8px; }

/* ---- definition list (config) ---------------------------------------------*/
.dl { display: grid; grid-template-columns: 200px 1fr; gap: 1px; background: var(--border); border-radius: var(--r); overflow: hidden; }
.dl dt { background: var(--surface); padding: 12px 16px; color: var(--muted); font-size: 12.5px; }
.dl dd { background: var(--surface); padding: 12px 16px; margin: 0; }
.dl dd.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px 8px; color: var(--muted); }
.empty-dash { color: var(--faint); }

.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---- responsive -----------------------------------------------------------*/
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
  .rail-brand { flex: 1 1 100%; }
  .field, .nav { flex: 1 1 auto; }
  .field-window { margin-top: 0; }
  .nav { flex-direction: row; }
  .rail-foot { flex: 1 1 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .grid-2 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
}

/* billing tab */
.billing-actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-top:12px}
.billing-actions .btn{display:inline-block;background:var(--accent);color:var(--accent-ink);padding:9px 16px;border-radius:8px;font-weight:600;text-decoration:none}

/* ---- Public Profile tab (RC Verified) ------------------------------------ */
.code-snippet{ width:100%; font-family:var(--font-mono); font-size:.82rem;
  background:var(--surface-2); color:var(--text); border:1px solid var(--border);
  border-radius:8px; padding:10px 12px; margin:6px 0 12px; resize:vertical; }
.input{ width:100%; max-width:420px; font-size:.95rem; background:var(--surface-2);
  color:var(--text); border:1px solid var(--border); border-radius:8px; padding:9px 12px; margin-top:4px; }
.consent{ display:flex; gap:10px; align-items:flex-start; margin:14px 0; font-size:.85rem;
  color:var(--muted); max-width:70ch; line-height:1.5; }
.consent input{ margin-top:3px; flex:0 0 auto; }
