:root { --bg:#f4f6f9; --panel:#fff; --text:#18212b; --muted:#667587; --line:#d9e0e8; --brand:#1a73e8; --danger:#c5221f; --ok:#1e8e3e; }
@media (prefers-color-scheme: dark) { :root { --bg:#10151b; --panel:#18202a; --text:#e8edf2; --muted:#93a1b1; --line:#2a3542; --brand:#6aa8ff; --danger:#ff8a80; } }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.danger { color: var(--danger); }
button.ghost { width: 100%; margin-top: 10px; }
button:disabled { opacity: .6; cursor: default; }
input[type=text], input[type=password], #user, #pass { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.muted { color: var(--muted); } .pad { padding: 24px; } .grow { flex: 1; }
.err { color: var(--danger); min-height: 1.3em; margin: 4px 0; font-size: 14px; }

#login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
#loginForm { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
#loginForm h1 { margin: 0; font-size: 26px; } .sub { margin: 0 0 6px; color: var(--muted); }
#loginForm label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }

#app { height: 100%; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
#who { color: var(--muted); font-size: 14px; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
aside { background: var(--panel); border-right: 1px solid var(--line); padding: 14px; overflow: auto; }
aside h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#clients { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#clients li { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
#clients li.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
#clients .cid { font-weight: 600; word-break: break-all; }
#clients .when { color: var(--muted); font-size: 12px; }
.pisos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.pisos button { padding: 3px 10px; border-radius: 99px; font-size: 13px; }
.pisos button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
main { overflow: auto; min-width: 0; }
#viewer { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.title { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.chip { background: var(--brand); color: #fff; border-radius: 99px; padding: 1px 10px; font-size: 13px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; }
.stagewrap { position: relative; flex: none; height: clamp(420px, 72vh, 920px); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; } /* absoluto: el alto no depende del contenedor flexible */
#stage:active { cursor: grabbing; }
.scaletag { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: #4a5a6b; background: rgba(255,255,255,.85); padding: 2px 8px; border-radius: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; align-items: center; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.sw.wall { background: #2b3440; height: 5px; vertical-align: 2px; } .sw.cam { background: rgba(234,67,53,.35); border: 1px solid #ea4335; } .sw.ap { background: rgba(26,115,232,.2); border: 1px dashed #1a73e8; border-radius: 50%; }
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.card h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card ul { margin: 0; padding-left: 18px; } .card li { margin: 2px 0; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } aside { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; } .stagewrap { height: clamp(360px, 62vh, 700px); } }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 7px 14px; background: var(--panel); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }
.stagewrap #stage3d { position: absolute; inset: 0; }
.msg3d { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #4a5a6b; background: #f4f7fb; }
.zoombtns { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoombtns button { width: 36px; height: 36px; padding: 0; font-size: 20px; line-height: 1; color: #18212b; background: rgba(255,255,255,.92); border-color: #cfd7e0; }
.rng { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.rng input { width: 150px; }
