/* EliDesk panel — soft tiles, dark by default, light theme supported. No inline styles (strict CSP). */
:root{
  --bg:#0e1014; --surface:#171a21; --surface2:#1f232c; --line:#2a2f3a;
  --fg:#eef1f6; --muted:#98a2b3;
  --accent:#6d6af8; --accent-hover:#7f7cff; --accent-fg:#fff; --accent-soft:rgba(109,106,248,.16); --accent-text:#a9a7ff;
  --ok:#34d399; --ok-soft:rgba(52,211,153,.14); --err:#f87171; --err-soft:rgba(248,113,113,.14); --off:#5b6472;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --r-lg:22px; --r-md:14px; --r-sm:10px;
}
html[data-theme="light"]{
  --bg:#f2f3f8; --surface:#ffffff; --surface2:#eef0f6; --line:#e2e5ee;
  --fg:#1a1e29; --muted:#667085;
  --accent:#5b57f0; --accent-hover:#4c48e0; --accent-soft:#ecebff; --accent-text:#4d49d8;
  --ok:#0f9f6e; --ok-soft:#e2f6ee; --err:#d9363e; --err-soft:#fdecec; --off:#a3abb8;
  --shadow:0 10px 30px rgba(30,35,60,.10);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font:15px/1.5 system-ui,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--fg);-webkit-font-smoothing:antialiased}
.hidden{display:none !important}
.spacer{flex:1}
.muted{color:var(--muted)}
.sm{font-size:12.5px}
.mono{font-family:ui-monospace,Consolas,monospace}
h1{font-size:24px;line-height:1.2;margin:0;font-weight:700;letter-spacing:-.2px}
h2{font-size:18px;margin:0}
h3{font-size:18px;margin:0 0 8px}
p{margin:6px 0 0}
.ic{display:inline-flex;flex:none}
.ic svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* top bar */
.topbar{display:flex;align-items:center;gap:10px;padding:12px 22px;position:sticky;top:0;z-index:10;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(10px)}
.brand{display:flex;align-items:center;gap:10px;font-weight:750;font-size:18px;letter-spacing:-.2px}
.logo{width:30px;height:30px;display:block}
.userchip{display:flex;align-items:center;gap:8px;padding:4px 12px 4px 4px;border-radius:999px;background:var(--surface);font-size:13.5px}
.avatar{width:28px;height:28px;border-radius:50%;background:var(--accent-soft);color:var(--accent-text);display:flex;align-items:center;justify-content:center;font-weight:700;text-transform:uppercase}
.langsel{height:36px;padding:0 8px;border-radius:var(--r-sm);border:0;background:var(--surface);color:var(--fg);font-size:13px;cursor:pointer}

/* controls */
label{display:block;font-size:13px;color:var(--muted);margin:14px 0 6px}
input[type=text],input[type=password],input[type=search],textarea{width:100%;padding:11px 13px;border-radius:var(--r-md);border:1px solid var(--line);background:var(--bg);color:var(--fg);font:inherit;outline:none;transition:border-color .15s,box-shadow .15s}
input:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border:0;border-radius:var(--r-md);background:var(--accent);color:var(--accent-fg);font:inherit;font-weight:600;cursor:pointer;white-space:nowrap;transition:background .15s,transform .05s}
.btn:hover{background:var(--accent-hover)}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn.block{width:100%;margin-top:18px;height:44px}
.btn.ghost{background:transparent;color:var(--fg);box-shadow:inset 0 0 0 1px var(--line)}
.btn.ghost:hover{background:var(--surface2)}
.btn.soft{background:var(--accent-soft);color:var(--accent-text)}
.btn.soft:hover{background:var(--accent-soft);filter:brightness(1.15)}
.btn.danger{background:var(--err);color:#fff}
.btn.sm{height:32px;padding:0 11px;font-size:13px;border-radius:var(--r-sm)}
.btn.sm .ic svg{width:15px;height:15px}
.iconbtn{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:var(--r-sm);background:transparent;color:var(--muted);cursor:pointer}
.iconbtn:hover{background:var(--surface2);color:var(--fg)}
.btnrow{display:flex;gap:10px;margin-top:18px;flex-wrap:wrap}
.btnrow.end{justify-content:flex-end}
.err{color:var(--err);font-size:13px;margin:10px 0 0}
.chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;padding:3px 10px;border-radius:999px;background:var(--surface2);color:var(--muted);white-space:nowrap}
.chip.ok{background:var(--ok-soft);color:var(--ok)}
.chip.bad{background:var(--err-soft);color:var(--err)}
.chip .ic svg{width:12px;height:12px}
.dot{width:9px;height:9px;border-radius:50%;background:var(--off);flex:none}
.dot.on{background:var(--ok);box-shadow:0 0 0 3px var(--ok-soft)}

/* layout */
.wrap{max-width:1180px;margin:0 auto;padding:18px 22px 60px}

/* sign-in screens */
.auth{display:flex;justify-content:center;padding-top:6vh}
.authcard{width:100%;max-width:400px;background:var(--surface);border-radius:var(--r-lg);padding:30px;box-shadow:var(--shadow)}
.authcard h1{margin-bottom:4px}
.codeinput{text-align:center;font-size:24px !important;letter-spacing:10px;font-family:ui-monospace,Consolas,monospace;margin-top:16px}
.qrbox{display:flex;justify-content:center;margin:16px 0 10px;background:#fff;border-radius:var(--r-md);padding:12px}
.qrbox img{width:210px;height:210px;display:block}

/* dashboard */
.dashhead{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:10px 0 22px}
.searchbox{position:relative;width:240px;max-width:100%}
.searchbox .ic{position:absolute;left:12px;top:11px;color:var(--muted)}
.searchbox input{padding-left:38px;height:40px;background:var(--surface);border-color:transparent}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:16px}
.device{background:var(--surface);border-radius:var(--r-lg);padding:18px;display:flex;flex-direction:column;gap:16px;transition:transform .15s,box-shadow .15s}
.device:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.device.isoff .devname{color:var(--muted)}
.devtop{display:flex;align-items:center;gap:13px;min-width:0}
.devico{width:50px;height:50px;border-radius:16px;background:var(--surface2);color:var(--muted);display:flex;align-items:center;justify-content:center;flex:none}
.devico .ic svg{width:24px;height:24px}
.device.ison .devico{background:var(--accent-soft);color:var(--accent-text)}
.device.isrev .devico{background:var(--err-soft);color:var(--err)}
.devtext{min-width:0;flex:1}
.devname{font-weight:650;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.devsub{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.devmeta{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--muted);min-height:24px}
.devacts{display:flex;gap:8px;align-items:center}
.devacts .btn{flex:1}
.menuwrap{position:relative}
.menu{position:absolute;right:0;top:calc(100% + 6px);min-width:220px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-md);padding:6px;box-shadow:var(--shadow);z-index:30}
.menu.up{top:auto;bottom:calc(100% + 6px)}
.menu button{display:flex;align-items:center;gap:10px;width:100%;padding:9px 11px;border:0;border-radius:9px;background:transparent;color:var(--fg);font:inherit;font-size:14px;text-align:left;cursor:pointer}
.menu button:hover{background:var(--surface2)}
.menu button.danger{color:var(--err)}
.menu kbd{margin-left:auto;font:11.5px ui-monospace,Consolas,monospace;color:var(--muted)}
.empty{background:var(--surface);border-radius:var(--r-lg);padding:54px 24px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px}
.emptyico{width:72px;height:72px;border-radius:24px;background:var(--accent-soft);color:var(--accent-text);display:flex;align-items:center;justify-content:center;margin-bottom:6px}
.emptyico .ic svg{width:34px;height:34px}
.empty .btn{margin-top:10px}

/* modals */
.modal{position:fixed;inset:0;background:rgba(6,8,12,.62);backdrop-filter:blur(3px);display:flex;align-items:center;justify-content:center;z-index:50;padding:16px}
.modalbox{background:var(--surface);border-radius:var(--r-lg);padding:26px;max-width:560px;width:100%;box-shadow:var(--shadow);max-height:92vh;overflow:auto}
.modalbox.small{max-width:400px}
.lockico{width:52px;height:52px;border-radius:17px;background:var(--accent-soft);color:var(--accent-text);display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.lockico .ic svg{width:24px;height:24px}
.modalbox input{margin-top:14px}
.modalbox label + input{margin-top:0}
.cmd{background:var(--bg);border-radius:var(--r-md);padding:14px;font:12px/1.55 ui-monospace,Consolas,monospace;white-space:pre-wrap;word-break:break-all;color:var(--accent-text);margin:12px 0 8px;user-select:all}

/* toasts */
.toasts{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;z-index:80;align-items:center;pointer-events:none}
.toast{background:var(--fg);color:var(--bg);padding:10px 16px;border-radius:999px;font-size:13.5px;font-weight:550;box-shadow:var(--shadow);animation:toastin .18s ease-out}
.toast.bad{background:var(--err);color:#fff}
@keyframes toastin{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* ---------- remote session: always dark, fills the window ---------- */
.session{
  --bg:#0b0c10; --surface:#16181e; --surface2:#22252e; --line:#2c303b; --fg:#eef1f6; --muted:#98a2b3;
  --accent-soft:rgba(109,106,248,.2); --accent-text:#a9a7ff; --ok:#34d399; --ok-soft:rgba(52,211,153,.14); --err:#f87171; --err-soft:rgba(248,113,113,.14);
  position:fixed;inset:0;z-index:20;display:flex;flex-direction:column;background:var(--bg);color:var(--fg)}
.sbar{display:flex;align-items:center;gap:6px;padding:7px 10px;background:var(--surface);border-bottom:1px solid var(--line);flex:none;min-height:50px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
.sbar::-webkit-scrollbar{display:none}
.sbar .spacer{min-width:6px}
.sbtn{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 10px;border:0;border-radius:var(--r-sm);background:transparent;color:var(--fg);font:inherit;font-size:13.5px;cursor:pointer;white-space:nowrap;flex:none}
.sbtn:hover{background:var(--surface2)}
.sbtn.active{background:var(--accent-soft);color:var(--accent-text)}
.sname{display:flex;align-items:center;gap:9px;font-weight:650;padding:0 8px;white-space:nowrap;flex:none}
.sep{width:1px;height:22px;background:var(--line);margin:0 4px;flex:none}
.ssel{height:34px;padding:0 8px;border-radius:var(--r-sm);border:0;background:var(--surface2);color:var(--fg);font:inherit;font-size:13.5px;cursor:pointer;flex:none}
.seg{display:inline-flex;background:var(--surface2);border-radius:var(--r-sm);padding:3px;gap:2px;flex:none}
.seg button{height:28px;min-width:32px;padding:0 9px;border:0;border-radius:7px;background:transparent;color:var(--muted);font:inherit;font-size:13px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:5px}
.seg button .ic svg{width:14px;height:14px}
.seg button.active{background:var(--accent);color:#fff}
.session .menuwrap{flex:none}
.session .menu{position:fixed;right:auto;top:auto}
.sbody{flex:1;min-height:0;display:flex}
.stage{flex:1;min-width:0;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;outline:none;background:#050608}
.stage.actual{overflow:auto;align-items:flex-start;justify-content:flex-start}
#screen{display:block;flex:none;cursor:default}
.stagehint{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:var(--muted);background:rgba(5,6,8,.55);pointer-events:none}
.spinner{width:28px;height:28px;border-radius:50%;border:3px solid var(--line);border-top-color:var(--accent);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.drawer{width:360px;max-width:92vw;flex:none;background:var(--surface);border-left:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.drawerhead{display:flex;align-items:center;padding:10px 10px 10px 18px;border-bottom:1px solid var(--line);flex:none}
.tool{padding:16px;overflow:auto;flex:1;min-height:0}
.statusgrid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.tile{background:var(--surface2);border-radius:var(--r-md);padding:12px}
.tile .tl{font-size:12px;color:var(--muted)}
.tile .tv{font-size:22px;font-weight:700;margin-top:2px}
.tile .ts{font-size:12px;color:var(--muted);margin-top:2px}
.proc{width:100%;border-collapse:collapse;margin-top:14px;font-size:13px}
.proc td{padding:7px 4px;border-top:1px solid var(--line);color:var(--muted)}
.proc td.r{text-align:right;color:var(--fg)}
.filesbar{display:flex;align-items:center;gap:8px}
.filelabel{cursor:pointer}
.fsPath{font:12px ui-monospace,Consolas,monospace;color:var(--muted);word-break:break-all;margin-top:10px}
.fsinfo{min-height:18px;margin:4px 0 8px}
.fslist{border-radius:var(--r-md);background:var(--surface2);overflow:hidden}
.fsrow{display:flex;align-items:center;gap:10px;padding:8px 12px;border-top:1px solid var(--line);font-size:13.5px}
.fsrow:first-child{border-top:0}
.fsrow.isdir{cursor:pointer}
.fsrow.isdir:hover{background:var(--line)}
.fsic{color:var(--muted);display:flex}
.fsrow.isdir .fsic{color:var(--accent-text)}
.fsnm{flex:1;word-break:break-all}
.fssz{color:var(--muted);font-size:12px;white-space:nowrap}
#clipText{resize:vertical;font:13px/1.5 ui-monospace,Consolas,monospace;margin-top:12px}

/* full screen: the toolbar slides away; a small handle at the top edge brings it back */
.sbar-handle{display:none}
.session.fs .sbar{position:absolute;left:0;right:0;top:0;z-index:6;transform:translateY(-100%);transition:transform .16s ease-out}
.session.fs.barshow .sbar{transform:none}
.session.fs .sbar-handle{display:block;position:absolute;top:0;left:50%;width:84px;height:9px;margin-left:-42px;border-radius:0 0 9px 9px;background:rgba(255,255,255,.28);z-index:7;cursor:pointer}
.session.fs.barshow .sbar-handle{display:none}

@media (max-width:900px){
  .sbtn .lbl{display:none}
  .drawer{position:absolute;right:0;top:0;bottom:0;z-index:5;box-shadow:var(--shadow)}
  .sbody{position:relative}
}
@media (max-width:560px){
  .wrap{padding:12px 14px 50px}
  .topbar{padding:10px 14px}
  .userchip span:last-child{display:none}
  .userchip{padding:4px}
  .searchbox{width:100%}
  .dashhead .btn{width:100%}
  .authcard{padding:22px}
}
