@font-face { font-family: "Inter"; src: url("assets/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("assets/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --azul: #041C34; --oro: #BF8A2E; --terra: #B8472D; --terra-h: #9E3B24; --terra-t: #FBEAE4;
  --fondo: #F4F6FA; --blanco: #fff; --pizarra: #5B6577; --linea: #D3D8E0; --texto: #14202e;
  --ok: #14804a; --alerta: #b45309; --mal: #b3261e;
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--fondo); color: var(--texto); }
h1, h2, h3 { font-family: "Manrope", "Inter", sans-serif; margin: 0; }
h1 { font-size: 1.2rem; margin-bottom: .8rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pizarra); margin: 1.4rem 0 .5rem; }
.pequeno { font-size: .85rem; color: var(--pizarra); }
code { background: #e9ecf2; padding: 1px 5px; border-radius: 4px; word-break: break-all; font-size: .8rem; }

/* ---- formularios (16px mínimo: evita el zoom de iOS) ---- */
label { display: block; font-size: .85rem; color: var(--pizarra); margin-bottom: .8rem; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .7rem .8rem; min-height: 48px; font: inherit; font-size: 16px; color: var(--texto); border: 1px solid var(--linea); border-radius: 10px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #f0c987; outline-offset: 1px; }
.error { color: var(--mal); font-size: .9rem; margin: 0 0 .8rem; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

/* ---- botones ---- */
button, .boton { font: inherit; font-weight: 600; cursor: pointer; min-height: 48px; padding: .6rem 1rem; border-radius: 12px; border: 1px solid var(--linea); background: #fff; color: var(--texto); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
button:active { transform: scale(.98); }
button:disabled { opacity: .45; }
button.primario { background: var(--terra); border-color: var(--terra); color: #fff; }
button.primario:hover { background: var(--terra-h); }
button.peligro { color: var(--mal); border-color: #e5b9b6; }
button.enlace { border: 0; background: none; color: var(--terra); min-height: 40px; padding: .3rem .6rem; font-weight: 600; }
button.enlace.claro { color: #d9e2ee; }
button.grande { min-height: 60px; font-size: 1.05rem; }

/* ---- login / 2FA ---- */
.centro { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.tarjeta { background: #fff; border: 1px solid var(--linea); border-radius: 16px; padding: 1.4rem; }
.estrecha { width: 100%; max-width: 400px; }
.qr { display: block; margin: .5rem auto; width: 200px; height: 200px; }
.primario[type=submit] { width: 100%; }

/* ---- estructura de la app ---- */
.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top)); background: var(--azul); color: #fff; }
.barra .pequeno { color: #aebbd0; }
.logo { height: 30px; width: auto; display: block; }
.logo.grande { height: 44px; margin: 0 auto 1.2rem; border-radius: 8px; }
.espacio { flex: 1; }
.cuerpo { display: block; }
#contenido { padding: 1rem; padding-bottom: calc(var(--nav-h) + 1.2rem + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }

/* menú: barra inferior en móvil */
#menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); }
#menu a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); font-size: .72rem; font-weight: 600; color: var(--pizarra); text-decoration: none; }
#menu a .ico { font-size: 1.4rem; line-height: 1; }
#menu a.activo { color: var(--terra); box-shadow: inset 0 3px 0 var(--terra); }

/* escritorio: menú a la derecha */
@media (min-width: 900px) {
  .cuerpo { display: grid; grid-template-columns: 1fr 190px; min-height: calc(100dvh - 54px); }
  #contenido { padding-bottom: 2rem; width: 100%; }
  #menu { position: sticky; top: 54px; align-self: start; height: calc(100dvh - 54px); display: flex; flex-direction: column; justify-content: flex-start; gap: .2rem; border-top: 0; border-left: 1px solid var(--linea); padding: 1rem .6rem; }
  #menu a { flex-direction: row; justify-content: flex-start; gap: .7rem; min-height: 48px; padding: 0 .8rem; border-radius: 10px; font-size: .95rem; }
  #menu a.activo { background: var(--terra-t); box-shadow: none; }
}

.banner { background: #fdf0dc; color: var(--alerta); border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; }
.vacio { color: var(--pizarra); text-align: center; padding: 2rem 0; }
.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 20; background: #14202e; color: #fff; padding: .7rem 1rem; border-radius: 10px; max-width: 92vw; font-size: .95rem; }
.aviso.mal { background: var(--mal); }

/* ---- etiquetas ---- */
.etiqueta { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: #e9ecf2; color: var(--pizarra); margin: 0 .3rem .3rem 0; font-weight: 600; }
.etiqueta.movil { background: #e0f3e8; color: var(--ok); }
.etiqueta.alerta { background: #fdf0dc; color: var(--alerta); }
.etiqueta.ok { background: #e0f3e8; color: var(--ok); }
.etiqueta.mal { background: #fbe4e2; color: var(--mal); }

/* ---- LLAMADAS ---- */
.cold-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; gap: .5rem; flex-wrap: wrap; }
.cold-filtros { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--pizarra); }
.cold-filtros label { display: flex; align-items: center; gap: .4rem; margin: 0; min-height: 40px; }
.cold-filtros input { width: 22px; height: 22px; min-height: 0; margin: 0; }
.ficha { background: #fff; border: 1px solid var(--linea); border-radius: 18px; padding: 1.3rem 1.1rem; text-align: center; }
.ficha .nombre { font-family: "Manrope", sans-serif; font-weight: 800; font-size: 1.55rem; line-height: 1.2; margin: .2rem 0 .3rem; word-break: break-word; }
.ficha .dir { color: var(--pizarra); font-size: .92rem; margin-bottom: .6rem; }
.ficha .tel { display: block; margin: .8rem 0; padding: .9rem; border-radius: 14px; background: var(--azul); color: #fff; font-family: "Manrope", sans-serif; font-weight: 800; font-size: 2rem; letter-spacing: .02em; text-decoration: none; }
.ficha .tel small { display: block; font-family: "Inter", sans-serif; font-size: .75rem; font-weight: 500; color: #aebbd0; letter-spacing: 0; }
.ficha .acciones2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }
.ficha .secundarias { display: flex; justify-content: center; gap: .3rem; flex-wrap: wrap; margin-top: .8rem; }
.motivos { display: grid; gap: .5rem; margin-top: .8rem; }
.contador { text-align: center; margin-top: .8rem; }

/* ---- HOME ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: .8rem 0; }
.stat { background: #fff; border: 1px solid var(--linea); border-radius: 14px; padding: .8rem 1rem; }
.stat b { display: block; font-family: "Manrope", sans-serif; font-size: 1.8rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--pizarra); }
.cal { background: #fff; border: 1px solid var(--linea); border-radius: 14px; padding: .7rem; }
.cal-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.cal-cab strong { font-family: "Manrope", sans-serif; }
.cal-cab strong::first-letter { text-transform: uppercase; }
.cal-cab button { min-height: 40px; min-width: 44px; padding: 0 .6rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal-grid .dow { font-size: .7rem; color: var(--pizarra); padding: 2px 0; }
.cal-grid button { min-height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cal-grid button.fuera { color: #b7bfcc; }
.cal-grid button.hoy { box-shadow: inset 0 0 0 2px var(--oro); }
.cal-grid button.sel { background: var(--azul); color: #fff; }
.cal-grid button .punto { width: 6px; height: 6px; border-radius: 50%; background: var(--terra); }
.cal-grid button.sel .punto { background: var(--oro); }
.cal-grid button .punto.sinvisita { background: transparent; }
.visita { display: flex; align-items: center; gap: .8rem; background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .5rem; }
.visita .hora { font-family: "Manrope", sans-serif; font-weight: 800; min-width: 3.4rem; }
.visita .info { flex: 1; min-width: 0; }
.visita .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visita a { color: var(--terra); font-weight: 600; text-decoration: none; }

/* ---- LEADS ---- */
.barra-leads { display: grid; grid-template-columns: 1fr 140px; gap: .6rem; margin-bottom: .6rem; }
.barra-leads input, .barra-leads select { margin: 0; }
.lead-item { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .5rem; min-height: 64px; font-weight: 400; }
.lead-item .info { flex: 1; min-width: 0; }
.lead-item .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lead-item .redes { color: var(--pizarra); font-size: .85rem; letter-spacing: .15em; }

/* ---- diálogos: hoja inferior en móvil ---- */
dialog { border: 0; padding: 0; width: min(440px, 100%); max-height: 92dvh; border-radius: 18px; color: var(--texto); }
dialog::backdrop { background: rgba(4, 28, 52, .55); }
dialog form { padding: 1.2rem; padding-bottom: calc(1.2rem + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92dvh; }
dialog h2 { margin-bottom: .2rem; }
dialog .pequeno { margin: 0 0 1rem; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .4rem; }
@media (max-width: 599px) {
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; }
}

/* ---- pantallas de acceso: todo azul, el logo se funde con el fondo ---- */
.centro { background: var(--azul); color: #fff; }
.centro .tarjeta { background: transparent; border: 0; color: #fff; padding: .5rem; }
.centro .logo.grande { height: 56px; margin-bottom: 2rem; border-radius: 0; }
.centro h1 { color: #fff; text-align: center; }
.centro label, .centro .pequeno { color: #aebbd0; }
.centro code { background: #0b2f52; color: #fff; }
.centro .error { color: #ffb4ab; }
.centro button.enlace { color: #d9e2ee; width: 100%; margin-top: .4rem; }
.centro input { border-color: #1d4570; }
.centro .qr { background: #fff; padding: 8px; border-radius: 10px; }
