/* ==========================================================================
   Skelo Portal design system
   --------------------------------------------------------------------------
   One stylesheet, one set of tokens.  Every colour, radius and spacing step
   used anywhere in the portal is declared here, so admin pages, customer pages
   and the public site cannot drift apart.

   Palette intent: near-black institutional ground, a single cool accent, and
   four status hues that carry meaning and nothing else.
   ========================================================================== */

:root {
  /* --- surfaces --- */
  --bg:            #0a0c10;
  --bg-elevated:   #10141b;
  --surface:       #141922;
  --surface-hover: #1a212c;
  --border:        #232b38;
  --border-strong: #303a4a;

  /* --- text --- */
  --text:          #e6ebf2;
  --text-muted:    #8b97a8;
  --text-faint:    #5d687a;

  /* --- accent --- */
  --accent:        #E2BC72;
  --accent-hover:  #F0CF92;
  --accent-dim:    rgba(226, 188, 114, 0.10);
  --accent-line:   rgba(226, 188, 114, 0.42);

  /* --- status --- */
  --ok:     #35c88a;
  --ok-bg:  rgba(53, 200, 138, 0.12);
  --warn:   #e0a33c;
  --warn-bg: rgba(224, 163, 60, 0.12);
  --error:  #e5545f;
  --error-bg: rgba(229, 84, 95, 0.12);
  --idle:   #6b7688;
  --idle-bg: rgba(107, 118, 136, 0.12);

  /* --- type --- */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas,
          "Liberation Mono", monospace;

  /* --- geometry --- */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 72px;

  --shell: 1220px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 var(--sp-4); }

code, .mono { font-family: var(--mono); font-size: 0.87em; }

.shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding: 0 var(--sp-5); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 650;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  flex: none;
}
.brand-sub {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.8rem;
  padding-left: var(--sp-2);
  border-left: 1px solid var(--border-strong);
  margin-left: var(--sp-1);
}

.nav-links { display: flex; align-items: center; gap: var(--sp-1); margin-left: auto; }
.nav-links a, .nav-links button {
  display: inline-block;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--surface-hover); }
.nav-links a.active { color: var(--text); background: var(--surface); }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  font-size: 0.9rem;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page { padding: var(--sp-6) 0 var(--sp-8); }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.page-head h1 { margin: 0; }
.page-head .lede { color: var(--text-muted); margin: var(--sp-1) 0 0; }

.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: var(--sp-5); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* ==========================================================================
   Cards and stat tiles
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-title {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 var(--sp-2);
}

.stat { display: flex; flex-direction: column; gap: var(--sp-1); }
.stat-value {
  font-size: 1.9rem;
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value.na { color: var(--text-faint); font-size: 1.1rem; font-weight: 500; letter-spacing: 0; }
.stat-note { color: var(--text-faint); font-size: 0.82rem; }

/* ==========================================================================
   Status badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok    { color: var(--ok);    background: var(--ok-bg); }
.badge.warn  { color: var(--warn);  background: var(--warn-bg); }
.badge.error { color: var(--error); background: var(--error-bg); }
.badge.idle  { color: var(--idle);  background: var(--idle-bg); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  position: sticky; top: 0;
  background: var(--bg-elevated);
  text-align: left;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.pos { color: var(--ok); }
.neg { color: var(--error); }

/* ==========================================================================
   Empty states
   ========================================================================== */

.empty {
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.empty-title { color: var(--text); font-weight: 560; margin-bottom: var(--sp-1); }
.empty-note { font-size: 0.88rem; color: var(--text-faint); margin: 0; }

/* ==========================================================================
   Buttons and forms
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--accent-line); color: var(--text); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06090f;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #06090f; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-danger { color: var(--error); border-color: rgba(229, 84, 95, 0.4); }
.btn-danger:hover { background: var(--error-bg); border-color: var(--error); color: var(--error); }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--text-muted); padding: var(--sp-2) var(--sp-3); cursor: pointer; font: inherit; font-size: 0.9rem; }
.btn-link:hover { color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.field label { font-size: 0.82rem; font-weight: 550; color: var(--text-muted); }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder { color: var(--text-faint); }
.checkbox { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: 0.88rem; }
.checkbox input { width: auto; }

.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: var(--sp-4);
  border: 1px solid;
}
.alert-error { color: var(--error); background: var(--error-bg); border-color: rgba(229, 84, 95, 0.3); }
.alert-warn  { color: var(--warn);  background: var(--warn-bg);  border-color: rgba(224, 163, 60, 0.3); }
.alert-ok    { color: var(--ok);    background: var(--ok-bg);    border-color: rgba(53, 200, 138, 0.3); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: flex-end;
  padding: var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
}
.filters .field { margin-bottom: 0; min-width: 150px; flex: 1 1 150px; }

/* ==========================================================================
   Definition lists (account / detail pages)
   ========================================================================== */

.dl { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: var(--sp-3) var(--sp-5); margin: 0; font-size: 0.9rem; }
.dl dt { color: var(--text-faint); }
.dl dd { margin: 0; }

/* ==========================================================================
   Public landing page
   ========================================================================== */

.hero { position: relative; overflow: hidden; padding: var(--sp-8) 0 var(--sp-7); border-bottom: 1px solid var(--border); }
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 20% auto -10%;
  height: 520px;
  background: radial-gradient(ellipse at center, rgba(226, 188, 114, 0.10), transparent 65%);
  pointer-events: none;
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: var(--sp-7); align-items: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-4);
}
.eyebrow::before { content: ""; width: 20px; height: 1px; background: var(--accent-line); }
.hero h1 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.5rem); margin-bottom: var(--sp-4); }
.hero .lede { font-size: clamp(1rem, 0.95rem + 0.3vw, 1.12rem); color: var(--text-muted); max-width: 52ch; margin-bottom: var(--sp-5); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.section { padding: var(--sp-8) 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 62ch; margin-bottom: var(--sp-6); }
.section-head .lede { color: var(--text-muted); margin: 0; }

.feature {
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.feature h3 { font-size: 0.98rem; margin-bottom: var(--sp-2); }
.feature p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.feature-mark {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  margin-bottom: var(--sp-4);
}

.disclaimer {
  border-left: 2px solid var(--border-strong);
  padding-left: var(--sp-4);
  color: var(--text-faint);
  font-size: 0.85rem;
  max-width: 70ch;
}

.footer { border-top: 1px solid var(--border); padding: var(--sp-6) 0; color: var(--text-faint); font-size: 0.85rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between; align-items: center; }
.locale-switcher { display:flex; align-items:center; gap:6px; margin-left:auto; color:var(--text-faint); font:600 .75rem var(--mono); }
.locale-switcher button { appearance:none; border:0; background:transparent; color:var(--text-faint); padding:4px; cursor:pointer; font:inherit; }
.locale-switcher button.active, .locale-switcher button:hover { color:var(--accent); }

/* --- animated chart figure ------------------------------------------------ */

.hero-figure {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface), var(--bg-elevated));
  padding: var(--sp-4);
  overflow: hidden;
}
.hero-figure svg { display: block; width: 100%; height: auto; }
.spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: draw 2.6s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.spark-fill { fill: url(#sparkGrad); opacity: 0; animation: fade 1.4s ease 1.5s forwards; }
.grid-line { stroke: var(--border); stroke-width: 0.5; }
.tick-label { fill: var(--text-faint); font-family: var(--mono); font-size: 6px; }
.pulse { fill: var(--accent); animation: pulse 2.4s ease-in-out 2.4s infinite; }

@keyframes draw  { to { stroke-dashoffset: 0; } }
@keyframes fade  { to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; r: 2.4; } 50% { opacity: 0.45; r: 3.6; } }

.terminal {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.9;
  color: var(--text-muted);
}
.terminal .t-key { color: var(--text-faint); }
.terminal .t-ok  { color: var(--ok); }
.terminal .t-dim { color: var(--text-faint); }
.terminal .caret {
  display: inline-block;
  width: 6px; height: 11px;
  background: var(--accent);
  vertical-align: -1px;
  animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Motion is decoration here; honour the user's preference. */
@media (prefers-reduced-motion: reduce) {
  .spark-line { animation: none; stroke-dashoffset: 0; }
  .spark-fill { animation: none; opacity: 1; }
  .pulse, .caret { animation: none; }
}

/* ==========================================================================
   Auth page
   ========================================================================== */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { padding: var(--sp-6); }
.auth-head { text-align: center; margin-bottom: var(--sp-5); }
.auth-head h1 { font-size: 1.4rem; margin-bottom: var(--sp-1); }
.auth-head p { color: var(--text-muted); font-size: 0.88rem; margin: 0; }
.auth-foot { text-align: center; margin-top: var(--sp-5); font-size: 0.84rem; color: var(--text-faint); }

/* ==========================================================================
   Key reveal (shown exactly once)
   ========================================================================== */

.key-reveal {
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin-top: var(--sp-2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: var(--sp-6); }
  .dl { grid-template-columns: 1fr; gap: var(--sp-1) 0; }
  .dl dt { margin-top: var(--sp-3); }
}

@media (max-width: 768px) {
  .shell { padding: 0 var(--sp-4); }
  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--sp-3);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a, .nav-links button { padding: var(--sp-3); text-align: left; }
  .page { padding: var(--sp-5) 0 var(--sp-7); }
  .section { padding: var(--sp-7) 0; }
  .card { padding: var(--sp-4); }
  .stat-value { font-size: 1.6rem; }
  .filters .field { flex-basis: 100%; }
  .brand-sub { display: none; }
}

/* ==========================================================================
   Live dashboard
   ========================================================================== */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--sp-5);
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
}
.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 620;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.kpi-note { font-size: 0.75rem; color: var(--text-faint); }

/* --- freshness indicator ------------------------------------------------- */

.freshness {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.freshness-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--idle);
  flex: none;
}
.freshness.is-live   .freshness-dot { background: var(--ok); animation: pulse-dot 2s ease-in-out infinite; }
.freshness.is-live   { color: var(--ok); }
.freshness.is-delayed .freshness-dot { background: var(--warn); }
.freshness.is-delayed { color: var(--warn); }
.freshness.is-stale  .freshness-dot { background: var(--error); }
.freshness.is-stale  { color: var(--error); }

@keyframes pulse-dot { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .freshness.is-live .freshness-dot { animation: none; }
}

/* --- equity chart -------------------------------------------------------- */

.chart-wrap { position: relative; min-height: 260px; }
.equity-svg { display: block; width: 100%; height: 260px; }
.eq-grid { stroke: var(--border); stroke-width: 1; }
.eq-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.eq-area { fill: url(#eqGrad); }
.eq-stop-top    { stop-color: var(--accent); stop-opacity: 0.22; }
.eq-stop-bottom { stop-color: var(--accent); stop-opacity: 0; }
.equity-svg.rising  .eq-line { stroke: var(--ok); }
.equity-svg.rising  .eq-stop-top { stop-color: var(--ok); }
.equity-svg.rising  .eq-stop-bottom { stop-color: var(--ok); }
.equity-svg.falling .eq-line { stroke: var(--error); }
.equity-svg.falling .eq-stop-top { stop-color: var(--error); }
.equity-svg.falling .eq-stop-bottom { stop-color: var(--error); }

[data-range-buttons] .btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-line);
  color: var(--text);
}

/* --- action buttons ------------------------------------------------------ */

.btn.is-busy { opacity: 0.55; cursor: progress; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 768px) {
  .kpi { padding: var(--sp-3) var(--sp-4); }
  .kpi-value { font-size: 1.25rem; }
  /* Bigger targets on touch: these buttons send real instructions to a
     broker, so a mis-tap has to be hard. */
  [data-positions-table] .btn { padding: 10px 14px; margin-bottom: 4px; }
  .equity-svg { height: 200px; }
}

/* --- deployment precheck panel ------------------------------------------ */
.precheck {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.precheck .badge { margin: 0 4px 4px 0; }
.warn-text { color: var(--warn); }

/* ===========================================================================
   Strategy detail: performance, risk, curves
   Built entirely from the existing tokens - no new palette. The tone is a
   research note, not a trading app: restrained type, generous space, numbers
   that do not shout.
   =========================================================================== */

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.page-head h1 { margin: var(--sp-2) 0 var(--sp-1); }
.back-link { font-size: 0.85rem; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--accent); }
.back-link::before { content: "\2190\00a0"; }
.head-meta { display: flex; align-items: center; gap: var(--sp-2);
             flex-wrap: wrap; color: var(--text-muted); font-size: 0.9rem; }
.head-meta .sep { color: var(--text-faint); }
.head-status { display: flex; gap: var(--sp-2); align-items: center; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border); padding-bottom: var(--sp-3);
}
.panel-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: 0.01em; }
.panel-head .tag {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 2px 10px; white-space: nowrap;
}

/* --- metric cards --- */
.metric-grid, .risk-grid {
  display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.metric {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
}
.metric-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); margin-bottom: 6px;
}
.metric-value {
  font-variant-numeric: tabular-nums; font-size: 1.5rem;
  line-height: 1.15; color: var(--text);
}
.metric-value.faint { font-size: 0.95rem; color: var(--text-faint); }

/* --- curves --- */
.chart-row {
  display: grid; gap: var(--sp-4); margin-top: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.chart-box h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); margin: 0 0 var(--sp-2);
}
.curve {
  width: 100%; height: 190px; display: block;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.curve-line { fill: none; stroke: var(--accent); stroke-width: 1.5;
              vector-effect: non-scaling-stroke; }
.curve-area { fill: var(--accent-dim); stroke: none; }
.curve-drawdown .curve-line { stroke: var(--error); }
.curve-drawdown .curve-area { fill: var(--error-bg); }
.empty-chart {
  height: 190px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); color: var(--text-faint); font-size: 0.85rem;
}

/* --- risk --- */
.risk-form {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding-top: var(--sp-3); border-top: 1px solid var(--border);
}
.risk-form input[type="number"] { width: 120px; font-variant-numeric: tabular-nums; }
.risk-cell { min-width: 210px; }
.risk-facts {
  display: grid; grid-template-columns: auto auto; gap: 2px var(--sp-2);
  margin: 0 0 var(--sp-2); font-size: 0.78rem;
}
.risk-facts dt { color: var(--text-faint); }
.risk-facts dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.risk-limit-form { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* --- notes --- */
.disclaimer {
  margin: var(--sp-4) 0 0; padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: 0.8rem; line-height: 1.5;
}
.notes { color: var(--text-muted); font-size: 0.87rem; line-height: 1.6; }
.table.compact th {
  width: 220px; text-align: left; font-weight: 400; color: var(--text-faint);
  font-size: 0.85rem;
}
.table.compact td { font-size: 0.9rem; }


/* --- backtest import ------------------------------------------------------ */
.release-backtest {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: var(--sp-3); background: var(--bg-elevated);
}
.release-backtest > summary {
  cursor: pointer; padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
}
.release-backtest > summary::-webkit-details-marker { color: var(--text-faint); }
.release-backtest > *:not(summary) { padding: 0 var(--sp-4) var(--sp-4); }
.backtest-form h4 {
  margin: var(--sp-4) 0 var(--sp-2); font-size: 0.9rem;
  color: var(--text-muted);
}
.backtest-form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3);
}
.backtest-form legend {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); padding: 0 var(--sp-2);
}
.field-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.field-grid label, .backtest-form label.wide {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.8rem; color: var(--text-muted);
}
.backtest-form label.wide { margin-top: var(--sp-3); }
.backtest-form textarea { font-family: var(--mono); font-size: 0.8rem; }

/* --- assignment UX -------------------------------------------------------- */
.assign-bar {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) 0 0; margin-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.assign-bar .btn-primary { margin-left: auto; }
.tech-details {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: var(--sp-5); background: var(--bg-elevated);
}
.tech-details > summary {
  cursor: pointer; padding: var(--sp-3) var(--sp-4);
  color: var(--text-muted); font-size: 0.85rem;
}
.tech-details > .card { border: 0; margin: 0; background: transparent; }
.alert.ok-note {
  background: var(--ok-bg); border: 1px solid var(--ok);
  color: var(--text); border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
}
.lifecycle { margin-bottom: var(--sp-4); }
.lifecycle-chain {
  display: flex; flex-wrap: wrap; gap: var(--sp-1);
  list-style: none; margin: 0 0 var(--sp-2); padding: 0;
}
.lifecycle-chain li {
  font-size: 0.75rem; padding: 3px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-faint);
  background: var(--bg-elevated);
}
.lifecycle-chain li.reached {
  border-color: var(--accent-line); color: var(--text);
  background: var(--accent-dim);
}
.lifecycle-chain li + li::before {
  content: "\2192"; margin-right: 8px; color: var(--text-faint);
}

/* --- operational summary -------------------------------------------------- */
.deploy-summary { margin-bottom: var(--sp-5); }
.summary-grid {
  display: grid; gap: var(--sp-5); align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.summary-value { margin: 6px 0 8px; }
.summary-action { display: flex; flex-direction: column; gap: var(--sp-2); }
.summary-action .btn { align-self: flex-start; }
.deploy-summary .tech-details { margin: var(--sp-4) 0 0; }

/* --- market protection ---------------------------------------------------- */
.protection-list { list-style: none; margin: 0; padding: 0; }
.protection-list li {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.protection-list li:last-child { border-bottom: 0; }
.protection-list span { color: var(--text-muted); }

/* ==========================================================================
   Guided activation and the connected-accounts list
   --------------------------------------------------------------------------
   Cards rather than tables throughout. Everything here is something a customer
   reads on a phone while deciding how much of their money to put at risk, and
   a table that scrolls sideways hides exactly the column that matters. The
   grids collapse to a single column on their own, so there is no mobile
   special case to keep in step with the desktop one.
   ========================================================================== */

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-dim), transparent);
  margin-bottom: 24px;
}
.cta h2 { margin: 0 0 6px; }
.cta .lede { margin: 0; }

/* --- step indicator ----------------------------------------------------- */
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 0.86rem;
}
.step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
}
.step.current { color: var(--text); }
.step.current .step-num {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
.step.done { color: var(--text-muted); }
.step.done .step-num { border-color: var(--ok); color: var(--ok); }

/* --- choosing an account ------------------------------------------------ */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.choice-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.choice-card:hover,
.choice-card:focus-visible {
  border-color: var(--accent-line);
  background: var(--surface-hover);
}
.choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.choice-title { font-weight: 600; }
.choice-action { margin-top: 12px; align-self: flex-start; }
.warn-text { color: var(--warn); }

/* --- risk and market options -------------------------------------------- */
.option-row { display: flex; flex-wrap: wrap; gap: 12px; }
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Comfortably past the 44px touch target: these are the controls that set
     risk, and a mis-tap here is expensive. */
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.option:hover { border-color: var(--border-strong); }
.option:focus-within { border-color: var(--accent); }
.option input { accent-color: var(--accent); width: 18px; height: 18px; }
.option.static { cursor: default; justify-content: space-between; }

/* --- connected accounts ------------------------------------------------- */
.account-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.account-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.account-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.account-card-strategies {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 4px;
}
.dl.compact { margin: 0; gap: 4px 14px; }

/* --- notices ------------------------------------------------------------ */
.notice {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.notice.error { border-color: var(--error); background: var(--error-bg); }
.notice.warn  { border-color: var(--warn);  background: var(--warn-bg); }

/* --- buttons ------------------------------------------------------------ */
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent-line); background: var(--surface-hover); }

@media (max-width: 640px) {
  .choice-grid, .option-grid, .account-cards { grid-template-columns: 1fr; }
  .cta { flex-direction: column; align-items: stretch; }
  .cta .btn { width: 100%; text-align: center; }
  .steps { gap: 8px 14px; font-size: 0.8rem; }
}

/* ==========================================================================
   Logged-in area, v2 - compact, one rhythm, phone first.
   --------------------------------------------------------------------------
   Scoped to body.app so the public pages and the sign-in screen are
   untouched. Everything below only changes presentation: spacing, type,
   density and responsive behaviour. No markup contract is altered.
   ========================================================================== */

body.app { font-size: 14px; line-height: 1.5; }
body.app h1 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); letter-spacing: -0.02em; }
body.app h2 { font-size: 1.05rem; letter-spacing: -0.01em; }
body.app h3 { font-size: 0.95rem; }
body.app .shell { max-width: 1160px; padding: 0 var(--sp-4); }

/* header --------------------------------------------------------------- */
body.app .nav-inner { height: 52px; gap: var(--sp-4); }
body.app .brand { font-size: 0.98rem; }
body.app .brand-mark { width: 18px; height: 18px; border-radius: 5px; }
body.app .brand-sub { font-size: 0.78rem; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.app .nav-links a, body.app .nav-links button { padding: 6px 10px; font-size: 0.86rem; }
body.app .nav-links a.active { box-shadow: inset 0 -2px 0 var(--accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: transparent; }

/* page rhythm ------------------------------------------------------------ */
body.app .page { padding: var(--sp-5) 0 var(--sp-7); }
body.app .page-head { margin-bottom: var(--sp-4); gap: var(--sp-3); align-items: flex-end; }
body.app .page-head h1 { margin: 0; }
body.app .page-head .lede { margin: 2px 0 0; font-size: 0.9rem; }
body.app .stack { gap: var(--sp-4); }
body.app .grid { gap: var(--sp-3); }
body.app .section-title { margin: var(--sp-5) 0 var(--sp-3); font-size: 0.95rem; }

/* surfaces: one radius, one border, no shadows --------------------------- */
body.app .card, body.app .panel { padding: var(--sp-4); border-radius: 8px; margin-bottom: var(--sp-4); }
body.app .stack > .card, body.app .stack > .panel, body.app .grid > .card { margin-bottom: 0; }
body.app .card-head, body.app .panel-head { margin-bottom: var(--sp-3); padding-bottom: 0; border-bottom: 0; align-items: center; }
body.app .panel-head h2, body.app .card-head h2, body.app .card-head h3 { font-size: 0.98rem; }
body.app .card-title { font-size: 0.78rem; font-weight: 550; letter-spacing: 0; text-transform: none; color: var(--text-muted); margin-bottom: 4px; }
body.app .panel-head .tag { text-transform: none; letter-spacing: 0; font-size: 0.74rem; }

/* numbers ----------------------------------------------------------------- */
body.app .kpi-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: var(--sp-4); border-radius: 8px; }
body.app .kpi { padding: var(--sp-3) var(--sp-4); gap: 0; }
body.app .kpi-label, body.app .metric-label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-muted); margin: 0 0 2px; }
body.app .kpi-value { font-size: 1.25rem; }
body.app .kpi-note { font-size: 0.72rem; }
body.app .stat-value { font-size: 1.35rem; }
body.app .metric-grid, body.app .risk-grid { gap: var(--sp-2); margin-bottom: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
body.app .metric { padding: var(--sp-2) var(--sp-3); border-radius: 6px; }
body.app .metric-value { font-size: 1.1rem; font-weight: 600; }

/* controls ---------------------------------------------------------------- */
body.app .btn { padding: 7px 14px; font-size: 0.86rem; border-radius: 6px; min-height: 34px; }
body.app .btn-sm { padding: 4px 10px; font-size: 0.8rem; min-height: 28px; }
body.app .btn-lg { padding: 10px 20px; font-size: 0.95rem; }
body.app .btn-primary { font-weight: 600; }
body.app input[type="text"], body.app input[type="email"], body.app input[type="password"],
body.app input[type="date"], body.app input[type="number"], body.app select, body.app textarea {
  padding: 7px 10px; font-size: 0.88rem; border-radius: 6px; }
body.app .field { margin-bottom: var(--sp-3); }
body.app .field label, body.app label { font-size: 0.8rem; }
body.app .badge { padding: 2px 9px; font-size: 0.73rem; letter-spacing: 0; }
body.app .alert, body.app .notice { padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); border-radius: 6px; font-size: 0.86rem; }

/* tables ------------------------------------------------------------------ */
body.app table { font-size: 0.86rem; }
body.app thead th { padding: var(--sp-2) var(--sp-3); font-size: 0.74rem; font-weight: 550; letter-spacing: 0; text-transform: none; }
body.app tbody td { padding: var(--sp-2) var(--sp-3); }
body.app .table-wrap { border-radius: 8px; }
body.app .empty { padding: var(--sp-5) var(--sp-4); border-radius: 8px; }
body.app .dl { gap: var(--sp-2) var(--sp-4); font-size: 0.86rem; grid-template-columns: minmax(120px, 30%) 1fr; }

/* call to action ----------------------------------------------------------- */
body.app .cta { padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); margin-bottom: var(--sp-4); }
body.app .cta h2 { font-size: 1rem; margin: 0 0 2px; }
body.app .cta .lede { font-size: 0.86rem; margin: 0; }

/* status strip: the answer to "where does this stand" in one row ----------- */
.sumbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  margin-bottom: var(--sp-4); }
.sumbar > div, .sumbar > a { background: var(--surface); padding: var(--sp-2) var(--sp-3); display: flex; flex-direction: column; gap: 1px; min-width: 0; color: var(--text); }
.sumbar a:hover { background: var(--surface-hover); color: var(--text); }
.sumbar .k { font-size: 0.74rem; color: var(--text-muted); }
.sumbar .v { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; flex-wrap: wrap; }
.sumbar .v small { font-weight: 400; color: var(--text-faint); font-size: 0.76rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.error { background: var(--error); }

/* technical details: always closed by default ------------------------------ */
details.tech { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elevated); margin-bottom: var(--sp-4); }
details.tech > summary { cursor: pointer; padding: var(--sp-2) var(--sp-3); font-size: 0.86rem; font-weight: 550; color: var(--text-muted); list-style: none; display: flex; align-items: center; gap: var(--sp-2); }
details.tech > summary::-webkit-details-marker { display: none; }
details.tech > summary::before { content: "\25B8"; color: var(--text-faint); transition: transform .12s; }
details.tech[open] > summary::before { transform: rotate(90deg); }
details.tech > summary small { font-weight: 400; color: var(--text-faint); }
details.tech > .tech-body { padding: 0 var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-4); }
details.tech .card, details.tech .panel { background: var(--surface); }

/* checklist (onboarding / live readiness) ----------------------------------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.checklist li { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-3); background: var(--surface); font-size: 0.88rem; }
.checklist .what { flex: 1; min-width: 0; }
.checklist .what small { display: block; color: var(--text-faint); font-size: 0.76rem; overflow-wrap: anywhere; }

/* risk: one home for the two numbers ---------------------------------------- */
.riskline { display: inline-flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.riskline b { font-size: 1.05rem; font-weight: 650; }
.riskline small { color: var(--text-faint); font-size: 0.76rem; }

/* bottom tab bar (phones only) ----------------------------------------------- */
.tabbar { display: none; }
@media (max-width: 768px) {
  body.app { padding-bottom: 64px; }
  body.app .nav-inner { height: 48px; }
  body.app .nav-links { top: 48px; max-height: calc(100vh - 112px); overflow-y: auto; }
  body.app .nav-links a.active { box-shadow: none; background: var(--surface); }
  body.app .page { padding: var(--sp-4) 0 var(--sp-5); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(16, 20, 27, 0.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; color: var(--text-faint); font-size: 0.68rem; font-weight: 500; padding: 6px 2px; min-width: 0; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.active { color: var(--accent); }
  body.app .footer { display: none; }
  body.app .kpi-row { grid-template-columns: repeat(2, 1fr); }
  body.app .sumbar { grid-template-columns: repeat(2, 1fr); }
  body.app .page-head { align-items: flex-start; }
}

/* tables become labelled rows on phones --------------------------------------- */
@media (max-width: 640px) {
  body.app .table-wrap { border: 0; overflow: visible; }
  body.app table.stackable, body.app table.stackable tbody, body.app table.stackable tr, body.app table.stackable td { display: block; width: 100%; }
  body.app table.stackable thead { position: absolute; left: -9999px; }
  body.app table.stackable tr { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: var(--sp-2); padding: var(--sp-1) 0; }
  body.app table.stackable tbody tr:hover { background: var(--surface); }
  body.app table.stackable td { border: 0; padding: 3px var(--sp-3); display: flex; justify-content: space-between; gap: var(--sp-3); text-align: right; align-items: center; flex-wrap: wrap; }
  body.app table.stackable td::before { content: attr(data-label); color: var(--text-faint); font-size: 0.76rem; text-align: left; flex: none; }
  body.app table.stackable td:not([data-label])::before { content: none; }
  body.app table.stackable td[colspan] { display: block; text-align: left; }
  body.app table.stackable td .row, body.app table.stackable td form.row { justify-content: flex-end; }
  body.app .dl { grid-template-columns: 1fr; gap: 0; }
  body.app .dl dt { margin-top: var(--sp-2); font-size: 0.76rem; }
  body.app .grid-2, body.app .grid-3, body.app .grid-4 { grid-template-columns: 1fr; }
  body.app .chart-row { grid-template-columns: 1fr; }
  body.app .page-head .row { width: 100%; }
}
@media (max-width: 400px) {
  body.app .risk-grid, body.app .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

/* v2 refinements */
details.tech > summary { flex-wrap: wrap; row-gap: 0; }
details.tech > summary small { flex: 1 1 14ch; }
.sumbar > div:empty, .sumbar::after { background: var(--surface); }
body.app .head-status { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
body.app .page-head > .btn { align-self: center; }
body.app .nav-links .locale-switcher { margin-left: var(--sp-3); }
@media (max-width: 768px) {
  body.app .nav-links .locale-switcher { margin: var(--sp-2) var(--sp-3); }
  body.app .btn, body.app select, body.app input[type="text"], body.app input[type="number"],
  body.app input[type="email"], body.app input[type="password"], body.app input[type="date"] { min-height: 40px; }
  body.app .btn-sm { min-height: 34px; }
  body.app .option { min-height: 44px; }
}

/* status strip: hairlines instead of a coloured gap, so a short last row looks finished */
.sumbar { gap: 0; background: var(--surface); border-width: 1px 0 0 1px; }
.sumbar > div, .sumbar > a { box-shadow: inset -1px -1px 0 var(--border); }
@media (max-width: 640px) {
  body.app .option-grid { grid-template-columns: repeat(2, 1fr); }
  body.app .option { padding: 8px 12px; }
}

/* legacy class spelling used by a few templates */
.alert.warn  { color: var(--warn);  background: var(--warn-bg);  border-color: rgba(224, 163, 60, 0.3); }
.alert.ok    { color: var(--ok);    background: var(--ok-bg);    border-color: rgba(53, 200, 138, 0.3); }
.alert.error { color: var(--error); background: var(--error-bg); border-color: rgba(229, 84, 95, 0.3); }

/* ==========================================================================
   Logged-in area, v3 - the SKELO "Boundaries" look of the public site.
   --------------------------------------------------------------------------
   Same ground (#070C0C), warm paper text, brass for the Trading Platform,
   verdigris for "all good", serif headlines, mono labels, pill buttons and
   outlined cards. Everything is a re-skin of the v2 structure through tokens
   plus a handful of components; no markup contract and no behaviour changes.
   ========================================================================== */

@font-face { font-family: "Newsreader"; src: url(../fonts/newsreader-latin-wght-normal.woff2) format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url(../fonts/inter-tight-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(../fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }

body.app {
  --bg:            #070C0C;
  --bg-elevated:   #0D1413;
  --surface:       #0D1413;
  --surface-hover: #131C1B;
  --border:        rgba(241, 237, 227, 0.14);
  --border-strong: rgba(241, 237, 227, 0.30);
  --text:          #F1EDE3;
  --text-muted:    #B9BEB6;
  --text-faint:    #8E9892;
  --accent:        #E2BC72;
  --accent-hover:  #F0CF92;
  --accent-dim:    rgba(226, 188, 114, 0.10);
  --accent-line:   rgba(226, 188, 114, 0.42);
  --ok:            #7AE8C6;
  --ok-bg:         rgba(122, 232, 198, 0.10);
  --warn:          #E8B35A;
  --warn-bg:       rgba(232, 179, 90, 0.11);
  --error:         #FF9C8C;
  --error-bg:      rgba(255, 156, 140, 0.11);
  --idle:          #9AA39D;
  --idle-bg:       rgba(154, 163, 157, 0.12);
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font:  "Inter Tight", "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease:  cubic-bezier(0.23, 1, 0.32, 1);
  --r-card: 18px;
  --r-in: 12px;
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
}
html:has(body.app) { background: #070C0C; }

/* type: serif for headlines, mono for small labels ------------------------- */
body.app h1, body.app h2, body.app .panel-head h2, body.app .cta h2, body.app .hero-name {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 1.08; }
body.app h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.9rem); }
body.app h2 { font-size: 1.4rem; }
body.app h3 { font-family: var(--font); font-weight: 600; font-size: 1rem; letter-spacing: -0.005em; }
body.app .page-head h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.8rem); }
body.app .kpi-label, body.app .metric-label, body.app .sumbar .k, body.app .chip .k, body.app .card-title {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.01em; font-weight: 400; color: var(--text-faint); }
body.app code, body.app .mono { font-family: var(--mono); }

/* header ---------------------------------------------------------------------- */
body.app .nav { background: rgba(7, 12, 12, 0.92); border-bottom: 1px solid var(--border); }
body.app .nav-inner { height: 60px; }
body.app .brand { gap: 12px; font: 600 0.88rem/1 var(--font); letter-spacing: 0.32em; }
body.app .brand-mark { display: none; }
body.app .brand svg { width: 24px; height: 24px; flex: none; }
body.app .brand-sub { letter-spacing: 0; font: 400 0.8rem var(--mono); color: var(--text-faint); border-left-color: var(--border-strong); }
body.app .nav-links a, body.app .nav-links button { font-size: 0.95rem; font-weight: 450; color: var(--text-muted); border-radius: 0; position: relative; padding: 8px 12px; }
body.app .nav-links a:hover, body.app .nav-links button:hover { background: transparent; color: var(--text); }
body.app .nav-links a.active { background: transparent; box-shadow: none; color: var(--text); }
body.app .nav-links a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--accent); border-radius: 2px; }
body.app .locale-switcher { font: 500 0.78rem var(--mono); }
body.app .locale-switcher button.active, body.app .locale-switcher button:hover { color: var(--accent); }

/* surfaces: outlined, softly rounded ---------------------------------------------- */
body.app .card, body.app .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; }
body.app .metric, body.app .kpi { border-radius: var(--r-in); }
body.app .kpi-row { border-radius: var(--r-card); background: var(--border); }
body.app .metric { background: var(--bg); border-color: var(--border); }
body.app .metric-value, body.app .kpi-value, body.app .stat-value { font-family: var(--font); font-weight: 560; letter-spacing: -0.015em; }
body.app .kpi-value { font-size: 1.4rem; }
body.app .empty { background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--r-card); }
body.app .table-wrap { border-radius: var(--r-card); border-color: var(--border); }
body.app thead th { background: var(--bg); font-family: var(--mono); font-weight: 400; color: var(--text-faint); }
body.app tbody tr:hover { background: var(--surface-hover); }
body.app .pos { color: var(--ok); } body.app .neg { color: var(--error); }
body.app a { color: var(--accent); } body.app a:hover { color: var(--accent-hover); }
body.app .back-link, body.app .page-head a.small, body.app p.small a { color: var(--text-muted); }

/* buttons: pills ------------------------------------------------------------------------- */
body.app .btn { border-radius: 999px; padding: 8px 18px; min-height: 38px; font-weight: 520; border-color: var(--border-strong); background: transparent; color: var(--text);
  transition: transform 140ms var(--ease), background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease); }
body.app .btn:active { transform: scale(0.97); }
body.app .btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
body.app .btn-primary { background: var(--accent); border-color: var(--accent); color: #17120a; font-weight: 600; }
body.app .btn-primary:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
body.app .btn-ghost { border-color: var(--border); }
body.app .btn-sm { min-height: 32px; padding: 4px 14px; }
body.app .btn-lg { min-height: 48px; padding: 10px 28px; font-size: 1rem; }
body.app .btn-danger { color: var(--error); border-color: rgba(255, 156, 140, 0.45); }
body.app .btn-danger:hover { background: var(--error); color: #1a0b08; border-color: var(--error); }
body.app [data-range-buttons] .btn.active { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent); }
body.app input[type="text"], body.app input[type="email"], body.app input[type="password"], body.app input[type="date"],
body.app input[type="number"], body.app input[type="search"], body.app select, body.app textarea {
  background: var(--bg); border-color: var(--border-strong); border-radius: var(--r-in); }
body.app input:focus, body.app select:focus, body.app textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
body.app :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* badges: outlined pills ---------------------------------------------------------------------- */
body.app .badge { border: 1px solid currentColor; background: transparent; font-family: var(--mono); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.02em; padding: 2px 10px; }
body.app .badge.ok { color: var(--ok); } body.app .badge.warn { color: var(--warn); }
body.app .badge.error { color: var(--error); } body.app .badge.idle { color: var(--idle); }
body.app .alert, body.app .notice { border-radius: var(--r-in); }
body.app .alert-ok, body.app .alert.ok { color: var(--ok); } body.app .alert-warn, body.app .alert.warn { color: var(--warn); }

/* hero card: the one place the page says "this is your account" ---------------------------- */
.hero-card { position: relative; margin: 14px 0 var(--sp-4); padding: 26px 22px 22px; border: 2px solid var(--accent); border-radius: 22px; background: var(--bg-elevated); }
.hero-card::before { content: attr(data-tag); position: absolute; top: -13px; left: 20px; padding: 0 10px; background: var(--bg); color: var(--accent); font: 500 0.8rem var(--mono); letter-spacing: 0.03em; }
.hero-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.hero-name { margin: 0; font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.7rem); }
.hero-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 0.95rem; }
.hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.chip { display: grid; grid-template-columns: 10px 1fr; column-gap: 10px; row-gap: 1px; align-items: start; padding: 12px 14px; border: 1px dashed var(--accent-line); border-radius: 14px; background: var(--bg); color: var(--text); min-width: 0;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease), transform 140ms var(--ease); }
a.chip:hover { background: var(--surface-hover); border-style: solid; color: var(--text); }
a.chip:active { transform: scale(0.985); }
.chip .dot { margin-top: 6px; grid-row: 1 / span 3; }
.chip .k { display: block; }
.chip .v { display: block; font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; line-height: 1.25; }
.chip .s { display: block; font-size: 0.8rem; color: var(--text-muted); line-height: 1.35; }
.chip.is-ok { border-color: rgba(122, 232, 198, 0.45); }
.chip.is-warn { border-color: rgba(232, 179, 90, 0.5); }

/* section heading used between blocks */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: var(--sp-5) 0 var(--sp-3); }
.sec-head h2 { margin: 0; font-size: 1.35rem; }
.sec-head .small { color: var(--text-faint); }

/* dashboard figures grouped in two cards ------------------------------------------------------- */
.fig-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); margin-bottom: var(--sp-4); }
@media (min-width: 760px) { .fig-grid { grid-template-columns: 1.2fr 1fr; } }
.fig-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; }
.fig-card h3 { margin: 0 0 10px; font-family: var(--mono); font-weight: 400; font-size: 0.78rem; color: var(--text-faint); letter-spacing: 0.01em; }
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 18px; }
.fig .kpi-label { display: block; margin-bottom: 2px; }
.fig .kpi-value { display: block; font-size: 1.35rem; line-height: 1.15; }
.fig .kpi-note { display: block; font-size: 0.72rem; color: var(--text-faint); }
.fig.big .kpi-value { font-family: var(--serif); font-weight: 400; font-size: 2.1rem; letter-spacing: -0.02em; }

/* risk, stated once ---------------------------------------------------------------------------- */
.risk-pair { display: grid; gap: 2px; }
.risk-pair b { font-weight: 600; }
.risk-pair span { color: var(--text-muted); font-size: 0.85rem; }

/* strategy card ----------------------------------------------------------------------------------- */
.strat { display: grid; gap: 14px; }
.strat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; }
.strat-head h2 { margin: 0 0 6px; }
.strat-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.perf-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-in); background: var(--bg); }
.perf-line .k { display: block; font: 400 0.72rem var(--mono); color: var(--text-faint); }
.perf-line .v { display: block; font-weight: 600; font-size: 1.08rem; }

/* status strip stays available for the admin; rounded to match */
body.app .sumbar { border-radius: var(--r-card); border-color: var(--border); }
body.app .sumbar > div, body.app .sumbar > a { background: var(--surface); }
body.app .sumbar .v { font-weight: 600; }
body.app .dot.ok { background: var(--ok); } body.app .dot.warn { background: var(--warn); } body.app .dot.error { background: var(--error); }
body.app .checklist { border-radius: var(--r-card); }
body.app details.tech { border-radius: var(--r-card); }
body.app .cta { background: var(--accent-dim); border: 1px solid var(--accent-line); border-radius: 20px; padding: 18px 20px; }
body.app .cta h2 { font-size: 1.45rem; }

/* option chips (assets) */
body.app .option { border-radius: 999px; background: var(--bg); min-height: 44px; padding: 8px 16px; }
body.app .option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-dim); }
body.app .option input { accent-color: var(--accent); }
body.app .account-card, body.app .choice-card { border-radius: var(--r-card); background: var(--bg); }

/* charts */
body.app .eq-line { stroke: var(--accent); }
body.app .equity-svg.rising .eq-line { stroke: var(--ok); }
body.app .curve-line { stroke: var(--accent); } body.app .curve-area { fill: var(--accent-dim); }
body.app .freshness { font-family: var(--mono); font-size: 0.74rem; }

/* mobile header + menu sheet ------------------------------------------------------------------------ */
.nav-toggle .bars { display: block; width: 20px; height: 12px; position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--text); border-radius: 2px; transition: transform 200ms var(--ease); }
.nav-toggle .bars::before { top: 0; } .nav-toggle .bars::after { bottom: 0; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-5px) rotate(-45deg); }
.nav-toggle .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 768px) {
  body.app .nav-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; }
  body.app .nav-inner { height: 56px; }
  body.app .brand-sub { display: none; }
  body.app .nav-links { top: 56px; left: 0; right: 0; bottom: 0; max-height: none; padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border: 0; gap: 0; overflow-y: auto; }
  body.app .nav-links a, body.app .nav-links > form { display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 0 4px; border-bottom: 1px solid var(--border); font: 400 1.6rem/1 var(--serif); letter-spacing: -0.02em; color: var(--text); }
  body.app .nav-links a.in-tabs { display: none; }
  body.app .nav-links a::after { display: none; }
  body.app .nav-links button.btn-link { font: 400 1.6rem/1 var(--serif); color: var(--text); padding: 0; width: 100%; text-align: left; min-height: 60px; }
  body.app .nav-links .locale-switcher { justify-content: flex-start; gap: 6px; margin: var(--sp-4) 0 0; border: 0; min-height: 0; font: 500 0.9rem var(--mono); }
  body.app .nav-links .locale-switcher button { border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 18px; min-height: 40px; font: 500 0.9rem var(--mono); }
  body.app .nav-links .locale-switcher button.active { border-color: var(--accent); color: var(--accent); }
  body.app .nav-links .locale-switcher span { display: none; }
  .tabbar { background: rgba(7, 12, 12, 0.96); border-top: 1px solid var(--border); }
  .tabbar a { font-family: var(--mono); font-size: 0.64rem; gap: 3px; letter-spacing: 0; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.active svg { stroke: var(--accent); }
  .hero-card { padding: 22px 16px 16px; margin-top: 12px; border-radius: 20px; }
  .chips { grid-template-columns: 1fr 1fr; }
  .chip { padding: 10px 12px; }
  .chip.wide { grid-column: 1 / -1; }
  body.app .card, body.app .panel { padding: 16px; border-radius: 16px; }
}
@media (min-width: 769px) { .nav-toggle { display: none; } }
@media (prefers-reduced-motion: reduce) { body.app *, .tabbar * { transition: none !important; } }
.brand-logo { display: none; }
body.app .brand-logo { display: block; width: 24px; height: 24px; }
body.app .brand-word { text-transform: uppercase; }
body.app a.chip, body.app a.chip:hover { color: var(--text); }
body.app .chart-wrap { min-height: 180px; }
body.app .tabbar a { color: var(--text-faint); }
body.app .tabbar a.active { color: var(--accent); }
body.app .card-head { flex-wrap: wrap; row-gap: 8px; }
body.app .card-head h3 { white-space: nowrap; }
@media (max-width: 640px) { .strat-facts { grid-template-columns: 1fr 1fr; } .strat-facts .chip:only-child { grid-column: 1 / -1; } }
body.app .nav { -webkit-backdrop-filter: none; backdrop-filter: none; background: #070C0C; }
@media (max-width: 768px) {
  body.app .nav-links { position: fixed; top: 56px; bottom: 57px; left: 0; right: 0; z-index: 44; }
}

/* ==========================================================================
   v4 - one palette for the whole portal (login included), gold frames.
   The blue of the first portal is gone from tokens, gradients and glows.
   ========================================================================== */
:root {
  --bg: #070C0C; --bg-elevated: #0D1413; --surface: #0D1413; --surface-hover: #141D1B;
  --text: #F1EDE3; --text-muted: #B9BEB6; --text-faint: #8E9892;
  --accent: #E2BC72; --accent-hover: #F0CF92;
  --accent-dim: rgba(226, 188, 114, 0.10); --accent-line: rgba(226, 188, 114, 0.42);
  --gold-line: rgba(226, 188, 114, 0.26); --gold-line-2: rgba(226, 188, 114, 0.50);
  --ok: #7AE8C6; --ok-bg: rgba(122, 232, 198, 0.10);
  --warn: #F0A04B; --warn-bg: rgba(240, 160, 75, 0.12);
  --error: #FF8F80; --error-bg: rgba(255, 143, 128, 0.11);
  --idle: #C9A860; --idle-bg: rgba(226, 188, 114, 0.09);
  --border: rgba(241, 237, 227, 0.12); --border-strong: rgba(241, 237, 227, 0.30);
}
.hero::before { background: radial-gradient(ellipse at center, rgba(226, 188, 114, 0.10), transparent 65%); }
.brand-logo { display: block; width: 24px; height: 24px; }
.brand-mark { display: none; }
.brand-word { text-transform: uppercase; letter-spacing: 0.32em; font-weight: 600; font-size: 0.88rem; }
.auth-card .card { border-color: var(--gold-line-2); }

/* gold frames on every card-like surface */
body.app .card, body.app .panel, body.app .fig-card, body.app .sumbar, body.app .kpi-row,
body.app .table-wrap, body.app details.tech, body.app .checklist, body.app .perf-line,
body.app .account-card, body.app .choice-card, body.app .metric, body.app .empty, body.app .option {
  border-color: var(--gold-line); }
body.app .kpi-row { background: var(--gold-line); }
body.app .sumbar > div, body.app .sumbar > a { box-shadow: inset -1px -1px 0 var(--gold-line); }
body.app .sumbar { border-color: var(--gold-line); }
body.app .checklist { background: var(--gold-line); }
body.app .panel-head { border-bottom: 1px solid var(--gold-line); padding-bottom: 12px; }
body.app .page-head { border-bottom: 1px solid var(--gold-line); padding-bottom: 16px; }
body.app .nav { border-bottom-color: var(--gold-line); }
body.app .tabbar { border-top-color: var(--gold-line); }
body.app .footer { border-top-color: var(--gold-line); }
body.app .hero-card .chip { border-color: var(--gold-line-2); }
body.app .hero-card .chip.is-ok { border-color: rgba(122, 232, 198, 0.55); }
body.app tbody td, body.app thead th { border-color: var(--border); }

/* buttons: gold primary, dark secondary with a gold outline */
body.app .btn { border-color: var(--gold-line-2); background: #0A100F; color: var(--text); }
body.app .btn:hover { background: var(--accent); border-color: var(--accent); color: #17120a; }
body.app .btn-ghost { background: transparent; border-color: var(--gold-line); }
body.app .btn-primary { background: var(--accent); border-color: var(--accent); color: #17120a; box-shadow: 0 0 0 0 rgba(226,188,114,0); transition: transform 140ms var(--ease), background-color 150ms var(--ease), box-shadow 200ms var(--ease), color 150ms var(--ease); }
body.app .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #17120a; box-shadow: 0 6px 22px -8px rgba(226, 188, 114, 0.65); }
body.app .btn-primary:active { transform: scale(0.97); box-shadow: none; }
body.app .btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; }
body.app .btn-danger { background: transparent; }

/* status colours: green = positive, gold = neutral, red = error */
body.app .badge.idle { color: #D8B873; background: transparent; }
body.app .dot { background: #8E9892; }
body.app .dot.idle { background: var(--accent); }
body.app .freshness.is-delayed, body.app .freshness.is-delayed .freshness-dot { color: var(--warn); }
body.app input[type="checkbox"], body.app input[type="radio"] { accent-color: var(--accent); }
body.app ::selection { background: rgba(226, 188, 114, 0.35); color: #fff; }
body.app .nav-links a.active::after { box-shadow: 0 0 10px rgba(226, 188, 114, 0.6); }
:root { --gold-line: rgba(226, 188, 114, 0.38); --gold-line-2: rgba(226, 188, 114, 0.62); }
body.app .fig-card h3, body.app .card-head h3, body.app .sec-head h2 { color: var(--accent); }
body.app .fig-card h3 { font-family: var(--mono); font-weight: 500; }
body.app .card-head h3 { font-family: var(--mono); font-weight: 500; font-size: 0.82rem; }
body.app .btn-danger { border-color: rgba(255, 143, 128, 0.55); color: var(--error); }
body.app .btn-danger:hover { background: var(--error); border-color: var(--error); color: #1a0b08; }
.auth-head h1 { font-family: "Newsreader", Georgia, serif; font-weight: 400; font-size: 2.1rem; letter-spacing: -0.02em; }
.auth-head .brand { gap: 12px; }
.auth-card .card { border: 2px solid var(--accent); border-radius: 22px; padding: 26px 24px; background: var(--bg-elevated); }
.auth-wrap { background: var(--bg); }
.auth-foot { color: var(--text-faint); }
body.app input[type="search"] { width: 100%; padding: 7px 12px; font: inherit; font-size: 0.88rem; color: var(--text); }
body.app .btn-block { border-radius: 999px; min-height: 44px; }
.auth-card .btn-block { border-radius: 999px; min-height: 48px; }
@media (max-width: 768px) { body.app .filters .field { flex-basis: calc(50% - 8px); min-width: 0; } body.app .filters .field:first-child { flex-basis: 100%; } }

/* phones: trades as stacked cards (open positions, history, instructions) */
@media (max-width: 640px) {
  body.app [data-live-trades] .card, body.app [data-live-trades] .table-wrap { min-width: 0; max-width: 100%; }
  body.app table.stackable td { min-width: 0; overflow-wrap: anywhere; }
  body.app table.stackable td::before { padding-right: var(--sp-3); }
  body.app table.stackable td .badge { flex: none; white-space: nowrap; }
  body.app table.stackable td.detail, body.app table.stackable td.small { text-align: right; max-width: 100%; }
  body.app table.stackable td.row-actions { display: flex; flex-wrap: wrap; justify-content: stretch; gap: 8px; padding: 8px var(--sp-3) 4px; border-top: 1px solid var(--border); margin-top: 4px; }
  body.app table.stackable td.row-actions::before { content: none; }
  body.app table.stackable td.row-actions .btn { flex: 1 1 0; min-height: 40px; }
  body.app table.stackable td[colspan] { text-align: center; }
  body.app [data-live-trades] .filters { flex-direction: row; }
  body.app { overflow-x: hidden; }
}
/* the live notice bar is hidden until a message is shown (the CSP forbids an inline style attribute) */
.alert[data-notice] { display: none; }
@media (max-width: 640px) { body.app table.stackable td.detail { flex: 1 1 55%; justify-content: flex-end; } body.app table.stackable td.detail::before { flex: none; } }

/* dashboard figures: the size follows the width, so six-figure balances never collide */
.fig, .fig-row, .kpi { min-width: 0; }
.fig .kpi-value, .kpi .kpi-value { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .fig-card { padding: 14px 14px; }
  .fig-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
  .fig .kpi-value { font-size: clamp(1.02rem, 5.4vw, 1.3rem); line-height: 1.2; }
  .fig.big { grid-column: 1 / -1; }
  .fig.big .kpi-value { font-size: clamp(1.7rem, 9.2vw, 2.2rem); }
  .fig .kpi-note { display: block; }
  .kpi .kpi-value { font-size: clamp(1rem, 5.2vw, 1.25rem); }
}
@media (max-width: 340px) {
  .fig-row { gap: 10px 10px; }
  .fig .kpi-label { font-size: 0.68rem; }
}
@media (max-width: 359px) { .chips { grid-template-columns: 1fr; } .chip .s { overflow-wrap: anywhere; } }
@media (max-width: 380px) { .fig .kpi-value { font-size: clamp(0.92rem, 4.7vw, 1.15rem); } .fig-row { column-gap: 18px; } }
