/* ============================================================
   INVESTRA - DARK THEME  (dark.css)
   Complete standalone theme - zero shared tokens with light.css
   Inspired by: deep cosmic black + molten gold + electric amber
   ============================================================ */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&family=Cinzel:wght@400;600;700&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds - warm neutral black (yacht-luxury palette) */
  --bg-base:    #131313;   /* Cursed Black */
  --bg-card:    #1c1c1b;   /* elevated above base */
  --bg-input:   #262625;   /* Nero - recessed panels */
  --bg-hover:   #302f2d;
  --bg-sidebar: #0e0e0d;   /* deepest, for separation */

  /* Borders - warm charcoal */
  --border:       #34332f;
  --border-strong:#4b4a48;   /* Private Black */
  --border-gold:  rgba(239,211,149,0.30);

  /* Gold palette - straw yellow */
  --gold:         #efd395;   /* Straw Yellow */
  --gold-bright:  #f6e4ae;
  --gold-dim:     rgba(239,211,149,0.09);
  --gold-glow:    rgba(239,211,149,0.22);

  /* Text - warm off-white on black */
  --text:         #eceae4;
  --text-sub:     #a4a4a4;   /* Rainy Grey */
  --text-muted:   #777674;   /* Steel Wool */
  --text-gold:    #efd395;

  /* Accents (data-viz semantics, tuned to sit on warm-black) */
  --teal:         #3ecfb2;
  --coral:        #f07360;
  --blue:         #5b9cf6;
  --purple:       #9b7fe8;
  --amber:        #f5a623;
  --teal-dim:     rgba(62,207,178,0.12);
  --coral-dim:    rgba(240,115,96,0.12);
  --blue-dim:     rgba(91,156,246,0.12);

  /* Typography */
  --font-sans:    'Schibsted Grotesk', 'Segoe UI', 'Nirmala UI', 'Noto Sans Devanagari', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Code', monospace;
  --font-display: 'Cinzel', 'Palatino', 'Nirmala UI', 'Noto Serif Devanagari', serif;

  /* Layout */
  --sidebar-w:    240px;
  --gap:          24px;
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;

  /* Liquid glass */
  --glass-bg:     rgba(28,28,27,0.55);
  --glass-border: rgba(239,211,149,0.18);
  --glass-shadow: rgba(0,0,0,0.55);
  --glass-shine:  rgba(255,255,255,0.05);

  /* Transitions */
  --ease-spring:  cubic-bezier(0.34,1.56,0.64,1);
  --ease-out:     cubic-bezier(0.16,1,0.3,1);
}

/* ============================================================
   BASE
   ============================================================ */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Ambient background blobs - makes liquid glass refraction visible */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(239,211,149,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(91,156,246,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 60% 30%, rgba(62,207,178,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 700px 600px at 10% 90%, rgba(155,127,232,0.04) 0%, transparent 70%);
}

/* SVG Liquid Filter - included once, referenced by backdrop-filter */
.svg-filters {
  position: absolute;
  width: 0; height: 0;
  overflow: hidden;
  pointer-events: none;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-bright); }

img { max-width: 100%; display: block; }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: var(--font-sans);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus { border-color: var(--gold); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-sidebar); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s var(--ease-out);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 59px;
  height: 59px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(239,211,149,0.4));
  flex-shrink: 0;
}

.sidebar-brand-text { flex: 1; min-width: 0; }

.sidebar-wordmark {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1;
}

.sidebar-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-top: 3px;
  line-height: 1.3;
}

.sidebar-version {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--gold);
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 12px 20px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(239,211,149,0.05);
  border-left-color: rgba(239,211,149,0.3);
}

.nav-item.active {
  color: var(--gold);
  background: linear-gradient(90deg, rgba(239,211,149,0.12), rgba(240,115,96,0.06));
  border-left-color: var(--gold);
  box-shadow: inset 0 0 12px rgba(239,211,149,0.08);
}

/* Fire glow animation on active nav */
.nav-item.active::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: fire-flicker 2.5s ease-in-out infinite;
}

@keyframes fire-flicker {
  0%,100% { opacity: 0.7; box-shadow: inset 0 0 8px rgba(239,211,149,0.15); }
  33%      { opacity: 1;   box-shadow: inset 0 0 14px rgba(240,115,96,0.12); }
  66%      { opacity: 0.85;box-shadow: inset 0 0 10px rgba(239,211,149,0.2); }
}

.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }

.nav-item.nav-astra {
  font-weight: 600;
  font-size: 13px;
}
.nav-item.nav-astra .nav-icon {
  width: 18px; height: 18px;
  filter: drop-shadow(0 0 4px rgba(239,211,149,0.5));
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.live-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.live-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal);
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

.theme-toggle {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--gold);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-toggle:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
  max-width: 1400px;
}

.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

.page-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* ============================================================
   LIQUID GLASS COMPONENT - the signature effect
   ============================================================ */
.glass {
  background: var(--glass-bg);
  /* Perf: the SVG url(#liquid-refraction) displacement was re-rasterised every
     frame behind ~12 glass elements (the main source of scroll lag). Dropped it
     for a cheap blur+saturate - visually near-identical, far smoother. */
  backdrop-filter: blur(12px) saturate(1.18);
  -webkit-backdrop-filter: blur(12px) saturate(1.18);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-shine),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 4px 24px var(--glass-shadow),
    0 0 0 1px rgba(255,255,255,0.02);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(239,211,149,0.4), transparent);
  opacity: 0.6;
}

.glass:hover {
  border-color: rgba(239,211,149,0.3);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 8px 40px rgba(0,0,0,0.6),
    0 0 20px rgba(239,211,149,0.08);
  transform: translateY(-1px);
}

/* Solid card (no glass) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--border-strong);
}

/* ============================================================
   KPI STRIP
   ============================================================ */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  padding: 18px 20px;
  position: relative;
  cursor: default;
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
}

.kpi-value.gold { color: var(--gold); }
.kpi-value.teal { color: var(--teal); }
.kpi-value.coral { color: var(--coral); }
.kpi-value.blue  { color: var(--blue); }
.kpi-value.amber { color: var(--amber); }

.kpi-change {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-change.up   { color: var(--teal); }
.kpi-change.down { color: var(--coral); }
.kpi-change.flat { color: var(--text-muted); }

.kpi-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--gold-dim);
  opacity: 0.6;
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-wrap {
  padding: 20px;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.chart-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

/* ============================================================
   SIGNAL BADGES
   ============================================================ */
.sig {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sig-uv   { background: rgba(62,207,178,0.15); color: #3ecfb2; border: 1px solid rgba(62,207,178,0.3); }
.sig-fv   { background: rgba(91,156,246,0.15); color: #5b9cf6; border: 1px solid rgba(91,156,246,0.3); }
.sig-hold { background: rgba(245,166,35,0.15);  color: #f5a623; border: 1px solid rgba(245,166,35,0.3); }
.sig-ov   { background: rgba(240,115,96,0.15);  color: #f07360; border: 1px solid rgba(240,115,96,0.3); }
.sig-exp  { background: rgba(231,76,60,0.15);   color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-strong);
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

thead th:hover { color: var(--text); }
thead th.sorted { color: var(--gold); }

thead th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.4;
  font-size: 9px;
}
thead th.sorted .sort-icon { opacity: 1; }

tbody tr {
  border-bottom: 1px solid rgba(30,45,64,0.6);
  transition: background 0.15s;
}

tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 10px 14px;
  color: var(--text-sub);
  white-space: nowrap;
}

tbody td.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

tbody td.ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

tbody td.positive { color: var(--teal); font-family: var(--font-mono); }
tbody td.negative { color: var(--coral); font-family: var(--font-mono); }
tbody td.neutral  { color: var(--blue); font-family: var(--font-mono); }

/* ============================================================
   SEGMENT TAGS
   ============================================================ */
.seg-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.seg-pvt  { background: rgba(91,156,246,0.15);  color: #5b9cf6; }
.seg-psu  { background: rgba(155,127,232,0.15); color: #9b7fe8; }
.seg-lnbfc{ background: rgba(239,211,149,0.15); color: #efd395; }
.seg-snbfc{ background: rgba(232,200,112,0.12); color: #f6e4ae; }
.seg-hfc  { background: rgba(59,189,227,0.15); color: #4cc3e6; }   /* R23: aqua and rose - teal/coral are kept for good/bad */
.seg-mfi  { background: rgba(230,101,155,0.15); color: #ec78a8; }
.seg-sfb  { background: rgba(245,166,35,0.15); color: #f5a623; }

/* ============================================================
   GEMINI AI BOX
   ============================================================ */
.ai-box {
  padding: 22px;
  margin-top: 20px;
}

.ai-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ai-gem-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(239,211,149,0.2), rgba(91,156,246,0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.ai-box-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ai-box-model {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 3px;
}

.ai-prompt-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-prompt-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  resize: none;
  min-height: 60px;
  transition: border-color 0.2s;
}

.ai-prompt-input:focus { border-color: var(--gold); outline: none; }

.ai-submit-btn {
  padding: 9px 16px;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  align-self: flex-end;
  transition: all 0.2s;
}

.ai-submit-btn:hover {
  background: var(--gold);
  color: var(--bg-base);
}

.ai-response {
  min-height: 60px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.ai-response.loading {
  color: var(--text-muted);
  font-style: italic;
}

.ai-typing-cursor::after {
  content: '▊';
  animation: blink 0.8s step-start infinite;
  color: var(--gold);
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ============================================================
   GRID HELPERS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gap); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap); }

/* ============================================================
   SCROLL ANIMATION CLASSES
   ============================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

.scale-in {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s var(--ease-spring), transform 0.5s var(--ease-spring);
}
.scale-in.visible { opacity: 1; transform: scale(1); }

.fade-in {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.fade-in.visible { opacity: 1; }

/* ============================================================
   PRELOADER - FULL SCREEN (index.html)
   ============================================================ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.preloader-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 500px at 50% 40%, rgba(239,211,149,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 600px 600px at 30% 70%, rgba(91,156,246,0.05) 0%, transparent 70%);
}

.preloader-logo-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.preloader-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  animation: preloader-logo-in 0.8s var(--ease-spring) forwards;
  opacity: 0;
  filter: drop-shadow(0 0 20px rgba(239,211,149,0.5));
}

@keyframes preloader-logo-in {
  0%   { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  60%  { opacity: 1; transform: scale(1.1) rotate(5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.preloader-pulse {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(239,211,149,0.4);
  animation: preloader-pulse 2s ease-out infinite;
  animation-delay: 0.8s;
}

@keyframes preloader-pulse {
  0%   { transform: translate(-50%,-50%) scale(1); opacity: 0.8; }
  100% { transform: translate(-50%,-50%) scale(3); opacity: 0; }
}

.preloader-wordmark {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--gold);
  text-transform: uppercase;
  opacity: 0;
  animation: preloader-text-in 0.6s var(--ease-out) 0.8s forwards;
}

@keyframes preloader-text-in {
  0%   { opacity: 0; transform: translateY(10px) scale(0.95); letter-spacing: 20px; }
  100% { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 8px; }
}

.preloader-tagline {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-align: center;
  opacity: 0;
  animation: preloader-text-in 0.6s var(--ease-out) 1.2s forwards;
}

.preloader-sanskrit {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold);
  opacity: 0;
  letter-spacing: 1px;
  text-align: center;
  animation: preloader-text-in 0.6s var(--ease-out) 1.7s forwards;
}

.preloader-bar-wrap {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
}

.preloader-bar {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.preloader-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright), var(--teal));
  border-radius: 1px;
  width: 0%;
  animation: preloader-fill 2.8s var(--ease-out) forwards;
}

@keyframes preloader-fill {
  0%  { width: 0%; }
  20% { width: 35%; }
  50% { width: 60%; }
  80% { width: 85%; }
  100%{ width: 100%; }
}

/* Preloader exit */
#preloader.exit {
  animation: preloader-exit 0.5s ease-in 0.1s forwards;
}

@keyframes preloader-exit {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); pointer-events: none; }
}

/* ============================================================
   PAGE PRELOADER (inner pages - compact)
   ============================================================ */
#page-preloader {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(19,19,19,0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-preloader-card {
  width: 280px;
  padding: 28px 24px;
  text-align: center;
  position: relative;
}

.page-preloader-logo {
  width: 64px; height: 64px;
  object-fit: contain;
  margin: 0 auto 16px;
  animation: page-logo-breathe 2.6s var(--ease-out) infinite;
  filter: drop-shadow(0 0 14px rgba(239,211,149,0.45));
}

/* Hero-style gentle breathing glow (no spin - emblem stays upright) */
@keyframes page-logo-breathe {
  0%,100% { transform: scale(1);    filter: drop-shadow(0 0 10px rgba(239,211,149,0.32)); }
  50%     { transform: scale(1.05); filter: drop-shadow(0 0 18px rgba(239,211,149,0.55)); }
}

.page-preloader-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.page-preloader-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.page-preloader-line {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
  position: absolute;
  bottom: -6px; left: 0; right: 0;
}

.page-preloader-line-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  animation: page-loader-fill 1.5s var(--ease-out) forwards;
  width: 0%;
}

@keyframes page-loader-fill {
  0%   { width: 0%; }
  100% { width: 100%; }
}

/* ============================================================
   HAMBURGER (mobile)
   ============================================================ */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  width: 36px; height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.2s;
}

/* ============================================================
   TABS
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-gold   { color: var(--gold); }
.text-teal   { color: var(--teal); }
.text-coral  { color: var(--coral); }
.text-blue   { color: var(--blue); }
.text-amber  { color: var(--amber); }
.text-muted  { color: var(--text-muted); }
.text-sub    { color: var(--text-sub); }
.text-mono   { font-family: var(--font-mono); }
.text-display{ font-family: var(--font-display); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.flex  { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

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

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.6);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-3  { grid-template-columns: 1fr 1fr; }
  .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }
  .content {
    margin-left: 0;
    padding: 20px 16px;
    padding-top: 60px;
  }
  .grid-2, .grid-3, .grid-1-2, .grid-2-1 {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    grid-template-columns: 1fr 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .kpi-strip { grid-template-columns: 1fr; }
  .kpi-value { font-size: 20px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .preloader, #preloader { display: none !important; }
  .content { margin-left: 0; }
}
