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

:root {
  --azul: #1e3a5f;
  --azul-claro: #2563eb;
  --azul-bg: #eff6ff;
  --rojo: #dc2626;
  --rojo-bg: #fef2f2;
  --verde: #16a34a;
  --verde-bg: #f0fdf4;
  --gris: #6b7280;
  --gris-bg: #f9fafb;
  --gris-borde: #e5e7eb;
  --texto: #111827;
  --texto-suave: #6b7280;
  --radio: 12px;
  --sombra: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --sombra-hover: 0 4px 12px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f1f5f9;
  color: var(--texto);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
  background: var(--azul);
  color: #fff;
  padding: 0 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo-area {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.logo-area:hover h1 { text-decoration: underline; }
.logo-area h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.logo-area p { font-size: .78rem; color: #93c5fd; margin-top: 1px; }

.badge-oficial {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  padding: .3rem .75rem;
  color: #bfdbfe;
  white-space: nowrap;
}

.header-cuenta {
  font-size: .8rem;
  color: #bfdbfe;
  white-space: nowrap;
}
.header-cuenta button {
  background: none;
  border: none;
  color: #bfdbfe;
  text-decoration: underline;
  cursor: pointer;
  font-size: .8rem;
  padding: 0;
  font-family: inherit;
}
.header-cuenta button:hover { color: #fff; }

/* ── Main ── */
.main-content {
  flex: 1;
  max-width: 780px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 2rem;
}

/* ── Form card ── */
.form-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: .35rem;
}
.card-desc {
  font-size: .9rem;
  color: var(--texto-suave);
  margin-bottom: .6rem;
}

.btn-ver-ejemplo {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: .85rem;
}

.badge-ejemplo {
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #854d0e;
  font-size: .82rem;
  padding: .6rem .9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--gris-borde);
  padding-bottom: 0;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: .55rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--texto-suave);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--azul-claro); }
.tab.active {
  color: var(--azul);
  border-bottom-color: var(--azul-claro);
  font-weight: 700;
}

/* Tab panels */
.tab-panel { display: none; flex-direction: column; gap: .5rem; }
.tab-panel.active { display: flex; }

label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--texto);
}
input[type="text"] {
  width: 100%;
  padding: .75rem 1rem;
  font-size: 1rem;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
  color: var(--texto);
  background: #fff;
}
input[type="text"]:focus {
  border-color: var(--azul-claro);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[type="text"]::placeholder { color: #9ca3af; }

.input-hint {
  font-size: .78rem;
  color: var(--texto-suave);
}
.input-hint a { color: var(--azul-claro); }


/* Autocompletado de direcciones */
.autocomplete-wrap { position: relative; }
.sugerencias-list {
  position: absolute;
  z-index: 100;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(560px, 92vw);
  margin: 0;
  padding: .25rem;
  list-style: none;
  background: #fff;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.15);
  max-height: 280px;
  overflow-y: auto;
}
.sugerencias-list li {
  padding: .55rem .75rem;
  font-size: .88rem;
  color: var(--texto);
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.3;
}
.sugerencias-list li:hover,
.sugerencias-list li.activa {
  background: var(--azul-bg, #eff6ff);
}
.sugerencias-list .sugerencia-lugar {
  display: block;
  font-size: .75rem;
  color: var(--texto-suave);
  margin-top: 1px;
}
.sugerencias-list .sugerencia-vacio {
  color: var(--texto-suave);
  cursor: default;
  font-size: .85rem;
  line-height: 1.4;
}

.form-error {
  background: var(--rojo-bg);
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: var(--rojo);
  font-size: .87rem;
  padding: .65rem 1rem;
  margin-top: .25rem;
}

.btn-primary {
  margin-top: 1rem;
  width: 100%;
  padding: .85rem 1.5rem;
  background: var(--azul-claro);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  font-family: inherit;
}
.btn-primary:hover { background: #1d4ed8; box-shadow: var(--sombra-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; transform: none; }

/* ── Spinner ── */
.spinner-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 2rem;
}
.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid #e0e7ff;
  border-top-color: var(--azul-claro);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--azul);
}
.spinner-sub {
  font-size: .8rem;
  color: var(--texto-suave);
}

/* ── Result card ── */
.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.semaforo-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.semaforo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 6px rgba(0,0,0,.06);
  transition: background .3s;
}
.semaforo.rojo  { background: var(--rojo);  box-shadow: 0 0 0 6px rgba(220,38,38,.15),  0 4px 16px rgba(220,38,38,.3); }
.semaforo.verde { background: var(--verde); box-shadow: 0 0 0 6px rgba(22,163,74,.15),   0 4px 16px rgba(22,163,74,.3); }
.semaforo.gris  { background: var(--gris);  box-shadow: 0 0 0 6px rgba(107,114,128,.15), 0 4px 16px rgba(107,114,128,.2); }

.semaforo-label {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.01em;
  display: block;
}
.semaforo-label.rojo  { color: var(--rojo); }
.semaforo-label.verde { color: var(--verde); }
.semaforo-label.gris  { color: var(--gris); }

.result-razon {
  font-size: .82rem;
  font-weight: 600;
  margin-top: 3px;
  line-height: 1.4;
}
.result-razon.rojo  { color: var(--rojo); }
.result-razon.verde { color: var(--verde); }
.result-razon.gris  { color: var(--gris); }

.result-meta {
  font-size: .82rem;
  color: var(--texto-suave);
  text-align: left;
  line-height: 1.8;
}
.result-meta strong { color: var(--texto); }

.result-descripcion {
  background: var(--gris-bg);
  border-left: 4px solid var(--gris-borde);
  border-radius: 0 8px 8px 0;
  padding: .9rem 1.1rem;
  font-size: .9rem;
  margin-bottom: 1.25rem;
  line-height: 1.65;
}
.result-card.rojo .result-descripcion { background: var(--rojo-bg); border-left-color: var(--rojo); }
.result-card.verde .result-descripcion { background: var(--verde-bg); border-left-color: var(--verde); }

/* Avisos */
.aviso {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  font-size: .88rem;
}
.aviso-gris  { background: #fffbeb; border: 1px solid #fde68a; }
.aviso-warn  { background: #fff7ed; border: 1px solid #fed7aa; }
.aviso-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1.3; }
.aviso-gris strong { display: block; margin-bottom: .25rem; color: #92400e; }
.aviso-gris p  { color: #78350f; margin: 0; }
.aviso-warn strong { display: block; margin-bottom: .25rem; color: #9a3412; }
.aviso-warn p  { color: #7c2d12; margin: 0; }

/* Cache badge */
.cache-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 20px;
  background: #e0e7ff;
  color: #3730a3;
  margin-left: .3rem;
  vertical-align: middle;
}

/* Tabla fuentes */
.table-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: .6rem;
}
.table-wrap { overflow-x: auto; }
.fuentes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.fuentes-table th {
  background: var(--azul);
  color: #fff;
  font-weight: 600;
  padding: .6rem .9rem;
  text-align: left;
  white-space: nowrap;
}
.fuentes-table th:first-child { border-radius: 6px 0 0 0; }
.fuentes-table th:last-child  { border-radius: 0 6px 0 0; }
.fuentes-table td {
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--gris-borde);
  vertical-align: middle;
}
.fuentes-table tr:last-child td { border-bottom: none; }
.fuentes-table tr:nth-child(even) td { background: var(--gris-bg); }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 20px;
  letter-spacing: .03em;
}
.badge-ok   { background: #dcfce7; color: #15803d; }
.badge-err  { background: #fef2f2; color: var(--rojo); }
.badge-si   { background: var(--rojo-bg); color: var(--rojo); font-size: .8rem; font-weight: 700; }
.badge-no   { background: var(--verde-bg); color: var(--verde); }
.badge-nd   { background: #f3f4f6; color: var(--gris); }

/* Group rows in table */
.group-row td {
  background: var(--azul) !important;
  color: #bfdbfe;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .35rem .9rem !important;
}
.detalle-cell {
  font-size: .78rem;
  color: var(--texto-suave);
  max-width: 180px;
  word-break: break-word;
}
.err-txt { color: var(--rojo); font-size: .75rem; }

/* Acciones */
.result-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.btn-pdf {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .72rem 1.3rem;
  background: var(--azul);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, box-shadow .15s;
}
.btn-pdf:hover { background: #152c46; box-shadow: var(--sombra-hover); }
.btn-pdf:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
  padding: .72rem 1.3rem;
  background: #fff;
  color: var(--azul);
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--azul-claro); background: var(--azul-bg); }

/* ── Info card ── */
.info-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 1.1rem;
}
.info-grid {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-bottom: 1rem;
}
.info-item {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
}
.info-num {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--azul);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  margin-top: 2px;
}
.info-item strong { font-size: .88rem; color: var(--texto); }
.info-item p { font-size: .82rem; color: var(--texto-suave); margin-top: 2px; }

.pill {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 20px;
}
.pill.rojo  { background: var(--rojo-bg); color: var(--rojo); }
.pill.verde { background: var(--verde-bg); color: var(--verde); }
.pill.gris  { background: #f3f4f6; color: var(--gris); }

.disclaimer {
  font-size: .78rem;
  color: var(--texto-suave);
  border-top: 1px solid var(--gris-borde);
  padding-top: .75rem;
  margin-top: .5rem;
}

/* ── Footer ── */
.site-footer {
  background: var(--azul);
  color: #93c5fd;
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: .78rem;
  line-height: 1.7;
}
.site-footer a { color: #bfdbfe; }
.site-footer a:hover { color: #fff; }
.footer-legal { color: #475569; font-size: .72rem; margin-top: .25rem; }

/* ── Utility ── */
[hidden] { display: none !important; }

@media (max-width: 600px) {
  .card { padding: 1.25rem; }
  .result-header { flex-direction: column; }
  .result-meta { text-align: left; }
  .header-inner { justify-content: flex-start; }
  .badge-oficial { display: none; }
}

/* ── Modal waitlist ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal-icon {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: .75rem;
}
.modal h2 {
  font-size: 1.2rem;
  color: var(--azul);
  text-align: center;
  margin-bottom: .5rem;
}
.modal-desc {
  font-size: .88rem;
  color: var(--texto-suave);
  text-align: center;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.modal label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: .3rem;
}
.modal input[type="email"],
.modal input[type="text"],
.modal textarea {
  width: 100%;
  padding: .7rem .9rem;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--texto);
  margin-bottom: .9rem;
  outline: none;
  transition: border-color .15s;
}
.modal textarea { resize: vertical; min-height: 4.5rem; }
.modal input[type="email"]:focus,
.modal input[type="text"]:focus,
.modal textarea:focus {
  border-color: var(--azul-claro);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.modal-error {
  font-size: .8rem;
  color: var(--rojo);
  margin-bottom: .75rem;
  display: none;
}
.modal-error.visible { display: block; }
.modal-links {
  display: flex;
  justify-content: space-between;
  margin-top: .8rem;
}
.btn-link {
  background: none;
  border: none;
  color: var(--texto-suave);
  text-decoration: underline;
  cursor: pointer;
  font-size: .8rem;
  padding: 0;
  font-family: inherit;
}
.btn-link:hover { color: var(--texto); }
.btn-link:disabled { opacity: .5; cursor: default; text-decoration: none; }

.modal-ancho { max-width: 600px; }
.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-header-row h2 { margin-bottom: 0; }
.modal-cerrar {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--texto-suave);
  cursor: pointer;
  line-height: 1;
  padding: .25rem;
}
.modal-cerrar:hover { color: var(--texto); }

.reportes-vacio { text-align: center; color: var(--texto-suave); font-size: .88rem; padding: 1rem 0; }
.reporte-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  padding: .8rem .2rem;
  border: none;
  border-bottom: 1px solid var(--gris-borde);
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.reporte-item:last-child { border-bottom: none; }
.reporte-item:hover { background: #f8fafc; }
.reporte-item-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.reporte-item-valor { font-size: .88rem; font-weight: 600; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reporte-item-fecha { font-size: .78rem; color: var(--texto-suave); }
.modal-ok {
  text-align: center;
  padding: 1rem 0 .5rem;
}
.modal-ok .ok-icon { font-size: 2.5rem; }
.modal-ok p { font-size: .9rem; color: var(--texto-suave); margin-top: .5rem; line-height: 1.5; }
.btn-waitlist {
  width: 100%;
  padding: .8rem;
  background: var(--azul);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-waitlist:hover { background: #162e4a; }
.btn-waitlist:disabled { opacity: .6; cursor: default; }
