:root {
  --bg: #090c12;
  --panel: #10151e;
  --panel-2: #151c27;
  --line: #232d3c;
  --text: #edf3ff;
  --muted: #8b98ab;
  --accent: #3bd7a5;
  --accent-dark: #082d24;
  --danger: #ff6b78;
  --shadow: 0 24px 80px rgba(0,0,0,.45);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, #18312e 0, var(--bg) 45%); }
.auth-card { width: min(420px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: rgba(16,21,30,.94); box-shadow: var(--shadow); }
.brand-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--accent); color: #04110d; font-size: 28px; font-weight: 900; box-shadow: 0 12px 32px rgba(59,215,165,.22); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; }
.auth-card h1 { margin: 22px 0 4px; font-size: 32px; }
.auth-card > p { color: var(--muted); margin: 0 0 28px; }
label { display: block; margin: 0 0 8px; color: #cad5e5; }
input { width: 100%; padding: 13px 14px; color: var(--text); border: 1px solid var(--line); border-radius: 12px; background: #090e16; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,215,165,.12); }
button { border: 1px solid var(--line); border-radius: 11px; padding: 10px 15px; color: var(--text); background: var(--panel-2); transition: .16s ease; }
button:hover { border-color: #3b4a60; transform: translateY(-1px); }
button.primary { border-color: var(--accent); background: var(--accent); color: #04110d; font-weight: 800; }
button.secondary { width: 100%; }
button.danger { border-color: rgba(255,107,120,.42); color: #ffdfe2; background: rgba(255,107,120,.12); }
.auth-card button { width: 100%; margin-top: 18px; }
.error { min-height: 22px; color: var(--danger) !important; margin: 12px 0 0 !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px; border-left: 1px solid var(--line); background: #0c1119; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; font-size: 19px; }
nav { display: grid; gap: 7px; }
.nav-item { text-align: right; background: transparent; border-color: transparent; color: var(--muted); }
.nav-item.active { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; padding: 0 8px; }
.server-state { color: var(--muted); font-size: 13px; }
.server-state i { display: inline-block; width: 8px; height: 8px; margin-left: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.link-button { padding: 0; border: 0; background: transparent; color: var(--muted); text-align: right; }
.main-content { padding: 42px clamp(24px, 5vw, 74px); overflow: hidden; }
.view { display: none; }
.view.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-header h2 { margin: 3px 0 0; font-size: clamp(28px, 3vw, 40px); }
.eyebrow { margin: 0; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.summary { margin: -14px 0 28px; color: var(--muted); }
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.device-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, var(--panel-2), var(--panel)); }
.device-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.device-icon { width: 46px; height: 38px; display: grid; place-items: center; border: 2px solid #43526a; border-radius: 6px; color: #91a0b4; }
.device-name { margin: 18px 0 5px; font-size: 19px; }
.status-pill { padding: 5px 9px; border-radius: 999px; font-size: 12px; color: var(--muted); background: #0b1017; }
.status-pill.online { color: var(--accent); background: var(--accent-dark); }
.device-meta { color: var(--muted); font-size: 13px; }
.device-actions { display: flex; gap: 9px; margin-top: 21px; }
.device-actions .connect { flex: 1; }
.device-actions button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; }
.empty-icon { font-size: 44px; color: var(--accent); }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 16px 18px; text-align: right; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; background: #0d131c; }
tr:last-child td { border-bottom: 0; }
dialog { width: min(480px, calc(100% - 36px)); padding: 30px; color: var(--text); border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.dialog-close { position: absolute; left: 18px; top: 16px; border: 0; background: transparent; font-size: 24px; color: var(--muted); }
dialog h2 { margin: 7px 0 8px; }
dialog p { color: var(--muted); line-height: 1.7; }
.pair-code { margin: 24px 0 12px; padding: 17px; direction: ltr; text-align: center; letter-spacing: .28em; font: 800 27px Consolas, monospace; color: var(--accent); border: 1px dashed #356a5e; border-radius: 13px; background: #091510; }
.muted { font-size: 12px; }
.remote-view { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: auto 1fr; background: #05070a; }
.remote-toolbar { min-height: 58px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: #0d121a; }
.remote-title, .remote-actions { display: flex; align-items: center; gap: 10px; }
.remote-title span:last-child { color: var(--muted); font-size: 12px; direction: ltr; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.remote-actions button, .remote-actions select { padding: 7px 10px; font-size: 13px; }
.remote-stage { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; background: #020304; }
#screen { display: block; max-width: 100%; max-height: 100%; outline: none; image-rendering: auto; cursor: default; }
.connection-message { position: absolute; padding: 12px 18px; border: 1px solid var(--line); border-radius: 10px; background: rgba(13,18,26,.92); color: var(--muted); }
.toast { position: fixed; z-index: 40; right: 50%; bottom: 25px; transform: translateX(50%); padding: 12px 18px; border: 1px solid var(--line); border-radius: 11px; background: #121923; box-shadow: var(--shadow); }
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: auto; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px; border-left: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  nav { display: flex; margin-right: auto; }
  .sidebar-bottom, .brand strong { display: none; }
  .main-content { padding: 24px 16px; }
  .remote-toolbar { align-items: flex-start; }
  .remote-actions { flex-wrap: wrap; justify-content: flex-end; }
  #clipboard-send, #clipboard-get { display: none; }
}

