/* DARK MODE DEFAULT */
[data-theme="dark"] body {
  background: radial-gradient(circle at 20% 0%, #101A2B 0%, #090B10 55%, #06080C 100%);
  color: #E2E8F0;
  font-family: 'Inter', sans-serif;
}
.mono { font-family: 'JetBrains Mono', monospace; }

/* GLOBAL DARK DROPDOWN & SLIM SCROLLBAR FIX */
[data-theme="dark"] select {
  color-scheme: dark;
  background-color: #0F172A;
  color: #F1F5F9;
}
[data-theme="dark"] select option {
  background-color: #0F172A !important;
  color: #F1F5F9 !important;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0A0E16; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* 3D ELEVATED CARDS, RECESSED WELLS & TACTILE BUTTONS (DARK) */
[data-theme="dark"] .card-3d {
  background: linear-gradient(160deg, rgba(24, 32, 48, 0.92) 0%, rgba(14, 19, 30, 0.96) 100%);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,0.78), 0 6px 14px -4px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
[data-theme="dark"] .card-3d:hover {
  transform: translateY(-4px);
  border-color: rgba(20, 184, 166, 0.38);
  box-shadow: 0 26px 50px -12px rgba(0,0,0,0.88), 0 0 28px -8px rgba(20,184,166,0.22), inset 0 1px 0 rgba(255,255,255,0.12);
}
[data-theme="dark"] .well-3d {
  background: linear-gradient(180deg, #0A0E16 0%, #111723 100%);
  border: 1px solid rgba(51, 65, 85, 0.55);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.65), 0 1px 0 rgba(255,255,255,0.04);
  border-radius: 12px;
}
.btn-3d {
  border-radius: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 0 rgba(0,0,0,0.55), 0 8px 16px -4px rgba(0,0,0,0.6);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}
.btn-3d:hover { filter: brightness(1.08); }
.btn-3d:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.55); }

/* 3D PEARL / PORCELAIN LIGHT MODE (WCAG HIGH CONTRAST) */
[data-theme="light"] body {
  background: linear-gradient(180deg, #EEF2F7 0%, #E2E8F0 100%);
  color: #0F172A;
}
[data-theme="light"] .card-3d {
  background: linear-gradient(160deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid rgba(15,23,42,0.08);
  border-top: 1px solid #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 14px 30px -10px rgba(15,23,42,0.14), 0 4px 10px -2px rgba(15,23,42,0.08);
  color: #0F172A;
}
[data-theme="light"] .well-3d {
  background: linear-gradient(180deg, #EEF2F7 0%, #F8FAFC 100%);
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: inset 0 2px 5px rgba(15,23,42,0.08);
  border-radius: 12px;
  color: #0F172A;
}
[data-theme="light"] .btn-3d {
  box-shadow: 0 3px 0 rgba(15,23,42,0.15), 0 6px 12px -4px rgba(15,23,42,0.12);
}

/* STATUS PILLS & PULSE */
.live-pill {
  background: linear-gradient(135deg, rgba(16,185,129,0.22), rgba(5,150,105,0.12));
  border: 1px solid rgba(16,185,129,0.65);
  box-shadow: 0 0 18px rgba(16,185,129,0.32), inset 0 1px 0 rgba(167,243,208,0.25);
  color: #34D399;
}
.paused-pill {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(180,83,9,0.1));
  border: 1px solid rgba(245,158,11,0.6);
  box-shadow: 0 0 14px rgba(245,158,11,0.22);
  color: #FBBF24;
}
.stopped-pill {
  background: linear-gradient(135deg, rgba(239,68,68,0.18), rgba(153,27,27,0.1));
  border: 1px solid rgba(239,68,68,0.55);
  color: #F87171;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.75); }
  50% { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
}
.pulse-dot { animation: livePulse 1.8s infinite; }

/* ZERO-BLUR CRYSTAL-TRANSPARENT DASHBOARD GLASS */
.glass-pardarshi {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
}
.glass-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
}
.pnl-card-3d {
  background: linear-gradient(155deg, rgba(16,185,129,0.16) 0%, rgba(6,78,59,0.06) 100%);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-top: 1px solid rgba(167, 243, 208, 0.45);
  border-radius: 18px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.45), inset 0 1px 0 rgba(167,243,208,0.18);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95);
}

/* COMPACT 3D CALENDAR HEATMAP TILES (BACKTESTING) */
.cal-tile { width: 16px; height: 16px; border-radius: 4px; cursor: pointer; transition: transform 0.14s ease; }
.cal-tile.win { background: linear-gradient(145deg, #10B981, #059669); box-shadow: 0 2px 6px rgba(16,185,129,0.35), inset 0 1px 0 rgba(255,255,255,0.28); }
.cal-tile.win-hi { background: linear-gradient(145deg, #34D399, #10B981); box-shadow: 0 2px 10px rgba(52,211,153,0.55), inset 0 1px 0 rgba(255,255,255,0.35); }
.cal-tile.loss { background: linear-gradient(145deg, #EF4444, #DC2626); box-shadow: 0 2px 6px rgba(239,68,68,0.35), inset 0 1px 0 rgba(255,255,255,0.25); }
.cal-tile.loss-hi { background: linear-gradient(145deg, #F87171, #B91C1C); box-shadow: 0 2px 10px rgba(239,68,68,0.55), inset 0 1px 0 rgba(255,255,255,0.3); }
.cal-tile.empty { background: rgba(30,41,59,0.42); box-shadow: inset 0 1px 2px rgba(0,0,0,0.45); cursor: default; }
.cal-tile:not(.empty):hover { transform: scale(1.26) translateY(-2px); filter: brightness(1.15); }
/* ===== INFINITY 3D POLISH PATCH (HEADER + SIDEBAR + SCREENER DARK) ===== */

/* 1. Upar ki purani moti patti ko slim transparent single-row banao & double title hatao */
.workspace > header {
  min-height: 44px !important;
  padding: 6px 14px !important;
  background: rgba(4, 7, 13, 0.82) !important;
  backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
}
.workspace > header > .brand {
  display: none !important;
}
.workspace > header .header-right {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
}

/* 2. White "MARKET CLOSED / Market status unavailable" & "FYERS not connected" pill fix */
.workspace > header .header-right span,
.workspace > header .header-right .pill,
.workspace > header .header-right .badge,
#marketStatus,
#connection {
  background: rgba(15, 23, 42, 0.92) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(148, 163, 184, 0.32) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}
#connection.ok,
#connection.connected,
#connection[data-state="connected"] {
  background: rgba(6, 78, 59, 0.45) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}

/* 3. Sidebar buttons: saare blue hatakar sirf ACTIVE button highlight rakho */
aside button:not(.active):not(.is-active):not([aria-current="page"]),
.infinity-sidebar button:not(.active):not(.is-active):not([aria-current="page"]),
.infinity-nav button:not(.active):not(.is-active):not([aria-current="page"]) {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 1px solid transparent !important;
  color: #94a3b8 !important;
}
aside button:not(.active):not(.is-active):not([aria-current="page"]):hover,
.infinity-sidebar button:not(.active):not(.is-active):not([aria-current="page"]):hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f1f5f9 !important;
}
aside button.active,
aside button.is-active,
aside button[aria-current="page"],
.infinity-sidebar button.active,
.infinity-sidebar button.is-active {
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(45, 212, 191, 0.48) !important;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

/* 4. Screener white cards -> 3D Obsidian Dark Mode (Light mode intact) */
html:not([data-theme="light"]) #notice,
html:not([data-theme="light"]) .market-highlights > *,
html:not([data-theme="light"]) .panel,
html:not([data-theme="light"]) .stock-panel {
  background: linear-gradient(155deg, rgba(20, 28, 43, 0.96) 0%, rgba(11, 16, 26, 0.98) 100%) !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}
html:not([data-theme="light"]) .market-highlights * {
  color: #e2e8f0 !important;
}
/* ===== EXACT IMAGE_33CD57 SIDEBAR (ICONS + ACTIVE BLUE PILL + CLEAN DARK) ===== */
aside.rail .infinity-navigation button[data-page] {
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  width: 100% !important;
  padding: 10px 13px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 1px solid transparent !important;
  color: #94a3b8 !important;
  text-align: left !important;
}
aside.rail .infinity-navigation button[data-page]:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f1f5f9 !important;
}
aside.rail .infinity-navigation button[data-page="charts"] {
  color: #2dd4bf !important;
}
aside.rail .infinity-navigation button[data-page="screener"] {
  color: #38bdf8 !important;
  margin-top: 6px !important;
  padding-top: 12px !important;
  border-top: 1px solid rgba(148, 163, 184, 0.14) !important;
  border-radius: 0 0 12px 12px !important;
}
aside.rail .infinity-navigation button[data-page].active,
aside.rail .infinity-navigation button[data-page].is-active,
aside.rail .infinity-navigation button[data-page][aria-current="page"] {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: 1px solid rgba(129, 140, 248, 0.55) !important;
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}