/* ════════════════════════════════════════════════════════════
   VEXTRIA REPORT · STYLES v1.0
   Sistema oficial de entregables · A4 print-ready
   Tokens en vextria-design-tokens.css
   ════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400;1,600&display=swap');

:root {
  /* Primarios Vextria */
  --vx-purple: #4A2B7A;
  --vx-purple-dark: #2E1A4A;
  --vx-purple-deep: #1A0F2E;
  --vx-purple-light: #6B4A9B;
  --vx-violet-accent: #8B6BC4;
  --vx-violet-pale: #E8E0F4;

  /* Fondos */
  --paper-cream: #F5F0E8;
  --paper-cream-soft: #FAF6EF;
  --pure-white: #FFFFFF;

  /* Texto */
  --text-primary: #1A1A2E;
  --text-secondary: #3F3F5A;
  --text-muted: #6A6A7E;
  --text-on-dark: #F5F0E8;

  /* Semáforo */
  --slot-red: #C44A4A;
  --slot-red-bg: #FCE8E8;
  --slot-yellow: #D4A82E;
  --slot-yellow-bg: #FDF6E1;
  --slot-green: #2E9B6B;
  --slot-green-bg: #E1F5EC;

  /* Módulos */
  --m01: #6B4A9B;
  --m02: #2E9B6B;
  --m03: #2E7BC4;
  --m04: #C44A4A;
  --m05: #4A7BC4;
  --m06: #C44A8B;
  --m07: #E07B2E;
  --m08: #D4A82E;

  /* Tipografía */
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', Monaco, Consolas, monospace;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Crimson Pro', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-xxl: 4rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(74,43,122,0.06);
  --shadow-md: 0 1px 4px rgba(74,43,122,0.08);
  --shadow-lg: 0 4px 20px rgba(74,43,122,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-body);
  font-size: 11pt;
  color: var(--text-primary);
  background: var(--paper-cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ───── PAGE A4 ───── */
.page {
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 20mm;
  margin: 0 auto;
  background: var(--paper-cream-soft);
  position: relative;
  page-break-after: always;
}
.page:last-child { page-break-after: auto; }

@media screen {
  body { padding: 24px 0; background: #d8d3c8; }
  .page {
    box-shadow: 0 4px 32px rgba(74,43,122,0.15);
    margin-bottom: 24px;
    border-radius: 4px;
  }
}

@page { size: A4; margin: 0; }

@media print {
  body { background: white; padding: 0; }
  .page { margin: 0; box-shadow: none; border-radius: 0; }
  /* Saltos de página limpios: ningún bloque se corta a la mitad */
  table, figure, .kpi-grid, .kpi-card, .highlight, .first-mover-box,
  .impacto, .gauge-row, .layers, .sevbar, .mirror-item, .two-cols, tr, li.finding {
    page-break-inside: avoid;
  }
  h1, h2, h3 { page-break-after: avoid; }
  thead { display: table-header-group; }
}

/* ───── PORTADA ───── */
.cover {
  background: linear-gradient(135deg, var(--vx-purple-deep) 0%, var(--vx-purple) 100%);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  min-height: 297mm;
  padding: 22mm 20mm;
}
.cover-top { display: flex; justify-content: space-between; align-items: center; }
.cover-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16pt;
  letter-spacing: -0.5px;
  color: var(--text-on-dark);
}
.cover-doc-id {
  font-family: var(--font-mono);
  font-size: 8pt;
  letter-spacing: 0.15em;
  color: rgba(245,240,232,0.6);
  text-transform: uppercase;
}
.cover-main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cover-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vx-violet-accent);
  margin-bottom: 24px;
}
.cover-title {
  font-family: var(--font-display);
  font-size: 36pt;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  color: var(--text-on-dark);
}
.cover-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16pt;
  font-weight: 400;
  color: rgba(245,240,232,0.85);
  line-height: 1.4;
  margin-bottom: 40px;
  max-width: 90%;
}
.cover-client-block {
  border-top: 1px solid rgba(245,240,232,0.2);
  padding-top: 20px;
  margin-top: auto;
}
.cover-client-label {
  font-family: var(--font-mono);
  font-size: 8pt;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(245,240,232,0.5);
  margin-bottom: 4px;
}
.cover-client-name {
  font-family: var(--font-display);
  font-size: 18pt;
  font-weight: 700;
  margin-bottom: 16px;
}
.cover-meta { display: flex; gap: 40px; flex-wrap: wrap; }
.cover-meta-item { }
.cover-meta-label {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(245,240,232,0.5);
  margin-bottom: 3px;
}
.cover-meta-value {
  font-family: var(--font-display);
  font-size: 11pt;
  font-weight: 600;
  color: var(--text-on-dark);
}

/* ───── PORTADA UNIFICADA v2 · F1 La Torre Karin · fondo oscuro estilo Plan de Servicio ───── */
.cover-v2 {
  padding: 0;
  background:
    radial-gradient(ellipse at 80% 12%, rgba(168,85,247,0.32) 0%, transparent 55%),
    radial-gradient(ellipse at 12% 88%, rgba(59,130,246,0.22) 0%, transparent 60%),
    linear-gradient(135deg, #0a0612 0%, #15092a 50%, #1f1340 100%);
  color: #fff;
  overflow: hidden;
  min-height: 297mm;
  page-break-after: always;
}
.cover-v2 .cover-v2-inner {
  width: 100%; min-height: 297mm; padding: 18mm;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  text-align: center;
  box-sizing: border-box;
}
.cover-v2 .cover-v2-top, .cover-v2 .cover-v2-bot {
  width: 100%; display: flex; justify-content: space-between;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 7.5pt; letter-spacing: 0.26em; text-transform: uppercase;
  color: rgba(255,255,255,0.5); font-weight: 600;
}
.cover-v2 .cover-v2-bot strong { color: rgba(255,255,255,0.7); font-weight: 600; }
.cover-v2 .cover-v2-mid {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; width: 100%;
  max-width: 160mm;
}
.cover-v2 .cover-v2-pill {
  display: inline-block; padding: 6px 18px;
  border: 1px solid rgba(168,85,247,0.5);
  background: rgba(168,85,247,0.12); color: #c084fc;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 8pt; letter-spacing: 0.3em; text-transform: uppercase;
  border-radius: 99px; font-weight: 600;
  margin-bottom: 14mm;
}
.cover-v2 .cover-v2-logos { display: flex; align-items: center; gap: 24mm; margin-bottom: 14mm; }
.cover-v2 .cover-v2-logos img.logo-client { height: 130px; width: auto; }
.cover-v2 .cover-v2-logos img.logo-vx { height: 80px; width: auto; }
.cover-v2 .cover-v2-logos .x {
  font-family: Georgia, serif; font-style: italic;
  font-size: 32pt; color: rgba(255,255,255,0.3); font-weight: 300;
}
.cover-v2 .cover-v2-eyebrow {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 9pt; letter-spacing: 0.36em; text-transform: uppercase;
  color: rgba(255,255,255,0.5); font-weight: 600; margin-bottom: 8mm;
}
.cover-v2 .cover-v2-title {
  font-size: 46pt; font-weight: 900; line-height: 1.08;
  letter-spacing: -0.025em; margin-bottom: 8mm;
  color: #ffffff;
  background: linear-gradient(135deg, #ffffff 0%, #e9d5ff 35%, #c084fc 70%, #a855f7 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  max-width: 100%;
  word-wrap: break-word;
}
.cover-v2 .cover-v2-subtitle {
  font-family: Georgia, serif; font-style: italic;
  font-size: 16pt; color: rgba(255,255,255,0.85);
  margin-bottom: 12mm; line-height: 1.3;
}
.cover-v2 .cover-v2-subtitle strong { font-style: normal; font-weight: 600; color: #c084fc; }
.cover-v2 .cover-v2-divider {
  width: 60px; height: 2px;
  background: linear-gradient(90deg, transparent, #a855f7, transparent);
  margin-bottom: 10mm;
}
.cover-v2 .cover-v2-meta { display: flex; gap: 16mm; }
.cover-v2 .cover-v2-meta .mi { text-align: center; }
.cover-v2 .cover-v2-meta .mi .lbl {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 7pt; letter-spacing: 0.32em; text-transform: uppercase;
  color: rgba(255,255,255,0.4); font-weight: 600; margin-bottom: 4px;
}
.cover-v2 .cover-v2-meta .mi .val { font-size: 11pt; color: #fff; font-weight: 600; }

/* ───── HEADER / FOOTER páginas interior ───── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--vx-violet-pale);
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 7.5pt;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.page-header-brand { color: var(--vx-purple); font-weight: 700; }
.page-footer {
  position: absolute;
  bottom: 12mm;
  left: 20mm;
  right: 20mm;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 7.5pt;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.page-num strong { color: var(--vx-purple); }

/* ───── TIPOGRAFÍA ───── */
.section-label {
  font-family: var(--font-mono);
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vx-violet-accent);
  margin-bottom: 8px;
}
h1 {
  font-family: var(--font-display);
  font-size: 24pt;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 8px;
}
h1 + .lead {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13pt;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
  max-width: 90%;
}
h2 {
  font-family: var(--font-display);
  font-size: 14pt;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}
h2:first-child { margin-top: 0; }
h3 {
  font-family: var(--font-display);
  font-size: 11pt;
  font-weight: 700;
  color: var(--vx-purple);
  margin-top: 18px;
  margin-bottom: 6px;
}
p { color: var(--text-secondary); margin-bottom: 10px; }
ul, ol { margin-left: 18px; margin-bottom: 12px; color: var(--text-secondary); }
li { margin-bottom: 4px; }
strong { color: var(--text-primary); font-weight: 600; }

.section-divider {
  border: none;
  border-top: 2px solid var(--vx-purple);
  margin-bottom: 20px;
}

/* ───── HIGHLIGHT BOX ───── */
.highlight {
  background: var(--vx-violet-pale);
  border-left: 4px solid var(--vx-purple);
  padding: 14px 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 16px;
}
.highlight strong { color: var(--vx-purple); }
.highlight.alert {
  background: var(--slot-red-bg);
  border-left-color: var(--slot-red);
}
.highlight.alert strong { color: var(--slot-red); }
.highlight.success {
  background: var(--slot-green-bg);
  border-left-color: var(--slot-green);
}
.highlight.success strong { color: var(--slot-green); }
.highlight.warn {
  background: var(--slot-yellow-bg);
  border-left-color: var(--slot-yellow);
}

/* ───── KPI CARDS ───── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.kpi-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-card {
  background: var(--pure-white);
  border: 1px solid var(--vx-violet-pale);
  border-left: 3px solid var(--vx-purple);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 24pt;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1;
}
.kpi-sub {
  font-family: var(--font-body);
  font-size: 9pt;
  color: var(--text-muted);
  margin-top: 4px;
}
.kpi-card.alert { border-left-color: var(--slot-red); }
.kpi-card.alert .kpi-value { color: var(--slot-red); }
.kpi-card.success { border-left-color: var(--slot-green); }
.kpi-card.success .kpi-value { color: var(--slot-green); }
.kpi-card.warn { border-left-color: var(--slot-yellow); }
.kpi-card.warn .kpi-value { color: var(--slot-yellow); }

/* ───── BADGES ───── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 7.5pt;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-red { background: var(--slot-red-bg); color: var(--slot-red); }
.badge-yellow { background: var(--slot-yellow-bg); color: var(--slot-yellow); }
.badge-green { background: var(--slot-green-bg); color: var(--slot-green); }
.badge-purple { background: var(--vx-violet-pale); color: var(--vx-purple); }
.badge-dark { background: var(--text-primary); color: var(--paper-cream); }

/* ───── TABLE ───── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
  font-size: 9.5pt;
  font-family: var(--font-body);
}
th {
  background: var(--vx-purple);
  color: var(--text-on-dark);
  padding: 8px 10px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--vx-violet-pale);
  vertical-align: top;
  color: var(--text-secondary);
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--paper-cream-soft); }
table.compact td, table.compact th { padding: 5px 8px; font-size: 9pt; }

/* ───── FINDING ITEMS ───── */
.findings { list-style: none; margin-left: 0; }
.finding {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  background: var(--pure-white);
  border: 1px solid var(--vx-violet-pale);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.finding-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11pt;
}
.finding-icon.red { background: var(--slot-red-bg); color: var(--slot-red); }
.finding-icon.yellow { background: var(--slot-yellow-bg); color: var(--slot-yellow); }
.finding-icon.green { background: var(--slot-green-bg); color: var(--slot-green); }
.finding-text { font-size: 10pt; color: var(--text-secondary); line-height: 1.5; }
.finding-text strong { color: var(--text-primary); }

/* ───── PULL QUOTE ───── */
.pull-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16pt;
  line-height: 1.4;
  color: var(--vx-purple);
  border-left: 4px solid var(--vx-violet-accent);
  padding: 6px 20px;
  margin: 20px 0;
}

/* ───── TIMELINE ───── */
.timeline {
  position: relative;
  padding-left: 24px;
  margin-top: 20px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--vx-violet-accent);
}
.timeline-item {
  position: relative;
  margin-bottom: 18px;
  padding-left: 16px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--vx-purple);
  border: 2px solid var(--paper-cream-soft);
}
.timeline-label {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--vx-violet-accent);
  font-weight: 600;
  margin-bottom: 2px;
}
.timeline-title {
  font-family: var(--font-display);
  font-size: 11pt;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.timeline-body { font-size: 10pt; color: var(--text-secondary); }

/* ───── TWO COLS ───── */
.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ───── INDEX / TOC ───── */
.toc { font-family: var(--font-display); }
.toc-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--vx-violet-pale);
}
.toc-item:last-child { border-bottom: none; }
.toc-num {
  font-family: var(--font-mono);
  font-size: 9pt;
  color: var(--vx-purple);
  font-weight: 700;
  margin-right: 16px;
}
.toc-title {
  flex: 1;
  font-size: 12pt;
  font-weight: 600;
  color: var(--text-primary);
}
.toc-page {
  font-family: var(--font-mono);
  font-size: 9pt;
  color: var(--text-muted);
}

/* ───── SCORE GAUGE (visualización SPE) ───── */
.score-gauge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
}
.score-value {
  font-size: 56pt;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--vx-purple);
}
.score-max {
  font-size: 20pt;
  font-weight: 400;
  color: var(--text-muted);
}
.score-label {
  font-family: var(--font-mono);
  font-size: 8pt;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ─── First-Mover Urgency Box ─── */
.first-mover-box {
  background: linear-gradient(135deg, var(--vx-purple-deep) 0%, #2D1355 100%);
  color: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 14px 0;
  border-left: 4px solid #f4c424;
  position: relative;
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.first-mover-box::before {
  content: '⚡';
  position: absolute;
  top: 8px;
  right: 16px;
  font-size: 30pt;
  opacity: 0.1;
}
.first-mover-box .fm-label {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #f4c424;
  margin-bottom: 6px;
}
.first-mover-box h3 {
  font-family: var(--font-display);
  font-size: 14pt;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}
.first-mover-box p {
  font-size: 10pt;
  color: rgba(255,255,255,0.88);
  margin: 0 0 8px;
  line-height: 1.55;
}
.first-mover-box code {
  background: rgba(255,255,255,0.18);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9pt;
  font-family: var(--font-mono);
}
.first-mover-box .fm-footer {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  color: rgba(255,255,255,0.55);
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 7px;
  margin-top: 8px;
}
