/* Plataforma Promotores IMN — estilos. Tema claro a propósito: se usa en la calle, al sol. */
:root {
  --tinta: #17132f;
  --suave: #58547a;
  --fondo: #f3f2f9;
  --tarjeta: #ffffff;
  --linea: #dddbeb;
  --violeta: #2e1a6e;
  --violeta-2: #4b34a8;
  --lila: #ebe7fb;
  --ok: #17784a;
  --ok-bg: #e4f4ea;
  --alerta: #8a5a00;
  --alerta-bg: #fff3d6;
  --peligro: #b3261e;
  --peligro-bg: #fcebea;
  --radio: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fondo); color: var(--tinta); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.barra { background: var(--violeta); color: #fff; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 10; }
.barra img { height: 30px; width: auto; display: block; }
.barra .quien { font-size: .85rem; text-align: right; line-height: 1.25; opacity: .95; }
.contenido { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 32px); }
.ancho { max-width: 1180px; }

h1 { font-size: 1.45rem; line-height: 1.2; margin: 6px 0 4px; }
h2 { font-size: 1.15rem; margin: 18px 0 8px; }
p { margin: 8px 0; }
.suave { color: var(--suave); font-size: .92rem; }

.tarjeta { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px; margin: 12px 0; }
.tarjeta.activa { border: 2px solid var(--violeta-2); }

label { display: block; font-weight: 600; font-size: .95rem; margin: 14px 0 6px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px; border: 1.5px solid var(--linea); border-radius: 8px; background: #fff; color: var(--tinta); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--lila); border-color: var(--violeta-2); }
textarea { min-height: 76px; resize: vertical; }
.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fila2 label { margin-top: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 12px 0; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--violeta-2); }

button { font: inherit; cursor: pointer; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; padding: 12px 16px; border: 0; border-radius: var(--radio); background: var(--violeta); color: #fff; font-weight: 700; font-size: 1.05rem; margin: 10px 0; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sec { background: #fff; color: var(--violeta); border: 2px solid var(--violeta); }
.btn.ok { background: var(--ok); }
.btn.peligro { background: var(--peligro); }
.btn.aviso-btn { background: #c77800; }
.btn.chico { min-height: 40px; font-size: .92rem; width: auto; padding: 8px 14px; margin: 4px 0; }
.btn:focus-visible, .enlace:focus-visible { outline: 3px solid #f0b400; outline-offset: 2px; }
.enlace { background: none; border: 0; color: var(--violeta-2); text-decoration: underline; padding: 8px 0; font-weight: 600; }

.foto-box { display: grid; gap: 8px; margin: 10px 0; }
.foto-box img { width: 100%; max-height: 320px; object-fit: contain; background: #000; border-radius: 8px; }
.estado { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--lila); color: var(--violeta); white-space: nowrap; }
.estado.ok { background: var(--ok-bg); color: var(--ok); }
.estado.alerta { background: var(--alerta-bg); color: var(--alerta); }
.estado.peligro { background: var(--peligro-bg); color: var(--peligro); }
.nota { background: var(--alerta-bg); color: var(--alerta); border-radius: 8px; padding: 10px 12px; font-size: .92rem; margin: 10px 0; }
.nota.info { background: var(--lila); color: var(--violeta); }
.demo { background: #fff3d6; color: #6b4600; text-align: center; font-size: .82rem; padding: 6px 12px; font-weight: 600; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.cifras div { background: var(--lila); border-radius: 8px; padding: 10px; text-align: center; }
.cifras b { display: block; font-size: 1.4rem; color: var(--violeta); font-variant-numeric: tabular-nums; }
.cifras span { font-size: .78rem; color: var(--suave); }

/* Firma */
.firma-texto { background: var(--lila); border-radius: 8px; padding: 14px; font-size: 1.02rem; line-height: 1.5; }
.firma-lienzo { width: 100%; height: 190px; background: #fff; border: 2px dashed var(--violeta-2); border-radius: 8px; touch-action: none; display: block; margin-top: 10px; }

/* Cámara */
.cam { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; flex-direction: column; }
.cam video { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
.cam-titulo { color: #fff; text-align: center; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px; font-weight: 700; }
.cam-barra { display: flex; align-items: center; justify-content: space-around; padding: 16px 12px calc(env(safe-area-inset-bottom, 0px) + 20px); }
.cam-btn { background: rgba(255,255,255,.16); color: #fff; border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 600; min-width: 96px; }
.cam-disparo { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; }

/* Aviso flotante */
.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); max-width: calc(100% - 32px); width: 520px; background: var(--tinta); color: #fff; padding: 12px 16px; border-radius: 10px; z-index: 200; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.aviso.error { background: var(--peligro); }
.aviso.ok { background: var(--ok); }

/* Tablas del panel */
.tabla { overflow-x: auto; background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; background: var(--lila); color: var(--violeta); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding: 10px; white-space: nowrap; }
td { padding: 9px 10px; border-top: 1px solid var(--linea); vertical-align: top; }
td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pestanas { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0; }
.pestanas button { flex: none; border: 1.5px solid var(--linea); background: #fff; color: var(--tinta); border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.pestanas button[aria-selected="true"] { background: var(--violeta); color: #fff; border-color: var(--violeta); }
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filtros label { margin: 0 0 4px; font-size: .82rem; }
.filtros > div { min-width: 150px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.kpis div { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio); padding: 12px; }
.kpis b { display: block; font-size: 1.6rem; color: var(--violeta); font-variant-numeric: tabular-nums; }
.kpis span { color: var(--suave); font-size: .85rem; }

.modal { position: fixed; inset: 0; background: rgba(15,10,40,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 20px 12px; }
.modal-caja { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; padding: 18px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.galeria figure { margin: 0; }
.galeria img { width: 100%; border-radius: 8px; background: #eee; min-height: 90px; object-fit: contain; }
.galeria figcaption { font-size: .8rem; color: var(--suave); }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; }
@media (max-width: 420px) { .fila2 { grid-template-columns: 1fr; } .datos { grid-template-columns: 1fr; } .datos dt { margin-top: 6px; } }

/* Horarios */
.proteo-saludo { display: flex; gap: 12px; align-items: center; background: #e9f7ee; border: 1px solid #bfe5cc; border-radius: var(--radio); padding: 12px 14px; margin: 12px 0; }
.proteo-saludo img { width: 64px; height: 64px; flex: none; }
.proteo-saludo p { margin: 0; font-size: .95rem; }
.turno-prog { border-left: 5px solid var(--violeta-2); }
.turno-prog.hoy { border-left-color: var(--ok); background: #f4fbf6; }
.turno-prog.cancelado { opacity: .6; border-left-color: var(--peligro); }
.turno-prog .cuando { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.turno-prog .cuando b { font-size: 1.05rem; }
.turno-prog .hora { font-size: 1.25rem; font-weight: 800; color: var(--violeta); font-variant-numeric: tabular-nums; }
.turno-prog .lugar { margin: 8px 0 4px; }
.turno-prog .acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.semana-titulo { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 20px 0 4px; font-weight: 700; }
.proximo { display: flex; gap: 12px; align-items: center; }
.proximo img { width: 54px; height: 54px; flex: none; }

/* Grilla semanal del panel */
.grilla td, .grilla th { min-width: 118px; }
.grilla td:first-child, .grilla th:first-child { min-width: 170px; position: sticky; left: 0; background: #fff; z-index: 1; }
.grilla th:first-child { background: var(--lila); }
.grilla .hoy-col { background: #f4fbf6; }
.bloque { display: block; width: 100%; text-align: left; background: var(--lila); border: 0; border-left: 4px solid var(--violeta-2); border-radius: 6px; padding: 6px 8px; margin: 3px 0; font-size: .8rem; line-height: 1.3; color: var(--tinta); }
.bloque b { display: block; font-size: .85rem; }
.bloque.cancelado { background: var(--peligro-bg); border-left-color: var(--peligro); text-decoration: line-through; opacity: .75; }
.bloque:hover { outline: 2px solid var(--violeta-2); }
.grilla tfoot td { background: var(--lila); font-weight: 700; }
.barra-semana { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 10px 0; }
.barra-semana > div { min-width: 150px; }
.barra-semana label { margin: 0 0 4px; font-size: .82rem; }
.dias-check { display: flex; flex-wrap: wrap; gap: 6px; }
.dias-check label { margin: 0; display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--linea); border-radius: 999px; padding: 6px 12px; font-weight: 600; cursor: pointer; }
.dias-check input { width: 18px; height: 18px; accent-color: var(--violeta-2); }
.estimado { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 10px 12px; font-weight: 600; margin: 10px 0; }

/* Proteo: chat del coordinador */
.proteo-fab { position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); z-index: 40; display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid #2fa35a; border-radius: 999px; padding: 4px 16px 4px 4px; box-shadow: 0 6px 22px rgba(20,60,30,.25); font-weight: 800; color: #1c6b39; }
.proteo-fab img { width: 48px; height: 48px; }
.proteo-panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 100%); background: #fff; z-index: 60; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(15,10,40,.25); }
.proteo-cab { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; background: #1c6b39; color: #fff; }
.proteo-cab img { width: 44px; height: 44px; background: #fff; border-radius: 50%; }
.proteo-cab div { flex: 1; line-height: 1.2; }
.proteo-cab small { opacity: .85; }
.proteo-cab button { background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; padding: 4px 8px; }
.proteo-msgs { flex: 1; overflow-y: auto; padding: 14px; background: #f5faf6; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; font-size: .93rem; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.msg.yo { align-self: flex-end; background: var(--violeta); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.proteo { align-self: flex-start; background: #fff; border: 1px solid #cfe8d7; border-bottom-left-radius: 4px; }
.msg.proteo p { margin: 4px 0; }
.msg.proteo ul { margin: 4px 0; padding-left: 1.1rem; }
.msg .copiar { margin-top: 6px; }
.msg.pensando { color: var(--suave); font-style: italic; }
.propuesta { align-self: stretch; background: #fff; border: 2px solid #2fa35a; border-radius: 12px; padding: 10px; font-size: .85rem; }
.propuesta table { font-size: .8rem; }
.propuesta td, .propuesta th { padding: 5px 6px; }
.propuesta .aviso-p { color: var(--peligro); font-weight: 700; }
.proteo-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; background: #fff; }
.proteo-chips button { flex: none; border: 1.5px solid #bfe5cc; background: #e9f7ee; color: #1c6b39; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .82rem; }
.proteo-form { display: flex; gap: 8px; padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 64px); background: #fff; border-top: 1px solid var(--linea); }
.proteo-form textarea { min-height: 46px; max-height: 160px; font-size: .95rem; padding: 10px; }
.proteo-form button { flex: none; width: auto; min-height: 46px; margin: 0; background: #1c6b39; }

/* Pedidos a distribuidores */
.ped-prod { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.ped-prod img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.ped-prod .info { flex: 1; min-width: 0; }
.ped-var { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.ped-var span { font-size: .9rem; }
.ped-cant { display: flex; align-items: center; gap: 4px; flex: none; }
.ped-cant button { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--linea); background: #fff; font: inherit; font-weight: 700; color: var(--violeta); cursor: pointer; }
.ped-cant input { width: 54px; padding: 6px; text-align: center; }
.ped-resumen { position: sticky; bottom: 0; background: var(--tarjeta); border: 2px solid var(--violeta-2); border-radius: var(--radio); padding: 12px 14px; margin: 12px 0; box-shadow: 0 -6px 18px rgba(20,16,58,.12); }
.ped-resumen .linea { display: flex; justify-content: space-between; gap: 8px; font-size: .95rem; }
.ped-resumen .total { font-size: 1.15rem; font-weight: 800; color: var(--violeta); }
.ped-barra { height: 8px; background: var(--lila); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.ped-barra i { display: block; height: 100%; background: var(--ok); }
.ped-card .fila { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ped-card .prods { white-space: pre-line; font-size: .88rem; color: var(--suave); margin: 6px 0; }
