/* Remika design system, direction 1a. Figtree for UI, DM Mono for IDs and passwords.
   Indigo is the single accent; green for live/ready, red only for destructive actions. */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:#F4F5F9; --surface:#FFFFFF; --line:#E6E8F0; --line2:#EEF0F5; --line-strong:#D7DAE6;
  --text:#1C1F2E; --muted:#5B6078; --muted2:#6B7090;
  --accent:#4F46E5; --accent-text:#4F46E5; --accent-soft:#EEF0FB; --accent-hover:#4338CA;
  --good:#16A34A; --warn:#F59E0B; --bad:#DC2626; --bad-line:#F3C4C4; --bad-soft:#FEF2F2;
  --stage:#0B0F1F; --overlay:rgba(28,31,46,.45);
  --toggle-off:#D7DAE6; --input-bg:#FFFFFF;
  --font:Figtree, "Segoe UI", system-ui, sans-serif; --mono:"DM Mono", Consolas, ui-monospace, monospace;
}
:root[data-theme="dark"] {
  --bg:#0F1119; --surface:#171A26; --line:#262A3A; --line2:#20232F; --line-strong:#353A4D;
  --text:#E8EAF2; --muted:#A3A8BD; --muted2:#8A8FA6;
  --accent:#5B54E8; --accent-text:#8B84F5; --accent-soft:#2A2A5A; --accent-hover:#6C66F0;
  --good:#34D399; --warn:#FBBF24; --bad:#F87171; --bad-line:#5A2E2E; --bad-soft:#2A1A1A;
  --stage:#05070F; --overlay:rgba(5,7,15,.6);
  --toggle-off:#353A4D; --input-bg:#171A26;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg:#0F1119; --surface:#171A26; --line:#262A3A; --line2:#20232F; --line-strong:#353A4D;
    --text:#E8EAF2; --muted:#A3A8BD; --muted2:#8A8FA6;
    --accent:#5B54E8; --accent-text:#8B84F5; --accent-soft:#2A2A5A; --accent-hover:#6C66F0;
    --good:#34D399; --warn:#FBBF24; --bad:#F87171; --bad-line:#5A2E2E; --bad-soft:#2A1A1A;
    --stage:#05070F; --overlay:rgba(5,7,15,.6);
    --toggle-off:#353A4D; --input-bg:#171A26;
  }
}

* { box-sizing:border-box; }
html, body { height:100%; }
body { margin:0; background:var(--bg); color:var(--text); font:13.5px/1.45 var(--font); display:flex; flex-direction:column; overflow:hidden; }
button, input { font-family:inherit; }
a { color:var(--accent-text); text-decoration:none; }

/* Buttons */
.btn { height:36px; padding:0 16px; border:0; border-radius:8px; background:var(--accent); color:#fff; font:600 13px var(--font); cursor:pointer; white-space:nowrap; display:inline-flex; align-items:center; gap:8px; }
.btn:hover { background:var(--accent-hover); }
.btn.lg { height:44px; padding:0 22px; font-size:14px; }
.btn.sm { height:30px; padding:0 12px; font-size:12.5px; border-radius:6px; }
.btn.ghost { background:var(--surface); color:var(--text); border:1px solid var(--line-strong); font-weight:500; }
.btn.ghost:hover { background:var(--accent-soft); }
.btn.danger { background:var(--surface); color:var(--bad); border:1px solid var(--bad-line); font-weight:600; }
.btn.danger:hover { background:var(--bad-soft); }
.btn.danger.solid { background:#DC2626; color:#fff; border:0; }
.btn.danger.solid:hover { background:#B91C1C; }
.btn:disabled { opacity:.45; cursor:default; pointer-events:none; }
.link { background:none; border:0; padding:0; color:var(--accent-text); font:500 12.5px var(--font); cursor:pointer; }
.link:hover { text-decoration:underline; }

/* Inputs */
.input { height:38px; padding:0 12px; border:1px solid var(--line-strong); border-radius:8px; background:var(--input-bg); color:var(--text); font:400 13px var(--font); outline:none; }
.input.mono { font:500 17px var(--mono); letter-spacing:.06em; }
.input.lg { height:44px; padding:0 14px; font-size:14px; }
.input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.input::placeholder { color:#9AA0B4; }

/* Toggle */
.toggle { position:relative; display:inline-block; width:36px; height:20px; flex:none; }
.toggle input { position:absolute; opacity:0; width:0; height:0; }
.toggle i { position:absolute; inset:0; border-radius:10px; background:var(--toggle-off); transition:background .15s; }
.toggle i::after { content:""; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%; background:#fff; transition:left .15s; }
.toggle input:checked + i { background:var(--accent); }
.toggle input:checked + i::after { left:18px; }
.toggle.sm { width:28px; height:16px; }
.toggle.sm i::after { width:12px; height:12px; }
.toggle.sm input:checked + i::after { left:14px; }
.switch-row { display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--muted); cursor:pointer; }

/* Cards and typography */
.card { background:var(--surface); border:1px solid var(--line); border-radius:12px; }
.card.pad { padding:20px 24px; }
.card-head { display:flex; justify-content:space-between; align-items:center; padding:16px 20px 12px; }
.eyebrow { font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted2); }
.mono { font-family:var(--mono); }
.big-id { font:500 34px/1.2 var(--mono); letter-spacing:.08em; margin-top:10px; }
.hint { font-size:12.5px; color:var(--muted); }
.chip { font-size:11.5px; padding:3px 8px; border-radius:999px; background:var(--accent-soft); color:var(--accent-text); font-weight:500; }
.dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--good); flex:none; }
.dot.warn { background:var(--warn); } .dot.off { background:var(--line-strong); } .dot.bad { background:var(--bad); }
.row { display:flex; gap:8px; align-items:center; }
.sep { width:1px; height:16px; background:var(--line); }

/* Window chrome (custom title bar) */
#titlebar { display:flex; align-items:center; justify-content:space-between; height:36px; padding-left:12px; background:var(--surface); border-bottom:1px solid var(--line); flex:none; user-select:none; }
#titlebar .app { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:500; }
#titlebar .logo { width:16px; height:16px; border-radius:4px; background:var(--accent); display:grid; place-items:center; }
#titlebar .logo i { width:6px; height:6px; border-radius:50%; background:#fff; }
#titlebar .controls { display:flex; color:var(--muted); }
#titlebar .controls button { width:46px; height:36px; display:grid; place-items:center; border:0; background:transparent; color:inherit; font-size:13px; cursor:pointer; }
#titlebar .controls button:hover { background:var(--line2); }
#titlebar .controls button.close:hover { background:#DC2626; color:#fff; }

/* Top nav */
#topnav { display:flex; align-items:center; justify-content:space-between; height:52px; padding:0 24px; background:var(--surface); border-bottom:1px solid var(--line); flex:none; }
#topnav .brand { font-weight:700; font-size:16px; letter-spacing:-.01em; color:var(--accent-text); margin-right:28px; }
#topnav .tabs { display:flex; gap:4px; height:52px; }
#topnav .tabs button { display:flex; align-items:center; padding:0 12px; font-size:13.5px; font-weight:500; color:var(--muted); background:transparent; border:0; cursor:pointer; }
#topnav .tabs button.active { font-weight:600; color:var(--text); box-shadow:inset 0 -2px 0 var(--accent); }
#topnav .status { display:flex; align-items:center; gap:14px; font-size:12.5px; color:var(--muted); }
#topnav .status .mono { color:var(--text); font-weight:500; }

/* Pages */
.tab { display:none; flex:1; min-height:0; flex-direction:column; }
.tab.active { display:flex; }
.page { padding:24px; gap:20px; overflow:auto; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.grid-2b { display:grid; grid-template-columns:1.3fr 1fr; gap:20px; }
.grid-2c { display:grid; grid-template-columns:1.25fr 1fr; gap:20px; }
@media (max-width:860px) { .grid-2, .grid-2b, .grid-2c { grid-template-columns:1fr; } }
.list-row { border-top:1px solid var(--line2); padding:11px 20px; }
.empty { padding:14px 20px; border-top:1px solid var(--line2); font-size:12.5px; color:var(--muted2); }

/* Session viewer */
#toolbar { display:flex; align-items:center; justify-content:space-between; height:48px; padding:0 12px 0 16px; background:var(--surface); border-bottom:1px solid var(--line); gap:12px; flex:none; }
#toolbar .left, #toolbar .right { display:flex; align-items:center; gap:6px; }
#toolbar .tool { height:32px; padding:0 10px; display:inline-flex; align-items:center; gap:8px; border-radius:8px; color:var(--text); font-size:12.5px; font-weight:500; background:transparent; border:0; cursor:pointer; white-space:nowrap; }
#toolbar .tool:hover { background:var(--accent-soft); }
#toolbar .tool.outline { border:1px solid var(--line-strong); }
#toolbar .peer { display:flex; align-items:center; gap:8px; height:32px; padding:0 12px; border-radius:8px; background:var(--accent-soft); font-size:13px; font-weight:600; }
#stage { flex:1; min-height:0; position:relative; background:var(--stage); display:flex; align-items:center; justify-content:center; overflow:hidden; }
#stage.drop::after { content:"Drop files to send them to the remote computer"; position:absolute; inset:12px; border:2px dashed #8B84F5; border-radius:12px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:18px; background:rgba(79,70,229,.35); pointer-events:none; z-index:4; }
#screen { max-width:100%; max-height:100%; width:100%; height:100%; object-fit:contain; outline:none; cursor:default; display:block; }
#stage.has-video #stagePlaceholder { display:none; }
#stagePlaceholder { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; text-align:center; color:#8A90A8; font-size:13px; pointer-events:none; }
#stagePlaceholder i { display:block; width:64px; height:40px; border:1.5px solid #3A4160; border-radius:4px; }
.bars { display:inline-flex; gap:2px; align-items:flex-end; }
.bars i { width:3px; display:block; background:var(--line-strong); }
.bars i.on { background:#22C55E; }
.bars i.warn { background:#F59E0B; }
#netStats { display:flex; align-items:center; gap:8px; font:12px var(--mono); color:var(--muted); white-space:nowrap; }
#netToggle { background:none; border:0; padding:0; color:var(--muted2); font:12px var(--font); cursor:pointer; }
#netToggle:hover { color:var(--accent-text); }
#fsStats { display:none; position:absolute; bottom:0; left:50%; z-index:5; gap:8px; align-items:center; padding:5px 12px; background:var(--surface); color:var(--muted); border:1px solid var(--line); border-bottom:0; border-radius:10px 10px 0 0; box-shadow:0 -6px 20px rgba(0,0,0,.25); transform:translate(-50%,100%); transition:transform .15s; font:12px var(--mono); }
body.fs #fsStats { display:flex; }
#fsStats.show { transform:translate(-50%,0); }
#bottombar { display:flex; align-items:center; justify-content:space-between; height:34px; padding:0 16px; background:var(--surface); border-top:1px solid var(--line); font-size:12px; color:var(--muted); flex:none; gap:12px; }
#bottombar .right { display:flex; align-items:center; gap:10px; }
#transfers { display:flex; align-items:center; gap:10px; }
#transfers div { display:flex; align-items:center; gap:6px; white-space:nowrap; }
#transfers .bar { width:80px; height:4px; border-radius:2px; background:var(--line2); overflow:hidden; display:inline-block; }
#transfers .bar i { display:block; height:100%; background:var(--accent); }
#transfers .bar i.failed { background:var(--bad); }
/* Full-screen pill: hidden unless full screen is active; slides in at the top centre only. */
#fsbar { display:none; position:absolute; top:0; left:50%; z-index:5; gap:10px; align-items:center; padding:5px 8px 5px 12px; background:var(--surface); color:var(--text); border:1px solid var(--line); border-top:0; border-radius:0 0 10px 10px; box-shadow:0 6px 20px rgba(0,0,0,.25); transform:translate(-50%,-100%); transition:transform .15s; font-size:12.5px; }
body.fs #fsbar { display:flex; }
#fsbar.show { transform:translate(-50%,0); }
/* Always-visible tab in full screen so the exit is easy to find. */
#fsHandle { display:none; position:absolute; top:0; left:50%; z-index:4; transform:translateX(-50%); width:64px; height:16px; border:0; border-radius:0 0 8px 8px; background:rgba(255,255,255,.55); color:#1C1F2E; font-size:11px; line-height:14px; cursor:pointer; padding:0; box-shadow:0 2px 8px rgba(0,0,0,.25); }
#fsHandle:hover { background:#fff; }
body.fs #fsHandle { display:block; }
#fsbar #fsPeer { color:var(--muted); font:12.5px var(--mono); }
body.fs #titlebar, body.fs #topnav, body.fs #toolbar, body.fs #bottombar, body.fs #hub { display:none !important; }
body.fs #stage { position:fixed; inset:0; z-index:50; }

#rcursor { position:absolute; display:none; pointer-events:none; z-index:3; image-rendering:auto; }
#monitorBox { display:flex; border:1px solid var(--line-strong); border-radius:8px; overflow:hidden; height:32px; }
#monitorBox button { padding:0 10px; display:flex; align-items:center; gap:6px; font:500 12.5px var(--font); color:var(--muted); background:transparent; border:0; border-left:1px solid var(--line-strong); cursor:pointer; }
#monitorBox button:first-child { border-left:0; }
#monitorBox button.active { background:var(--accent-soft); color:var(--accent-text); font-weight:600; }
#monitorBox button i { width:12px; height:8px; border:1.5px solid currentColor; border-radius:1px; display:block; }
[data-unread]:not([data-unread=""])::after { content:attr(data-unread); margin-left:6px; min-width:16px; height:16px; padding:0 4px; border-radius:8px; background:var(--bad); color:#fff; font-size:10.5px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
#chatPanel { position:absolute; top:12px; right:12px; bottom:12px; width:300px; max-width:calc(100% - 24px); z-index:6; display:none; flex-direction:column; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,.3); overflow:hidden; }
#chatPanel.show { display:flex; }
#chatPanel .head { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid var(--line); }
#chatPanel .msgs { flex:1; overflow:auto; padding:12px; display:flex; flex-direction:column; gap:8px; }
#chatPanel .msg { max-width:85%; padding:7px 11px; border-radius:12px; font-size:13px; line-height:1.4; white-space:pre-wrap; word-break:break-word; }
#chatPanel .msg.me { align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
#chatPanel .msg.them { align-self:flex-start; background:var(--accent-soft); color:var(--text); border-bottom-left-radius:4px; }
#chatPanel .empty-chat { color:var(--muted2); font-size:12.5px; text-align:center; margin-top:20px; }
#chatPanel form { display:flex; gap:8px; padding:10px; border-top:1px solid var(--line); }
#chatPanel form .input { flex:1; height:34px; }
#pausedBanner { display:none; position:absolute; top:12px; left:50%; transform:translateX(-50%); z-index:5; padding:8px 14px; border-radius:10px; background:#F59E0B; color:#1C1F2E; font-size:13px; font-weight:600; box-shadow:0 6px 20px rgba(0,0,0,.25); }
#pausedBanner.show { display:block; }
#filePanel { position:absolute; top:12px; right:12px; bottom:12px; width:420px; max-width:calc(100% - 24px); z-index:6; display:none; flex-direction:column; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,.3); overflow:hidden; }
#filePanel.show { display:flex; }
#filePanel .head { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid var(--line); }
#filePanel .path { padding:8px 14px; font:12px var(--mono); color:var(--muted); border-bottom:1px solid var(--line); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; direction:rtl; text-align:left; }
#filePanel .list { flex:1; overflow:auto; }
#filePanel .file-row { display:flex; align-items:center; gap:10px; padding:7px 14px; cursor:pointer; font-size:13px; border-bottom:1px solid var(--line2); }
#filePanel .file-row:hover { background:var(--accent-soft); }
#filePanel .file-row.dir { font-weight:600; }
#filePanel .file-row .fi { flex:none; }
#filePanel .file-row .fn { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#filePanel .file-row .fm { color:var(--muted2); font-size:11.5px; flex:none; }
#filePanel .file-row .get { flex:none; opacity:0; }
#filePanel .file-row:hover .get { opacity:1; }
#filePanel .file-empty { padding:24px; text-align:center; color:var(--muted2); font-size:12.5px; }
#filePanel .foot { display:flex; gap:8px; padding:10px; border-top:1px solid var(--line); }
#filePanel .foot #fileUpload { margin-left:auto; }
#permNote { display:none; position:absolute; bottom:12px; left:50%; transform:translateX(-50%); z-index:5; padding:6px 12px; border-radius:8px; background:var(--surface); border:1px solid var(--line); color:var(--muted); font-size:12px; box-shadow:0 4px 16px rgba(0,0,0,.2); }

/* Menus and dialogs */
.menu { position:absolute; z-index:20; min-width:200px; padding:6px; background:var(--surface); border:1px solid var(--line); border-radius:10px; box-shadow:0 12px 40px rgba(0,0,0,.18); font-size:13px; }
.menu button { display:flex; width:100%; justify-content:space-between; align-items:center; padding:8px 10px; border:0; background:transparent; color:var(--text); border-radius:6px; cursor:pointer; text-align:left; font:inherit; }
.menu button:hover { background:var(--accent-soft); }
.menu button:disabled { color:var(--muted2); cursor:default; }
.menu hr { border:0; height:1px; background:var(--line); margin:6px 4px; }
.menu-label { padding:6px 10px 2px; font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted2); }
.menu button span { color:var(--muted2); font-size:11.5px; margin-left:12px; }
.menu button.on { color:var(--accent-text); font-weight:600; }
.menu button.on::before { content:"✓"; margin-right:6px; }
.modal-bg { position:fixed; inset:0; background:var(--overlay); display:none; align-items:center; justify-content:center; z-index:100; }
.modal-bg.show { display:flex; }
.modal { width:440px; max-width:94vw; background:var(--surface); border:1px solid var(--line); border-radius:12px; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.modal .body { padding:24px 24px 20px; }
.modal .foot { display:flex; align-items:center; justify-content:space-between; padding:14px 24px; border-top:1px solid var(--line); background:var(--bg); }
.icon-tile { width:40px; height:40px; border-radius:10px; background:var(--accent-soft); display:grid; place-items:center; flex:none; }
.icon-tile i { width:16px; height:11px; border:1.5px solid var(--accent-text); border-radius:2px; display:block; }
.icon-tile.lg { width:44px; height:44px; } .icon-tile.lg i { width:18px; height:12px; }
.facts { margin-top:18px; padding:14px 16px; border:1px solid var(--line); border-radius:10px; background:var(--bg); display:grid; grid-template-columns:1fr 1fr; gap:10px; font-size:12.5px; }
.facts .k { color:var(--muted2); } .facts .v { margin-top:3px; font-weight:600; }
.spinner { width:14px; height:14px; border-radius:50%; border:2px solid var(--line-strong); border-top-color:var(--muted2); display:inline-block; animation:spin 1s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.toast { position:fixed; right:16px; bottom:16px; z-index:90; display:flex; flex-direction:column; gap:8px; }
.toast div { background:var(--surface); border:1px solid var(--line); border-left:3px solid var(--accent); border-radius:10px; padding:10px 14px; font-size:13px; box-shadow:0 8px 30px rgba(0,0,0,.15); display:flex; align-items:center; gap:12px; max-width:420px; }
.toast div.good { border-left-color:var(--good); } .toast div.bad { border-left-color:var(--bad); }
.toast .link { white-space:nowrap; }

/* Settings rail */
.rail { display:flex; flex-direction:column; gap:2px; font-size:13.5px; }
.rail button { padding:8px 12px; border-radius:8px; color:var(--muted); font-weight:500; background:transparent; border:1px solid transparent; text-align:left; cursor:pointer; font:inherit; }
.rail button.active { background:var(--surface); border-color:var(--line); font-weight:600; color:var(--text); }
.seg { display:flex; border:1px solid var(--line-strong); border-radius:8px; overflow:hidden; height:32px; font-size:12.5px; }
.seg button { padding:0 14px; display:flex; align-items:center; color:var(--muted); border:0; border-left:1px solid var(--line-strong); background:transparent; cursor:pointer; font:inherit; }
.seg button:first-child { border-left:0; }
.seg button.active { background:var(--accent-soft); color:var(--accent-text); font-weight:600; }
.setting-row { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-top:12px; }
.setting-row .t { font-size:13.5px; font-weight:600; } .setting-row .d { font-size:12.5px; color:var(--muted); margin-top:3px; }
.field-label { font-size:12.5px; font-weight:600; margin-bottom:6px; }
.ok-msg { color:var(--good); font-size:12.5px; } .err-msg { color:var(--bad); font-size:12.5px; }

:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.input:focus-visible { outline:none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration:.01ms !important; transition-duration:.01ms !important; } }
