﻿/* ═══════════════════════════════════════════
   VORTEX DESIGN SYSTEM v1.0
   Fonts: Bricolage Grotesque + Inter + DM Mono
   Icons: Lucide (stroke, 1.75px, 18px default)
═══════════════════════════════════════════ */

/* ── CUSTOM PROPERTIES ───────────────────── */
:root {
  /* Backgrounds — warm purple-tinted depth */
  --bg:         #12122A;
  --surface:    #1A1A32;
  --surface-2:  #22223C;
  --surface-3:  #2A2A48;

  /* Ink (kept for legacy) */
  --ink:         #F4F4F8;
  --ink-soft:    #E0E0EC;

  /* Text scale — primary names for legacy compat */
  --text-primary:   rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.50);
  --text-tertiary:  rgba(255,255,255,0.24);
  --text-ghost:     rgba(255,255,255,0.12);

  /* New text aliases */
  --text-1: rgba(255,255,255,0.92);
  --text-2: rgba(255,255,255,0.50);
  --text-3: rgba(255,255,255,0.24);
  --text-4: rgba(255,255,255,0.12);

  /* Borders */
  --border:       rgba(255,255,255,0.06);
  --border-2:     rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.10);

  /* Brand accents */
  --indigo:      #7C6FE0;
  --indigo-hover:#6B5FD0;
  --indigo-dim:  rgba(124,111,224,0.12);
  --indigo-glow: rgba(124,111,224,0.20);
  --indigo-light:rgba(124,111,224,0.12);
  --indigo-ring: rgba(124,111,224,0.25);
  --lime:        #C8F135;
  --lime-dim:    rgba(200,241,53,0.10);

  /* Trading semantic — lime/purple palette */
  --green:       #C8F135;
  --green-dim:   rgba(200,241,53,0.10);
  --profit:      #C8F135;
  --profit-bg:   rgba(200,241,53,0.10);
  --profit-border: rgba(200,241,53,0.20);
  --red:         #E879A8;
  --red-dim:     rgba(232,121,168,0.10);
  --loss:        #E879A8;
  --loss-bg:     rgba(232,121,168,0.10);
  --loss-border: rgba(232,121,168,0.20);
  --gold:        #B4A0F4;
  --gold-dim:    rgba(180,160,244,0.10);
  --caution:     #B4A0F4;
  --caution-bg:  rgba(180,160,244,0.10);
  --caution-border: rgba(180,160,244,0.20);

  /* Calendar */
  --cal-green-bg:     rgba(200,241,53,0.12);
  --cal-green-text:   #C8F135;
  --cal-green-border: rgba(200,241,53,0.25);
  --cal-yellow-bg:    rgba(180,160,244,0.12);
  --cal-yellow-text:  #B4A0F4;
  --cal-yellow-border:rgba(180,160,244,0.25);
  --cal-red-bg:       rgba(232,121,168,0.12);
  --cal-red-text:     #E879A8;
  --cal-red-border:   rgba(232,121,168,0.25);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.45), 0 4px 12px rgba(0,0,0,0.25);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.3);

  /* Radii */
  --r-xs:  6px;
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Typography */
  --font-head: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
  /* Legacy aliases */
  --font-serif: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-sans:  'Inter', system-ui, sans-serif;
  --fh: 'Bricolage Grotesque', system-ui, sans-serif;
  --fb: 'Inter', system-ui, sans-serif;
  --fm: 'DM Mono', monospace;

  /* Legacy color aliases */
  --white: #111119;
  --off: #17171F;
  --off-2: #1E1E28;
  --text: rgba(255,255,255,0.92);
  --green-bg: rgba(200,241,53,0.10);
  --green-mid: rgba(200,241,53,0.25);
  --red-bg: rgba(232,121,168,0.10);
  --red-mid: rgba(232,121,168,0.25);
  --gold-bg: rgba(180,160,244,0.10);
  --gold-mid: rgba(180,160,244,0.25);
  --indigo-mid: rgba(124,111,224,0.25);
  --ink-2: #E0E0EC;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 0.12s;
  --med:  0.22s;
  --slow: 0.35s;

  /* Dashboard v2 — deep palette */
  --bg-deep:     #070b10;
  --surface-d:   #0e1420;
  --surface-d2:  #131b28;
  --surface-d3:  #18223a;
  --border-d:    #1a2236;
  --border-d2:   #222d42;
  --purple-v:    #7c6ff7;
  --purple-vd:   rgba(124,111,247,.1);
  --purple-vb:   rgba(124,111,247,.22);
  --amber-v:     #fbbf24;
  --amber-vd:    rgba(251,191,36,.07);
  --amber-vb:    rgba(251,191,36,.18);
  --teal-v:      #2dd4bf;
  --teal-vd:     rgba(45,212,191,.07);
  --teal-vb:     rgba(45,212,191,.2);
}

/* ── LIGHT MODE TOKEN OVERRIDES ──────────── */
[data-theme="light"] {
  --bg:         #F7F7FA;
  --surface:    #FFFFFF;
  --surface-2:  #F3F3F8;
  --surface-3:  #EAEAEF;
  --border:     rgba(0,0,0,0.07);
  --border-2:   rgba(0,0,0,0.12);
  --text-1:     #0c0c0e;
  --text-2:     #6B6B80;
  --text-3:     #9292a0;
  --text-4:     #c4c4cc;
  --text-primary:   #0c0c0e;
  --text-secondary: #6B6B80;
  --text-tertiary:  #9292a0;
  --text-ghost:     #c4c4cc;
  --indigo-dim:  rgba(124,111,224,0.08);
  --indigo-glow: rgba(124,111,224,0.15);
  --green-dim:   rgba(5,150,105,0.08);
  --red-dim:     rgba(220,38,38,0.08);
  --gold-dim:    rgba(124,111,224,0.08);
  --green:       #059669;
  --red:         #DC2626;
  --gold:        #7C6FE0;
  --profit:      #059669;
  --loss:        #DC2626;
  --caution:     #7C6FE0;
  --shadow-xs:   0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --cal-green-bg:     rgba(5,150,105,0.08);
  --cal-green-text:   #059669;
  --cal-green-border: rgba(5,150,105,0.20);
  --cal-yellow-bg:    rgba(124,111,224,0.08);
  --cal-yellow-text:  #7C6FE0;
  --cal-yellow-border:rgba(124,111,224,0.20);
  --cal-red-bg:       rgba(220,38,38,0.08);
  --cal-red-text:     #DC2626;
  --cal-red-border:   rgba(220,38,38,0.20);
}

/* ── RESET ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--slow) var(--ease), color var(--slow) var(--ease);
}
img, svg { display: block; max-width: 100%; }
button { font-family: var(--font-sans); cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── ICONS (Lucide) ──────────────────────── */
.icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; stroke-width: 1.75; }
.icon-md { width: 20px; height: 20px; stroke-width: 1.5; }
.icon-lg { width: 24px; height: 24px; stroke-width: 1.5; }
.icon-xl { width: 32px; height: 32px; stroke-width: 1.25; }

/* ── TYPOGRAPHY ──────────────────────────── */
.font-serif { font-family: var(--font-serif); }
.font-sans  { font-family: var(--font-sans); }
.font-mono  { font-family: var(--font-mono); }

.text-xs   { font-size: 0.7rem;   line-height: 1.4; }
.text-sm   { font-size: 0.8rem;   line-height: 1.5; }
.text-base { font-size: 0.875rem; line-height: 1.6; }
.text-md   { font-size: 1rem;     line-height: 1.6; }
.text-lg   { font-size: 1.125rem; line-height: 1.5; }
.text-xl   { font-size: 1.25rem;  line-height: 1.4; }
.text-2xl  { font-size: 1.5rem;   line-height: 1.3; }
.text-3xl  { font-size: 1.875rem; line-height: 1.2; }
.text-4xl  { font-size: 2.25rem;  line-height: 1.15; }
.text-5xl  { font-size: 3rem;     line-height: 1.1; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-profit    { color: var(--profit); }
.text-loss      { color: var(--loss); }
.text-caution   { color: var(--caution); }
.text-indigo    { color: var(--indigo); }
.text-green  { color: var(--profit); }
.text-red    { color: var(--loss); }
.text-gold   { color: var(--caution); }
.text-muted  { color: var(--text-tertiary); }

.font-300 { font-weight: 300; }
.font-400 { font-weight: 400; }
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }

.label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

/* ── LAYOUT ──────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 48px; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 0 48px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.g-main { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

.mb-4  { margin-bottom: 4px; }
.mb-6  { margin-bottom: 6px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-auto { margin-top: auto; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ── CARDS ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--med) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-sm { padding: 16px; border-radius: var(--r-sm); }
.card-lg { padding: 32px; border-radius: var(--r-lg); }

.kpi { position: relative; overflow: visible; }
.kpi::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 0 0 var(--r) var(--r);
  overflow: hidden;
}
.kpi-profit::after  { background: var(--profit); }
.kpi-loss::after    { background: var(--loss); }
.kpi-indigo::after  { background: var(--indigo); }
.kpi-caution::after { background: var(--caution); }
.kpi-neutral::after { background: var(--border-strong); }
.kpi-green::after  { background: var(--profit); }
.kpi-red::after    { background: var(--loss); }
.kpi-gold::after   { background: var(--caution); }

.card-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title {
  font-size: 0.68rem; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 1.1px; margin-bottom: 10px;
}
.card-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1.1;
  color: var(--text-primary);
}
.card-value.mono {
  font-family: var(--font-mono);
  font-size: 1.75rem;
}
.card-sub {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.card-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  color: var(--text-ghost);
}

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  transition: all var(--fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 1px 3px var(--indigo-ring), 0 4px 12px var(--indigo-ring);
}
.btn-primary:hover {
  background: var(--indigo-hover);
  box-shadow: 0 2px 6px var(--indigo-ring), 0 6px 20px var(--indigo-ring);
  transform: translateY(-1px);
}
.btn-indigo {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 1px 3px var(--indigo-ring), 0 4px 12px var(--indigo-ring);
}
.btn-indigo:hover {
  background: var(--indigo-hover);
  box-shadow: 0 2px 6px var(--indigo-ring), 0 6px 20px var(--indigo-ring);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--ink);
  background: var(--surface-2);
}

.btn-ink {
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}
.btn-ink:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--loss-bg);
  color: var(--loss);
  border: 1px solid var(--loss-border);
}
.btn-danger:hover { background: var(--loss); color: #fff; }

.btn-success {
  background: var(--profit-bg);
  color: var(--profit);
  border: 1px solid var(--profit-border);
}
.btn-success:hover { background: var(--profit); color: #fff; }

.btn-white { background: #fff; color: var(--ink); }
.btn-white:hover { background: var(--surface-2); }

.btn-sm { padding: 7px 14px; font-size: 0.78rem; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 32px; font-size: 0.92rem; border-radius: 10px; }
.btn-xl { padding: 16px 40px; font-size: 1rem; border-radius: 10px; }
.btn-full { width: 100%; }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-sm); background: transparent;
  border: 1.5px solid var(--border); color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--fast) var(--ease);
}
.btn-icon:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--surface-2); }
.btn-icon-sm { width: 30px; height: 30px; }

/* ── TAGS & BADGES ───────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tag-profit  { background: var(--profit-bg);  color: var(--profit);  border: 1px solid var(--profit-border); }
.tag-loss    { background: var(--loss-bg);    color: var(--loss);    border: 1px solid var(--loss-border); }
.tag-caution { background: var(--caution-bg); color: var(--caution); border: 1px solid var(--caution-border); }
.tag-indigo  { background: var(--indigo-light); color: var(--indigo); border: 1px solid var(--indigo-ring); }
.tag-ghost   { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.tag-ink     { background: var(--ink); color: var(--surface); }
.tag-green { background: var(--profit-bg); color: var(--profit); border: 1px solid var(--profit-border); }
.tag-red   { background: var(--loss-bg); color: var(--loss); border: 1px solid var(--loss-border); }
.tag-gold  { background: var(--caution-bg); color: var(--caution); border: 1px solid var(--caution-border); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 0.65rem; font-weight: 700;
  background: var(--loss); color: #fff;
}
.badge-gold { background: var(--caution); }
.badge-indigo { background: var(--indigo); }

/* ── FORM ELEMENTS ───────────────────────── */
.field { margin-bottom: 18px; }
.field-label,
.field label {
  display: block; font-size: 0.68rem; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 7px;
}
.field input,
.field select,
.field textarea {
  width: 100%; background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-primary); font-family: var(--font-sans);
  font-size: 0.875rem; padding: 11px 14px;
  outline: none; transition: border-color var(--fast), background var(--fast);
  -webkit-appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--indigo); background: var(--surface);
  box-shadow: 0 0 0 3px var(--indigo-ring);
}
.field input::placeholder { color: var(--text-ghost); }
.field textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.field select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8A96' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* ── Premium select & option styling (global) ── */
select,
.sel {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 11px 14px;
  padding-right: 36px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select:hover,
.sel:hover {
  border-color: var(--border-2);
  background-color: var(--surface-3);
}
select:focus,
.sel:focus {
  border-color: var(--indigo);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--indigo-ring);
}
select option,
.sel option {
  background-color: var(--surface-2);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 10px 14px;
  line-height: 1.6;
  font-weight: 400;
}
select option:checked,
.sel option:checked {
  background: var(--indigo-dim);
  color: var(--text-primary);
}
select option:hover,
.sel option:hover {
  background: var(--surface-3);
}
select:disabled,
.sel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="range"] {
  -webkit-appearance: none; height: 4px; border-radius: 2px;
  background: var(--border-strong); cursor: pointer; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--indigo); border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm); cursor: pointer;
}

/* ── TABLE ───────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead { background: var(--surface-2); }
thead th {
  padding: 10px 14px; text-align: left; font-size: 0.63rem; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.09em;
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.td-strong { font-weight: 600; color: var(--text-primary); }
.td-mono { font-family: var(--font-mono); }
.td-profit { font-family: var(--font-mono); font-weight: 700; color: var(--profit); }
.td-loss   { font-family: var(--font-mono); font-weight: 700; color: var(--loss); }

/* ── DIVIDER ─────────────────────────────── */
.divider { height: 1px; background: var(--border); }
.divider-strong { height: 1px; background: var(--border-strong); }

/* ── SCROLL REVEAL ───────────────────────── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ── SKELETON LOADER ─────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px); z-index: 200;
}
.modal-overlay.hidden { display: none !important; }
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
  z-index: 201; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px); overflow-y: auto; padding: 32px;
}
.modal.hidden { display: none !important; }
.modal-title {
  font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: 20px;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; color: var(--text-tertiary);
}

/* ── DRAWER (right-side) ─────────────────── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl); z-index: 200;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--med) var(--ease);
}
.drawer.open { transform: translateX(0); }

/* ── TOOLTIP ─────────────────────────────── */
.tooltip-wrap { position: relative; }
.tooltip-wrap .tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--ink); color: var(--surface);
  font-size: 0.72rem; padding: 5px 10px; border-radius: var(--r-xs);
  white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity var(--fast); z-index: 50;
}
.tooltip-wrap:hover .tooltip { opacity: 1; }
.tooltip[data-tip] { position: relative; }
.tooltip[data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--ink); color: var(--surface);
  padding: 4px 10px; border-radius: 6px; font-size: 0.68rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.tooltip[data-tip]:hover::after { opacity: 1; }

/* ── INFO TIP (ℹ icon with hover popup) ──── */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--text-ghost);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  font-family: var(--font-body);
  cursor: help;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
  vertical-align: middle;
  line-height: 1;
  user-select: none;
  margin-left: 4px;
}
.info-tip:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}
.info-tip::before {
  content: 'i';
}
.info-tip .info-popup {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.74rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.55;
  color: var(--text-2);
  min-width: 220px;
  max-width: 280px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  text-transform: none;
  letter-spacing: 0;
}
.info-tip .info-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
}

/* ── GLOBAL LIGHT MODE INLINE-STYLE FIXES ──────── */
/* Catch-all for inline rgba(255,255,255,...) text colors rendered by JS */
[data-theme="light"] [style*="color:rgba(255,255,255,.2)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.25)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.3)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.35)"] {
  color: #9C9890 !important;
}
[data-theme="light"] [style*="color:rgba(255,255,255,.4)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.45)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.5)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.55)"] {
  color: #5C5854 !important;
}
[data-theme="light"] [style*="color:rgba(255,255,255,.6)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.65)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.7)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.75)"] {
  color: #3D3D47 !important;
}
[data-theme="light"] [style*="color:rgba(255,255,255,.8)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.85)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.9)"],
[data-theme="light"] [style*="color:rgba(255,255,255,.92)"] {
  color: #1A1917 !important;
}

/* Inline background fix: translucent white BGs → translucent black */
[data-theme="light"] [style*="background:rgba(255,255,255,.03)"],
[data-theme="light"] [style*="background:rgba(255,255,255,.04)"],
[data-theme="light"] [style*="background:rgba(255,255,255,.05)"],
[data-theme="light"] [style*="background:rgba(255,255,255,.06)"],
[data-theme="light"] [style*="background:rgba(255,255,255,.08)"] {
  background: rgba(0,0,0,.03) !important;
}

/* Inline border fix */
[data-theme="light"] [style*="border:0.5px solid rgba(255,255,255"],
[data-theme="light"] [style*="border:1px solid rgba(255,255,255"],
[data-theme="light"] [style*="border-bottom:0.5px solid rgba(255,255,255"] {
  border-color: rgba(0,0,0,.08) !important;
}

/* Semantic color remapping for light mode */
[data-theme="light"] [style*="color:#4ade80"] { color: #059669 !important; }
[data-theme="light"] [style*="color:#4ADE80"] { color: #059669 !important; }
[data-theme="light"] [style*="color:#f87171"] { color: #DC2626 !important; }
[data-theme="light"] [style*="color:#F87171"] { color: #DC2626 !important; }
[data-theme="light"] [style*="color:#7c6ff7"] { color: #4F46E5 !important; }
[data-theme="light"] [style*="color:#7C6FE0"] { color: #4F46E5 !important; }
[data-theme="light"] [style*="color:#fbbf24"] { color: #B45309 !important; }
[data-theme="light"] [style*="color:#60a5fa"] { color: #2563EB !important; }
[data-theme="light"] [style*="color:#2dd4bf"] { color: #0D9488 !important; }

/* SVG strokes inside light mode */
[data-theme="light"] svg [style*="stroke:rgba(255,255,255"] {
  stroke: rgba(0,0,0,.06) !important;
}

/* Fill fix for SVG text in clearance/protocol circles */
[data-theme="light"] svg text[fill="rgba(255,255,255,.85)"] { fill: #1A1917 !important; }
[data-theme="light"] svg text[fill="rgba(255,255,255,.3)"] { fill: #9C9890 !important; }
[data-theme="light"] svg circle[stroke="rgba(255,255,255,.06)"] { stroke: rgba(0,0,0,.08) !important; }
  border: 6px solid transparent;
  border-top-color: var(--surface-2);
}
.info-tip:hover .info-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* When tip is near right edge, shift left */
.info-tip.info-tip-left .info-popup {
  left: auto; right: -8px;
  transform: translateX(0) translateY(4px);
}
.info-tip.info-tip-left:hover .info-popup {
  transform: translateX(0) translateY(0);
}
.info-tip.info-tip-left .info-popup::after {
  left: auto; right: 12px;
  transform: none;
}

/* ── NOTIFICATION STRIP ──────────────────── */
.strip {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; border-radius: var(--r-sm);
  font-size: 0.82rem; margin-bottom: 16px;
}
.strip-icon { flex-shrink: 0; margin-top: 1px; }
.strip-text { color: var(--text-secondary); line-height: 1.6; }
.strip-text strong { color: var(--text-primary); font-weight: 600; }
.strip-warn   { background: var(--caution-bg); border: 1px solid var(--caution-border); }
.strip-profit { background: var(--profit-bg);  border: 1px solid var(--profit-border); }
.strip-loss   { background: var(--loss-bg);    border: 1px solid var(--loss-border); }
.strip-info   { background: var(--indigo-light); border: 1px solid var(--indigo-ring); }

/* ── UTILITIES ───────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ── SCROLLBARS ──────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

::selection { background: var(--indigo-light); color: var(--indigo); }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
*:focus:not(:focus-visible) { outline: none; }

.page-content > * { animation: pageIn 0.22s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── MOBILE ──────────────────────────────── */
@media (max-width: 1100px) { .grid-main { grid-template-columns: 1fr; } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 960px)  { .grid-4, .g4 { grid-template-columns: 1fr 1fr; } .grid-3, .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .grid-2, .g2 { grid-template-columns: 1fr; } .grid-3, .g3, .g4 { grid-template-columns: 1fr; } .container, .container-sm { padding: 0 16px; } }
