:root {
  --tinta: #14213d; --acento: #1f6feb; --suave: #5b6475; --fondo: #f6f7f9; --tarjeta: #fff; --linea: #e3e6eb;
  --verde: #1a7f37; --amarillo: #b26b00; --rojo: #c62828; --gris: #8a93a3;
  --verde-f: #e6f4ea; --amarillo-f: #fff4e0; --rojo-f: #fdecea;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--tinta); background: var(--fondo); font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
button, input, select { font: inherit; }
button { background: var(--acento); color: #fff; border: 0; border-radius: 8px; padding: .5rem .9rem; cursor: pointer; }
button.secundario { background: transparent; color: var(--tinta); border: 1px solid var(--linea); }
button.peligro { background: var(--rojo); }
button.chico { padding: .25rem .55rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }
input, select { border: 1px solid var(--linea); border-radius: 8px; padding: .5rem .6rem; background: #fff; width: 100%; }
label { display: block; margin: .6rem 0; font-size: .9rem; color: var(--suave); }
label input, label select { margin-top: .25rem; color: var(--tinta); }
.suave { color: var(--suave); }
.chica { font-size: .85rem; }
.centro { text-align: center; }
.barra { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; background: var(--tinta); color: #fff; flex-wrap: wrap; }
.barra .marca { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.barra .logo { background: var(--acento); border-radius: 6px; padding: .15rem .35rem; font-size: .8rem; }
.barra .sub { font-weight: 400; opacity: .7; }
.barra nav { display: flex; gap: .3rem; }
.barra nav button { background: transparent; color: #cfd6e4; }
.barra nav button.activo { background: rgba(255,255,255,.12); color: #fff; }
.barra .derecha { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.barra .derecha .suave { color: #aab3c5; font-size: .85rem; }
.barra .secundario { color: #fff; border-color: rgba(255,255,255,.25); }
main { max-width: 1240px; margin: 0 auto; padding: 1.5rem; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 12px; padding: 1.1rem 1.2rem; }
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.grilla-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.seccion { margin: 1.6rem 0 .8rem; display: flex; align-items: baseline; gap: .8rem; }
.estudio { cursor: pointer; transition: border-color .15s; }
.estudio:hover { border-color: var(--acento); }
.estudio .cab { display: flex; align-items: center; gap: .55rem; margin-bottom: .2rem; }
.estudio .cab h3 { margin: 0; }
.punto { width: .7rem; height: .7rem; border-radius: 50%; flex: none; display: inline-block; }
.verde .punto, .punto.verde { background: var(--verde); }
.amarillo .punto, .punto.amarillo { background: var(--amarillo); }
.rojo .punto, .punto.rojo { background: var(--rojo); }
.datos { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem .8rem; margin-top: .8rem; font-size: .88rem; }
.datos b { display: block; font-size: 1.05rem; color: var(--tinta); }
.datos span { color: var(--suave); }
.problemas { list-style: none; padding: 0; margin: .7rem 0 0; font-size: .86rem; }
.problemas li { padding: .3rem .5rem; border-radius: 6px; margin-top: .25rem; }
.problemas li.rojo { background: var(--rojo-f); color: var(--rojo); }
.problemas li.amarillo { background: var(--amarillo-f); color: var(--amarillo); }
.ok-chip { display: inline-block; font-size: .78rem; padding: .1rem .45rem; border-radius: 99px; background: var(--verde-f); color: var(--verde); }
.chip { display: inline-block; font-size: .78rem; padding: .1rem .45rem; border-radius: 99px; background: var(--fondo); border: 1px solid var(--linea); color: var(--suave); }
.chip.rojo { background: var(--rojo-f); color: var(--rojo); border-color: transparent; }
.chip.amarillo { background: var(--amarillo-f); color: var(--amarillo); border-color: transparent; }
.barra-uso { height: .5rem; border-radius: 99px; background: var(--linea); overflow: hidden; margin: .35rem 0; }
.barra-uso div { height: 100%; background: var(--acento); }
.barra-uso.amarillo div { background: var(--amarillo); }
.barra-uso.rojo div { background: var(--rojo); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--suave); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
th, td { padding: .5rem .45rem; border-bottom: 1px solid var(--linea); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .acciones { display: flex; gap: .3rem; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv dt { color: var(--suave); }
.kv dd { margin: 0; }
.volver { background: transparent; color: var(--acento); padding: 0; margin-bottom: .8rem; }
.modulo { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--linea); }
.modulo:last-of-type { border-bottom: 0; }
.modulo .nombre { flex: 1; }
.modulo input[type=text] { width: 12rem; }
.interruptor { position: relative; width: 2.6rem; height: 1.45rem; flex: none; }
.interruptor input { opacity: 0; width: 0; height: 0; }
.interruptor span { position: absolute; inset: 0; background: var(--linea); border-radius: 99px; transition: .15s; cursor: pointer; }
.interruptor span::before { content: ""; position: absolute; width: 1.05rem; height: 1.05rem; left: .2rem; top: .2rem; background: #fff; border-radius: 50%; transition: .15s; }
.interruptor input:checked + span { background: var(--verde); }
.interruptor input:checked + span::before { transform: translateX(1.15rem); }
.interruptor input:focus-visible + span { outline: 2px solid var(--acento); outline-offset: 2px; }
.acceso { max-width: 380px; margin: 3rem auto; }
.acceso h2 { margin-bottom: .2rem; }
.aviso { padding: .6rem .8rem; border-radius: 8px; margin: .7rem 0; font-size: .9rem; }
.aviso.error { background: var(--rojo-f); color: var(--rojo); }
.aviso.bien { background: var(--verde-f); color: var(--verde); }
.aviso.info { background: #eaf1fd; color: #1d4f9a; }
.secreto { font-family: ui-monospace, Menlo, monospace; background: var(--fondo); padding: .5rem; border-radius: 6px; word-break: break-all; user-select: all; }
.qr { display: block; margin: .6rem auto; width: 220px; height: 220px; }
dialog { border: 0; border-radius: 12px; padding: 1.3rem; width: min(420px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20,33,61,.35); }
.acciones { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.fila { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.fila label { flex: 1; min-width: 160px; margin: .3rem 0; }
pre.log { background: #0f172a; color: #d6deeb; padding: .8rem; border-radius: 8px; font-size: .8rem; max-height: 320px; overflow: auto; white-space: pre-wrap; }
.grafico { width: 100%; height: 140px; }
.grafico text { font-size: 10px; fill: var(--suave); }
.leyenda { font-size: .8rem; color: var(--suave); display: flex; gap: 1rem; margin-top: .3rem; }
.leyenda i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
@media (max-width: 640px) { .grilla-2 { grid-template-columns: 1fr; } main { padding: 1rem; } }
