/* ==========================================================================
   XAUUSD Trading Journal — design system
   Single committed DARK theme. There are no light tokens and no theme
   switcher: a half-built second theme is a dead setting in the UI.
   Every colour below was validated with the dataviz palette validator against
   the real surfaces; the contrast figures in the comments are measured.
   ========================================================================== */

:root {
  /* ---- surfaces ---- */
  --bg-page:    #0A0D14;
  --bg-card:    #131826;
  --bg-sunken:  #1A2133;
  --bg-raised:  #1E2740;
  --border:     #242C42;
  --border-strong: #33406A;
  --grid:       #1E2536;

  /* ---- ink ---- */
  --ink:        #E9EDF9;  /* 15.13:1 on card */
  --ink-2:      #A5AFC9;  /*  8.07:1 */
  --ink-muted:  #77819C;  /*  4.56:1 */

  /* ---- brand ---- */
  --brand:      #6E7CEE;  /* 4.87:1 — mark/fill */
  --brand-text: #9AA5FF;  /* 7.76:1 — link text */
  --brand-dim:  #2F3A78;
  --brand-glow: rgba(110, 124, 238, 0.30);

  /* ---- status (reserved meaning; never reused as "series 4") ---- */
  --good:     #35C77A;   /* 8.09:1 */
  --warning:  #E9A93C;   /* 8.60:1 */
  --serious:  #E8804F;   /* 6.43:1 */
  --critical: #EF5A6F;   /* 5.36:1 */
  --good-dim:     rgba(53, 199, 122, 0.14);
  --warning-dim:  rgba(233, 169, 60, 0.14);
  --critical-dim: rgba(239, 90, 111, 0.14);

  /* ---- categorical series (validated; see 06-DESIGN.md) ----
     3 slots pass all-pairs; 5 pass adjacent-only. Do not add a 6th. */
  --series-1: #6E7CEE;
  --series-2: #D95926;
  --series-3: #199E70;
  --series-4: #C98500;
  --series-5: #D55181;

  /* ---- type ---- */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* ---- spacing / radius ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 6px 18px rgba(0,0,0,.45);
  --shadow-lift: 0 10px 26px rgba(0,0,0,.55);

  --nav-h: 64px;
  --ease: cubic-bezier(.2,.7,.3,1);

  color-scheme: dark;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* No page ever scrolls sideways (AC-P1.3). This must be on `html`, not only
     on `body`: body-level overflow only propagates to the viewport when html's
     overflow is `visible`, and decorative absolutely-positioned elements
     (the login blobs) otherwise widen the document. Measured on the live site
     at 1280px: the document was 1340px wide before this. */
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-page);
  overflow-x: hidden;
}
h1,h2,h3,h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; font-weight: 650; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand-text);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted     { color: var(--ink-muted); }
.dim       { color: var(--ink-2); }
.small     { font-size: 13px; }
.tiny      { font-size: 12px; }
.tnum      { font-variant-numeric: tabular-nums; }
.center    { text-align: center; }
.right     { text-align: right; }
.nowrap    { white-space: nowrap; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ==========================================================================
   App shell — bottom nav on mobile, sidebar on desktop
   ========================================================================== */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.shell-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) calc(var(--nav-h) + var(--sp-7));
}
.page-head { margin-bottom: var(--sp-4); }
.page-head .eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-muted); margin-bottom: 2px;
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(19, 24, 38, .92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; color: var(--ink-muted); text-decoration: none;
  transition: color .15s var(--ease);
}
.nav a svg { width: 22px; height: 22px; }
.nav a.is-active { color: var(--brand-text); }
.nav a:hover { color: var(--ink); text-decoration: none; }

/* The log button is the visual centre and the largest target: one tap from the
   dashboard to the entry form is a structural requirement, not a menu item. */
.nav .nav-log { position: relative; }
.nav .nav-log .fab {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  width: 54px; height: 54px; border-radius: var(--r-pill);
  background: var(--brand); color: var(--bg-page);
  display: grid; place-items: center;
  box-shadow: 0 6px 20px var(--brand-glow);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.nav .nav-log .fab svg { width: 26px; height: 26px; }
.nav .nav-log:hover .fab { transform: translateX(-50%) translateY(-2px); }
.nav .nav-log span { margin-top: 26px; }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .nav {
    position: sticky; top: 0; bottom: auto; left: auto;
    height: 100dvh; width: 216px; flex: 0 0 216px;
    grid-template-columns: 1fr; grid-auto-rows: max-content;
    align-content: start; gap: 4px; padding: var(--sp-5) var(--sp-3);
    border-top: 0; border-right: 1px solid var(--border);
  }
  .nav a {
    flex-direction: row; justify-content: flex-start; gap: var(--sp-3);
    font-size: 14px; padding: 10px var(--sp-3); border-radius: var(--r-md);
  }
  .nav a.is-active { background: var(--bg-sunken); }
  .nav .nav-log .fab { position: static; transform: none; width: 36px; height: 36px; border-radius: var(--r-md); }
  .nav .nav-log:hover .fab { transform: translateY(-1px); }
  .nav .nav-log span { margin-top: 0; }
  .shell-main { padding: var(--sp-6) var(--sp-5) var(--sp-7); }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--sp-3) var(--sp-5); }
  .nav-brand img { width: 30px; height: 30px; }
  .nav-brand b { font-size: 15px; letter-spacing: -.01em; }
}
.nav-brand { display: none; }
@media (min-width: 900px) { .nav-brand { display: flex; } }

/* ==========================================================================
   Cards, tiles, panels
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-head h2, .card-head h3 { font-size: 15px; }
.card-title-note { font-size: 12px; color: var(--ink-muted); }

.grid { display: grid; gap: var(--sp-3); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 720px)  { .grid-tiles { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (min-width: 900px)  { .grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* Square stat tiles: icon, big value, label, small radial ring. Tiles are
   links, never dead cards. */
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  aspect-ratio: 1 / 1;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-3);
  color: inherit; text-decoration: none; overflow: hidden;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease);
}
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--border-strong); text-decoration: none; }
.tile-icon { width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--bg-sunken); color: var(--ink-2); }
.tile-icon svg { width: 16px; height: 16px; }
.tile-value { font-size: 30px; font-weight: 680; line-height: 1; letter-spacing: -.03em; }
.tile-label { font-size: 12px; color: var(--ink-muted); line-height: 1.25; }
.tile-ring { position: absolute; top: var(--sp-3); right: var(--sp-3); width: 30px; height: 30px; }
.tile.is-good    .tile-value { color: var(--good); }
.tile.is-warn    .tile-value { color: var(--warning); }
.tile.is-danger  .tile-value { color: var(--critical); }
.tile.is-good   .tile-icon { background: var(--good-dim);    color: var(--good); }
.tile.is-warn   .tile-icon { background: var(--warning-dim); color: var(--warning); }
.tile.is-danger .tile-icon { background: var(--critical-dim);color: var(--critical); }
@media (max-width: 400px) { .tile-value { font-size: 25px; } }

/* Hero figure — one large radial ring */
.hero-ring { display: flex; align-items: center; gap: var(--sp-5); }
.hero-ring .ring-wrap { position: relative; flex: 0 0 auto; width: 148px; height: 148px; }
.hero-ring .ring-center {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.hero-ring .ring-value { font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.hero-ring .ring-sub { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }
.hero-ring .hero-facts { display: grid; gap: var(--sp-3); min-width: 0; }
.fact-line { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: 14px; }
.fact-line dt { color: var(--ink-muted); }
.fact-line dd { margin: 0; font-weight: 600; }
@media (max-width: 520px) {
  .hero-ring { flex-direction: column; align-items: stretch; }
  .hero-ring .ring-wrap { align-self: center; }
  .hero-ring .hero-facts { width: 100%; }
}

/* The plan-followed comparison: the homepage's thesis statement. */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--sp-3); }
.compare-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); }
.compare-panel.followed { border-color: rgba(53,199,122,.35); }
.compare-panel.broken   { border-color: rgba(239,90,111,.35); }
.compare-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-muted); margin-bottom: var(--sp-2); }
.compare-panel .big { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.compare-panel.followed .big { color: var(--good); }
.compare-panel.broken   .big { color: var(--critical); }
.compare-panel .sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.compare-rows { margin-top: var(--sp-3); display: grid; gap: 6px; font-size: 13px; }
.compare-rows > div { display: flex; justify-content: space-between; }

/* ==========================================================================
   Buttons
   MEASURED: white text FAILS AA on every filled button (brand 3.63, good 2.19,
   critical 3.30, warning 2.06). Dark ink on the same fills scores 5.35–9.44.
   Filled buttons therefore take var(--bg-page), not white.
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 46px; padding: 0 var(--sp-4);
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--bg-sunken); color: var(--ink);
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn svg { width: 18px; height: 18px; }
.btn-primary  { background: var(--brand);    color: var(--bg-page); }
.btn-good     { background: var(--good);     color: var(--bg-page); }
.btn-danger   { background: var(--critical); color: var(--bg-page); }
.btn-warning  { background: var(--warning);  color: var(--bg-page); }
.btn-primary:hover { background: #8290ff; }
.btn-good:hover    { background: #4bd68b; }
.btn-danger:hover  { background: #ff7186; }
.btn-ghost   { background: transparent; border-color: var(--border-strong); color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); border-color: var(--brand); }
.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: 13px; border-radius: var(--r-sm); }
.btn-block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* Sticky action bar keeps the primary action in thumb reach on a phone. */
.sticky-actions {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  margin: var(--sp-5) calc(var(--sp-4) * -1) 0;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg-page) 60%, rgba(10,13,20,0));
  display: flex; gap: var(--sp-3); z-index: 20;
}
.sticky-actions .btn { flex: 1; }
@media (min-width: 900px) {
  .sticky-actions { position: static; margin: var(--sp-5) 0 0; padding: 0; background: none; }
  .sticky-actions .btn { flex: 0 0 auto; min-width: 180px; }
}

/* ==========================================================================
   Forms
   ========================================================================== */
.field { margin-bottom: var(--sp-4); }
.field > label, .field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 6px;
}
.field-hint { font-size: 12px; color: var(--ink-muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px var(--sp-3);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow);
}
.input::placeholder { color: #59617A; }
.input-price { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.textarea { min-height: 80px; resize: vertical; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--critical); }
.field-error {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 6px; font-size: 13px; color: var(--critical);
}
.field-error svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; }

/* Segmented control — direction, plan followed */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 54px; padding: 0 var(--sp-3);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r-md); font-weight: 650; cursor: pointer;
  transition: all .15s var(--ease);
}
.segmented label svg { width: 18px; height: 18px; }
.segmented input:checked + label { background: var(--brand); border-color: var(--brand); color: var(--bg-page); }
.segmented input:focus-visible + label { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.segmented.tone-good  input:checked + label { background: var(--good);     border-color: var(--good); }
.segmented.tone-bad   input:checked + label { background: var(--critical); border-color: var(--critical); }

/* Reason picker — five full-width buttons. The two self-indicting answers wear
   warning colours so that choosing one is a felt act. This is the product's
   core mechanic rendered in CSS. */
.reasons { display: grid; gap: var(--sp-2); }
.reasons input { position: absolute; opacity: 0; pointer-events: none; }
.reasons label {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: 0 var(--sp-3);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r-md); font-weight: 600; cursor: pointer;
  transition: all .15s var(--ease);
}
.reasons label .r-ico {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--bg-raised); color: var(--ink-2);
}
.reasons label .r-ico svg { width: 16px; height: 16px; }
.reasons input:checked + label { background: var(--brand); border-color: var(--brand); color: var(--bg-page); }
.reasons input:checked + label .r-ico { background: rgba(10,13,20,.22); color: var(--bg-page); }
.reasons .tone-warning label   { border-color: rgba(233,169,60,.32); }
.reasons .tone-warning label .r-ico { color: var(--warning); }
.reasons .tone-critical label  { border-color: rgba(239,90,111,.32); }
.reasons .tone-critical label .r-ico { color: var(--critical); }
.reasons .tone-warning input:checked + label  { background: var(--warning);  border-color: var(--warning); }
.reasons .tone-critical input:checked + label { background: var(--critical); border-color: var(--critical); }
.reasons input:focus-visible + label { outline: 2px solid var(--brand-text); outline-offset: 2px; }

/* Chip rows — setups, lot-size shortcuts, filters */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chip, .chips label {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 var(--sp-3);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r-pill); font-size: 14px; font-weight: 600;
  cursor: pointer; color: var(--ink-2); text-decoration: none;
  transition: all .15s var(--ease);
}
.chips label:hover, a.chip:hover { color: var(--ink); border-color: var(--border-strong); text-decoration: none; }
.chips input:checked + label { background: var(--brand); border-color: var(--brand); color: var(--bg-page); }
.chips input:focus-visible + label { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--bg-page); }
.chip-static { cursor: default; }

/* Live risk strip — the reason the entry form is worth opening. */
.risk-strip {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.risk-strip .rs-main { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.risk-strip .rs-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-muted); }
.risk-strip .rs-side { text-align: right; font-size: 14px; font-weight: 600; }
.risk-strip.is-ok     { border-color: rgba(53,199,122,.45);  background: var(--good-dim); }
.risk-strip.is-warn   { border-color: rgba(233,169,60,.45);  background: var(--warning-dim); }
.risk-strip.is-danger { border-color: rgba(239,90,111,.5);   background: var(--critical-dim); }
.risk-strip.is-ok     .rs-main { color: var(--good); }
.risk-strip.is-warn   .rs-main { color: var(--warning); }
.risk-strip.is-danger .rs-main { color: var(--critical); }

/* ==========================================================================
   Flash messages — every form has a visible error AND success path
   ========================================================================== */
.flashes { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.flash {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--bg-card); font-size: 14px;
  animation: flash-in .3s var(--ease) both;
}
.flash svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.flash-success { border-color: rgba(53,199,122,.4);  background: var(--good-dim);     color: #b9f0d2; }
.flash-error   { border-color: rgba(239,90,111,.45); background: var(--critical-dim); color: #ffc9d1; }
.flash-info    { border-color: var(--border-strong); }
.flash-success svg { color: var(--good); }
.flash-error svg   { color: var(--critical); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.error-summary {
  border: 1px solid rgba(239,90,111,.45); background: var(--critical-dim);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
}
.error-summary h2 { font-size: 14px; color: #ffc9d1; margin-bottom: 6px; }
.error-summary ul { margin: 0; padding-left: 18px; font-size: 13px; color: #ffc9d1; }

/* ==========================================================================
   Empty states — designed, never a blank grid
   ========================================================================== */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); }
.empty img, .empty svg.illus { width: min(230px, 70%); height: auto; margin: 0 auto var(--sp-4); display: block; }
.empty h2 { margin-bottom: var(--sp-2); }
.empty p { color: var(--ink-muted); max-width: 42ch; margin-left: auto; margin-right: auto; }
.empty .actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-4); }

/* Low-sample honesty: below the threshold the app must not perform false
   precision. Statistical panels are muted and carry a notice. */
.low-sample {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  font-size: 12px; color: var(--ink-muted);
  border-top: 1px dashed var(--border-strong); padding-top: var(--sp-2); margin-top: var(--sp-3);
}
.low-sample svg { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 2px; }
.is-low-confidence .tile-value,
.is-low-confidence .ring-value,
.is-low-confidence .big { opacity: .72; }

/* ==========================================================================
   Tables & lists
   ========================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); }
.table { font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-muted); font-weight: 600; padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s var(--ease); }
.table tbody tr:hover { background: var(--bg-sunken); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Trade rows on mobile read as cards, not a squeezed table. */
.trade-list { display: grid; gap: var(--sp-2); }
.trade-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); color: inherit; text-decoration: none;
  transition: transform .12s var(--ease), border-color .15s var(--ease);
}
.trade-row:hover { transform: translateY(-1px); border-color: var(--border-strong); text-decoration: none; }
.trade-row .dir {
  width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.trade-row .dir.long  { background: var(--good-dim);     color: var(--good); }
.trade-row .dir.short { background: var(--critical-dim); color: var(--critical); }
.trade-row .meta { font-size: 12px; color: var(--ink-muted); }
.trade-row .r { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trade-row .r.win  { color: var(--good); }
.trade-row .r.loss { color: var(--critical); }
.trade-row .r.be   { color: var(--ink-muted); }
.trade-row .r.open { color: var(--brand-text); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
  background: var(--bg-sunken); color: var(--ink-2); border: 1px solid var(--border);
}
.badge svg { width: 12px; height: 12px; }
.badge.good     { background: var(--good-dim);     color: var(--good);     border-color: rgba(53,199,122,.35); }
.badge.warning  { background: var(--warning-dim);  color: var(--warning);  border-color: rgba(233,169,60,.35); }
.badge.critical { background: var(--critical-dim); color: var(--critical); border-color: rgba(239,90,111,.35); }
.badge.brand    { background: rgba(110,124,238,.16); color: var(--brand-text); border-color: rgba(110,124,238,.35); }

/* ==========================================================================
   Charts (server-rendered inline SVG; no library, works with JS off)
   ========================================================================== */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-text { fill: var(--ink-muted); font-size: 10px; font-family: var(--font); }
.chart .zero-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .bar-pos { fill: var(--good); }
.chart .bar-neg { fill: var(--critical); }
.chart .bar-zero { fill: var(--ink-muted); }
.chart .line-path { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-path { fill: url(#equityFill); }
.chart .label-text { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.chart .label-value { fill: var(--ink); font-size: 11px; font-weight: 600; font-family: var(--font); font-variant-numeric: tabular-nums; }

/* Breakdown bars — sorted worst-first, because the goal is finding the leak. */
.breakdown { display: grid; gap: var(--sp-2); }
.breakdown-row { display: grid; grid-template-columns: 96px 1fr 64px; align-items: center; gap: var(--sp-3); font-size: 13px; }
.breakdown-row .bd-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breakdown-row .bd-track { position: relative; height: 22px; background: var(--bg-sunken); border-radius: 4px; overflow: hidden; }
.breakdown-row .bd-mid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.breakdown-row .bd-fill { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; }
.breakdown-row .bd-fill.pos { background: var(--good); }
.breakdown-row .bd-fill.neg { background: var(--critical); }
.breakdown-row .bd-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.breakdown-row .bd-value.pos { color: var(--good); }
.breakdown-row .bd-value.neg { color: var(--critical); }
@media (max-width: 420px) { .breakdown-row { grid-template-columns: 78px 1fr 56px; gap: var(--sp-2); } }

/* Hour-of-day density strip — sequential indigo ramp */
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.hours i { display: block; aspect-ratio: 1/2; border-radius: 2px; background: var(--seq, #1B2140); }
.hours-axis { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; margin-top: 4px; font-size: 9px; color: var(--ink-muted); text-align: center; }

/* ==========================================================================
   Screenshots
   ========================================================================== */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-3); }
.shot { position: relative; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: var(--bg-sunken); }
.shot img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.shot .shot-tags { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; }
.shot .shot-tags .badge { backdrop-filter: blur(6px); background: rgba(10,13,20,.72); }
.shot .shot-del { position: absolute; top: 6px; right: 6px; }
.shot-full { display: block; width: 100%; border-radius: var(--r-md); border: 1px solid var(--border); }

.upload-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 104px; padding: var(--sp-4);
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--bg-sunken); color: var(--ink-muted); cursor: pointer; text-align: center;
  transition: all .15s var(--ease);
}
.upload-drop:hover { border-color: var(--brand); color: var(--ink-2); }
.upload-drop svg { width: 26px; height: 26px; }
.upload-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: var(--sp-2); margin-top: var(--sp-2); }
.upload-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); }

/* ==========================================================================
   Review
   ========================================================================== */
.grades { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-2); }
.grades input { position: absolute; opacity: 0; pointer-events: none; }
.grades label {
  display: grid; place-items: center; min-height: 52px;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 19px; font-weight: 700; cursor: pointer; transition: all .15s var(--ease);
}
.grades input:checked + label { background: var(--brand); border-color: var(--brand); color: var(--bg-page); }
.grades input:focus-visible + label { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.review-progress { display: flex; gap: 4px; margin-bottom: var(--sp-4); }
.review-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-sunken); }
.review-progress i.done { background: var(--good); }
.review-progress i.current { background: var(--brand); }

/* ==========================================================================
   Login — the only public surface
   ========================================================================== */
.page-auth {
  min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-5) var(--sp-4);
  background:
    radial-gradient(680px 420px at 50% -8%, rgba(110,124,238,.20), transparent 62%),
    radial-gradient(520px 340px at 88% 106%, rgba(53,199,122,.10), transparent 60%),
    var(--bg-page);
  position: relative; overflow: hidden;
}
.auth-card {
  position: relative; z-index: 2;
  width: min(420px, 100%);
  background: rgba(19,24,38,.86); backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); border-radius: 18px;
  padding: var(--sp-6) var(--sp-5); box-shadow: var(--shadow-2);
}
.auth-card .auth-illus { width: 132px; height: 132px; margin: 0 auto var(--sp-4); display: block; }
.auth-card h1 { font-size: 24px; text-align: center; }
.auth-card .auth-sub { text-align: center; color: var(--ink-muted); font-size: 14px; margin-bottom: var(--sp-5); }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(46px); opacity: .5; z-index: 1; }
.auth-blob.b1 { width: 260px; height: 260px; background: rgba(110,124,238,.34); top: -60px; left: -70px; animation: drift 17s ease-in-out infinite; }
.auth-blob.b2 { width: 210px; height: 210px; background: rgba(53,199,122,.20); bottom: -70px; right: -60px; animation: drift 21s ease-in-out infinite reverse; }
@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(26px,-20px) scale(1.09); }
}
.auth-foot { margin-top: var(--sp-4); text-align: center; font-size: 12px; color: var(--ink-muted); }
.check-row { display: flex; align-items: center; gap: var(--sp-2); font-size: 14px; color: var(--ink-2); }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Error pages */
.page-error { display: grid; place-items: center; min-height: 100dvh; padding: var(--sp-5); text-align: center; }
.error-shell .error-code { font-size: 60px; font-weight: 700; color: var(--brand-dim); line-height: 1; margin: 0 0 var(--sp-2); }
.error-shell h1 { margin-bottom: var(--sp-2); }
.error-shell .btn { margin-top: var(--sp-4); }

/* iOS install banner */
.install-banner {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--bg-card); font-size: 13px; color: var(--ink-2);
}
.install-banner svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--brand-text); }
.install-banner button { background: none; border: 0; color: var(--ink-muted); cursor: pointer; padding: 4px; }

/* ==========================================================================
   Motion — reveal + page transitions. Always behind prefers-reduced-motion.
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity .45s var(--ease), transform .45s var(--ease); }

body { transition: opacity .18s var(--ease), transform .18s var(--ease); }
body.is-leaving { opacity: 0; transform: translateY(-8px); }

.ring-arc { transition: stroke-dashoffset .6s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  body.is-leaving { opacity: 1; transform: none; }
}
