@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600&display=swap');

/* ════════════════════════════════════════════════════════════
   Investolingo · shared.css · V4.0
   Light-first. Dark is the variant.
   Three card types. Four type scales. Colour is signal only.
   ════════════════════════════════════════════════════════════ */


/* ── SECTION INDEX ──────────────────────────────────────────
   1.  CSS Variables (light = :root, dark = [data-theme="dark"])
   2.  Reset
   3.  Base
   4.  Type Scale
   5.  Header & Nav
   6.  Main Layout
   7.  Card System (Primary · Data · Surface)
   8.  Numeric & Ticker Utilities
   9.  Badges (Zone · Stage · Sector)
  10.  Buttons
  11.  Forms
  12.  Tables
  13.  Modal
  14.  Toast
  15.  Spinner · Divider · Empty State
  16.  Macro Strip
  17.  KPI Cards
  18.  Section Headers
  19.  Scorecard Tab
  20.  Intelligence Tab
  21.  Thesis Tab
  22.  Journal Tab
  23.  Documents Tab
  24.  Lesson Content
  25.  Markdown
  26.  RAG Dots
  27.  Drop Zone
  28.  SVG Diagram Variables
  29.  Logo Wordmark
  30.  Theme Toggle
  31.  Progress Bar
  32.  Scrollbar
  33.  Responsive
   ──────────────────────────────────────────────────────────── */


/* ════════════════════════════════════════════════════════════
   1. CSS VARIABLES
   :root = light (default). Dark overrides in [data-theme="dark"].
   ════════════════════════════════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg:           #F7F5F2;
  --bg-card:      #FFFFFF;
  --bg-card-2:    #F0EDE8;
  --bg-hover:     #EDE9E3;

  /* Borders */
  --border:       #E0DCD4;
  --border-light: #D4CFC8;

  /* Signal colours — data only, never surfaces */
  --gold:         #C8993A;
  --gold-light:   #D4A84C;
  --accent:       #9A7520;
  --accent-light: #B08A2A;
  --green:        #15803D;
  --red:          #B91C1C;
  --amber:        #B45309;
  --blue:         #185FA5;

  /* Text hierarchy */
  --text-1:       #1A1F2E;
  --text-2:       #4A5568;
  --text-3:       #8A93A8;
  --text-4:       #B0B8C8;
  --muted:        #8A93A8;

  /* Surfaces */
  --white:        #FFFFFF;
  --surface-1:    #F4F5F8;
  --surface-2:    #EDEEF2;

  /* Radius */
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;

  /* Fonts */
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* SVG diagram variables — light */
  --svg-bg:        #F0F2F5;
  --svg-bg-green:  #F0FDF4;
  --svg-bg-red:    #FEF2F2;
  --svg-bg-blue:   #EFF6FF;
  --svg-text:      #1A1F2E;
  --svg-muted:     #6B7280;
}

/* ── DARK THEME ── */
[data-theme="dark"] {
  --bg:           #0e0e0e;
  --bg-card:      #1a1a1a;
  --bg-card-2:    #202020;
  --bg-hover:     #242424;
  --border:       #2a2a2a;
  --border-light: #333333;
  --gold:         #c8993a;
  --gold-light:   #e8b84b;
  --green:        #00c087;
  --red:          #ff4d4f;
  --amber:        #f0a500;
  --blue:         #4d8fd1;
  --white:        #f0f0f0;
  --text-1:       #ffffff;
  --text-2:       #f0f0f0;
  --text-3:       #d0d0d0;
  --text-4:       #b0b0b0;
  --muted:        #d0d0d0;
  --surface-1:    #1a1a1a;
  --surface-2:    #202020;

  /* SVG diagram variables — dark */
  --svg-bg:        #1a1a1a;
  --svg-bg-green:  #1e2a1e;
  --svg-bg-red:    #2a1e1e;
  --svg-bg-blue:   #1e1e2a;
  --svg-text:      #e8e8e8;
  --svg-muted:     #a0a0a0;
}


/* ════════════════════════════════════════════════════════════
   2. RESET
   ════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}


/* ════════════════════════════════════════════════════════════
   3. BASE
   ════════════════════════════════════════════════════════════ */
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}


/* ════════════════════════════════════════════════════════════
   4. TYPE SCALE
   Display · Title · Label · Body — four scales, nothing else.
   ════════════════════════════════════════════════════════════ */

/* Display — Playfair Display 600, 26–32px. One per page max. */
.type-display {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

/* Title — Inter 700, 18–20px. Section headers only. */
.type-title,
.section-title {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
  line-height: 1.3;
}

/* Label — Inter 900, 10–11px, uppercase, gold. Card headers, column headers. */
.type-label,
.card-label,
.table-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  line-height: 1;
}

/* Body — Inter 400, 13–14px, line-height 1.7. All content text. */
.type-body {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.7;
}

/* Page header */
.page-header   { margin-bottom: 24px; }
.page-title    { font-size: 20px; font-weight: 700; color: var(--text-1); letter-spacing: -0.3px; margin-bottom: 2px; }
.page-subtitle { font-size: 12px; color: var(--text-3); line-height: 1.5; }


/* ════════════════════════════════════════════════════════════
   5. HEADER & NAV
   ════════════════════════════════════════════════════════════ */
header {
  display: flex;
  align-items: center;
  padding: 0 32px 0 28px;
  height: 100px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  border-bottom: 2px solid var(--border);
  gap: 0;
}

[data-theme="dark"] header {
  background: #111111;
  border-bottom-color: var(--border);
}

/* Logo */
.logo-area {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; flex-shrink: 0;
  margin-right: 40px;
}
.logo-mark {
  display: flex; align-items: center; flex-shrink: 0;
}
.logo-mark img {
  height: 52px; width: 52px;
  display: block; object-fit: contain;
  border-radius: 50%;
}
.logo-text-wrap { display: flex; flex-direction: column; gap: 3px; }
.logo-name {
  font-family: var(--font-ui);
  font-size: 26px; font-weight: 800;
  color: var(--text-1); letter-spacing: -0.5px;
  line-height: 1;
}
.logo-sub {
  font-size: 10px; color: var(--text-3);
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1;
  font-weight: 500;
}
/* Sienna on investo in light, gold in dark */
.logo-investo { color: var(--accent); }
.logo-lingo   { color: var(--accent); }
[data-theme="dark"] .logo-investo { color: var(--gold); }
[data-theme="dark"] .logo-lingo   { color: var(--gold); }

/* Nav links — centre, flex:1 */
.header-right {
  display: flex; align-items: center;
  flex: 1; gap: 0;
}

/* Right actions */
.header-actions {
  display: flex; align-items: center;
  gap: 10px; flex-shrink: 0;
}

/* Nav tabs */
/* Nav icons */
.nav-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
  position: relative;
  top: -1px;
  flex-shrink: 0;
  opacity: 0.75;
}
.nav-btn:hover .nav-icon,
.nav-btn.active .nav-icon { opacity: 1; }

.nav-btn {
  padding: 0 20px;
  height: 52px;
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 15px; font-weight: 500;
  text-decoration: none;
  color: var(--text-2);
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex; align-items: center;
  white-space: nowrap;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  align-self: flex-end;
}
.nav-btn:hover {
  color: var(--text-1);
  border-bottom-color: var(--border);
}

/* Light mode active — sienna */
.nav-btn.active {
  color: var(--accent);
  font-weight: 700;
  border-bottom: 5px solid var(--accent);
}

/* Dark mode active — gold */
[data-theme="dark"] .nav-btn {
  color: var(--text-3);
}
[data-theme="dark"] .nav-btn:hover {
  color: var(--text-1);
  border-bottom-color: var(--border);
}
[data-theme="dark"] .nav-btn.active {
  color: var(--gold);
  font-weight: 700;
  border-bottom: 5px solid var(--gold);
}

/* ── NAV DROPDOWNS ── */
.nav-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
}

.nav-dropdown-trigger {
  background: none;
  border: none;
  cursor: pointer;
  align-self: flex-end;
  height: 52px;
}

.nav-dropdown-caret {
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.6;
  transition: transform 0.15s;
}

.nav-dropdown-trigger[aria-expanded="true"] .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-panel {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  z-index: 9999;
  padding: 4px 0;
}

.nav-dropdown-panel.open { display: block; }

[data-theme="dark"] .nav-dropdown-panel {
  border-top-color: var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.nav-dropdown-item {
  display: block;
  padding: 10px 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.nav-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

.nav-dropdown-item.active {
  color: var(--accent);
  font-weight: 700;
  background: var(--bg-hover);
}

[data-theme="dark"] .nav-dropdown-item { color: var(--text-3); }
[data-theme="dark"] .nav-dropdown-item:hover { background: #1e1e1e; color: var(--text-1); }
[data-theme="dark"] .nav-dropdown-item.active { color: var(--gold); background: #1e1e1e; }



/* ── THEME TOGGLE — segmented pill ── */
.theme-toggle-btn {
  display: flex; align-items: center;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px; gap: 2px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.theme-toggle-btn:hover { border-color: var(--accent); }

.toggle-segment {
  font-size: 13px; font-weight: 500;
  padding: 7px 16px;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-3);
  background: transparent;
  font-family: var(--font-ui);
  white-space: nowrap;
}
.toggle-segment.active {
  background: #FFFFFF;
  color: var(--text-1);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

[data-theme="dark"] .theme-toggle-btn {
  background: var(--bg-card-2);
  border-color: var(--border-light);
}
[data-theme="dark"] .theme-toggle-btn:hover { border-color: var(--gold); }
[data-theme="dark"] .toggle-segment.active {
  background: var(--bg-hover);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Keep .toggle-dot for any legacy references */
.toggle-dot { display: none; }

/* ── PROFILE PILL ── */
.profile-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 16px 6px 6px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.profile-pill:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
[data-theme="dark"] .profile-pill:hover { border-color: var(--gold); }

.profile-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: #FFFFFF; flex-shrink: 0;
  font-family: var(--font-ui);
}
[data-theme="dark"] .profile-avatar { background: var(--gold); color: #111; }

.profile-name {
  font-size: 14px; font-weight: 600;
  color: var(--text-1); white-space: nowrap;
}

/* ── PROFILE DROPDOWN ── */
.profile-dropdown-wrap { position: relative; }
.profile-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 200;
  display: none;
}
[data-theme="dark"] .profile-dropdown {
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.profile-dropdown.open { display: block; }
.dd-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.dd-name  { font-size: 13px; font-weight: 600; color: var(--text-1); }
.dd-email { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.dd-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  color: var(--text-2); cursor: pointer;
  transition: background 0.12s;
  text-decoration: none; width: 100%;
  border: none; background: none; font-family: var(--font-ui);
  text-align: left;
}
.dd-item:hover { background: var(--bg-hover); color: var(--text-1); }
.dd-item.danger { color: var(--red); }
.dd-item.danger:hover { background: rgba(185,28,28,0.06); }
[data-theme="dark"] .dd-item.danger:hover { background: rgba(255,77,79,0.08); }
.dd-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Nav divider */
.nav-divider {
  width: 1px; height: 20px;
  background: var(--border); flex-shrink: 0;
}

/* Header username — hidden, replaced by profile pill */
.header-username { display: none; }
.btn-signout { display: none; }


/* ════════════════════════════════════════════════════════════
   6. MAIN LAYOUT
   ════════════════════════════════════════════════════════════ */
main { padding: 32px 24px 80px; max-width: 1520px; margin: 0 auto; }


/* ════════════════════════════════════════════════════════════
   7. CARD SYSTEM
   Three types only. No improvising.
   ════════════════════════════════════════════════════════════ */

/* ── PRIMARY CARD ──
   Verdict, AI intelligence, key decisions.
   2px gold left border · white bg · distinct header band */
.card-primary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
}

/* ── DATA CARD ──
   Macro tiles, watchlist rows, scorecard tables.
   1px border · white bg · compact */
.card-data,
.card,
.glass,
.table-card,
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── SURFACE CARD ──
   Supporting context, secondary info.
   #F4F5F8 bg · no border */
.card-surface {
  background: var(--surface-1);
  border-radius: var(--radius);
}

/* Dark overrides for all card types */
[data-theme="dark"] .card-primary {
  background: var(--bg-card);
  border-color: var(--border);
  border-left-color: var(--gold);
}
[data-theme="dark"] .card-data,
[data-theme="dark"] .card,
[data-theme="dark"] .glass,
[data-theme="dark"] .table-card,
[data-theme="dark"] .kpi-card {
  background: var(--bg-card);
  border-color: var(--border);
}
[data-theme="dark"] .card-surface {
  background: var(--bg-card-2);
}

/* Card header band */
.card-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-1);
  border-radius: var(--radius) var(--radius) 0 0;
}
[data-theme="dark"] .card-header {
  background: var(--bg-card-2);
  border-bottom-color: var(--border);
}
.card-header-title {
  font-size: 11px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold);
}

/* Table card header */
.table-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--surface-1);
}
[data-theme="dark"] .table-header {
  background: var(--bg-card-2);
  border-bottom-color: var(--border);
}
.table-meta { font-size: 11px; color: var(--text-3); }


/* ════════════════════════════════════════════════════════════
   8. NUMERIC & TICKER UTILITIES
   Always Inter 600, tabular-nums. No system monospace.
   ════════════════════════════════════════════════════════════ */
.num, td, .price, [class*="price"], [class*="value"] {
  font-variant-numeric: tabular-nums;
}
.pii-price {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.pii-ticker {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.pii-mono {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.num-up   { color: var(--green); }
.num-down { color: var(--red); }
.num-flat { color: var(--text-2); }


/* ════════════════════════════════════════════════════════════
   9. BADGES — Zone · Stage · Sector
   Colour is signal only. Never decorative.
   ════════════════════════════════════════════════════════════ */

/* Zone badges */
.zone-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  font-family: var(--font-ui);
}
.zone-green { background: rgba(21,128,61,0.1);    color: #15803D; }
.zone-blue  { background: rgba(29,78,216,0.1);    color: #1D4ED8; }
.zone-amber { background: rgba(180,83,9,0.1);     color: #B45309; }
.zone-red   { background: rgba(185,28,28,0.1);    color: #B91C1C; }
.zone-none  { background: rgba(138,147,168,0.1);  color: var(--text-3); }

[data-theme="dark"] .zone-green { background: rgba(0,192,135,0.12);  color: #00c087; }
[data-theme="dark"] .zone-blue  { background: rgba(77,143,209,0.15); color: #7ab4d8; }
[data-theme="dark"] .zone-amber { background: rgba(240,165,0,0.12);  color: #f0a500; }
[data-theme="dark"] .zone-red   { background: rgba(255,77,79,0.12);  color: #ff4d4f; }
[data-theme="dark"] .zone-none  { background: rgba(80,80,80,0.1);    color: var(--text-3); }

/* Stage badges */
.stage-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  white-space: nowrap; letter-spacing: 0.3px;
  font-family: var(--font-ui);
}
.stage-ADDED         { background: rgba(138,147,168,0.12); color: var(--text-3); }
.stage-RESEARCHING   { background: rgba(24,95,165,0.1);    color: #185FA5; }
.stage-THESIS_FORMED { background: rgba(180,83,9,0.1);     color: #B45309; }
.stage-PRICED        { background: rgba(181,132,26,0.12);  color: #B5841A; }
.stage-MONITORING    { background: rgba(21,128,61,0.1);    color: #15803D; }

[data-theme="dark"] .stage-ADDED         { background: rgba(100,100,100,0.15); color: var(--text-3); }
[data-theme="dark"] .stage-RESEARCHING   { background: rgba(77,143,209,0.15);  color: #6aabdf; }
[data-theme="dark"] .stage-THESIS_FORMED { background: rgba(240,165,0,0.15);   color: #f0a500; }
[data-theme="dark"] .stage-PRICED        { background: rgba(200,153,58,0.15);  color: #c8993a; }
[data-theme="dark"] .stage-MONITORING    { background: rgba(0,192,135,0.15);   color: #00c087; }

/* Sector chips */
.sector-chip {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  text-transform: uppercase;
  font-family: var(--font-ui);
}
.sector-SEMICONDUCTOR { background: rgba(24,95,165,0.1);   color: #185FA5; }
.sector-CLOUD_PLATFORM{ background: rgba(6,148,162,0.1);   color: #0694A2; }
.sector-TECHNOLOGY    { background: rgba(124,58,237,0.1);  color: #6D28D9; }
.sector-FINANCIAL     { background: rgba(100,116,139,0.1); color: #475569; }
.sector-PAYMENTS      { background: rgba(21,128,61,0.1);   color: #15803D; }
.sector-AGRITECH      { background: rgba(21,128,61,0.08);  color: #166534; }
.sector-HOSPITALITY   { background: rgba(180,83,9,0.1);    color: #B45309; }
.sector-MARINE_ENERGY { background: rgba(181,132,26,0.1);  color: #B5841A; }
.sector-CRUISE        { background: rgba(56,180,200,0.1);  color: #0e7490; }
.sector-AI_INFRA      { background: rgba(124,58,237,0.08); color: #6D28D9; }

[data-theme="dark"] .sector-SEMICONDUCTOR { background: rgba(100,160,220,0.1);  color: #7ab0e0; }
[data-theme="dark"] .sector-CLOUD_PLATFORM{ background: rgba(6,182,212,0.1);   color: #22d3ee; }
[data-theme="dark"] .sector-TECHNOLOGY    { background: rgba(140,100,220,0.1);  color: #a07ade; }
[data-theme="dark"] .sector-FINANCIAL     { background: rgba(180,180,180,0.1);  color: #aaaaaa; }
[data-theme="dark"] .sector-PAYMENTS      { background: rgba(0,192,135,0.1);    color: #00c087; }
[data-theme="dark"] .sector-AGRITECH      { background: rgba(0,192,135,0.08);   color: #4dc9a0; }
[data-theme="dark"] .sector-HOSPITALITY   { background: rgba(240,165,0,0.1);    color: #f0a500; }
[data-theme="dark"] .sector-MARINE_ENERGY { background: rgba(200,153,58,0.1);   color: #c8993a; }
[data-theme="dark"] .sector-CRUISE        { background: rgba(56,180,200,0.1);   color: #4db8cc; }
[data-theme="dark"] .sector-AI_INFRA      { background: rgba(140,100,220,0.08); color: #9070cc; }


/* ════════════════════════════════════════════════════════════
   10. BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--gold);
  color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) { background: var(--gold-light); }

[data-theme="dark"] .btn-primary { color: #0e0e0e; }

.btn-secondary {
  background: var(--bg-card-2);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-light); }

.btn-ghost {
  background: none;
  color: var(--text-2);
  border: 1px solid transparent;
}
.btn-ghost:hover:not(:disabled) { color: var(--text-1); background: var(--bg-hover); }

.btn-danger {
  background: rgba(185,28,28,0.08);
  color: var(--red);
  border: 1px solid rgba(185,28,28,0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(185,28,28,0.15); }

[data-theme="dark"] .btn-danger {
  background: rgba(255,77,79,0.1);
  border-color: rgba(255,77,79,0.2);
}
[data-theme="dark"] .btn-danger:hover:not(:disabled) { background: rgba(255,77,79,0.18); }


/* ════════════════════════════════════════════════════════════
   11. FORMS
   ════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-ui);
}
.form-input, .form-select {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus { border-color: var(--gold); }
.form-input::placeholder { color: var(--text-4); }
.form-select option { background: var(--bg-card); color: var(--text-1); }

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select {
  background: var(--bg-card-2);
  border-color: var(--border-light);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.form-grid .full { grid-column: span 2; }


/* ════════════════════════════════════════════════════════════
   12. TABLES
   ════════════════════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; }
th {
  padding: 9px 14px;
  font-size: 12px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); text-align: left;
  background: #F5EFE0;
  font-family: var(--font-ui);
  border-bottom: 2px solid var(--accent);
}
[data-theme="dark"] th {
  background: var(--bg-card-2);
  border-bottom: 2px solid var(--gold);
  color: var(--gold);
}
td {
  padding: 11px 14px;
  font-size: 13px; font-weight: 400;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-ui);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

[data-theme="dark"] th {
  background: var(--bg-card-2);
  border-bottom-color: var(--border);
}
[data-theme="dark"] td {
  border-bottom-color: var(--border);
}
[data-theme="dark"] tr:hover td { background: var(--bg-hover); }


/* ════════════════════════════════════════════════════════════
   13. MODAL
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.4);
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%; max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.15);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s cubic-bezier(0.16,1,0.3,1);
  -webkit-overflow-scrolling: touch;
}
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .modal-card {
  background: #1e1e1e;
  border-color: var(--border-light);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.modal-sub   { font-size: 12px; color: var(--text-3); margin-bottom: 20px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 18px; line-height: 1;
  padding: 4px 8px; border-radius: 4px; transition: all 0.15s;
}
.modal-close:hover { color: var(--text-1); background: var(--bg-hover); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }


/* ════════════════════════════════════════════════════════════
   14. TOAST
   ════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 20px; right: 16px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-width: 320px;
  animation: toastIn 0.2s ease;
  font-family: var(--font-ui);
  pointer-events: all;
  border: 1px solid transparent;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast-success { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.toast-error   { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.toast-info    { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }

[data-theme="dark"] .toast-success { background: #1a3a2a; color: #00c087; border-color: rgba(0,192,135,0.3); }
[data-theme="dark"] .toast-error   { background: #3a1a1a; color: #ff4d4f; border-color: rgba(255,77,79,0.3); }
[data-theme="dark"] .toast-info    { background: #2a2a1a; color: #f0a500; border-color: rgba(240,165,0,0.3); }


/* ════════════════════════════════════════════════════════════
   15. SPINNER · DIVIDER · EMPTY STATE
   ════════════════════════════════════════════════════════════ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(181,132,26,0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
[data-theme="dark"] .spinner {
  border-color: rgba(200,153,58,0.2);
  border-top-color: var(--gold);
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; gap: 8px; text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-icon  { font-size: 28px; opacity: 0.3; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.empty-sub   { font-size: 12px; color: var(--text-3); max-width: 280px; line-height: 1.6; }

.tab-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 40px 0; color: var(--muted); font-size: 12px;
}


/* ════════════════════════════════════════════════════════════
   16. MACRO STRIP
   ════════════════════════════════════════════════════════════ */
.macro-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: start; }
.macro-card {
  position: relative;
  border-left: 3px solid var(--border);
  padding: 14px 16px; overflow: hidden;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
}
[data-theme="dark"] .macro-card {
  background: var(--bg-card);
  border-color: var(--border);
}
.macro-card[data-key="OIL_BRENT"] { border-left-color: #e87c3e; }
.macro-card[data-key="FED_FUNDS"]  { border-left-color: var(--red); }
.macro-card[data-key="US_10Y"]     { border-left-color: var(--blue); }
.macro-card[data-key="GOLD"]       { border-left-color: var(--gold); }
.macro-card[data-key="USDSGD"]     { border-left-color: var(--green); }
.macro-card[data-key="VIX"]        { border-left-color: var(--amber); }
.macro-card[data-key="HY_SPREAD"]  { border-left-color: #0E7490; }
.macro-card[data-key="M2_GROWTH"]  { border-left-color: #0694A2; }
.macro-card[data-key="DXY"]        { border-left-color: #065F46; }
.macro-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.macro-value { font-size: 22px; font-weight: 700; color: var(--text-1); line-height: 1; letter-spacing: -0.3px; margin: 4px 0 3px; font-variant-numeric: tabular-nums; }
.macro-change { font-size: 11px; font-weight: 500; }
.macro-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-top: 6px; }


/* ════════════════════════════════════════════════════════════
   17. KPI CARDS
   ════════════════════════════════════════════════════════════ */
.kpi-card { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi-accent {
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 3px 0 0 3px;
}
.kpi-label {
  font-size: 10px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 6px;
  font-family: var(--font-ui);
}
.kpi-value {
  font-size: 26px; font-weight: 700;
  color: var(--text-1); line-height: 1.1;
  letter-spacing: -0.5px; margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 11px; color: var(--text-3); }


/* ════════════════════════════════════════════════════════════
   18. SECTION HEADERS
   ════════════════════════════════════════════════════════════ */
.section-block { margin-bottom: 36px; }
.section-header {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}
.section-header:first-of-type,
.section-header.no-rule {
  border-top: none;
  padding-top: 4px;
}
.section-header-left { flex: 1; min-width: 0; }
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.2px;
  line-height: 1.3;
  margin-bottom: 4px;
}
.section-subtitle {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 640px;
}

/* AI bullets */
.bullet-item { color: var(--text-1); }


/* ════════════════════════════════════════════════════════════
   19. SCORECARD TAB
   ════════════════════════════════════════════════════════════ */
.scorecard-section-title {
  font-size: 16px; font-weight: 700;
  color: var(--text-1); margin: 32px 0 12px;
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; padding: 0;
}
.scorecard-section-title:first-child { margin-top: 0; }
.layer-desc { font-size: 13px; font-weight: 400; opacity: 0.55; margin-left: 8px; }

.scorecard-table { width: 100%; border-collapse: collapse; }
.scorecard-table th {
  font-size: 11px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold); padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
[data-theme="dark"] .scorecard-table th { background: var(--bg-card-2); }
.scorecard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-1);
}
[data-theme="dark"] .scorecard-table td { border-bottom-color: rgba(255,255,255,0.04); }
.scorecard-table tr:last-child td { border-bottom: none; }
.scorecard-table tr:hover td { background: var(--bg-hover); }
[data-theme="dark"] .scorecard-table tr:hover td { background: rgba(255,255,255,0.015); }

.metric-value-cell { font-size: 15px; font-weight: 600; white-space: nowrap; cursor: default; padding-top: 2px; font-variant-numeric: tabular-nums; }
.val-green { color: var(--green); }
.val-amber { color: var(--amber); }
.val-red   { color: var(--red); }
.val-none  { color: var(--text-1); }
.metric-empty { color: var(--muted); font-size: 13px; font-weight: 400; }
.metric-commentary { font-size: 13px; color: var(--text-2); line-height: 1.6; }

.threshold-tooltip { position: relative; display: inline-block; }
.threshold-tooltip .tooltip-text {
  visibility: hidden; opacity: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-1); font-size: 10px; border-radius: 6px;
  padding: 6px 10px; position: absolute; z-index: 100;
  bottom: 125%; left: 50%; transform: translateX(-50%);
  white-space: nowrap; transition: opacity 0.15s;
  pointer-events: none; font-weight: 400;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.threshold-tooltip:hover .tooltip-text { visibility: visible; opacity: 1; }


/* ════════════════════════════════════════════════════════════
   20. INTELLIGENCE TAB
   ════════════════════════════════════════════════════════════ */
.intel-section { border-radius: var(--radius); padding: 22px; margin-bottom: 14px; background: var(--bg-card); border: 1px solid var(--border); }
[data-theme="dark"] .intel-section { background: var(--bg-card); border-color: var(--border); }
.intel-section-title { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.intel-text { font-size: 14px; line-height: 1.85; color: var(--text-2); font-weight: 400; white-space: pre-wrap; }
[data-theme="dark"] .intel-text { color: var(--text-1); font-weight: 300; }
.intel-empty { font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.6; }

.intel-collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; cursor: pointer;
  border-bottom: 1px solid var(--border); user-select: none;
}
.intel-collapsible-header:hover { opacity: 0.85; }
.intel-collapsible-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.intel-collapsible-meta  { font-size: 12px; color: var(--muted); margin-top: 3px; }
.intel-collapsible-chevron { font-size: 13px; color: var(--muted); transition: transform 0.2s; }
.intel-collapsible-chevron.open { transform: rotate(180deg); }
.intel-collapsible-body { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.intel-collapsible-body.open { max-height: 2000px; }
.intel-collapsible-body .intel-text { padding: 14px 0 4px; }

.thesis-section-title { font-size: 14px; font-weight: 700; color: var(--gold); margin-bottom: 3px; letter-spacing: 0.08em; text-transform: uppercase; }
.thesis-section-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
.docs-section-heading { font-size: 14px; font-weight: 700; color: var(--text-1); }

.qa-card { border-radius: var(--radius); padding: 20px; margin-top: 20px; background: var(--bg-card); border: 1px solid var(--border); }
.qa-title { font-size: 13px; font-weight: 900; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.qa-input {
  width: 100%; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card-2); color: var(--text-1);
  font-family: var(--font-ui); font-size: 14px; outline: none;
  margin-bottom: 10px; transition: border-color 0.15s;
}
.qa-input:focus { border-color: var(--gold); }
.qa-response {
  margin-top: 14px; padding: 14px; border-radius: 8px;
  background: var(--surface-1); font-size: 14px; line-height: 1.75;
  display: none; color: var(--text-1);
  border: 1px solid var(--border);
}
[data-theme="dark"] .qa-response { background: rgba(255,255,255,0.04); border-color: transparent; }


/* ════════════════════════════════════════════════════════════
   21. THESIS TAB
   ════════════════════════════════════════════════════════════ */
.thesis-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.thesis-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 12px;
  font-family: var(--font-ui);
}
.thesis-text {
  font-size: 14px; line-height: 1.85; color: var(--text-2);
  font-weight: 400; white-space: pre-wrap; min-height: 40px;
}
[data-theme="dark"] .thesis-text { color: var(--text-1); font-weight: 300; }
.thesis-edit-btn { margin-top: 14px; font-size: 11px; }

/* Stage selector */
.stage-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.stage-option {
  padding: 7px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-2); font-size: 12px; font-family: var(--font-ui);
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.stage-option:hover { border-color: var(--gold); color: var(--gold); }
.stage-option.active {
  background: var(--gold); border-color: var(--gold);
  color: #FFFFFF; font-weight: 600;
}
[data-theme="dark"] .stage-option.active { color: #111; }

/* Valuation */
.valuation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.val-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.range-label { font-size: 10px; color: var(--text-3); margin-bottom: 4px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
.range-display { font-family: var(--font-ui); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; color: var(--text-1); line-height: 1; }
.range-not-set-lg { font-size: 13px; color: var(--muted); font-style: italic; }
.range-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }


/* ════════════════════════════════════════════════════════════
   22. JOURNAL TAB
   ════════════════════════════════════════════════════════════ */
.journal-add-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.journal-textarea {
  width: 100%; min-height: 90px;
  background: var(--bg-card-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; color: var(--text-1);
  font-family: var(--font-ui); font-size: 13px; line-height: 1.7;
  resize: vertical; outline: none; transition: border-color 0.15s;
  margin-bottom: 12px;
}
.journal-textarea:focus { border-color: var(--gold); }
.journal-entry {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
}
.journal-entry-meta { font-size: 10px; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.3px; }
.journal-entry-text { font-size: 14px; line-height: 1.75; color: var(--text-2); white-space: pre-wrap; }
[data-theme="dark"] .journal-entry-text { color: var(--text-1); }


/* ════════════════════════════════════════════════════════════
   23. DOCUMENTS TAB
   ════════════════════════════════════════════════════════════ */
.doc-upload-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.doc-upload-title { font-size: 13px; font-weight: 900; color: var(--text-1); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.08em; }
.doc-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.doc-icon { font-size: 20px; flex-shrink: 0; color: var(--muted); }
.doc-info { flex: 1; min-width: 0; }
.doc-filename { font-size: 14px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc-status-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; padding: 3px 8px; border-radius: 4px; flex-shrink: 0; }
.status-PARSED  { background: rgba(21,128,61,0.1); color: #15803D; }
.status-PENDING { background: rgba(180,83,9,0.1);  color: #B45309; }
.status-FAILED  { background: rgba(185,28,28,0.1); color: #B91C1C; }
[data-theme="dark"] .status-PARSED  { background: rgba(61,184,122,0.12); color: #00c087; }
[data-theme="dark"] .status-PENDING { background: rgba(232,160,48,0.12); color: #f0a500; }
[data-theme="dark"] .status-FAILED  { background: rgba(224,92,92,0.12);  color: #ff4d4f; }
.doc-delete-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 6px; border-radius: 4px; flex-shrink: 0; transition: color 0.15s; }
.doc-delete-btn:hover { color: var(--red); background: rgba(185,28,28,0.08); }
[data-theme="dark"] .doc-delete-btn:hover { background: rgba(224,92,92,0.1); }


/* ════════════════════════════════════════════════════════════
   24. LESSON CONTENT
   ════════════════════════════════════════════════════════════ */
.lesson-content { line-height: 1.7; }
.lesson-content h2 { font-size: 20px; font-weight: 700; color: var(--text-1); margin: 0 0 12px; }
.lesson-content h3 { font-size: 15px; font-weight: 700; color: var(--gold); margin: 24px 0 10px; }
.lesson-content p  { font-size: 14px; color: var(--text-2); margin: 0 0 14px; }
.lesson-content ul { padding-left: 20px; margin: 0 0 14px; }
.lesson-content li { font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.lesson-content strong { color: var(--gold); font-weight: 600; }
.lesson-content em { color: var(--gold); font-style: italic; }

.lesson-intro {
  font-size: 15px; color: var(--text-1);
  border-left: 3px solid var(--gold);
  padding-left: 14px; margin-bottom: 20px !important;
}

.info-box { background: var(--surface-1); border-radius: var(--radius-sm); overflow: hidden; margin: 16px 0; border: 1px solid var(--border); }
[data-theme="dark"] .info-box { background: var(--bg-card-2); }
.info-row { display: grid; grid-template-columns: 160px 1fr; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px 14px; background: var(--bg-card-2); }
[data-theme="dark"] .info-label { background: var(--bg-card); color: var(--text-2); }
.info-value { font-size: 13px; color: var(--text-2); padding: 10px 14px; line-height: 1.5; }

.formula-box {
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0;
}
[data-theme="dark"] .formula-box { background: var(--bg-card-2); }
.formula { font-size: 14px; font-weight: 700; color: var(--text-1); font-family: var(--font-ui); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.formula-example { font-size: 13px; color: var(--text-3); }

.callout { border-radius: var(--radius-sm); padding: 14px 18px; margin: 16px 0; font-size: 13px; line-height: 1.6; }
.callout-gold  { background: rgba(181,132,26,0.07); border-left: 3px solid var(--gold); color: var(--text-2); }
.callout-red   { background: rgba(185,28,28,0.06);  border-left: 3px solid var(--red);  color: var(--text-2); }
.callout-amber { background: rgba(180,83,9,0.06);   border-left: 3px solid var(--amber); color: var(--text-2); }
.callout strong { color: var(--text-1); }

[data-theme="dark"] .callout-gold  { background: rgba(200,153,58,0.08); }
[data-theme="dark"] .callout-red   { background: rgba(224,85,85,0.08); }
[data-theme="dark"] .callout-amber { background: rgba(200,153,58,0.06); }


/* ════════════════════════════════════════════════════════════
   25. MARKDOWN
   ════════════════════════════════════════════════════════════ */
.md-content h1 { font-size: 20px; font-weight: 700; color: var(--gold); margin: 0 0 16px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md-content h2 { font-size: 17px; font-weight: 700; color: var(--gold); margin: 20px 0 8px; }
.md-content h3 { font-size: 15px; font-weight: 600; color: var(--gold); margin: 16px 0 6px; }
.md-content p  { margin: 0 0 10px; line-height: 1.85; color: var(--text-2); }
[data-theme="dark"] .md-content p { color: var(--text-1); }
.md-content strong { font-weight: 700; color: var(--text-1); }
.md-content em { font-style: italic; color: var(--text-2); }
.md-content ul, .md-content ol { padding-left: 20px; margin: 0 0 10px; }
.md-content li { margin-bottom: 4px; line-height: 1.7; color: var(--text-2); }
[data-theme="dark"] .md-content li { color: var(--text-1); }
.md-content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md-content code { font-family: monospace; font-size: 13px; background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px; color: var(--text-1); }
[data-theme="dark"] .md-content code { background: rgba(255,255,255,0.06); }
.md-content blockquote { border-left: 3px solid var(--gold); padding-left: 12px; color: var(--text-2); margin: 10px 0; }


/* ════════════════════════════════════════════════════════════
   26. RAG DOTS
   ════════════════════════════════════════════════════════════ */
.rag-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }
.rag-green { background: var(--green); }
.rag-amber { background: var(--amber); }
.rag-red   { background: var(--red); }
.rag-none  { background: rgba(0,0,0,0.15); }
[data-theme="dark"] .rag-none { background: rgba(255,255,255,0.15); }


/* ════════════════════════════════════════════════════════════
   27. DROP ZONE
   ════════════════════════════════════════════════════════════ */
.drop-zone {
  border: 2px dashed rgba(181,132,26,0.3);
  border-radius: var(--radius); padding: 24px 20px;
  text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 14px; position: relative;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--gold); background: rgba(181,132,26,0.04); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-zone-icon { font-size: 24px; margin-bottom: 6px; }
.drop-zone-label { font-size: 14px; font-weight: 500; color: var(--text-1); margin-bottom: 2px; }
.drop-zone-sub { font-size: 12px; color: var(--muted); }
.drop-zone-filename { font-size: 12px; color: var(--gold); font-weight: 500; margin-top: 6px; display: none; }


/* ════════════════════════════════════════════════════════════
   28. SVG DIAGRAM VARIABLES
   Already set in :root and [data-theme="dark"] above.
   Alias classes for SVG inline use.
   ════════════════════════════════════════════════════════════ */
/* SVG diagrams keep intentional dark styling — no forced override.
   CSS variables --svg-bg etc. flow in automatically per theme. */


/* ════════════════════════════════════════════════════════════
   29. LOGO WORDMARK
   ════════════════════════════════════════════════════════════ */
.logo-investo { color: #1A1F2E; }
.logo-lingo   { color: #C8993A; }
[data-theme="dark"] .logo-investo { color: #ffffff; }
[data-theme="dark"] .logo-lingo   { color: #C8993A; }

[data-theme="dark"] .logo-name { color: #C8993A; }
[data-theme="dark"] .logo-name span:last-child { color: var(--gold-light) !important; }


/* ════════════════════════════════════════════════════════════
   30. PROGRESS BAR
   ════════════════════════════════════════════════════════════ */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  height: 6px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 99px;
  transition: width 0.3s ease;
}


/* ════════════════════════════════════════════════════════════
   31. SCROLLBAR
   ════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }


/* ════════════════════════════════════════════════════════════
   32. RESPONSIVE
   ════════════════════════════════════════════════════════════ */
/* ── 900px — tablet ── */
@media (max-width: 900px) {
  header { padding: 0 16px; }
  main   { padding: 24px 16px 60px; }
}

/* ── 700px — small tablet / large phone ── */
@media (max-width: 700px) {
  .nav-btn { padding: 0 10px; font-size: 13px; }
  .toggle-segment { padding: 5px 10px; font-size: 12px; }
}

/* ── 600px — phone ── */
@media (max-width: 600px) {
  html { font-size: 14px; }

  /* Header wraps to two rows — logo + actions row 1, nav row 2 */
  header {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 8px 12px 0;
    gap: 0;
    align-items: center;
  }
  .logo-area {
    flex: 0 0 auto;
    gap: 8px;
    margin-right: 0;
  }
  .header-actions {
    flex: 0 0 auto;
    margin-left: auto;
    gap: 8px;
  }
  /* Nav scrolls on row 2 */
  .header-right {
    flex: 0 0 100%;
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px;
    padding: 2px 12px 0;
  }
  .header-right::-webkit-scrollbar { display: none; }
  .nav-btn { height: 44px; font-size: 13px; padding: 0 12px; }

  /* Nav dropdowns on mobile — positioning handled by JS, just style here */
  .nav-dropdown-panel {
    border-radius: 16px 16px 0 0 !important;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 3px solid var(--accent) !important;
    padding: 12px 0 32px;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.3);
  }
  [data-theme="dark"] .nav-dropdown-panel {
    border-top-color: var(--gold) !important;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  }
  .nav-dropdown-item { padding: 16px 28px; font-size: 16px; min-height: 52px; }



  /* Logo */
  .logo-mark img { height: 40px; }
  .logo-name { font-size: 17px; }
  .logo-sub  { display: none; }

  /* Profile pill — hide name, keep avatar */
  .profile-name { display: none; }
  .profile-avatar { width: 28px; height: 28px; font-size: 11px; }
  .profile-pill { padding: 4px 8px 4px 4px; gap: 6px; }

  /* Theme toggle — compact */
  .toggle-segment { padding: 5px 8px; font-size: 11px; }
  .theme-toggle-btn { gap: 2px; }

  /* Content */
  main { padding: 12px 12px 80px; }
  .col-hide-mobile { display: none !important; }
  td { padding: 10px 10px; font-size: 13px; }
  th { padding: 7px 10px; }
  .macro-strip { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: span 1; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-card { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-width: 100%; max-height: 88vh; }
  .modal-actions { flex-direction: column-reverse; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .info-row { grid-template-columns: 110px 1fr; }
  .info-label { font-size: 11px; padding: 8px 10px; }
  .info-value { font-size: 12px; padding: 8px 10px; }
  .section-header-left { width: 100%; }
  .modal-actions .btn { width: 100%; justify-content: center; padding: 13px; }
  #toast-container { left: 12px; right: 12px; max-width: none; }
  .toast { max-width: 100%; }
  .form-input, .form-select { font-size: 16px; }
  .btn { padding: 11px 16px; }
  .lesson-content h2 { font-size: 16px; }
  .lesson-content h3 { font-size: 13px; }
  .lesson-content p, .lesson-content li { font-size: 13px; }
  .callout { font-size: 12px; padding: 10px 12px; }
}

/* ── TABLE HORIZONTAL SCROLL ── */
/* Wrap any wide table in this so columns scroll instead of clipping on mobile. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── TAB BUTTONS ── */
.tab-btn {
  padding: 0 16px; height: 44px;
  border: none; border-bottom: 2px solid transparent;
  background: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--text-3);
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--text-1); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── CO-HEADER ELEMENTS ── */
.co-ticker-badge { color: var(--gold); }
.co-name { color: var(--text-1); }
.co-meta { color: var(--text-3); }
.co-zone-pin { border-color: var(--bg-card); }
.co-switcher {
  background: var(--bg-card-2); border: 1px solid var(--border);
  color: var(--text-1); border-radius: var(--radius-sm);
  padding: 6px 10px; font-family: var(--font-ui); font-size: 13px;
}

/* ── INDICATOR PANEL ── */
.ind-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.1);
}
[data-theme="dark"] .ind-panel { box-shadow: 0 16px 48px rgba(0,0,0,0.4); }
.ind-row:hover { background: var(--bg-hover); }
.ind-row-name { color: var(--text-1); }

