:root {
  --bg-canvas: #dce3ec;
  --page-white: #ffffff;
  --page-stone: #f4f7fb;
  --header-dark: #0b1017;
  --panel-dark: #0f172a;

  --border-light: #dce4ee;
  --border-medium: #cbd5e1;

  --brand-red: #e11d24;
  --copper-amber: #d97706;
  --copper-light: #f59e0b;
  --copper-tint: #fffbeb;
  --blue-tech: #2563eb;
  --blue-tint: #eff6ff;
  --teal-print: #0d9488;
  --teal-tint: #f0fdfa;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--ink-900);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px 60px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==================== BARRA DE CONTROL SUPERIOR (NO SE IMPRIME) ==================== */
.brochure-toolbar {
  width: 210mm;
  max-width: 100%;
  background: var(--header-dark);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 28px rgba(11, 16, 23, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.back-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.07);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.18s ease, color 0.18s ease;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.toolbar-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 2px 8px;
  border-radius: 4px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  background: #161f2c;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 2px;
  font-size: 0.74rem;
  font-weight: 700;
}

.lang-switch a {
  padding: 5px 9px;
  border-radius: 4px;
  color: #94a3b8;
}

.lang-switch a.active {
  background: var(--brand-red);
  color: #ffffff;
}

.btn-print {
  background: var(--brand-red);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(225, 29, 36, 0.3);
  transition: background 0.18s ease, transform 0.18s ease;
}

.btn-print:hover {
  background: #c5161d;
  transform: translateY(-1px);
}

/* ==================== HOJAS A4 CALIBRADAS ==================== */
.a4-page {
  width: 210mm;
  min-height: 297mm;
  background: var(--page-white);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

/* Barra superior multicapa de identidad gráfica + minera */
.page-top-accent {
  height: 3mm;
  background: linear-gradient(90deg, var(--brand-red) 0%, var(--copper-light) 50%, var(--blue-tech) 100%);
  width: 100%;
  flex-shrink: 0;
}

/* ==================== PÁGINA 1: ENCABEZADO Y PERFIL ==================== */
.p1-header {
  background: var(--header-dark);
  color: #ffffff;
  padding: 7.5mm 12mm 7mm;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 7mm;
  align-items: center;
}

.p1-brand-row {
  display: flex;
  align-items: center;
  gap: 5mm;
  margin-bottom: 2.5mm;
}

.p1-logo {
  height: 12.5mm;
  width: auto;
}

.p1-doc-type {
  font-family: var(--font-mono);
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.8mm 2.5mm;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2mm;
}

.p1-header h1 {
  font-size: 15pt;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 2mm;
}

.p1-header p {
  font-size: 8.3pt;
  color: #cbd5e1;
  line-height: 1.44;
}

.p1-meta-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  padding: 3.2mm 4mm;
  font-size: 7.8pt;
  display: flex;
  flex-direction: column;
  gap: 1.6mm;
}

.meta-line {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-family: var(--font-mono);
  font-size: 6.2pt;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

.meta-val {
  font-weight: 700;
  color: #ffffff;
  font-size: 8pt;
}

/* Input editable para personalizar destinatario antes de exportar a PDF */
.editable-recipient {
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.45);
  color: #fde68a;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 7.8pt;
  padding: 0.8mm 1.8mm;
  border-radius: 4px;
  width: 100%;
  margin-top: 0.6mm;
}

.editable-recipient:focus {
  outline: none;
  border-style: solid;
  background: rgba(245, 158, 11, 0.2);
}

/* Cuerpo interno de página */
.page-body {
  padding: 5mm 12mm 4.5mm;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3.8mm;
}

.sec-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--border-light);
  padding-bottom: 1.2mm;
  margin-bottom: 2.5mm;
}

.sec-kicker {
  font-family: var(--font-mono);
  font-size: 6.8pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--copper-amber);
}

.sec-title {
  font-size: 10.6pt;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.015em;
}

/* Doble Nodo en Página 1 */
.nodes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm;
}

.node-box {
  background: var(--page-stone);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--blue-tech);
  border-radius: 6px;
  padding: 3.2mm 4mm;
}

.node-box.calingasta {
  border-top-color: var(--copper-amber);
  background: linear-gradient(180deg, #fffdf6 0%, #f8fafc 100%);
}

.node-box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1mm;
}

.node-box h3 {
  font-size: 9.2pt;
  font-weight: 800;
  color: var(--ink-900);
}

.node-tag {
  font-family: var(--font-mono);
  font-size: 6.2pt;
  font-weight: 700;
  padding: 0.6mm 2mm;
  border-radius: 99px;
  background: var(--copper-tint);
  color: #92400e;
  border: 1px solid #fde68a;
}

.node-tag.blue {
  background: var(--blue-tint);
  color: var(--blue-tech);
  border-color: #bfdbfe;
}

.node-addr {
  font-size: 7.9pt;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 0.8mm;
}

.node-copy {
  font-size: 7.5pt;
  color: var(--ink-700);
  line-height: 1.38;
}

/* 4 Unidades de Provisión en Página 1 */
.units-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3.2mm;
}

.unit-card {
  background: var(--page-white);
  border: 1px solid var(--border-light);
  border-left: 3.5px solid var(--copper-amber);
  border-radius: 6px;
  padding: 3mm 3.6mm;
}

.unit-card.u-fleet { border-left-color: var(--blue-tech); }
.unit-card.u-textile { border-left-color: var(--brand-red); }
.unit-card.u-corp { border-left-color: var(--teal-print); }

.unit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1mm;
}

.unit-head h4 {
  font-size: 8.9pt;
  font-weight: 800;
  color: var(--ink-900);
}

.unit-code {
  font-family: var(--font-mono);
  font-size: 6.2pt;
  font-weight: 700;
  color: var(--ink-500);
  background: var(--page-stone);
  padding: 0.5mm 1.8mm;
  border-radius: 4px;
}

.unit-card p {
  font-size: 7.4pt;
  color: var(--ink-700);
  line-height: 1.36;
  margin-bottom: 1.4mm;
}

.unit-bullets {
  display: flex;
  flex-direction: column;
  gap: 0.8mm;
}

.unit-bullets li {
  font-size: 7.1pt;
  color: var(--ink-700);
  padding-left: 2.8mm;
  position: relative;
  line-height: 1.32;
}

.unit-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  font-weight: 900;
  color: var(--ink-900);
}

/* Franja Plug & Play al pie de Página 1 */
.plugplay-strip {
  background: var(--panel-dark);
  color: #ffffff;
  border-radius: 6px;
  padding: 3.4mm 4.5mm;
  border-left: 4px solid var(--copper-light);
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 4mm;
  align-items: center;
}

.plugplay-strip h4 {
  font-size: 9pt;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 0.8mm;
}

.plugplay-strip p {
  font-size: 7.4pt;
  color: #cbd5e1;
  line-height: 1.38;
}

.plugplay-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.8mm;
}

.kpi-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1.5mm 2mm;
  text-align: center;
}

.kpi-pill strong {
  display: block;
  font-size: 8pt;
  color: #ffffff;
}

.kpi-pill span {
  font-size: 6.2pt;
  color: #94a3b8;
}

/* ==================== PÁGINA 2: CATÁLOGO DE KITS, SUSTRATOS Y FICHA COMERCIAL ==================== */
.p2-mini-header {
  background: var(--header-dark);
  color: #ffffff;
  padding: 3.5mm 12mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.p2-mini-header img {
  height: 8.5mm;
  width: auto;
}

.p2-mini-title {
  font-family: var(--font-mono);
  font-size: 7.2pt;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* 3 Kits con fotos reales en Página 2 */
.kits-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3.5mm;
}

.kit-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  background: var(--page-white);
  display: flex;
  flex-direction: column;
}

.kit-photo {
  height: 28mm;
  background: var(--page-stone);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-light);
}

.kit-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kit-photo-tag {
  position: absolute;
  top: 1.8mm;
  left: 1.8mm;
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 5.8pt;
  font-weight: 700;
  padding: 0.6mm 1.8mm;
  border-radius: 3px;
}

.kit-content {
  padding: 2.6mm 3mm;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.6mm;
}

.kit-content h4 {
  font-size: 8.4pt;
  font-weight: 800;
  color: var(--ink-900);
  margin-bottom: 0.8mm;
}

.kit-content p {
  font-size: 7.1pt;
  color: var(--ink-700);
  line-height: 1.34;
}

.kit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 1mm;
}

.kit-chip {
  font-size: 6.1pt;
  font-weight: 700;
  background: var(--page-stone);
  border: 1px solid var(--border-light);
  color: var(--ink-700);
  padding: 0.5mm 1.5mm;
  border-radius: 3px;
}

/* Tabla de Sustratos e Infraestructura en Página 2 */
.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.4pt;
}

.specs-table th {
  background: var(--panel-dark);
  color: #ffffff;
  text-align: left;
  padding: 1.8mm 2.8mm;
  font-size: 6.9pt;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.specs-table td {
  padding: 1.8mm 2.8mm;
  border-bottom: 1px solid var(--border-light);
  color: var(--ink-700);
  vertical-align: top;
  line-height: 1.34;
}

.specs-table tr:nth-child(even) td {
  background: var(--page-stone);
}

.specs-table strong {
  color: var(--ink-900);
}

/* Flujo de 4 pasos compacto */
.workflow-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3mm;
}

.wf-step {
  background: var(--page-stone);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 2.4mm 2.8mm;
}

.wf-num {
  font-family: var(--font-mono);
  font-size: 6.4pt;
  font-weight: 700;
  color: var(--copper-amber);
  display: block;
  margin-bottom: 0.5mm;
}

.wf-step h5 {
  font-size: 7.9pt;
  font-weight: 800;
  color: var(--ink-900);
  margin-bottom: 0.5mm;
}

.wf-step p {
  font-size: 6.9pt;
  color: var(--ink-700);
  line-height: 1.32;
}

/* Ficha de Alta de Proveedor al cierre de Página 2 */
.vendor-card {
  background: linear-gradient(155deg, #131c2e 0%, #0b1017 100%);
  color: #ffffff;
  border-radius: 6px;
  padding: 3.5mm 4.5mm;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 4.5mm;
  align-items: center;
}

.vendor-card h4 {
  font-size: 9.2pt;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.8mm;
}

.vendor-card p {
  font-size: 7.3pt;
  color: #cbd5e1;
  line-height: 1.36;
  margin-bottom: 2mm;
}

.vendor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6mm 3.5mm;
  font-size: 7.3pt;
}

.vendor-item span {
  font-family: var(--font-mono);
  font-size: 6pt;
  color: #94a3b8;
  text-transform: uppercase;
  display: block;
}

.vendor-item strong {
  color: #fbbf24;
  font-size: 7.7pt;
}

.vendor-cta-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  padding: 2.8mm 3.5mm;
  display: flex;
  flex-direction: column;
  gap: 1.2mm;
}

/* Pie de cada hoja A4 */
.page-footer {
  background: var(--page-stone);
  border-top: 1px solid var(--border-light);
  padding: 2.3mm 12mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7pt;
  color: var(--ink-500);
  flex-shrink: 0;
}

.page-footer strong {
  color: var(--ink-900);
}

/* ==================== IMPRESIÓN / EXPORTACIÓN A PDF ==================== */
@media print {
  body {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .no-print {
    display: none !important;
  }

  .a4-page {
    box-shadow: none !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    overflow: hidden !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .a4-page:last-of-type {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .editable-recipient {
    border-color: transparent !important;
    background: transparent !important;
    padding: 0 !important;
  }
}
