:root {
  --azul: #1a3a5c;
  --verde: #2e7d32;
  --fondo: #eef2f7;
  --radio: 14px;
  --sombra: 0 4px 20px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--fondo);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
}

header {
  background: var(--azul);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 4px solid var(--verde);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-img {
  height: 70px;
  width: auto;
  flex-shrink: 0;
}

.ht h1 { color: #fff; font-size: 13px; font-weight: 700; line-height: 1.3; }
.ht p { color: #90caf9; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 10px 36px;
}

.card {
  background: #fff;
  border-radius: var(--radio);
  padding: 20px 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--sombra);
}

.card-title { font-size: 20px; font-weight: 800; color: var(--azul); margin-bottom: 6px; }
.card-sub { font-size: 14px; color: #888; margin-bottom: 22px; border-bottom: 1px solid #eee; padding-bottom: 16px; line-height: 1.6; }

.info-banner { border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; display: none; }
.info-banner.empresa { background: #e8f0fe; }
.info-banner.linea { background: #e8f5e9; }
.info-banner .label-b { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; }
.info-banner.empresa .label-b { color: var(--azul); }
.info-banner.linea .label-b { color: var(--verde); }
.info-banner .nombre-b { font-size: 16px; font-weight: 800; color: #0d2440; line-height: 1.3; }
.info-banner .sub-b { font-size: 13px; color: #555; margin-top: 4px; }

.tabs { display: flex; background: var(--fondo); border-radius: 10px; padding: 4px; margin-bottom: 20px; gap: 3px; }
.tab {
  flex: 1;
  padding: 10px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  color: #aaa;
  border-radius: 8px;
  transition: all 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
.tab.on { background: #fff; color: var(--azul); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

.pnl { display: none; }
.pnl.on { display: block; }

label { display: block; font-size: 12px; font-weight: 700; color: #555; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }

input[type=text] {
  width: 100%;
  padding: 15px 13px;
  border: 2px solid #dde3ec;
  border-radius: 12px;
  font-size: 18px;
  letter-spacing: 3px;
  text-transform: uppercase;
  outline: none;
  color: #111;
  margin-bottom: 14px;
  background: #f8fafc;
  font-weight: 600;
  -webkit-appearance: none;
  min-height: 52px;
}
input[type=text]:focus { border-color: var(--azul); background: #fff; box-shadow: 0 0 0 4px rgba(26,58,92,0.10); }

.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--azul);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  touch-action: manipulation;
  box-shadow: 0 4px 14px rgba(26,58,92,0.25);
  min-height: 52px;
}
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--azul);
  border: 2px solid var(--azul);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  margin-top: 14px;
  touch-action: manipulation;
  min-height: 52px;
}

.msg { margin-top: 14px; padding: 15px; border-radius: 12px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.msg-verde { background: #e8f5e9; border-left: 5px solid var(--verde); color: #1b5e20; }
.msg-rojo { background: #ffebee; border-left: 5px solid #c62828; color: #b71c1c; }
.msg-azul { background: #e3f2fd; border-left: 5px solid #1565c0; color: #0d47a1; }

.conteo { font-size: 14px; color: var(--verde); font-weight: 700; text-transform: uppercase; margin-top: 18px; margin-bottom: 8px; }

.resultado-item {
  background: #fff;
  border: 1.5px solid #dde3ec;
  border-left: 5px solid var(--verde);
  padding: 15px;
  border-radius: 12px;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.resultado-item .fecha { font-size: 12px; color: #aaa; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; font-weight: 600; }
.resultado-item .dato { font-size: 15px; color: #333; margin-bottom: 6px; line-height: 1.4; }
.resultado-item .dato strong { color: var(--azul); font-weight: 800; }

.linea-badge { display: inline-block; border-radius: 20px; padding: 4px 10px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.linea-badge-emp { background: #e8f0fe; color: var(--azul); }
.linea-badge-linea { background: #e8f5e9; color: var(--verde); }
.linea-badge-gen { background: #f3e5f5; color: #6a1b9a; }

.btn-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 14px;
  background: var(--verde);
  color: white;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
  font-size: 14px;
  text-align: center;
  text-transform: uppercase;
  min-height: 48px;
}

#panel-consulta { display: none; }

.spinner-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(26,58,92,0.55);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.spinner-overlay.activo { display: flex; }
.spinner-box { background: white; border-radius: 20px; padding: 32px 36px; text-align: center; max-width: 280px; width: 85%; }
.spinner-circle { width: 52px; height: 52px; border: 5px solid #e8f0fe; border-top-color: var(--azul); border-radius: 50%; animation: girar 0.9s linear infinite; margin: 0 auto 16px; }
@keyframes girar { to { transform: rotate(360deg); } }
.spinner-texto { font-size: 16px; font-weight: 700; color: var(--azul); line-height: 1.5; }
.spinner-sub { font-size: 13px; color: #888; margin-top: 6px; }

footer { background: var(--azul); color: #90caf9; text-align: center; padding: 16px; font-size: 12px; }

/* ── 480px ── */
@media (min-width: 480px) {
  header { padding: 14px 18px; gap: 12px; }
  .logo-img { height: 80px; width: auto; }
  .ht h1 { font-size: 14px; }
  .main { padding: 20px 14px 38px; }
  .card { padding: 24px 18px; }
  .card-title { font-size: 22px; }
  .card-sub { font-size: 14px; }
  .tab { font-size: 12px; padding: 11px 5px; }
  input[type=text] { font-size: 20px; padding: 16px 14px; }
  .btn-primary { padding: 16px; font-size: 16px; }
  .btn-secondary { padding: 15px; font-size: 14px; }
}

/* ── 768px ── */
@media (min-width: 768px) {
  header { padding: 20px 40px; gap: 14px; }
  .logo-img { height: 100px; width: auto; }
  .ht h1 { font-size: 20px; }
  .ht p { font-size: 11px; }
  .main { padding: 48px 24px; justify-content: center; }
  .card { padding: 44px 40px; }
  .card-title { font-size: 24px; }
  .card-sub { font-size: 15px; margin-bottom: 28px; padding-bottom: 20px; }
  .info-banner { padding: 14px 18px; margin-bottom: 22px; }
  .info-banner .nombre-b { font-size: 18px; }
  .tabs { margin-bottom: 24px; }
  .tab { font-size: 14px; padding: 12px 8px; }
  input[type=text] { font-size: 22px; letter-spacing: 4px; padding: 18px 16px; margin-bottom: 16px; }
  .btn-primary { padding: 20px; font-size: 18px; }
  .btn-secondary { padding: 16px; font-size: 15px; }
  .resultado-item { padding: 18px; }
  .resultado-item .dato { font-size: 16px; }
  .linea-badge { font-size: 12px; padding: 4px 12px; }
}
