:root {
  --bg: #0f1116;
  --surface: #181b22;
  --surface-2: #20242d;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b92a1;
  --primary: #6b7cff;
  --green: #3fb950;
  --red: #f85149;
  --blue: #4b9bff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); font-weight: 400; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

.conn { font-size: 13px; padding: 4px 10px; border-radius: 20px; }
.conn.online { background: rgba(63,185,80,.15); color: var(--green); }
.conn.offline { background: rgba(248,81,73,.15); color: var(--red); }

.layout { display: flex; height: calc(100vh - 53px); }

.sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}
.sidebar-head { padding: 14px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.device-list { list-style: none; margin: 0; padding: 0; }
.device-list li {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.device-list li:hover { background: var(--surface-2); }
.device-list li.active { background: var(--surface-2); border-left: 3px solid var(--primary); }
.device-list .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.device-list .id { font-size: 11px; color: var(--muted); margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.online { background: var(--green); }

.content { flex: 1; overflow-y: auto; padding: 24px; }
.empty { color: var(--muted); text-align: center; margin-top: 15vh; font-size: 15px; }

.device-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.device-header h2 { margin: 0 0 4px; }

.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: default; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); }
.badge { background: var(--surface-2); border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.card .icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex: none;
}
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: 600; font-size: 14px; }
.card .sub { font-size: 12px; color: var(--muted); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }

.pill.green { background: rgba(63,185,80,.15); color: var(--green); }
.pill.red { background: rgba(248,81,73,.15); color: var(--red); }
.pill.blue { background: rgba(75,155,255,.15); color: var(--blue); }
.icon.green { background: rgba(63,185,80,.15); color: var(--green); }
.icon.red { background: rgba(248,81,73,.15); color: var(--red); }
.icon.blue { background: rgba(75,155,255,.15); color: var(--blue); }

.panel-empty { color: var(--muted); text-align: center; padding: 40px; }
a { color: var(--blue); }
