/* Sistema de diseño de Proyecto X (design/brand-guide.md): azul oscuro
   #00275e, azul vivo #0066ff, League Spartan para titulares y Roboto para el
   resto. No se inventan colores fuera de esta paleta. */

:root {
  --cf-blue-deep: #00275e;
  --cf-blue: #0066ff;
  --cf-blue-hover: #0057db;
  --cf-blue-05: #f2f7ff;
  --cf-blue-10: #e6efff;
  --cf-blue-20: #cce0ff;
  --cf-ink: #111827;
  --cf-ink-2: #374151;
  --cf-ink-3: #6b7280;
  --cf-line: #e5e7eb;
  --cf-line-2: #eef0f3;
  --cf-bg: #ffffff;
  --cf-bg-soft: #f7f8fa;
  --cf-bg-mute: #f1f3f6;
  --verde-ink: #1b8f3a;
  --verde-bg: #ebfaee;
  --ambar: #f59e0b;
  --ambar-bg: #fff5e0;
  --rojo: #e5484d;
  --rojo-bg: #fdecec;
  --font-display: "League Spartan", "Calibri", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Roboto", "Calibri", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --radio: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cf-bg-soft);
  color: var(--cf-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- estructura ---------- */

.cargando-inicial {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--cf-ink-3);
}

#app { min-height: 100vh; }

.barra {
  background: var(--cf-blue-deep);
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.marca {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.marca .facil { background: var(--cf-blue); padding: 0 6px; border-radius: 4px; }

nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
nav button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  font-size: 14px;
  padding: 8px 13px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
nav button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
nav button[aria-current="page"] { background: var(--cf-blue); color: #fff; font-weight: 500; }

.sesion { display: flex; align-items: center; gap: 12px; font-size: 13px; white-space: nowrap; }
.sesion .quien { opacity: 0.8; }
.sesion button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
}
.sesion button:hover { background: rgba(255, 255, 255, 0.12); }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------- encabezado de pantalla ---------- */

.encabezado {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 25px;
  margin: 0 0 3px;
  color: var(--cf-blue-deep);
}
.subtitulo { margin: 0; color: var(--cf-ink-3); font-size: 14px; }

/* ---------- tarjetas y tablas ---------- */

.tarjeta {
  background: var(--cf-bg);
  border: 1px solid var(--cf-line);
  border-radius: var(--radio);
  overflow: hidden;
  margin-bottom: 18px;
}
.tarjeta > h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cf-line-2);
  color: var(--cf-blue-deep);
}
.tarjeta .cuerpo { padding: 18px; }

.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cf-ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--cf-line);
  background: var(--cf-bg-mute);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--cf-line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--cf-blue-05); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.centro, th.centro { text-align: center; }
.etiqueta-mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.vacio { padding: 44px 20px; text-align: center; color: var(--cf-ink-3); }
.vacio p { margin: 0 0 4px; }
.vacio .pista { font-size: 13px; opacity: 0.8; }

/* ---------- chips de estado ---------- */

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-verde { background: var(--verde-bg); color: var(--verde-ink); }
.chip-azul { background: var(--cf-blue-10); color: var(--cf-blue-deep); }
.chip-ambar { background: var(--ambar-bg); color: #92400e; }
.chip-rojo { background: var(--rojo-bg); color: var(--rojo); }
.chip-gris { background: var(--cf-bg-mute); color: var(--cf-ink-2); }

/* ---------- formularios ---------- */

.campos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo.ancho { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 500; color: var(--cf-ink-2); }
label .ayuda { display: block; font-weight: 400; color: var(--cf-ink-3); font-size: 12px; }

input, select, textarea {
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--cf-ink);
  background: var(--cf-bg);
  border: 1px solid var(--cf-line);
  border-radius: 8px;
  width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--cf-blue);
  box-shadow: 0 0 0 3px var(--cf-blue-20);
}
textarea { min-height: 70px; resize: vertical; }

.filtros {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cf-line-2);
  background: var(--cf-bg-soft);
}
.filtros .campo { min-width: 150px; }
.filtros input, .filtros select { font-size: 13.5px; }

/* ---------- botones ---------- */

button.primario, button.secundario, button.peligro {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
button.primario { background: var(--cf-blue); color: #fff; }
button.primario:hover:not(:disabled) { background: var(--cf-blue-hover); }
button.secundario { background: var(--cf-bg); color: var(--cf-ink-2); border-color: var(--cf-line); }
button.secundario:hover:not(:disabled) { background: var(--cf-bg-mute); }
button.peligro { background: var(--rojo-bg); color: var(--rojo); border-color: #f7c9cb; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primario:focus-visible, button.secundario:focus-visible, button.peligro:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cf-blue-20);
}
button.enlace {
  background: none;
  border: none;
  color: var(--cf-blue);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
}
button.enlace:hover { background: var(--cf-blue-05); text-decoration: underline; }

.acciones { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- avisos ---------- */

.aviso { padding: 12px 15px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.aviso-error { background: var(--rojo-bg); color: var(--rojo); }
.aviso-ok { background: var(--verde-bg); color: var(--verde-ink); }
.aviso-info { background: var(--cf-blue-10); color: var(--cf-blue-deep); }

/* ---------- login ---------- */

.login-pantalla {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--cf-blue-deep);
  padding: 20px;
}
.login-caja {
  background: var(--cf-bg);
  border-radius: 14px;
  padding: 34px 30px;
  width: 100%;
  max-width: 380px;
}
.login-caja .marca { color: var(--cf-blue-deep); font-size: 26px; margin-bottom: 6px; }
.login-caja .marca .facil { color: #fff; }
.login-caja p.intro { margin: 0 0 24px; color: var(--cf-ink-3); font-size: 14px; }
.login-caja .campo { margin-bottom: 14px; }
.login-caja button { width: 100%; margin-top: 8px; }

/* ---------- modal ---------- */

.fondo-modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  background: var(--cf-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  margin: 0;
  padding: 17px 20px;
  border-bottom: 1px solid var(--cf-line-2);
  color: var(--cf-blue-deep);
}
.modal .cuerpo { padding: 20px; }

/* ---------- consolidado de retiro ---------- */

.tabla-consolidado th.cliente { text-align: center; min-width: 92px; }
.tabla-consolidado td.cantidad { text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; }
.tabla-consolidado td.cero { color: var(--cf-line); }
.tabla-consolidado tfoot td { font-weight: 700; background: var(--cf-bg-mute); border-top: 2px solid var(--cf-line); }
.tabla-consolidado .total-col { background: var(--cf-blue-05); font-weight: 700; }

@media (max-width: 700px) {
  .barra { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  nav { order: 3; width: 100%; }
  main { padding: 18px 14px 48px; }

  /* Fernando entra desde el teléfono, en terreno. Dos cosas que en escritorio
     no molestan y en el celular sí:

     16px es el umbral bajo el cual iOS hace zoom solo al enfocar un campo, y
     después deja la página corrida. En escritorio los filtros van más chicos
     a propósito (entran más), pero acá manda no pelear con el navegador. */
  input, select, textarea, .filtros input, .filtros select { font-size: 16px; }

  /* 44px es el mínimo táctil: con 36 se falla el toque y se abre otra pestaña. */
  nav button { padding: 11px 14px; font-size: 15px; }
  button.primario, button.secundario, button.peligro { padding: 12px 18px; }
  .opcion, td, th { padding-top: 12px; padding-bottom: 12px; }
}
