/* ============================================================
   COGNITIVE PMO · PRESENTACIÓN TFM
   Estilos comunes para todas las pantallas
   ============================================================ */

/* === VARIABLES — DARK (default) === */
:root {
  --bg-base: #1a1d23;
  --bg-elev: #22262e;
  --bg-hover: #2a2f38;
  --bg-deep: #16181d;
  --border: #2d323d;
  --border-active: #3d4452;
  --text-primary: #e6edf3;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #e6edf3;
  --shadow-tile: 0 4px 24px rgba(0,0,0,0.25);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.4);
  --header-bg: rgba(26, 29, 35, 0.85);
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* === VARIABLES — LIGHT === */
[data-theme="light"] {
  --bg-base: #f5f7fa;
  --bg-elev: #ffffff;
  --bg-hover: #f0f3f8;
  --bg-deep: #eef1f5;
  --border: #e1e4e8;
  --border-active: #c8cdd4;
  --text-primary: #1a1d23;
  --text-secondary: #4a5568;
  --text-muted: #6b7280;
  --accent: #1a1d23;
  --shadow-tile: 0 2px 12px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 8px 28px rgba(15, 23, 42, 0.12);
  --header-bg: rgba(245, 247, 250, 0.92);
}

/* === BASE === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}
body { display: flex; flex-direction: column; }

/* === HEADER === */
header.app-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 22px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s ease, border-color 0.3s ease;
  gap: 24px;
}
.brand-logo {
  height: 64px;
  width: auto;
  display: block;
  flex-shrink: 0;
  cursor: pointer;
}
.header-center {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.header-controls { display: flex; align-items: center; gap: 14px; }

/* Selector modo */
.mode-selector {
  display: flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.mode-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s ease;
  font-family: inherit;
  letter-spacing: 0.5px;
}
.mode-btn.active { background: var(--bg-hover); color: var(--text-primary); }

/* Cronómetro */
.chrono {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
  min-width: 120px;
  justify-content: space-between;
}
.chrono:hover { border-color: var(--border-active); color: var(--text-primary); }
.chrono.running { color: var(--text-primary); }
.chrono.over { color: #f59e0b; }
.chrono .time { font-weight: 500; letter-spacing: 0.5px; }
.chrono .icon { font-size: 10px; opacity: 0.7; }

/* Toggle tema */
.theme-toggle {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  font-size: 16px;
}
.theme-toggle:hover { border-color: var(--border-active); color: var(--text-primary); }

/* === HERO (compartido) === */
.hero {
  padding: 60px 32px 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero .eyebrow {
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 38px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  max-width: 1100px;
  margin: 0 auto 18px auto;
  letter-spacing: -0.5px;
}
.hero .subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 920px;
  margin: 0 auto 32px auto;
  line-height: 1.55;
  font-weight: 400;
}
.hero .meta {
  display: inline-flex;
  gap: 48px;
  font-size: 15px;
  color: var(--text-muted);
  padding: 18px 32px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.hero .meta .item { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.hero .meta .label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.hero .meta .value { font-weight: 500; color: var(--text-primary); font-size: 16px; }

/* === GRID DE TILES (HOME) === */
.grid-section {
  padding: 50px 48px 80px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}
.group-title {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin: 32px 0 18px 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.group-title:first-child { margin-top: 0; }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 22px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  box-shadow: var(--shadow-tile);
}
.tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--tile-accent, var(--accent));
  opacity: 0;
  transition: opacity 0.22s ease;
}
.tile:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.tile:hover::before { opacity: 1; }
.tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.tile-icon { width: 48px; height: 48px; flex-shrink: 0; }
.tile-num { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 2px; font-family: var(--font-mono); }
.tile-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.tile-title { font-size: 17px; font-weight: 600; color: var(--text-primary); line-height: 1.35; margin-bottom: 10px; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: auto; }
.tile-meta .time { font-family: var(--font-mono); letter-spacing: 0.5px; }
.tile-meta .arrow { opacity: 0; transition: all 0.22s ease; transform: translateX(-4px); }
.tile:hover .tile-meta .arrow { opacity: 1; transform: translateX(0); }

/* === FOOTER === */
footer.app-footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-base);
  transition: background 0.3s ease, border-color 0.3s ease;
}
footer.app-footer .line { margin: 4px 0; }

/* ============================================================
   PANTALLAS ANIDADAS (Secciones 01-14)
   ============================================================ */

/* Barra superior secundaria — navegación entre secciones */
.section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 48px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 109px;
  z-index: 90;
  gap: 16px;
}
.section-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.18s ease;
}
.section-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}
.section-nav-btn.primary {
  background: var(--text-primary);
  color: var(--bg-base);
  border-color: var(--text-primary);
}
.section-nav-btn.primary:hover { opacity: 0.92; }
.section-nav-progress {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* === SECTION HERO (pantalla interior) === */
.section-hero {
  padding: 60px 48px 40px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}
.section-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--section-color, var(--text-secondary));
  font-weight: 700;
  margin-bottom: 18px;
  padding: 6px 14px;
  border: 1px solid var(--section-color, var(--border));
  border-radius: 20px;
  background: var(--bg-elev);
}
.section-hero .eyebrow .icon-small {
  width: 18px;
  height: 18px;
  display: inline-block;
}
.section-hero h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 22px;
  letter-spacing: -1px;
  max-width: 1200px;
}
.section-hero .lead {
  font-size: 22px;
  color: var(--text-secondary);
  max-width: 1100px;
  line-height: 1.5;
  font-weight: 400;
}

/* === CONTENIDO SECCIÓN === */
.section-content {
  padding: 30px 48px 100px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}
.section-block-title {
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin: 50px 0 22px 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-block-title:first-child { margin-top: 0; }

/* === STAT CARDS (números rotundos) === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 26px;
  position: relative;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-tile);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-accent, var(--accent));
}
.stat-card .stat-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 14px;
}
.stat-card .stat-value {
  font-size: 44px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1.5px;
  margin-bottom: 10px;
  font-family: var(--font);
}
.stat-card .stat-value.smaller { font-size: 36px; }
.stat-card .stat-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === DRILL-DOWN CARDS === */
.drill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.drill-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-tile);
  text-decoration: none;
  color: inherit;
}
.drill-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.drill-card .drill-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.drill-card .drill-icon {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.drill-card .drill-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.drill-card .drill-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.drill-card .drill-cta {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: auto;
  padding-top: 8px;
}
.drill-card:hover .drill-cta { color: var(--text-primary); }

/* === PANEL DE DRILL-DOWN (subpantalla anidada) === */
.drill-panel {
  display: none;
  background: var(--bg-base);
  border-radius: 16px;
  padding: 50px 0 0 0;
}
.drill-panel.active { display: block; }
.hidden-during-drill { display: none !important; }
.drill-panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 48px 28px 48px;
  border-bottom: 1px solid var(--border);
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}
.drill-panel-back {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
}
.drill-panel-back:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}
.drill-panel-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.drill-panel-body {
  padding: 40px 48px 80px 48px;
  max-width: 1100px;
  margin: 0 auto;
}
.drill-panel-body h2 { font-size: 22px; margin: 28px 0 12px 0; color: var(--text-primary); font-weight: 600; }
.drill-panel-body h3 { font-size: 17px; margin: 22px 0 10px 0; color: var(--text-primary); font-weight: 600; }
.drill-panel-body p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.drill-panel-body p strong { color: var(--text-primary); font-weight: 600; }
.drill-panel-body ul, .drill-panel-body ol { margin: 0 0 16px 24px; color: var(--text-secondary); line-height: 1.7; }
.drill-panel-body li { margin-bottom: 6px; }
.drill-panel-body blockquote {
  border-left: 3px solid var(--section-color, var(--border-active));
  padding: 8px 0 8px 22px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
  font-size: 17px;
  line-height: 1.6;
}

/* === FOOTER NAV (entre secciones) === */
.footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 48px 50px 48px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
  gap: 18px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}
.footer-nav-btn {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 22px;
  text-decoration: none;
  color: inherit;
  transition: all 0.22s ease;
  flex: 1;
  max-width: 380px;
  cursor: pointer;
}
.footer-nav-btn.next { align-items: flex-end; text-align: right; }
.footer-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.footer-nav-btn .nav-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.footer-nav-btn .nav-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   STORY GRID — vistas narrativas dentro de una sección
   (compartido por todas las secciones 01–14)
   ============================================================ */
.story-grid { display: flex; flex-direction: column; gap: 24px; margin-top: 8px; }
.story-row { display: grid; gap: 24px; }
.story-row.cols-2 { grid-template-columns: 1fr 1fr; }
.story-row.cols-1 { grid-template-columns: 1fr; }
.story-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 32px;
  box-shadow: var(--shadow-tile);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.story-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--section-color);
}
.story-card .story-title {
  font-size: 13px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.story-card .story-sub {
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 26px;
  line-height: 1.35;
}
.story-card .story-sub strong { color: var(--section-color); }

/* KPI strip */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 4px; }
.kpi-strip .kpi {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-strip .kpi .kpi-label {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}
.kpi-strip .kpi .kpi-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.kpi-strip .kpi .kpi-value.accent { color: var(--section-color); }
.kpi-strip .kpi .kpi-detail { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* Telegraphic list (para drill panels) */
.tg-list { list-style: none; margin-left: 0; padding-left: 0; }
.tg-list li {
  padding: 10px 0 10px 22px;
  border-bottom: 1px dashed var(--border);
  position: relative;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
}
.tg-list li:last-child { border-bottom: none; }
.tg-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  top: 10px;
  color: var(--section-color);
  font-weight: 700;
}
.tg-list li strong { color: var(--text-primary); }

/* Tablas dentro de drill panels */
.drill-panel-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 22px 0;
  font-size: 14px;
}
.drill-panel-body th, .drill-panel-body td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.drill-panel-body th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--bg-elev);
}
.drill-panel-body td.num {
  font-family: var(--font-mono);
  text-align: right;
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   MARCA "BANCO α" — tratamiento visual de la marca del cliente
   ficticio para que se distinga del resto del texto.
   ============================================================ */
.brand-bank {
  display: inline;
  font-weight: 700;
  white-space: nowrap;
  color: #d4af6a;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.brand-bank .alpha-mark {
  display: inline-block;
  color: #d4af6a;
  font-family: 'Georgia', 'Cambria', 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.15em;
  letter-spacing: -0.5px;
  margin-left: 2px;
  position: relative;
  top: -0.02em;
}
[data-theme="light"] .brand-bank,
[data-theme="light"] .brand-bank .alpha-mark {
  color: #9c7322;
  text-shadow: none;
}

/* Misma marca dentro de un SVG <text> (no admite HTML, usar tspan).
   svg-brand pinta "Banco" en oro y svg-alpha pinta "α" en oro itálica. */
.svg-brand {
  fill: #d4af6a;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.svg-alpha {
  fill: #d4af6a;
  font-family: 'Georgia', 'Cambria', 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.1em;
}
[data-theme="light"] .svg-brand,
[data-theme="light"] .svg-alpha { fill: #9c7322; }

/* Procedencia al pie de un drill panel */
.drill-source {
  margin-top: 32px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--section-color);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.drill-source strong { color: var(--text-primary); }

/* Story responsive */
@media (max-width: 980px) {
  .story-row.cols-2 { grid-template-columns: 1fr; }
}

/* === RESPONSIVE === */
@media (max-width: 900px) { .header-center { display: none; } }
@media (max-width: 768px) {
  header.app-header { padding: 14px 16px; flex-wrap: wrap; gap: 12px; }
  .brand-logo { height: 48px; }
  .hero { padding: 40px 16px 30px; }
  .hero h1 { font-size: 28px; }
  .grid-section, .section-hero, .section-content, .footer-nav { padding-left: 16px; padding-right: 16px; }
  .section-hero h1 { font-size: 32px; }
  .section-hero .lead { font-size: 18px; }
  .stat-card .stat-value { font-size: 36px; }
  .section-nav { padding: 12px 16px; }
  .story-card { padding: 22px 20px; }
  .kpi-strip { grid-template-columns: 1fr; }
}
