/* PRW CRM — estilo (marca: navy #1B2E63, rojo #C6362C) */
:root {
  --navy: #1B2E63; --rojo: #C6362C; --fondo: #F2F4F9; --carta: #fff;
  --tinta: #1c2340; --gris: #6b7390; --linea: #e3e6f0;
  --verde: #1e8e4e; --ambar: #b97a10;
  --radio: 14px; --sombra: 0 2px 10px rgba(27, 46, 99, .08);
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Avenir Next", Avenir, -apple-system, "Segoe UI", sans-serif;
  background: var(--fondo); color: var(--tinta); font-size: 17px; line-height: 1.45;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; width: 100%; padding: 13px 14px; border: 1.5px solid var(--linea);
  border-radius: 12px; background: #fff; color: var(--tinta);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); border-color: var(--navy); }
label { display: block; font-size: 14px; font-weight: 700; color: var(--gris); margin: 14px 0 5px; }

/* barra superior */
#barra {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
#barra img { border-radius: 8px; }
#barra b { font-size: 19px; letter-spacing: .02em; }
#barra b span { color: #f0b9b2; font-weight: 800; }
#barra-extra { margin-left: auto; font-size: 14px; opacity: .85; }
#barra-ajustes { color: #fff; opacity: .9; display: flex; padding: 4px; }

/* dinero */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 13px 14px; }
.stat small { display: block; font-size: 12.5px; font-weight: 800; color: var(--gris); text-transform: uppercase; letter-spacing: .05em; }
.stat b { font-size: 24px; color: var(--navy); }
.stat.grande { grid-column: 1 / -1; background: var(--navy); }
.stat.grande small { color: #b9c3e4; }
.stat.grande b { color: #fff; font-size: 30px; }
.chip.borrador { background: #eceef3; color: var(--gris); }
.chip.enviada { background: #e8edfb; color: var(--navy); }
.chip.pagada { background: #e2f5e9; color: var(--verde); }

/* factura imprimible */
@media print {
  #barra, #tabs, .fab, .no-imprimir { display: none !important; }
  body { background: #fff; padding: 0; }
  main { max-width: none; padding: 0; }
  .carta { box-shadow: none; border: 0; }
}

main { padding: 16px; max-width: 640px; margin: 0 auto; }

/* pestañas de abajo */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
  background: #fff; border-top: 1px solid var(--linea);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; text-decoration: none; color: var(--gris);
  font-size: 11.5px; font-weight: 700; position: relative; white-space: nowrap;
}
#tabs a svg { width: 24px; height: 24px; }
#tabs a.activa { color: var(--navy); }
#tabs i {
  position: absolute; top: 4px; right: calc(50% - 24px); background: var(--rojo); color: #fff;
  font-style: normal; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
#tabs i[hidden] { display: none; }

/* tarjetas y listas */
.carta { background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 14px; }
.titulo { font-size: 22px; font-weight: 800; color: var(--navy); margin: 4px 0 12px; }
.sub { color: var(--gris); font-size: 14.5px; }
.fila-cita { display: block; text-decoration: none; color: inherit; }
.fila-cita + .fila-cita { margin-top: 12px; }
.fila-cita .arriba { display: flex; align-items: baseline; gap: 10px; }
.fila-cita .hora { font-weight: 800; color: var(--navy); font-size: 18px; min-width: 74px; }
.fila-cita .nombre { font-weight: 800; font-size: 18px; }
.fila-cita .detalle { color: var(--gris); font-size: 14.5px; margin-top: 3px; }

.chip {
  display: inline-block; font-size: 12.5px; font-weight: 800; padding: 3px 10px;
  border-radius: 999px; margin-left: auto; white-space: nowrap;
}
.chip.nueva { background: #fdeae7; color: var(--rojo); }
.chip.deposito { background: #fdf3e0; color: var(--ambar); }
.chip.confirmada { background: #e8edfb; color: var(--navy); }
.chip.completada { background: #e2f5e9; color: var(--verde); }
.chip.cancelada { background: #eceef3; color: var(--gris); }

/* botones */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 54px; border: 0; border-radius: 13px; font-size: 18px; font-weight: 800;
  background: var(--navy); color: #fff; text-decoration: none; margin-top: 12px;
}
.btn.rojo { background: var(--rojo); }
.btn.verde { background: var(--verde); }
.btn.claro { background: #e8edfb; color: var(--navy); }
.btn.borde { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn:disabled { opacity: .5; }
.btn-fila { display: flex; gap: 10px; }
.btn-fila .btn { margin-top: 12px; }
.enorme { min-height: 64px; font-size: 20px; }

.acciones-rapidas { display: flex; gap: 10px; margin-top: 10px; }
.acciones-rapidas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: #f2f4fb; border-radius: 12px; padding: 10px 4px 8px;
  text-decoration: none; color: var(--navy); font-size: 12.5px; font-weight: 800;
}
.acciones-rapidas svg { width: 24px; height: 24px; }

/* teclado PIN */
.pin-caja { max-width: 320px; margin: 8vh auto 0; text-align: center; }
.pin-logo { width: 84px; border-radius: 20px; margin-bottom: 12px; }
.pin-puntos { display: flex; justify-content: center; gap: 12px; margin: 18px 0 8px; min-height: 18px; }
.pin-puntos i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--navy); }
.pin-puntos i.lleno { background: var(--navy); }
.pin-teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.pin-teclado button {
  height: 68px; font-size: 26px; font-weight: 700; border: 0; border-radius: 16px;
  background: #fff; box-shadow: var(--sombra); color: var(--tinta);
}
.pin-teclado button:active { background: #e8edfb; }
.pin-error { color: var(--rojo); font-weight: 700; min-height: 24px; margin-top: 10px; }

/* cobro */
.linea-cobro { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.linea-cobro input.desc { flex: 1; }
.linea-cobro input.monto { width: 108px; text-align: right; font-weight: 700; }
.linea-cobro .quitar {
  background: #fdeae7; color: var(--rojo); border: 0; border-radius: 10px;
  width: 44px; height: 48px; font-size: 22px; font-weight: 800; flex: none;
}
.total-grande {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--navy); color: #fff; border-radius: 13px; padding: 16px; margin-top: 14px;
  font-size: 20px; font-weight: 800;
}
.total-grande b { font-size: 30px; }
.resumen-lineas { border-top: 1px solid var(--linea); margin-top: 8px; }
.resumen-lineas div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--linea); }
.resumen-lineas div span:last-child { font-weight: 700; white-space: nowrap; }

/* firma */
.firma-caja { border: 2px dashed var(--navy); border-radius: 13px; background: #fff; margin-top: 12px; position: relative; }
.firma-caja canvas { display: block; width: 100%; height: 220px; touch-action: none; border-radius: 11px; }
.firma-guia { position: absolute; left: 12%; right: 12%; bottom: 42px; border-bottom: 1.5px solid #c9cede; pointer-events: none; }
.firma-texto { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--gris); font-size: 13px; pointer-events: none; }

.aviso { background: #fdf3e0; border-radius: 12px; padding: 12px 14px; font-size: 15px; margin-top: 12px; }
.aviso.rojo { background: #fdeae7; }
.aviso.verde { background: #e2f5e9; }
.centrado { text-align: center; }
.paso { font-size: 13.5px; font-weight: 800; letter-spacing: .06em; color: var(--rojo); text-transform: uppercase; }
.recibo-firma { max-width: 260px; border: 1px solid var(--linea); border-radius: 10px; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.buscador { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 10px; padding: 12px 0; font-weight: 700; }
.check input { width: 26px; height: 26px; accent-color: var(--navy); }
.fab {
  position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 15;
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--rojo); color: #fff;
  font-size: 32px; font-weight: 700; box-shadow: 0 4px 14px rgba(198, 54, 44, .45);
}
.vacio { text-align: center; color: var(--gris); padding: 40px 12px; }
.vacio svg { width: 54px; height: 54px; opacity: .4; margin-bottom: 8px; }
.tabs-arriba { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.tabs-arriba button {
  border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 800; font-size: 14.5px;
  background: #fff; color: var(--gris); box-shadow: var(--sombra); white-space: nowrap;
}
.tabs-arriba button.activa { background: var(--navy); color: #fff; }
.fecha-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fecha-nav button { width: 46px; height: 46px; border: 0; border-radius: 12px; background: #fff; box-shadow: var(--sombra); font-size: 20px; color: var(--navy); font-weight: 800; }
.fecha-nav b { flex: 1; text-align: center; font-size: 17px; color: var(--navy); }

/* proceso (pipeline) — v1.9 */
.etapa-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 14px; }
.etapa-pill {
  border: 0; background: #fff; border-radius: 12px; box-shadow: var(--sombra); padding: 8px 3px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--gris); opacity: .5;
}
.etapa-pill.con { opacity: 1; color: var(--navy); }
.etapa-pill.con.urgente { background: #fdeae7; color: var(--rojo); }
.etapa-pill span { font-size: 19px; line-height: 1.1; }
.etapa-pill b { font-size: 19px; line-height: 1.1; }
.etapa-pill small { font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center; }
.lane-h { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.lane-h b { font-size: 17px; color: var(--navy); }
.lane-h .sub { font-size: 13px; }
.lane-ic { font-size: 24px; flex: none; }
.lane-n {
  margin-left: auto; flex: none; background: var(--navy); color: #fff; font-weight: 800; border-radius: 999px;
  min-width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; padding: 0 9px;
}
.lane-urgente .lane-n { background: var(--rojo); }
.proc-fila { padding: 12px 0 4px; border-top: 1px solid var(--linea); }
.proc-fila .fila-cita + .seg { margin-top: 2px; }
.marca-seg { margin-left: 6px; font-size: 12.5px; font-weight: 800; color: var(--ambar); white-space: nowrap; }
.seg { margin-top: 10px; }
.seg-linea { font-size: 15px; padding: 9px 12px; border-radius: 10px; background: #f6f7fb; margin-top: 8px; }
.seg-linea.pend { background: #fdf3e0; }
.seg-linea.ok { background: #e2f5e9; }
.seg-linea .tarde { color: var(--rojo); font-weight: 700; }
.seg-deshacer { background: none; border: 0; color: var(--gris); text-decoration: underline; font-size: 13px; padding: 0 0 0 6px; }
.seg-form { background: #fff; border: 1.5px dashed var(--navy); border-radius: 12px; padding: 2px 14px 14px; margin-top: 10px; }
.seg-tipo.activa { background: var(--navy); color: #fff; }

/* contratos (cotizaciones) */
.chip.aceptada { background: #e2f5e9; color: var(--verde); }
.chip.rechazada { background: #eceef3; color: var(--gris); }

/* formulario de información del cliente (v2.0) */
.info-tabla { margin-top: 8px; border: 1px solid var(--linea); border-radius: 10px; overflow: hidden; }
.info-fila { display: flex; gap: 10px; padding: 7px 12px; font-size: 14.5px; border-top: 1px solid var(--linea); background: #fff; }
.info-fila:first-child { border-top: 0; }
.info-fila:nth-child(even) { background: #f6f7fb; }
.info-k { flex: 0 0 46%; color: var(--gris); font-weight: 600; }
.info-v { flex: 1; word-break: break-word; }
