/* Portal de clientes de IEM (clientes.iemadrid.com) — estilo «Esencial», el mismo de IEM Gestión
   (ui-kit/DOCS/estilos/rholesinsky/LENGUAJE_VISUAL.md) con la identidad de IEM: el rojo es el único
   acento, la acción principal es monocroma y el estado de los servicios va con el semáforo de siempre
   (verde funciona, ámbar mantenimiento, rojo incidencia). Tema según el sistema por defecto.
   Tokens primero: ningún color fuera de :root. Animar solo transform/opacity. */

:root {
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px;
  --gutter: clamp(18px, 5vw, 32px);
  --r-frame: 24px; --r-card: 16px; --r-inner: 12px; --r-ctrl: 12px; --r-pill: 999px;
  --h-ctrl: 48px; --h-btn: 48px; --h-mini: 36px; --h-tab: 36px;
  --bg: #000000; --surface: #1C1C1E; --surface-2: #2C2C2E; --surface-3: #3A3A3C;
  --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.18);
  --ink: #FFFFFF; --ink-2: #8E8E93; --ink-3: #636366;
  --action: #FFFFFF; --on-action: #000000;
  --field-bg: #2C2C2E; --field-line: transparent;
  --scrim: rgba(0, 0, 0, 0.55);
  --brand: #FF0B0B; --accent: var(--brand); --brand-tint: rgba(255, 11, 11, 0.14);
  --ok: #30D158; --ok-bg: rgba(48, 209, 88, 0.12); --ok-line: rgba(48, 209, 88, 0.28);
  --ko: #FF453A; --ko-bg: rgba(255, 69, 58, 0.12); --ko-line: rgba(255, 69, 58, 0.30);
  --warn: #FF9F0A; --warn-ink: #FFB340; --warn-bg: rgba(255, 159, 10, 0.12); --warn-line: rgba(255, 159, 10, 0.30);
  --info: #0A84FF; --info-bg: rgba(10, 132, 255, 0.12); --info-line: rgba(10, 132, 255, 0.30);
  --sh-lift: 0 0 0 1px rgba(255, 255, 255, 0.06); --sh-float: 0 0 0 1px rgba(255, 255, 255, 0.10);
  --burbuja-iem: var(--surface-2);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --track-tight: -0.03em; --track-title: -0.02em; --track-caps: 0.06em;
  --dur-micro: 160ms; --dur-quick: 240ms; --dur-sheet: 350ms; --dur-morph: 420ms; --dur-enter: 480ms; --dur-exit: 220ms; --stagger: 60ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease-in: cubic-bezier(0.55, 0, 1, 0.45); --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --side: 248px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F5F7; --surface: #FFFFFF; --surface-2: #F4F4F5; --surface-3: #E9E9EB;
  --line: #E5E7EB; --line-strong: #CBCDD3;
  --ink: #111111; --ink-2: #6B7280; --ink-3: #A1A1AA;
  --action: #000000; --on-action: #FFFFFF;
  --field-bg: #FFFFFF; --field-line: #E5E7EB;
  --scrim: rgba(17, 17, 17, 0.28);
  --brand-tint: rgba(255, 11, 11, 0.10);
  --ok: #16A34A; --ok-bg: #ECFDF3; --ok-line: #ABEFC6;
  --ko: #DC2626; --ko-bg: #FEF2F2; --ko-line: #FECACA;
  --warn: #F59E0B; --warn-ink: #B54708; --warn-bg: #FFFAEB; --warn-line: #FEDF89;
  --info: #0A84FF; --info-bg: #EFF6FF; --info-line: #BFDBFE;
  --sh-lift: 0 2px 8px rgba(0, 0, 0, 0.10); --sh-float: 0 8px 24px rgba(0, 0, 0, 0.08);
  --burbuja-iem: #F0F0F2;
  color-scheme: light;
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-sheet: 1ms; --dur-morph: 1ms; --dur-enter: 1ms; --dur-exit: 1ms; --stagger: 0ms; }
  .punto.vivo::after { animation: none !important; }
}

/* ---------- Base ---------- */
[v-cloak] { display: none; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg);
  min-height: 100dvh; overflow-x: clip; overscroll-behavior: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
#app { min-height: 100dvh; }
button, a { touch-action: manipulation; }
button { font-family: inherit; }
h1, h2, h3 { font-weight: 500; letter-spacing: var(--track-title); line-height: 1.15; margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--brand-tint); }
:root[data-theme="light"] .logo-iem { filter: invert(1); }

.muted { color: var(--ink-2); font-size: 13.5px; }
.strong { font-weight: 500; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dec { color: var(--ink-3); }
.error { color: var(--ko); font-size: 14px; margin: 8px 0 0; }
.empty { text-align: center; color: var(--ink-2); padding: 32px 16px; font-size: 14.5px; }
.nota { font-size: 13.5px; color: var(--ink-2); margin: 0 0 14px; line-height: 1.5; }
.section-title {
  font-size: 11px; letter-spacing: var(--track-caps); text-transform: uppercase; font-weight: 500; color: var(--ink-2);
  margin: 28px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px;
}
.section-title:first-child { margin-top: 0; }
.section-title > span, .section-title > button { letter-spacing: 0; text-transform: none; font-weight: 400; font-size: 13px; color: var(--ink-3); }

/* ---------- Barra superior: fina; logo, y el avatar con su menú ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  min-height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(var(--gutter) - 4px + env(safe-area-inset-right)) 0 calc(var(--gutter) - 4px + env(safe-area-inset-left));
  background: var(--bg);
}
@supports (backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px)) {
  .topbar { background: color-mix(in oklab, var(--bg) 78%, transparent); backdrop-filter: saturate(1.4) blur(20px); -webkit-backdrop-filter: saturate(1.4) blur(20px); }
}
.topbar .logo-iem { height: 20px; width: auto; display: block; margin-left: 4px; }
.topbar .portal-tag { font-size: 12px; color: var(--ink-2); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line-strong); line-height: 1; }
.topbar .hueco { flex: 1; }
.iconbtn {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; position: relative; padding: 0; transition: transform var(--dur-micro) var(--ease-out);
}
.iconbtn:active { transform: scale(0.94); }
.avatar { font-size: 13px; font-weight: 500; letter-spacing: 0; }
.menu-av {
  position: absolute; right: calc(var(--gutter) - 4px); top: calc(56px + env(safe-area-inset-top)); z-index: 30; min-width: 230px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh-float); padding: 6px;
  transform-origin: top right;
}
.menu-av .quien { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-av .quien b { display: block; font-weight: 500; }
.menu-av button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--ink); font-size: 14.5px; min-height: 44px; padding: 0 12px; border-radius: 10px; cursor: pointer; text-align: left; }
.menu-av button:hover { background: var(--surface-2); }
.menu-av button i { font-size: 18px; color: var(--ink-2); }
.pop-enter-active { transition: opacity var(--dur-quick) var(--ease-out), transform var(--dur-quick) var(--ease-out); }
.pop-leave-active { transition: opacity var(--dur-exit) var(--ease-in), transform var(--dur-exit) var(--ease-in); }
.pop-enter-from, .pop-leave-to { opacity: 0; transform: scale(0.96) translateY(-4px); }

.page-head { padding: 18px calc(var(--gutter) + env(safe-area-inset-right)) 0 calc(var(--gutter) + env(safe-area-inset-left)); }
.page-head h1 { font-size: 28px; }
.page-head .sub { color: var(--ink-2); font-size: 14px; margin-top: 6px; }
.page-head .volver { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 14px; text-decoration: none; margin-bottom: 10px; min-height: 32px; }

.content { padding: 18px calc(var(--gutter) + env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left)); max-width: 760px; }
.content > * { animation: rise var(--dur-enter) var(--ease-out) both; }
.content > :nth-child(2) { animation-delay: var(--stagger); }
.content > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.content > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.content > :nth-child(n + 5) { animation-delay: calc(var(--stagger) * 4); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 15px 18px; margin-bottom: 8px; }
.card.tap { cursor: pointer; display: block; text-decoration: none; color: inherit; transition: transform var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out); }
.card.tap:hover { border-color: var(--line-strong); }
.card.tap:active { transform: scale(0.985); }
.card.ambar { border-color: var(--warn-line); background: var(--warn-bg); }
.card.rojo { border-color: var(--ko-line); background: var(--ko-bg); }
.card.azul { border-color: var(--info-line); background: var(--info-bg); }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.row + .row { margin-top: 4px; }
.row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.row.centro { align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.pill.verde { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.pill.ambar { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.pill.rojo { background: var(--ko-bg); border-color: var(--ko-line); color: var(--ko); }
.pill.azul { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }

/* Semáforo: un punto por servicio; el que no está verde late despacio */
.punto { position: relative; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }
.punto.ambar { background: var(--warn); }
.punto.rojo { background: var(--ko); }
.punto.vivo::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: latido 2s var(--ease-out) infinite; }
@keyframes latido { from { opacity: .6; transform: scale(1); } to { opacity: 0; transform: scale(2.6); } }

/* ---------- Inicio: estado general ---------- */
.hero { border-radius: var(--r-frame); padding: 22px 20px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--surface); }
.hero .h-estado { display: flex; align-items: center; gap: 12px; }
.hero .h-estado .punto { width: 14px; height: 14px; }
.hero h2 { font-size: clamp(22px, 6vw, 26px); }
.hero p { margin: 8px 0 0; color: var(--ink-2); font-size: 14.5px; }
.cifras { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.cifra { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.cifra .c-l { font-size: 12.5px; color: var(--ink-2); }
.cifra .c-v { font-size: 26px; font-weight: 300; letter-spacing: var(--track-tight); margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cifra .c-s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.rapidas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.rapidas .btn { margin: 0; flex-direction: column; gap: 6px; min-height: 76px; border-radius: var(--r-card); font-size: 13.5px; white-space: normal; line-height: 1.2; }
.rapidas .btn i { font-size: 22px; }
.rapidas .btn + .btn { margin-top: 0; }

/* Lista de servicios */
.servicio { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; }
.servicio + .servicio { border-top: 1px solid var(--line); }
.servicio .punto { margin-top: 6px; }
.servicio .s-txt { flex: 1; min-width: 0; }
.servicio .s-nombre { font-weight: 500; overflow-wrap: anywhere; }
.servicio .s-estado { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.servicio .s-msg { font-size: 13px; color: var(--ink-2); margin-top: 6px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-inner); }
.servicio .s-imp { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.card.lista { padding-top: 4px; padding-bottom: 4px; }
.alcance { font-size: 13px; color: var(--ink-2); margin-top: 6px; white-space: pre-line; }
.mas-info { background: none; border: 0; color: var(--ink-2); font-size: 13px; padding: 4px 0 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }

/* ---------- Datos clave (contrato, cuenta) ---------- */
.dato { padding: 10px 0; display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.dato + .dato { border-top: 1px solid var(--line); }
.dato .d-l { font-size: 13.5px; color: var(--ink-2); flex: none; }
.dato .d-v { text-align: right; overflow-wrap: anywhere; font-weight: 500; }
.dato .d-v small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12.5px; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 14px; min-width: 0; }
label.fl { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
input, select, textarea {
  width: 100%; font-size: 16px; font-family: inherit; color: var(--ink); background: var(--field-bg); border: 1px solid var(--field-line);
  border-radius: var(--r-ctrl); padding: 0 14px; outline: none; min-height: var(--h-ctrl); height: var(--h-ctrl);
  transition: border-color var(--dur-micro) var(--ease-out);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select option { background: var(--surface); color: var(--ink); }
textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong) inset; }
input[readonly] { color: var(--ink-2); }
input.codigo { font-size: 28px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; height: 60px; padding-left: calc(14px + 0.4em); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* ---------- Botones ---------- */
.btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 500;
  padding: 0 18px; min-height: var(--h-btn); border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), opacity var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}
.btn i { font-size: 18px; }
.btn:hover { border-color: var(--line-strong); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.btn.danger { color: var(--ko); border-color: var(--ko-line); background: transparent; }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.mini { width: auto; min-height: var(--h-mini); padding: 0 14px; font-size: 13.5px; }
.btn + .btn { margin-top: 8px; }
.btn[disabled] { opacity: 0.38; pointer-events: none; }
.enlace { background: none; border: 0; padding: 8px 0; min-height: 40px; color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  font-size: 13.5px; font-weight: 500; padding: 0 14px; min-height: 40px; border-radius: var(--r-pill); white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out);
}
.chip i { font-size: 16px; }
.chip:active { transform: scale(0.96); }
.chip.on { background: var(--action); border-color: var(--action); color: var(--on-action); }

/* Pestañas de la sección (Ayuda: Incidencias · Peticiones) */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: var(--r-pill); min-height: 36px; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-lift); }
.tabs .n { font-size: 11px; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--brand); color: #fff; padding: 0 5px; }

/* ---------- Navegación: píldora flotante en móvil, barra lateral en escritorio ---------- */
.nav {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--sh-float);
}
@supports (backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px)) {
  .nav { background: color-mix(in oklab, var(--surface) 84%, transparent); backdrop-filter: saturate(1.4) blur(20px); -webkit-backdrop-filter: saturate(1.4) blur(20px); }
}
.nav a {
  position: relative; width: 52px; height: 48px; border-radius: var(--r-pill); display: grid; place-items: center; color: var(--ink-2); text-decoration: none;
  transition: background-color var(--dur-quick) var(--ease-out), color var(--dur-quick) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.nav a:active { transform: scale(0.92); }
.nav a i { font-size: 22px; line-height: 1; }
.nav a .txt { display: none; }
.nav a.active { background: var(--action); color: var(--on-action); }
.nav .badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 500; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.nav .side-logo, .nav .side-pie { display: none; }

/* ---------- Entrar ---------- */
.login { padding: calc(24px + env(safe-area-inset-top)) var(--gutter) 24px; display: flex; flex-direction: column; justify-content: center; min-height: 100dvh; max-width: 420px; margin: 0 auto; }
.login .marca { text-align: center; margin-bottom: 32px; }
.login .marca img { width: 132px; max-width: 50%; }
.login .marca h1 { font-size: 24px; margin-top: 20px; }
.login .marca p { color: var(--ink-2); margin: 8px 0 0; font-size: 14.5px; }
.login .o { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 18px 0; }
.login .o::before, .login .o::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login .pie { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 28px; line-height: 1.5; }

/* ---------- Conversación de una incidencia ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .m-meta { font-size: 11.5px; color: var(--ink-3); margin-bottom: 3px; }
.msg.cliente { align-self: flex-end; background: var(--action); color: var(--on-action); border-bottom-right-radius: 6px; }
.msg.cliente .m-meta { color: color-mix(in oklab, var(--on-action) 55%, transparent); }
.msg.iem { align-self: flex-start; background: var(--burbuja-iem); border-bottom-left-radius: 6px; }

/* ---------- Carga ---------- */
.sk { height: 72px; border-radius: var(--r-card); margin-bottom: 8px; background: var(--surface); position: relative; overflow: hidden; }
.sk.alto { height: 120px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(100deg, transparent 30%, var(--surface-2) 50%, transparent 70%); animation: sk 1.4s var(--ease-in-out) infinite; }
@keyframes sk { to { transform: translateX(100%); } }

/* ---------- Aviso breve ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%) translateY(12px); opacity: 0; pointer-events: none;
  background: var(--action); color: var(--on-action); padding: 0 18px; min-height: 44px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500;
  box-shadow: var(--sh-float); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
  transition: opacity var(--dur-exit) var(--ease-in), transform var(--dur-exit) var(--ease-in);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); transition: opacity var(--dur-quick) var(--ease-out), transform var(--dur-quick) var(--ease-out); }
.toast i { font-size: 18px; }
.toast.ok i { color: var(--ok); }
.toast.err i { color: var(--ko); }

/* ---------- Hoja (confirmación, Face ID) ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.modal-box { background: var(--surface); box-shadow: var(--sh-float); border-radius: 28px; padding: 14px 20px 20px; width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-box::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--ink-3); opacity: 0.6; margin: 0 auto 18px; }
.modal-box .m-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 28px; margin-bottom: 14px; }
.modal-box h3 { margin: 0 0 6px; font-size: 20px; }
.modal-box > p { margin: 0 0 16px; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-actions .btn { margin: 0; }
.sheet-enter-active { transition: opacity var(--dur-sheet) var(--ease-out); }
.sheet-enter-active .modal-box { transition: transform var(--dur-sheet) var(--ease-out); }
.sheet-leave-active { transition: opacity var(--dur-exit) var(--ease-in); }
.sheet-leave-active .modal-box { transition: transform var(--dur-exit) var(--ease-in); }
.sheet-enter-from, .sheet-leave-to { opacity: 0; }
.sheet-enter-from .modal-box, .sheet-leave-to .modal-box { transform: translateY(40px); }

.savebar { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 15; margin-top: 8px; padding: 16px 0 4px; background: linear-gradient(to top, var(--bg) 62%, transparent); }
.savebar .btn { margin: 0; min-height: 52px; }
.aviso-inline { color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--r-inner); padding: 10px 12px; margin: 0 0 14px; font-size: 13.5px; line-height: 1.45; }
.info-inline { color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-inner); padding: 10px 12px; margin: 0 0 14px; font-size: 13.5px; line-height: 1.45; }
.zona-peligro { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Transición entre pantallas */
.page-enter-active { transition: opacity var(--dur-quick) var(--ease-out); }
.page-leave-active { transition: opacity var(--dur-exit) var(--ease-in); }
.page-enter-from, .page-leave-to { opacity: 0; }

/* ---------- Escritorio: barra lateral de 248 con el usuario al pie ---------- */
@media (min-width: 820px) {
  :root { --r-frame: 16px; --r-card: 12px; --r-inner: 10px; --r-ctrl: 8px; --h-ctrl: 42px; --h-btn: 42px; --h-mini: 32px; }
  body { font-size: 14.5px; }
  .nav {
    left: 0; top: 0; bottom: 0; transform: none; width: var(--side); border-radius: 0; box-shadow: none; flex-direction: column; align-items: stretch;
    gap: 2px; padding: 20px 12px 16px; background: var(--bg); border-right: 1px solid var(--line); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .nav .side-logo { display: flex; align-items: center; gap: 10px; margin: 6px 12px 26px; }
  .nav .side-logo img { height: 22px; width: auto; }
  .nav .side-logo span { font-size: 12px; color: var(--ink-2); padding-left: 10px; border-left: 1px solid var(--line-strong); line-height: 1; }
  .nav a { width: auto; height: 40px; border-radius: 8px; display: flex; justify-content: flex-start; gap: 10px; padding: 0 12px; font-size: 14px; font-weight: 500; }
  .nav a i { font-size: 18px; }
  .nav a .txt { display: inline; }
  .nav a:hover { color: var(--ink); background: var(--surface); }
  .nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-lift); }
  .nav .badge { position: static; margin-left: auto; box-shadow: none; }
  .nav .side-pie { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); min-width: 0; }
  .nav .side-pie .av { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; font-size: 11px; font-weight: 500; flex: none; }
  .nav .side-pie .quien { min-width: 0; line-height: 1.3; }
  .nav .side-pie .quien b { display: block; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav .side-pie .quien span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar { min-height: 56px; padding: 0 var(--s-7); background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar .logo-iem, .topbar .portal-tag { display: none; }
  .menu-av { right: var(--s-7); top: 56px; }
  .pagina > .topbar, .pagina > .page-head, .pagina > .content { margin-left: var(--side); }
  .page-head { padding: 8px var(--s-7) 0; }
  .content { padding: 22px var(--s-7) 64px; }
  .savebar { bottom: 12px; }
  .toast { bottom: 28px; }
  .modal-mask { align-items: center; padding: 24px; }
  .modal-box { border-radius: 24px; padding: 24px; max-width: 420px; }
  .modal-box::before { display: none; }
  .cifras { grid-template-columns: repeat(4, 1fr); }
  .rapidas { grid-template-columns: repeat(4, 1fr); }
  .content > * { animation-duration: var(--dur-quick); }
  .chip { min-height: 34px; }
}
@media (min-width: 1100px) {
  .pagina > .content, .pagina > .page-head { margin-left: max(var(--side), calc(var(--side) + (100vw - var(--side) - 760px) / 2)); }
  .page-head { max-width: 760px; }
}
