/* ============ TOKENS ============ */
:root {
  --bg: #0b0d14;
  --bg-2: #10131c;
  --surface: #151925;
  --surface-2: #1c2130;
  --surface-3: #252b3c;
  --border: #262c3d;
  --border-strong: #343b50;
  --text: #eef0f6;
  --muted: #8d95a9;
  --faint: #5e6578;
  --accent: #6d7bff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(109,123,255,.14);
  --accent-text: #fff;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  --grad: linear-gradient(135deg, #6d7bff 0%, #8b5cf6 50%, #22d3ee 100%);
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.35);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6fa; --bg-2: #eceef5; --surface: #ffffff; --surface-2: #f2f4f9; --surface-3: #e6e9f2;
  --border: #e1e4ee; --border-strong: #cfd4e2; --text: #141826; --muted: #5d6579; --faint: #9aa1b3;
  --accent: #4f5df0; --accent-soft: rgba(79,93,240,.1);
  --ok: #10b981; --warn: #d97706; --bad: #dc2626;
  --shadow: 0 1px 2px rgba(20,24,38,.04), 0 8px 24px rgba(20,24,38,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #f5f6fa; --bg-2: #eceef5; --surface: #ffffff; --surface-2: #f2f4f9; --surface-3: #e6e9f2;
    --border: #e1e4ee; --border-strong: #cfd4e2; --text: #141826; --muted: #5d6579; --faint: #9aa1b3;
    --accent: #4f5df0; --accent-soft: rgba(79,93,240,.1);
    --ok: #10b981; --warn: #d97706; --bad: #dc2626;
    --shadow: 0 1px 2px rgba(20,24,38,.04), 0 8px 24px rgba(20,24,38,.06);
    color-scheme: light;
  }
}

/* ============ BASE ============ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: .3rem 0 0; }
code, kbd { font-family: var(--mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--border); padding: .05em .35em; border-radius: 5px; }
a.link { color: var(--accent); text-decoration: none; } a.link:hover { text-decoration: underline; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic { width: 16px; height: 16px; vertical-align: -3px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .grow { flex: 1; min-width: 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .row.center { justify-content: center; }
.fine { font-size: .76rem; color: var(--faint); margin-top: 1.4rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ============ CONTROLS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  padding: .55rem 1rem; border-radius: var(--radius-sm); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-text); box-shadow: 0 6px 18px -6px var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { color: var(--bad); background: transparent; border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger-solid { background: var(--bad); border-color: transparent; color: #fff; }
.btn.block { width: 100%; } .btn.lg { padding: .75rem 1rem; font-size: .98rem; } .btn.sm { padding: .35rem .7rem; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: block; font-size: .83rem; font-weight: 600; color: var(--muted); margin-bottom: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .62rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text); font: inherit; font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; margin-bottom: .5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { width: 100%; accent-color: var(--accent); margin-top: .5rem; }
.check { display: flex; align-items: center; gap: .55rem; font-size: .9rem; margin: .5rem 0; cursor: pointer; color: var(--text); font-weight: 500; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-error { color: var(--bad); font-size: .84rem; min-height: 1.2em; margin: .4rem 0 .6rem; }

.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ BRAND ============ */
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 750; letter-spacing: -.01em; font-size: 1.02rem; }
.brand.lg { font-size: 1.15rem; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); position: relative; box-shadow: 0 4px 14px -4px #6d7bff; }
.logo-mark::after { content: ""; position: absolute; inset: 7px 6px 9px; border: 2px solid rgba(255,255,255,.9); border-radius: 3px; }

/* ============ LOGIN ============ */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; padding: 3rem 3.5rem; display: flex; flex-direction: column; justify-content: center; gap: 1.2rem;
  background: radial-gradient(1200px 600px at -10% -10%, rgba(109,123,255,.35), transparent 60%),
              radial-gradient(800px 500px at 110% 110%, rgba(34,211,238,.2), transparent 60%), var(--bg-2);
  border-right: 1px solid var(--border);
}
.login-hero h1 { font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 800; letter-spacing: -.035em; max-width: 14ch;
  background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 65%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 46ch; }
.hero-points { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .8rem; }
.hero-points li { display: flex; gap: .8rem; align-items: flex-start; color: var(--muted); }
.hero-points svg { color: var(--accent-2); margin-top: 2px; }
.hero-points b { color: var(--text); font-weight: 600; }
.hero-art { margin-top: 1.4rem; perspective: 900px; }
.art-window { width: min(440px, 100%); border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); transform: rotateX(8deg) rotateY(-10deg); overflow: hidden; }
.art-bar { display: flex; gap: 6px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.art-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.art-body { height: 170px; background: linear-gradient(135deg, #1e2a6b, #4a2a7b 60%, #0e5a6e); position: relative; }
.art-body span { position: absolute; border-radius: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); backdrop-filter: blur(4px); }
.art-body span:nth-child(1) { left: 8%; top: 14%; width: 44%; height: 52%; }
.art-body span:nth-child(2) { left: 56%; top: 26%; width: 34%; height: 40%; animation: float 6s ease-in-out infinite; }
.art-body span:nth-child(3) { left: 0; right: 0; bottom: 0; height: 14%; border-radius: 0; background: rgba(0,0,0,.35); }
@keyframes float { 50% { transform: translateY(-8px); } }

.login-panel { display: grid; place-items: center; padding: 2rem 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 1.6rem; font-weight: 700; }
.auth-card form > .muted { margin-bottom: 1.6rem; }
.pw-wrap { position: relative; display: block; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: .17rem; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; padding: .3rem .5rem; border-radius: 6px; }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.divider { display: flex; align-items: center; gap: .8rem; margin: 1.1rem 0; color: var(--faint); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.otp, .code-boxes { display: flex; gap: .45rem; justify-content: center; margin: 1.2rem 0 .4rem; }
.otp input, .code-boxes input {
  width: 46px; height: 54px; margin: 0; padding: 0; text-align: center; font: 600 1.3rem var(--mono); text-transform: uppercase;
}
.code-boxes .dash { align-self: center; color: var(--faint); font-weight: 700; }
.mobile-only { display: none; margin-bottom: 1.6rem; }

/* ============ SHELL ============ */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.2rem .9rem; background: var(--bg-2); border-right: 1px solid var(--border); z-index: 30;
}
.sidebar .brand { padding: .2rem .5rem; }
.sidebar nav { display: grid; gap: .2rem; }
.nav { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.nav:hover { background: var(--surface); color: var(--text); }
.nav.active { background: var(--accent-soft); color: var(--text); }
.nav.active svg { color: var(--accent); }
.side-card { margin-top: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; }
.side-card p { margin: .3rem 0 .7rem; color: var(--muted); }
.me { display: flex; align-items: center; gap: .6rem; padding: .6rem .4rem 0; border-top: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; flex: none; }
.me-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.me-text b, .me-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }

.main { min-width: 0; }
.mobile-top { display: none; }
.page { padding: 2rem 2.2rem 4rem; max-width: 1200px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.sub { margin: 2rem 0 .8rem; font-size: 1.05rem; }

.toolbar-row { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input { margin: 0; padding-left: 2.2rem; }
.chips { display: flex; gap: .3rem; background: var(--bg-2); padding: .25rem; border-radius: 10px; border: 1px solid var(--border); }
.chip { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: .35rem .8rem; border-radius: 7px; cursor: pointer; }
.chip.active { background: var(--surface-3); color: var(--text); }

/* device cards */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.dcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.dcard:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.dthumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer; }
.dthumb .wall { position: absolute; inset: 0; }
.dthumb .win { position: absolute; left: 14%; top: 16%; width: 52%; height: 50%; border-radius: 5px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); }
.dthumb .win.b { left: 48%; top: 30%; width: 36%; height: 40%; background: rgba(255,255,255,.2); }
.dthumb .task { position: absolute; left: 0; right: 0; bottom: 0; height: 11%; background: rgba(0,0,0,.35); }
.dthumb.off .wall { filter: grayscale(1) brightness(.35); }
.dthumb.off .win, .dthumb.off .task { opacity: .25; }
.dthumb .play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s; background: rgba(0,0,0,.35); }
.dthumb .play span { display: inline-flex; gap: .4rem; align-items: center; background: #fff; color: #111; font-weight: 700; padding: .5rem 1rem; border-radius: 99px; }
.dthumb:hover .play { opacity: 1; }
.dthumb.off .play { display: none; }
.status-badge { position: absolute; top: .6rem; left: .6rem; display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700; padding: .2rem .55rem; border-radius: 99px; background: rgba(10,12,18,.7); color: #e6e8ef; backdrop-filter: blur(6px); }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8d95a9; }
.status-badge.online::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.status-badge.busy::before { background: var(--warn); }
.fav-btn { position: absolute; top: .45rem; right: .45rem; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(10,12,18,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.fav-btn svg { width: 16px; height: 16px; }
.fav-btn.on svg { fill: #fbbf24; stroke: #fbbf24; }
.dbody { padding: .9rem 1rem 1rem; display: grid; gap: .7rem; flex: 1; }
.dtitle { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.dname { font-weight: 650; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsub { font-size: .8rem; color: var(--muted); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .9rem; }
.metric { font-size: .76rem; color: var(--muted); }
.metric .bar { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: .25rem; overflow: hidden; }
.metric .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag { font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.dactions { display: flex; gap: .5rem; margin-top: auto; }
.dactions .btn.primary { flex: 1; }

.empty { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty > svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: .6rem; }
.empty .btn { margin-top: 1rem; }

/* menu */
.menu { position: fixed; z-index: 70; min-width: 180px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: .3rem; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.menu button { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .5rem .65rem; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.bad { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }

/* tables, lists, cards */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 650; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.res { font-weight: 650; font-size: .8rem; } .res.ok { color: var(--ok); } .res.bad { color: var(--bad); }
.cards { display: grid; gap: .8rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card.setting { display: flex; align-items: center; gap: 1rem; }
.setting-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.list li { display: flex; align-items: center; gap: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.list li .grow b { display: block; }
.this-badge { font-size: .7rem; font-weight: 700; color: var(--ok); background: rgba(52,211,153,.12); padding: .1rem .45rem; border-radius: 5px; margin-left: .4rem; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.settings-grid .card h3 { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; }

/* ============ MODALS ============ */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(5,7,12,.65); backdrop-filter: blur(4px); animation: fade .15s; }
.modal-card { position: relative; width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; padding: 1.8rem; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .18s ease; }
.modal-card.sm { max-width: 380px; }
.modal-card h2 { margin-bottom: .6rem; }
.modal-x { position: absolute; top: .8rem; right: .8rem; }
.modal-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; margin-bottom: 1rem; }
.modal-ic svg { width: 24px; height: 24px; }
.steps { color: var(--muted); padding-left: 1.2rem; margin: .4rem 0 0; font-size: .9rem; display: grid; gap: .25rem; }
.steps b { color: var(--text); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }

/* ============ VIEWER ============ */
.viewer { position: fixed; inset: 0; background: #000; overflow: hidden; color: #eef0f6; }
.stage { position: absolute; inset: 0; display: grid; place-items: center; touch-action: none; outline: none; }
.stage video, .stage canvas { display: block; max-width: 100%; max-height: 100%; }
.stage.scale-fill video, .stage.scale-fill canvas { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.stage.scale-native { overflow: auto; place-items: start; }
.stage.scale-native video, .stage.scale-native canvas { max-width: none; max-height: none; }
.stage.view-only { cursor: not-allowed; }
/* No "cursor: none" for the locked-mouse mode: the browser hides the cursor itself only while
   the mouse is actually locked, and before that you need to see where you click. */

.pill-bar {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 1rem; padding: .35rem .4rem .35rem .9rem;
  background: rgba(16,19,28,.82); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.09); border-radius: 99px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  transition: transform .25s ease, opacity .25s; max-width: calc(100% - 16px);
}
.pill-bar.away { transform: translate(-50%, -140%); opacity: 0; pointer-events: none; }

/* Thin handle at the top centre while the toolbar is hidden. */
.top-handle {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 19;
  width: 160px; height: 14px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: start center; transition: opacity .2s;
}
.top-handle span { width: 64px; height: 5px; border-radius: 0 0 6px 6px; background: rgba(255,255,255,.35); box-shadow: 0 1px 4px rgba(0,0,0,.5); transition: width .15s, background .15s; }
.top-handle:hover span { width: 96px; background: rgba(255,255,255,.7); }
.viewer:not(.toolbar-away) .top-handle { opacity: 0; pointer-events: none; }

/* Settings button in the top-right corner. */
.corner-btn {
  position: absolute; top: 12px; right: 12px; z-index: 21; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(255,255,255,.12); cursor: pointer;
  background: rgba(16,19,28,.6); color: #eef0f6; opacity: .35; transition: opacity .2s, background .2s, transform .2s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.corner-btn:hover, .corner-btn:focus-visible { opacity: 1; background: rgba(16,19,28,.9); transform: rotate(30deg); }
.viewer.panel-open .corner-btn { opacity: 0; pointer-events: none; }
@media (hover: none) { .corner-btn { opacity: .7; } }
.viewer.panel-open .pill-bar { left: calc((100% - 360px) / 2); }
@media (max-width: 560px) { .viewer.panel-open .pill-bar { opacity: 0; pointer-events: none; } }
.pill-left { display: flex; align-items: center; gap: .6rem; min-width: 0; font-size: .86rem; }
.pill-left b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.timer { font-variant-numeric: tabular-nums; color: #9aa3b8; font-size: .8rem; }
.pill-actions { display: flex; gap: .2rem; }
.pb { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: #dfe3ee; display: grid; place-items: center; cursor: pointer; }
.pb:hover { background: rgba(255,255,255,.1); }
.pb.on { background: rgba(109,123,255,.3); color: #fff; }
.pb.end { background: #ef4444; color: #fff; margin-left: .2rem; }
.pb.end:hover { background: #f05252; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 3px; border-radius: 2px; background: rgba(255,255,255,.2); }
.bars i:nth-child(1) { height: 25%; } .bars i:nth-child(2) { height: 50%; } .bars i:nth-child(3) { height: 75%; } .bars i:nth-child(4) { height: 100%; }
.bars[data-q="4"] i, .bars[data-q="3"] i:nth-child(-n+3), .bars[data-q="2"] i:nth-child(-n+2), .bars[data-q="1"] i:nth-child(1) { background: var(--ok); }
.bars[data-q="2"] i:nth-child(-n+2) { background: var(--warn); }
.bars[data-q="1"] i:nth-child(1) { background: var(--bad); }

.hud { position: absolute; top: 64px; left: 12px; z-index: 15; width: 240px; padding: .7rem .8rem; border-radius: 12px; background: rgba(10,12,18,.78); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(8px); font: 12px/1.6 var(--mono); }
.hud-row { display: flex; justify-content: space-between; color: #9aa3b8; } .hud-row b { color: #eef0f6; font-weight: 600; }
.hud canvas { display: block; width: 100%; height: 44px; margin-top: .4rem; }

.panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 25; width: 360px; max-width: 100%;
  display: flex; flex-direction: column; background: rgba(16,19,28,.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid rgba(255,255,255,.08); transform: translateX(100%); transition: transform .25s ease;
  --surface: #1c2130; --surface-2: #232838; --surface-3: #2d3346; --border: #2a3042; --border-strong: #363d52; --bg-2: #121520; --text: #eef0f6; --muted: #98a0b4; color-scheme: dark;
}
.panel.open { transform: none; box-shadow: -20px 0 60px rgba(0,0,0,.5); }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem .5rem; }
.tabs { display: grid; grid-template-columns: repeat(6, 1fr); gap: .2rem; padding: 0 .6rem .6rem; border-bottom: 1px solid var(--border); }
.tab { display: grid; justify-items: center; gap: .2rem; padding: .5rem .2rem; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: .7rem; font-weight: 600; cursor: pointer; }
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--accent-soft); color: #fff; }
.tab.active svg { color: var(--accent); }
.tab-body { flex: 1; overflow-y: auto; padding: .6rem 1rem 1.6rem; }
.group-title { display: flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 1.1rem 0 .55rem; }
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: .2rem; gap: .2rem; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600; padding: .42rem .3rem; border-radius: 7px; cursor: pointer; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.hint { font-size: .78rem; color: var(--muted); margin: .5rem 0 .2rem; }
.tool-grid, .key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.tool { display: flex; align-items: center; gap: .5rem; padding: .6rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; font-weight: 550; cursor: pointer; text-align: left; }
.tool:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tool.on { border-color: var(--accent); background: var(--accent-soft); }
.key { padding: .55rem .5rem; border-radius: 9px; border: 1px solid var(--border); border-bottom-width: 3px; background: var(--surface); color: var(--text); font: 600 .8rem var(--font); cursor: pointer; }
.key:hover { background: var(--surface-2); }
.key:active { transform: translateY(2px); border-bottom-width: 1px; }
.pad-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.pad-list li.pad { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .84rem; }
.pad-list li.pad svg { color: var(--ok); }
.pad-list li.pad .pad-text { display: grid; line-height: 1.3; }
.pad-list li.pad .last { font-size: .74rem; color: var(--muted); font-family: var(--mono); }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); flex: none; transition: background .1s, box-shadow .1s; }
.live.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.25); }
.pad-ind { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .45rem; border-radius: 99px; background: rgba(52,211,153,.14); color: var(--ok); font-size: .72rem; transition: box-shadow .1s, background .1s; }
.pad-ind svg { width: 16px; height: 16px; }
.ctl-ind { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: 99px; font-size: .72rem; background: rgba(52,211,153,.14); color: var(--ok); white-space: nowrap; }
.ctl-ind svg { width: 14px; height: 14px; }
.ctl-ind.off { background: rgba(251,191,36,.16); color: var(--warn); }
.pad-ind.active { background: rgba(52,211,153,.32); box-shadow: 0 0 10px rgba(52,211,153,.55); }
.drop { display: grid; justify-items: center; text-align: center; gap: .3rem; padding: 1.6rem 1rem; margin-top: .6rem; border: 1.5px dashed var(--border-strong); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop > svg { width: 28px; height: 28px; color: var(--accent); }
.xfers { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.xfer { padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .82rem; }
.xfer .row { justify-content: space-between; flex-wrap: nowrap; }
.xfer .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xfer .prog { height: 4px; margin-top: .4rem; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.xfer .prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.xfer.done .prog i { background: var(--ok); }
.clip-box { padding: .7rem .8rem; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font: .84rem/1.5 var(--mono); max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin-bottom: .5rem; color: var(--muted); }

.tp-cursor { position: absolute; z-index: 12; width: 16px; height: 16px; margin: -2px 0 0 -2px; pointer-events: none; border-left: 2px solid #fff; border-top: 2px solid #fff; transform: skew(-12deg); filter: drop-shadow(0 0 2px #000); }
.dropzone { position: absolute; inset: 12px; z-index: 30; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 20px; background: rgba(109,123,255,.15); backdrop-filter: blur(3px); pointer-events: none; }
.dropzone div { display: grid; justify-items: center; gap: .5rem; font-size: 1.1rem; }
.dropzone svg { width: 40px; height: 40px; }
.banner { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 22; display: flex; gap: .6rem; align-items: center; padding: .55rem 1rem; border-radius: 99px; background: rgba(251,191,36,.95); color: #1a1405; font-weight: 600; font-size: .88rem; }
.kbd-sink { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

.overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: radial-gradient(800px 500px at 50% 30%, rgba(109,123,255,.18), transparent), #07080d; }
.connect-card { width: 100%; max-width: 400px; text-align: center; }
.connect-card h2 { margin: 1.6rem 0 1rem; color: #eef0f6; }
.connect-visual { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.cv-node { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: #151925; border: 1px solid #2a3042; color: #c7cce0; }
.cv-node svg { width: 24px; height: 24px; }
.cv-line { position: relative; width: 120px; height: 2px; background: #2a3042; overflow: hidden; border-radius: 2px; }
.cv-line span { position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--grad); animation: travel 1.2s ease-in-out infinite; }
.overlay.failed .cv-line span { animation: none; background: var(--bad); left: 0; width: 100%; }
@keyframes travel { to { left: 100%; } }
.progress { list-style: none; padding: 0; margin: 0 auto 1.4rem; text-align: left; display: grid; gap: .25rem; max-width: 300px; }
.progress li { position: relative; padding: .35rem 0 .35rem 1.9rem; color: #5e6578; font-size: .92rem; transition: color .2s; }
.progress li::before { content: ""; position: absolute; left: .3rem; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; border: 2px solid #343b50; }
.progress li.active { color: #eef0f6; }
.progress li.active::before { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.progress li.done { color: #98a0b4; }
.progress li.done::before { background: var(--ok); border-color: var(--ok); }
.progress li.failed { color: var(--bad); } .progress li.failed::before { background: var(--bad); border-color: var(--bad); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); border-top-color: currentColor; animation: spin .8s linear infinite; display: inline-block; }
.spin.sm { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ TOASTS ============ */
.toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: grid; gap: .5rem; pointer-events: none; max-width: calc(100% - 36px); }
.toast { display: flex; align-items: center; gap: .6rem; background: #1c2130; color: #eef0f6; border: 1px solid #2f3548; padding: .65rem 1rem; border-radius: 12px; font-size: .88rem; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: toast-in .2s ease; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.ok::before { background: var(--ok); } .toast.bad::before { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .mobile-only { display: flex; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.5); }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; padding: .6rem 16px; border-bottom: 1px solid var(--border); background: var(--bg-2); position: sticky; top: 0; z-index: 20; }
  .page { padding: 1.4rem 16px 3rem; }
}
@media (max-width: 560px) {
  .page-head .btn { width: 100%; }
  .search { max-width: none; }
  .otp input, .code-boxes input { width: 36px; height: 46px; font-size: 1.1rem; }
  .code-boxes { gap: .3rem; }
  .pill-bar { gap: .4rem; padding-left: .7rem; top: 8px; }
  .pill-left b { max-width: 10ch; }
  .timer { display: none; }
  .pb { width: 34px; height: 34px; }
  .panel { width: 100%; }
  .hud { width: 200px; top: 64px; }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Local checkpoint: keep actions that need later stages (accounts, pairing, SYSTEM service)
   out of the active UI. Now working and visible: Input, Keys, Files, Clipboard tabs, quality,
   resolution, fps, bitrate, monitor switching, audio, controllers. */
#login-form > :not(h2):not(.muted), .nav:not([data-page="computers"]), .side-card,
#btn-open-pair,#btn-empty-pair,.fav-btn,.dmenu,.dmore,.dactions [data-act="wake"],
#t-privacy,.key[data-combo="ctrl-alt-del"] {display:none!important}

.dcard [data-menu],.chip[data-filter="fav"]{display:none!important}
.seg.disabled { opacity: .5; pointer-events: none; }

/* Gaming tab: keyboard & mouse → controller mapping */
.g-status { color: var(--ok); font-weight: 600; }
.g-status.off { color: var(--muted); font-weight: 500; }
.g-map-head { justify-content: space-between; }
.g-map-head .btn { text-transform: none; letter-spacing: 0; font-size: .74rem; padding: .2rem .5rem; color: var(--muted); }
.g-map { display: grid; gap: .15rem; }
.g-map .g-group { font-size: .7rem; font-weight: 700; color: var(--faint); margin: .7rem 0 .2rem; text-transform: uppercase; letter-spacing: .05em; }
.g-row { display: grid; grid-template-columns: minmax(0, 1fr) 5.6rem 5.6rem; gap: .3rem; align-items: center; }
.g-row > span { font-size: .82rem; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.g-slot { min-height: 1.9rem; padding: .25rem .35rem; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 .74rem var(--font); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-slot:hover { border-color: var(--border-strong); background: var(--surface-2); }
.g-slot.empty { color: var(--faint); font-weight: 500; border-style: dashed; }
.g-slot.listening { border-color: var(--accent); background: var(--accent-soft); color: var(--text); animation: g-pulse 1s ease-in-out infinite; }
.g-slot.flash { border-color: var(--ok); }
@keyframes g-pulse { 50% { box-shadow: 0 0 0 3px var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .g-slot.listening { animation: none; } }
.g-live { display: grid; gap: .35rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin: .4rem 0; }
.g-live-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: .5rem; align-items: center; font-size: .78rem; color: var(--muted); }
.g-live-row b { color: var(--text); font-family: var(--mono); font-size: .75rem; grid-column: 3; }
.g-live-row > span:first-child { grid-column: 1; }
.g-meter { grid-column: 2; position: relative; height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.g-meter i { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; background: var(--accent); }
.code-input { font: 700 1.6rem/1.2 var(--mono) !important; letter-spacing: .25em; text-align: center; text-transform: uppercase; padding: .7rem !important; }
.code-input::placeholder { color: var(--faint); letter-spacing: .25em; }
