:root {
  --bg: #0f1420;
  --panel: #161d2c;
  --panel2: #1d2637;
  --line: #26314a;
  --text: #e6ecf7;
  --muted: #8fa0bd;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell { display: flex; min-height: 100vh; }

.nav {
  width: 220px;
  flex: 0 0 220px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 16px; letter-spacing: .3px;
  padding: 4px 8px 16px; color: #fff;
}
.brand svg { color: var(--accent); }
.nav-item {
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px;
}
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-foot {
  margin-top: auto; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 7px; padding: 8px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 8px; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--err); }

.main { flex: 1; padding: 26px 30px; max-width: 1100px; }
h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; flex: 1; }
.field label { font-size: 12px; color: var(--muted); }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); }

button.btn {
  border: 0; border-radius: 9px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--accent); color: #fff;
}
button.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.btn.warn { background: transparent; color: var(--err); border: 1px solid #4a2530; }
button.btn:disabled { opacity: .5; cursor: default; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
}
.badge.connected { background: rgba(34,197,94,.15); color: #4ade80; }
.badge.pairing { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.offline { background: rgba(143,160,189,.15); color: var(--muted); }
.badge.logged_out, .badge.error { background: rgba(239,68,68,.15); color: #f87171; }

.pair {
  font-family: ui-monospace, Menlo, monospace; font-size: 26px; letter-spacing: 6px;
  background: var(--panel2); border: 1px dashed var(--accent); border-radius: 12px;
  padding: 16px; text-align: center; margin-top: 12px;
}
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.msg { margin-top: 12px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.msg.err { color: #f87171; }
.msg.ok { color: #4ade80; }

.log { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.log td { padding: 6px 10px; }
.log .kind { color: var(--accent); }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .nav { width: auto; flex: none; flex-direction: row; flex-wrap: wrap; }
  .nav-foot { margin: 0; }
  .main { padding: 18px; }
}
