:root {
  --rojo: #8B0000;
  --rojo-claro: #c0392b;
  --verde: #1a6b2e;
  --dorado: #b8860b;
  --bg: #f5f5f0;
  --texto: #222;
  --gris: #777;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--texto);
  padding-bottom: 76px; /* espacio para la barra de pestañas fija de abajo */
  -webkit-tap-highlight-color: transparent;
}

.oculto { display: none !important; }

.pantalla { min-height: 100vh; padding: 10px; }

/* ── LOGIN ─────────────────────────────────────────────────────────── */
#pantalla-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #8B0000 0%, #5c0000 100%);
}
.login-caja {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.login-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 8px; }
.login-titulo { font-size: 20px; margin: 4px 0 2px 0; color: var(--rojo); }
.login-sub { font-size: 13px; color: var(--gris); margin: 0 0 20px 0; }
.login-saludo { font-size: 17px; font-weight: bold; color: var(--verde); margin-bottom: 14px; }
.login-caja label { display: block; font-size: 13px; color: var(--gris); margin: 10px 0 6px 0; text-align: left; }
.login-caja input {
  width: 100%; font-size: 26px; text-align: center; letter-spacing: 8px;
  padding: 14px; border: 2px solid #ddd; border-radius: 10px;
}
.login-caja input:focus { outline: none; border-color: var(--rojo); }
.btn.btn-link { background: none; color: var(--gris); font-weight: normal; text-decoration: underline; padding: 10px; }

/* ── CABECERA + MENÚ ──────────────────────────────────────────────────── */
.cabecera {
  display: flex; align-items: center; gap: 10px;
  background: var(--rojo); color: #fff;
  padding: 10px 12px; position: sticky; top: 0; z-index: 50;
}
.cabecera-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: #fff; }
.cabecera-texto { flex: 1; min-width: 0; }
.cabecera-tienda { font-size: 14px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cabecera-sub { font-size: 11px; opacity: 0.85; }
.btn-icono { background: none; border: none; color: #fff; font-size: 22px; padding: 4px 8px; cursor: pointer; }

.menu-inferior {
  position: fixed; left: 0; right: 0; bottom: 0; height: 60px;
  background: #fff; z-index: 80; box-shadow: 0 -2px 10px rgba(0,0,0,0.12);
  display: flex; border-top: 1px solid #eee;
}
.tab-inferior {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: none; cursor: pointer; color: var(--gris);
  font-family: inherit; padding: 6px 0;
}
.tab-inferior.activo { color: var(--rojo); }
.tab-icono { font-size: 20px; line-height: 1; }
.tab-texto { font-size: 10px; }
#tab-salir.activo { color: var(--gris); } /* salir nunca queda "seleccionado" como pantalla activa */

/* ── LISTAS / TARJETAS ─────────────────────────────────────────────── */
.encabezado-simple { display: flex; align-items: center; gap: 8px; padding: 8px 2px 12px 2px; }
.encabezado-simple h2 { font-size: 16px; margin: 0; }
.btn-volver { background: none; border: none; font-size: 22px; padding: 0 6px; cursor: pointer; color: var(--rojo); }
.titulo-seccion { font-size: 15px; margin: 8px 2px; color: var(--rojo); }

.lista { display: flex; flex-direction: column; gap: 8px; }

.tarjeta-ruta, .tarjeta-cliente, .tarjeta-super {
  background: #fff; border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10); cursor: pointer;
  border-left: 5px solid #ccc;
}
.tarjeta-ruta.terminada { opacity: 0.55; }
.tarjeta-cliente.capturado { border-left-color: var(--verde); background: #f4faf5; }
.tarjeta-ruta-titulo, .tarjeta-cliente-nombre { font-size: 15px; font-weight: bold; }
.tarjeta-ruta-sub, .tarjeta-cliente-datos { font-size: 12px; color: var(--gris); margin-top: 3px; }
.chip-verde {
  display: inline-block; background: var(--verde); color: #fff; font-size: 10px;
  padding: 2px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}
.chip-rojo {
  display: inline-block; background: #c0392b; color: #fff; font-size: 10px;
  padding: 2px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}

/* ── BARRA GRADIENTE DE AVANCE (estilo consumo de datos) ─────────────── */
.barra-gradiente-cont { margin: 4px 2px 14px 2px; }
.barra-gradiente-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--gris); margin-bottom: 4px; }
.barra-gradiente-track {
  height: 14px; border-radius: 7px; background: #e5e5e0; overflow: hidden;
  position: relative;
}
.barra-gradiente-fill {
  height: 100%; border-radius: 7px;
  background: linear-gradient(90deg, #c0392b 0%, #e0a814 45%, #d4af17 65%, #1a6b2e 100%);
  transition: width 0.4s ease;
}

/* ── FORM DE CAPTURA (inline, expandible) ─────────────────────────────── */
.captura-inline {
  background: #fbfbf8; border-top: 1px dashed #ddd; margin-top: 8px;
  padding: 12px 4px 4px 4px;
}
.aviso-ya-capturado {
  background: #fff3cd; border: 1px solid #ffe08a; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 10px; color: #6b5400;
}
.tarjeta-form { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tarjeta-form h3 { font-size: 13px; margin: 0 0 8px 0; color: var(--rojo); }
label { display: block; font-size: 12px; color: var(--gris); margin: 8px 0 3px 0; }
input {
  width: 100%; font-size: 17px; padding: 10px;
  border: 1px solid #ccc; border-radius: 8px; background: #fff; color: var(--texto);
}
input:focus { outline: none; border-color: var(--rojo); }

.btn {
  display: block; width: 100%; border: none; border-radius: 10px;
  padding: 13px; font-size: 15px; font-weight: bold; color: #fff;
  cursor: pointer; margin-top: 10px;
}
.btn-verde { background: var(--verde); }
.btn-dorado { background: var(--dorado); }
.btn-rojo { background: var(--rojo); }
.btn-secundario { background: #555; margin: 10px 2px; }

.texto-ayuda { color: var(--gris); font-size: 13px; padding: 8px 4px; }
.status-captura { text-align: center; font-weight: bold; min-height: 18px; margin-top: 8px; font-size: 13px; }

.linea-corte { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.linea-corte.destacada { font-size: 17px; color: var(--rojo); border-bottom: none; padding-top: 12px; }

#indicador-pendientes {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--dorado); color: #fff; text-align: center;
  font-size: 12px; padding: 5px; font-weight: bold;
}

/* ── Vista de cliente: pestañas de período, puntos, modal de canje ────── */
.periodo-tabs { display: flex; gap: 6px; }
.tab-periodo {
  flex: 1; padding: 10px; border: 1px solid #ddd; background: #fff;
  border-radius: 8px; font-size: 13px; font-weight: bold; color: var(--gris);
  cursor: pointer;
}
.tab-periodo.activo { background: var(--rojo); color: #fff; border-color: var(--rojo); }

.puntos-saldo { font-size: 44px; font-weight: bold; text-align: center; color: var(--dorado); margin: 6px 0; }

.modal-fondo {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-caja { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 340px; }
.modal-caja h3 { margin-top: 0; color: var(--rojo); }
.modal-caja select {
  width: 100%; font-size: 16px; padding: 10px; border: 1px solid #ccc; border-radius: 8px;
}

.chip-rol {
  display: inline-block; background: rgba(255,255,255,0.25); color: #fff;
  font-size: 10px; font-weight: bold; padding: 2px 7px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.5px; margin-right: 4px;
}

/* ── Gráficas de pastel (CSS puro, sin librerías) ─────────────────────── */
.pie-cont { display: flex; align-items: center; gap: 14px; }
.pie-chart {
  width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0;
  position: relative;
}
.pie-chart::after {
  content: ""; position: absolute; top: 12px; left: 12px; right: 12px; bottom: 12px;
  background: #fff; border-radius: 50%;
}
.pie-centro {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold; color: var(--texto); z-index: 1;
}
.pie-leyenda { flex: 1; font-size: 12px; }
.pie-leyenda-item { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.pie-punto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.periodo-tabs-chico { display: flex; gap: 6px; margin-bottom: 10px; }

/* Aviso fijo cuando el permiso de ubicación está bloqueado */
.aviso-gps { background: #fff4d6; border: 1px solid #e0b000; color: #6b5200; border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; font-size: 13px; line-height: 1.35; }

/* 4.4.8: nota bajo el botón único de Registrar */
.nota-captura { margin: 8px 0 0; font-size: 12px; color: #666; text-align: center; line-height: 1.35; }
