/* ============================================================
   Market Intelligence · Monitor PP/PE
   Design system: Grupo Ortiz brand — grupo-ortiz.com
   Modos: light (default) / dark via body[data-mode="dark"]
   ============================================================ */

/* Google Fonts — fallbacks + mono (debe ir primero) */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Blauer Nue — display/brand GO */
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-Semibold.otf') format('opentype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-Extrabold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-Extrabold.otf') format('opentype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-Heavy.otf') format('opentype'); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Blauer Nue'; src: url('../fonts/BlaurNue-BoldItalic.otf') format('opentype'); font-weight: 700; font-style: italic; font-display: swap; }

/* Conthic — body/tablas GO */
@font-face { font-family: 'Conthic'; src: url('../fonts/Conthic-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }

/* Morganite Pro — display variable (narrows/condensed headings) */
@font-face { font-family: 'Morganite Pro'; src: url('../fonts/MorganitePro-VF.ttf') format('truetype'); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ── Tokens: modo claro (default) ── */
:root {
  /* Marca Grupo Ortiz — paleta GO canónica */
  --go-orange:      #FB670B;
  --go-orange-hot:  #FF7A22;
  --go-orange-deep: #D95C00;
  --go-orange-tint: rgba(251,103,11,0.10);

  /* Tokens GO design system (context_design.md) */
  --go-black:  #262626;
  --go-gray-1: #535353;
  --go-gray-2: #C5C5C5;
  --go-cream:  #ECEBE0;
  --go-white:  #FFFFFF;

  /* Semánticos GO */
  --go-bg:      var(--go-white);
  --go-bg-warm: var(--go-cream);
  --go-text:    var(--go-black);
  --go-text-2:  var(--go-gray-1);
  --go-text-3:  var(--go-gray-2);
  --go-accent:  var(--go-orange);
  --go-border:  var(--go-gray-2);

  /* Neutrales — alineados a GO design system (light mode) */
  --go-ink:       #262626;   /* GO black — texto principal */
  --go-graphite:  #353535;   /* texto fuerte secundario */
  --go-slate:     #535353;   /* GO gray-1 — texto secundario */
  --go-gray:      #8A8A8A;   /* meta, labels, timestamps */
  --go-line:      #C5C5C5;   /* GO gray-2 — bordes */
  --go-line-2:    #DDDDD5;   /* bordes suaves, warm */
  --go-paper:     #FFFFFF;   /* cards, modales */
  --go-paper-2:   #ECEBE0;   /* GO cream — fondo de página */
  --go-paper-3:   #F2F1E8;   /* superficies warm level-2 */

  /* Señales semánticas */
  --go-mint:      #00A36E;
  --go-mint-soft: #E8F6EF;
  --go-mint-tint: rgba(0,163,110,0.12);
  --go-amber:     #D97706;
  --go-amber-tint:rgba(217,119,6,0.12);
  --go-gold:      #B58900;
  --go-gold-tint: rgba(181,137,0,0.12);

  /* Series de datos */
  --go-pp:        #1E3A8A;
  --go-pe:        #6B21A8;
  --go-pp-tint:   rgba(30,58,138,0.08);
  --go-pe-tint:   rgba(107,33,168,0.08);

  /* Tokens invertidos (siempre oscuro — para nav chip, login, etc.) */
  --go-inverse-bg:   #0A0A0A;
  --go-inverse-fg:   #FFFFFF;
  --go-inverse-fg-2: rgba(255,255,255,0.72);
  --go-inverse-fg-3: rgba(255,255,255,0.42);
  --go-inverse-line: rgba(255,255,255,0.08);

  /* Tipografía GO */
  --go-display: 'Blauer Nue', 'Nunito', sans-serif;
  --go-narrow:  'Blauer Nue', 'Nunito', sans-serif;
  --go-sans:    'Conthic', 'Inter', system-ui, sans-serif;
  --go-mono:    'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Radios */
  --go-r-sm:   4px;
  --go-r-md:   8px;
  --go-r-lg:   12px;
  --go-r-pill: 999px;

  /* Sombras — GO black base */
  --go-sh-1: 0 1px 2px rgba(38,38,38,0.06), 0 1px 0 rgba(38,38,38,0.03);
  --go-sh-2: 0 8px 24px rgba(38,38,38,0.10), 0 2px 4px rgba(38,38,38,0.05);
  --go-sh-3: 0 24px 60px rgba(38,38,38,0.14), 0 4px 12px rgba(38,38,38,0.06);

  /* Movimiento */
  --go-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --go-dur:  220ms;

  /* Aliases para compatibilidad interna */
  --ng-font-sans:    var(--go-sans);
  --ng-font-mono:    var(--go-mono);
  --ng-font-display: var(--go-display);
  --ng-r-sm:  var(--go-r-sm);
  --ng-r-md:  var(--go-r-md);
  --ng-r-lg:  var(--go-r-lg);
  --ng-ease:  var(--go-ease);
  --ng-dur:   var(--go-dur);

  /* Aliases semánticos de color (modo claro) */
  --ng-bg-0:         var(--go-cream);    /* página — crema GO */
  --ng-bg-1:         var(--go-white);    /* cards — blanco */
  --ng-bg-2:         var(--go-paper-3);  /* superficies level-2 */
  --ng-fg-1:         var(--go-black);    /* texto principal */
  --ng-fg-2:         var(--go-gray-1);   /* texto secundario */
  --ng-fg-3:         var(--go-slate);    /* texto terciario */
  --ng-fg-4:         var(--go-gray);     /* meta */
  --ng-glass-bg:     var(--go-white);
  --ng-glass-border: var(--go-gray-2);
  --ng-glass-border-hi: #BBBBBB;
  --ng-sh-rest:      var(--go-sh-1);
  --ng-sh-hover:     var(--go-sh-2);
  --ng-green:        var(--go-mint);
  --ng-orange:       var(--go-orange);
  --ng-gold:         var(--go-gold);
  --ng-amber:        var(--go-amber);
  --ng-pp:           var(--go-pp);
  --ng-pe:           var(--go-pe);
  --ng-green-tint:   var(--go-mint-tint);
  --ng-orange-tint:  var(--go-orange-tint);
  --ng-gold-tint:    var(--go-gold-tint);
  --ng-pp-tint:      var(--go-pp-tint);
  --ng-pe-tint:      var(--go-pe-tint);

  /* Chat/form tokens */
  --ng-border:       var(--go-line);
  --ng-surface-2:    var(--go-paper-3);
}

/* ── Modo oscuro ── */
body[data-mode="dark"] {
  /* GO canónicos — invertidos para dark */
  --go-black:  #FFFFFF;
  --go-gray-1: #A0A0A0;
  --go-gray-2: rgba(255,255,255,0.18);
  --go-cream:  #0F0F0F;
  --go-white:  #262626;
  /* --go-orange: #FB670B — invariable, no override */

  /* Semánticos GO — dark */
  --go-bg:      #1A1A1A;
  --go-bg-warm: #0F0F0F;
  --go-text:    #FFFFFF;
  --go-text-2:  #A0A0A0;
  --go-text-3:  rgba(255,255,255,0.35);
  --go-border:  rgba(255,255,255,0.10);

  /* Neutrales legacy — dark */
  --go-ink:       #FFFFFF;
  --go-graphite:  #F0F0F0;
  --go-slate:     #A0A0A0;
  --go-gray:      #686868;
  --go-line:      rgba(255,255,255,0.09);
  --go-line-2:    rgba(255,255,255,0.04);
  --go-paper:     #262626;   /* cards — GO black */
  --go-paper-2:   #1A1A1A;   /* page bg */
  --go-paper-3:   #2E2E2E;   /* surface level-2 */

  /* Señales — brighter en dark */
  --go-orange-tint: rgba(251,103,11,0.15);
  --go-mint:       #34D399;
  --go-mint-tint:  rgba(52,211,153,0.14);
  --go-gold:       #F5C518;
  --go-gold-tint:  rgba(245,197,24,0.14);
  --go-amber:      #FBBF24;
  --go-amber-tint: rgba(251,191,36,0.14);
  --go-pp:         #60A5FA;
  --go-pe:         #C084FC;
  --go-pp-tint:    rgba(96,165,250,0.14);
  --go-pe-tint:    rgba(192,132,252,0.14);

  /* Sombras dark */
  --go-sh-1: 0 1px 3px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.04);
  --go-sh-2: 0 8px 24px rgba(0,0,0,0.50), 0 2px 4px rgba(0,0,0,0.30);
  --go-sh-3: 0 24px 60px rgba(0,0,0,0.60), 0 4px 12px rgba(0,0,0,0.40);

  /* Aliases dark */
  --ng-glass-bg:        rgba(255,255,255,0.04);
  --ng-glass-border:    rgba(255,255,255,0.09);
  --ng-glass-border-hi: rgba(255,255,255,0.18);
  --ng-surface-2: #2E2E2E;
  --ng-border:    rgba(255,255,255,0.09);
  --ng-sh-rest:   var(--go-sh-1);
  --ng-sh-hover:  var(--go-sh-2);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  min-height: 100%;
  background: var(--go-paper-2);
}
html[data-mode="dark"] { background: #1A1A1A; }

body {
  min-height: 100vh;
  background: var(--go-paper-2);
  color: var(--go-ink);
  font-family: var(--go-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01','cv11';
  transition: background var(--go-dur) var(--go-ease), color var(--go-dur) var(--go-ease);
}

a { color: var(--go-orange); text-decoration: none; }
a:hover { color: var(--go-orange-hot); }

h1 {
  font-family: var(--go-display); font-size: 34px; font-weight: 900;
  letter-spacing: -0.02em; line-height: 0.95; text-transform: uppercase;
  color: var(--go-ink);
}
h2 {
  font-family: var(--go-display); font-size: 26px; font-weight: 900;
  letter-spacing: -0.02em; text-transform: uppercase; color: var(--go-ink);
}
p { color: var(--go-slate); }

.mono, .go-mono { font-family: var(--go-mono); font-variant-numeric: tabular-nums; }
.ng-num, .go-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  letter-spacing: -0.02em;
}

/* Eyebrow — estilo GO */
.eyebrow, .go-eyebrow {
  font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--go-orange);
}

/* Labels */
.go-label {
  font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--go-gray);
}

.text-1 { color: var(--go-ink); }
.text-2 { color: var(--go-graphite); }
.text-3 { color: var(--go-slate); }
.text-4 { color: var(--go-gray); }
.text-green { color: var(--go-mint); }
.gold  { color: var(--go-gold); }
.fw-700 { font-weight: 700; }

.w-full { width: 100%; }
[x-cloak] { display: none !important; }

/* Scrollbar */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--go-line-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--go-gray); }

::selection { background: var(--go-orange); color: #fff; }

/* ── Animaciones GO ── */
@keyframes goFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes goPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── Nav ── */
.nav {
  height: 64px; padding: 0 32px;
  display: flex; align-items: center; gap: 0;
  background: var(--go-paper);
  border-bottom: 1px solid var(--go-line);
  position: sticky; top: 0; z-index: 40;
  transition: background var(--go-dur) var(--go-ease), border-color var(--go-dur) var(--go-ease);
}

/* Logo mark */
.nav-logo { display: flex; align-items: center; gap: 12px; cursor: pointer; text-decoration: none; margin-right: 40px; }
.nav-logo-icon {
  width: 41px; height: 41px; border-radius: 8px;
  background: #FB670B;
  position: relative; flex-shrink: 0; overflow: visible;
  display: flex; align-items: center; justify-content: center;
}
.nav-logo-img { width: 41px; height: 41px; object-fit: contain; display: block; border-radius: 8px; padding: 3px; }
.nav-live-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--go-orange);
  animation: goPulse 1.6s ease-in-out infinite;
}
.nav-logo-text {
  line-height: 1;
}
.nav-logo-text strong {
  display: block;
  font-family: 'Inter', system-ui, sans-serif; font-weight: 700; font-size: 16px;
  letter-spacing: 0.04em; text-transform: lowercase; color: var(--go-ink);
}
.nav-logo-text small {
  display: block;
  font-size: 12px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--go-gray); margin-top: 2px;
}

/* Nav links — underline style GO */
.nav-links { display: flex; }
.nav-link {
  font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--go-ink); padding: 6px 0; margin: 0 14px;
  position: relative; cursor: pointer;
  transition: color var(--go-dur) var(--go-ease);
  text-decoration: none;
}
.nav-link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -22px;
  height: 3px; background: var(--go-orange); border-radius: 2px;
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--go-dur) var(--go-ease);
}
.nav-link:hover { color: var(--go-orange); }
.nav-link.active { color: var(--go-ink); }
.nav-link.active::after { transform: scaleX(1); }

.nav-end { margin-left: auto; display: flex; align-items: center; gap: 20px; }

/* Nav meta blocks (FX, fecha) */
.nav-meta-block { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.nav-meta-label { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--go-gray); font-family: 'Inter', system-ui, sans-serif; }
.nav-meta-val   { font-family: var(--go-mono); font-size: 17px; font-weight: 700; color: var(--go-ink); }

/* Toggle dark/light — botón con icono + etiqueta */
.nav-theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--go-r-sm);
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  color: var(--go-slate); cursor: pointer;
  font-size: 16px; font-weight: 600; letter-spacing: 0.04em;
  font-family: 'Inter', system-ui, sans-serif;
  transition: all var(--go-dur) var(--go-ease); flex-shrink: 0;
}
.nav-theme-btn:hover { border-color: var(--go-orange); color: var(--go-orange); background: var(--go-orange-tint); }

/* Visibilidad de íconos según modo */
body:not([data-mode="dark"]) .theme-icon-dark  { display: none; }
body:not([data-mode="dark"]) .theme-label-dark  { display: none; }
body[data-mode="dark"]       .theme-icon-light  { display: none; }
body[data-mode="dark"]       .theme-label-light { display: none; }

.nav-logout {
  font-size: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--go-gray); padding: 6px 12px; border-radius: var(--go-r-sm);
  border: 1px solid var(--go-line); cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.nav-logout:hover { color: var(--go-orange); border-color: var(--go-orange); background: var(--go-orange-tint); }

.nav-user {
  display: flex; align-items: center; gap: 7px;
  text-decoration: none; color: var(--go-slate);
  transition: color var(--go-dur) var(--go-ease);
}
.nav-user:hover { color: var(--go-ink); }
.nav-username { font-size: 13px; font-weight: 600; font-family: var(--go-mono); }
.nav-role-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 6px; border-radius: 999px;
}
.nav-role-admin { background: var(--go-orange); color: #fff; }
.nav-role-user  { background: var(--go-line); color: var(--go-gray); }
body[data-mode="dark"] .nav-role-user { background: rgba(255,255,255,0.1); color: var(--go-gray); }

/* ── Page ── */
.page { padding: 32px 32px 60px; max-width: 1440px; margin: 0 auto; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 32px; padding-bottom: 24px;
  border-bottom: 1px solid var(--go-line);
}
.page-header h1 { margin-top: 10px; }

/* ── Card (flat, GO style) ── */
.card {
  background: var(--go-paper);
  border: 1px solid var(--go-line);
  border-radius: var(--go-r-lg);
  box-shadow: var(--go-sh-1);
  position: relative; overflow: hidden;
  transition: transform var(--go-dur) var(--go-ease), box-shadow var(--go-dur) var(--go-ease), border-color var(--go-dur) var(--go-ease);
}
.card:hover { box-shadow: var(--go-sh-2); }
body[data-mode="dark"] .card:hover { border-color: rgba(255,255,255,0.18); }

.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--go-narrow); font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--go-ink);
}

/* ── Signal badge ── */
.signal-badge {
  font-family: var(--go-display); font-size: 16px; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: var(--go-r-sm);
}
.signal-buy   { color: var(--go-mint);  background: var(--go-mint-tint);  border: 1px solid rgba(0,163,110,0.25); }
.signal-wait  { color: var(--go-amber); background: var(--go-amber-tint); border: 1px solid rgba(217,119,6,0.25); }
.signal-alert { color: var(--go-orange);   background: var(--go-orange-tint);   border: 1px solid rgba(251,103,11,0.25); }

/* ── KPI Grid ── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1024px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px)  { .kpi-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px)  { .kpi-value { font-size: 34px; } }

.kpi-card {
  position: relative; padding: 22px;
  background: var(--go-paper); border: 1px solid var(--go-line);
  border-radius: var(--go-r-lg); box-shadow: var(--go-sh-1);
  transition: transform var(--go-dur) var(--go-ease), box-shadow var(--go-dur) var(--go-ease), border-color var(--go-dur) var(--go-ease);
  cursor: default; overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--go-sh-2); }
body[data-mode="dark"] .kpi-card:hover { border-color: rgba(255,255,255,0.18); }

/* KPI product pill */
.kpi-product-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 16px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
}
.kpi-product-pill--pp { background: var(--go-pp-tint); color: var(--go-pp); }
.kpi-product-pill--pe { background: var(--go-pe-tint); color: var(--go-pe); }
body[data-mode="dark"] .kpi-card:hover { border-color: rgba(255,255,255,0.18); }

.kpi-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.kpi-label  { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; color: var(--go-gray); }

/* Product pill */
.kpi-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.kpi-dot--pp { background: var(--go-pp); }
.kpi-dot--pe { background: var(--go-pe); }

.kpi-hero { display: flex; align-items: baseline; gap: 4px; }
.kpi-currency { font-size: 15px; font-weight: 700; color: var(--go-gold); flex-shrink: 0; }
.kpi-value {
  font-family: var(--go-display); font-size: clamp(22px, 2.2vw, 34px); font-weight: 900;
  letter-spacing: -0.02em; line-height: 0.95; color: var(--go-ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kpi-unit { font-size: 13px; color: var(--go-gray); font-family: var(--go-mono); font-weight: 600; letter-spacing: 0.03em; white-space: nowrap; flex-shrink: 0; }

.kpi-sub-hero { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; }
.kpi-sub-currency { font-size: 12px; font-weight: 700; color: var(--go-gold); }
.kpi-sub-value { font-family: var(--go-display); font-size: 22px; font-weight: 800; letter-spacing: -0.01em; line-height: 1; color: var(--go-slate); font-variant-numeric: tabular-nums; }
.kpi-sub-unit { font-size: 13px; color: var(--go-gray); font-family: var(--go-mono); font-weight: 600; letter-spacing: 0.04em; }

.kpi-divider { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--go-line-2); }
.kpi-rows { display: flex; flex-direction: column; gap: 4px; }
.kpi-row  { display: flex; justify-content: space-between; font-size: 14px; font-family: var(--go-mono); color: var(--go-gray); }
.kpi-row.highlight { color: var(--go-slate); font-weight: 500; }

.kpi-delta {
  position: absolute; top: 18px; right: 18px;
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 3px 7px; border-radius: var(--go-r-sm);
}
.kpi-delta.up   { background: var(--go-orange-tint);  color: var(--go-orange);  }
.kpi-delta.dn   { background: var(--go-mint-tint); color: var(--go-mint); }
.kpi-delta.none { color: var(--go-gray); background: transparent; }
.kpi-empty { color: var(--go-gray); font-size: 13px; padding: 8px 0; }
.kpi-freshness { font-size: 11px; margin-top: 6px; font-family: var(--go-mono); }
.kpi-freshness.fresh { color: #22c55e; }
.kpi-freshness.warn { color: #f59e0b; }
.kpi-freshness.stale { color: #ef4444; font-weight: bold; }

/* ── Chart + Gauge ── */
.row-chart-gauge {
  display: grid; grid-template-columns: 2fr 1fr; gap: 20px;
  margin-bottom: 24px; min-height: 360px;
}
@media (max-width: 900px) { .row-chart-gauge { grid-template-columns: 1fr; } }

.chart-card { padding: 24px; display: flex; flex-direction: column; height: 100%; }
.chart-wrap { position: relative; flex: 1; min-height: 280px; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* ── Gauge ── */
.gauge-card .eyebrow { font-size: 24px; }
.gauge-card {
  padding: 28px; display: flex; flex-direction: column;
  align-items: center; text-align: center;
}
.gauge-wrap { width: 100%; margin: 14px 0 0; }
.gauge-number { display: flex; align-items: baseline; justify-content: center; margin-top: 14px; }
.gauge-val {
  font-family: var(--go-display); font-size: 52px; font-weight: 900;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1;
  color: var(--go-ink);
}
.gauge-of  {
  font-family: var(--go-display); font-size: 18px; font-weight: 900;
  color: var(--go-gray); letter-spacing: 0.02em;
}
.gauge-signal {
  margin-top: 10px; font-family: var(--go-display); font-size: 22px;
  font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase;
}
.gauge-meta {
  margin-top: 16px; width: 100%;
  display: flex; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--go-gray); font-weight: 700;
}

/* Gauge SVG — clases para CSS vars (los atributos SVG no las soportan) */
.gauge-track       { stroke: var(--go-line); }
.gauge-needle-line { stroke: var(--go-ink); }
.gauge-needle-hub  { fill: var(--go-ink); }
.gauge-needle-dot  { fill: var(--go-paper); }
.gauge-tick-label  { fill: var(--go-gray); }

/* Colores de señal adaptativos (responden al toggle dark/light) */
.signal-color-buy   { color: var(--go-mint); }
.signal-color-wait  { color: var(--go-amber); }
.signal-color-alert { color: var(--go-orange); }

/* ── News ── */
.news-card { padding: 24px; margin-bottom: 24px; }
.news-list  { max-height: 480px; overflow-y: auto; }
.news-item  {
  display: grid; grid-template-columns: 90px 1fr 20px;
  align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: var(--go-r-sm);
  border-top: 1px solid var(--go-line-2); color: inherit;
  transition: background var(--go-dur);
}
.news-item:first-child { border-top: none; }
.news-item:hover { background: var(--go-paper-3); }
.news-source   { font-family: var(--go-mono); font-size: 16px; color: var(--go-gray); text-transform: uppercase; letter-spacing: 0.08em; }
.news-headline { font-size: 21px; color: var(--go-ink); font-weight: 500; line-height: 1.4; }
.news-arrow    { font-size: 18px; color: var(--go-gray); }

/* ── Reports strip ── */
.reports-strip {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  padding: 14px 20px; border-radius: var(--go-r-md);
  background: var(--go-paper); border: 1px solid var(--go-line);
  margin-top: 4px;
}
.reports-links { display: flex; gap: 8px; flex-wrap: wrap; }
.report-chip {
  padding: 5px 10px; border-radius: var(--go-r-sm);
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  color: var(--go-slate); font-size: 11px; font-family: var(--go-mono);
  transition: all 180ms;
}
.report-chip.active { background: var(--go-pp-tint); border-color: var(--go-pp); color: var(--go-pp); }
.report-chip:hover   { border-color: var(--go-gray); color: var(--go-ink); }

/* ── History table — GO style ── */
.hist-thead {
  display: grid; grid-template-columns: 110px repeat(4,1fr) 120px 80px;
  gap: 16px; padding: 10px 16px;
  font-family: var(--go-display); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--go-gray); border-bottom: 2px solid var(--go-orange);
}
.hist-tbody { max-height: 480px; overflow-y: auto; }
.hist-row {
  display: grid; grid-template-columns: 110px repeat(4,1fr) 120px 80px;
  gap: 16px; padding: 10px 16px;
  align-items: center; font-size: 14px; font-family: var(--go-sans);
  border-top: 1px solid var(--go-line-2);
  transition: background var(--go-dur);
}
.hist-row:hover { background: var(--go-orange-tint); }
.hist-row.first { border-top: none; }
.hist-legend { margin-top: 12px; font-size: 13px; color: var(--go-gray); }

/* ── Enter form ── */
.enter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 600px) { .enter-grid { grid-template-columns: 1fr; } }

.enter-field {}
.enter-label  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.enter-input  {
  width: 100%; background: var(--go-paper-3);
  border: 1px solid var(--go-line); border-radius: var(--go-r-md);
  color: var(--go-ink); font-size: 24px; font-weight: 700; letter-spacing: -0.01em;
  padding: 14px 70px 14px 16px; font-family: inherit; font-variant-numeric: tabular-nums;
  outline: none; transition: border-color var(--go-dur) var(--go-ease), box-shadow var(--go-dur) var(--go-ease);
  -moz-appearance: textfield;
}
.enter-input::-webkit-inner-spin-button,
.enter-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.enter-input:focus {
  border-color: var(--go-orange);
  box-shadow: 0 0 0 3px var(--go-orange-tint);
}
.enter-unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--go-mono); font-size: 13px; color: var(--go-gray);
  letter-spacing: 0.08em; text-transform: uppercase; pointer-events: none;
}
.enter-mxn  { margin-top: 6px; font-size: 13px; color: var(--go-gold); font-family: var(--go-mono); font-weight: 600; }
.enter-footer {
  margin-top: 24px; display: flex; justify-content: space-between; align-items: center;
}
.enter-existing {
  margin-top: 16px; padding: 14px 18px; border-radius: var(--go-r-md);
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  font-size: 12px; color: var(--go-gray); font-family: var(--go-mono);
}

/* ── Admin ── */
.admin-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.config-grid { display: flex; flex-direction: column; gap: 12px; }
.config-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--go-line-2);
  font-size: 13px;
}
.config-row:last-child { border-bottom: none; }
.log-box {
  background: var(--go-paper-3); border-radius: var(--go-r-md);
  border: 1px solid var(--go-line);
  padding: 12px 16px; max-height: 360px; overflow-y: auto;
}
.log-line { font-family: var(--go-mono); font-size: 13px; color: var(--go-gray); padding: 2px 0; white-space: pre-wrap; word-break: break-all; }
.log-err  { color: var(--go-orange) !important; }
.log-warn { color: var(--go-amber) !important; }
.log-ok   { color: var(--go-mint) !important; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: var(--go-r-md);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.alert-ok  { background: var(--go-mint-tint); border: 1px solid rgba(0,163,110,0.3);   color: var(--go-mint); }
.alert-err { background: var(--go-orange-tint);  border: 1px solid rgba(251,103,11,0.3); color: var(--go-orange);  }

/* ── Buttons — estilo GO ── */
.btn-primary {
  padding: 11px 22px; border-radius: var(--go-r-pill);
  background: var(--go-orange); color: #fff; border: none;
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  letter-spacing: 0.02em;
  transition: all var(--go-dur) var(--go-ease);
}
.btn-primary:hover { background: var(--go-orange-hot); transform: translateY(-1px); }
.btn-primary:active { background: var(--go-orange-deep); transform: translateY(0); }

.btn-secondary {
  padding: 11px 22px; border-radius: var(--go-r-pill);
  background: transparent; color: var(--go-ink);
  border: 1px solid var(--go-line);
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.btn-secondary:hover { background: var(--go-paper-3); border-color: var(--go-gray); transform: translateY(-1px); }

.btn-success {
  padding: 11px 22px; border-radius: var(--go-r-pill);
  background: var(--go-mint); color: #fff; border: none;
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.btn-success:hover { transform: translateY(-1px); filter: brightness(1.08); }

.btn-ghost {
  background: transparent; border: 1px solid var(--go-line);
  color: var(--go-slate); font-size: 12px; font-family: inherit;
  padding: 6px 12px; border-radius: var(--go-r-sm); cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.btn-ghost:hover { border-color: var(--go-orange); color: var(--go-orange); }

/* ── Login ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--go-paper-2); padding: 24px;
}
body[data-mode="dark"] .login-page {
  background: radial-gradient(circle at 50% 30%, #262626 0%, #1A1A1A 60%);
}
.login-card {
  width: min(400px, 92vw); padding: 44px; border-radius: 16px;
  background: var(--go-paper);
  border: 1px solid var(--go-line);
  box-shadow: var(--go-sh-3);
  text-align: center;
}
.login-logo {
  width: 100px; height: 100px; border-radius: 18px; margin: 0 auto;
  background: #FB670B;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.login-logo-img { width: 100px; height: 100px; object-fit: contain; border-radius: 18px; display: block; padding: 10px; }
.login-live {
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--go-orange);
  animation: goPulse 1.6s ease-in-out infinite;
}
.login-brand { margin-top: 20px; font-family: var(--go-display); font-size: 24px; font-weight: 900; letter-spacing: 0.04em; text-transform: lowercase; color: var(--go-ink); }
.login-sub   { margin-top: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--go-gray); font-weight: 700; }
.login-form  { margin-top: 28px; display: flex; flex-direction: column; gap: 0; }
.login-input {
  width: 100%; padding: 14px 16px; border-radius: var(--go-r-md);
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  color: var(--go-ink); font-size: 20px; font-family: inherit;
  text-align: center; letter-spacing: 0.3em;
  outline: none; transition: all var(--go-dur) var(--go-ease);
}
.login-input:focus { border-color: var(--go-orange); box-shadow: 0 0 0 3px var(--go-orange-tint); }
.login-input.error { border-color: var(--go-orange); }
.login-input::placeholder { letter-spacing: 0; color: var(--go-gray); }
.login-error { margin: 10px 0; font-size: 15px; color: var(--go-orange); }
.login-form .btn-primary { margin-top: 16px; width: 100%; border-radius: var(--go-r-md); }
.login-footer { margin-top: 20px; font-size: 12.5px; color: var(--go-gray); font-family: var(--go-mono); letter-spacing: 0.1em; }

/* ── Chat IA ── */
.chat-page {
  display: flex; flex-direction: column;
  height: calc(100vh - 64px);
  max-width: 820px; margin: 0 auto;
  padding: 0 16px;
}
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--go-line);
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--go-orange-tint); border: 1px solid rgba(251,103,11,0.25);
  display: flex; align-items: center; justify-content: center;
}
.chat-header-title { font-size: 18px; font-weight: 700; color: var(--go-ink); }
.chat-header-sub   { font-size: 13px; color: var(--go-gray); font-family: var(--go-mono); margin-top: 2px; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px 0;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--go-line); border-radius: 2px; }

.chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1; gap: 20px; padding: 40px 0;
  text-align: center;
}
.chat-welcome-icon { opacity: .6; }
.chat-welcome-title { font-size: 22px; font-weight: 600; color: var(--go-slate); }
.chat-welcome-suggestions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  max-width: 520px;
}
.chat-suggestion {
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  color: var(--go-slate); font-size: 13px; font-family: inherit;
  padding: 8px 14px; border-radius: 20px; cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.chat-suggestion:hover { border-color: var(--go-orange); color: var(--go-orange); background: var(--go-orange-tint); }

.chat-row { display: flex; }
.chat-row-user      { justify-content: flex-end; }
.chat-row-assistant { justify-content: flex-start; }

.chat-bubble { max-width: 72%; padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.6; }
.chat-bubble-user {
  background: var(--go-orange); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-assistant {
  background: var(--go-paper-3); color: var(--go-ink);
  border: 1px solid var(--go-line);
  border-bottom-left-radius: 4px;
}
.chat-bubble-text { white-space: pre-wrap; }
.chat-bubble-text code {
  font-family: var(--go-mono); font-size: 12px;
  background: var(--go-paper-2); padding: 1px 5px; border-radius: 4px;
}
.chat-bubble-time { font-size: 12px; margin-top: 6px; opacity: .5; font-family: var(--go-mono); }

.chat-typing {
  display: flex; align-items: center; gap: 5px;
  padding: 14px 18px; width: 60px;
}
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--go-gray);
  animation: chat-bounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

.chat-error {
  background: var(--go-orange-tint); border: 1px solid rgba(251,103,11,0.3);
  color: var(--go-orange); font-size: 13px; padding: 10px 14px;
  border-radius: var(--go-r-sm);
}

.chat-inputbar {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 0 20px; border-top: 1px solid var(--go-line);
  flex-shrink: 0;
}
.chat-textarea {
  flex: 1; resize: none; overflow: hidden;
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  color: var(--go-ink); font-family: inherit; font-size: 14px;
  padding: 12px 14px; border-radius: 14px; line-height: 1.5;
  outline: none; transition: border-color var(--go-dur) var(--go-ease);
  min-height: 46px;
}
.chat-textarea:focus { border-color: var(--go-orange); box-shadow: 0 0 0 3px var(--go-orange-tint); }
.chat-textarea::placeholder { color: var(--go-gray); }
.chat-textarea:disabled { opacity: .5; cursor: not-allowed; }

.chat-send-btn {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: var(--go-orange); border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--go-dur) var(--go-ease);
}
.chat-send-btn:hover:not(:disabled) { background: var(--go-orange-hot); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── Report chips mejorados ── */
.report-chip {
  padding: 5px 12px; border-radius: var(--go-r-sm);
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  color: var(--go-slate); font-size: 11px; font-family: var(--go-mono);
  cursor: pointer; transition: all 180ms var(--go-ease);
  font-weight: 600;
}
.report-chip.active { background: var(--go-orange-tint); border-color: rgba(251,103,11,0.35); color: var(--go-orange); }
.report-chip:hover   { border-color: var(--go-orange); color: var(--go-orange); background: var(--go-orange-tint); }

/* ── Modal flotante de reportes ── */
.report-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,10,10,0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: goFadeUp 200ms var(--go-ease) both;
}

.report-modal {
  width: 100%; max-width: 900px; height: 85vh;
  background: var(--go-paper);
  border: 1px solid var(--go-line);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(10,10,10,0.3);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.report-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--go-line);
  flex-shrink: 0;
}

.report-modal-date {
  font-family: var(--go-display); font-size: 22px; font-weight: 900;
  color: var(--go-ink); letter-spacing: 0.02em;
}

.report-modal-pdf-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--go-r-pill);
  background: var(--go-orange); color: #fff; border: none;
  font-size: 12.5px; font-weight: 700; font-family: var(--go-sans);
  letter-spacing: 0.02em; cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.report-modal-pdf-btn:hover { background: var(--go-orange-hot); transform: translateY(-1px); }

.report-modal-close {
  width: 32px; height: 32px; border-radius: var(--go-r-sm);
  background: transparent; border: 1px solid var(--go-line);
  color: var(--go-gray); font-size: 16px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--go-dur) var(--go-ease);
}
.report-modal-close:hover { border-color: var(--go-orange); color: var(--go-orange); background: var(--go-orange-tint); }

.report-modal-body {
  flex: 1; overflow: hidden;
}

.report-modal-iframe {
  width: 100%; height: 100%; border: none;
  background: #fff;
}

/* ── Admin form fields ──────────────────────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field .eyebrow { font-size: 16px; letter-spacing: .10em; }

.form-input {
  padding: 9px 12px;
  border: 1px solid var(--go-line);
  border-radius: var(--go-r-sm);
  background: var(--go-paper-2);
  color: var(--go-ink);
  font-family: inherit;
  font-size: 13px;
  transition: border-color var(--go-dur) var(--go-ease);
}
.form-input:focus { outline: none; border-color: var(--go-orange); }
.form-input.mono { font-family: var(--go-mono); }
select.form-input { cursor: pointer; }

/* ── Status pills — GO ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--go-r-pill);
  font-family: var(--go-display); font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  border: 1px solid transparent;
}
.pill-buy   { background: var(--go-mint-tint);    color: var(--go-mint);   border-color: rgba(0,163,110,.25); }
.pill-wait  { background: var(--go-amber-tint);   color: var(--go-amber);  border-color: rgba(217,119,6,.25); }
.pill-alert { background: var(--go-orange-tint);  color: var(--go-orange); border-color: rgba(251,103,11,.25); }

/* ── Pipeline / data table — GO ── */
.data-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.data-table thead tr { border-bottom: 2px solid var(--go-orange); }
.data-table th {
  text-align: left; padding: 8px 12px;
  font-family: var(--go-display); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--go-gray);
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--go-line-2); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--go-orange-tint); }

/* ── News sentiment badges ──────────────────────────────────────────────────── */
.gauge-sentiment { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.sentiment-badge {
  font-size: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 12px; border-radius: var(--go-r-pill); border: 1px solid transparent;
}
.sentiment-bullish { background: var(--go-orange-tint);  color: var(--go-orange);  border-color: rgba(251,103,11,.2); }
.sentiment-bearish { background: var(--go-mint-tint); color: var(--go-mint); border-color: rgba(0,163,110,.2); }
.sentiment-neutral { background: var(--go-gold-tint); color: var(--go-gold); border-color: rgba(181,137,0,.2); }

/* ── go-table — tabla canónica GO design system ── */
.go-table { width: 100%; border-collapse: collapse; font-family: var(--go-sans); font-size: 13px; }
.go-table thead tr { border-bottom: 2px solid var(--go-orange); }
.go-table thead th {
  padding: 10px 12px; text-align: left;
  font-family: var(--go-display); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.10em; color: var(--go-gray);
}
.go-table thead th.num { text-align: right; }
.go-table tbody tr { border-bottom: 1px solid var(--go-line-2); transition: background 150ms; }
.go-table tbody tr:hover { background: var(--go-orange-tint); }
.go-table tbody tr:last-child { border-bottom: none; }
.go-table tbody td { padding: 10px 12px; color: var(--go-ink); vertical-align: middle; }
.go-table td.num { font-family: var(--go-mono); font-variant-numeric: tabular-nums; text-align: right; }
.go-table td.up   { color: var(--go-mint);   font-weight: 700; }
.go-table td.down { color: var(--go-orange);  font-weight: 700; }
.go-table.striped tbody tr:nth-child(even) { background: var(--go-paper-3); }

/* eyebrow de tabla */
.go-table-eyebrow {
  font-size: 16px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--go-orange); margin-bottom: 10px;
}

/* ── Dashboard 2-col layout ── */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}
.dashboard-main { min-width: 0; }
@media (max-width: 768px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .news-sidebar { position: static !important; }
}

/* ── Focus news sidebar ── */
.news-sidebar {
  position: sticky;
  top: 76px;
  height: calc(100vh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--go-line) transparent;
}
.news-sidebar::-webkit-scrollbar { width: 4px; }
.news-sidebar::-webkit-scrollbar-track { background: transparent; }
.news-sidebar::-webkit-scrollbar-thumb { background: var(--go-line); border-radius: 2px; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--go-line);
  position: sticky; top: 0; z-index: 1;
  background: var(--go-surface);
}
body[data-mode="dark"] .sidebar-header { background: var(--go-paper-3); }

.sidebar-topic-name {
  font-family: var(--go-display); font-size: 20px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em; color: var(--go-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.sidebar-live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--go-orange); border: 1px solid var(--go-orange);
  padding: 2px 7px; border-radius: 999px;
}
.sidebar-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--go-orange);
  animation: sidebar-pulse 2s ease-in-out infinite;
}
@keyframes sidebar-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.focus-news-list { padding: 8px 0; }
.focus-news-item {
  display: block; padding: 12px 16px;
  border-bottom: 1px solid var(--go-line-2);
  text-decoration: none; color: inherit;
  transition: background var(--go-dur) var(--go-ease);
}
.focus-news-item:hover { background: var(--go-orange-tint); }
.focus-news-item:last-child { border-bottom: none; }

.focus-news-source {
  font-size: 15px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--go-orange); margin-bottom: 4px;
}
.focus-news-headline {
  font-size: 20px; font-weight: 500; color: var(--go-ink);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.focus-news-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 5px;
}
.focus-news-time { font-size: 17px; color: var(--go-gray); font-family: var(--go-mono); }
.focus-news-arrow { font-size: 18px; color: var(--go-gray); }

.sidebar-empty {
  padding: 32px 16px; text-align: center;
  color: var(--go-gray); font-size: 13px;
}
.sidebar-loading {
  padding: 24px 16px; text-align: center;
  color: var(--go-gray); font-size: 12px; font-family: var(--go-mono);
}
.sidebar-refresh-bar {
  padding: 8px 16px;
  border-top: 1px solid var(--go-line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-refresh-label { font-size: 15px; color: var(--go-gray); font-family: var(--go-mono); }

/* ── Tabs Alpine.js ── */
.tab-bar {
  display: flex; gap: 0; border-bottom: 2px solid var(--go-line);
  margin-bottom: 24px; overflow-x: auto;
}
.tab-btn {
  padding: 10px 18px; font-family: var(--go-display); font-size: 13px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--go-gray); border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color var(--go-dur) var(--go-ease), border-color var(--go-dur) var(--go-ease);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--go-ink); }
.tab-btn.active { color: var(--go-orange); border-bottom-color: var(--go-orange); }

/* ── Health chips ── */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap:12px; margin-bottom:20px; }
.health-chip {
  padding: 14px 16px; border-radius: var(--go-r-md);
  border: 1px solid var(--go-line); background: var(--go-surface);
}
.health-chip-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.10em; color: var(--go-gray); margin-bottom: 6px; }
.health-chip-val { font-family: var(--go-mono); font-size: 14px; font-weight: 600; color: var(--go-ink); }
.health-ok   { border-color: var(--go-mint);   background: var(--go-mint-tint); }
.health-err  { border-color: var(--go-red, #E11C3D); background: rgba(225,28,61,0.08); }
.health-warn { border-color: var(--go-amber); background: var(--go-amber-tint); }

/* ── Inline form modals ── */
.inline-form-box {
  background: var(--go-paper-3); border: 1px solid var(--go-line);
  border-radius: var(--go-r-md); padding: 20px; margin-top: 16px;
}
body[data-mode="dark"] .inline-form-box { background: var(--ng-surface-2); }

/* ── Danger btn ── */
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--go-r-sm); border: 1px solid var(--go-red, #E11C3D);
  background: transparent; color: var(--go-red, #E11C3D);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--go-dur) var(--go-ease);
}
.btn-danger:hover { background: rgba(225,28,61,0.1); }

/* ═══════════════════════════════════════════════════
   RESPONSIVE BASE — Fase 1
   Breakpoints: tablet ≤768px · mobile ≤600px · xs ≤400px
   ═══════════════════════════════════════════════════ */

/* ── Tablet (≤768px) ── */
@media (max-width: 768px) {
  /* nav */
  .nav { padding: 0 16px; height: 56px; }
  .news-sidebar { top: 56px !important; height: calc(100vh - 68px); }

  /* page */
  .page { padding: 24px 20px 48px; }

  /* dashboard sidebar sticky → ya se resuelve en regla existente (grid 1fr) */
  /* ajustar top del sticky tras reducir nav */
  .news-sidebar { top: 56px; }
}

/* ── Mobile (≤600px) ── */
@media (max-width: 600px) {
  /* nav */
  .nav { padding: 0 12px; }
  .nav-meta-block { display: none; }

  /* page */
  .page { padding: 16px 12px 40px; }

  /* login card padding reducido */
  .login-card { padding: 28px 20px; }

  /* charts */
  .chart-wrap { min-height: 200px; }
  .row-chart-gauge { min-height: 0; }

  /* report modal — fullscreen desde abajo */
  .report-modal-overlay { align-items: flex-end; padding: 0; }
  .report-modal {
    height: 92dvh;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }

  /* sidebar noticias — altura limitada en mobile (layout ya es 1 col) */
  .news-sidebar {
    height: auto !important;
    max-height: 60vh;
    position: static !important;
  }

  /* sidebar topic name — usa ancho disponible */
  .sidebar-topic-name { max-width: calc(100vw - 140px); }
}

/* ── XS (≤400px) ── */
@media (max-width: 400px) {
  .page { padding: 12px 10px 32px; }
  .login-card { padding: 24px 16px; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE NAV — Fase 2
   ═══════════════════════════════════════════════════ */

/* Hamburger — oculto en desktop */
.nav-hamburger { display: none; }
/* nav-hide-mobile — sin efecto en desktop */
.nav-hide-mobile { }

/* ═══════════════════════════════════════════════════
   RESPONSIVE TABLAS — Fase 4
   ═══════════════════════════════════════════════════ */

/* hist grid necesita min-width para que table-scroll funcione */
.hist-thead,
.hist-row { min-width: 560px; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE DASHBOARD + EJECUCION — Fase 3
   ═══════════════════════════════════════════════════ */

/* config form 2-col → 1-col en mobile */
.config-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px;
}
@media (max-width: 600px) {
  .config-form-grid { grid-template-columns: 1fr; }
}

/* tabla con scroll horizontal en mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .data-table { min-width: 600px; }

/* page-header: wrap en mobile para que badge no desborde */
@media (max-width: 600px) {
  .page-header { flex-wrap: wrap; gap: 12px; align-items: flex-start; padding-bottom: 16px; margin-bottom: 20px; }
  .page-header h1 { font-size: clamp(28px, 7vw, 48px); }
}

/* admin-actions: columna en mobile */
@media (max-width: 600px) {
  .admin-actions { flex-direction: column; }
  .admin-actions > .card { flex: none !important; }
}

/* news-item: ajuste en mobile (90px source puede apretarse en 375px) */
@media (max-width: 400px) {
  .news-item { grid-template-columns: 70px 1fr 18px; gap: 8px; }
  .news-source { font-size: 13px; }
  .news-headline { font-size: 17px; }
}

/* ── Nav mobile (≤768px) ── */
@media (max-width: 768px) {
  /* nav necesita position:relative para el dropdown absoluto */
  .nav { position: relative; flex-wrap: wrap; }

  /* ocultar links desktop y user/logout en barra */
  .nav-links { display: none; }
  .nav-hide-mobile { display: none !important; }

  /* ocultar labels del theme toggle, dejar solo ícono */
  .theme-label-light, .theme-label-dark { display: none !important; }

  /* hamburger visible */
  .nav-hamburger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 36px; height: 36px; padding: 7px;
    background: none; border: 1px solid var(--go-line); border-radius: var(--go-r-sm);
    cursor: pointer; flex-shrink: 0; margin-left: 8px;
    transition: border-color var(--go-dur) var(--go-ease);
  }
  .nav-hamburger:hover { border-color: var(--go-orange); }
  .nav-hamburger span {
    display: block; height: 2px; background: var(--go-ink);
    border-radius: 1px; transform-origin: center;
    transition: transform var(--go-dur) var(--go-ease), opacity var(--go-dur) var(--go-ease);
  }
  .nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* mobile dropdown */
  .nav-mobile-menu {
    position: absolute; top: 56px; left: 0; right: 0; z-index: 999;
    background: var(--go-paper);
    border-bottom: 2px solid var(--go-orange);
    box-shadow: var(--go-sh-2);
    padding: 6px 0 12px;
  }
  body[data-mode="dark"] .nav-mobile-menu { background: var(--go-paper-2); }

  .nav-mobile-link {
    display: block; padding: 12px 20px;
    font-family: var(--go-display); font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--go-ink); text-decoration: none;
    border-left: 3px solid transparent;
    transition: color var(--go-dur), background var(--go-dur), border-color var(--go-dur);
  }
  .nav-mobile-link:hover { color: var(--go-orange); background: var(--go-orange-tint); border-left-color: var(--go-orange); }
  .nav-mobile-link.active { color: var(--go-orange); border-left-color: var(--go-orange); }

  .nav-mobile-sep { height: 1px; background: var(--go-line); margin: 8px 16px; }

  .nav-mobile-user-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; gap: 12px;
  }
  .nav-mobile-user-link {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--go-slate);
    transition: color var(--go-dur);
  }
  .nav-mobile-user-link:hover { color: var(--go-ink); }
  .nav-mobile-logout {
    font-family: var(--go-display); font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--go-gray); text-decoration: none; padding: 6px 12px;
    border: 1px solid var(--go-line); border-radius: var(--go-r-sm);
    transition: color var(--go-dur), border-color var(--go-dur), background var(--go-dur);
  }
  .nav-mobile-logout:hover { color: var(--go-orange); border-color: var(--go-orange); background: var(--go-orange-tint); }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE FORMS + CHAT + ADMIN — Fase 5
   ═══════════════════════════════════════════════════ */

/* toast admin panel — posición sticky debajo del nav */
.panel-toast { position: sticky; top: 72px; z-index: 100; }

/* form-input + chat-textarea: font-size 16px en mobile (evita zoom iOS) */
@media (max-width: 600px) {
  .form-input { font-size: 16px; width: 100%; box-sizing: border-box; }
  .chat-textarea { font-size: 16px; }
}

/* chat en mobile */
@media (max-width: 768px) {
  /* nav reducido a 56px → ajustar altura */
  .chat-page { height: calc(100vh - 56px); }
  /* burbujas más anchas */
  .chat-bubble { max-width: 88%; }
  /* subtitle se aprieta en 375px */
  .chat-header-sub { display: none; }
  /* welcome menos padding */
  .chat-welcome { padding: 20px 0; }
  /* toast nav 56px */
  .panel-toast { top: 56px; }
}

/* perfil info grid: stack 1 col en mobile */
.perfil-info-grid {
  display: grid; grid-template-columns: auto 1fr;
  gap: 10px 20px; align-items: center;
}
@media (max-width: 480px) {
  .perfil-info-grid { grid-template-columns: 1fr; gap: 4px 0; }
  .perfil-info-grid .eyebrow { margin-top: 10px; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE LOGIN + ESTADOS + SAFE-AREA — Fase 6
   ═══════════════════════════════════════════════════ */

/* disabled buttons */
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-success:disabled {
  opacity: 0.45; cursor: not-allowed;
  transform: none !important; pointer-events: none;
}

/* safe-area: login — notch en landscape */
.login-page {
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

/* safe-area: chat inputbar — home indicator iPhone */
.chat-inputbar {
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

/* safe-area + dvh en mobile */
@media (max-width: 768px) {
  /* dvh excluye barra de dirección móvil */
  .chat-page { height: calc(100dvh - 56px); }
  /* safe-area inferior en páginas generales */
  .page { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 400px) {
  .page { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
}
