/* CoEquiper — dashboard interno
   Paleta: azul institucional profundo + cyan tecnologico sutil + blanco/gris.
   70% confianza institucional / 30% tecnologia. Sin neon excesivo, sin sci-fi.
   Mobile-first, responsive, cero dependencias. */

:root {
  --brand-blue:      #0b3d91;
  --brand-blue-700:  #082c6a;
  --brand-blue-300:  #4f74c4;
  --brand-blue-100:  #e6ecf8;
  --brand-blue-50:   #f1f5fc;
  --brand-cyan:      #06b6d4;
  --brand-cyan-300:  #67e8f9;
  --brand-cyan-100:  #cffafe;

  --bg:              #f5f7fb;
  --surface:         #ffffff;
  --border:          #e2e8f0;
  --border-soft:     #eef2f7;
  --border-strong:   #cbd5e1;

  --text:            #0f172a;
  --text-muted:      #475569;
  --text-soft:       #64748b;

  --semaforo-verde:    #10b981;
  --semaforo-verde-bg: #ecfdf5;
  --semaforo-amarillo:    #d97706;
  --semaforo-amarillo-bg: #fffbeb;
  --semaforo-rojo:    #dc2626;
  --semaforo-rojo-bg: #fef2f2;
  --semaforo-critico:    #7f1d1d;
  --semaforo-critico-bg: #fef2f2;

  --shadow-xs: 0 1px 1px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04),
               0 1px 1px rgba(15, 23, 42, .03);
  --shadow-md: 0 12px 28px -14px rgba(15, 23, 42, .22),
               0 2px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 48px -22px rgba(8, 44, 106, .35),
               0 4px 12px rgba(15, 23, 42, .06);

  --radius:    16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
}

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

body {
  background:
    radial-gradient(1200px 600px at 80% -20%, #e0f1ff 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background:
    linear-gradient(135deg, #0a3686 0%, #082c6a 55%, #061f4d 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(6, 182, 212, .15);
  box-shadow: 0 4px 20px -8px rgba(6, 18, 49, .55);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  background: rgba(6, 182, 212, .08);
  border: 1px solid rgba(103, 232, 249, .25);
  border-radius: 12px;
  color: var(--brand-cyan);
  box-shadow: inset 0 0 12px rgba(6, 182, 212, .15);
}
.brand-mark svg { display: block; }

.brand-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .2px;
}
.brand-tag {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-cyan-300);
  margin-top: 4px;
  font-weight: 500;
  opacity: .9;
}

.primary-nav {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.primary-nav a {
  color: #e6ecf8;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.primary-nav a:hover {
  background: rgba(255, 255, 255, .1);
  text-decoration: none;
  color: #fff;
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #e6ecf8;
  padding: 6px 12px 6px 10px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
}
.api-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 0 rgba(148, 163, 184, .4);
  transition: background .2s, box-shadow .2s;
}
.api-status[data-state="ok"] .dot {
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .2);
}
.api-status[data-state="off"] .dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .2);
}
.api-status[data-state="demo"] {
  background: rgba(6, 182, 212, .12);
  border-color: rgba(103, 232, 249, .35);
  color: var(--brand-cyan-100);
}
.api-status[data-state="demo"] .dot {
  background: var(--brand-cyan-300);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, .25);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 40px 0 8px;
}
.hero-text {
  max-width: 760px;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.12;
  letter-spacing: -.015em;
  color: var(--brand-blue-700);
  font-weight: 700;
}
.hero-sub {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 17px;
  max-width: 64ch;
}
.hero-sub strong { color: var(--text); font-weight: 600; }

.hero-badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-badges li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 13px 7px 11px;
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
}
.hb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hb-dot-ok    { background: var(--semaforo-verde);
                box-shadow: 0 0 0 3px rgba(16, 185, 129, .14); }
.hb-dot-tech  { background: var(--brand-cyan);
                box-shadow: 0 0 0 3px rgba(6, 182, 212, .14); }
.hb-dot-soft  { background: var(--brand-blue-300);
                box-shadow: 0 0 0 3px rgba(79, 116, 196, .14); }

/* ============================================================
   CARDS GRID
   ============================================================ */
.cards {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease,
              border-color .18s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-cyan));
  opacity: 0;
  transition: opacity .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-blue-300);
}
.card:hover::before { opacity: 1; }

.card a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 20px 18px;
  color: inherit;
  height: 100%;
}
.card a:hover { text-decoration: none; }

.card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--brand-blue-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
  flex-shrink: 0;
}
.card p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}
.card-cta {
  margin-top: auto;
  padding-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-blue);
  letter-spacing: .01em;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 32px 0;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 80px;
}
.panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-blue-700);
  letter-spacing: -.005em;
}
.panel-head p {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 70ch;
}

/* ============================================================
   TOOLS PANEL (Herramientas para el contador)
   ============================================================ */
.tools-panel { padding: 28px 32px; }

.tools-subhead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tools-subhead::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}
.tools-subhead-soon { margin-top: 26px; color: var(--text-soft); }

.tools-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease,
              border-color .15s ease;
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-cyan));
  opacity: 0;
  transition: opacity .15s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-blue-300);
  box-shadow: var(--shadow-md);
}
.tool-card:hover::before { opacity: 1; }

.tool-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--brand-blue);
  background: linear-gradient(135deg, var(--brand-blue-50), #fff);
  border: 1px solid var(--brand-blue-100);
  margin-bottom: 2px;
}
.tool-icon svg { display: block; }

.tool-card h4 {
  margin: 4px 0 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--brand-blue-700);
  letter-spacing: -.002em;
}
.tool-card p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.tool-cta {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 12px;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-blue);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color .12s ease, transform .08s ease;
}
.tool-cta:hover { color: var(--brand-blue-700); transform: translateX(2px); }
.tool-cta:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Soon variant */
.tool-card-soon {
  background: linear-gradient(180deg, #fafbfd 0%, #f5f7fb 100%);
  border-style: dashed;
  border-color: var(--border-strong);
}
.tool-card-soon::before { background: var(--border-strong); }
.tool-card-soon:hover {
  transform: none;
  border-color: var(--brand-blue-300);
  border-style: dashed;
}
.tool-card-soon .tool-icon {
  color: var(--text-soft);
  background: #fff;
  border-color: var(--border);
}
.tool-card-soon h4 { color: var(--text-muted); }
.tool-card-soon p { color: var(--text-soft); }

.soon-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Informe note inside evaluar */
.informe-note {
  margin: 0 0 18px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--brand-blue-700);
  background: linear-gradient(135deg, #ecfeff 0%, var(--brand-blue-50) 100%);
  border: 1px solid var(--brand-cyan-100);
  border-left: 3px solid var(--brand-cyan);
  border-radius: var(--radius-md);
  line-height: 1.5;
}
.informe-note strong { display: block; color: var(--brand-blue); margin-bottom: 2px; }
.informe-note[hidden] { display: none; }

/* ============================================================
   FORMATOS ACEPTADOS (chips en el panel de conciliacion)
   ============================================================ */
.formatos-hint {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.formatos-hint strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}
.fmt-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  border: 1px solid var(--brand-blue-100);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.field-hint code {
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  padding: 0 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============================================================
   INFORME IMPRIMIBLE
   ============================================================ */
.informe-panel { background: #fff; }

.informe-doc {
  padding: 12px 4px;
  color: var(--text);
}
.informe-empty {
  padding: 22px;
  background: var(--brand-blue-50);
  border: 1px dashed var(--brand-blue-300);
  border-radius: var(--radius-md);
  color: var(--brand-blue-700);
  font-size: 14px;
  line-height: 1.55;
}

.informe-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--brand-blue);
}
.informe-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--brand-blue-700);
}
.informe-brand strong {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2px;
}
.informe-brand small {
  display: block;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 500;
}
.informe-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.informe-meta strong { color: var(--text); font-weight: 600; }

.informe-veredicto {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  background: var(--brand-blue-50);
  border: 1px solid var(--brand-blue-100);
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}
.informe-veredicto[data-nivel="VERDE"]    { border-left-color: var(--semaforo-verde);
                                            background: #ecfdf5; }
.informe-veredicto[data-nivel="AMARILLO"] { border-left-color: var(--semaforo-amarillo);
                                            background: #fffbeb; }
.informe-veredicto[data-nivel="ROJO"]     { border-left-color: var(--semaforo-rojo);
                                            background: #fef2f2; }
.informe-veredicto[data-nivel="CRITICO"]  { border-left-color: var(--semaforo-critico);
                                            background: #fef2f2; }

.informe-veredicto .nivel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.informe-veredicto .nivel-valor {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-blue-700);
  letter-spacing: -.005em;
  line-height: 1.1;
}
.informe-veredicto[data-nivel="VERDE"]    .nivel-valor { color: #047857; }
.informe-veredicto[data-nivel="AMARILLO"] .nivel-valor { color: #b45309; }
.informe-veredicto[data-nivel="ROJO"]     .nivel-valor { color: var(--semaforo-rojo); }
.informe-veredicto[data-nivel="CRITICO"]  .nivel-valor { color: var(--semaforo-critico); }
.informe-veredicto .score-box {
  margin-left: auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.informe-veredicto .score-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand-blue-700);
}
.informe-veredicto .score-of {
  font-size: 14px;
  color: var(--text-muted);
}

.informe-resumen {
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 22px;
  padding: 14px 16px;
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.informe-section { margin: 18px 0; }
.informe-section h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 10px;
}
.informe-acciones {
  list-style: decimal;
  padding-left: 20px;
  margin: 0;
}
.informe-acciones li {
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 8px;
  color: var(--text);
}
.informe-acciones li em {
  color: var(--text-soft);
  font-style: normal;
  font-size: 12px;
  margin-left: 6px;
}

.informe-traza {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 18px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 14px 16px;
  background: #f9fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.informe-traza > div {
  /* Que ninguna celda fuerce a la grilla a crecer mas alla del contenedor. */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.informe-traza strong { color: var(--text); font-weight: 600; }

/* Fuente: ocupa toda la fila para que la URL respire en el cuadro. */
.traza-fuente { grid-column: 1 / -1; }
.traza-url {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--brand-blue);
}

/* Idem en el header del informe: textos largos no se salen del cuadro. */
.informe-meta > div { overflow-wrap: anywhere; word-break: break-word; }

.informe-disclaimer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.55;
}
.informe-disclaimer strong { color: var(--text); }

.informe-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ============================================================
   PRESETS (quick-load buttons)
   ============================================================ */
.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, var(--brand-blue-50), #fff);
  border: 1px dashed var(--brand-blue-300);
  border-radius: var(--radius-md);
}
.presets-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}
.preset-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .12s ease, background .12s ease,
              color .12s ease, transform .05s ease;
}
.preset-btn::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .65;
}
.preset-btn:hover { transform: translateY(-1px); }
.preset-btn:active { transform: translateY(0); }
.preset-sano    { color: #047857; border-color: #6ee7b7; }
.preset-sano:hover    { background: var(--semaforo-verde-bg); }
.preset-riesgo  { color: var(--semaforo-rojo); border-color: #fca5a5; }
.preset-riesgo:hover  { background: var(--semaforo-rojo-bg); }
.preset-critico { color: var(--semaforo-critico); border-color: #f87171;
                  background: linear-gradient(180deg, #fff, #fef2f2); }
.preset-critico:hover { background: #fef2f2; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 20px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.field-block { grid-column: 1 / -1; }
.field span {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  letter-spacing: .005em;
}
.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease,
              background .15s ease;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--brand-blue-300);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 61, 145, .14);
}
.field textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 150px;
  background: #fbfcfe;
}
.field-hint {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
  margin-top: 2px;
}

.conc-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 18px;
  margin-top: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
}

.btn-primary, .btn-secondary {
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease,
              box-shadow .2s ease, border-color .15s ease;
  letter-spacing: .005em;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #0d44a3 0%, var(--brand-blue) 60%,
                              #0a3686 100%);
  border: 1px solid var(--brand-blue);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 6px 16px -6px rgba(11, 61, 145, .55);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-blue) 0%,
                              var(--brand-blue-700) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 10px 24px -8px rgba(11, 61, 145, .6);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
  opacity: .65;
  cursor: progress;
  transform: none;
}
.btn-secondary {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
  background: var(--brand-blue-50);
  border-color: var(--brand-blue-300);
}

/* ============================================================
   RESULT (shared)
   ============================================================ */
.result {
  margin-top: 24px;
  padding: 0;
  background: transparent;
  font-size: 14px;
}
.result.loading {
  padding: 22px;
  color: var(--text-soft);
  font-style: italic;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.result.error {
  padding: 20px 22px;
  background: var(--semaforo-rojo-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: #7f1d1d;
}
.result.error h3 {
  margin: 0 0 8px;
  color: #7f1d1d;
  font-size: 15px;
}
.result h3 {
  margin: 0 0 12px;
  color: var(--brand-blue-700);
  font-size: 16px;
}

/* ============================================================
   VERDICT (semáforo result hero block)
   ============================================================ */
.verdict {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 18px;
}
.verdict::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.verdict[data-nivel="VERDE"]::before    { background: var(--semaforo-verde); }
.verdict[data-nivel="AMARILLO"]::before { background: var(--semaforo-amarillo); }
.verdict[data-nivel="ROJO"]::before     { background: var(--semaforo-rojo); }
.verdict[data-nivel="CRITICO"]::before  {
  background: linear-gradient(90deg, var(--semaforo-critico), #b91c1c);
}

.verdict-head {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.verdict-level {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.verdict-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.verdict-nivel {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -.005em;
  line-height: 1;
}
.verdict[data-nivel="VERDE"] .verdict-nivel    { color: #047857; }
.verdict[data-nivel="AMARILLO"] .verdict-nivel { color: #b45309; }
.verdict[data-nivel="ROJO"] .verdict-nivel     { color: var(--semaforo-rojo); }
.verdict[data-nivel="CRITICO"] .verdict-nivel  { color: var(--semaforo-critico); }

.verdict-score {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  background: var(--brand-blue-50);
  border: 1px solid var(--brand-blue-100);
  padding: 10px 18px;
  border-radius: var(--radius-md);
}
.verdict-score-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand-blue-700);
  line-height: 1;
}
.verdict-score-of {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.verdict[data-nivel="ROJO"] .verdict-score,
.verdict[data-nivel="CRITICO"] .verdict-score {
  background: var(--semaforo-rojo-bg);
  border-color: #fecaca;
}
.verdict[data-nivel="ROJO"] .verdict-score-num,
.verdict[data-nivel="CRITICO"] .verdict-score-num {
  color: var(--semaforo-critico);
}

.verdict-resumen {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
}

/* Semaforo strip */
.semaforo {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
}
.semaforo .step {
  flex: 1;
  text-align: center;
  padding: 9px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .15s ease;
}
.semaforo .step.active {
  color: #fff;
  border-color: transparent;
}
.semaforo .step.active[data-nivel="VERDE"]    { background: var(--semaforo-verde); }
.semaforo .step.active[data-nivel="AMARILLO"] { background: var(--semaforo-amarillo); }
.semaforo .step.active[data-nivel="ROJO"]     { background: var(--semaforo-rojo); }
.semaforo .step.active[data-nivel="CRITICO"]  {
  background: var(--semaforo-critico);
  box-shadow: 0 0 0 2px rgba(127, 29, 29, .15);
}

/* Subsection heading inside result */
.subhead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 22px 0 10px;
}

/* Dimensiones list */
.dim-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.dim {
  display: flex;
  gap: 14px;
  align-items: stretch;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color .15s ease;
}
.dim:hover { border-color: var(--border-strong); }
.dim strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text);
  margin-bottom: 2px;
}
.dim p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.dim-pill {
  width: 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.dim-pill[data-nivel="VERDE"]    { background: var(--semaforo-verde); }
.dim-pill[data-nivel="AMARILLO"] { background: var(--semaforo-amarillo); }
.dim-pill[data-nivel="ROJO"]     { background: var(--semaforo-rojo); }
.dim-pill[data-nivel="CRITICO"]  { background: var(--semaforo-critico); }

/* Acciones (numbered, prominent) */
.acciones {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  counter-reset: acc;
}
.acciones li {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 14px 16px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-cyan);
  border-radius: var(--radius-md);
}
.acciones li::before {
  counter-increment: acc;
  content: counter(acc);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.acciones li[data-nivel="AMARILLO"] { border-left-color: var(--semaforo-amarillo); }
.acciones li[data-nivel="ROJO"] {
  border-left-color: var(--semaforo-rojo);
  background: var(--semaforo-rojo-bg);
}
.acciones li[data-nivel="ROJO"]::before {
  background: #fee2e2;
  color: var(--semaforo-rojo);
}
.acciones li[data-nivel="CRITICO"] {
  border-left-color: var(--semaforo-critico);
  background: var(--semaforo-critico-bg);
  box-shadow: inset 0 0 0 1px rgba(127, 29, 29, .08);
}
.acciones li[data-nivel="CRITICO"]::before {
  background: #fecaca;
  color: var(--semaforo-critico);
}
.acc-dim {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 2px;
}
.acc-what {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.acc-when {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
  font-style: italic;
}

.acciones-empty {
  margin: 0;
  padding: 14px 16px;
  background: var(--semaforo-verde-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  color: #065f46;
  font-size: 14px;
}

/* Trazabilidad */
.trazabilidad {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-soft);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 18px;
}
.trazabilidad strong { color: var(--text); font-weight: 600; }
.trazabilidad .adv-block {
  grid-column: 1 / -1;
  padding-top: 6px;
}
.trazabilidad .adv-block ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

/* ============================================================
   DATASET PANEL
   ============================================================ */
.dataset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kv {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.kv > span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 6px;
}
.kv strong {
  font-size: 14.5px;
  color: var(--text);
  word-break: break-word;
  font-weight: 600;
}
.kv a { word-break: break-all; }

/* Verified seal */
.seal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.seal svg { display: block; }
.seal-ok {
  background: linear-gradient(135deg, #d1fae5, #ecfdf5);
  color: #065f46;
  border: 1px solid #6ee7b7;
  box-shadow: inset 0 0 0 1px rgba(110, 231, 183, .35),
              0 1px 2px rgba(6, 95, 70, .08);
}
.seal-warn {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  color: #78350f;
  border: 1px solid #fcd34d;
}

/* Categorias chips */
.kv-categorias { grid-column: 1 / -1; }
.categorias-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  background: var(--brand-blue-50);
  color: var(--brand-blue-700);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #c7d5f0;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* ============================================================
   CONCILIACION RESULT
   ============================================================ */
.conc-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.conc-numbers .kv strong {
  font-size: 20px;
  color: var(--brand-blue-700);
  font-variant-numeric: tabular-nums;
}
.adv-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.adv-list li {
  padding: 9px 12px;
  background: var(--semaforo-amarillo-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  color: #713f12;
  font-size: 13px;
  margin-bottom: 6px;
}

/* ============================================================
   DEMO banner (legacy — fallback amarillo si la API local cae)
   ============================================================ */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--semaforo-amarillo-bg), #fde68a);
  border: 1px solid #f59e0b;
  color: #78350f;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* ============================================================
   DEMO chip (modo demo público — informativo, no alarmista)
   ============================================================ */
.demo-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #ecfeff 0%, #f1f5fc 100%);
  border: 1px solid var(--brand-cyan-100);
  border-left: 3px solid var(--brand-cyan);
  color: var(--brand-blue-700);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.demo-chip > span {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand-cyan);
  background: rgba(6, 182, 212, .1);
  padding: 3px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.demo-chip small {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: 60px;
  padding: 28px 0 40px;
  background: linear-gradient(180deg, var(--bg) 0%, #e9eef6 100%);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer p { margin: 4px 0; }
.site-footer .muted { color: var(--text-soft); font-size: 12px; max-width: 70ch; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
    row-gap: 10px;
  }
  .primary-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    margin-left: 0;
    padding-bottom: 2px;
  }
  .api-status { margin-left: auto; }
  .hero { padding: 28px 0 4px; }
  .panel { padding: 22px; }
  .verdict { padding: 20px; }
  .verdict-score { margin-left: 0; }
}

@media (max-width: 480px) {
  .brand-tag { display: none; }
  .container { padding: 0 16px; }
  .form-grid { gap: 14px; }
  .verdict-head { gap: 14px; }
  .verdict-score { width: 100%; justify-content: center; }
  .presets { padding: 10px; }
  .presets-label { width: 100%; margin: 0 0 4px; }
  .preset-btn { flex: 1; justify-content: center; }
  .demo-chip { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   PRINT — solo el informe queda visible, layout A4 compacto
   ============================================================ */
@page {
  size: A4;
  margin: 14mm;
}

@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.45;
  }

  /* Ocultar todo el dashboard. */
  .site-header,
  .hero,
  #herramientas,
  #evaluar,
  #dataset,
  #conciliar,
  .site-footer,
  .no-print,
  .informe-actions {
    display: none !important;
  }

  /* Mostrar y descomprimir el informe. */
  .container { padding: 0 !important; max-width: none !important; }
  #informe,
  #informe[hidden] {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    overflow: visible !important;
  }
  .informe-doc {
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Cabecera */
  .informe-head {
    padding-bottom: 10px !important;
    margin-bottom: 14px !important;
    border-bottom: 1.5px solid #000 !important;
  }
  .informe-brand strong { color: #000 !important; font-size: 18pt !important; }
  .informe-brand small  { color: #555 !important; font-size: 8pt !important; }
  .informe-meta { font-size: 9pt !important; color: #444 !important; }
  .informe-meta strong { color: #000 !important; }

  /* Veredicto: caja blanca, borde negro fino, sin sombras. */
  .informe-veredicto {
    background: #fff !important;
    border: 1px solid #000 !important;
    box-shadow: none !important;
    padding: 12px 14px !important;
    margin-bottom: 14px !important;
  }
  .informe-veredicto .nivel-valor {
    color: #000 !important;
    font-size: 22pt !important;
  }
  .informe-veredicto .score-num {
    color: #000 !important;
    font-size: 22pt !important;
  }
  .informe-veredicto .score-of  { color: #555 !important; }
  .informe-veredicto .nivel-label { color: #555 !important; }

  /* Resumen */
  .informe-resumen {
    background: #fff !important;
    border: 1px solid #999 !important;
    padding: 10px 12px !important;
    font-size: 11pt !important;
    margin-bottom: 14px !important;
  }

  /* Secciones (acciones / trazabilidad) */
  .informe-section { margin: 10px 0 !important; page-break-inside: avoid; }
  .informe-section h3 {
    color: #444 !important;
    font-size: 9pt !important;
    margin: 0 0 6px !important;
  }
  .informe-acciones li { font-size: 10.5pt !important; margin-bottom: 5px !important; }
  .informe-acciones li em { color: #555 !important; font-size: 9pt !important; }

  /* Trazabilidad: una columna en impresion para que la URL respire. */
  .informe-traza {
    background: #fff !important;
    border: 1px solid #999 !important;
    grid-template-columns: 1fr !important;
    gap: 4px 0 !important;
    padding: 10px 12px !important;
    font-size: 10pt !important;
  }
  .informe-traza > div { grid-column: 1 / -1 !important; }
  .traza-url {
    color: #000 !important;
    font-size: 9.5pt !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  /* Disclaimer */
  .informe-disclaimer {
    margin-top: 12px !important;
    padding-top: 8px !important;
    font-size: 9pt !important;
    color: #555 !important;
    border-top: 1px dashed #999 !important;
  }
  .informe-disclaimer strong { color: #000 !important; }

  /* Links: negro subrayado, sin azul ni hovers. */
  a { color: #000 !important; text-decoration: underline; }
}
