/* ============================================================
   TRADING COMPOUND GROWTH SIMULATOR — style.css
   Sequential Trade Chain Edition
   ============================================================ */

/* ── Custom Properties (Dark Theme) ── */
:root {
  /* Backgrounds */
  --bg-base:        #080D1A;
  --bg-surface:     #0C1223;
  --bg-card:        #101827;
  --bg-card-hover:  #141D35;
  --bg-input:       #0A1020;

  /* Borders */
  --border:         #1A2845;
  --border-subtle:  #0F1830;
  --border-focus:   #F59E0B;

  /* Text */
  --text-primary:   #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted:     #3D5070;
  --text-inverse:   #0F172A;

  /* Accent — Gold */
  --gold:           #F59E0B;
  --gold-hover:     #FBBF24;
  --gold-dim:       #D97706;
  --gold-glow:      rgba(245, 158, 11, 0.25);
  --gold-surface:   rgba(245, 158, 11, 0.08);

  /* Status */
  --success:        #10B981;
  --success-dim:    rgba(16, 185, 129, 0.15);
  --error:          #EF4444;
  --error-dim:      rgba(239, 68, 68, 0.15);
  --info:           #3B82F6;
  --info-dim:       rgba(59, 130, 246, 0.15);

  /* Trade Colors (5 sequential trades) */
  --t1: #F59E0B;
  --t2: #06B6D4;
  --t3: #10B981;
  --t4: #8B5CF6;
  --t5: #F97316;

  /* Typography */
  --font-sans: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-pill: 9999px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-btn:  0 4px 20px rgba(0, 0, 0, 0.4);

  /* Layout */
  --header-h:     64px;
  --nav-h:        52px;
  --mobile-nav-h: 66px;
  --content-max:  1400px;
  --panel-pad:    28px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-std:  220ms ease;
  --t-slow: 350ms ease;
}

/* ── Light Theme Override ── */
[data-theme="light"] {
  --bg-base:        #F0F4FA;
  --bg-surface:     #FFFFFF;
  --bg-card:        #FFFFFF;
  --bg-card-hover:  #F8FAFF;
  --bg-input:       #F4F7FC;

  --border:         #DDE3EE;
  --border-subtle:  #EEF2F8;
  --border-focus:   #B45309;

  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;

  --gold:           #B45309;
  --gold-hover:     #92400E;
  --gold-dim:       #D97706;
  --gold-glow:      rgba(180, 83, 9, 0.2);
  --gold-surface:   rgba(180, 83, 9, 0.07);

  --success:        #059669;
  --error:          #DC2626;
  --info:           #2563EB;

  --shadow-card:    0 2px 16px rgba(0, 0, 0, 0.08);
  --shadow-btn:     0 2px 10px rgba(0, 0, 0, 0.12);
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--t-slow), color var(--t-slow);
}

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
button { font-family: var(--font-sans); cursor: pointer; }
input, select, textarea { font-family: var(--font-sans); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

.hidden { display: none !important; }


/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color var(--t-slow), border-color var(--t-slow);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--gold);
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.logo-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--gold), var(--gold-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

@media (max-width: 680px) { .header-tagline { display: none; } }

.theme-toggle {
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-std);
}

.theme-toggle:hover {
  border-color: var(--gold); color: var(--gold); background: var(--gold-surface);
}

.theme-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

[data-theme="dark"]  .theme-moon { display: none; }
[data-theme="dark"]  .theme-sun  { display: block; }
[data-theme="light"] .theme-sun  { display: none; }
[data-theme="light"] .theme-moon { display: block; }


/* ============================================================
   TAB NAVIGATION
   ============================================================ */
.tab-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--t-slow);
}

.desktop-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 100;
  display: flex;
  height: var(--nav-h);
  padding: 0 24px;
  gap: 4px;
  align-items: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
}

.desktop-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 0 18px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500;
  border-radius: var(--r-md) var(--r-md) 0 0;
  white-space: nowrap;
  transition: all var(--t-std);
  position: relative;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform var(--t-std);
}

.tab-btn:hover { color: var(--text-primary); background: var(--gold-surface); }
.tab-btn.active { color: var(--gold); background: var(--gold-surface); font-weight: 600; }
.tab-btn.active::after { transform: scaleX(1); }
.tab-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.tab-icon { font-size: 1rem; line-height: 1; }

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--mobile-nav-h);
  border-top: 1px solid var(--border);
  border-bottom: none;
  padding: 0;
  grid-template-columns: repeat(6, 1fr);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}

.mobile-nav .tab-btn {
  flex-direction: column; gap: 4px;
  height: 100%; border-radius: 0; padding: 8px 4px;
  font-size: 0.7rem; font-weight: 500;
}

.mobile-nav .tab-btn::after { top: 0; bottom: auto; height: 2px; border-radius: 0 0 2px 2px; }
.mobile-nav .tab-icon { font-size: 1.2rem; }

@media (max-width: 768px) {
  .desktop-nav { display: none; }
  .mobile-nav  { display: grid; }
  .main-content { padding-bottom: var(--mobile-nav-h) !important; }
}


/* ============================================================
   ABOUT TAB
   ============================================================ */
.about-wrapper {
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 520px;
  width: 100%;
  text-align: center;
}

.about-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 28px;
}

.about-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.about-qr {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  border: 3px solid var(--border);
  object-fit: contain;
  background: #fff;
  padding: 6px;
}

.about-qr-label {
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
  letter-spacing: 0.04em;
}


/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  text-align: center;
  padding: 14px 24px;
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  border-top: 1px solid var(--border);
  background: var(--surface, #0f172a);
}

.app-footer a {
  color: var(--accent, #F59E0B);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .app-footer { margin-bottom: var(--mobile-nav-h); }
}


/* ============================================================
   MAIN CONTENT & TAB PANELS
   ============================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
}

.tab-panel {
  display: none;
  padding: var(--panel-pad);
  max-width: var(--content-max);
  margin: 0 auto;
  animation: fadeSlideUp 0.25s ease;
}

.tab-panel.active { display: block; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-header { margin-bottom: 28px; }
.panel-title  { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; }
.panel-desc   { font-size: 0.9rem; color: var(--text-secondary); }

@media (max-width: 640px) {
  .tab-panel   { padding: 16px; }
  .panel-title { font-size: 1.35rem; }
}


/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-secondary);
}

.empty-icon  { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.empty-desc  { font-size: 0.875rem; color: var(--text-muted); max-width: 340px; margin: 0 auto; }


/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: background-color var(--t-slow), border-color var(--t-slow);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.card-title    { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); }

.card-body      { padding: 20px 24px 24px; }
.card-body.no-pad { padding: 0; }

@media (max-width: 640px) {
  .card-header { padding: 16px 16px 12px; }
  .card-body   { padding: 16px; }
}


/* ============================================================
   SETUP GRID
   ============================================================ */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  .setup-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 22px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.label-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--t-std), box-shadow var(--t-std), background-color var(--t-slow);
}

.form-input:hover { border-color: color-mix(in srgb, var(--border) 50%, var(--gold) 50%); }
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.form-input::placeholder { color: var(--text-muted); }

/* Prefix / Suffix */
.input-affix-wrap { position: relative; display: flex; align-items: center; }

.input-prefix {
  position: absolute; left: 13px;
  color: var(--gold); font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600;
  pointer-events: none; z-index: 1;
}

.input-suffix {
  position: absolute; right: 13px;
  color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem;
  pointer-events: none; z-index: 1; white-space: nowrap;
}

.form-input.has-prefix { padding-left: 30px; }
.form-input.has-suffix { padding-right: 42px; }
.days-suffix { font-size: 0.72rem; }

/* Slider row */
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-number { flex-shrink: 0; width: 110px; }
.slider-number .form-input { width: 110px; text-align: right; padding-right: 38px; }

/* Range slider */
.form-slider {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px;
  background: var(--border);
  outline: none; cursor: pointer;
  transition: background var(--t-slow);
}

.form-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gold); cursor: pointer;
  box-shadow: 0 0 0 3px var(--gold-surface), 0 2px 8px rgba(0,0,0,0.4);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.form-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gold); cursor: pointer; border: none;
  box-shadow: 0 0 0 3px var(--gold-surface), 0 2px 8px rgba(0,0,0,0.4);
}

.form-slider:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px var(--gold-surface), 0 4px 12px var(--gold-glow);
}

.form-slider:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }


/* ============================================================
   TRADE COUNT BUTTONS
   ============================================================ */
.trade-fieldset { border: none; }

.trade-count-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.trade-count-btn {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-std);
}

.trade-count-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-surface); }
.trade-count-btn.active {
  border-color: var(--gold);
  background: var(--gold-surface);
  color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.trade-count-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.trade-chain-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}


/* ============================================================
   SIMULATION PREVIEW BOX
   ============================================================ */
.sim-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  transition: border-color var(--t-slow), background var(--t-slow);
}

.sim-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sim-preview-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  min-width: 110px;
}

.sim-preview-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
}

.sim-preview-chain {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chain-item {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.chain-arrow {
  color: var(--text-muted);
  font-size: 0.85rem;
}


/* ============================================================
   RUN BUTTON
   ============================================================ */
.run-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
}

.btn-run {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 52px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #0A0500;
  border: none;
  border-radius: var(--r-xl);
  font-family: var(--font-sans);
  font-size: 1.05rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 40px var(--gold-glow), var(--shadow-btn);
  transition: all var(--t-std);
  position: relative; overflow: hidden;
}

.btn-run::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

.btn-run:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 60px var(--gold-glow), 0 8px 32px rgba(0,0,0,0.5);
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
}

.btn-run:active  { transform: translateY(-1px); }
.btn-run:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-run-icon { font-size: 1rem; }

.run-hint { font-size: 0.78rem; color: var(--text-muted); }
.run-hint kbd {
  display: inline-block; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-card); font-family: var(--font-mono);
  font-size: 0.75rem; color: var(--text-secondary);
  box-shadow: 0 1px 0 var(--border);
}


/* ============================================================
   GENERIC BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-family: var(--font-sans); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all var(--t-std); white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-secondary {
  background: var(--bg-card); color: var(--text-secondary); border-color: var(--border);
}

.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--gold); color: var(--gold); }

.btn-ghost {
  background: transparent; color: var(--text-muted); border-color: transparent;
}

.btn-ghost:hover { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }


/* ============================================================
   TABLE CONTROLS
   ============================================================ */
.table-controls {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.filter-group {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.filter-label {
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700;
}

.trade-filter-btns {
  display: flex; gap: 6px; flex-wrap: wrap;
}

.trade-filter-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap;
}

.trade-filter-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-surface); }
.trade-filter-btn.active { background: var(--gold-surface); border-color: var(--gold); color: var(--gold); }
.trade-filter-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.export-group { display: flex; gap: 8px; }


/* ============================================================
   RESULTS TABLE
   ============================================================ */
.table-scroll-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  outline: none;
  -webkit-overflow-scrolling: touch;
  max-height: 680px;
  overflow-y: auto;
}

.table-scroll-wrapper:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  min-width: 540px;
}

.results-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.results-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  transition: background var(--t-slow);
}

.results-table th.th-day { text-align: center; min-width: 60px; }

.results-table td {
  padding: 8px 14px;
  text-align: right;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  transition: background var(--t-fast);
}

.results-table td.td-day {
  text-align: center;
  color: var(--text-muted);
  font-weight: 600; font-size: 0.78rem;
}

.results-table td.td-earned { color: var(--success); font-weight: 600; }
.results-table tr:hover td  { background: var(--bg-card-hover); }
.results-table tbody tr:last-child td { border-bottom: none; }

/* ── Trade Section Header Row ── */
.trade-header-row td {
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-card-hover);
  border-top: 2px solid var(--trade-color, var(--gold));
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
  font-family: var(--font-sans);
}

.trade-header-row:first-child td {
  border-top: none;
}

.trade-header-badge {
  display: inline-flex; align-items: center;
  background: var(--trade-color, var(--gold));
  color: #000;
  font-size: 0.7rem; font-weight: 800;
  padding: 2px 9px; border-radius: var(--r-pill);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-right: 10px;
}

.trade-header-start {
  color: var(--trade-color, var(--gold));
  font-family: var(--font-mono); font-size: 0.85rem;
}

.trade-header-from {
  color: var(--text-muted);
  font-size: 0.75rem; font-weight: 500;
  margin-left: 8px;
}

/* ── Trade Summary Row ── */
.trade-summary-row td {
  padding: 9px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 2px solid var(--trade-color, var(--gold));
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

.trade-summary-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trade-summary-earned {
  color: var(--success);
  font-family: var(--font-mono);
  font-weight: 700;
}

.trade-summary-end-cap {
  font-family: var(--font-mono);
  font-weight: 700;
}

.trade-summary-pct {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 6px;
}


/* ============================================================
   CHART
   ============================================================ */
.chart-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chart-toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-card);
}

.chart-toggle-btn {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: all var(--t-std);
}

.chart-toggle-btn:last-child { border-right: none; }
.chart-toggle-btn:hover { background: var(--gold-surface); color: var(--gold); }
.chart-toggle-btn.active { background: var(--gold); color: #000; }
.chart-toggle-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* Trade color legend for chart */
.chart-trade-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
}

.legend-swatch {
  width: 24px; height: 4px;
  border-radius: 2px;
}

.chart-offline {
  background: var(--error-dim);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--r-md);
  padding: 14px 18px;
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}

.chart-container {
  position: relative;
  width: 100%; height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

@media (max-width: 640px) { .chart-container { height: 320px; padding: 12px; } }


/* ============================================================
   SUMMARY STATS — Per-Trade Table
   ============================================================ */
.summary-table-card { margin-bottom: 28px; }

.summary-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.summary-trade-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  min-width: 560px;
}

.summary-trade-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 12px 16px;
  text-align: right;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.summary-trade-table th:first-child { text-align: left; }

.summary-trade-table td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 500;
}

.summary-trade-table td:first-child { text-align: left; }

.summary-trade-table tr:last-child td { border-bottom: none; }
.summary-trade-table tbody tr:hover td { background: var(--bg-card-hover); }

.trade-label-cell {
  display: flex; align-items: center; gap: 10px;
}

.trade-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

.trade-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
}

.earned-cell { color: var(--success); font-weight: 700; }
.growth-cell { font-weight: 600; }

/* Totals row */
.summary-trade-table .totals-row td {
  background: var(--gold-surface);
  border-top: 2px solid var(--gold);
  border-bottom: none;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
}

.summary-trade-table .totals-row td .trade-name { color: var(--gold); }


/* ============================================================
   SUMMARY STATS — Overall Cards
   ============================================================ */
.overall-summary-section { margin-top: 8px; }

.overall-summary-title {
  font-size: 1rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
}

.overall-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) { .overall-cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .overall-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .overall-cards-grid { grid-template-columns: 1fr; } }

.overall-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-card);
  transition: background var(--t-slow), border-color var(--t-slow);
}

.overall-card.highlight {
  background: var(--gold-surface);
  border-color: var(--gold-glow);
  border-width: 2px;
}

.overall-card-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

.overall-card-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.overall-card.highlight .overall-card-value {
  font-size: 1.4rem;
  color: var(--gold);
}

.overall-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.value-up   { color: var(--success) !important; }
.value-mult { color: var(--gold) !important; }


/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 13, 26, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-slow);
}

[data-theme="light"] .loading-overlay { background: rgba(240, 244, 250, 0.85); }

.loading-overlay.visible { opacity: 1; pointer-events: all; }

.spinner-wrapper {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}

.spinner {
  width: 52px; height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  box-shadow: 0 0 20px var(--gold-glow);
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text { font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }


/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 16px;
  z-index: 600;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 32px);
}

.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow-card);
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform var(--t-slow), opacity var(--t-slow);
  pointer-events: all;
  line-height: 1.4;
}

.toast.visible { transform: translateX(0); opacity: 1; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--error); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-icon    { font-size: 0.9rem; flex-shrink: 0; line-height: 1.5; }
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--error); }
.toast-info    .toast-icon { color: var(--info); }
.toast-message { flex: 1; }


/* ============================================================
   PRINT STYLESHEET
   ============================================================ */
@media print {
  .app-header,
  .tab-nav,
  .desktop-nav,
  .mobile-nav,
  #loading-overlay,
  #toast-container,
  .table-controls,
  .chart-controls,
  .chart-container,
  .run-section,
  .empty-state,
  .panel-desc,
  #tab-setup,
  #tab-chart,
  #tab-summary { display: none !important; }

  body {
    background: #fff;
    color: #000;
    font-family: Arial, sans-serif;
    font-size: 10pt;
  }

  .main-content { overflow: visible; }
  .tab-panel    { display: none !important; padding: 0 !important; }
  #tab-table    { display: block !important; }

  .panel-title  { font-size: 16pt; margin-bottom: 10pt; color: #000; }

  .table-scroll-wrapper {
    overflow: visible; border: none; box-shadow: none; max-height: none;
  }

  .results-table { width: 100%; border-collapse: collapse; font-size: 8pt; }

  .results-table th,
  .results-table td {
    border: 1px solid #ccc;
    padding: 4pt 6pt;
    text-align: right;
    color: #000;
    background: #fff !important;
  }

  .results-table th { background: #f0f0f0 !important; font-weight: bold; }
  .results-table td.th-day,
  .results-table td.td-day { text-align: center; }

  .trade-header-row td {
    background: #e8e8e8 !important;
    border-top: 2pt solid #333 !important;
    font-weight: bold;
    color: #000 !important;
  }

  .trade-summary-row td { background: #f8f8f8 !important; border-top: 1pt solid #999 !important; }

  .hidden { display: none !important; }
  #table-content { display: block !important; }
  #table-no-results { display: none !important; }
}


/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar         { width: 6px; height: 6px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ============================================================
   FOCUS RING
   ============================================================ */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }


/* ============================================================
   THEME TRANSITION UTILITY
   ============================================================ */
.app-header, .tab-nav, .card, .form-input,
.trade-count-btn, .overall-card, .toast, .sim-preview,
.trade-filter-btn, .chart-toggle-btn, .calc-btn {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: var(--t-slow);
  transition-timing-function: ease;
}


/* ============================================================
   CALCULATOR
   ============================================================ */
.calc-wrapper {
  display: flex;
  justify-content: center;
  padding: 8px 0 24px;
}

.calc-body {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card), 0 0 48px rgba(0,0,0,0.25);
}

/* Display */
.calc-display {
  padding: 24px 24px 16px;
  text-align: right;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  transition: background var(--t-slow);
}

.calc-expression {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 18px;
  word-break: break-all;
  line-height: 1.4;
}

.calc-result {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
  word-break: break-all;
  transition: color var(--t-std);
}

.calc-result.calc-result--answer {
  color: var(--gold);
}

/* Button grid */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
}

.calc-btn {
  border: none;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 500;
  padding: 0;
  height: 72px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.calc-btn:hover  { background: var(--bg-card-hover); }
.calc-btn:active { filter: brightness(1.2); transform: scale(0.96); }
.calc-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; z-index: 1; }

/* Function buttons (C, +/-, %) */
.calc-fn {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
}

.calc-fn:hover { background: color-mix(in srgb, var(--bg-surface) 60%, var(--bg-card-hover) 40%); }

/* Operator buttons (/, *, -, +) */
.calc-op {
  background: var(--gold-surface);
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: 400;
}

.calc-op:hover         { background: color-mix(in srgb, var(--gold-surface) 60%, var(--gold) 20%); }
.calc-op.calc-op--active {
  background: var(--gold);
  color: #000;
}

/* Equals button */
.calc-eq {
  background: var(--gold);
  color: #000;
  font-size: 1.4rem;
  font-weight: 600;
}

.calc-eq:hover  { background: var(--gold-hover); }
.calc-eq:active { background: var(--gold-dim); }

/* Wide zero button */
.calc-zero {
  grid-column: span 2;
  justify-content: flex-start;
  padding-left: 28px;
}

@media (max-width: 480px) {
  .calc-body { border-radius: var(--r-lg); }
  .calc-btn  { height: 64px; font-size: 1.1rem; }
  .calc-result { font-size: 2rem; }
}
