@font-face { font-family: 'Outfit'; src: url('fonts/outfit-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('fonts/outfit-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('fonts/outfit-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('fonts/outfit-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --navy: #172C51;
  --navy-2: #1F3A68;
  --cyan: #00B0F0;
  --cyan-2: #57C4F1;
  --cyan-ink: #0079A8;      /* cian oscurecido para texto sobre blanco (contraste AA) */
  --cyan-wash: #E6F6FD;
  --fondo: #F3F6FA;
  --papel: #FFFFFF;
  --tinta: #16233A;
  --gris: #5B6B82;
  --linea: #DCE3EC;
  --ok: #138A5B;  --ok-wash: #E3F5EC;
  --alerta: #A86A00; --alerta-wash: #FFF4DC;
  --error: #C93838; --error-wash: #FDECEC;
  --radio: 10px;
  --radio-s: 6px;
  --sombra: 0 1px 2px rgba(23, 44, 81, .06), 0 4px 16px rgba(23, 44, 81, .06);
  --fuente: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--fuente); font-size: 16px; line-height: 1.45; color: var(--tinta); background: var(--fondo); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan-ink); }
:focus-visible { outline: 3px solid var(--cyan-2); outline-offset: 2px; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- barra superior ---------- */
.barra { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; }
.barra-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; min-height: 58px; }
.marca { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: #fff; }
.marca-honor { font-weight: 700; font-size: 21px; letter-spacing: .22em; }
.marca-sub { font-size: 14px; color: var(--cyan-2); font-weight: 500; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: #C9D6EA; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.activo { color: var(--navy); background: #fff; }
.nav svg { width: 18px; height: 18px; }
.barra-der { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip-hes { border: 1px solid rgba(87,196,241,.6); background: transparent; color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.chip-hes b { font-weight: 600; color: var(--cyan-2); }
.usuario { text-align: right; line-height: 1.15; font-size: 14px; }
.usuario small { display: block; color: #9FB2CF; font-size: 12px; }
.btn-salir { background: transparent; border: 0; color: #C9D6EA; cursor: pointer; padding: 8px; border-radius: 8px; }
.btn-salir:hover { color: #fff; background: rgba(255,255,255,.08); }

/* barra inferior móvil */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav, .usuario { display: none; }
  .barra-in { padding: 8px 14px; min-height: 52px; gap: 10px; }
  .marca-sub { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--papel); border-top: 1px solid var(--linea); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--gris); text-decoration: none; padding: 4px 0; font-weight: 500; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.activo { color: var(--navy); }
  .tabbar a.activo svg { color: var(--cyan); }
  main { padding-bottom: 92px !important; }
}

main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 48px; }
.angosto { max-width: 760px; margin: 0 auto; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
.sub { color: var(--gris); margin: 0 0 18px; }
.cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.volver { display: inline-flex; align-items: center; gap: 4px; color: var(--gris); text-decoration: none; font-size: 15px; margin-bottom: 10px; }
.volver:hover { color: var(--navy); }

/* ---------- inicio: buscador protagonista ---------- */
.buscador { background: var(--navy); color: #fff; border-radius: 16px; padding: 26px 24px 22px; position: relative; overflow: hidden; }
.buscador::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 28px solid rgba(0,176,240,.18); pointer-events: none; }
.buscador h1 { color: #fff; font-size: 24px; }
.buscador p { color: #B7C7E0; margin: 0 0 16px; }
.caja-buscar { display: flex; align-items: center; background: #fff; border-radius: 12px; padding: 4px 6px 4px 14px; position: relative; z-index: 1; }
.caja-buscar svg { width: 22px; height: 22px; color: var(--gris); flex: none; }
.caja-buscar input { border: 0; outline: 0; flex: 1; padding: 13px 10px; font-size: 18px; color: var(--tinta); background: transparent; min-width: 0; }
.caja-buscar:focus-within { box-shadow: 0 0 0 3px var(--cyan); }
.acciones-rapidas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; position: relative; z-index: 1; }
.accion { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 16px; }
.accion svg { width: 22px; height: 22px; flex: none; }
.accion-1 { background: var(--cyan); color: var(--navy); }
.accion-2 { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.accion:hover { filter: brightness(1.06); }
.accion small { display: block; font-weight: 400; font-size: 13px; opacity: .85; }

.resultados { margin-top: 14px; }
.fila-cliente { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  text-decoration: none; color: inherit; margin-bottom: 8px; }
.fila-cliente:hover { border-color: var(--cyan-2); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--cyan-wash); color: var(--cyan-ink); display: grid; place-items: center; font-weight: 600; flex: none; }
.fila-cliente .info { flex: 1; min-width: 0; }
.fila-cliente .nombre { font-weight: 600; }
.fila-cliente .meta { color: var(--gris); font-size: 14px; }
.fila-cliente .lado { text-align: right; font-size: 13px; color: var(--gris); }

.bloque { margin-top: 26px; }
.bloque-titulo { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.bloque-titulo h2 { margin: 0; }
.cifras { display: flex; gap: 18px; color: var(--gris); font-size: 14px; }
.cifras b { color: var(--tinta); font-size: 18px; margin-right: 4px; }

/* ---------- tarjetas / paneles ---------- */
.panel { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.atencion-fila { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--linea);
  border-radius: var(--radio); background: var(--papel); text-decoration: none; color: inherit; margin-bottom: 8px; }
.atencion-fila:hover { border-color: var(--cyan-2); }
.atencion-fila .n { font-weight: 600; color: var(--navy); font-size: 14px; }
.atencion-fila .t { font-weight: 500; }
.atencion-fila .m { grid-column: 2 / 4; color: var(--gris); font-size: 14px; }

.estado { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap;
  background: var(--cyan-wash); color: var(--navy); }
.estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.estado.fin { background: var(--ok-wash); color: var(--ok); }
.estado.fin::before { background: var(--ok); }
.estado.cancel { background: #EEF1F5; color: var(--gris); }
.estado.cancel::before { background: var(--gris); }
.estado.espera { background: var(--alerta-wash); color: var(--alerta); }
.estado.espera::before { background: #E8A317; }
.pendiente { font-size: 12px; color: var(--alerta); background: var(--alerta-wash); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 500; }

/* progreso de estados (secuencia real) */
.pasos { display: flex; gap: 4px; margin: 14px 0 6px; }
.paso { flex: 1; height: 6px; border-radius: 3px; background: var(--linea); }
.paso.hecho { background: var(--cyan); }
.paso.actual { background: var(--navy); }
.pasos-txt { display: flex; justify-content: space-between; font-size: 12px; color: var(--gris); }

/* ---------- formularios ---------- */
.form { display: grid; gap: 16px; }
.campo { display: grid; gap: 6px; }
.campo > label, .etq { font-weight: 500; font-size: 15px; }
.campo .req { color: var(--error); margin-left: 2px; }
.campo .ayuda { font-size: 13px; color: var(--gris); }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid #C7D2E0; background: #fff; border-radius: var(--radio-s); padding: 11px 12px; font-size: 16px; min-height: 46px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,176,240,.2); }
.campo.con-error input, .campo.con-error select, .campo.con-error textarea { border-color: var(--error); }
.msg-error { color: var(--error); font-size: 14px; }
.fila-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fila-doc { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
@media (max-width: 560px) { .fila-campos { grid-template-columns: 1fr; } }

.segmentos { display: flex; flex-wrap: wrap; gap: 8px; }
.segmentos input { position: absolute; opacity: 0; pointer-events: none; }
.segmentos label { border: 1px solid #C7D2E0; border-radius: 999px; padding: 9px 15px; cursor: pointer; background: #fff; font-size: 15px; user-select: none; }
.segmentos input:checked + label { background: var(--navy); border-color: var(--navy); color: #fff; }
.segmentos input:focus-visible + label { outline: 3px solid var(--cyan-2); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); margin: 1px 0 0; flex: none; }
.consent { background: var(--cyan-wash); border-radius: var(--radio-s); padding: 12px 14px; }

.agregar-opcion { display: flex; gap: 8px; }
.agregar-opcion input { flex: 1; }

.aviso { border-radius: var(--radio-s); padding: 12px 14px; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.aviso svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.aviso.info { background: var(--cyan-wash); color: var(--navy); }
.aviso.alerta { background: var(--alerta-wash); color: #6B4500; }
.aviso.error { background: var(--error-wash); color: #8A1F1F; }
.aviso.ok { background: var(--ok-wash); color: #0B5A3A; }
.aviso a { color: inherit; font-weight: 600; }
.aviso ul { margin: 6px 0 0; padding-left: 18px; }

.botones { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 1px solid transparent; border-radius: var(--radio-s); padding: 11px 18px; font-weight: 600; font-size: 16px; cursor: pointer; min-height: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn svg { width: 19px; height: 19px; }
.btn-primario { background: var(--cyan); color: var(--navy); }
.btn-primario:hover { background: #12BCF8; }
.btn-oscuro { background: var(--navy); color: #fff; }
.btn-oscuro:hover { background: var(--navy-2); }
.btn-borde { background: #fff; border-color: #C7D2E0; color: var(--navy); }
.btn-borde:hover { border-color: var(--navy); }
.btn-peligro { background: #fff; border-color: #E9B8B8; color: var(--error); }
.btn-texto { background: transparent; color: var(--cyan-ink); padding: 8px 6px; min-height: 0; }
.btn-chico { padding: 6px 12px; font-size: 14px; min-height: 36px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-bloque { width: 100%; }
.pie-form { position: sticky; bottom: 0; background: linear-gradient(to top, var(--fondo) 70%, transparent); padding: 14px 0 4px; }
@media (max-width: 760px) { .pie-form { bottom: 66px; } }

/* ---------- ficha ---------- */
.ficha-cab { display: flex; gap: 16px; align-items: center; }
.ficha-cab .avatar { width: 56px; height: 56px; font-size: 20px; background: var(--navy); color: #fff; }
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; margin: 16px 0 0; }
.datos dt { font-size: 13px; color: var(--gris); }
.datos dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.equipos { display: flex; flex-wrap: wrap; gap: 8px; }
.equipo { border: 1px solid var(--linea); border-radius: var(--radio-s); padding: 8px 12px; font-size: 14px; background: #FAFCFE; }
.equipo b { display: block; font-weight: 600; font-size: 15px; }

.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--linea); margin-left: 6px; }
.linea-tiempo li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--cyan); }
.linea-tiempo li:last-child { border-left-color: transparent; }
.linea-tiempo .cuando { font-size: 13px; color: var(--gris); }

/* ---------- seguimiento ---------- */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filtros select { width: auto; min-width: 200px; }
.tablero { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.columna { background: #E9EEF5; border-radius: var(--radio); padding: 10px; min-height: 120px; }
.columna h3 { display: flex; justify-content: space-between; font-size: 14px; color: var(--navy); margin: 2px 4px 10px; }
.columna h3 span { color: var(--gris); font-weight: 500; }
.tarjeta { display: block; background: #fff; border-radius: var(--radio-s); padding: 10px 12px; margin-bottom: 8px; text-decoration: none; color: inherit; box-shadow: var(--sombra); }
.tarjeta:hover { outline: 2px solid var(--cyan-2); }
.tarjeta .n { font-size: 12px; color: var(--gris); display: flex; justify-content: space-between; }
.tarjeta .c { font-weight: 600; margin: 2px 0; }
.tarjeta .d { font-size: 13px; color: var(--gris); }
.tarjeta .tarde { color: var(--error); font-weight: 600; }
@media (max-width: 760px) { .tablero { grid-template-columns: 1fr; overflow: visible; } }

/* ---------- admin ---------- */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--linea); margin-bottom: 18px; overflow-x: auto; }
.pestanas button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 500; color: var(--gris); border-bottom: 3px solid transparent; white-space: nowrap; }
.pestanas button[aria-selected=true] { color: var(--navy); border-bottom-color: var(--cyan); }
.badge { background: var(--alerta); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; margin-left: 4px; }
.tabla { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; font-size: 15px; }
.tabla th { text-align: left; font-size: 13px; color: var(--gris); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--linea); background: #FAFCFE; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #EEF2F7; vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .inactivo td { color: #9AA7B8; }
.envoltura-tabla { overflow-x: auto; }

/* ---------- login ---------- */
.pantalla-login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-lado { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-lado::after { content: ''; position: absolute; right: -140px; bottom: -140px; width: 420px; height: 420px; border-radius: 50%; border: 56px solid rgba(0,176,240,.16); }
.login-lado .marca-honor { font-size: 30px; }
.login-lado h1 { color: #fff; font-size: 38px; max-width: 12ch; line-height: 1.1; font-weight: 600; margin-top: 28px; }
.login-lado p { color: #B7C7E0; max-width: 34ch; font-size: 17px; }
.login-form { display: grid; place-items: center; padding: 32px 22px; }
.login-form form { width: 100%; max-width: 360px; }
@media (max-width: 760px) {
  .pantalla-login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-lado { padding: 26px 22px 30px; }
  .login-lado h1 { font-size: 27px; margin-top: 14px; }
  .login-lado p { display: none; }
}

/* ---------- confirmación y toast ---------- */
.exito { text-align: center; padding: 36px 20px; }
.exito .icono { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; animation: pop .35s ease-out; }
.exito .icono svg { width: 38px; height: 38px; }
.exito .numero { font-size: 34px; font-weight: 700; color: var(--navy); letter-spacing: .04em; margin: 4px 0 2px; }
.resumen { text-align: left; max-width: 420px; margin: 18px auto; }
.resumen div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--linea); font-size: 15px; }
.resumen span { color: var(--gris); }
.resumen b { font-weight: 500; text-align: right; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 50;
  box-shadow: 0 8px 24px rgba(23,44,81,.25); display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px); }
.toast.ok svg { color: #5BE0A6; }
.toast.error { background: var(--error); }
.toast svg { width: 20px; height: 20px; flex: none; }
@media (max-width: 760px) { .toast { bottom: 84px; } }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100% - 28px)); box-shadow: 0 20px 60px rgba(23,44,81,.3); }
dialog::backdrop { background: rgba(23,44,81,.45); }
.dlg { padding: 22px; }
.lista-hes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 55vh; overflow-y: auto; margin: 12px 0; }
.lista-hes button { border: 1px solid #C7D2E0; background: #fff; border-radius: 8px; padding: 11px 10px; text-align: left; cursor: pointer; font-size: 15px; }
.lista-hes button small { display: block; color: var(--gris); font-size: 12px; }
.lista-hes button:hover, .lista-hes button.sel { border-color: var(--navy); background: var(--cyan-wash); }

.vacio { text-align: center; color: var(--gris); padding: 28px 16px; border: 1px dashed #C7D2E0; border-radius: var(--radio); background: #fff; }
.cargando { color: var(--gris); padding: 24px 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.centrar { justify-content: center; }
.abajo { align-self: end; }
.clave-grande { font-size: 28px; font-weight: 700; color: var(--navy); letter-spacing: .06em; margin: 10px 0 18px; }
.caja-buscar input[type=search] { border: 0; box-shadow: none; min-height: 0; padding: 13px 10px; font-size: 18px; border-radius: 0; }
.chip-hes { white-space: nowrap; }
.chip-hes svg, .volver svg { width: 18px; height: 18px; flex: none; }
.fila-cliente, .atencion-fila { transition: border-color .15s; }
.btn-salir svg { width: 22px; height: 22px; display: block; }
@media (max-width: 760px) {
  .buscador { padding: 20px 16px 16px; }
  .buscador h1 { font-size: 21px; }
  .accion { padding: 12px; font-size: 15px; }
  .bloque-titulo { flex-direction: column; gap: 4px; }
  .atencion-fila { grid-template-columns: 1fr auto; }
  .atencion-fila .t { grid-column: 1 / 3; grid-row: 2; }
  .atencion-fila .m { grid-column: 1 / 3; }
  .volver { margin-bottom: 6px; }
}
.tabla select { width: auto; min-width: 170px; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.tabla td .botones { align-items: center; }
@media (max-width: 760px) { .datos { grid-template-columns: 1fr 1fr; gap: 10px 14px; } .ficha-cab h1 { font-size: 22px; } }
