/* ============================================================
   CSS CUSTOM PROPERTIES  — dark (default) + light overrides
   ============================================================ */
:root {
  --bg: #03060a;
  --bg2: #060d15;
  --panel: rgba(4, 9, 16, 0.97);
  --panel-raised: #080f1a;
  --panel-border: rgba(148, 182, 210, 0.09);
  --ink: #ddeaf4;
  --ink-muted: #7a98ae;
  --ink-faint: rgba(221, 234, 244, 0.35);
  --accent: #41d9a8;
  --accent-glow: rgba(65, 217, 168, 0.18);
  --accent-border: rgba(65, 217, 168, 0.28);
  --warn: #f5c26b;
  --warn-soft: rgba(245, 194, 107, 0.12);
  --danger: #ff7b61;
  --danger-soft: rgba(255, 123, 97, 0.12);
  --good: #6fd98f;
  --good-soft: rgba(111, 217, 143, 0.12);
  --shadow: 0 32px 64px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.5);
  --plot-bg: rgba(0,0,0,0);
  --plot-grid: rgba(148, 182, 210, 0.08);
  --header-bg: rgba(3, 6, 10, 0.98);
  --tab-active-bg: var(--panel-raised);
  --tab-hover-bg: rgba(65, 217, 168, 0.06);

  /* Palette keys for JS */
  --c0: #41d9a8;
  --c1: #7b92f5;
  --c2: #f5c26b;
  --c3: #ff7b61;
  --c4: #a78bfa;
  --c5: #34d3eb;
}

[data-theme="light"] {
  --bg: #f0f4f0;
  --bg2: #e8ede8;
  --panel: rgba(255, 255, 253, 0.9);
  --panel-raised: #fffffe;
  --panel-border: rgba(30, 50, 40, 0.1);
  --ink: #1a2e22;
  --ink-muted: #4d6b58;
  --ink-faint: rgba(26, 46, 34, 0.35);
  --accent: #0a7c5c;
  --accent-glow: rgba(10, 124, 92, 0.1);
  --accent-border: rgba(10, 124, 92, 0.25);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.1);
  --danger: #c0392b;
  --danger-soft: rgba(192, 57, 43, 0.1);
  --good: #166534;
  --good-soft: rgba(22, 101, 52, 0.12);
  --shadow: 0 24px 48px rgba(26, 46, 34, 0.1);
  --shadow-sm: 0 4px 14px rgba(26, 46, 34, 0.08);
  --plot-grid: rgba(30, 50, 40, 0.1);
  --header-bg: rgba(240, 244, 240, 0.9);
  --tab-active-bg: var(--panel-raised);
  --tab-hover-bg: rgba(10, 124, 92, 0.06);

  --c0: #0a7c5c;
  --c1: #5065d4;
  --c2: #b45309;
  --c3: #c0392b;
  --c4: #7c3aed;
  --c5: #0891b2;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(65,217,168,.04) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 100%, rgba(255,123,97,.03) 0%, transparent 45%);
  min-height: 100vh;
  transition: background .25s, color .25s;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(10,124,92,.05) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(192,57,43,.04) 0%, transparent 50%);
}

/* ============================================================
   STICKY HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--panel-border);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.97rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse-dot 2.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
  50%       { opacity: .7; box-shadow: 0 0 16px var(--accent), 0 0 30px var(--accent-glow); }
}

.brand-muted { color: var(--ink-muted); font-weight: 400; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel-raised);
  color: var(--ink-muted);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}

.theme-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Refresh data button ─────────────────────────────────────────────────── */
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-raised);
  color: var(--ink-muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s;
  white-space: nowrap;
}
.refresh-btn:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.refresh-btn:disabled,
.refresh-btn.refreshing {
  opacity: .6;
  cursor: wait;
}

.theme-icon { display: flex; align-items: center; justify-content: center; }

/* show only the icon that matches the current theme */
[data-theme="dark"] .theme-icon-dark  { display: flex; }
[data-theme="dark"] .theme-icon-light { display: none;  }
[data-theme="light"] .theme-icon-dark  { display: none;  }
[data-theme="light"] .theme-icon-light { display: flex; }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Glass panel ─────────────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 32px 36px;
}

.hero-text h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  line-height: 1.05;
  margin: 8px 0 12px;
  letter-spacing: -0.02em;
}

.hero-text h1 em {
  font-style: italic;
  color: var(--accent);
}

.lede { color: var(--ink-muted); max-width: 60ch; font-size: 0.95rem; }

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--panel-raised);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px 18px;
  min-width: 130px;
  text-align: center;
}

.kpi-value {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  line-height: 1;
  display: block;
  margin: 4px 0 6px;
}

.kpi-label { font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ============================================================
   EYEBROW / TYPOGRAPHY HELPERS
   ============================================================ */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 4px;
}

.section-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  margin-bottom: 0;
}

h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; }
h3 { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; font-weight: 600; }

/* ============================================================
   AGGREGATE SECTION
   ============================================================ */
.agg-section { display: flex; flex-direction: column; gap: 16px; }

.agg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.agg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.chart-card { padding: 22px 22px 14px; }

.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-note { font-size: 0.82rem; color: var(--ink-muted); text-align: right; max-width: 28ch; }

.plot { min-height: 280px; }

/* ============================================================
   STRATEGY TABS
   ============================================================ */
.tabs-section { display: flex; flex-direction: column; gap: 0; }

.tabs-bar {
  display: flex;
  gap: 4px;
  padding: 6px 6px 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 14px 14px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background .18s, color .18s;
  position: relative;
}

.tab-btn:hover {
  background: var(--tab-hover-bg);
  color: var(--ink);
}

.tab-btn.active {
  background: var(--tab-active-bg);
  color: var(--accent);
  font-weight: 600;
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--danger-soft);
  color: var(--danger);
}

.tab-badge.ok {
  background: var(--good-soft);
  color: var(--good);
}

.tab-panes {
  background: var(--tab-active-bg);
  border: 1px solid var(--panel-border);
  border-radius: 0 0 20px 20px;
  padding: 0;
  overflow: hidden;
}

.tab-pane { display: none; padding: 24px; flex-direction: column; gap: 20px; }
.tab-pane.active { display: flex; }

/* ── Pane: stat row ──────────────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-val {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  line-height: 1;
}

.stat-meta { font-size: 0.8rem; color: var(--ink-muted); }

/* ── Pane: month grid ─────────────────────────────────────────────────────── */
.month-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.month-grid {
  display: grid;
  gap: 8px;
}

.month-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr auto;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}

.month-card:hover { border-color: var(--accent-border); background: var(--panel-raised); }
.month-card.expanded { border-color: var(--accent-border); }

.month-label { font-weight: 600; font-size: 0.92rem; }
.month-bars { height: 6px; background: var(--panel-border); border-radius: 999px; overflow: hidden; }
.month-bars-fill { height: 100%; border-radius: 999px; transition: width .3s; }
.month-pnl { font-weight: 700; font-size: 0.95rem; text-align: right; white-space: nowrap; }

.month-detail {
  display: none;
  padding: 0 0 6px 0;
}

.month-detail.open { display: block; }
.month-detail .table-wrap { margin-top: 10px; }

/* ── Symbol table ────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--panel-border);
  white-space: nowrap;
}

th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--tab-hover-bg); }

/* ── Pills & chips ───────────────────────────────────────────────────────── */
.pill, .chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.pill.pass   { background: var(--good-soft);   color: var(--good);   }
.pill.alert  { background: var(--danger-soft);  color: var(--danger); }
.pill.warn   { background: var(--warn-soft);    color: var(--warn);   }
.pill.info   { background: var(--accent-glow);  color: var(--accent); }
.pill.demo   { background: rgba(122,152,174,.1); color: var(--ink-muted); }

.chip {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent-border);
}

/* ── Alert cards ─────────────────────────────────────────────────────────── */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }

.alert-card {
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  padding: 14px 16px;
}

.alert-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.alert-card p  { font-size: 0.88rem; color: var(--ink-muted); margin: 0; }
.alert-card.pass   { background: var(--good-soft);   border-color: rgba(111,217,143,.25); }
.alert-card.alert  { background: var(--danger-soft);  border-color: rgba(255,123,97,.25);  }
.alert-card.warn   { background: var(--warn-soft);    border-color: rgba(245,194,107,.25); }

/* ── Scope stack ─────────────────────────────────────────────────────────── */
.scope-stack { display: flex; flex-direction: column; gap: 0; }

.scope-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.9rem;
}

.scope-line:last-child { border-bottom: none; }
.scope-label { color: var(--ink-muted); }

.scope-list-value { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ── Header nav links ────────────────────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-nav-link {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color .2s, background .2s;
}
.header-nav-link:hover { color: var(--ink); background: var(--tab-hover-bg); }
.header-nav-link.forward-link { color: var(--accent); }
.header-nav-link.forward-link:hover { background: var(--accent-glow); }
.header-nav-link.nav-arrow {
  font-size: 1.1rem;
  padding: 3px 8px;
  line-height: 1;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.empty-state { color: var(--ink-muted); }

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-faint);
  padding-top: 8px;
}

/* ── Strategy filter (aggregate section) ────────────────────────────────── */
.strat-filter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent-border);
  color: var(--ink);
  background: var(--tab-hover-bg);
}

.filter-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 700;
}

/* ── Symbol filter (inside tab pane) ────────────────────────────────────── */
.symbol-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--panel-border);
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.filter-chip {
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s;
}

.filter-chip:hover {
  border-color: var(--accent-border);
  color: var(--ink);
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 700;
}

/* ── Date filter bar ─────────────────────────────────────────────────────── */
.date-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--panel-border);
}

.date-custom-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.date-input {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.82rem;
  cursor: pointer;
}

.date-input:focus {
  outline: none;
  border-color: var(--accent);
}

.date-clear-btn {
  padding: 3px 8px;
  font-size: 0.8rem;
}

/* ── Candle extend buttons ───────────────────────────────────────────────── */
.candle-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}

.candle-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ── Per-tab history charts ──────────────────────────────────────────────── */
.pane-history-charts { margin-top: 4px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero              { grid-template-columns: 1fr; }
  .hero-kpis         { grid-template-columns: repeat(3, 1fr); }
  .chart-pair        { grid-template-columns: 1fr; }
  .stat-row          { grid-template-columns: repeat(3, 1fr); }
  .month-card        { grid-template-columns: minmax(110px, auto) 1fr auto; }
}

@media (max-width: 600px) {
  .page              { padding: 16px 12px 40px; gap: 20px; }
  .hero              { padding: 20px; }
  .hero-kpis         { grid-template-columns: 1fr 1fr; }
  .stat-row          { grid-template-columns: 1fr 1fr; }
  .tab-pane          { padding: 16px; }
}

/* ============================================================
   TRADE MODAL
   ============================================================ */
.trade-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.trade-modal-overlay.open { display: flex; }

.trade-modal {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-raised);
  color: var(--ink-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, border-color .2s;
}
.modal-close:hover { color: var(--danger); border-color: var(--danger); }

.modal-header { margin-bottom: 16px; }
.modal-header h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.modal-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.modal-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.chip-buy    { background: var(--good-soft);   color: var(--good);   border: 1px solid rgba(111,217,143,.25); }
.chip-sell   { background: var(--warn-soft);   color: var(--warn);   border: 1px solid rgba(245,194,107,.25); }
.chip-win    { background: var(--good-soft);   color: var(--good);   border: 1px solid rgba(111,217,143,.25); }
.chip-loss   { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(255,123,97,.25); }
.chip-tp     { background: var(--good-soft);   color: var(--good);   border: 1px solid rgba(111,217,143,.25); }
.chip-sl     { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(255,123,97,.25); }
.chip-neutral{ background: var(--panel-raised); color: var(--ink-muted); border: 1px solid var(--panel-border); }

.modal-chart { height: 320px; margin-bottom: 18px; }

.modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.modal-stat-card {
  background: var(--panel-raised);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal-stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); }
.modal-stat-value { font-size: 1.05rem; font-weight: 700; }

/* Trades section inside month detail */
.trades-section { margin-top: 16px; }
.trades-summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink-muted);
  padding: 6px 0;
  border-top: 1px solid var(--panel-border);
  list-style: none;
  user-select: none;
}
.trades-summary:hover { color: var(--accent); }
details[open] .trades-summary { color: var(--accent); }

/* Clickable trade rows */
.trade-row { cursor: pointer; transition: background .12s; }
.trade-row:hover td { background: rgba(65,217,168,.07) !important; }

/* ============================================================
   STRATEGY CONSOLIDATED TRADE LIST
   ============================================================ */
.strategy-trades-section {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

/* strat-trade rows are also .trade-row but expand inline rather than opening a modal */
.strat-trade-row { cursor: pointer; }
.strat-trade-row:hover td { background: rgba(65,217,168,.07) !important; }
.strat-trade-row.expanded td {
  background: var(--panel-raised) !important;
  border-bottom: none;
}

/* The expandable detail row that contains the inline chart */
.strat-trade-detail-row td {
  padding: 0 !important;
  background: var(--panel-raised);
  border-bottom: 2px solid var(--panel-border) !important;
}

.strat-trade-chart-wrap {
  padding: 12px 16px 16px;
  animation: strat-chart-slide .15s ease-out;
}

@keyframes strat-chart-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CI RUN BUTTON
   ============================================================ */
.ci-run-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent-border);
  background: var(--accent-glow);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s;
  white-space: nowrap;
}
.ci-run-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.ci-run-btn:disabled,
.ci-run-btn.ci-running {
  opacity: .7;
  cursor: wait;
}
.ci-run-btn.ci-success { border-color: var(--good); background: var(--good-soft); color: var(--good); }
.ci-run-btn.ci-failed  { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); cursor: pointer; }

/* ============================================================
   CI CONFIG MODAL
   ============================================================ */
.ci-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ci-modal {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 500px;
  padding: 28px;
  position: relative;
}

.ci-modal h3 { margin-bottom: 10px; }
.ci-modal-intro { font-size: .88rem; color: var(--ink-muted); margin-bottom: 20px; }
.ci-modal-intro code { font-size: .82rem; background: var(--panel-raised); padding: 1px 6px; border-radius: 5px; }

.ci-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.ci-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.ci-label-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }

.ci-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-raised);
  color: var(--ink);
  font-size: .9rem;
  font-family: monospace;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.ci-input:focus { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-glow); }

.ci-remember { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-muted); cursor: pointer; }
.ci-remember input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

.ci-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }

.ci-cancel-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--ink-muted);
  font-size: .88rem;
  cursor: pointer;
  transition: border-color .18s, color .18s;
}
.ci-cancel-btn:hover { border-color: var(--accent-border); color: var(--ink); }

.ci-confirm-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid var(--accent-border);
  background: var(--accent-glow);
  color: var(--accent);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}
.ci-confirm-btn:hover { background: var(--accent); color: var(--bg); box-shadow: 0 0 0 3px var(--accent-glow); }
.ci-confirm-btn:disabled { opacity: .5; cursor: wait; }

.ci-modal-note {
  font-size: .78rem;
  color: var(--ink-muted);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--panel-border);
}

/* CI status inline notification (shown below ci-run-btn) */
.ci-status-bar {
  font-size: .78rem;
  color: var(--ink-muted);
  display: none;
  align-items: center;
  gap: 6px;
}
.ci-status-bar.visible { display: flex; }
.ci-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  animation: ci-blink 1s ease-in-out infinite;
}
.ci-status-dot.done { background: var(--good); animation: none; }
.ci-status-dot.failed { background: var(--danger); animation: none; }
@keyframes ci-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ============================================================
   STRATEGY TRADING KPIs
   ============================================================ */
.strategy-kpis-section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
}

.kpi-mini-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

@media (max-width: 900px) { .kpi-mini-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .kpi-mini-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-mini-card {
  background: var(--panel-raised);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kpi-mini-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-muted);
}

.kpi-mini-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.1;
}

/* ============================================================
   EQUITY CURVE SECTION
   ============================================================ */
.equity-curve-section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
}

/* Flash-highlight a trade row when navigated to from the equity curve */
.strat-trade-row.equity-highlight td {
  background: rgba(65,217,168,.18) !important;
  transition: background .6s;
}
