/* ============================================================================
   pf-theme.css — Canonical theme. See THEME_SPEC.md.
   Loaded by every page in <head> BEFORE the page's inline <style>.
   ----------------------------------------------------------------------------
   Cascade contract:
   - This file ships sensible defaults at low specificity (element selectors +
     single classes). Because every page's inline <style> comes AFTER this
     <link>, equal-specificity page rules always win. No !important anywhere.
   - body font-size: pf-theme sets 14px (the app-wide default). index.html
     (trading terminal) keeps its denser 13px simply by re-declaring
     `body { font-size: 13px }` in its inline style — later in cascade, wins.
     docs.html may likewise bump its article prose to 15–16px locally.
   - Ambient glow: the shared two-glow background is body::before (below).
     index.html's legacy `.bg-effects` element is neutralized in its own CSS
     (display:none) so the glow can never double; every page gets the glow
     from here and should NOT add its own body::before / glow divs.
   - Fonts: every page loads the single canonical Google Fonts link
     (Instrument Sans 400..700, Plus Jakarta Sans 300..600,
      JetBrains Mono 400..600 — variable ranges, so weight 650 is real):
     https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400..700&family=JetBrains+Mono:wght@400..600&family=Plus+Jakarta+Sans:wght@300..600&display=swap
   - Do NOT redefine the :root token names below with different values in
     page CSS (index.html predates this rule and is the audited exception).
   ========================================================================== */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg-0: #0c0e14;        /* page background */
  --bg-1: #141824;        /* cards, panels, elevated surfaces */
  --bg-2: #101420;        /* page-level wells, table headers */
  --bg-3: #1a2030;        /* hover surfaces */
  --bg-input: #0f1320;
  --border: rgba(255,255,255,0.07);
  --border-subtle: rgba(255,255,255,0.04);
  --border-hover: rgba(255,255,255,0.12);
  --text-0: #f0f2f7;      /* headings */
  --text-1: #dde2ec;      /* body */
  --text-2: #8a93a8;      /* secondary */
  --text-3: #4e5668;      /* faint */
  --accent: #4AE3C0; --accent-hover: #3dd4b1;
  --accent-dim: rgba(74,227,192,0.12); --accent-border: rgba(74,227,192,0.25);
  --green: #4AE3C0; --green-bg: rgba(74,227,192,0.12);
  --red: #f87171;  --red-bg: rgba(248,113,113,0.12);
  --yellow: #fbbf24; --yellow-bg: rgba(251,191,36,0.12);
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-display: 'Instrument Sans', var(--font-body);
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius-card: 12px; --radius-btn: 8px; --radius-input: 8px; --radius-badge: 6px;
  --page-max: 1240px; --page-pad: 24px;
}

/* ── 2. Global base ────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;          /* pages may re-declare (index.html: 13px) */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient background glow — every page, exactly once (see header note). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 600px at -5% -5%, rgba(74,227,192,0.06), transparent 65%),
    radial-gradient(900px 600px at 105% 105%, rgba(122,162,255,0.04), transparent 65%);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-0);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }

::selection { background: var(--accent); color: #0c0e14; }

/* Thin scrollbars; page-scoped scrollbar rules (e.g. index panels) override. */
html { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Numbers / addresses / amounts */
.pf-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── 3. Standard page scaffold ─────────────────────────────────────────── */
/* <main class="pf-page"> wraps every content page (index.html stays
   full-bleed and does not use it). */
.pf-page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px var(--page-pad) 48px;
}

.pf-page-head { margin: 4px 0 20px; }
.pf-page-head h1 {
  display: flex;
  align-items: center;
  gap: 10px;             /* room for an inline .pf-badge (e.g. PROTOTYPE) */
}
.pf-page-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
}

/* Narrow form column (fund / withdraw / settings): left-aligned inside
   .pf-page, NOT margin-auto centered. */
.pf-page-narrow { max-width: 860px; }

/* ── 4. Components ─────────────────────────────────────────────────────── */

/* Cards */
.pf-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
}
.pf-card + .pf-card { margin-top: 16px; }
/* Hover affordance for interactive cards only — add the extra class. */
.pf-card-interactive { transition: border-color .15s ease; cursor: pointer; }
.pf-card-interactive:hover { border-color: var(--border-hover); }

/* Buttons */
.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;   /* variants recolor; keeps heights equal */
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s ease;
}
.pf-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.pf-btn-primary { background: var(--accent); color: #0c0e14; }
.pf-btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.pf-btn-ghost {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-border);
}
.pf-btn-ghost:hover:not(:disabled) { background: rgba(74,227,192,0.18); }

.pf-btn-neutral {
  background: var(--bg-3);
  color: var(--text-1);
  border-color: var(--border);
}
.pf-btn-neutral:hover:not(:disabled) { border-color: var(--border-hover); }

.pf-btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(248,113,113,0.25);
}
.pf-btn-danger:hover:not(:disabled) { background: rgba(248,113,113,0.18); }

.pf-btn-sm { font-size: 12px; padding: 6px 12px; }

/* Inputs */
.pf-input, .pf-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-1);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pf-input::placeholder { color: var(--text-3); }
.pf-input:focus, .pf-select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.pf-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a93a8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Tables */
.pf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pf-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  background: var(--bg-2);
  text-align: left;
  padding: 10px 12px;
}
.pf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.pf-table tbody tr:hover { background: var(--bg-3); }

/* Badges */
.pf-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-badge);
  padding: 3px 8px;
  vertical-align: middle;
}
.pf-badge-green   { background: var(--green-bg);  color: var(--green); }
.pf-badge-red     { background: var(--red-bg);    color: var(--red); }
.pf-badge-yellow  { background: var(--yellow-bg); color: var(--yellow); }
.pf-badge-neutral { background: rgba(255,255,255,0.06); color: var(--text-2); }

/* Section titles (emoji allowed here — max one, leading) */
.pf-section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  margin: 28px 0 12px;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .pf-page { padding: 16px; }
  .pf-btn { min-height: 40px; }        /* tap-friendly */
  .pf-btn-sm { min-height: 34px; }
}
