/* WIMI-PANELSSH — primero celular. Sin frameworks. El color de cada marca llega por /marca.css (--marca). */
:root {
  --marca: #2563eb; --marca-texto: #fff;
  --fondo: #f4f6fb; --superficie: #fff; --borde: #e3e8f0; --texto: #0f172a; --suave: #64748b;
  --ok: #16a34a; --alerta: #d97706; --mal: #dc2626; --gris: #94a3b8;
  --radio: 14px; --sombra: 0 1px 2px rgb(15 23 42 / 6%), 0 4px 16px rgb(15 23 42 / 4%);
  --barra-inferior: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --fondo: #0b1120; --superficie: #131c2e; --borde: #22304a; --texto: #e2e8f0; --suave: #94a3b8;
          --sombra: 0 1px 2px rgb(0 0 0 / 40%); }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 .75rem; }
.sprite { display: none; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.suave { color: var(--suave); }
.chico { font-size: .85rem; }

/* Estructura */
.app { min-height: 100dvh; }
.principal { padding-bottom: calc(var(--barra-inferior) + env(safe-area-inset-bottom)); }
.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1rem; background: var(--superficie); border-bottom: 1px solid var(--borde); }
.salir { display: flex; align-items: center; gap: .5rem; margin: 0; }
.quien { color: var(--suave); font-size: .9rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 1rem; max-width: 1100px; margin: 0 auto; display: grid; gap: 1rem; }
.lateral { display: none; }
.inferior { position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; height: calc(var(--barra-inferior) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--superficie); border-top: 1px solid var(--borde); }
.inferior a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .72rem; color: var(--suave); }
.inferior a[aria-current] { color: var(--marca); font-weight: 600; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 240px 1fr; }
  .inferior { display: none; }
  .principal { padding-bottom: 0; }
  .lateral { display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100dvh;
    padding: 1.25rem .75rem; background: var(--superficie); border-right: 1px solid var(--borde); }
  .lateral nav { display: grid; gap: 2px; }
  .lateral nav a { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; color: var(--suave); }
  .lateral nav a:hover { background: var(--fondo); color: var(--texto); }
  .lateral nav a[aria-current] { background: color-mix(in srgb, var(--marca) 12%, transparent); color: var(--marca); font-weight: 600; }
  main { padding: 1.5rem; }
}

/* Marca */
.marca { display: flex; align-items: center; gap: .6rem; font-weight: 700; padding: 0 .5rem; }
.marca.grande { font-size: 1.3rem; justify-content: center; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--marca); color: var(--marca-texto); font-weight: 800; }

/* Piezas */
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; box-shadow: var(--sombra); }
.indicadores { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 900px) { .indicadores { grid-template-columns: repeat(4, 1fr); } }
.indicador { display: grid; gap: .15rem; }
.indicador strong { font-size: 1.6rem; line-height: 1.2; }
.fila { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--borde); }
.fila:first-of-type { border-top: 0; }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--gris) 18%, transparent); color: var(--suave); }
.chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.alerta { background: color-mix(in srgb, var(--alerta) 15%, transparent); color: var(--alerta); }
.chip.mal { background: color-mix(in srgb, var(--mal) 15%, transparent); color: var(--mal); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 46px; padding: 0 1.1rem;
  border: 1px solid var(--borde); border-radius: 12px; background: var(--superficie); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer; }
.btn.principal { background: var(--marca); border-color: var(--marca); color: var(--marca-texto); }
.btn.ancho { width: 100%; }
.btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--marca) 45%, transparent); outline-offset: 2px; }
.btn-icono { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--suave); cursor: pointer; }
.btn-icono:hover { background: var(--fondo); color: var(--texto); }
.accion { justify-self: stretch; }
@media (min-width: 900px) { .accion { justify-self: start; } }
.g { width: 20px; height: 20px; background: #fff; border-radius: 50%; padding: 2px; }

/* Pantalla sin sesión */
.suelto { min-height: 100dvh; place-content: center; padding: 1.25rem; }
.ingreso { width: min(400px, 100%); display: grid; gap: 1rem; text-align: center; padding: 2rem 1.5rem; }
.ingreso form { display: grid; gap: 1rem; justify-items: center; }
.aviso { margin: 0; padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.aviso { background: color-mix(in srgb, var(--texto) 7%, transparent); }
.aviso.error { background: color-mix(in srgb, var(--mal) 12%, transparent); color: var(--mal); }

.htmx-request { opacity: .6; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
