/* ============================================================
   dashboard.css — Modern Fintech Trading Redesign
   Inspired by Groww, Zerodha Kite, and TradingView.
   Built with a mobile-first, edge-to-edge iOS design system.
   ============================================================ */

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

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Font Family */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Layout Dimensions */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 76px;
  --header-height: 64px;
  --mobile-tabbar-height: 68px;
  
  /* Spacing Grid (8px baseline) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Theme: Dark Mode (Default) */
  --bg: #07090e;
  --surface: #0f121d;
  --surface-hover: #161a29;
  --surface-card: #0f121d;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --text-muted: #8a99ad;
  --text-inverse: #07090e;
  
  /* Fintech Colors */
  --green: #00c896; /* Groww Green */
  --green-alpha: rgba(0, 200, 150, 0.1);
  --red: #ff4a4a; /* Groww Red */
  --red-alpha: rgba(255, 74, 74, 0.1);
  --blue: #0082f6; /* Action Blue */
  --blue-alpha: rgba(0, 130, 246, 0.1);
  --purple: #8b5cf6;
  --purple-alpha: rgba(139, 92, 246, 0.1);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.4);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.15);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Theme Switch: Light Mode overrides */
body.light-theme {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-card: #ffffff;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 4px 20px rgba(15, 23, 42, 0.03);
  
  --green-alpha: rgba(0, 200, 150, 0.08);
  --red-alpha: rgba(255, 74, 74, 0.08);
  --blue-alpha: rgba(0, 130, 246, 0.08);
}

/* ============================================================
   Global Reset & Styling
   ============================================================ */
html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select {
  font-family: inherit;
  color: inherit;
  outline: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout Outer Frame */
.dashboard-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ============================================================
   COLLAPSIBLE SIDEBAR STYLE (DESKTOP)
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4);
  flex-shrink: 0;
  transition: width var(--transition-normal);
  z-index: 100;
  position: relative;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  padding: var(--space-5) var(--space-2);
}

.sidebar-toggle-btn {
  position: absolute;
  top: 24px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), color var(--transition-fast);
}
.sidebar-toggle-btn:hover {
  color: var(--text);
  transform: scale(1.1);
}
.sidebar.collapsed .sidebar-toggle-btn {
  transform: rotate(180deg);
}
.sidebar.collapsed .sidebar-toggle-btn:hover {
  transform: rotate(180deg) scale(1.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-left: var(--space-2);
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-brand .brand-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}
.sidebar-brand .brand-logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: block;
}
.sidebar-brand .brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity var(--transition-normal);
}
.sidebar.collapsed .brand-title {
  opacity: 0;
  pointer-events: none;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  margin-bottom: var(--space-5);
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sidebar-profile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity var(--transition-normal);
}
.sidebar.collapsed .sidebar-profile-info {
  opacity: 0;
  pointer-events: none;
}
.profile-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-alpha);
  color: var(--blue);
  border: 1px solid rgba(0, 130, 246, 0.2);
  align-self: flex-start;
  margin-top: var(--space-1);
}
.sidebar-role-badge.admin {
  background: var(--purple-alpha);
  color: var(--purple);
  border-color: rgba(139, 92, 246, 0.2);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  min-height: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.menu-item-signout {
  color: var(--text-muted);
}

.menu-item-signout:hover {
  background: var(--red-alpha);
  color: var(--red);
}

.menu-item-signout .menu-icon {
  font-size: 1.1rem;
}
.menu-item {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  white-space: nowrap;
}
a.menu-item {
  text-decoration: none;
  box-sizing: border-box;
}
.menu-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.menu-item.active {
  background: var(--blue-alpha);
  color: var(--blue);
  font-weight: 600;
}
.menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
}
.menu-icon .ui-icon {
  width: 18px;
  height: 18px;
}
.menu-text {
  transition: opacity var(--transition-normal);
}
.sidebar.collapsed .menu-text {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   MAIN CONTENT WRAPPER
   ============================================================ */
.main-content-wrapper {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Navigation Bar */
.topnav {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  flex-shrink: 0;
  z-index: 99;
}

/* Live index carousels */
.index-carousel {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  overflow-x: auto;
  flex-wrap: nowrap;
  max-width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.index-carousel::-webkit-scrollbar {
  display: none;
}
.index-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.72rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.index-chip-us {
  border-color: rgba(0, 130, 246, 0.25);
  background: rgba(0, 130, 246, 0.04);
}
.index-chip-unavailable {
  opacity: 0.55;
}
.index-etf-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: middle;
  background: var(--blue-alpha);
  color: var(--blue);
}
.index-name {
  font-weight: 700;
}
.index-val {
  font-weight: 600;
}
.index-change {
  font-weight: 700;
}
.index-change.up { color: var(--green); }
.index-change.down { color: var(--red); }
.index-chip-loading {
  opacity: 0.6;
}

.mobile-index-strip {
  display: none;
  gap: var(--space-2);
  align-items: center;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.mobile-index-strip::-webkit-scrollbar {
  display: none;
}

/* Main Content Area */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  position: relative;
  background: var(--bg);
}

/* Mobile top header (hidden on desktop) */
.mobile-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top);
}
.mobile-header-title {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mobile bottom navigation tabbar (hidden on desktop) */
.mobile-tabbar {
  display: none;
  height: calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  justify-content: space-around;
  align-items: center;
}
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  width: 20%;
  height: 100%;
  cursor: pointer;
  gap: var(--space-1);
}
.tabbar-item.active {
  color: var(--blue);
}
.tabbar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.tabbar-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.stat-mini-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--blue);
  flex-shrink: 0;
}
.stat-mini-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.date-field-icon {
  position: absolute;
  left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  line-height: 1;
  pointer-events: none;
  color: var(--text-muted);
  z-index: 1;
}
.date-field-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.ui-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.ui-icon-spin {
  animation: ui-icon-spin 0.8s linear infinite;
}
@keyframes ui-icon-spin {
  to { transform: rotate(360deg); }
}

.meta-chip-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.meta-chip-with-icon .ui-icon {
  width: 14px;
  height: 14px;
  opacity: 0.85;
}

.modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  background: var(--blue-alpha);
  color: var(--blue);
}
.modal-icon .ui-icon {
  width: 24px;
  height: 24px;
}
.modal-icon.modal-icon-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.modal-icon.modal-icon-danger {
  background: var(--red-alpha);
  color: var(--red);
}

.btn-pill .ui-icon,
.btn-pill .ui-icon + span {
  vertical-align: middle;
}
.btn-pill .ui-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-loader .ui-icon {
  width: 16px;
  height: 16px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.success { background: var(--green); }
.status-dot.warn { background: #f59e0b; }
.status-dot.muted { background: var(--text-muted); }

/* Tab Switching Panels */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* ============================================================
   Aesthetic Framework Elements
   ============================================================ */
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.25rem 0 var(--space-4);
  line-height: 1.5;
  max-width: 720px;
}

.scheduler-jobs-wrap {
  margin-bottom: var(--space-5);
  overflow-x: auto;
}
.scheduler-jobs-table .scheduler-job-cell {
  min-width: 280px;
  max-width: 360px;
}
.scheduler-job-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.scheduler-job-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 8px;
}
.scheduler-job-impact {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  border: 1px solid var(--border);
}
.scheduler-job-impact strong {
  color: var(--text);
}
.scheduler-schedule-cell {
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text-muted);
}
.scheduler-status-cell {
  text-align: center;
  white-space: nowrap;
}
.scheduler-status-badge {
  cursor: help;
}

.animate-in {
  opacity: 0;
  transform: translateY(10px);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom Alert Banner */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.alert.success {
  background: var(--green-alpha);
  border-color: rgba(0, 200, 150, 0.2);
  color: var(--green);
}
.alert.error {
  background: var(--red-alpha);
  border-color: rgba(255, 74, 74, 0.2);
  color: var(--red);
}
.alert.info {
  background: var(--blue-alpha);
  border-color: rgba(0, 130, 246, 0.2);
  color: var(--blue);
}

/* ============================================================
   Dashboard Layout Cards Grid
   ============================================================ */
.dashboard-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}
.dashboard-card:hover {
  border-color: var(--border-hover);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.stat-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.stat-mini-info {
  display: flex;
  flex-direction: column;
}
.stat-mini-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.stat-mini-val {
  font-size: 1.15rem;
  font-weight: 700;
}

.health-overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.health-section-hint {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.health-badge.running { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.health-badge.pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.health-badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.health-badge.other { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.health-current-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(0, 130, 246, 0.15);
  color: var(--accent);
  vertical-align: middle;
}
.health-storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}
.health-storage-card {
  padding: var(--space-4);
}
.health-storage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.health-storage-title {
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-all;
}
.health-storage-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.health-storage-usage {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}
.health-storage-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.health-storage-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--accent));
  transition: width 0.4s ease;
}
.health-storage-bar-fill.warn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.health-storage-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.scan-filter-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 200px;
}

.scan-select {
  min-width: 220px;
}

.scanner-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}

.comparator-subtitle {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-4) 0 var(--space-3);
}

.comparator-symbol-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.comparator-symbol-summary strong {
  color: var(--text);
}

.comparator-section {
  margin-bottom: var(--space-5);
}

.comparator-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: var(--space-2) 0 var(--space-4);
  line-height: 1.5;
}

.comparator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.comparator-card {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.comparator-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.comparator-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.comparator-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.comparator-accuracy {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.comparator-accuracy.good { color: var(--green); }
.comparator-accuracy.warn { color: var(--red); }
.comparator-accuracy.muted { color: var(--text-muted); }

.comparator-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.comparator-stats-row .hit { color: var(--green); }
.comparator-stats-row .miss { color: var(--red); }

.comparator-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comparator-pick {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.comparator-pick.long { color: var(--green); border-color: rgba(0, 200, 150, 0.25); }
.comparator-pick.short { color: var(--red); border-color: rgba(255, 74, 74, 0.25); }

.comparator-more,
.comparator-empty {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.comparator-view-btn {
  align-self: flex-start;
  padding: 4px 12px !important;
  font-size: 0.78rem !important;
}

/* Prediction pages (scheduled / live / single) */
.prediction-hero {
  margin-bottom: var(--space-5);
}
.prediction-page-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: var(--space-2);
}
.prediction-page-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: var(--space-4);
}
.prediction-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}
.prediction-section {
  margin-bottom: var(--space-6);
}
.prediction-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.prediction-summary-bar strong {
  color: var(--text);
}
.prediction-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-start;
}
.prediction-click-table .clickable-row {
  cursor: pointer;
  transition: background var(--transition-fast);
}
.prediction-click-table .clickable-row:hover {
  background: var(--surface-hover);
}
.prediction-click-table .selected-row {
  background: rgba(0, 130, 246, 0.08);
}
.modal-card-wide {
  max-width: min(920px, 96vw);
  width: 100%;
  text-align: left;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.prediction-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.prediction-modal-title {
  text-align: left;
  margin-bottom: 4px;
}
.prediction-modal-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}
.modal-close-btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 var(--space-1);
}
.modal-close-btn:hover {
  color: var(--text);
}
.prediction-modal-accuracy {
  margin-bottom: var(--space-3);
}
.prediction-modal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: 0.82rem;
  align-items: center;
}
.prediction-modal-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.scan-source-scheduled {
  color: var(--blue);
  border-color: rgba(0, 130, 246, 0.25);
}
.scan-source-manual {
  color: var(--text-muted);
}

/* Empty / loading states inside table panels */
.panel-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-6);
  min-height: 148px;
  background: linear-gradient(180deg, rgba(0, 130, 246, 0.04) 0%, transparent 72%);
}
.panel-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-card);
}
.panel-empty-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.panel-empty-message {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 380px;
}
.panel-loading-state {
  background: linear-gradient(180deg, rgba(0, 130, 246, 0.03) 0%, transparent 100%);
}
.panel-loading-state .panel-empty-icon {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--blue);
  width: auto;
  height: auto;
}
.panel-loading-state .panel-empty-message {
  font-weight: 500;
}

.chart-card-wrapper {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-card);
}

.accuracy-chart-card {
  padding: var(--space-4) var(--space-5) var(--space-3);
}

.accuracy-chart-wrap {
  width: 100%;
  min-height: 240px;
}

#accuracy-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  overflow: visible;
}

#accuracy-svg .accuracy-grid-line {
  stroke: var(--border);
  stroke-width: 1;
}

#accuracy-svg .accuracy-axis-label {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
}

#accuracy-svg .accuracy-bar-value {
  fill: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
}

#accuracy-svg .accuracy-bar-value.is-zero {
  fill: var(--text-muted);
  font-weight: 600;
}

#accuracy-svg .accuracy-date-label {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
}

#accuracy-svg .accuracy-empty-text {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
}

.chart-controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.chart-ticker-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.chart-ticker-symbol {
  font-size: 1.15rem;
  font-weight: 800;
}
.chart-ticker-price {
  font-size: 1.15rem;
  font-weight: 700;
}
.chart-ticker-change {
  font-size: 0.85rem;
  font-weight: 600;
}
.chart-ticker-change.up { color: var(--green); }
.chart-ticker-change.down { color: var(--red); }

.chart-options {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.chart-timeframe-group {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
}
.timeframe-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.timeframe-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.chart-type-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.canvas-chart-container {
  width: 100%;
  height: 320px;
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.interactive-chart-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.chart-hud-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 18, 29, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  pointer-events: none;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-3);
  backdrop-filter: blur(4px);
  z-index: 10;
}
.chart-hud-item span {
  font-weight: 700;
  color: var(--text);
  margin-left: 2px;
}

.settings-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 880px;
}

.settings-hero {
  padding: var(--space-5);
}

.settings-hero-main {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.settings-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  flex-shrink: 0;
}

.settings-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.settings-email {
  margin: 0 0 var(--space-2);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.settings-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.settings-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.settings-badge.verified {
  color: var(--green);
  border-color: rgba(0, 200, 150, 0.35);
  background: rgba(0, 200, 150, 0.08);
}

.settings-badge.unverified {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
}

.settings-badge.admin {
  color: var(--purple);
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
}

.settings-badge.muted {
  color: var(--text-muted);
  font-weight: 600;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.settings-card {
  padding: var(--space-5);
}

.settings-card-header {
  margin-bottom: var(--space-4);
}

.settings-card-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
}

.settings-card-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}

.settings-row-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
}

.settings-row-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.settings-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.settings-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.settings-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
}

.settings-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 130, 246, 0.12);
}

.field-error {
  display: block;
  min-height: 1rem;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--red);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.telegram-setup-help {
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  font-size: 0.8rem;
  color: var(--text-muted);
}

.telegram-setup-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.telegram-setup-steps {
  margin: var(--space-3) 0 0;
  padding-left: 1.25rem;
  line-height: 1.55;
}

.telegram-setup-steps li {
  margin-bottom: var(--space-2);
}

.settings-field-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.settings-field-actions .btn-pill {
  width: 100%;
}

.btn-pill.danger-outline {
  background: transparent;
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.45);
}

.btn-pill.danger-outline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--red);
}

@media (max-width: 768px) {
  .settings-field-row {
    grid-template-columns: 1fr;
  }
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.portfolio-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.portfolio-hero {
  margin-bottom: var(--space-5);
  background: linear-gradient(135deg, rgba(0, 130, 246, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  border-color: rgba(0, 130, 246, 0.15);
}

.portfolio-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.portfolio-realized-corner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 220px;
}

.portfolio-realized-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.portfolio-realized-range {
  font-weight: 600;
  text-transform: none;
}

.portfolio-realized-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 4px;
}

.portfolio-realized-meta {
  display: flex;
  gap: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.portfolio-realized-alltime {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.portfolio-hero-title {
  font-size: 1.6rem;
  font-weight: 800;
}

.portfolio-date-filter {
  display: flex;
  align-items: flex-end;
}

.date-range-group {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.date-range-group-single {
  align-items: stretch;
}

.section-header .date-range-group {
  flex-shrink: 0;
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-field-inline {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
}

.date-field-inline .date-field-label {
  margin-bottom: 0;
  white-space: nowrap;
}

.date-field-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.date-field-input {
  position: relative;
  display: flex;
  align-items: center;
}

.date-input {
  height: 36px;
  min-width: 148px;
  padding: 0 10px 0 34px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  color-scheme: dark;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

body.light-theme .date-input {
  color-scheme: light;
  background: var(--surface-hover);
}

.date-input:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.date-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-alpha);
  background: var(--surface);
}

.date-input::-webkit-calendar-picker-indicator {
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.date-input::-webkit-datetime-edit {
  padding: 0;
}

.date-input::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

.date-range-sep {
  color: var(--text-muted);
  font-weight: 600;
  padding-bottom: 9px;
  font-size: 0.85rem;
  user-select: none;
}

.date-apply-btn {
  height: 36px;
  margin-left: var(--space-1);
  padding: 0 18px;
}

.date-selector-wrapper {
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .section-header .date-selector-wrapper,
  .section-header .date-range-group {
    width: 100%;
  }

  .section-header .date-field {
    flex: 1;
  }

  .section-header .date-field-input,
  .section-header .date-input {
    width: 100%;
    min-width: 0;
  }
}

.portfolio-date-filter label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.portfolio-date-note {
  margin: var(--space-3) 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.section-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
}

@media (max-width: 768px) {
  .portfolio-hero-top {
    flex-direction: column;
    align-items: stretch;
  }

  .portfolio-hero-top > div:first-child {
    order: 1;
  }

  .portfolio-date-filter {
    order: 2;
    width: 100%;
  }

  .portfolio-realized-corner {
    order: 3;
    width: 100%;
    align-items: flex-start;
    text-align: left;
  }

  .portfolio-realized-meta {
    justify-content: flex-start;
  }

  .date-range-group {
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
  }
  .date-field {
    flex: 1;
    min-width: 130px;
  }
  .date-field-input,
  .date-input {
    width: 100%;
    min-width: 0;
  }
  .date-range-sep {
    display: none;
  }
  .date-apply-btn {
    width: 100%;
    margin-left: 0;
    margin-top: var(--space-1);
    height: 40px;
  }
}

/* ============================================================
   Stock Lists, Watchlists and Opportunity Cards
   ============================================================ */
.search-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  position: relative;
  z-index: 50;
}

.search-form-row .dashboard-card {
  overflow: visible;
}
@media (max-width: 768px) {
  .search-form-row {
    grid-template-columns: 1fr;
  }
}

.scanner-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.scanner-panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-2);
}

.scanner-panel-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 var(--space-4);
}

.scanner-action-row,
.symbol-search-form {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  margin-top: auto;
}

.symbol-search-form {
  flex-wrap: wrap;
}

.symbol-combobox {
  position: relative;
  flex: 1;
  min-width: 0;
  z-index: 60;
}

.symbol-search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.symbol-search-icon {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  pointer-events: none;
}

.symbol-search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.symbol-search-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.symbol-search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 130, 246, 0.12);
}

.symbol-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1000;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
}

.symbol-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.symbol-suggestion-item:hover,
.symbol-suggestion-item.active {
  background: rgba(0, 130, 246, 0.08);
}

.symbol-suggestion-symbol {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.symbol-suggestion-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
  text-align: right;
}

.symbol-suggestion-empty {
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.symbol-analyze-btn {
  height: 40px;
  padding-left: 18px;
  padding-right: 18px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .scanner-action-row {
    flex-direction: column;
  }
  .scanner-action-row .btn-pill {
    width: 100%;
  }
  .symbol-search-form {
    flex-direction: column;
  }
  .symbol-analyze-btn {
    width: 100%;
  }
}

.stock-action-buttons {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.btn-pill {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
}
.btn-pill:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}
.btn-pill:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn-pill.primary {
  background: var(--blue);
  color: var(--text-inverse);
  border-color: var(--blue);
}
.btn-pill.primary:hover:not(:disabled) {
  background: #0070d4;
  border-color: #0070d4;
  box-shadow: 0 4px 10px rgba(0, 130, 246, 0.35);
}
.btn-pill.secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.btn-pill.secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--blue);
  color: var(--blue);
}

/* ============================================================
   PREMIUM TABLES
   ============================================================ */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-card);
  box-shadow: var(--shadow-card);
}
.premium-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}
.premium-table th {
  background: rgba(255, 255, 255, 0.01);
  padding: var(--space-4) var(--space-5);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.premium-table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.premium-table tr:last-child td {
  border-bottom: none;
}
.premium-table tr {
  transition: background-color var(--transition-fast);
}
.premium-table tr:hover td {
  background: var(--surface-hover);
}
.premium-table .symbol-name {
  font-weight: 700;
  font-size: 0.9rem;
}
.row-actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.row-delete-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 74, 74, 0.25);
  background: transparent;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.row-delete-btn:hover {
  background: var(--red-alpha);
  border-color: rgba(255, 74, 74, 0.4);
}

/* Badges & Outcomes */
.pred-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-block;
}
.pred-badge.long {
  background: var(--green-alpha);
  color: var(--green);
  border: 1px solid rgba(0, 200, 150, 0.2);
}
.pred-badge.short {
  background: var(--red-alpha);
  color: var(--red);
  border: 1px solid rgba(255, 74, 74, 0.2);
}

.trade-can {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  display: inline-block;
}
.trade-can.yes {
  background: var(--green-alpha);
  color: var(--green);
}
.trade-can.no {
  background: var(--red-alpha);
  color: var(--red);
}
.trade-style-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-block;
}
.trade-style-badge.intraday {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.trade-style-badge.swing {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.trade-plan-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.trade-plan-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.trade-plan-title {
  font-weight: 800;
  font-size: 0.85rem;
}
.trade-plan-prices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.trade-plan-prices .price-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.trade-plan-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 8px;
  line-height: 1.45;
}
.trade-plan-reasons {
  margin: 0;
  padding-left: 18px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.outcome-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  display: inline-block;
}
.outcome-badge.correct {
  background: var(--green);
  color: var(--text-inverse);
}
.outcome-badge.incorrect {
  background: var(--red);
  color: var(--text-inverse);
}
.outcome-badge.pending {
  background: var(--blue);
  color: var(--text-inverse);
}
.outcome-badge.empty {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.session-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.session-badge.session-live {
  background: var(--blue-alpha);
  color: var(--blue);
  border: 1px solid rgba(0, 130, 246, 0.2);
}
.session-badge.session-eod {
  background: var(--purple-alpha);
  color: var(--purple);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ============================================================
   Skeleton Shimmer Placeholders
   ============================================================ */
.skeleton-card {
  height: 140px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}
body.light-theme .skeleton-card::after {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.03), transparent);
}

.skeleton-table-row {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.skeleton-table-row::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}
body.light-theme .skeleton-table-row::after {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.03), transparent);
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* ============================================================
   Toggles and Switch sliders
   ============================================================ */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border);
  border-radius: 34px;
  transition: background-color var(--transition-fast);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}
input:checked + .slider {
  background-color: var(--blue-alpha);
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: var(--blue);
}

.toggle-switch-wrapper {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.toggle-switch-wrapper:hover {
  border-color: var(--border-hover);
}

.order-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: 0.95rem;
}

/* Modals overlays */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: var(--space-4);
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-6); max-width: 400px; width: 100%; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.3s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes modalSlideUp { from { opacity:0; transform: translateY(15px); } to { opacity:1; transform: translateY(0); } }
.modal-title { font-size: 1.15rem; font-weight: 700; margin-bottom: var(--space-2); }
.modal-body { font-size: 0.85rem; color: var(--text-muted); margin-bottom: var(--space-5); line-height: 1.5; }
.modal-actions { display: flex; gap: var(--space-3); justify-content: center; }

.btn-ghost-modal { padding: var(--space-2) var(--space-5); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); }
.btn-ghost-modal:hover { background: var(--surface-hover); }
.btn-danger-modal { padding: var(--space-2) var(--space-5); border-radius: var(--radius-sm); border: none; background: var(--red-alpha); color: var(--red); border: 1px solid rgba(255, 74, 74, 0.2); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); }
.btn-danger-modal:hover { background: rgba(255, 74, 74, 0.2); }
.btn-primary-modal { padding: var(--space-2) var(--space-5); border-radius: var(--radius-sm); border: none; background: var(--blue); color: var(--text-inverse); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); }
.btn-primary-modal:hover { background: #0070d4; }

/* ============================================================
   RESPONSIVENESS & MOBILE EDGE-TO-EDGE OVERRIDES
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .topnav {
    height: auto;
    min-height: 48px;
    padding: var(--space-2) var(--space-4);
    overflow-x: auto;
  }
  .index-carousel {
    flex-wrap: nowrap;
  }
  .mobile-header {
    display: flex;
  }
  .mobile-index-strip {
    display: flex;
  }
  .mobile-tabbar {
    display: flex;
  }
  .main-content {
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + var(--mobile-tabbar-height));
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
  }
}
.hidden { display: none !important; }
