/* ==========================================================================
   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:        #4d8dff;
  --accent-hover:  #6ea1ff;
  --accent-dim:    rgba(77, 141, 255, 0.12);
  --accent-line:   rgba(77, 141, 255, 0.35);

  /* --- 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: linear-gradient(135deg, var(--accent), #7b5cff);
  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(77, 141, 255, 0.16), 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; }
}
