/* ═══════════════════════════════════════════════════════════════════════
   MIRRA · Echo design system
   ───────────────────────────────────────────────────────────────────────
   MIRRA's original black / charcoal canvas and electric-green identity,
   paired with Echo's updated typography, spacing and soft depth.

   Two rules that are not stylistic and must not be relaxed:

   1. Green is both the MIRRA brand accent and the positive P&L colour. A
      value's sign or a written state must always carry the meaning as well.
   2. Green and red separate at only ΔE ~4–5 under deuteranopia, far below
      the ΔE 8 floor, so colour may never be the ONLY carrier of meaning.
      Every monetary figure ships a +/− sign (.pos/.neg add it via content
      where the value is not pre-signed) and every state chip ships a word.

   Load after nothing else — this file owns the page.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── tokens ────────────────────────────────────────────────────────────── */
:root {
  --paper:  #F5F7F6;
  --card:   #FFFFFF;
  --sand:   #EDF1EF;
  --line:   #E0E6E2;
  --line-2: #C9D3CD;
  --ink:    #090C0A;
  --ink-2:  #59635E;
  --ink-3:  #87928C;

  --accent:      #007A41;
  --accent-soft: rgba(0,122,65,.10);
  --accent-ink:  #FFFFFF;
  /* Compatibility aliases used by the redesigned page templates. */
  --honey:       var(--accent);
  --honey-soft:  var(--accent-soft);
  --green:       #007A41;
  --green-soft:  rgba(0,122,65,.10);
  --red:         #D3113A;
  --red-soft:    rgba(211,17,58,.10);
  --blue:        #245AE6;
  --blue-soft:   rgba(36,90,230,.10);
  --warning:     #B45309;
  --warning-soft: rgba(180,83,9,.11);

  --sh-sm: 0 1px 2px rgba(0,0,0,.05);
  --sh:    0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.06);
  --sh-lg: 0 2px 4px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.09);
  --sh-xl: 0 4px 8px rgba(0,0,0,.06), 0 24px 60px rgba(0,0,0,.14);
  --ring:  inset 0 0 0 1px var(--line);

  --r-xs: 7px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 18px;
  --r-xl: 26px;

  --sans:  "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono:  "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease:   cubic-bezier(.22, 1, .36, 1);

  --side:  228px;
  --rail:  316px;
  --top-h: 62px;
}

[data-theme="dark"] {
  --paper:  #050505;
  --card:   #0E0E0E;
  --sand:   #151515;
  --line:   rgba(255,255,255,.065);
  --line-2: rgba(255,255,255,.12);
  --ink:    #FFFFFF;
  --ink-2:  #A0A0A0;
  --ink-3:  #666666;

  --accent:      #00E676;
  --accent-soft: rgba(0,230,118,.10);
  --accent-ink:  #031008;
  --honey:       var(--accent);
  --honey-soft:  var(--accent-soft);
  --green:       #00E676;
  --green-soft:  rgba(0,230,118,.10);
  --red:         #FF1744;
  --red-soft:    rgba(255,23,68,.11);
  --blue:        #2962FF;
  --blue-soft:   rgba(41,98,255,.12);
  --warning:     #FF9100;
  --warning-soft: rgba(255,145,0,.11);

  --sh-sm: 0 1px 2px rgba(0,0,0,.3);
  --sh:    0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.28);
  --sh-lg: 0 2px 4px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.36);
  --sh-xl: 0 4px 8px rgba(0,0,0,.3), 0 24px 60px rgba(0,0,0,.46);
}

/* ── reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .4s var(--ease), color .4s var(--ease);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
svg { display: block; }
img { max-width: 100%; }
::selection { background: var(--honey-soft); color: var(--ink); }

h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* subtle surface grain — enough texture to keep the dark canvas tactile */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: .3; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .12; }

/* ── type helpers ──────────────────────────────────────────────────────── */
.fig { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.muted  { color: var(--ink-2); }
.muted-2 { color: var(--ink-3); }

/* P&L semantics — colour is the second signal, never the first */
.pos { color: var(--green); }
.neg { color: var(--red); }

/* privacy mode blurs money and nothing else */
body.private .money { filter: blur(7px); user-select: none; }

/* ── app shell ─────────────────────────────────────────────────────────── */
.echo-app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }

.echo-side {
  position: sticky; top: 0; height: 100vh; z-index: 60;
  display: flex; flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.echo-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.echo-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  color: var(--accent);
}
.echo-mark img { width: 100%; height: 100%; object-fit: contain; }
.echo-wordmark { font-size: 14.5px; font-weight: 600; letter-spacing: .18em; }

.nav-group { font-size: 11px; font-weight: 500; color: var(--ink-3); padding: 14px 8px 8px; letter-spacing: .04em; }
.nav-group:first-of-type { padding-top: 0; }

.nav-i {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin-bottom: 1px;
  border-radius: var(--r-sm);
  font-size: 14px; color: var(--ink-2);
  transition: background .18s, color .18s;
}
.nav-i i, .nav-i svg { flex: none; width: 16px; font-size: 14px; text-align: center; opacity: .85; }
.nav-i:hover { background: var(--sand); color: var(--ink); }
.nav-i.active {
  background: var(--card); color: var(--ink); font-weight: 500;
  box-shadow: var(--ring), var(--sh-sm);
}
.nav-i .tail { margin-left: auto; }

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }

.echo-me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); transition: background .18s; }
.echo-me:hover { background: var(--sand); }
.echo-me-av {
  width: 30px; height: 30px; border-radius: 999px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: var(--honey-soft); color: var(--honey);
  font-size: 12px; font-weight: 600;
}
.echo-me-av img { width: 100%; height: 100%; object-fit: cover; }
.echo-me-n { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.echo-me-p { font-size: 11.5px; color: var(--ink-3); }

/* ── topbar ────────────────────────────────────────────────────────────── */
.echo-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--top-h); padding: 0 26px;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.echo-top h1 { font-size: 19px; font-weight: 600; letter-spacing: -.03em; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.ibtn {
  position: relative;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-2);
  transition: background .18s, color .18s, transform .3s var(--spring);
}
.ibtn:hover { background: var(--sand); color: var(--ink); }
.ibtn:active { transform: scale(.92); }
.ibtn.on { color: var(--honey); background: var(--honey-soft); }
.ibtn .badge {
  position: absolute; top: 5px; right: 5px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 600; line-height: 15px; text-align: center;
  box-shadow: 0 0 0 2px var(--paper);
}
.ibtn .moon { display: none; }
[data-theme="dark"] .ibtn .sun { display: none; }
[data-theme="dark"] .ibtn .moon { display: block; }

.vdiv { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.echo-content { padding: 24px 26px 60px; }
.echo-content.narrow { max-width: 980px; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: transform .28s var(--spring), box-shadow .28s var(--ease), background .18s, color .18s;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[disabled] { opacity: .45; pointer-events: none; }

.btn-ink    { background: var(--accent); color: var(--accent-ink); box-shadow: var(--sh-sm); }
.btn-ink:hover { box-shadow: var(--sh); }
.btn-soft   { background: var(--card); box-shadow: var(--ring), var(--sh-sm); }
.btn-soft:hover { background: var(--sand); }
.btn-ghost  { color: var(--ink-2); }
.btn-ghost:hover { background: var(--sand); color: var(--ink); }
.btn-danger { color: var(--red); background: var(--red-soft); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 18%, transparent); }
.btn-honey  { color: var(--honey); background: var(--honey-soft); }
.btn-honey:hover { background: color-mix(in srgb, var(--honey) 20%, transparent); }

.btn-sm { height: 29px; padding: 0 11px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; border-radius: var(--r); }
.btn-block { width: 100%; }

/* ── chips & badges ────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.chip-green { color: var(--green); background: var(--green-soft); }
.chip-red   { color: var(--red);   background: var(--red-soft); }
.chip-honey { color: var(--honey); background: var(--honey-soft); }
.chip-blue  { color: var(--blue);  background: var(--blue-soft); }
.chip-soft  { color: var(--ink-2); background: var(--sand); }

.beacon { width: 6px; height: 6px; border-radius: 50%; background: currentColor; position: relative; flex: none; }
.beacon::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0;
  animation: beacon 2.6s var(--ease) infinite;
}
@keyframes beacon {
  0% { opacity: .7; transform: scale(.5); }
  70%, 100% { opacity: 0; transform: scale(1.5); }
}

/* environment badge — LIVE money vs DEMO */
.env {
  height: 17px; padding: 0 6px; border-radius: 5px;
  display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 600; letter-spacing: .06em;
}
.env-demo { background: var(--sand); color: var(--ink-2); }
.env-live { background: var(--honey-soft); color: var(--honey); }

/* ── cards ─────────────────────────────────────────────────────────────── */
.card {
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--ring), var(--sh);
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-h h2, .card-h h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.card-h .r { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.card-b { padding: 18px; }

.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h h2 { font-size: 20px; }
.page-h .r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.section-lbl {
  font-size: 11.5px; font-weight: 500; color: var(--ink-3);
  letter-spacing: .04em; margin-bottom: 10px;
}

/* ── stat tiles ────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.tiles.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.tiles.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.tiles.c5 { grid-template-columns: repeat(5, minmax(0,1fr)); }

.tile {
  padding: 15px 17px;
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--ring), var(--sh-sm);
  transition: transform .32s var(--ease), box-shadow .32s var(--ease);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--ring), var(--sh); }
.tile .k { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.tile .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 23px; font-weight: 500; letter-spacing: -.04em; margin-top: 5px; }
.tile .d { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

/* ── tables ────────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .18s; }
.tbl tbody tr:hover { background: var(--sand); }
.tbl .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 500; letter-spacing: -.02em; }
.tbl-wrap { overflow-x: auto; }

.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--ink); }

/* account identity cell */
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--sand); color: var(--ink-2);
}
.who-ic.lead { background: var(--honey-soft); color: var(--honey); }
.who-n { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-m { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

/* ── multiplier stepper ────────────────────────────────────────────────── */
.mult { display: inline-flex; align-items: center; gap: 1px; padding: 2px; border-radius: 9px; background: var(--sand); }
.mult button {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; color: var(--ink-2);
  font-size: 14px; line-height: 1;
  transition: background .16s, color .16s;
}
.mult button:hover { background: var(--card); color: var(--ink); box-shadow: var(--sh-sm); }
.mult input, .mult .n {
  width: 34px; min-width: 34px; text-align: center; border: none; background: none;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  -moz-appearance: textfield; appearance: textfield;
}
.mult input::-webkit-outer-spin-button, .mult input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mult input:focus { outline: none; }

/* ── gauges ────────────────────────────────────────────────────────────── */
.gauge { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.gauge:last-child { border-bottom: 0; }
.gauge-r { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 9px; }
.gauge-r .fig { color: var(--ink-2); font-size: 12px; }
.gauge-b { height: 8px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--ink) 9%, transparent); }
.gauge-f { display: block; height: 100%; border-radius: 999px; background: var(--green); width: 0; transition: width 1.3s var(--ease); }
.gauge-f.honey { background: var(--honey); }
.gauge-f.red   { background: var(--red); }

/* ── forms ─────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label, .lbl { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--card); border: none;
  box-shadow: var(--ring), var(--sh-sm);
  font-size: 14px; outline: none;
  transition: box-shadow .2s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  box-shadow: 0 0 0 1px var(--honey), 0 0 0 3px var(--honey-soft);
}
.select { appearance: none; background-image: none; cursor: pointer; }

.switch { position: relative; display: inline-flex; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line-2); transition: background .25s var(--ease); cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-sm);
  transition: transform .3s var(--spring);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(17px); }

/* segmented control */
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--sand); }
.seg button {
  height: 26px; min-width: 30px; padding: 0 10px; border-radius: 7px;
  display: inline-grid; place-items: center; color: var(--ink-3);
  font-size: 12.5px; font-weight: 500;
  transition: background .18s, color .18s;
}
.seg button.active, .seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh-sm); }

/* ── activity feed ─────────────────────────────────────────────────────── */
.feed { padding: 6px 0; }
.ev { display: flex; gap: 11px; padding: 10px 18px; }
.ev-ic {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 11px;
  background: var(--sand); color: var(--ink-2);
}
.ev-ic.g { background: var(--green-soft); color: var(--green); }
.ev-ic.r { background: var(--red-soft); color: var(--red); }
.ev-ic.h { background: var(--honey-soft); color: var(--honey); }
.ev-t { font-size: 13px; line-height: 1.4; }
.ev-t b { font-weight: 500; }
.ev-m { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

/* ── empty state ───────────────────────────────────────────────────────── */
.empty { padding: 48px 24px; text-align: center; }
.empty-ic {
  width: 46px; height: 46px; border-radius: 15px; margin: 0 auto 16px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--sand); color: var(--ink-3);
}
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; color: var(--ink-2); max-width: 42ch; margin: 0 auto 16px; }

/* ── demo banner ───────────────────────────────────────────────────────── */
.demo-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px;
  border-radius: var(--r); background: var(--honey-soft);
}
.demo-banner-ic {
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 12px;
  background: var(--card); color: var(--honey);
}
.demo-banner-text { flex: 1 1 260px; font-size: 13px; color: var(--ink-2); }

/* ── flash messages ────────────────────────────────────────────────────── */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: var(--r-sm);
  font-size: 13.5px;
  background: var(--card); box-shadow: var(--ring), var(--sh-sm);
}
.flash.success { background: var(--green-soft); color: var(--green); box-shadow: none; }
.flash.error, .flash.danger { background: var(--red-soft); color: var(--red); box-shadow: none; }
.flash.warning { background: var(--warning-soft); color: var(--warning); box-shadow: none; }

/* ── value flash on live tick ──────────────────────────────────────────── */
@keyframes flashUp   { 0% { background: var(--green-soft); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: var(--red-soft);   } 100% { background: transparent; } }
.tick-up   { animation: flashUp   .9s var(--ease); }
.tick-down { animation: flashDown .9s var(--ease); }

/* ── toasts ────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 400;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r);
  background: var(--card); box-shadow: var(--ring), var(--sh-lg);
  animation: toastIn .34s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.toast-ic {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 12px;
  background: var(--sand); color: var(--ink-2);
}
.toast-success .toast-ic { background: var(--green-soft); color: var(--green); }
.toast-error   .toast-ic { background: var(--red-soft);   color: var(--red); }
.toast-warning .toast-ic { background: var(--warning-soft); color: var(--warning); }
.toast-t { font-size: 13.5px; font-weight: 500; }
.toast-m { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.toast-x { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.toast-x:hover { color: var(--ink); }

/* ── modals ────────────────────────────────────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-back.open { display: flex; }
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  border-radius: var(--r-xl);
  background: var(--card); box-shadow: var(--sh-xl);
  animation: modalIn .34s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 16px; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 22px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ── charts ────────────────────────────────────────────────────────────── */
.chart-stage { position: relative; }
.chart-stage svg { width: 100%; height: auto; overflow: visible; }
.grid-l { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; }
.ax { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 4;
  padding: 8px 11px; border-radius: var(--r-sm);
  background: #0A0A0A; color: #FFFFFF;
  font-size: 12px; white-space: nowrap;
  opacity: 0; transition: opacity .15s;
  transform: translate(-50%, -124%);
  box-shadow: var(--sh-lg);
}
.chart-tip .d { opacity: .6; font-size: 11px; }
.chart-tip .v { font-family: var(--mono); font-weight: 500; font-size: 14px; }

/* calendar heatmap */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-d {
  aspect-ratio: 1; border-radius: var(--r-xs);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--sand); font-size: 11px; color: var(--ink-3);
  transition: transform .25s var(--spring);
}
.cal-d:hover { transform: scale(1.07); }
.cal-d .n { font-family: var(--mono); font-size: 10px; }
.cal-d.win  { background: var(--green-soft); color: var(--green); }
.cal-d.loss { background: var(--red-soft); color: var(--red); }

/* ── utilities ─────────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; }
.cols-rail { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); gap: 18px; align-items: start; }
.rail-sticky { position: sticky; top: calc(var(--top-h) + 24px); display: flex; flex-direction: column; gap: 18px; }
.mb-0 { margin-bottom: 0; } .mb-12 { margin-bottom: 12px; } .mb-18 { margin-bottom: 18px; } .mb-24 { margin-bottom: 24px; }
.hide { display: none !important; }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .cols-rail { grid-template-columns: 1fr; }
  .rail-sticky { position: static; }
  .tiles, .tiles.c5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .echo-app { grid-template-columns: 1fr; }
  .echo-side {
    position: fixed; inset: 0 auto 0 0; width: 268px;
    transform: translateX(-100%); transition: transform .34s var(--ease);
    box-shadow: var(--sh-xl);
  }
  body.nav-open .echo-side { transform: none; }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,.62);
  }
  .echo-content { padding: 18px 16px 44px; }
  .echo-top { padding: 0 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: grid !important; }
}
@media (max-width: 620px) {
  .tiles, .tiles.c2, .tiles.c3, .tiles.c5 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
}

.nav-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
