:root {
  --bg: #0a0e13;
  --panel: #10161d;
  --panel-2: #151d26;
  --border: #202a35;
  --text: #dbe4ee;
  --text-dim: #7d8ea0;
  --accent: #4fd1c5;
  --accent-dim: #2c7a72;
  --danger: #f06464;
  --danger-dim: #4a2323;
  --font-ui: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.brand-name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(79,209,197,0.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(79,209,197,0.04), transparent 40%),
    var(--bg);
}
.login-card {
  width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
}
.brand-sub { color: var(--text-dim); font-size: 13px; margin-top: 8px; margin-bottom: 24px; }
#login-form label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
#login-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  margin-bottom: 16px;
  font-size: 14px;
}
#login-form input:focus { outline: none; border-color: var(--accent); }
#login-form button {
  width: 100%;
  background: var(--accent);
  color: #06201d;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.15s;
}
#login-form button:hover { filter: brightness(1.08); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--panel);
  flex-shrink: 0;
}
.topbar-status { display: flex; align-items: center; gap: 16px; }
.ws-status { font-family: var(--font-mono); font-size: 12px; }
.ws-status.online { color: var(--accent); }
.ws-status.offline { color: var(--danger); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn-ghost.small { padding: 4px 10px; font-size: 12px; }

.layout { flex: 1; display: flex; overflow: hidden; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-head {
  padding: 16px 18px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.count-badge {
  background: var(--panel-2);
  border-radius: 20px;
  padding: 2px 9px;
  font-family: var(--font-mono);
  color: var(--accent);
}
.empty-hint { padding: 20px 18px; color: var(--text-dim); font-size: 13px; }

.device-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.12s;
}
.device-item:hover { background: var(--panel-2); }
.device-item.active { background: var(--panel-2); border-left: 3px solid var(--accent); }
.device-item-top { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.online { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.offline { background: #45525f; }
.device-item-name { font-size: 14px; font-weight: 500; }
.device-item-meta { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); padding-left: 16px; }

/* ---------- Main ---------- */
.main { flex: 1; overflow-y: auto; padding: 28px; }
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  gap: 12px;
}
.empty-glyph { font-size: 40px; opacity: 0.4; }

.device-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}
.device-panel-head h2 { font-size: 22px; font-weight: 600; }
.dp-meta { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }

.status-pill {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
}
.status-pill.online { background: rgba(79,209,197,0.12); color: var(--accent); }
.status-pill.offline { background: rgba(240,100,100,0.12); color: var(--danger); }

/* ---------- Actions ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.action-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.action-btn:hover { border-color: var(--accent); background: var(--panel-2); }
.action-btn.danger { color: var(--danger); }
.action-btn.danger:hover { border-color: var(--danger); background: var(--danger-dim); }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); display: block; margin-bottom: 8px; }
.stat-value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; display: block; margin-bottom: 10px; }
.stat-bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.stat-bar-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; }

/* ---------- Sections ---------- */
.section-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.screenshot-section, .process-section, .terminal-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.screenshot-section img { width: 100%; border-radius: 6px; border: 1px solid var(--border); }

.process-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.process-table th { text-align: left; color: var(--text-dim); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.process-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.process-table button { background: var(--danger-dim); color: var(--danger); border: none; border-radius: 4px; padding: 3px 8px; font-size: 11px; cursor: pointer; }

.terminal-box { height: 340px; border-radius: 6px; overflow: hidden; }
