/* app.css · MO - APP · MontOfi
 *
 * Marca: negro, blanco y celeste. Nada de naranja ni del azul marino de ML App.
 *
 * Los tokens se declaran TRES veces a propósito (CLAUDE.md):
 *   1. :root                                              → claro, y valor por defecto
 *   2. @media (prefers-color-scheme: dark) :root:not([data-theme="light"])
 *   3. :root[data-theme="dark"]                           → el alternador manual
 * Olvidar el tercero es el fallo clásico: con el sistema en oscuro se ve bien, pero el
 * botón de tema no hace nada. El :not([data-theme="light"]) del segundo es lo que deja
 * al usuario forzar el claro teniendo el sistema en oscuro.
 *
 * MÓVIL PRIMERO. El montador maneja el teléfono con una mano en mitad de una obra:
 * todo lo pulsable mide 44 px, las acciones principales caen abajo y las listas ganan
 * a las tablas (las tablas solo se despliegan de 700 px para arriba).
 */

/* ── Tipografías, servidas desde aquí ───────────────────────────────────────
 *
 * POR QUÉ NO SE PIDEN A GOOGLE. Antes había un <link> a fonts.googleapis.com en
 * index.html. Eso es una petición a un tercero desde el navegador de CADA
 * empleado y CADA cliente que abre un presupuesto, con su IP. Aquí se sirven
 * desde el propio dominio: se acabó el aviso de RGPD y, de paso, la app carga
 * con su tipografía sin cobertura, que es donde trabaja el montador.
 *
 * SON CINCO ARCHIVOS Y NO NUEVE porque Archivo e IBM Plex Sans son fuentes
 * VARIABLES: un solo archivo cubre todo su rango de pesos. Duplicarlo por peso
 * eran 157 KB de más en cada carga.
 *
 * El subconjunto es «latin», que cubre el español entero (tildes, ñ, ü, ¿, ¡).
 * `font-display: swap` para que el texto se lea desde el primer momento con la
 * fuente de respaldo en vez de quedarse en blanco esperando.
 * Licencias en assets/fuentes/LICENCIAS.txt · las dos familias son OFL.
 */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('assets/fuentes/archivo.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fuentes/plex-sans.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Plex Mono no es variable: aquí sí hace falta un archivo por peso. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fuentes/plex-mono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fuentes/plex-mono-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fuentes/plex-mono-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --paper:   #F5F8FA;
  --surface: #FFFFFF;
  --ink:     #0D1317;
  --muted:   #56656F;
  --line:    #CCDBE5;
  --accent:  #1B7FBE;   /* celeste con contraste suficiente para TEXTO */
  --celeste: #6FC2EC;   /* celeste puro, solo para RELLENOS y filetes */

  /* Texto que va encima de un relleno --accent. */
  --sobre-acento: #FFFFFF;

  /* Estados. No están en la paleta de marca porque no son marca: son semáforo.
     Siempre acompañados de texto; un punto de color a secas no lo lee todo el mundo. */
  --ok:     #1F7A4D;
  --aviso:  #9A6511;
  --error:  #B3261E;
  --ok-suave:    #E4F4EC;
  --aviso-suave: #FBF0DC;
  --error-suave: #FBE7E5;

  --sombra:      0 1px 2px rgba(13, 19, 23, .06), 0 4px 14px rgba(13, 19, 23, .05);
  --sombra-alta: 0 8px 30px rgba(13, 19, 23, .18);
  --velo:        rgba(13, 19, 23, .46);
  --hover:       rgba(13, 19, 23, .045);

  /* Geometría del armazón, copiada de lo que ya funciona en ML App: barra fija
     arriba y lateral solo en pantalla ancha. */
  --mo-top-h:  52px;
  --mo-side-w: 212px;
  --radio:     10px;
  --radio-s:   7px;

  --fuente-titular: "Archivo", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --fuente-cuerpo:  "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --fuente-datos:   "IBM Plex Mono", "Cascadia Mono", Consolas, "Courier New", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #0A0E11;
    --surface: #121A1F;
    --ink:     #EAF1F6;
    --muted:   #93A5B0;
    --line:    #27333B;
    --accent:  #6FC2EC;
    --celeste: #9AD6F5;
    --sobre-acento: #08131B;

    --ok:     #6FD3A3;
    --aviso:  #E8B761;
    --error:  #F28B84;
    --ok-suave:    #10261E;
    --aviso-suave: #2A2214;
    --error-suave: #2C1615;

    --sombra:      0 1px 2px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .38);
    --sombra-alta: 0 8px 30px rgba(0, 0, 0, .6);
    --velo:        rgba(0, 0, 0, .62);
    --hover:       rgba(234, 241, 246, .06);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:   #0A0E11;
  --surface: #121A1F;
  --ink:     #EAF1F6;
  --muted:   #93A5B0;
  --line:    #27333B;
  --accent:  #6FC2EC;
  --celeste: #9AD6F5;
  --sobre-acento: #08131B;

  --ok:     #6FD3A3;
  --aviso:  #E8B761;
  --error:  #F28B84;
  --ok-suave:    #10261E;
  --aviso-suave: #2A2214;
  --error-suave: #2C1615;

  --sombra:      0 1px 2px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .38);
  --sombra-alta: 0 8px 30px rgba(0, 0, 0, .6);
  --velo:        rgba(0, 0, 0, .62);
  --hover:       rgba(234, 241, 246, .06);

  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--fuente-cuerpo);
  font-size: 16px;           /* 16 px justos: por debajo, iOS hace zoom al enfocar un input */
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { font-family: var(--fuente-titular); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

a { color: var(--accent); }

/* Alpine quita x-cloak al arrancar. Sin esto se ve el HTML crudo un instante. */
[x-cloak] { display: none !important; }

.mo-mono,
.mo-num { font-family: var(--fuente-datos); font-variant-numeric: tabular-nums; }
.mo-muted { color: var(--muted); }
.mo-sr {   /* solo para lectores de pantalla */
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Armazón: barra superior, lateral y cajón ───────────────────────────── */

.mo-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--mo-top-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  display: flex; align-items: stretch; gap: 4px;
  padding-left: 6px; padding-right: 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  /* El filete celeste es la única nota de color de la barra: marca sin gritar. */
  box-shadow: inset 0 -3px 0 var(--celeste), var(--sombra);
}

.mo-top__burger {
  flex: 0 0 auto; width: 44px; min-height: 44px; align-self: center;
  background: transparent; border: 0; color: var(--ink);
  font-size: 20px; line-height: 1; cursor: pointer; border-radius: var(--radio-s);
}
.mo-top__burger:hover { background: var(--hover); }

.mo-marca {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--fuente-titular); font-weight: 800; letter-spacing: .02em;
  font-size: 17px; color: var(--ink);
  background: transparent; border: 0; cursor: pointer; padding: 0 6px; min-height: 44px;
}
.mo-marca__punto {
  width: 10px; height: 10px; border-radius: 50%; background: var(--celeste);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--celeste) 28%, transparent);
}

.mo-top__dominios { display: none; }        /* en móvil los dominios viven en el cajón */
.mo-top__hueco { flex: 1 1 auto; }
.mo-top__acciones { display: flex; align-items: center; gap: 2px; }

.mo-icono-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--radio-s);
  color: var(--ink); font-size: 17px; cursor: pointer;
}
.mo-icono-btn:hover { background: var(--hover); }

.mo-usuario {
  display: none; align-items: center; gap: 8px; padding: 0 10px; min-height: 44px;
  border-left: 1px solid var(--line); margin-left: 4px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.mo-usuario strong { color: var(--ink); font-weight: 600; }

.mo-side { display: none; }

.mo-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: 272px; max-width: 86vw; z-index: 90;
  background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: var(--sombra-alta); overflow-y: auto;
  padding: 10px 10px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-100%); transition: transform .18s ease, visibility .18s;
  visibility: hidden;   /* cerrado no se ve Y tampoco se alcanza con el tabulador */
}
.mo-drawer.abierto { transform: translateX(0); visibility: visible; }
.mo-drawer-velo { position: fixed; inset: 0; background: var(--velo); z-index: 89; }

.mo-nav-i {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px;
  padding: 10px 12px; margin-bottom: 2px;
  border: 0; border-radius: var(--radio-s); background: transparent;
  font-family: var(--fuente-titular); font-weight: 600; font-size: 15px;
  color: var(--ink); text-align: left; cursor: pointer;
}
.mo-nav-i:hover { background: var(--hover); }
.mo-nav-i.on {
  background: color-mix(in srgb, var(--celeste) 22%, transparent);
  /* Además del color, una barra a la izquierda: el activo se distingue sin ver color. */
  box-shadow: inset 3px 0 0 var(--accent);
}
.mo-nav-i[disabled] { opacity: .45; cursor: not-allowed; }
.mo-nav-i__ico { width: 22px; text-align: center; font-size: 16px; }
.mo-nav-i__falta { margin-left: auto; font-family: var(--fuente-datos); font-size: 10px; color: var(--muted); }

.mo-nav-t {
  font-family: var(--fuente-datos); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px;
}

/* El contenido vive por debajo de la barra fija. */
.mo-vista {
  padding-top: calc(var(--mo-top-h) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
}
.mo-contenido { padding: 14px 12px 0; max-width: 1180px; margin: 0 auto; }

@media (min-width: 900px) {
  .mo-top__burger { display: none; }
  .mo-top__dominios { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; }
  .mo-usuario { display: flex; }
  .mo-drawer, .mo-drawer-velo { display: none !important; }

  .mo-top__dominio {
    display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; min-height: 44px;
    align-self: center; border: 0; background: transparent; border-radius: var(--radio-s);
    font-family: var(--fuente-titular); font-weight: 600; font-size: 14px;
    color: var(--muted); cursor: pointer; white-space: nowrap;
  }
  .mo-top__dominio:hover { background: var(--hover); color: var(--ink); }
  .mo-top__dominio.on { color: var(--ink); background: color-mix(in srgb, var(--celeste) 20%, transparent); }

  .mo-side {
    position: fixed; top: var(--mo-top-h); left: 0; bottom: 0; width: var(--mo-side-w); z-index: 55;
    display: block; overflow-y: auto; padding: 12px 8px;
    background: var(--surface); border-right: 1px solid var(--line);
  }
  .mo-vista { padding-left: var(--mo-side-w); }
  .mo-contenido { padding: 18px 22px 0; }
}

/* ── Tarjetas ───────────────────────────────────────────────────────────── */

.mo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--sombra);
}
.mo-card__t {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--fuente-titular); font-weight: 700; font-size: 15px;
  margin: 0 0 10px;
}
.mo-card__pie { border-top: 1px solid var(--line); margin: 12px -14px -14px; padding: 10px 14px; }
.mo-card--acento { border-left: 4px solid var(--celeste); }

.mo-kpi { display: grid; gap: 2px; }
.mo-kpi__n { font-family: var(--fuente-datos); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mo-kpi__lb { font-family: var(--fuente-datos); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.mo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

/* ── Botones ────────────────────────────────────────────────────────────── */

.mo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px;      /* 44 px: el dedo de un montador con guante */
  border: 1px solid var(--line); border-radius: var(--radio-s);
  background: var(--surface); color: var(--ink);
  font-family: var(--fuente-titular); font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none;
  touch-action: manipulation;                /* mata el retardo de 300 ms del doble toque */
}
.mo-btn:hover:not([disabled]) { border-color: var(--accent); }
.mo-btn:active:not([disabled]) { transform: translateY(1px); }
.mo-btn[disabled] { opacity: .55; cursor: not-allowed; }

.mo-btn--primario { background: var(--accent); border-color: var(--accent); color: var(--sobre-acento); }
.mo-btn--primario:hover:not([disabled]) { filter: brightness(1.08); }
.mo-btn--peligro  { border-color: var(--error); color: var(--error); }
.mo-btn--plano    { border-color: transparent; background: transparent; }
.mo-btn--bloque   { width: 100%; }
.mo-btn--mini     { min-height: 34px; padding: 5px 10px; font-size: 13px; }

/* Barra de acciones pegada abajo: en el móvil el pulgar llega ahí, no arriba. */
.mo-acciones {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; gap: 8px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--paper) 72%, transparent);
}
.mo-acciones .mo-btn { flex: 1 1 0; }

/* ── Chips: estado con FORMA además de color ────────────────────────────── */

.mo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-family: var(--fuente-datos); font-size: 11px; font-weight: 500;
  letter-spacing: .04em; white-space: nowrap; color: var(--muted);
}
.mo-chip--ok     { color: var(--ok);     border-color: var(--ok);     background: var(--ok-suave); }
.mo-chip--aviso  { color: var(--aviso);  border-color: var(--aviso);  background: var(--aviso-suave); }
.mo-chip--error  { color: var(--error);  border-color: var(--error);  background: var(--error-suave); }
.mo-chip--acento { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--celeste) 18%, transparent); }
.mo-chip--boton  { cursor: pointer; min-height: 44px; }
/* 44 px y no 34: estos chips son botones de verdad —los filtros de jornadas,
   los roles de la cuadrilla, los ocho tipos de parada— y se pulsan en la obra,
   con una mano y a menudo con guantes. A 34 px se fallan. */
.mo-chip--boton.on { border-color: var(--accent); color: var(--accent); }

/* ── Listas: lo primero en móvil ────────────────────────────────────────── */

.mo-lista { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.mo-item {
  display: grid; gap: 4px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--celeste); border-radius: var(--radio);
  padding: 12px; min-height: 44px; cursor: pointer; color: inherit; font: inherit;
}
.mo-item:hover { border-color: var(--accent); }
.mo-item__t { font-family: var(--fuente-titular); font-weight: 600; font-size: 15px; }
.mo-item__d { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* ── Tablas: solo tienen sentido en pantalla ancha ──────────────────────── */

.mo-tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mo-tabla {
  width: 100%; border-collapse: collapse;
  font-size: 14px; background: var(--surface);
}
.mo-tabla th {
  font-family: var(--fuente-datos); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); text-align: left; font-weight: 500;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.mo-tabla td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mo-tabla tr:last-child td { border-bottom: 0; }
.mo-tabla td.num, .mo-tabla th.num { text-align: right; font-family: var(--fuente-datos); font-variant-numeric: tabular-nums; }

/* Por debajo de 700 px la tabla se apila y cada celda enseña su cabecera desde
   data-lb. Es lo que evita tener que arrastrar la tabla de lado en la obra. */
@media (max-width: 699px) {
  .mo-tabla--apila thead { display: none; }
  .mo-tabla--apila tr {
    display: block; border: 1px solid var(--line); border-radius: var(--radio);
    margin-bottom: 8px; padding: 4px 0;
  }
  .mo-tabla--apila td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 12px; }
  .mo-tabla--apila td::before {
    content: attr(data-lb);
    font-family: var(--fuente-datos); font-size: 10px; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted);
  }
}

/* ── Formularios ────────────────────────────────────────────────────────── */

.mo-form { display: grid; gap: 12px; }
.mo-form--2 { grid-template-columns: 1fr; }
@media (min-width: 700px) { .mo-form--2 { grid-template-columns: 1fr 1fr; } }

.mo-campo { display: grid; gap: 5px; }
.mo-campo > label,
.mo-campo__lb {
  font-family: var(--fuente-datos); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.mo-campo input, .mo-campo select, .mo-campo textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radio-s);
  background: var(--surface); color: var(--ink);
  font-family: var(--fuente-cuerpo); font-size: 16px;   /* 16 px o iOS hace zoom al enfocar */
}
.mo-campo textarea { min-height: 96px; resize: vertical; }
.mo-campo input:focus, .mo-campo select:focus, .mo-campo textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.mo-campo__ayuda { font-size: 12px; color: var(--muted); }
.mo-campo--mal input, .mo-campo--mal select, .mo-campo--mal textarea { border-color: var(--error); }
.mo-campo--mal .mo-campo__ayuda { color: var(--error); }

/* Foco visible en todo lo pulsable: en oficina se navega con teclado. */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Vacío, cargando y avisos ───────────────────────────────────────────── */

.mo-vacio {
  display: grid; gap: 8px; justify-items: center; text-align: center;
  padding: 34px 18px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radio); background: var(--surface);
}
.mo-vacio__ico { font-size: 26px; opacity: .8; }
.mo-vacio__t { font-family: var(--fuente-titular); font-weight: 600; color: var(--ink); }

.mo-cargando {
  display: flex; align-items: center; gap: 10px;
  padding: 18px; color: var(--muted); font-size: 14px;
}
.mo-cargando::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: mo-giro .7s linear infinite;
}
@keyframes mo-giro { to { transform: rotate(360deg); } }

/* Quien pide menos movimiento no ve girar nada ni deslizarse el cajón. */
@media (prefers-reduced-motion: reduce) {
  .mo-cargando::before { animation: none; }
  .mo-drawer { transition: none; }
  .mo-pin.mal { animation: none; }
}

.mo-aviso {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radio-s);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; margin-bottom: 12px;
}
.mo-aviso--error { border-color: var(--error); background: var(--error-suave); color: var(--error); }
.mo-aviso--aviso { border-color: var(--aviso); background: var(--aviso-suave); color: var(--aviso); }
.mo-aviso--ok    { border-color: var(--ok);    background: var(--ok-suave);    color: var(--ok); }

/* ── Avisos flotantes ───────────────────────────────────────────────────── */

.mo-toasts {
  position: fixed; left: 0; right: 0; z-index: 120;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 8px; padding: 0 12px;
  pointer-events: none;                     /* el fondo se sigue pudiendo tocar */
}
.mo-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 auto; width: 100%; max-width: 520px;
  padding: 12px 14px; border-radius: var(--radio);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sombra-alta); font-size: 14px; color: var(--ink);
}
.mo-toast__x { margin-left: auto; background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; min-width: 28px; }
.mo-toast--ok    { border-left: 4px solid var(--ok); }
.mo-toast--error { border-left: 4px solid var(--error); }
.mo-toast--info  { border-left: 4px solid var(--accent); }

/* ── Arranque y acceso ──────────────────────────────────────────────────── */

.mo-pantalla {
  min-height: 100dvh; display: grid; align-content: center; justify-items: center;
  gap: 18px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
}
.mo-pantalla__marca { display: grid; gap: 6px; justify-items: center; text-align: center; }
.mo-pantalla__marca img { width: 56px; height: 56px; }
.mo-pantalla__marca .nombre {
  font-family: var(--fuente-titular); font-weight: 800; font-size: 30px; letter-spacing: -.01em;
}
.mo-pantalla__marca .lema { color: var(--muted); font-size: 14px; font-style: italic; }
.mo-pantalla__marca .ver { font-family: var(--fuente-datos); font-size: 11px; color: var(--muted); }

.mo-acceso {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden;
}
.mo-acceso__pestanas { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.mo-acceso__pestana {
  min-height: 48px; border: 0; background: transparent; cursor: pointer;
  font-family: var(--fuente-titular); font-weight: 600; font-size: 14px; color: var(--muted);
  border-bottom: 3px solid transparent;
}
.mo-acceso__pestana.on { color: var(--ink); border-bottom-color: var(--accent); }
.mo-acceso__cuerpo { padding: 16px; display: grid; gap: 14px; }

/* PIN: de cuatro a ocho dígitos. Los puntos se leen de un vistazo con el móvil en la mano. */
.mo-pin { display: flex; justify-content: center; gap: 10px; padding: 6px 0 2px; min-height: 20px; }
.mo-pin__p { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); }
.mo-pin__p.lleno { background: var(--accent); border-color: var(--accent); }
.mo-pin.mal { animation: mo-temblor .3s; }
@keyframes mo-temblor {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
.mo-teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mo-tecla {
  min-height: 56px; border: 1px solid var(--line); border-radius: var(--radio);
  background: var(--surface); color: var(--ink);
  font-family: var(--fuente-datos); font-size: 22px; cursor: pointer;
  touch-action: manipulation; user-select: none;
}
.mo-tecla:active { background: color-mix(in srgb, var(--celeste) 26%, transparent); }
.mo-tecla--aux { font-size: 15px; font-family: var(--fuente-cuerpo); color: var(--muted); }

.mo-enlace-plano {
  background: transparent; border: 0; color: var(--accent); cursor: pointer;
  font-family: var(--fuente-cuerpo); font-size: 14px; min-height: 44px; text-decoration: underline;
}

/* ── Utilidades cortas ──────────────────────────────────────────────────── */

.mo-fila { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mo-fila--sep { justify-content: space-between; }
.mo-pila { display: grid; gap: 8px; }
.mo-barra-seccion {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--fuente-datos); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 18px 0 8px;
}

/* ── Bloque de datos crudos ─────────────────────────────────────────────── */

/* Para el detalle JSON de una anotación de auditoría y cualquier otro volcado
   que se enseñe tal cual. Rueda en horizontal DENTRO de su caja: sin esto, un
   detalle con una ruta larga estira la página entera y en el móvil se arrastra
   toda la pantalla de lado. `pre-wrap` para que las líneas normales sí partan. */
.mo-pre {
  margin: 0; padding: 10px 12px;
  max-height: 340px; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radio-s);
  font-family: var(--fuente-datos); font-size: 12px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}

/* Un campo que ocupa el ancho entero dentro de un .mo-form--2. Los dominios lo
   venían resolviendo con style="grid-column:1/-1" repetido veintitantas veces;
   la clase existe para que la siguiente pantalla no lo vuelva a escribir. */
.mo-ancho { grid-column: 1 / -1; }
