/* OberDomo Tech — estilo (tema claro DNNS, verde OberDomo) */
:root {
  --verde: #5aa825; --verde-osc: #3f7f16; --verde-cl: #e9f5e0; --verde-borde: #b9dca0;
  --fondo: #f4f6f4; --panel: #ffffff; --borde: #e3e7e2; --texto: #1f2a1c; --suave: #6b7768;
  --rojo: #d64541; --rojo-cl: #fdeceb; --ambar: #d98a00; --ambar-cl: #fff4dd; --azul: #2f7fd1; --azul-cl: #e6f0fb;
  --radio: 10px; --sombra: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font-family: "Segoe UI", system-ui, sans-serif; font-size: 14px; color: var(--texto);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); }
button, input, select { font: inherit; color: inherit; }
.oculto { display: none !important; }
.suave { color: var(--suave); }
.error { color: var(--rojo); min-height: 1.2em; margin: 4px 0; }
h1, h2, h3 { margin: 0; font-weight: 600; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Botones y campos */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--borde); background: var(--panel); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9d1c6; background: #fafbfa; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.prim { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 600; }
.btn.prim:hover { background: var(--verde-osc); }
.btn.peligro { color: var(--rojo); border-color: #f0c4c2; }
.btn.fino { padding: 5px 10px; font-size: 13px; }
label { display: block; font-size: 13px; color: var(--suave); margin: 10px 0 4px; }
label > input, label > select { display: block; width: 100%; margin-top: 4px; }
input, select { padding: 8px 10px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; color: var(--texto); }
input:focus, select:focus { outline: 2px solid var(--verde-borde); border-color: var(--verde); }

/* PIN */
.pantalla-pin { position: fixed; inset: 0; z-index: 50; background: linear-gradient(160deg, #f7faf5, #e7f1e1); display: flex; align-items: center; justify-content: center; }
.pin-caja { text-align: center; width: 320px; }
.pin-logo { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 14px; }
.pin-caja h1 { font-size: 22px; color: var(--verde-osc); }
.pin-puntos { display: flex; gap: 12px; justify-content: center; margin: 22px 0 6px; min-height: 16px; }
.pin-puntos span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--verde); }
.pin-puntos span.lleno { background: var(--verde); }
.pin-puntos.mal span { border-color: var(--rojo); background: var(--rojo); animation: temblor .3s; }
@keyframes temblor { 25% { transform: translateX(-4px) } 75% { transform: translateX(4px) } }
.pin-error { color: var(--rojo); min-height: 1.3em; font-size: 13px; }
.pin-teclado { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; justify-content: center; margin-top: 8px; }
.pin-teclado button { height: 60px; border-radius: 50%; border: 1px solid var(--borde); background: #fff; font-size: 22px; cursor: pointer; }
.pin-teclado button:hover { background: var(--verde-cl); }
.pin-teclado button.vacia { visibility: hidden; }
.pin-nota { font-size: 12px; margin-top: 18px; }

/* Login */
.pantalla-login { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
.login-lado { background: linear-gradient(160deg, #5aa825, #2f6b10); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center; }
.login-lado h1 { font-size: 32px; margin: 18px 0 10px; }
.login-lado p { max-width: 420px; line-height: 1.5; opacity: .92; }
.login-logo { width: 84px; height: 84px; border-radius: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.login-form { align-self: center; justify-self: center; width: 360px; background: var(--panel); padding: 32px; border-radius: 14px; box-shadow: var(--sombra); }
.login-form h2 { font-size: 22px; }
.login-form .btn { width: 100%; justify-content: center; margin-top: 10px; padding: 10px; }

/* Estructura con barra lateral (estándar DNNS) */
.shell { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.lateral { background: var(--panel); border-right: 1px solid var(--borde); display: flex; flex-direction: column; min-height: 0; }
.marca { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--borde); }
.marca img { width: 36px; height: 36px; border-radius: 9px; }
.marca small { display: block; color: var(--suave); font-size: 12px; }
#menu { flex: 1; overflow: auto; padding: 8px 10px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 16px 8px 6px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; background: none; border-radius: 999px; cursor: pointer; text-align: left; color: var(--texto); }
.nav-item:hover { background: #f1f4f0; }
.nav-item.activo { background: var(--verde-cl); color: var(--verde-osc); font-weight: 600; }
.nav-item .cuenta { margin-left: auto; font-size: 11px; background: var(--ambar-cl); color: var(--ambar); border-radius: 999px; padding: 1px 7px; }
.lateral-pie { border-top: 1px solid var(--borde); padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.yo { flex: 1; min-width: 0; font-size: 12px; }
.yo b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.principal { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.barra { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--borde); min-height: 64px; }
.barra h1 { font-size: 18px; }
.barra .relleno { flex: 1; }
.vista { flex: 1; overflow: auto; padding: 22px 24px 40px; }

/* Chips y avisos */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #eef1ed; color: var(--suave); white-space: nowrap; }
.chip.verde { background: var(--verde-cl); color: var(--verde-osc); }
.chip.ambar { background: var(--ambar-cl); color: var(--ambar); }
.chip.rojo { background: var(--rojo-cl); color: var(--rojo); }
.chip.azul { background: var(--azul-cl); color: var(--azul); }
.led { width: 9px; height: 9px; border-radius: 50%; background: #c8cec6; display: inline-block; flex: none; }
.led.on { background: var(--verde); box-shadow: 0 0 0 3px rgba(90,168,37,.18); }
.aviso { margin: 12px 24px 0; padding: 12px 16px; border-radius: var(--radio); background: var(--azul-cl); display: flex; gap: 12px; align-items: center; }
.aviso > div { flex: 1; }
.caja { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 16px; }
.caja h2 { font-size: 15px; margin-bottom: 12px; }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.vacio { text-align: center; padding: 48px 20px; color: var(--suave); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; }
.kpi b { display: block; font-size: 22px; margin-top: 4px; }
.kpi span { color: var(--suave); font-size: 12px; }
.kpi small { display: block; margin-top: 4px; font-size: 11px; color: var(--suave); }
.kpi small.kpi-ok { color: var(--verde-osc); } .kpi small.kpi-mal { color: var(--rojo); }
.kpi.kpi-rojo { border-color: var(--rojo); background: var(--rojo-cl); }
.kpi.kpi-ambar { border-color: var(--ambar); background: var(--ambar-cl); }
.caja.mini-fila { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.mini-dato { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.mini-dato b { font-size: 15px; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 4px; font-size: 11px; opacity: .7; } .chip-x:hover { opacity: 1; }
.esquema { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.esq-sala { border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 12px; cursor: pointer; }
.esq-sala:hover { border-color: var(--verde); }
.esq-sala h3 { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 0 0 6px; }
.esq-sala ul { list-style: none; margin: 0; padding: 0; }
.esq-sala li { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 0; flex-wrap: wrap; }
.esq-sala li .ic { width: 14px; height: 14px; color: var(--suave); }
.esq-flecha { color: var(--suave); } .esq-sin { color: var(--ambar); font-size: 11px; }
.kpi-link { cursor: pointer; } .kpi-link:hover { border-color: var(--verde); }

/* Tarjetas de MiniServer */
.mini { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; cursor: pointer; box-shadow: var(--sombra); transition: border-color .15s, transform .15s; }
.mini:hover { border-color: var(--verde); transform: translateY(-1px); }
.mini h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mini .datos { color: var(--suave); font-size: 12px; margin: 6px 0 10px; line-height: 1.5; }
.buscar { width: 320px; }

/* Tablas */
table.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: 12px; color: var(--suave); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--borde); }
.tabla td { padding: 6px 8px; border-bottom: 1px solid #f0f2ef; vertical-align: middle; }
.tabla input, .tabla select { width: 100%; padding: 6px 8px; }
.tabla tr.cambiado td { background: #fffbef; }

/* Pizarra de enlaces (estilo Loxone) */
.lienzo-cab { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.pizarra-marco { display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
.paleta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; align-self: start; position: sticky; top: 0; }
.paleta h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 4px 0 8px; }
.paleta h3 + .pal-item { margin-top: 0; }
.pal-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--borde); border-radius: 8px; background: #fbfcfb; cursor: grab; user-select: none; }
.pal-item:hover { border-color: var(--verde); background: var(--verde-cl); }
.pal-nota { font-size: 12px; margin: 12px 0 0; }
.pal-fantasma { position: fixed; z-index: 70; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border: 2px solid var(--verde); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); transform: translate(-50%, -50%); }
.lienzo { position: relative; background: var(--panel) radial-gradient(circle, #dfe5dc 1px, transparent 1px) 0 0 / 16px 16px; border: 1px solid var(--borde); border-radius: var(--radio); overflow: auto; height: calc(100vh - 230px); min-height: 420px; user-select: none; }
.lienzo-dentro { position: relative; }
.pizarra-vacia { position: absolute; top: 40%; left: 0; right: 0; text-align: center; color: var(--suave); font-size: 18px; pointer-events: none; }
.pizarra-vacia span { font-size: 13px; }
.lienzo svg.cables { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.cables path { fill: none; stroke: var(--verde); stroke-width: 2.5; pointer-events: stroke; cursor: pointer; }
.cables path.escena { stroke: var(--azul); }
.cables path.sel { stroke-width: 5; filter: drop-shadow(0 0 3px rgba(0,0,0,.25)); }
.cables path.nuevo { stroke-dasharray: 6 5; stroke: var(--ambar); pointer-events: none; }
.cables path.ancho { stroke: transparent; stroke-width: 14; }
.bloque { position: absolute; z-index: 2; background: #fff; border: 1px solid var(--borde); border-radius: 9px; box-shadow: var(--sombra); padding: 6px 14px 6px 10px; cursor: grab; display: flex; align-items: center; min-width: 150px; min-height: 44px; }
.bloque.ent { border-left: 4px solid var(--verde); }
.bloque.rel { border-right: 4px solid #8a9487; padding: 6px 10px 6px 14px; }
.bloque.sinconf { border-style: dashed; background: var(--ambar-cl); }
.bloque.cogido { cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 3; }
.b-fila { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.b-fila svg.ic { width: 22px; height: 22px; color: var(--verde-osc); }
.b-txt { min-width: 0; flex: 1; }
.b-nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-cap { font-size: 11px; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloque.apagado { opacity: .5; }
.bloque.destino-ok { border-color: var(--ambar); background: var(--ambar-cl); }
.bloque.resaltado { border-color: var(--verde); background: var(--verde-cl); }
.puerto { position: absolute; top: 50%; margin-top: -8px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--verde); background: #fff; }
.bloque.ent .puerto { right: -9px; cursor: crosshair; }
.bloque.rel .puerto { left: -9px; }
.bloque.sinconf .puerto { border-color: #c9c9c9; }
.puerto.con { background: var(--verde); }
.bloque.apagado .puerto { border-color: #bbb; cursor: not-allowed; }
.asa { position: absolute; right: 3px; bottom: 3px; width: 12px; height: 12px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, #b7c0b4 50%, #b7c0b4 60%, transparent 60%, transparent 72%, #b7c0b4 72%, #b7c0b4 82%, transparent 82%); }
.bloque.ent .asa { right: 12px; }
.sala { position: absolute; z-index: 0; border: 2px solid #cfe3bf; background: rgba(233,245,224,.45); border-radius: 14px; }
.sala.cogido { border-color: var(--verde); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.sala-cab { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #d9eacb; cursor: grab; color: var(--verde-osc); border-radius: 12px 12px 0 0; background: rgba(233,245,224,.9); }
.sala-cab .suave { margin-left: auto; font-size: 11px; }
.sala .asa { right: 4px; bottom: 4px; }
.pal-sala svg.ic { color: var(--verde-osc); }
.detalle { position: sticky; bottom: 0; margin-top: 14px; }
.leyenda { display: inline-flex; gap: 14px; font-size: 12px; color: var(--suave); }
.leyenda i { display: inline-block; width: 22px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; background: var(--verde); }
.leyenda i.az { background: var(--azul); }

/* Modal y avisos flotantes */
.modal { position: fixed; inset: 0; background: rgba(20,30,18,.35); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-caja { background: var(--panel); border-radius: 14px; padding: 22px; width: 460px; max-width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal-caja h2 { font-size: 17px; margin-bottom: 8px; }
.modal-caja .botones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2a1c; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 60; max-width: 80%; }
.toast.mal { background: var(--rojo); }
pre.json { background: #f6f8f5; border: 1px solid var(--borde); border-radius: 8px; padding: 12px; max-height: 360px; overflow: auto; font-size: 12px; }
.grupo-btn { display: inline-flex; gap: 6px; margin-right: 6px; }

/* Instalación: MiniServer numerado | estancias | propiedades */
.inst { display: grid; grid-template-columns: 290px minmax(420px, 1fr) 300px; gap: 14px; align-items: start; }
.inst-hw, .inst-ins { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; position: sticky; top: 0; max-height: calc(100vh - 130px); overflow: auto; }
.inst-hw h3, .inst-ins h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.inst-ins h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); margin: 16px 0 6px; }
.hw-placa { margin-top: 12px; }
.hw-tit { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; flex-wrap: wrap; }
.hw-tit .suave { font-weight: 400; font-size: 11px; }
.hw-tit[data-plegar] { cursor: pointer; user-select: none; border-radius: 6px; padding: 4px 2px; }
.hw-tit[data-plegar]:hover { background: var(--fondo); }
.hw-flecha { display: inline-block; width: 10px; font-size: 11px; color: var(--suave); transition: transform .15s; }
.hw-placa.abierta .hw-flecha { transform: rotate(90deg); }
.hw-placa:not(.abierta) .hw-cuerpo { display: none; }
.hw-libres { color: var(--ambar); }
.hw-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); margin: 8px 0 4px; }
.hw-fila { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; user-select: none; }
.hw-fila:hover { background: #f3f6f1; }
.hw-fila.sel { background: var(--verde-cl); border-color: var(--verde-borde); }
.hw-fila.libre .hw-nom { color: var(--ambar); }
.hw-fila.apagada { opacity: .55; }
.hw-fila svg.ic { width: 16px; height: 16px; color: var(--verde-osc); }
.hw-num { font: 600 11px Consolas, monospace; background: #eef1ed; border-radius: 5px; padding: 2px 5px; min-width: 28px; text-align: center; }
.hw-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.hw-fila .chip { font-size: 10px; padding: 1px 7px; }
.sala-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sala-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--borde); border-radius: 999px; background: var(--panel); cursor: pointer; }
.sala-tab.activa { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 600; }
.sala-tab.activa svg.ic { color: #fff; }
.sala-tab .cuenta { font-size: 11px; background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 7px; }
.sala-tab.mas { border-style: dashed; color: var(--verde-osc); }
.nueva-sala { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.sala-vacia { text-align: center; padding: 40px 20px; }
.sala-vacia .nueva-sala { justify-content: center; margin-top: 16px; }
.sala-panel { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 90px; background: var(--panel) radial-gradient(circle, #e3e8e0 1px, transparent 1px) 0 0 / 16px 16px; border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 20px; min-height: 360px; }
.sala-panel.destino { border-color: var(--verde); box-shadow: 0 0 0 3px var(--verde-cl); }
.sala-panel svg.cables { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.sala-col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 0 0 10px; }
.tarjeta { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--borde); border-radius: 10px; box-shadow: var(--sombra); cursor: pointer; }
.tarjeta.ent { border-left: 4px solid var(--verde); }
.tarjeta.sal { border-right: 4px solid #8a9487; }
.tarjeta.sel { border-color: var(--verde); box-shadow: 0 0 0 3px var(--verde-cl); }
.tarjeta.resaltado { background: var(--verde-cl); }
.tarjeta svg.ic { width: 22px; height: 22px; color: var(--verde-osc); flex: none; }
.t-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.t-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-txt span { font-size: 11px; color: var(--suave); }
.t-txt .t-fuera { color: var(--azul); }
.tarjeta .puerto { position: absolute; top: 50%; margin-top: -8px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--verde); background: #fff; }
.tarjeta.ent .puerto { right: -9px; cursor: crosshair; }
.tarjeta.sal .puerto { left: -9px; }
.anadir { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.anadir .btn { border-style: dashed; }
.pasos { padding-left: 18px; line-height: 1.6; margin: 6px 0 12px; }
.aviso-i { background: var(--ambar-cl); border-radius: 8px; padding: 8px 10px; margin-top: 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.i-enl { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #f0f2ef; }
.i-enl > span { flex: 1; min-width: 0; }
.i-enl select { width: auto; padding: 4px 6px; }
#i-anadir-enl { width: 100%; margin-top: 8px; }
select.resalta { border-color: var(--ambar); box-shadow: 0 0 0 3px var(--ambar-cl); }
.tarjeta.fantasma { border-style: dashed; background: #fafbfa; box-shadow: none; }
.tarjeta.fantasma b { color: var(--suave); }
.tarjeta .btn.fino { padding: 3px 8px; font-size: 12px; }
.anadir .suave { font-size: 12px; align-self: center; }
.hw-apagadas summary { cursor: pointer; font-size: 12px; color: var(--suave); padding: 6px 8px; }

/* Aprovechar toda la pantalla en Instalación */
.inst { grid-template-columns: minmax(250px, 300px) minmax(420px, 1fr) minmax(270px, 330px); height: calc(100vh - 128px); }
.inst-hw, .inst-ins { position: static; max-height: none; height: 100%; }
.inst-centro { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.inst-centro .sala-panel { flex: 1; min-height: 0; overflow: auto; align-content: start; }
.pie-sala { font-size: 12px; margin: 6px 0 0; }
.sala-col .anadir { margin: 0 0 12px; }
/* Menú lateral plegado: solo iconos */
.marca { position: relative; }
.plegar { margin-left: auto; border: 1px solid var(--borde); background: #fff; border-radius: 6px; cursor: pointer; width: 26px; height: 26px; color: var(--suave); flex: none; }
.shell.plegado { grid-template-columns: 64px 1fr; }
.shell.plegado .marca { flex-direction: column; padding: 14px 8px; }
.shell.plegado .marca-txt, .shell.plegado .nav-label, .shell.plegado .nav-item span, .shell.plegado .yo, .shell.plegado #btn-bloquear { display: none; }
.shell.plegado .plegar { margin: 8px 0 0; }
.shell.plegado #menu { padding: 8px 6px; }
.shell.plegado .nav-item { justify-content: center; padding: 10px 0; }
.shell.plegado .lateral-pie { justify-content: center; }

/* Escenas: lista */
.esc-lista .fila h2 { margin-right: auto; }
.esc-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--borde); border-radius: var(--radio); margin: 10px 0; background: #fff; cursor: default; }
.esc-item:hover { border-color: var(--verde-borde); }
.esc-ic { width: 38px; height: 38px; border-radius: 9px; background: var(--ambar-cl); color: var(--ambar); display: grid; place-items: center; flex: none; }
.esc-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.esc-txt span { color: var(--suave); font-size: 13px; }
/* Escenas: editor visual */
.esc-ed { display: grid; grid-template-columns: 220px 1fr 290px; grid-template-rows: auto 1fr; gap: 12px; height: calc(100vh - 128px); }
.esc-cab { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 8px 12px; }
.esc-nombre { display: flex; align-items: center; gap: 8px; margin: 0; }
.esc-nombre input { width: 220px; margin: 0; }
.esc-cab #esc-huecos { margin-left: auto; font-size: 13px; }
.esc-pal, .esc-prop { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; overflow: auto; min-height: 0; }
.esc-pal h3, .esc-prop h3 { font-size: 13px; display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; }
.esc-pal h3:first-child, .esc-prop h3:first-child { margin-top: 0; }
.pal-it { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; user-select: none; font-size: 13px; }
.pal-it:hover { background: #f3f6f1; }
.pal-it small { margin-left: auto; color: var(--suave); font-size: 11px; }
.pal-it svg.ic { width: 16px; height: 16px; }
.pal-it.disp svg.ic { color: var(--ambar); }
.pal-it.acc svg.ic { color: var(--verde-osc); }
.pal-it.usado { opacity: .45; }
.pal-it.off { opacity: .45; cursor: not-allowed; }
.pal-tit { font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; margin: 6px 8px 2px; }
.esc-lienzo { position: relative; overflow: auto; min-height: 0; border: 1px solid var(--borde); border-radius: var(--radio);
  background-color: #fbfcfb; background-image: linear-gradient(#eef1ed 1px, transparent 1px), linear-gradient(90deg, #eef1ed 1px, transparent 1px); background-size: 22px 22px; }
.esc-lienzo.encima { outline: 2px dashed var(--verde); outline-offset: -4px; }
.esc-cables { position: absolute; left: 0; top: 0; pointer-events: none; }
.esc-cables path { fill: none; stroke: #93a08f; stroke-width: 2; }
.esc-nodos { position: relative; display: grid; grid-template-columns: repeat(3, minmax(170px, 230px)); justify-content: space-evenly; align-items: center; min-height: 100%; padding: 30px 20px; }
.esc-col { display: flex; flex-direction: column; gap: 16px; }
.nodo { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 2px solid; background: #fff; cursor: pointer; box-shadow: var(--sombra); }
.nodo > div { display: flex; flex-direction: column; min-width: 0; }
.nodo b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nodo small { color: var(--suave); font-size: 11px; }
.nodo.sel { box-shadow: 0 0 0 3px rgba(90,168,37,.35); }
.n-disp { border-color: #e9b949; background: #fff8e6; } .n-disp svg.ic { color: var(--ambar); }
.n-dest { border-color: #6cb6d9; background: #eef8fc; } .n-dest svg.ic { color: var(--azul); }
.n-acc { border-color: #7cc35a; background: #eef8e8; } .n-acc svg.ic { color: var(--verde-osc); }
.n-acc.auto { border-style: dashed; }
.nodo.hueco { border: 2px dashed var(--borde); color: var(--suave); background: rgba(255,255,255,.7); flex-direction: column; align-items: flex-start; gap: 2px; cursor: default; box-shadow: none; }
.pin-in, .pin-out { position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #fff; border: 2px solid currentColor; color: #93a08f; }
.pin-in { left: -7px; } .pin-out { right: -7px; }
.n-disp .pin-in, .n-acc .pin-out { display: none; }
.nodo-x { position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--borde); background: #fff; color: var(--rojo); cursor: pointer; line-height: 16px; padding: 0; display: none; }
.nodo:hover .nodo-x, .nodo.sel .nodo-x { display: block; }
.esc-prop .fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.esc-prop select, .esc-prop input { width: 100%; }
.dias { display: flex; gap: 4px; }
.dia { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--borde); background: #fff; cursor: pointer; }
.dia.on { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 600; }
.acciones { display: flex; flex-direction: column; gap: 6px; }
.aviso-p { background: var(--ambar-cl); color: #7a4d00; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
/* Entradas y relés: número pegado al nombre, dos columnas */
.dos-col { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; align-items: start; }
.dos-col .caja { margin: 0 0 14px; }
.num-campo { display: flex; align-items: center; gap: 8px; }
.num-campo span { font-weight: 600; color: var(--verde-osc); width: 26px; flex: none; }
.num-campo input { flex: 1; }
@media (max-width: 1000px) { .dos-col { grid-template-columns: 1fr; } }

/* Compacto (Antonio 29-09): menú, MiniServer y panel derecho a la mitad; el centro para configurar */
.shell { grid-template-columns: 124px 1fr; }
.marca { flex-wrap: wrap; gap: 6px; padding: 10px 8px; }
.marca img { width: 26px; height: 26px; border-radius: 7px; }
.marca-txt b { font-size: 12px; line-height: 1.2; display: block; }
.marca small { font-size: 10px; }
.plegar { width: 22px; height: 22px; }
#menu { padding: 6px 6px; }
.nav-label { font-size: 10px; margin: 12px 6px 4px; }
.nav-item { gap: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.2; }
.nav-item svg.ic { width: 15px; height: 15px; }
.nav-item span { white-space: normal; }
.lateral-pie { flex-direction: column; align-items: stretch; padding: 8px; gap: 6px; }
.yo { font-size: 10px; } .yo b { font-size: 11px; }
.lateral-pie .btn.fino { justify-content: center; padding: 4px 6px; font-size: 12px; }
.inst { grid-template-columns: 148px minmax(420px, 1fr) 170px; gap: 10px; }
.inst-hw, .inst-ins { padding: 10px 8px; }
.inst-hw h3, .inst-ins h3 { font-size: 12px; }
.inst-hw .pal-nota { display: none; }
.hw-tit { font-size: 12px; } .hw-tit .suave { display: block; width: 100%; }
.hw-fila { gap: 5px; padding: 4px 4px; }
.hw-fila svg.ic, .hw-fila .chip { display: none; }
.hw-num { font-size: 10px; min-width: 24px; padding: 1px 3px; }
.hw-nom { font-size: 12px; }
.hw-fila.libre .hw-num { background: var(--ambar-cl); color: var(--ambar); }
.inst-ins { font-size: 12px; }
.inst-ins label { font-size: 11px; margin: 8px 0 3px; }
.inst-ins input, .inst-ins select, .inst-ins .btn { font-size: 12px; }
.inst-ins select, .inst-ins input { padding: 5px 6px; width: 100%; }
.inst-ins .btn { padding: 5px 8px; white-space: normal; }
.inst-ins h4 { font-size: 10px; margin: 12px 0 4px; }
.inst-ins .i-enl { font-size: 12px; flex-wrap: wrap; }
.inst-ins .pasos { padding-left: 16px; }
.esc-ed { grid-template-columns: 150px 1fr 270px; }

/* Editor flotante (doble clic en un elemento) — Antonio 29-09: la zona de trabajo usa todo el ancho */
.inst { grid-template-columns: 148px 1fr; }
.pop-fondo { position: fixed; inset: 0; background: rgba(20,30,18,.25); z-index: 50; display: grid; place-items: center; }
.inst-ins.pop { position: relative; width: 380px; max-width: 92vw; height: auto; max-height: 85vh; overflow: auto; padding: 18px 20px; font-size: 13px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.inst-ins.pop h3 { font-size: 15px; padding-right: 28px; }
.inst-ins.pop label { font-size: 12px; margin: 10px 0 4px; }
.inst-ins.pop input, .inst-ins.pop select { font-size: 13px; padding: 7px 8px; width: 100%; }
.inst-ins.pop .btn { font-size: 13px; }
.inst-ins.pop h4 { font-size: 11px; margin: 16px 0 6px; }
.inst-ins.pop .i-enl { font-size: 13px; flex-wrap: nowrap; }
.inst-ins.pop .i-enl select { width: auto; }
.pop-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--borde); background: #fff; cursor: pointer; font-size: 16px; line-height: 1; color: var(--suave); }
.pop-x:hover { color: var(--rojo); border-color: #f0c4c2; }
.tarjeta.sal .puerto { cursor: crosshair; }
.tarjeta.resaltado { outline: 2px solid var(--ambar); }
/* Esquina para cambiar el tamaño de un recuadro */
.tarjeta { max-width: 100%; }
.tarjeta .asa { position: absolute; right: 3px; bottom: 3px; width: 12px; height: 12px; cursor: nwse-resize; opacity: 0; transition: opacity .1s;
  background: linear-gradient(135deg, transparent 50%, #9aa596 50%, #9aa596 58%, transparent 58%, transparent 72%, #9aa596 72%, #9aa596 80%, transparent 80%); }
.tarjeta.ent .asa { right: 14px; }
.tarjeta:hover .asa, .tarjeta.sel .asa { opacity: 1; }
/* Estancia = lienzo libre: cada recuadro donde se deje */
.sala-panel, .inst-centro .sala-panel { display: block; padding: 0; }
.sala-lienzo { position: relative; min-width: 100%; min-height: 100%; }
.sala-lienzo .tarjeta { position: absolute; width: 240px; margin: 0; cursor: grab; }
.sala-lienzo .tarjeta.moviendo { cursor: grabbing; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.sala-vacia-txt { position: absolute; top: 40%; left: 0; right: 0; text-align: center; }
.ayuda-uso { font-size: 12px; color: var(--suave); background: #f6f8f5; border-radius: 7px; padding: 7px 9px; margin: 6px 0 0; line-height: 1.4; }
/* En directo: lo que está encendido de verdad */
.tarjeta.sal.vivo-on { background: #fff8d6; border-color: #f0c64a; box-shadow: 0 0 0 3px rgba(240,198,74,.35), 0 0 18px rgba(240,198,74,.45); }
.tarjeta.sal.vivo-on svg.ic { color: #d99a00; fill: rgba(255,210,60,.45); }
.tarjeta.ent.vivo-on { background: var(--verde-cl); box-shadow: 0 0 0 3px rgba(90,168,37,.3); }
.hw-fila.vivo-on .hw-num { background: #f0c64a; color: #fff; }
.hw-fila.ent.vivo-on .hw-num, .hw-fila[data-punto^="ent"].vivo-on .hw-num { background: var(--verde); }
/* Asas de tamaño: borde derecho, borde de abajo y esquina (siempre activas) */
.tarjeta .asa { opacity: 1; background: none; }
.tarjeta .asa-d { top: 0; bottom: 0; right: -3px; width: 7px; height: auto; cursor: ew-resize; }
.tarjeta .asa-b { left: 0; right: 0; bottom: -3px; height: 7px; width: auto; cursor: ns-resize; }
.tarjeta .asa-db { right: -3px; bottom: -3px; width: 14px; height: 14px; cursor: nwse-resize; }
.tarjeta.ent .asa-db { right: -3px; }
.tarjeta:hover .asa-d, .tarjeta:hover .asa-b { background: rgba(90,168,37,.18); }
.tarjeta:hover .asa-db { background: linear-gradient(135deg, transparent 50%, #9aa596 50%, #9aa596 60%, transparent 60%, transparent 72%, #9aa596 72%, #9aa596 82%, transparent 82%); }
.tarjeta .puerto { z-index: 3; }
#i-sacar { margin-top: 14px; }

/* Utilidades (la CSP no deja style="" en el HTML) */
.u-m0 { margin: 0 !important; } .u-mb12 { margin: 0 0 12px !important; } .u-mb14 { margin-bottom: 14px; } .u-mb18 { margin-bottom: 18px; }
.u-w64 { width: 64px !important; } .u-w80 { width: 80px !important; } .u-w90 { width: 90px !important; } .u-w130 { width: 130px !important; } .u-w170 { width: 170px !important; } .u-w300 { width: 300px !important; }
.u-wauto { width: auto !important; } .u-winl { width: auto !important; display: inline !important; } .u-dcha { text-align: right; } .u-sep { justify-content: space-between; }
.ley { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin: 0 4px 0 2px; }
.ley.verde { background: var(--verde); } .ley.azul { background: var(--azul); }
.placas-tabla tr.fila-placa { cursor: pointer; }
.placas-tabla tr.fila-placa:hover td { background: #f3f6f1; }
.placas-tabla tr.ejemplo td { opacity: .5; font-style: italic; }

/* Aviso al salir con cambios sin enviar */
.aviso-salir { display: flex; gap: 14px; align-items: flex-start; }
.aviso-salir > .ic { flex: none; width: 38px; height: 38px; padding: 8px; border-radius: 50%; background: var(--ambar-cl); color: var(--ambar); }
.aviso-salir p { margin: 0 0 8px; }
.aviso-salir ul { margin: 0 0 10px; padding-left: 18px; }
.aviso-salir li { margin: 2px 0; }
.b-atras { font-size: 16px; line-height: 1; padding: 5px 10px; margin-right: 4px; }
/* El círculo de enlazar va por encima del borde de redimensionar (antes el borde se lo tragaba) */
.tarjeta .puerto { z-index: 3; }
.tarjeta .asa { z-index: 2; }
.mini-col { font-size: 13px; white-space: nowrap; }
.mini-col span { display: block; font-size: 11px; color: var(--suave); }
.mini-col code { font-size: 12px; }
.mini-notas { margin: -8px 0 16px 4px; font-size: 12px; }
.rm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; min-width: 420px; }
.rm-grid .rm-nombre, .rm-grid .rm-direccion, .rm-grid .rm-notas { grid-column: 1 / -1; }
/* Varios pulsadores de pared en paralelo sobre una misma entrada */
.tarjeta .fisicos { position: absolute; right: calc(100% + 44px); top: 0; display: flex; flex-direction: column; gap: 8px; }
.fisico { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px dashed #b7c0b4; border-radius: 16px; padding: 4px 10px 4px 6px; font-size: 12px; white-space: nowrap; max-width: 160px; }
.fisico span { overflow: hidden; text-overflow: ellipsis; }
.fisico .ic { width: 14px; height: 14px; color: var(--suave); flex: none; }
.cables path.fisico-cable { stroke: #aab4a6; stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; pointer-events: none; }
.i-fis { display: flex; gap: 6px; margin-bottom: 6px; } .i-fis input { flex: 1; }
.tarjeta.borne { border-style: dashed; background: #f7faf5; }
.tarjeta.borne .t-txt span { color: var(--verde-osc); }
.fisico { cursor: pointer; } .fisico:hover { border-color: var(--verde); }
.fisico.plegado { border-style: solid; font-weight: 600; } .fisico.plegado b { color: var(--suave); font-weight: 400; margin-left: 2px; }
.i-fis { align-items: center; } .i-fis-n { width: 18px; font-size: 12px; color: var(--suave); text-align: right; }
#i-notas { width: 100%; resize: vertical; font: inherit; font-size: 13px; padding: 8px; border: 1px solid var(--borde); border-radius: 8px; margin-bottom: 10px; box-sizing: border-box; }
.t-nota { color: var(--suave); font-weight: 400; font-size: 12px; cursor: help; }
.fisico.solo { cursor: default; border-style: solid; }
.fisico[data-pulsar] { cursor: pointer; } .fisico.solo { cursor: pointer; }
.fisico.pulsado { background: var(--verde); color: #fff; border-color: var(--verde); } .fisico.pulsado .ic { color: #fff; }
.fisico.plegado b[data-fis-plegar] { cursor: pointer; padding: 0 4px; }
.fis-plegar { font-size: 11px; font-weight: 400; color: var(--suave); cursor: pointer; align-self: flex-end; }
.fisico.manteniendo { background: var(--ambar-cl); border-color: var(--ambar); border-style: solid; font-variant-numeric: tabular-nums; }
/* Panel de la escena sin barra horizontal: los días se reparten y los campos no se salen */
.esc-prop { overflow-x: hidden; }
.esc-prop .dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.esc-prop .dia { min-width: 0; width: auto; padding: 6px 0; font-size: 12px; }
.esc-prop .fila2 > * { min-width: 0; }
.esc-prop input[type=time] { min-width: 0; }
.reloj-mini { border: 1px solid var(--borde); border-radius: 8px; padding: 8px 10px; margin: 10px 0 6px; background: var(--fondo); }
.reloj-mini span { display: block; font-size: 11px; color: var(--suave); }
.reloj-mini > b { font-size: 20px; font-variant-numeric: tabular-nums; }
.reloj-mini small { display: block; font-size: 11px; color: var(--suave); } .reloj-mini .ok { color: var(--verde-osc); }
.reloj-mini.mal { border-color: var(--ambar); background: var(--ambar-cl); }
/* Barra superior: el título no se parte en líneas y los botones bajan de fila si no caben (sin barra horizontal) */
.barra { flex-wrap: wrap; row-gap: 8px; }
.barra h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.reloj-mini > b .seg { display: inline; font-size: 14px; color: var(--suave); font-weight: 600; }
.grupo-red { margin-bottom: 16px; } .grupo-red h3 { font-size: 14px; display: inline-flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.grupo-red > .suave { margin: 0 0 8px; font-size: 12px; } details.grupo-red summary { cursor: pointer; list-style: none; } details.grupo-red summary::-webkit-details-marker { display: none; }
details.grupo-red summary::before { content: '▸ '; color: var(--suave); } details.grupo-red[open] summary::before { content: '▾ '; }
.sep-red { border: 0; border-top: 1px solid var(--borde); margin: 4px 0 16px; }
/* Pantalla de conexión: enlaces bajo el formulario */
.login-enlaces { margin-top: 16px; text-align: center; line-height: 1.9; }
.login-enlaces a { color: var(--acento, #69b865); text-decoration: none; }
.login-enlaces a:hover { text-decoration: underline; }
/* Versión web (domo.dnns.es/tech/): sin PIN del programa */
body.web #btn-bloquear { display: none; }
code.clave-grande { display: inline-block; font-size: 16px; padding: 8px 12px; background: var(--fondo, #f3f5f2); border-radius: 8px; user-select: all; word-break: break-all; }

h3.pers-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--verde, #4a8a2a); margin: 16px 0 6px; padding-top: 10px; border-top: 1px solid #e5e9e2; }
.t-pers { display: block; font-size: 11px; color: var(--verde-osc); font-weight: 600; margin-top: 2px; }
.cables path.persiana { stroke: var(--verde-osc); stroke-width: 2.5; stroke-dasharray: 8 4; fill: none; pointer-events: none; }
.cables path.persiana.par { stroke-width: 3; stroke-dasharray: none; }
.t-pctl { position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); width: 168px; background: #fff; border: 1px solid var(--verde-borde); border-radius: 10px; padding: 6px 8px; box-shadow: 0 2px 8px rgba(0,0,0,.08); z-index: 2; }
.t-pbarra { height: 6px; border-radius: 3px; background: #e3e8df; margin: 2px 0 3px; overflow: hidden; }
.t-pbarra i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .15s linear; }
.t-ptxt { display: block; font-size: 11px; color: var(--suave); }
.t-pbotones { display: flex; gap: 4px; margin-top: 4px; }
.t-pbotones .btn { padding: 2px 10px; min-width: 0; font-size: 12px; }
.tarjeta.pers-mov { box-shadow: 0 0 0 2px var(--verde-borde); }
.tarjeta.pers-bloque { min-width: 230px; border-left: 4px solid var(--verde); }
.tarjeta.pers-bloque .t-pbarra { margin-top: 6px; }
.pg-lista { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pg-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
