:root {
  --bg:#0f1720; --panel:#17212c; --panel2:#1d2935; --line:#263241; --text:#e6edf3; --muted:#8b98a5;
  --accent:#2f81f7; --ok:#3fb950; --warn:#d29922; --err:#f85149;
}
* { box-sizing:border-box; }
html, body { height:100%; }
body { margin:0; background:var(--bg); color:var(--text); font:14px/1.4 "Segoe UI", system-ui, sans-serif; display:flex; flex-direction:column; overflow:hidden; user-select:none; }
svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
[hidden] { display:none !important; }

/* Barra superior: en el programa de escritorio también es la barra de la ventana. */
#bar { height:36px; flex:none; display:flex; align-items:center; gap:12px; padding:0 0 0 12px; background:var(--panel); border-bottom:1px solid var(--line); }
#bar .brand { display:flex; align-items:center; gap:7px; color:var(--text); }
#bar .brand svg { width:20px; height:20px; }
#bar strong { font-size:14px; font-weight:600; }
#status { color:var(--muted); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.grow { flex:1; align-self:stretch; }
#route { font-size:12px; padding:2px 9px; border-radius:10px; background:#263241; white-space:nowrap; }
#route.direct { background:rgba(63,185,80,.16); color:var(--ok); }
#route.relay { background:rgba(210,153,34,.18); color:var(--warn); }
#rec-badge { font-size:12px; color:var(--err); white-space:nowrap; }
#bar button { font:inherit; font-size:13px; border:0; cursor:pointer; }
#hangup { padding:4px 12px; border-radius:6px; background:var(--err); color:#fff; margin-right:8px; }
#wincontrols { display:flex; align-self:stretch; }
#wincontrols button { width:40px; background:transparent; color:var(--muted); display:grid; place-items:center; }
#wincontrols button svg { width:10px; height:10px; stroke-width:1.2; }
#wincontrols button:hover { background:#263241; color:var(--text); }
#wincontrols button.close:hover { background:#c42b1c; color:#fff; }

/* Inicio */
#home { flex:1; display:flex; align-items:stretch; align-content:center; justify-content:center; gap:20px; padding:24px; flex-wrap:wrap; overflow:auto;
  background:radial-gradient(1200px 500px at 50% -10%, rgba(47,129,247,.14), transparent 60%), var(--bg); }
.card { width:min(380px, 100%); background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:26px; display:flex; flex-direction:column; gap:14px; box-shadow:0 12px 32px rgba(0,0,0,.25); user-select:text; }
.eyebrow { font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.card h1 { margin:-6px 0 2px; font-size:21px; }
#mine .num { font-size:38px; font-weight:600; letter-spacing:3px; line-height:1.1; }
.link { align-self:flex-start; padding:0; border:0; background:none; color:var(--accent); font:inherit; font-size:13px; cursor:pointer; }
.presence { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); }
.presence .dot { width:9px; height:9px; border-radius:50%; background:var(--muted); }
.presence.on .dot { background:var(--ok); box-shadow:0 0 0 3px rgba(63,185,80,.2); }
.presence.on { color:var(--ok); }
.presence.off .dot { background:var(--err); }
.hint { margin:0; color:var(--muted); font-size:13px; }
.optional { color:var(--muted); font-weight:400; }
#pwHint { margin-top:-6px; }
.menu button:disabled { opacity:.45; cursor:not-allowed; }
#err.wait { color:var(--muted); }
.hint.version { margin-top:auto; font-size:12px; opacity:.7; }
.hint.warn { color:var(--warn); margin-top:-8px; }
#acceso label, #login label { font-size:13px; color:var(--muted); display:flex; flex-direction:column; gap:6px; }
#acceso input, #login input { font:inherit; width:100%; padding:10px 12px; border-radius:8px; border:1px solid #30404f; background:var(--bg); color:var(--text); }
#acceso input:focus, #login input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(47,129,247,.2); }
#login input.big { font-size:22px; letter-spacing:2px; padding:9px 12px; }
.pw { position:relative; display:block; }
.pw input { padding-right:42px !important; }
#eye { position:absolute; right:4px; top:50%; transform:translateY(-50%); width:34px; height:32px; border:0; background:none; color:var(--muted); cursor:pointer; display:grid; place-items:center; }
#eye.on, #eye:hover { color:var(--text); }
#go, #aGo { font:inherit; font-weight:600; padding:11px; border:0; border-radius:8px; background:var(--accent); color:#fff; cursor:pointer; }
#go:hover, #aGo:hover { filter:brightness(1.1); }
#go:disabled, #aGo:disabled { opacity:.6; cursor:default; }
#acceso input.codigo { font:600 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing:6px; text-align:center; }
#err, #aErr { color:var(--err); font-size:13px; min-height:1em; margin-top:-6px; }
.tecnico { display:flex; align-items:center; gap:10px; padding-top:12px; border-top:1px solid var(--line); font-size:13px; color:var(--muted); }
.tecnico span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tecnico .link { align-self:auto; }
#recent { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
#recent button { font:inherit; font-size:13px; padding:5px 10px; border-radius:16px; border:1px solid var(--line); background:var(--panel2); color:var(--text); cursor:pointer; }
#recent button:hover { border-color:var(--accent); }

/* Pantalla remota */
#stage { flex:1; display:none; background:#000; position:relative; outline:none; overflow:hidden; }
#stage video { width:100%; height:100%; object-fit:contain; display:block; cursor:none; }
#stage.original { overflow:auto; }
#stage.original video { width:auto; height:auto; max-width:none; object-fit:fill; margin:0 auto; }
#stage.viewonly video, #stage.localcursor video { cursor:default; }

/* Barra de herramientas flotante */
#toolbar { position:fixed; top:44px; left:50%; transform:translateX(-50%); z-index:10; display:flex; flex-direction:column; align-items:center; }
#toolbar .tools { display:flex; gap:6px; padding:6px; background:rgba(23,33,44,.96); border:1px solid var(--line); border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,.4); }
#toolbar .tools button { width:34px; height:30px; border:0; border-radius:7px; background:var(--accent); color:#fff; cursor:pointer; display:grid; place-items:center; font:600 10px/1 "Segoe UI", system-ui, sans-serif; }
#toolbar .tools button:hover { filter:brightness(1.15); }
#toolbar .tools button.on { background:#3d4b5a; }
#toolbar .tools #pin { background:#3d4b5a; }
#toolbar .tools #pin.on { background:var(--accent); }
#toolbar .tools button.danger { background:var(--err); }
#toolbar .tools .rec { width:52px; white-space:nowrap; display:flex; justify-content:center; align-items:center; }
#toolbar .tools .rec::before { content:"●"; margin-right:3px; }
#toolbar .tools .rec.recording { background:var(--err); }
#toolbar .tools #vozBtn.sonando { background:var(--ok); color:#06210c; animation:sonando 1.2s ease-in-out infinite; }
#toolbar .tools #vozBtn.activa { background:var(--err); }
#toolbar .tools #vozBtn.activa svg { transform:rotate(135deg); }
#toolbar .tools #vozMudo { background:#3d4b5a; }
#toolbar .tools #vozMudo[aria-pressed="true"] { background:var(--warn); color:#1d1300; }
@keyframes sonando { 50% { box-shadow:0 0 0 5px rgba(63,185,80,.25); } }
#toolbar .handle { display:grid; place-items:center; width:46px; height:16px; margin-top:-1px; padding:0; background:rgba(23,33,44,.96); border:1px solid var(--line); border-top:0; border-radius:0 0 8px 8px; color:var(--muted); cursor:pointer; }
#toolbar .handle:hover { color:var(--text); }
#toolbar .handle svg { width:13px; height:13px; transition:transform .15s; }
#toolbar.collapsed .tools { display:none; }
#toolbar.collapsed { top:36px; }
#toolbar.collapsed .handle { width:56px; height:18px; border:0; border-radius:0 0 9px 9px; background:var(--accent); color:#fff; box-shadow:0 4px 12px rgba(0,0,0,.35); }
#toolbar.collapsed .handle svg { transform:rotate(180deg); }

.menu { position:absolute; top:46px; min-width:260px; max-height:calc(100vh - 100px); overflow-y:auto; padding:6px 0; background:#1b1f24; border:1px solid #30363d; border-radius:8px; box-shadow:0 10px 28px rgba(0,0,0,.5); }
.menu button, .menu label { display:flex; align-items:center; gap:8px; width:100%; padding:6px 14px; border:0; background:transparent; color:var(--text); font:inherit; text-align:left; cursor:pointer; }
.menu button:hover, .menu label:hover { background:#2a313a; }
.menu input { accent-color:var(--accent); margin:0; }
.menu hr { border:0; border-top:1px solid #30363d; margin:6px 0; }
.menu .medida { margin-left:auto; padding-left:12px; white-space:nowrap; color:var(--muted); font-size:12px; }
.menu .label { padding:4px 14px 2px; color:var(--muted); font-size:12px; }

#toast button { margin-left:12px; font:inherit; font-weight:600; color:#fff; background:#2f81f7; border:0; border-radius:6px; padding:4px 10px; cursor:pointer; }
#toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:20; padding:9px 16px; border-radius:8px; background:#1b1f24; border:1px solid #30363d; box-shadow:0 6px 20px rgba(0,0,0,.4); font-size:13px; }

/* Chat */
#toolbar .tools #chatBtn { position:relative; }
#toolbar .badge { position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; padding:0 4px; border-radius:8px; background:var(--err); color:#fff; font:600 10px/16px "Segoe UI", system-ui, sans-serif; }
#chatPanel { position:fixed; right:12px; top:48px; bottom:12px; width:320px; z-index:15; display:flex; flex-direction:column; background:rgba(23,33,44,.98); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 32px rgba(0,0,0,.5); overflow:hidden; }
body.full #chatPanel { top:12px; }
.chat-head { display:flex; align-items:center; padding:10px 8px 10px 14px; border-bottom:1px solid var(--line); }
.chat-head strong { flex:1; }
.chat-head button { width:30px; height:28px; border:0; border-radius:6px; background:none; color:var(--muted); display:grid; place-items:center; cursor:pointer; }
.chat-head button:hover { background:#263241; color:var(--text); }
#chatLog { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:8px; user-select:text; }
.chat-empty { margin:auto; text-align:center; color:var(--muted); font-size:13px; max-width:220px; }
.cmsg { max-width:85%; padding:7px 11px; border-radius:12px; white-space:pre-wrap; word-wrap:break-word; }
.cmsg small { display:block; font-size:11px; opacity:.7; margin-top:2px; }
.cmsg.them { align-self:flex-start; background:var(--panel2); border:1px solid var(--line); border-bottom-left-radius:4px; }
.cmsg.me { align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
#chatForm { display:flex; gap:8px; padding:10px; border-top:1px solid var(--line); }
#chatForm input { flex:1; font:inherit; padding:8px 10px; border-radius:8px; border:1px solid #30404f; background:var(--bg); color:var(--text); user-select:text; }
#chatForm input:focus { outline:none; border-color:var(--accent); }
#chatForm button { width:38px; border:0; border-radius:8px; background:var(--accent); color:#fff; display:grid; place-items:center; cursor:pointer; }

/* Archivos */
#toolbar .tools #filesBtn { position:relative; }
#filesPanel { position:fixed; right:12px; top:48px; bottom:12px; width:340px; z-index:15; display:flex; flex-direction:column; background:rgba(23,33,44,.98); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 32px rgba(0,0,0,.5); overflow:hidden; }
body.full #filesPanel { top:12px; }
.fdrop { margin:12px 12px 0; display:flex; flex-direction:column; align-items:center; gap:4px; padding:14px 12px; border:1.5px dashed #30404f; border-radius:12px; color:var(--muted); font-size:12px; text-align:center; cursor:pointer; }
.fdrop svg { width:24px; height:24px; color:var(--accent); }
.fdrop strong { color:var(--text); font-size:14px; }
.fdrop:hover { border-color:var(--accent); background:rgba(47,129,247,.08); }
#flist { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:8px; }
.frow { display:grid; grid-template-columns:32px 1fr auto; gap:4px 10px; align-items:center; padding:10px 12px; border-radius:10px; background:var(--panel2); border:1px solid var(--line); }
.frow .ic { grid-column:1; grid-row:1 / span 2; width:32px; height:32px; border-radius:8px; display:grid; place-items:center; background:rgba(47,129,247,.12); color:var(--accent); }
.frow .ic svg { width:17px; height:17px; }
.frow.in .ic { background:rgba(63,185,80,.12); color:var(--ok); }
.frow .name { grid-column:2; grid-row:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; user-select:text; }
.frow .act { grid-column:3; grid-row:1 / span 2; font:inherit; font-size:12px; padding:5px 9px; border-radius:7px; border:1px solid #30404f; background:var(--panel); color:var(--text); cursor:pointer; }
.frow .act:hover { background:#263241; }
.frow .act:empty { display:none; }
.frow .info { grid-column:2; grid-row:2; font-size:12px; color:var(--muted); }
.frow .info.err { color:var(--err); }
.frow .info.ok { color:var(--ok); }
.frow .prog { grid-column:2 / 4; grid-row:3; height:4px; border-radius:2px; background:var(--line); overflow:hidden; }
.frow .prog i { display:block; height:100%; width:0; background:var(--accent); transition:width .2s; }
.frow.done .prog { display:none; }
#dropHint { position:fixed; inset:0; z-index:25; display:grid; place-items:center; background:rgba(15,23,32,.7); pointer-events:none; }
#dropHint div { padding:18px 26px; border:2px dashed var(--accent); border-radius:14px; background:rgba(23,33,44,.95); font-size:16px; font-weight:600; }

/* Pantalla completa: solo la imagen. */
body.full #bar { display:none; }
body.full #toolbar { top:8px; }
body.full #toolbar.collapsed { top:0; }
