/* ─────────────────────────────────────────────────────────────────────────────
   Identidad Visual Travelkit — tokens de docs/IDENTIDAD-VISUAL.md
   Rojo brand #E30613 como ACENTO (nunca fondo dominante). Inter. Cards rounded-xl
   con lift. Semáforo con border-l-4. tabular-nums en números. Slide-up al entrar.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50: #fef2f2;  --brand-100: #fee2e2; --brand-200: #fecaca; --brand-300: #fca5a5;
  --brand-600: #e30613; --brand-700: #c70511; --brand-800: #a1040e; --brand-700-txt: #b91c1c;
  /* Semánticos */
  --success: #10b981; --warning: #f59e0b; --danger: #dc2626; --info: #3b82f6;
  --emerald-50: #ecfdf5; --emerald-700: #047857;
  --amber-50: #fffbeb;  --amber-700: #b45309;
  --red-50: #fef2f2;    --red-700: #b91c1c;
  --blue-50: #eff6ff;   --blue-700: #1d4ed8;
  /* Neutros */
  --background: #ffffff; --surface: #fafafa; --border: #e5e7eb; --muted: #f3f4f6;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-900: #111827;
  /* Texto */
  --text-primary: #0a0a0a; --text-secondary: #6b7280; --text-tertiary: #9ca3af;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "calt", "rlig";
  color: var(--text-primary);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  font-size: 14px; line-height: 20px;
}
.num { font-variant-numeric: tabular-nums; }
a { color: var(--brand-600); text-decoration: none; }

/* ── Cabecera + wordmark ─────────────────────────────────────────────────── */
.cabecera {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--background); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.marca {
  font-weight: 900; font-size: 17px; letter-spacing: -0.02em; text-transform: uppercase;
  color: var(--brand-600); display: flex; align-items: center; gap: 8px;
}
.marca .sep { color: var(--border); font-weight: 400; }
.marca .modulo { color: var(--text-primary); font-weight: 700; text-transform: none; letter-spacing: -0.025em; font-size: 15px; }
.usuario { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }

.app { max-width: 600px; margin: 0 auto; padding: 24px 20px 40px; }
.cargando { text-align: center; color: var(--text-secondary); padding: 64px 0; }

/* ── Iconos (Lucide inline) ──────────────────────────────────────────────── */
.icono { width: 16px; height: 16px; stroke-width: 2; flex: none; vertical-align: middle; }
.icono-lg { width: 20px; height: 20px; }
.icono-xl { width: 24px; height: 24px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--background); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); padding: 20px; margin-bottom: 16px;
}
h1 { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -0.025em; margin: 0 0 6px; }
h2 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0 0 14px; }
.sub { color: var(--text-secondary); font-size: 13px; margin: 0 0 16px; }

/* ── Formularios ─────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--text-primary); }
label.lbl-mayus { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); }
input, select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 14px; background: var(--background); color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 68px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 4px var(--brand-100);
}
input.num, input[type="number"] { font-variant-numeric: tabular-nums; }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--background); color: var(--text-primary); font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background-color .15s, box-shadow .15s, transform .15s, border-color .15s;
}
.btn:hover { background: var(--gray-50); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primario:hover { background: var(--brand-700); }
.btn-primario:active { background: var(--brand-800); }
.btn-primario:hover:not(:disabled) { transform: scale(1.01); }
.btn-bloque { width: 100%; }
.btn-lg { height: 44px; }
.btn-fantasma { background: transparent; border-color: transparent; color: var(--text-secondary); padding: 6px 10px; height: auto; }
.btn-fantasma:hover { background: var(--gray-50); color: var(--text-primary); }
.fila-btn { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Estado del viaje (estilo KPI) ───────────────────────────────────────── */
.resumen { display: flex; flex-direction: column; }
.resumen .item { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.resumen .item:last-child { border-bottom: none; }
.resumen .item .k { color: var(--text-secondary); }
.resumen .item .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.resumen .total .k, .resumen .total .v { font-weight: 700; font-size: 15px; }
.resumen .destacado .v { color: var(--brand-600); font-weight: 700; }

/* ── Captura (3 puertas) ─────────────────────────────────────────────────── */
.captura { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.captura .btn { flex-direction: column; height: auto; padding: 16px 8px; font-size: 12.5px; gap: 8px; color: var(--text-secondary); }
.captura .btn:hover { color: var(--brand-600); border-color: var(--brand-200); }
.captura .icono { width: 22px; height: 22px; }

/* ── Semáforo de facturas (border-l-4, patrón 10.2 del doc) ──────────────── */
.factura {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--background);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.factura.clic { cursor: pointer; }
.factura.clic:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08); border-color: var(--brand-200); }
.factura .miniatura { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--muted); flex: none; }
.factura .cuerpo { flex: 1; min-width: 0; }
.factura .titulo { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.factura .detalle { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.factura .detalle .mono { font-variant-numeric: tabular-nums; }
.factura .valor { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.borde-verde { border-left: 4px solid var(--success); }
.borde-ambar { border-left: 4px solid var(--warning); }
.borde-rojo  { border-left: 4px solid var(--danger); }

/* ── Badges (pill, variants del doc 9.2) ─────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.01em; }
.badge-verde { background: var(--emerald-50); color: var(--emerald-700); }
.badge-ambar { background: var(--amber-50); color: var(--amber-700); }
.badge-rojo  { background: var(--red-50); color: var(--red-700); }
.badge-brand { background: var(--brand-50); color: var(--brand-700-txt); }

/* ── Alertas dentro del detalle ──────────────────────────────────────────── */
.alerta { font-size: 13px; padding: 5px 0; display: flex; align-items: flex-start; gap: 7px; }
.alerta .icono { width: 15px; height: 15px; margin-top: 1px; }
.alerta.error { color: var(--danger); }
.alerta.revision { color: var(--amber-700); }
.alerta.informativa { color: var(--text-secondary); }

/* ── Detalle / edición ───────────────────────────────────────────────────── */
.detalle { display: grid; grid-template-columns: 150px 1fr; gap: 18px; margin-top: 8px; }
.detalle .foto { width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-grid .ancho { grid-column: 1 / -1; }

/* ── Banner de aviso (patrón insight/coaching) ───────────────────────────── */
.aviso { display: flex; gap: 10px; background: var(--red-50); border: 1px solid var(--brand-200); color: var(--brand-700-txt); padding: 11px 13px; border-radius: 12px; font-size: 13px; margin: 12px 0; align-items: flex-start; }
.aviso .icono { margin-top: 1px; }

/* ── Empty state cálido (patrón 10.6) ────────────────────────────────────── */
.vacio { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 16px; color: var(--text-secondary); }
.vacio .circulo { width: 44px; height: 44px; border-radius: 999px; background: var(--brand-50); color: var(--brand-600); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.vacio .titulo { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.vacio .desc { font-size: 12.5px; margin-top: 2px; max-width: 280px; }

/* ── Éxito final ─────────────────────────────────────────────────────────── */
.ok-final { text-align: center; padding: 22px; }
.ok-final .circulo-ok { width: 64px; height: 64px; border-radius: 999px; background: var(--emerald-50); color: var(--success); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.ok-final .circulo-ok .icono { width: 34px; height: 34px; stroke-width: 2.2; }
.chip { display: inline-block; background: var(--gray-100); border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Transporte ──────────────────────────────────────────────────────────── */
.trayecto { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.trayecto input { flex: 1; }
.trayecto .val { max-width: 110px; }

/* ── Animaciones (funcionales, 150-400ms) ────────────────────────────────── */
@keyframes slide-up-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes check-pop { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.animar { opacity: 0; animation: slide-up-fade 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.stagger-1 { animation-delay: 60ms; } .stagger-2 { animation-delay: 120ms; }
.stagger-3 { animation-delay: 180ms; } .stagger-4 { animation-delay: 240ms; }
.pop { animation: check-pop 280ms cubic-bezier(0.34, 1.56, 0.64, 1); }

*:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.4); border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  .animar, .pop { animation: none; opacity: 1; }
  * { transition: none !important; }
}
@media (max-width: 560px) {
  .detalle { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr; }
  .app { padding: 18px 14px 32px; }
}
