/* Lumina móvil · lo propio del teléfono, encima del diseño del panel.
   tokens.css, base.css, lumina.css y vistas/*.css son copias exactas del panel (movil/dev/copiar-diseno.mjs): de ahí salen
   los colores, la tipografía, los botones, las etiquetas, los campos, las burbujas del chat y las filas de eventos.
   Aquí va solo lo que cambia en un teléfono: el marco (barra superior, contenido que se desplaza, barra inferior), las
   áreas seguras, el teclado, los tamaños táctiles (todo lo que se toca mide 44 px o más), las hojas que suben desde abajo
   y las pantallas a una columna. De 320 a 1024 px, vertical y horizontal, claro y oscuro. */

/* ---------- medidas táctiles y texto (los campos van a 16 px: iOS no acerca la pantalla al enfocarlos) ---------- */
:root {
  --opt-control-height: 44px;
  --opt-content-padding: 16px;
  --opt-text-xs: 0.8125rem;
  --opt-text-sm: 0.875rem;
  --opt-text-md: 0.9375rem;
  --opt-text-body: 1rem;
  --opt-text-lead: 1.0625rem;
  --opt-text-section: 1.125rem;
  --opt-text-title: 1.625rem;
  --m-nav-alto: 58px;
  --m-barra-alto: 52px;
  --m-lado-i: max(16px, env(safe-area-inset-left, 0px));
  --m-lado-d: max(16px, env(safe-area-inset-right, 0px));
  --m-arriba: env(safe-area-inset-top, 0px);
  --m-abajo: env(safe-area-inset-bottom, 0px);
}
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  position: fixed; inset: 0; width: 100%; overflow: hidden; overscroll-behavior: none; font-size: var(--opt-text-md);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
input, select, textarea { font-size: 1rem; }
.m-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.m-sin-js { padding: 32px 20px; text-align: center; }
.arranque small { font-size: 0.78125rem; }
.arranque.fuera { pointer-events: none; } /* mientras se desvanece ya se puede tocar lo de abajo */

/* ---------- marco: ocupa la pantalla visible (con el teclado abierto, lo que queda sobre el teclado) ---------- */
.m-raiz { position: absolute; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-alto, 100vh); overflow: hidden; }
@supports (height: 100dvh) { .m-raiz { height: var(--vv-alto, 100dvh); } }
.m-app { position: relative; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto auto; background: var(--opt-background); }
.m-app > .m-franja { grid-row: 1; }
.m-app > .m-barra { grid-row: 2; }
.m-app > .m-contenido { grid-row: 3; }
.m-app > .m-pie { grid-row: 4; }
.m-app > .m-nav { grid-row: 5; }

/* barra superior: título, «volver» visible en toda pantalla interior y acciones */
.m-barra { position: relative; z-index: 5; display: flex; align-items: center; gap: 4px; min-height: calc(var(--m-barra-alto) + var(--m-arriba));
  padding: var(--m-arriba) calc(var(--m-lado-d) - 8px) 0 calc(var(--m-lado-i) - 8px);
  background: var(--vidrio-fuerte); -webkit-backdrop-filter: var(--vidrio-blur-suave); backdrop-filter: var(--vidrio-blur-suave); border-bottom: 1px solid var(--opt-border); }
.m-barra[hidden] { display: none; }
.m-barra-t { flex: 1; min-width: 0; padding: 0 8px; display: grid; gap: 1px; }
.m-barra-t h1 { font-size: 1.1875rem; line-height: 1.2; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: 0; }
.m-barra-t small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-barra .ib { width: 44px; height: 44px; }
.m-volver { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; padding: 0 10px 0 4px; border-radius: var(--opt-radius-pill); color: var(--opt-accent-text); font-weight: 600; font-size: var(--opt-text-md); flex: none; }
.m-volver:active { background: var(--opt-accent-soft); }
.m-volver span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-vivo { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--opt-radius-pill); background: var(--opt-surface-inset); color: var(--opt-text-secondary); font-size: var(--opt-text-xs); font-weight: 600; white-space: nowrap; flex: none; }
.m-vivo.ok { background: var(--opt-success-soft); color: var(--opt-success); }
.m-vivo.ok .dot { background: var(--atendida); animation: pulso-pt 2s ease-in-out infinite; }
.m-vivo.mal { background: var(--opt-warning-soft); color: var(--opt-warning); }
.m-vivo.mal .dot { background: var(--revision); }

/* contenido: lo único que se desplaza; el rebote no arrastra la barra inferior */
.m-contenido { position: relative; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; outline: 0;
  padding: 16px var(--m-lado-d) 28px var(--m-lado-i); scroll-padding-bottom: 96px; }
.m-contenido > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.m-contenido > * + * { margin-top: 16px; }
.m-app.sin-barra .m-contenido { padding-top: calc(16px + var(--m-arriba)); }
.m-app.sin-nav .m-contenido, .m-app.con-pie .m-contenido { padding-bottom: 24px; }
.m-app.sin-nav:not(.con-pie) .m-contenido { padding-bottom: calc(24px + var(--m-abajo)); }

/* pie propio de una pantalla (compositor del chat, botones de revisión): pegado sobre la barra inferior o el teclado */
.m-pie { position: relative; z-index: 4; padding: 10px var(--m-lado-d) 10px var(--m-lado-i); background: var(--vidrio-fuerte); -webkit-backdrop-filter: var(--vidrio-blur-suave); backdrop-filter: var(--vidrio-blur-suave); border-top: 1px solid var(--opt-border); }
.m-pie:empty, .m-pie[hidden] { display: none; }
.m-pie > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.m-app.sin-nav .m-pie, .m-raiz.teclado .m-pie { padding-bottom: calc(10px + var(--m-abajo)); }
.m-raiz.teclado .m-pie { padding-bottom: 10px; }

/* barra inferior: Alertas · Lumina · Avisos · Cuenta */
.m-nav { position: relative; z-index: 6; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 env(safe-area-inset-right, 0px) var(--m-abajo) env(safe-area-inset-left, 0px);
  background: var(--vidrio-fuerte); -webkit-backdrop-filter: var(--vidrio-blur); backdrop-filter: var(--vidrio-blur); border-top: 1px solid var(--opt-border); }
.m-nav[hidden] { display: none; }
.m-nav a { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: var(--m-nav-alto); min-width: 44px; padding: 6px 2px; color: var(--opt-text-secondary); font-size: 0.71875rem; font-weight: 600; letter-spacing: 0; line-height: 1.2;
  transition: color var(--opt-duration-fast); }
.m-nav a .ic { width: 24px; height: 24px; transition: transform .4s var(--resorte), color var(--opt-duration-fast); }
.m-nav a span.t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-nav a[aria-current=page] { color: var(--opt-heading); }
.m-nav a[aria-current=page] .ic { color: var(--lumina); transform: scale(1.08); }
.m-nav a:active .ic { transform: scale(.9); }
.m-nav a:focus-visible { outline-offset: -3px; border-radius: 10px; }
.m-nav .m-cuenta { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--opt-radius-pill); background: var(--lumina); color: #0B131B; font-size: 0.6875rem; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.m-nav .m-cuenta[hidden] { display: none; }
/* con el teclado abierto la barra inferior se guarda: el campo y su botón quedan justo encima del teclado */
.m-raiz.teclado .m-nav { display: none; }

/* horizontal en un teléfono o pantalla ancha: la barra pasa al costado */
@media (orientation: landscape) and (max-height: 540px), (min-width: 900px) {
  .m-app:not(.sin-nav) { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .m-app:not(.sin-nav) > .m-franja { grid-column: 1 / -1; }
  .m-app:not(.sin-nav) > .m-barra, .m-app:not(.sin-nav) > .m-contenido, .m-app:not(.sin-nav) > .m-pie { grid-column: 2; }
  .m-app:not(.sin-nav) > .m-barra { padding-left: 8px; }
  .m-app:not(.sin-nav) > .m-contenido, .m-app:not(.sin-nav) > .m-pie { padding-left: 16px; }
  .m-app:not(.sin-nav) > .m-nav { grid-column: 1; grid-row: 2 / -1; grid-template-columns: none; grid-auto-rows: min-content; align-content: start; gap: 2px; width: calc(76px + env(safe-area-inset-left, 0px));
    padding: calc(6px + var(--m-arriba)) 0 var(--m-abajo) env(safe-area-inset-left, 0px); border-top: 0; border-right: 1px solid var(--opt-border); overflow-y: auto; }
  .m-app:not(.sin-nav) > .m-franja ~ .m-nav { padding-top: 6px; }
  .m-app:not(.sin-nav) > .m-nav a { min-height: 54px; }
  .m-raiz.teclado .m-app:not(.sin-nav) > .m-nav { display: grid; }
  .m-app:not(.sin-nav) > .m-pie { padding-bottom: calc(10px + var(--m-abajo)); }
}

/* franja de conexión: arriba de todo, no se va sola y deja reintentar */
.m-franja { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; min-height: 44px; padding: calc(6px + var(--m-arriba)) var(--m-lado-d) 6px var(--m-lado-i);
  background: var(--opt-error); color: #fff; font-size: var(--opt-text-sm); font-weight: 600; text-align: center; }
.m-franja[hidden] { display: none; }
.m-franja > span { display: inline-flex; align-items: center; gap: 8px; }
.m-franja .btn { min-height: 36px; background: #fff; color: #0B131B; box-shadow: none; }
:root[data-theme=oscuro] .m-franja { color: #0B131B; }
.m-franja:not([hidden]) ~ .m-barra { padding-top: 0; min-height: var(--m-barra-alto); }
.m-app:has(> .m-franja:not([hidden])).sin-barra .m-contenido { padding-top: 16px; }

/* ---------- tamaños táctiles sobre los componentes del panel ---------- */
.btn { min-height: 44px; }
.btn.chico { min-height: 44px; padding: 0 14px; }
.btn.t.chico { padding: 0 10px; }
.btn:hover { transform: none; }
.ib, .cerrar-x, .mas { width: 44px; height: 44px; }
.tabs { display: flex; }
.tabs [role=tab], .tabs button { min-height: 44px; padding: 0 14px; flex: 1 0 auto; justify-content: center; }
.seg button { min-height: 44px; padding: 0 14px; }
.lu-pill { min-height: 44px; height: auto; padding: 0 14px; font-size: var(--opt-text-sm); }
.form input, .form select, .form textarea, .campo { min-height: 44px; font-size: 1rem; width: 100%; }
.form label { font-size: var(--opt-text-sm); }
select.campo, .form select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%235E6A71' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme=oscuro] select.campo, :root[data-theme=oscuro] .form select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23A1A1A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select.campo option, .form select option { color: #0B131B; background: #fff; }
.card { padding: 16px; }
.card-head { margin-bottom: 12px; }
.vacio { padding: 32px 12px; }
.vacio p { font-size: var(--opt-text-sm); }
.chip { min-height: 26px; font-size: var(--opt-text-xs); white-space: normal; line-height: 1.2; padding: 3px 10px; }
.ayuda { font-size: var(--opt-text-xs); }
.error-campo { font-size: var(--opt-text-sm); }
.botones { margin-top: 16px; }
.botones .btn { flex: 1 1 auto; }
h2 { font-size: var(--opt-text-section); }

/* interruptor: toda la fila es el botón (≥ 44 px); adentro, el interruptor del panel */
.m-fila-sw { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 0; text-align: left; color: var(--opt-text); }
.m-fila-sw > span:first-child { flex: 1; min-width: 0; display: grid; gap: 2px; }
.m-fila-sw b { font-weight: 600; color: var(--opt-heading); }
.m-fila-sw small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); line-height: 1.4; }
.m-fila-sw[aria-checked=true] .sw { background: var(--atendida); }
.m-fila-sw[aria-checked=true] .sw::after { transform: translateX(18px); }
.m-fila-sw:disabled { opacity: .55; }
.m-fila-sw[aria-busy=true] .sw { opacity: .6; }

/* ---------- avisos (los del panel, arriba y al centro) ---------- */
/* bajo la barra superior: un aviso nunca tapa el botón «volver» */
.m-avisos { position: absolute; z-index: 40; top: calc(var(--m-arriba) + var(--m-barra-alto) + 8px); left: var(--m-lado-i); right: var(--m-lado-d); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.m-avisos .toast { max-width: min(440px, 100%); border-radius: 16px; padding: 8px 10px; font-size: var(--opt-text-sm); animation-name: m-aviso-entra; }
.m-avisos .toast > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.m-avisos .toast .btn { min-height: 44px; flex: none; }
/* un aviso no frena los toques: pasan a lo que tiene debajo (solo su botón se puede tocar) */
.m-avisos .toast { pointer-events: none; }
.m-avisos .toast .btn { pointer-events: auto; }
@keyframes m-aviso-entra { from { opacity: 0; transform: translateY(-14px) scale(.97); } }

/* ---------- hojas: suben desde abajo (en pantalla ancha, al centro) ---------- */
.m-velo { position: absolute; inset: 0; z-index: 30; display: grid; align-items: end; justify-items: center; background: var(--opt-overlay); -webkit-backdrop-filter: blur(10px) saturate(120%); backdrop-filter: blur(10px) saturate(120%); animation: m-velo .3s var(--llegada); }
@keyframes m-velo { from { background: transparent; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
.m-hoja { position: relative; width: 100%; max-width: 640px; max-height: calc(100% - 24px - var(--m-arriba)); display: flex; flex-direction: column; border-radius: 16px 16px 0 0;
  background: var(--opt-surface); box-shadow: var(--opt-shadow-lg), var(--vidrio-filo); animation: m-hoja-sube .42s var(--llegada); outline: 0; }
:root[data-theme=oscuro] .m-hoja { background: #1A1A1D; }
@keyframes m-hoja-sube { from { transform: translateY(40px); opacity: 0; } }
.m-hoja-cab { flex: none; display: flex; align-items: flex-start; gap: 8px; padding: 14px 8px 6px 20px; }
.m-hoja-cab > div { flex: 1; min-width: 0; padding-top: 8px; }
.m-hoja-cab h2 { font-size: 1.25rem; letter-spacing: -0.02em; outline: 0; overflow-wrap: anywhere; }
.m-hoja-cab p { margin-top: 4px; color: var(--opt-text-secondary); font-size: var(--opt-text-sm); }
.m-hoja-cuerpo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 8px max(20px, env(safe-area-inset-right, 0px)) 8px max(20px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; align-content: start; }
.m-hoja-pie { flex: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 12px max(20px, env(safe-area-inset-right, 0px)) calc(14px + var(--m-abajo)) max(20px, env(safe-area-inset-left, 0px)); }
.m-hoja-pie .btn { flex: 1 1 140px; }
.m-raiz.teclado .m-hoja-pie { padding-bottom: 12px; }
.m-hoja-cuerpo:last-child { padding-bottom: calc(20px + var(--m-abajo)); }
@media (min-width: 700px) and (min-height: 541px) {
  .m-velo { align-items: center; padding: 24px; }
  .m-hoja { border-radius: var(--opt-radius-large); max-width: 560px; max-height: calc(100% - 48px); animation-name: dialogo; }
  .m-hoja-pie { padding-bottom: 16px; }
  .m-hoja-cuerpo:last-child { padding-bottom: 20px; }
}

/* ---------- conectar e ingreso: la caja del panel, a pantalla completa en un teléfono ---------- */
.m-entrada { display: grid; gap: 14px; justify-items: center; align-content: start; min-height: 100%; }
.m-entrada > * { width: 100%; max-width: 420px; }
.m-entrada .ingreso-caja { max-width: 420px; padding: 24px 20px; gap: 18px; }
.m-entrada h1 { font-size: 1.375rem; letter-spacing: -0.025em; outline: 0; }
.m-entrada .ingreso-marca small { font-size: 0.625rem; }
.m-entrada .ing-tabs [role=tab] { flex: 1 1 0; }
.m-entrada .cc-tit { font-size: 1.375rem; margin-bottom: -10px; }
.m-entrada .cc-pie { margin-top: -2px; }
.m-entrada .ingreso-pie { padding-top: 14px; flex-wrap: wrap; align-items: center; }
.m-entrada .ingreso-pie > span { flex: 1 1 200px; min-width: 0; }
.m-planta-cod { font-family: var(--opt-font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
#cc-k { font-family: var(--opt-font-mono); }
.m-entrada-nota { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--opt-radius-card); background: var(--opt-warning-soft); color: var(--opt-text); font-size: var(--opt-text-sm); line-height: 1.45; }
.m-entrada-nota .ic { flex: none; margin-top: 2px; color: var(--opt-warning); }
.m-entrada-nota > div { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: start; }

/* aviso «Instalar Lumina» (se puede descartar) y hoja con los pasos */
.m-instalar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-radius: var(--opt-radius-card); background: var(--opt-surface); box-shadow: var(--vidrio-filo), var(--opt-shadow-sm); }
.m-instalar > .ic { flex: none; color: var(--lumina); }
.m-instalar-btn { flex: 1; min-width: 0; min-height: 44px; display: grid; gap: 1px; padding: 4px 8px; text-align: left; border-radius: 8px; }
.m-instalar-btn b { color: var(--opt-heading); font-weight: 600; }
.m-instalar-btn small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); }
.m-pasos { list-style: none; padding: 0; display: grid; gap: 12px; counter-reset: paso; }
.m-pasos li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border-radius: var(--opt-radius-card); background: var(--opt-surface-inset); counter-increment: paso; }
.m-pasos .m-paso-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--opt-surface-raised); color: #0A84FF; box-shadow: inset 0 0 0 1px var(--opt-border); }
.m-pasos .m-paso-ico .ic { width: 24px; height: 24px; }
.m-pasos .m-paso-ico b { font-size: 0.9375rem; font-weight: 600; }
.m-pasos li > div { min-width: 0; display: grid; gap: 2px; }
.m-pasos li b.t::before { content: counter(paso) ". "; color: var(--opt-text-secondary); font-weight: 600; }
.m-pasos li b.t { color: var(--opt-heading); font-weight: 600; }
.m-pasos li small { color: var(--opt-text-secondary); font-size: var(--opt-text-sm); line-height: 1.4; }

/* ---------- Alertas: pestañas, filtros y lista ---------- */
.m-tabs-fila { display: flex; gap: 8px; align-items: center; }
.m-tabs-fila .tabs { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.m-tabs-fila .tabs::-webkit-scrollbar { display: none; }
.m-tabs-fila .tabs .contador { min-width: 22px; height: 20px; font-size: 0.71875rem; }
.m-activos { display: flex; flex-wrap: wrap; gap: 8px; }
.m-activos:empty { display: none; }
.m-activos .pill { min-height: 44px; font-size: var(--opt-text-sm); }
.m-tirar { display: grid; place-items: center; height: 0; overflow: hidden; color: var(--opt-text-secondary); font-size: var(--opt-text-xs); transition: height .25s var(--llegada); margin-top: 0 !important; }
.m-tirar.viendo { transition: none; }
.m-tirar span { display: inline-flex; align-items: center; gap: 8px; }
.m-tirar.cargando .ic { animation: giro .8s linear infinite; }
.m-tirar + * { margin-top: 0; }
.m-lista { list-style: none; padding: 0; display: grid; gap: 8px; }
.m-ev { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px; text-align: left; border-radius: var(--opt-radius-card);
  background: var(--opt-surface); box-shadow: var(--vidrio-filo), var(--opt-shadow-sm); color: inherit; transition: transform .3s var(--llegada), box-shadow .3s; }
.m-ev:active { transform: scale(.985); }
.m-ev.nueva { animation: m-ev-nueva 1.6s var(--llegada); }
@keyframes m-ev-nueva { from { box-shadow: inset 0 0 0 2px var(--lumina), 0 12px 28px -16px rgba(236, 109, 39, .6); transform: translateY(-6px); opacity: .4; } }
.m-ev-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; background: var(--opt-surface-inset); color: var(--opt-heading); }
.m-ev-ico.alta { background: var(--opt-error-soft); color: var(--opt-error); }
.m-ev-ico.media { background: var(--opt-warning-soft); color: var(--opt-warning); }
.m-ev-ico .ic { width: 22px; height: 22px; }
.m-ev > .ic { color: var(--opt-text-muted); }
.m-ev .ev-fila-txt b { font-size: var(--opt-text-body); }
.m-ev .ev-fila-ext .chip { min-height: 22px; font-size: 0.75rem; padding: 2px 8px; }
.m-mas { display: grid; justify-items: center; gap: 8px; color: var(--opt-text-secondary); font-size: var(--opt-text-sm); text-align: center; }
.m-ia-pt { display: inline-flex; align-items: center; gap: 4px; }
.m-ia-pt img { width: 12px; height: 12px; }

/* ---------- Detalle de una alerta ---------- */
.m-det { display: grid; gap: 0; }
.m-det .ev-d-titulo h2 { font-size: 1.5rem; }
.m-det .ev-media { margin-top: 14px; }
.m-evid { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--opt-video); box-shadow: 0 0 0 1px rgba(11, 19, 27, .06); }
.m-evid img, .m-evid svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m-evid img { object-fit: contain; }
.m-evid .ev-sin, .m-evid .ev-cargando { position: absolute; inset: 0; }
.m-evid-caja { fill: none; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.m-evid-caja.persona { stroke: #FFB340; }
.m-evid-caja.montacargas { stroke: #64A8FF; }
.m-evid-caja.epp { stroke: #30D158; stroke-dasharray: 4 3; }
.m-evid-zona { fill: rgba(236, 109, 39, .12); stroke: #EC6D27; stroke-width: 2; vector-effect: non-scaling-stroke; }
.m-evid-leyenda { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; color: var(--opt-text-secondary); font-size: var(--opt-text-xs); }
.m-evid-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.m-evid-leyenda i { width: 12px; height: 12px; border-radius: 3px; border: 2px solid currentColor; }
.m-evid-leyenda .persona i { color: #C77F00; } .m-evid-leyenda .montacargas i { color: #2F64B5; } .m-evid-leyenda .epp i { color: #127543; border-style: dashed; } .m-evid-leyenda .zona i { color: #EC6D27; }
.m-det .ev-estados { margin-left: 0; width: 100%; }
.m-det .ev-dl { grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); gap: 9px 14px; }
.m-det .ev-accion { flex-wrap: wrap; }
.m-det .ev-accion small { max-width: 100%; flex: 1 1 100%; text-align: left; padding-left: 27px; }
.m-det .ev-decidir .campo { height: auto; min-height: 44px; }
.m-det .ev-decidir { margin: 14px 0 0; }
.m-det .ev-dec-b { margin-left: 0; width: 100%; }
.m-det .ev-dec-b .btn { flex: 1 1 0; }
.m-det .ev-nota textarea { min-height: 72px; }
.m-rol-nota { display: flex; align-items: flex-start; gap: 10px; color: var(--opt-text-secondary); font-size: var(--opt-text-sm); line-height: 1.45; }
.m-rol-nota .ic { flex: none; margin-top: 2px; }
.m-acciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.m-acciones .btn { padding: 0 10px; white-space: normal; line-height: 1.2; min-width: 0; }
.m-acciones .btn.ancha { grid-column: 1 / -1; }
.m-acciones:empty { display: none; }
.m-guardado { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: var(--opt-text-sm); font-weight: 500; }
.m-guardado:empty { display: none; }
.m-guardado.ok { color: var(--opt-success); } .m-guardado.pend { color: var(--opt-warning); } .m-guardado.error { color: var(--opt-error); }
.m-sugerencia { display: grid; gap: 4px; margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: var(--opt-accent-soft); font-size: var(--opt-text-sm); line-height: 1.45; }
.m-sugerencia p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--opt-heading); }
.m-sugerencia img { width: 14px; height: 14px; }
.m-sugerencia small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); }
.m-preguntar { margin-top: 14px; width: 100%; }

/* ---------- Lumina (chat): las burbujas y tarjetas del panel, en una columna ---------- */
.m-chat { display: flex; flex-direction: column; gap: 18px; min-height: 100%; }
.m-chat .lu-msg.yo p { max-width: 86%; font-size: var(--opt-text-md); }
.m-chat .lu-burbuja { font-size: var(--opt-text-md); }
.m-chat .lu-burbuja pre { max-width: 100%; }
.m-chat .lu-tarj { flex-wrap: wrap; }
.m-chat .lu-tarj > span:nth-child(2) { flex: 1 1 160px; }
.m-chat .lu-tarj b { font-size: var(--opt-text-sm); overflow-wrap: anywhere; }
.m-chat .lu-tarj small { font-size: var(--opt-text-xs); }
.m-chat .lu-tarj-acc { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; }
.m-chat .lu-tarj-acc:empty { display: none; }
.m-chat .lu-msg-adj { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-bottom: 6px; }
.m-chat .lu-msg.yo { flex-direction: column; align-items: flex-end; }
.m-chat .lu-msg-adj figure { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--opt-surface-inset); }
.m-chat .lu-msg-adj img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-bienvenida { margin: auto 0; display: grid; gap: 6px; justify-items: center; text-align: center; padding: 8px 0; }
.m-bienvenida img { width: 44px; height: 44px; margin-bottom: 6px; }
.m-bienvenida h2 { font-size: 1.375rem; letter-spacing: -0.025em; }
.m-bienvenida p { color: var(--opt-text-secondary); font-size: var(--opt-text-sm); max-width: 34em; }
.m-bienvenida .lu-sugerencias { width: 100%; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
.m-bienvenida .lu-sug { min-height: 56px; }
.m-bienvenida .lu-sug b, .m-bienvenida .lu-sug small { white-space: normal; }
.m-bienvenida .lu-sug b { font-size: var(--opt-text-sm); }
.m-bienvenida .lu-sug small { font-size: var(--opt-text-xs); }
@media (min-width: 600px) { .m-bienvenida .lu-sugerencias { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.m-legal { color: var(--opt-text-muted); font-size: 0.75rem; text-align: center; line-height: 1.4; }
.m-compositor { display: grid; gap: 8px; }
.m-compositor .lu-compositor { padding: 4px 4px 4px 4px; align-items: flex-end; border-radius: 26px; }
.m-compositor .lu-compositor textarea { font-size: 1rem; line-height: 1.4; min-height: 44px; max-height: 132px; padding: 11px 0; }
.m-compositor .lu-compositor:focus-within { border-color: var(--opt-accent-border); box-shadow: 0 0 0 4px var(--opt-accent-soft); }
.m-compositor .lu-enviar, .m-adjuntar { width: 44px; height: 44px; flex: none; }
.m-adjuntar { display: grid; place-items: center; border-radius: 50%; color: var(--opt-text-secondary); }
.m-adjuntar:active { background: var(--opt-surface-inset); }
.m-compositor.escribiendo .lu-enviar { background: var(--lumina); color: #0B131B; }
.m-adjuntos { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.m-adjuntos:empty { display: none; }
.m-adj { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--opt-surface-inset); display: grid; place-items: center; }
.m-adj img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-adj.leyendo::after { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--opt-text-secondary); border-right-color: transparent; animation: giro .8s linear infinite; }
.m-adj button { position: absolute; inset: 0; display: grid; place-items: start end; padding: 3px; color: #fff; }
.m-adj button i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(11, 19, 27, .72); font-style: normal; }
.m-adj button .ic { width: 12px; height: 12px; }
.m-chat-aviso { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--opt-warning-soft); color: var(--opt-text); font-size: var(--opt-text-sm); line-height: 1.4; }
.m-chat-aviso .ic { flex: none; margin-top: 2px; color: var(--opt-warning); }
.m-chat-aviso span { flex: 1; min-width: 0; }
.m-convs { list-style: none; padding: 0; display: grid; gap: 6px; }
.m-conv { display: flex; align-items: center; gap: 4px; border-radius: 10px; background: var(--opt-surface-inset); }
.m-conv[aria-current=true] { box-shadow: inset 0 0 0 1.5px var(--lumina); background: var(--opt-surface-raised); }
.m-conv > button:first-child { flex: 1; min-width: 0; min-height: 56px; padding: 8px 12px; text-align: left; display: grid; gap: 2px; border-radius: 10px; }
.m-conv b { color: var(--opt-heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-conv small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); }
/* visuales del chat (cifras, barras, tablas…) dibujados con nodos, nunca con HTML del servidor */
.m-visual { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--opt-border); border-radius: var(--opt-radius-card); background: var(--opt-surface); min-width: 0; }
.m-visual > b { color: var(--opt-heading); font-size: var(--opt-text-sm); }
.m-visual > small { color: var(--opt-text-muted); font-size: var(--opt-text-xs); }
.m-cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.m-cifra { display: grid; gap: 2px; padding: 10px; border-radius: 8px; background: var(--opt-surface-inset); min-width: 0; }
.m-cifra small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); }
.m-cifra strong { color: var(--opt-heading); font-size: 1.375rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.m-barras { display: grid; gap: 8px; }
.m-barra-h { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: var(--opt-text-sm); }
.m-barra-h .riel { grid-column: 1 / -1; height: 8px; border-radius: 8px; background: var(--opt-surface-inset); overflow: hidden; }
.m-barra-h .riel i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--lumina-claro), var(--lumina)); }
.m-barra-h b { color: var(--opt-heading); font-variant-numeric: tabular-nums; }
.m-barra-h span { min-width: 0; overflow-wrap: anywhere; }
.m-tabla-caja { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.m-tabla-caja table { font-size: var(--opt-text-sm); }
.m-tabla-caja th, .m-tabla-caja td { padding: 8px 10px; white-space: nowrap; }
.m-hitos { list-style: none; padding: 0; display: grid; gap: 10px; }
.m-hitos li { display: grid; gap: 2px; padding-left: 14px; border-left: 2px solid var(--opt-border-strong); font-size: var(--opt-text-sm); }
.m-hitos li.hecho { border-left-color: var(--atendida); }
.m-hitos small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); }
.m-opciones { display: grid; gap: 8px; }
.m-opciones .btn { justify-content: flex-start; text-align: left; white-space: normal; height: auto; padding: 10px 16px; line-height: 1.3; }

/* ---------- Avisos: canales, notificaciones del teléfono, contactos y envíos ---------- */
.m-seccion { display: grid; gap: 12px; }
.m-seccion > h2 { padding: 0 2px; }
.m-seccion > p.ayuda { padding: 0 2px; margin-top: -6px; }
.m-canal { display: grid; gap: 12px; }
.m-canal-cab { display: flex; align-items: flex-start; gap: 12px; }
.m-canal .al-ico { width: 44px; height: 44px; }
.m-canal .al-ico .ic { width: 22px; height: 22px; }
.m-canal .al-c-t h3 { font-size: var(--opt-text-body); }
.m-canal .al-quien { font-size: var(--opt-text-sm); }
.m-canal-acc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.m-canal-acc .btn { flex: 1 1 120px; }
.m-canal .m-fila-sw { padding: 0; border-top: 1px solid var(--opt-border); padding-top: 10px; }
.m-resultado { padding: 10px 12px; border-radius: 8px; font-size: var(--opt-text-sm); line-height: 1.45; overflow-wrap: anywhere; }
.m-resultado.ok { background: var(--opt-success-soft); } .m-resultado.mal { background: var(--opt-error-soft); }
.m-envios { list-style: none; padding: 0; display: grid; gap: 8px; }
.m-envio { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: var(--opt-radius-card); background: var(--opt-surface); box-shadow: var(--vidrio-filo); }
.m-envio .ct-canal { width: 36px; height: 36px; }
.m-envio > div { min-width: 0; display: grid; gap: 4px; }
.m-envio-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.m-envio-cab b { color: var(--opt-heading); font-weight: 600; }
.m-envio .al-ev { min-height: 44px; }
.m-envio small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); overflow-wrap: anywhere; line-height: 1.4; }
.m-contacto { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 12px; text-align: left; border-radius: var(--opt-radius-card); background: var(--opt-surface); box-shadow: var(--vidrio-filo), var(--opt-shadow-sm); color: inherit; }
.m-contacto .ct-ini { width: 44px; height: 44px; }
.m-contacto > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.m-contacto b { color: var(--opt-heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-contacto small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); overflow-wrap: anywhere; }
.m-contacto.pausado b { color: var(--opt-text-secondary); }
.m-contacto > .ic { color: var(--opt-text-muted); }
.m-grupo { display: grid; gap: 4px; margin: 0; padding: 12px 14px; border: 0; border-radius: var(--opt-radius-card); background: var(--opt-surface-inset); min-width: 0; }
.m-grupo legend { float: left; width: 100%; padding: 0 0 4px; color: var(--opt-heading); font-weight: 600; font-size: var(--opt-text-sm); }
.m-grupo legend + * { clear: both; }
.m-marca { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 500; font-size: var(--opt-text-md); color: var(--opt-text); }
.m-marca input { width: 22px; height: 22px; flex: none; accent-color: var(--lumina); }
.m-min { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.m-min label { display: grid; gap: 6px; font-weight: 600; font-size: var(--opt-text-sm); }

/* ---------- Cuenta ---------- */
.m-perfil { display: flex; align-items: center; gap: 14px; }
.m-perfil .avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 1.125rem; font-weight: 700; letter-spacing: 0.02em; background: linear-gradient(140deg, var(--lumina-claro), var(--lumina)); color: #0B131B; }
.m-perfil > div { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.m-perfil b { color: var(--opt-heading); font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.m-perfil small { color: var(--opt-text-secondary); font-size: var(--opt-text-sm); overflow-wrap: anywhere; }
.m-filas { display: grid; padding: 4px 16px; }
.m-fila { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 0; text-align: left; color: var(--opt-text); border-bottom: 1px solid var(--opt-border); }
.m-filas > :last-child { border-bottom: 0; }
.m-fila > .ic { flex: none; color: var(--opt-text-secondary); }
.m-fila > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.m-fila b { color: var(--opt-heading); font-weight: 600; }
.m-fila small { color: var(--opt-text-secondary); font-size: var(--opt-text-xs); line-height: 1.4; overflow-wrap: anywhere; }
.m-fila.peligro b, .m-fila.peligro > .ic { color: var(--opt-error); }
.m-fila > .ic:last-child { color: var(--opt-text-muted); }
.m-filas .m-fila-sw { min-height: 56px; border-bottom: 1px solid var(--opt-border); padding: 8px 0; }
.m-tema { display: grid; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--opt-border); }
.m-tema .seg { display: flex; width: 100%; }
.m-tema .seg button { flex: 1 1 0; justify-content: center; padding: 0 6px; }
.m-version { color: var(--opt-text-muted); font-size: var(--opt-text-xs); text-align: center; }

/* ---------- pantallas muy angostas (320 px) y movimiento reducido ---------- */
@media (max-width: 359px) {
  :root { --m-lado-i: max(12px, env(safe-area-inset-left, 0px)); --m-lado-d: max(12px, env(safe-area-inset-right, 0px)); }
  .m-entrada .ingreso-caja { padding: 20px 14px; }
  .card { padding: 14px; }
  .tabs [role=tab], .tabs button { padding: 0 10px; }
  .m-acciones .btn { font-size: var(--opt-text-sm); }
  .m-min { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
