/* ==========================================================================
   TradePro Bot V2 — Modern Dark Glassmorphism Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;

  /* ─── Superficies ─── */
  --bg-main: rgb(11, 15, 25);
  --bg-header: rgba(15,23,42,0.4);
  --bg-card: rgba(18, 24, 39, 0.75);
  --bg-card-hover: rgba(26, 34, 53, 0.85);
  --bg-modal: rgba(18, 24, 38, 0.95);
  --bg-surface: rgb(15, 23, 42);
  --bg-surface-deep: rgb(11, 17, 32);
  --bg-option: rgb(15, 23, 42);
  --bg-soft: rgba(255,255,255,0.05);
  --bg-soft-strong: rgba(255,255,255,0.1);
  --bg-faint: rgba(255,255,255,0.02);
  --bg-faint2: rgba(255,255,255,0.04);
  --bg-hover-accent: rgba(56,189,248,0.08);
  --bg-inset: rgba(0,0,0,0.25);
  --bg-inset-strong: rgba(0,0,0,0.3);
  --bg-inset-soft: rgba(0,0,0,0.2);
  --bg-select: rgba(30,41,59,0.85);
  --bg-select-soft: rgba(15,23,42,0.7);
  --bg-toggle: rgba(15,23,42,0.85);
  --bg-toolbar: rgba(15,23,42,0.65);
  --bg-zoom: rgba(30,41,59,0.7);
  --bg-guest: rgba(30,41,59,0.6);
  --bg-canvas: rgb(10, 15, 29);
  --bg-macro: rgba(11,15,25,0.95);
  --bg-tooltip: rgba(15,23,42,0.96);
  --bg-auth-card: rgba(17,24,39,0.96);
  --bg-auth-overlay: rgba(7,10,19,0.88);
  --bg-auth-input: rgba(15,23,42,0.8);
  --bg-auth-input-focus: rgba(15,23,42,0.95);
  --scroll-track: rgba(0,0,0,0.2);
  --scroll-thumb: rgba(255,255,255,0.15);

  /* ─── Bordes ─── */
  --border-subtle: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --border-faint: rgba(255,255,255,0.04);
  --border-glass: rgba(255,255,255,0.12);
  --border-strong: rgba(255,255,255,0.2);
  --border-active: rgba(56,189,248,0.4);

  /* ─── Texto ─── */
  --text-primary: rgb(248, 250, 252);
  --text-secondary: rgb(148, 163, 184);
  --text-muted: rgb(100, 116, 139);
  --text-inverse: rgb(11, 15, 25);
  --text-light: rgb(203, 213, 225);
  --text-white: rgb(255, 255, 255);

  /* ─── Acentos (heredados) ─── */
  --accent-blue: rgb(56, 189, 248);
  --accent-cyan: rgb(6, 182, 212);
  --accent-emerald: rgb(16, 185, 129);
  --accent-amber: rgb(245, 158, 11);
  --accent-rose: rgb(244, 63, 94);
  --accent-purple: rgb(168, 85, 247);

  /* ─── Semántica de mercado ─── */
  --up: rgb(52, 211, 153);
  --up-solid: rgb(16, 185, 129);
  --up-soft: rgba(16,185,129,0.15);
  --up-border: rgba(16,185,129,0.3);
  --down: rgb(251, 113, 133);
  --down-solid: rgb(239, 68, 68);
  --down-soft: rgba(244,63,94,0.15);
  --down-border: rgba(244,63,94,0.3);
  --amber: rgb(251, 191, 36);
  --amber-solid: rgb(245, 158, 11);
  --amber-soft: rgba(245,158,11,0.15);
  --amber-border: rgba(245,158,11,0.3);
  --info: rgb(125, 211, 252);
  --info-soft: rgba(56,189,248,0.15);
  --info-border: rgba(56,189,248,0.3);
  --info-glow: rgba(56,189,248,0.25);
  --info-glow-soft: rgba(56,189,248,0.2);
  --info-active: rgba(56,189,248,0.18);
  --info-badge: rgba(56,189,248,0.12);
  --info-chip: rgba(56,189,248,0.16);
  --info-hover: rgba(56,189,248,0.1);

  /* ─── Indicadores EMA (botones + gráfico) ─── */
  --ema10: rgb(56, 189, 248);
  --ema10-soft: rgba(56,189,248,0.18);
  --ema10-glow: rgba(56,189,248,0.25);
  --ema30: rgb(251, 191, 36);
  --ema30-soft: rgba(251,191,36,0.18);
  --ema30-glow: rgba(251,191,36,0.25);
  --ema50: rgb(192, 132, 252);
  --ema50-soft: rgba(192,132,252,0.18);
  --ema50-glow: rgba(192,132,252,0.25);

  /* ─── Gráfico Canvas (leídos por ChartManager) ─── */
  --chart-grid: rgba(255,255,255,0.05);
  --chart-grid-text: rgba(255,255,255,0.45);
  --chart-vol-up: rgba(34,197,94,0.15);
  --chart-vol-down: rgba(239,68,68,0.15);
  --chart-area-accent: rgba(56,189,248,0.38);
  --chart-area-mid: rgba(56,189,248,0.12);
  --chart-accent-glow: rgba(56,189,248,0.6);
  --chart-buy: rgb(34, 197, 94);
  --chart-buy-stroke: rgb(22, 163, 74);
  --chart-sell: rgb(239, 68, 68);
  --chart-sell-stroke: rgb(220, 38, 38);
  --chart-crosshair: rgba(255,255,255,0.28);
  --chart-label-bg: rgb(30, 41, 59);
  --chart-label-ring: rgb(56, 189, 248);
  --chart-hint: rgba(255,255,255,0.35);
  --chart-clear: rgb(255, 255, 255);

  /* ─── Tipografía ─── */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* ─── Geometría ─── */
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-glow: 0 0 25px rgba(56,189,248,0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, var(--bg-hover-accent) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-inset-soft);
}
::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

/* Top Macro Ticker Bar */
.macro-bar {
  background: var(--bg-macro);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  overflow: visible;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: var(--glass-blur);
}

.macro-items {
  display: flex;
  align-items: center;
  gap: 24px;
  white-space: nowrap;
}

.macro-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.macro-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 0.72rem;
}

.macro-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  height: 24px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
}
.badge-green { background: var(--up-soft); color: var(--up); border: 1px solid var(--up-border); }
.badge-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-red { background: var(--down-soft); color: var(--down); border: 1px solid var(--down-border); }
.badge-blue { background: var(--info-soft); color: var(--info); border: 1px solid rgba(56, 189, 248, 0.3); }

/* Header Navbar - Estructura espaciosa de 2 niveles */
.header-nav {
  position: relative;
  z-index: 1005;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-header);
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.header-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
  flex-shrink: 0;
}

.logo-brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  line-height: 1;
}

.logo-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  margin: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.version-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: var(--info-soft);
  color: var(--accent-blue);
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}

.logo-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-hover);
  flex-shrink: 0;
}

.logo-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  margin: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-end;
}
.nav-actions::-webkit-scrollbar { display: none; }
.nav-actions .btn-primary,
.nav-actions a.btn-primary,
.nav-actions .skin-picker-toggle {
  flex-shrink: 0;
  white-space: nowrap;
}

.hidden-by-role,
.nav-actions [style*="display: none"],
.nav-actions [style*="display:none"] {
  display: none !important;
}

/* Universal Search Input */
.search-wrapper {
  position: relative;
  width: 260px;
}

.search-input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 14px 8px 36px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
}
.search-input:focus {
  border-color: var(--accent-blue);
  background: var(--border-subtle);
  box-shadow: 0 0 0 3px var(--info-soft);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 105%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.autocomplete-item {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border-faint);
  transition: background 0.15s ease;
}
.autocomplete-item:hover {
  background: var(--info-hover);
}

/* Main Layout Grid */
.main-layout {
  display: grid;
  grid-template-columns: 310px 1fr 390px;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1800px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 1380px) {
  .main-layout {
    grid-template-columns: 280px 1fr;
  }
  .sidebar-right {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 32px var(--bg-inset-soft);
  transition: border-color 0.25s ease;
}
.glass-card:hover {
  border-color: var(--border-hover);
}

/* Market Selector Tabs */
.market-tabs {
  display: flex;
  background: var(--bg-inset);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}
.market-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.market-tab-btn.active {
  background: var(--accent-blue);
  color: var(--text-inverse);
  font-weight: 700;
}

/* Ticker List */
.ticker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 680px;
  overflow-y: auto;
  padding-right: 4px;
}
.ticker-card {
  background: var(--bg-faint);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ticker-card:hover, .ticker-card.active {
  background: var(--bg-hover-accent);
  border-color: var(--accent-blue);
  transform: translateX(4px);
}
.ticker-card.active {
  box-shadow: 0 0 15px var(--info-glow-soft);
}

.ticker-sym {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
}
.ticker-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.ticker-price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.92rem;
  text-align: right;
}
.ticker-chg {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
}
.text-up { color: var(--up); }
.text-down { color: var(--down); }

/* Chart Central Area */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.active-asset-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.active-asset-price {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.chart-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ctrl-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  white-space: nowrap;
  text-align: center;
}
.ctrl-btn:hover {
  background: var(--bg-soft-strong);
  color: var(--text-primary);
}
.ctrl-btn.active {
  background: var(--info-soft);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* Colores específicos de cada indicador para rápida identificación visual */
.ctrl-btn.ctrl-ema10.active {
  background: var(--info-active);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 8px var(--info-glow);
}
.ctrl-btn.ctrl-ema30.active {
  background: var(--ema30-soft);
  color: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 8px var(--ema30-glow);
}
.ctrl-btn.ctrl-ema50.active {
  background: var(--ema50-soft);
  color: var(--ema50);
  border-color: var(--ema50);
  box-shadow: 0 0 8px var(--ema50-glow);
}
.ctrl-btn.ctrl-ruler.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}
.ctrl-btn.ctrl-emawaves.active {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}
.ctrl-btn.ctrl-angles.active {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border-color: #0ea5e9;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.35);
}
.ctrl-btn.ctrl-risk.active {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

/* Selector Segmentado de Tipo de Gráfico: Velas vs Línea */
.chart-type-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-toggle);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.chart-type-btn {
  background: transparent;
  border: none !important;
  color: var(--text-secondary) !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  padding: 4px 9px !important;
  border-radius: 4px !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.1;
}

.chart-type-btn:hover {
  color: var(--text-primary) !important;
  background: var(--border-subtle) !important;
}

.chart-type-btn.active {
  background: #3b82f6 !important;
  color: var(--text-white) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45) !important;
}

.ctrl-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.ctrl-btn.ctrl-zoom {
  background: var(--bg-zoom);
  padding: 5px 8px;
}
.ctrl-btn.ctrl-zoom:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.main-chart-section {
  min-width: 0;
  max-width: 100%;
}

.canvas-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 560px;
  position: relative;
  background: var(--bg-inset-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-faint);
}

/* ==========================================================================
   MODO PANTALLA COMPLETA TOTAL (PC y Móvil)
   ========================================================================== */
.main-chart-section.chart-fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
  background: var(--bg-base, #0b0f19) !important;
  box-shadow: none !important;
  padding: 12px 18px 14px !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.main-chart-section.chart-fullscreen-mode .chart-header {
  flex-shrink: 0 !important;
  margin-bottom: 8px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
}

.main-chart-section.chart-fullscreen-mode .canvas-container {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  width: 100% !important;
  position: relative !important;
  border-radius: 8px !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
}

.main-chart-section.chart-fullscreen-mode .canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Ocultar elementos secundarios en pantalla completa para enfocar toda la vista en el gráfico */
.main-chart-section.chart-fullscreen-mode .stats-grid,
.main-chart-section.chart-fullscreen-mode .risk-card,
.main-chart-section.chart-fullscreen-mode .backtest-card,
.main-chart-section.chart-fullscreen-mode .admin-oscillator-panel,
.main-chart-section.chart-fullscreen-mode #waveOscContainer {
  display: none !important;
}

/* Paneles osciladores inferiores y sus canvas: siempre contenidos al 100% */
.admin-oscillator-panel,
#waveOscContainer {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#adminSmaDiffCanvas,
#waveOscCanvas {
  max-width: 100% !important;
  display: block !important;
}

.canvas-container.chart-fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
  background: var(--bg-card, #0f172a) !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.chart-fs-locked {
  overflow: hidden !important;
  touch-action: none !important;
}

.ctrl-btn.ctrl-fullscreen {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  font-weight: 700;
  transition: all 0.2s ease;
}

.ctrl-btn.ctrl-fullscreen:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.ctrl-btn.ctrl-fullscreen.active {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4) !important;
}

/* Botonera flotante táctil sobre el gráfico — Cápsula Glassmorphism con Auto-Fade */
.chart-floating-touch-bar {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 30;
  pointer-events: auto;
  opacity: 0.22;
  transform: translateY(0);
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.28s ease,
              border-color 0.28s ease,
              box-shadow 0.28s ease;
}

/* En reposo no estorba la lectura de velas ni volumen; al pasar el cursor por el gráfico o la barra se ilumina suavemente */
.canvas-container:hover .chart-floating-touch-bar {
  opacity: 0.72;
}

.chart-floating-touch-bar:hover,
.chart-floating-touch-bar.touch-active,
.chart-floating-touch-bar:focus-within {
  opacity: 1 !important;
  background: rgba(15, 23, 42, 0.82) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(56, 189, 248, 0.2) !important;
  transform: translateY(-2px);
}

.chart-floating-touch-bar button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.16s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  padding: 0;
  margin: 0;
}

.chart-floating-touch-bar button:hover {
  background: rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  transform: scale(1.12);
}

.chart-floating-touch-bar button:active {
  background: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: scale(0.92);
}

.chart-floating-touch-bar .pill-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 3px;
  flex-shrink: 0;
}

/* Indicators Live Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.stat-box {
  background: var(--bg-faint);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}
.stat-box-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-box-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
}

/* Risk Parameters Card */
.risk-card {
  margin-top: 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.6));
  border: 1px solid var(--border-active);
}
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.risk-item {
  background: var(--bg-inset-strong);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.sidebar-right {
  display: flex;
  flex-direction: column;
  min-height: 820px;
}

/* AI Assistant Panel */
.ai-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  gap: 12px;
}
.ai-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 2px;
}
.ai-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-icon-badge {
  font-size: 1.35rem;
  background: var(--info-badge);
  border: 1px solid var(--info-glow);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-title {
  font-size: 0.98rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
}
.ai-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 8px var(--up);
}
.status-dot.offline {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

/* AI Controls Mini-Toolbar */
.ai-controls-bar {
  display: flex;
  gap: 8px;
  background: var(--bg-toolbar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  align-items: center;
}

.ai-select-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ai-select-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ai-mode-select {
  width: 100%;
  background: var(--bg-select);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  color-scheme: dark;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-mode-select:hover, .ai-mode-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 8px var(--info-glow);
}
.ai-mode-select optgroup {
  background: #0b1120;
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 5px 2px;
}
.ai-mode-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 4px 6px;
  font-weight: 500;
}

.ai-mode-refresh-btn {
  background: var(--bg-guest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ai-mode-refresh-btn .refresh-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}
.ai-mode-refresh-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.ai-mode-refresh-btn:hover .refresh-icon {
  transform: rotate(180deg);
}

.ai-output-area {
  flex: 1;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  font-size: 0.88rem;
  overflow-y: auto;
  min-height: 560px;
  max-height: 720px;
  line-height: 1.65;
}
.ai-output-area h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent-blue);
}
.ai-output-area ul {
  padding-left: 18px;
  margin-bottom: 10px;
}

/* Chat Messages & Bubbles */
.chat-msg {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  animation: fadeInMsg 0.2s ease;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
  align-items: flex-end;
}
.chat-msg.assistant {
  align-items: flex-start;
}
.chat-bubble {
  max-width: 95%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.4), rgba(14, 165, 233, 0.4));
  border: 1px solid var(--border-active);
  color: var(--text-white);
  border-bottom-right-radius: 2px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--border-faint);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}
.chat-sender-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 95%;
}
.chat-sender-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chat-timestamp {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-secondary);
  opacity: 0.85;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.ai-input-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.ai-input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}
.ai-input:focus {
  border-color: var(--accent-blue);
}
.ai-btn {
  background: var(--accent-blue);
  color: var(--text-inverse);
  border: none;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  white-space: nowrap;
}
.ai-btn:hover {
  background: var(--info);
  box-shadow: 0 0 15px var(--border-active);
}

/* Backtest Dashboard Modal / Section */
.backtest-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}
@media (max-width: 768px) {
  .backtest-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.backtest-card {
  background: var(--bg-inset-strong);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

/* ==========================================================================
   Print / PDF Styles — Informe Pro
   ========================================================================== */

#proPrintReportContainer {
  display: none;
}

@media print {
  @page {
    margin: 8mm 10mm;
    size: A4 portrait;
  }

  html, body {
    background: var(--text-inverse) !important;
    color: var(--text-primary) !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    font-family: var(--font-body) !important;
    font-size: 10pt !important;
  }

  /* 1. Ocultar completamente la UI interactiva en la impresión */
  .macro-bar,
  .header-nav,
  .main-layout,
  #alertsModal,
  #logsPanel {
    display: none !important;
  }

  /* 2. Mostrar exclusivamente el Informe Pro */
  #proPrintReportContainer {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--text-inverse) !important;
    color: var(--text-primary) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pro-report-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-blue);
    background: var(--bg-surface) !important;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 12px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pro-logo-title {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .pro-logo-icon {
    font-size: 2rem;
  }

  .pro-logo-title h2 {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    font-family: var(--font-heading) !important;
  }

  .pro-logo-title p {
    font-size: 0.74rem !important;
    color: var(--text-secondary) !important;
    margin: 2px 0 0 0 !important;
  }

  .pro-tag {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: white;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
  }

  .pro-header-right {
    text-align: right;
  }

  .pro-date {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-family: var(--font-mono);
  }

  .pro-signal-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-family: var(--font-mono);
  }
  .pro-signal-badge.buy {
    background: rgba(16, 185, 129, 0.25) !important;
    border: 1px solid var(--up-solid) !important;
    color: var(--up) !important;
  }
  .pro-signal-badge.sell {
    background: rgba(239, 68, 68, 0.25) !important;
    border: 1px solid var(--down-solid) !important;
    color: var(--down) !important;
  }
  .pro-signal-badge.neutral {
    background: rgba(245, 158, 11, 0.25) !important;
    border: 1px solid #f59e0b !important;
    color: var(--amber) !important;
  }

  .pro-asset-banner {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 14px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pro-asset-sym {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-blue);
    font-family: var(--font-heading);
  }

  .pro-asset-name {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: 8px;
  }

  .pro-asset-prices {
    font-size: 0.85rem;
    text-align: right;
  }

  .pro-section {
    margin-bottom: 12px !important;
    page-break-inside: avoid !important;
  }

  .pro-section-title {
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-blue);
    border-bottom: 1px solid #334155;
    padding-bottom: 4px;
    margin-bottom: 8px;
    font-family: var(--font-heading);
  }

  /* Contenedor del Gráfico con Fondo Grafito Oscuro */
  .pro-chart-wrapper {
    background: #0a0f1d !important;
    border: 1px solid #1e293b !important;
    border-radius: 8px;
    overflow: hidden;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pro-chart-img {
    width: 100% !important;
    height: 380px !important;
    object-fit: cover !important;
    display: block;
  }

  .pro-chart-legend {
    display: flex;
    justify-content: space-around;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6) !important;
    border-top: 1px solid #1e293b;
    font-size: 0.74rem;
    font-family: var(--font-mono);
    color: var(--text-light);
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Grids de métricas */
  .pro-grid-5 {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8px !important;
  }

  .pro-grid-4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
  }

  .pro-card {
    background: var(--bg-surface) !important;
    border: 1px solid #334155 !important;
    border-radius: 6px;
    padding: 8px 10px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pro-card-label {
    font-size: 0.66rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
  }

  .pro-card-val {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    margin: 2px 0;
    color: var(--text-primary);
  }

  .pro-card-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
  }

  /* Área de Dictamen IA con flujo completo sin cortes */
  .pro-ai-content {
    background: var(--bg-surface) !important;
    border: 1px solid #334155 !important;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 0.84rem;
    line-height: 1.6;
    color: #f1f5f9;
    page-break-inside: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pro-ai-content h2, .pro-ai-content h3 {
    color: var(--accent-blue);
    margin: 10px 0 4px 0;
    font-size: 0.94rem;
  }

  .pro-ai-content ul {
    padding-left: 18px;
    margin: 4px 0 8px 0;
  }

  .pro-ai-content p {
    margin-bottom: 8px;
  }

  .pro-report-footer {
    margin-top: 16px !important;
    padding-top: 8px !important;
    border-top: 1px solid #334155;
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    page-break-inside: avoid !important;
  }
}

/* Modal de Alertas Glassmorphism */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.modal-box {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 14px;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}
.modal-close-btn:hover {
  color: var(--text-white);
}
.switch-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* ==========================================================================
   Sistema de Tooltips Educativos e Interactivos (Para no expertos)
   ========================================================================== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-tooltip);
  color: var(--text-primary);
  border: 1px solid var(--border-active);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  width: max-content;
  max-width: 270px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 16px var(--info-glow-soft);
  z-index: 10000;
  text-transform: none;
  font-family: var(--font-body);
  letter-spacing: normal;
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--bg-tooltip) transparent transparent transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 10001;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltip desplegable hacia abajo para barras superiores */
[data-tooltip-pos="down"]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-pos="down"]::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-color: transparent transparent var(--bg-tooltip) transparent;
}

[data-tooltip-pos="down"]:hover::after,
[data-tooltip-pos="down"]:hover::before {
  transform: translateX(-50%) translateY(0);
}

/* Alineación a la derecha para elementos pegados al borde derecho */
[data-tooltip-pos="left"]::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
[data-tooltip-pos="left"]::before {
  left: auto;
  right: 14px;
  transform: none;
}
[data-tooltip-pos="left"]:hover::after {
  transform: translateY(0);
}

/* Tooltip abajo a la izquierda para esquinas superiores derechas */
[data-tooltip-pos="down-left"]::after {
  bottom: auto;
  top: calc(100% + 8px);
  left: auto;
  right: 0;
  transform: translateY(-4px);
}
[data-tooltip-pos="down-left"]::before {
  bottom: auto;
  top: calc(100% + 2px);
  left: auto;
  right: 18px;
  transform: none;
  border-color: transparent transparent var(--bg-tooltip) transparent;
}
[data-tooltip-pos="down-left"]:hover::after,
[data-tooltip-pos="down-left"]:hover::before {
  transform: translateY(0);
}

/* Tooltip abajo a la derecha para elementos pegados al borde izquierdo */
[data-tooltip-pos="down-right"]::after {
  bottom: auto;
  top: calc(100% + 8px);
  left: 0;
  transform: translateY(-4px);
}
[data-tooltip-pos="down-right"]::before {
  bottom: auto;
  top: calc(100% + 2px);
  left: 20px;
  transform: none;
  border-color: transparent transparent var(--bg-tooltip) transparent;
}
[data-tooltip-pos="down-right"]:hover::after,
[data-tooltip-pos="down-right"]:hover::before {
  transform: translateY(0);
}

/* ==========================================================================
   ANIMACIONES DE TICKER: DESTELLOS DE PRECIO EN VIVO (FLASH UP / FLASH DOWN)
   ========================================================================== */
.active-asset-price {
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
}

.price-val {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

@keyframes priceFlashUp {
  0% {
    background-color: var(--up-border);
    color: var(--up);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.6);
    transform: scale(1.06);
  }
  100% {
    background-color: transparent;
    color: inherit;
    box-shadow: none;
    transform: scale(1);
  }
}

@keyframes priceFlashDown {
  0% {
    background-color: var(--down-border);
    color: var(--down);
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.6);
    transform: scale(1.06);
  }
  100% {
    background-color: transparent;
    color: inherit;
    box-shadow: none;
    transform: scale(1);
  }
}

.price-flash-up {
  animation: priceFlashUp 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.price-flash-down {
  animation: priceFlashDown 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* ==========================================================================
   Supabase Auth Gate & User Profile Styles
   ========================================================================== */

/* 1. Chip de Usuario en la Barra de Navegación */
.user-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-zoom);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 9999px;
  padding: 4px 14px;
  height: 38px;
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-left: 8px;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  vertical-align: middle;
}

.user-avatar-icon {
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.user-email-text {
  font-weight: 700;
  color: var(--text-primary);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--down);
  border-radius: 999px;
  padding: 0 10px;
  height: 24px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.3);
  color: var(--text-white);
  border-color: var(--down-solid);
}

/* 2. Cortina / Overlay de Autenticación (Auth Gate) */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(7, 10, 19, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: authFadeIn 0.3s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.7), 0 0 25px rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(59, 130, 246, 0.3));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 14px;
  font-size: 1.5rem;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  background: linear-gradient(135deg, var(--text-white) 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted, var(--text-secondary));
  margin: 0;
  line-height: 1.4;
}

/* Pestañas */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-select-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: #4f46e5;
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

/* Campos de Formulario */
.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-field {
  margin-bottom: 16px;
  text-align: left;
}

.auth-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-auth-input);
  border: 1px solid rgba(75, 85, 99, 0.45);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: #6366f1;
  background: var(--bg-auth-input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-password-toggle {
  transition: color 0.2s ease, transform 0.15s ease;
  user-select: none;
}

.auth-password-toggle:hover {
  color: var(--accent-blue) !important;
}

.auth-password-toggle:active {
  transform: translateY(-50%) scale(0.9) !important;
}

.auth-status-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  margin-bottom: 14px;
  line-height: 1.4;
  text-align: left;
}

.auth-status-msg.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.auth-status-msg.success {
  background: var(--up-soft);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* Botón Submit */
.btn-auth-submit {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: var(--text-white);
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-auth-submit:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--text-white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer & Modo Invitado */
.auth-footer {
  margin-top: 20px;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--bg-soft-strong);
}

.auth-divider span {
  padding: 0 10px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.btn-guest-login {
  width: 100%;
  background: var(--bg-guest);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-light);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-guest-login:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(148, 163, 184, 0.45);
  color: var(--text-white);
}

.auth-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 0;
  line-height: 1.35;
}

/* Watchlist de Alertas TG */
.btn-watch-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  margin-left: 10px;
  transition: all 0.2s ease;
  vertical-align: middle;
  white-space: nowrap;
}

.btn-watch-toggle:hover {
  background: var(--info-badge);
  border-color: var(--border-active);
  color: var(--accent-blue);
}

.btn-watch-toggle.active {
  background: var(--info-active);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 10px var(--info-glow);
}

.watch-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--border-faint);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  user-select: none;
}

.watch-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-white);
  border-color: var(--border-strong);
}

.watch-chip.active {
  background: var(--info-chip);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 8px var(--info-glow-soft);
}

/* ==========================================================================
   RESPONSIVE / MOBILE — Notebooks chicas, tablets y celulares
   (Basados en la retroalimentación real: se veía roto y el gráfico
   desaparecía dentro de su área por el escalado DPR del canvas.)
   ========================================================================== */

@media (max-width: 1100px) {
  .header-nav {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  .search-wrapper {
    width: 100%;
    order: 3;
  }
  .main-layout {
    padding: 16px;
    gap: 16px;
  }
  .logo-title {
    font-size: 1.25rem;
  }
  /* Prevenir cortes en textos largos */
  .ticker-name {
    max-width: 120px;
  }
  .btn-logout {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  /* Mejorar flex layout */
  .market-tabs {
    justify-content: flex-start;
    overflow-x: auto;
  }
  .market-tab-btn {
    flex: 0 0 auto;
    min-width: 80px;
  }
  /* Ajustar píldoras y badges */
  .badge-pill {
    padding: 2px 6px;
    font-size: 0.7rem;
  }
  .btn-primary {
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .macro-bar {
    padding: 6px 12px;
    gap: 8px;
    height: auto;
    min-height: 32px;
    z-index: 999;
  }
  .macro-items {
    gap: 12px;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .macro-label {
    font-size: 0.7rem;
  }
  .macro-val {
    font-size: 0.75rem;
  }
  .canvas-container {
    height: 420px;
  }
  .glass-card {
    padding: 16px;
  }
  .sidebar-right {
    min-height: auto;
  }
  .ai-output-area {
    min-height: 380px;
    max-height: 500px;
  }
  .ticker-list {
    max-height: 420px;
    padding-right: 2px;
  }
  /* Ajustes de text-overflow y overflow */
  .ticker-card {
    padding: 10px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .ticker-sym {
    font-size: 0.9rem;
  }
  .ticker-name {
    max-width: 120px;
  }
  /* Prevenir cortes en píldoras */
  .badge-pill {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  /* Mejorar scroll en móviles */
  .macro-items {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }
  /* Ajustar chart controls */
  .chart-controls {
    gap: 6px;
    overflow-x: auto;
  }
  .ctrl-btn {
    font-size: 0.7rem;
    padding: 4px 6px;
    white-space: nowrap;
  }
  .active-asset-title {
    font-size: 1.1rem;
  }
  .active-asset-price {
    font-size: 1.25rem;
  }
}

@media (max-width: 768px) {
  /* 1. Prevención radical de desbordamiento horizontal */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
  }

  /* 2. Barra Macro Superior compacta con scroll horizontal fluido */
  .macro-bar {
    padding: 6px 12px;
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--bg-macro);
    z-index: 999;
  }
  .macro-bar::-webkit-scrollbar {
    display: none;
  }
  .macro-items {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
    width: max-content;
  }
  .macro-item {
    white-space: nowrap;
    font-size: 0.72rem;
  }
  .macro-label {
    font-size: 0.68rem;
  }
  .macro-val {
    font-size: 0.74rem;
  }
  .badge-pill {
    font-size: 0.68rem;
    height: 20px;
    padding: 0 6px;
  }

  /* 3. Header estilo AppBar Android con 2 niveles limpios */
  .header-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    z-index: 1000;
  }

  /* Fila 1: Logo compacto a la izquierda + Chip de Usuario a la derecha */
  .header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }
  .logo-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .logo-icon {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    border-radius: 8px;
  }
  .logo-brand-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .logo-title {
    font-size: 1.15rem;
    line-height: 1;
  }
  .version-tag {
    font-size: 0.55rem;
    height: 18px;
    padding: 0 5px;
  }
  /* Ocultar subtítulo largo en móviles para evitar romper el ancho */
  .logo-dot,
  .logo-tagline {
    display: none !important;
  }

  /* Chip de sesión / usuario estilo Android */
  .user-profile-chip {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    max-width: 52%;
    margin-left: auto;
    font-size: 0.72rem;
  }
  .user-avatar-icon {
    font-size: 0.78rem;
  }
  .user-email-text {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  #userPlanBadge {
    font-size: 0.58rem;
    height: 18px;
    padding: 0 5px;
  }
  .btn-logout {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: none;
    cursor: pointer;
  }

  /* Fila 2: Buscador completo + Carrusel táctil de botones de acción */
  .header-bottom-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }
  .search-wrapper {
    width: 100% !important;
  }
  .search-input {
    width: 100%;
    height: 36px;
    padding: 6px 12px 6px 36px;
    font-size: 0.82rem;
    border-radius: 999px;
    background: var(--bg-surface);
  }
  .search-icon {
    left: 12px;
    font-size: 0.85rem;
  }

  /* Barra de acciones deslizable (Horizontal Action Chips) */
  .nav-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    width: 100%;
    padding: 2px 0 4px;
  }
  .nav-actions::-webkit-scrollbar {
    display: none;
  }
  .nav-actions .btn-primary,
  .nav-actions a.btn-primary,
  .nav-actions .skin-picker-toggle {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.74rem !important;
    padding: 6px 11px !important;
    border-radius: 999px !important;
    margin-right: 0 !important;
    height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  /* 4. Layout vertical estilo app Android (Single Column Stack) */
  .main-layout {
    display: flex !important;
    flex-direction: column !important;
    padding: 10px 12px !important;
    gap: 14px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .sidebar-left,
  .main-content,
  .sidebar-right {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .glass-card {
    padding: 14px;
    border-radius: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
  }

  /* 5. Selector de Mercados y Tickers en Móvil */
  .market-tabs {
    display: flex;
    gap: 4px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .market-tabs::-webkit-scrollbar {
    display: none;
  }
  .market-tab-btn {
    flex: 1;
    min-width: max-content;
    text-align: center;
    padding: 7px 10px;
    font-size: 0.76rem;
    white-space: nowrap;
  }
  .ticker-list {
    max-height: 250px;
    overflow-y: auto;
    gap: 6px;
    padding-right: 2px;
  }
  /* El card de ticker se mantiene siempre horizontal y prolijo */
  .ticker-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 9px 12px;
    gap: 8px;
  }
  .ticker-sym {
    font-size: 0.9rem;
  }
  .ticker-name {
    max-width: 110px;
    font-size: 0.7rem;
  }
  .ticker-price {
    font-size: 0.88rem;
    text-align: right;
  }

  /* 6. Gráfico Canvas y Barra de Herramientas Táctil */
  .active-asset-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }
  .active-asset-title {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 1.15rem;
  }
  .active-asset-price {
    font-size: 1.3rem;
    line-height: 1.1;
  }
  .chart-controls {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    width: 100%;
    padding: 2px 0 6px;
  }
  .chart-controls::-webkit-scrollbar {
    display: none;
  }
  .ctrl-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.7rem;
    padding: 5px 9px;
    border-radius: 6px;
  }
  .canvas-container {
    height: clamp(340px, 58vh, 440px);
    width: 100%;
    min-width: 0;
  }

  /* 7. Consejero IA y Métricas en Móvil */
  .sidebar-right {
    max-height: none !important;
    overflow: visible !important;
  }
  .ai-panel {
    max-height: none !important;
    overflow: visible !important;
  }
  .ai-output-area {
    min-height: 260px;
    max-height: none;
    font-size: 0.84rem;
    padding: 14px;
  }
  .ai-input-area {
    display: flex;
    gap: 6px;
    width: 100%;
  }
  .ai-input-area input {
    font-size: 0.84rem;
    padding: 10px 13px;
  }

  /* 8. Cuadrículas adaptadas a pantallas angostas */
  .stats-grid,
  .risk-grid,
  .backtest-summary-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* 9. Modales táctiles adaptables */
  .modal-overlay {
    padding: 12px;
    align-items: center;
  }
  .modal-box {
    padding: 16px;
    max-width: 100%;
    max-height: 92vh;
    width: 100%;
    border-radius: 14px;
  }
  .auth-card {
    padding: 22px 16px;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .logo-title {
    font-size: 1.05rem;
  }
  .user-email-text {
    max-width: 65px;
  }
  .canvas-container {
    height: clamp(330px, 58vh, 420px);
  }
  .stats-grid,
  .risk-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   SISTEMA DE SKINS — Selector de apariencia (componente base, theme-aware)
   El servicio js/themeService.js gestiona la selección y la persiste por usuario.
   Cada skin es una hoja CSS en /skins/*.css que sobrescribe las variables :root.
   ========================================================================== */
.skin-picker {
  position: relative;
  display: inline-flex;
  z-index: 1010;
}

.skin-picker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.skin-picker-toggle:hover {
  background: var(--bg-soft-strong);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.skin-picker-toggle .skin-picker-arrow {
  font-size: 0.6rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}
.skin-picker.open .skin-picker-arrow {
  transform: rotate(180deg);
}

.skin-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--bg-modal, #121826);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  padding: 6px;
  display: none; /* visibilidad controlada por JS (inline style) cuando está en el body */
  z-index: 9999;
}
/* Fallback: si el menú queda dentro del container (no teleportado) */
.skin-picker.open .skin-picker-menu {
  display: block;
}


.skin-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: all 0.15s ease;
}
.skin-option:hover {
  background: var(--bg-soft);
  color: var(--text-primary);
}
.skin-option.active {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
}
.skin-option-icon {
  font-size: 1.05rem;
  line-height: 1.3;
}
.skin-option-name {
  font-weight: 600;
  font-size: 0.8rem;
}
.skin-option-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.skin-option-check {
  color: var(--info);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.4;
}
.skin-option[data-skin-id].active .skin-option-check { display: inline; }

/* ==========================================================================
   PRESET DE IMPRESIÓN (Informe Profesional) — siempre en paleta oscura,
   independientemente del skin activo. Garantiza PDF/impresión uniforme.
   ========================================================================== */
@media print {
  html, body {
    background: #0b0f19 !important;
    color: #f8fafc !important;
  }
  #proPrintReportContainer {
    background: #0b0f19 !important;
    color: #f8fafc !important;
  }
  .pro-report-header {
    background: #0f172a !important;
    border-bottom-color: #38bdf8 !important;
  }
  .pro-logo-title h2 { color: #f8fafc !important; }
  .pro-logo-title p { color: #94a3b8 !important; }
  .pro-date { color: #94a3b8 !important; }
  .pro-signal-badge.buy {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: #10b981 !important;
    color: #34d399 !important;
  }
  .pro-signal-badge.sell {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
  }
  .pro-signal-badge.neutral {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
  }
  .pro-asset-banner {
    background: #1e293b !important;
    border-color: #334155 !important;
  }
  .pro-asset-sym { color: #38bdf8 !important; }
  .pro-asset-name { color: #cbd5e1 !important; }
  .pro-asset-prices { color: #f8fafc !important; }
  .pro-section-title {
    color: #38bdf8 !important;
    border-bottom-color: #334155 !important;
  }
  .pro-chart-wrapper {
    background: #0a0f1d !important;
    border-color: #1e293b !important;
  }
  .pro-chart-legend {
    background: rgba(0, 0, 0, 0.6) !important;
    border-top-color: #1e293b !important;
    color: #cbd5e1 !important;
  }
  .pro-card {
    background: #0f172a !important;
    border-color: #334155 !important;
  }
  .pro-card-label { color: #94a3b8 !important; }
  .pro-card-val { color: #f8fafc !important; }
  .pro-card-sub { color: #64748b !important; }
  .pro-ai-content {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
  }
  .pro-ai-content h2, .pro-ai-content h3 { color: #38bdf8 !important; }
  .pro-report-footer { border-top-color: #334155 !important; color: #64748b !important; }
}
