/* Agente Central — sistema visual
   Dirección: consola sobria tipo Apple/Google. Superficies planas, líneas finas, un solo acento azul,
   tipografía del sistema (SF Pro en Apple, Segoe UI en Windows, Roboto en Android) para sensación nativa.
   Escala de espaciado 4/8, radios 10/14/980, sombras casi nulas. */
:root {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fbfbfd; --sunken: #f0f0f3;
  --text: #1d1d1f; --text-2: #5f5f66; --text-3: #86868b;
  --line: rgba(0,0,0,.08); --line-2: rgba(0,0,0,.14);
  --accent: #0066cc; --accent-hover: #0058b0; --accent-soft: rgba(0,102,204,.09); --on-accent: #fff;
  --ok: #1a7f37; --ok-soft: rgba(26,127,55,.1);
  --warn: #9a5b00; --warn-soft: rgba(196,120,0,.12);
  --bad: #c9182b; --bad-soft: rgba(201,24,43,.09);
  --info: #5e5ce6;
  --c1: #0066cc; --c2: #2aa198; --c3: #e8a33d; --c4: #8e6bd8; --c5: #9aa0a6;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-pop: 0 8px 40px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.08);
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --pill: 980px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --side: 252px; --top: 56px; --tab: 64px;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --bg: #000; --surface: #1c1c1e; --surface-2: #232325; --sunken: #2c2c2e;
    --text: #f5f5f7; --text-2: #aeaeb2; --text-3: #8e8e93;
    --line: rgba(255,255,255,.09); --line-2: rgba(255,255,255,.16);
    --accent: #2997ff; --accent-hover: #4aa8ff; --accent-soft: rgba(41,151,255,.16); --on-accent: #fff;
    --ok: #32d74b; --ok-soft: rgba(50,215,75,.14); --warn: #ffb340; --warn-soft: rgba(255,179,64,.14);
    --bad: #ff6961; --bad-soft: rgba(255,105,97,.15);
    --c1: #2997ff; --c2: #40c8b8; --c3: #ffb340; --c4: #b29cff; --c5: #8e8e93;
    --shadow: none; --shadow-pop: 0 8px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-tema="oscuro"] {
  --bg: #000; --surface: #1c1c1e; --surface-2: #232325; --sunken: #2c2c2e;
  --text: #f5f5f7; --text-2: #aeaeb2; --text-3: #8e8e93;
  --line: rgba(255,255,255,.09); --line-2: rgba(255,255,255,.16);
  --accent: #2997ff; --accent-hover: #4aa8ff; --accent-soft: rgba(41,151,255,.16);
  --ok: #32d74b; --ok-soft: rgba(50,215,75,.14); --warn: #ffb340; --warn-soft: rgba(255,179,64,.14);
  --bad: #ff6961; --bad-soft: rgba(255,105,97,.15);
  --c1: #2997ff; --c2: #40c8b8; --c3: #ffb340; --c4: #b29cff; --c5: #8e8e93;
  --shadow: none; --shadow-pop: 0 8px 40px rgba(0,0,0,.6); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; min-height: 100dvh; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.022em; text-wrap: balance; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 16px; height: 16px; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; box-shadow: 0 0 0 1px var(--accent); border-radius: 6px; }
.saltar { position: fixed; left: 12px; top: -60px; z-index: 1000; background: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow-pop); }
.saltar:focus { top: 12px; }

/* ── estructura ── */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100dvh; }
.lateral { position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 18px 12px 16px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.marca { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.marca-logo { width: 32px; height: 32px; border-radius: 9px; background: var(--text); color: var(--bg); display: grid; place-items: center; }
.marca-logo svg { width: 18px; height: 18px; }
.marca b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.marca span { display: block; font-size: 12px; color: var(--text-3); }
.nav-grupo { margin: 14px 0 4px; padding: 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 0 12px; height: 38px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14px; position: relative; }
.nav a:hover { background: var(--sunken); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .badge { margin-left: auto; }
.lateral-pie { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sunken); color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.lateral-pie .quien { min-width: 0; flex: 1; }
.lateral-pie .quien b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral-pie .quien span { display: block; font-size: 12px; color: var(--text-3); }

.principal { min-width: 0; }
.barra { position: sticky; top: 0; z-index: 20; height: var(--top); display: none; align-items: center; gap: 8px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.barra .titulo { font-weight: 600; font-size: 17px; flex: 1; text-align: center; }
.contenido { max-width: 1240px; margin: 0 auto; padding: 32px 40px 64px; }
.cabecera { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.cabecera .t { flex: 1; min-width: 220px; }
.cabecera .t p { color: var(--text-2); margin-top: 6px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.migas { font-size: 13px; color: var(--text-3); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.migas a { color: var(--text-2); }

.tabbar { display: none; }

/* ── controles ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: var(--pill);
  border: 1px solid transparent; background: var(--sunken); color: var(--text); font-weight: 500; font-size: 14px; cursor: pointer;
  transition: background .15s var(--ease), transform .1s var(--ease); white-space: nowrap; touch-action: manipulation; }
.btn:hover { background: color-mix(in srgb, var(--sunken) 80%, var(--text) 6%); }
.btn:active { transform: scale(.97); }
.btn.primario { background: var(--accent); color: var(--on-accent); }
.btn.primario:hover { background: var(--accent-hover); }
.btn.peligro { background: var(--bad-soft); color: var(--bad); }
.btn.borde { background: transparent; border-color: var(--line-2); }
.btn.texto { background: transparent; color: var(--accent); padding: 0 8px; }
.btn.texto:hover { background: var(--accent-soft); }
.btn.icono { width: 36px; padding: 0; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .giro { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: giro .7s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.campo small { color: var(--text-3); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.mono { font-family: var(--mono); font-size: 13px; }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.buscar { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.buscar .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 17px; height: 17px; }
.buscar .input { padding-left: 36px; border-radius: var(--pill); background: var(--surface); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form .ancho { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 13px; background: var(--line-2); transition: background .2s var(--ease); }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px var(--accent-soft); }

.segmento { display: inline-flex; background: var(--sunken); border-radius: 10px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.segmento button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.segmento button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ── superficies ── */
.hoja { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--line); }
.hoja + .hoja, .bloque + .bloque { margin-top: 20px; }
.hoja-cab { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.hoja-cab h2 { flex: 1; font-size: 17px; }
.hoja-cuerpo { padding: 18px 22px 22px; }
.vacio { padding: 48px 24px; text-align: center; color: var(--text-2); }
.vacio .ico { width: 36px; height: 36px; color: var(--text-3); margin-bottom: 10px; stroke-width: 1.4; }
.vacio b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); margin-bottom: 20px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis::after { content: ""; background: var(--surface); grid-column: auto / -1; }
.kpi { background: var(--surface); padding: 18px 20px 20px; min-width: 0; color: inherit; }
.kpi span { display: block; font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
a.kpi:hover { background: var(--surface-2); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.grid-2 > .hoja + .hoja { margin-top: 0; }

/* tablas */
.tabla-env { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr.click { cursor: pointer; }
.tabla tbody tr.click:hover td { background: var(--surface-2); }
.tabla td.der, .tabla th.der { text-align: right; }
.tabla .nombre { font-weight: 500; }
.tabla .sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; }
.celda-nombre { display: flex; align-items: center; gap: 12px; min-width: 200px; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--line); }
.lista > li:first-child { border-top: 0; }
.lista .cuerpo { flex: 1; min-width: 0; }
.lista .cuerpo b { font-weight: 500; display: block; overflow-wrap: anywhere; }
.lista .cuerpo small { color: var(--text-3); font-size: 12px; display: block; margin-top: 2px; }

/* estados */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--pill); font-size: 12px; font-weight: 500; background: var(--sunken); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.badge.cuenta { background: var(--bad); color: #fff; min-width: 20px; height: 20px; padding: 0 6px; justify-content: center; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.punto.ok { background: var(--ok); } .punto.lento { background: var(--warn); } .punto.caido { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.agente-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--sunken); color: var(--text-2); flex: none; font-weight: 600; font-size: 14px; }
.barra-uso { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; min-width: 80px; }
.barra-uso i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.barra-uso.alto i { background: var(--bad); }

/* tarjetas de agentes */
.agentes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; color: inherit; transition: border-color .15s, box-shadow .2s var(--ease); }
.tarjeta:hover { border-color: var(--line-2); box-shadow: var(--shadow-pop); }
.tarjeta .arriba { display: flex; gap: 12px; align-items: flex-start; }
.tarjeta .arriba > div:not(.agente-ico) { min-width: 0; flex: 1; }
.tarjeta .arriba b { display: block; font-weight: 600; }
.tarjeta .arriba small { color: var(--text-3); font-size: 12px; }
.tarjeta p { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.tarjeta .pie { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }

/* pestañas */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button { border: 0; background: none; padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.pestanas button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }

/* gráficos */
.grafico { width: 100%; height: auto; display: block; }
.grafico text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.grafico .rejilla { stroke: var(--line); }
.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: fixed; z-index: 200; pointer-events: none; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.45; box-shadow: var(--shadow-pop); max-width: 240px; }
.barras-cat { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--sunken); gap: 2px; }
.barras-cat i { display: block; height: 100%; }

/* diálogo / hoja modal */
.capa { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.32); display: grid; place-items: center; padding: 24px; animation: aparecer .18s var(--ease); }
.dialogo { width: min(560px, 100%); max-height: calc(100dvh - 48px); overflow: auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-pop); animation: subir .26s var(--ease); }
.dialogo.ancho { width: min(820px, 100%); }
.dialogo-cab { display: flex; align-items: center; gap: 12px; padding: 20px 24px 4px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialogo-cab h2 { flex: 1; }
.dialogo-cuerpo { padding: 12px 24px 8px; }
.dialogo-pie { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; flex-wrap: wrap; }
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.aviso { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--sunken); color: var(--text-2); font-size: 14px; align-items: flex-start; }
.aviso .ico { margin-top: 1px; }
.aviso.warn { background: var(--warn-soft); color: var(--warn); }
.aviso.bad { background: var(--bad-soft); color: var(--bad); }
.aviso.ok { background: var(--ok-soft); color: var(--ok); }
.aviso.acc { background: var(--accent-soft); color: var(--accent); }

.toasts { position: fixed; z-index: 300; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: var(--pill); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop); animation: subir .25s var(--ease); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

.esqueleto { background: linear-gradient(90deg, var(--sunken) 25%, var(--surface-2) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: brillo 1.3s infinite; border-radius: 10px; }
@keyframes brillo { to { background-position: -200% 0; } }

.codigo { font-family: var(--mono); font-size: 12.5px; background: var(--sunken); border-radius: 10px; padding: 12px 14px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; margin: 0; }
.dif { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; font-size: 13px; }
.dif > div { background: var(--surface); padding: 8px 10px; overflow-wrap: anywhere; min-width: 0; }
.dif .k { color: var(--text-2); font-weight: 500; background: var(--surface-2); }
.dif .a { color: var(--bad); } .dif .d { color: var(--ok); }
.dif .h { background: var(--surface-2); font-size: 12px; color: var(--text-3); font-weight: 500; }

.permisos-matriz { display: grid; gap: 10px; }
.permisos-matriz .fila { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.permisos-matriz .fila b { width: 160px; font-weight: 500; font-size: 14px; }
.permisos-matriz .fila div { display: flex; gap: 14px; flex-wrap: wrap; flex: 1; }

/* acceso */
.acceso { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.acceso-caja { width: min(400px, 100%); }
.acceso-marca { text-align: center; margin-bottom: 28px; }
.acceso-marca .marca-logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px; }
.acceso-marca .marca-logo svg { width: 30px; height: 30px; }
.acceso-marca h1 { font-size: 26px; }
.acceso-marca p { color: var(--text-2); margin-top: 6px; }
.acceso .hoja { padding: 28px; }
.acceso form { display: grid; gap: 16px; }
.codigo-otp { text-align: center; font-family: var(--mono); font-size: 26px !important; letter-spacing: .4em; height: 56px !important; }
.qr { background: #fff; border-radius: 14px; padding: 4px; width: 232px; max-width: 100%; margin: 4px auto; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.respaldo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: var(--mono); font-size: 15px; text-align: center; }
.respaldo span { background: var(--sunken); border-radius: 8px; padding: 8px; }
.pasos { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.pasos i { width: 6px; height: 6px; border-radius: 3px; background: var(--line-2); transition: width .25s var(--ease); }
.pasos i.on { width: 20px; background: var(--accent); }

/* ── tablet ── */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > .hoja + .hoja { margin-top: 0; }
  .contenido { padding: 28px 28px 56px; }
}
/* ── celular ── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .lateral { display: none; }
  .barra { display: flex; }
  .contenido { padding: 20px 16px calc(var(--tab) + 32px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  .cabecera { margin-bottom: 18px; }
  .kpis, .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cabecera > .agente-ico { display: none; }
  .lista > li { flex-wrap: wrap; row-gap: 10px; }
  .lista > li > .cuerpo { flex: 1 1 calc(100% - 80px); }
  .lista > li > .acciones { margin-left: auto; }
  .kpi { padding: 14px 16px 16px; }
  .kpi b { font-size: 22px; }
  .form { grid-template-columns: 1fr; }
  .hoja-cab { padding: 16px 16px 0; }
  .hoja-cuerpo { padding: 14px 16px 18px; }
  .lista > li { padding: 14px 16px; }
  .tabla th, .tabla td { padding: 10px 10px; }
  .tabla .ocultable { display: none; }
  .buscar { max-width: none; flex-basis: 100%; }
  .input, select.input { height: 44px; font-size: 16px; }
  textarea.input { font-size: 16px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tab) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--text-3); border: 0; background: none; position: relative; }
  .tabbar .ico { width: 24px; height: 24px; }
  .tabbar [aria-current="page"] { color: var(--accent); }
  .tabbar .badge.cuenta { position: absolute; top: 6px; left: calc(50% + 6px); height: 17px; min-width: 17px; font-size: 10px; padding: 0 4px; }
  .capa { place-items: end stretch; padding: 0; }
  .dialogo, .dialogo.ancho { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .dif { grid-template-columns: 1fr; }
  .dif .h { display: none; }
  .toasts { bottom: calc(var(--tab) + 16px + env(safe-area-inset-bottom)); }
  .permisos-matriz .fila b { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
