:root {
  --bg-canvas: #070b14;
  --bg-layout: #0a0a1a;
  --bg-surface: #0c1220;
  --glass: rgba(17, 25, 40, 0.6);
  --brand: #4a7ab5;
  --brand-hover: #3a6396;
  --brand-pressed: #31537e;
  --brand-light: #93b3d6;
  --text: #dbe4f0;
  --text-dim: #8b99b0;
  --muted: #64748b;
  --divider: rgba(30, 41, 59, 0.5);
  --border: rgba(110, 140, 180, 0.16);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-card: 16px;
  --radius-control: 10px;
  --radius-item: 8px;
}

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

body {
  min-height: 100vh;
  background: radial-gradient(1200px 800px at 20% -10%, #0d1830 0%, var(--bg-canvas) 55%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.shell { width: 100%; max-width: 420px; }
.shell.wide { max-width: 760px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-left: 4px;
}
.brand .logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #16233d, #0b1220);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--brand-light);
  font-weight: 800; font-size: 18px;
}
.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.brand p { font-size: 12px; color: var(--muted); }

.card {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  padding: 24px;
}

.tabs {
  display: flex;
  background: rgba(30, 41, 59, 0.3);
  border-radius: var(--radius-item);
  padding: 4px;
  margin-bottom: 20px;
}
.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.tabs button.active {
  background: var(--brand);
  color: #f2f6fb;
  box-shadow: 0 4px 14px rgba(74, 122, 181, 0.3);
}

label { display: block; font-size: 12px; color: var(--text-dim); margin: 14px 0 6px; }
input {
  width: 100%;
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid rgba(110, 140, 180, 0.18);
  border-radius: var(--radius-control);
  color: var(--text);
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(74, 122, 181, 0.18); }
input::placeholder { color: #4b5668; }

.row { display: flex; gap: 10px; }
.row input { flex: 1; }

.btn {
  width: 100%;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--brand);
  color: #f2f6fb;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 16px;
  margin-top: 18px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(74, 122, 181, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn:hover { background: var(--brand-hover); transform: translateY(-1px); }
.btn:active { background: var(--brand-pressed); transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  box-shadow: none;
  margin-top: 10px;
}
.btn.ghost:hover { background: rgba(17, 25, 40, 0.5); color: var(--text); }
.btn.small {
  width: auto;
  margin: 0;
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-item);
}
.btn.danger { background: rgba(239, 68, 68, 0.16); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); box-shadow: none; }

.msg { font-size: 12px; margin-top: 12px; min-height: 16px; color: var(--text-dim); }
.msg.err { color: #f87171; }
.msg.ok { color: var(--success); }

.hidden { display: none !important; }

/* panel */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat {
  background: rgba(10, 16, 28, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-item);
  padding: 12px 14px;
}
.stat .k { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat .v { font-size: 18px; font-weight: 700; margin-top: 4px; }
.stat .v.small { font-size: 14px; font-weight: 600; }

.list-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.list-head h2 { font-size: 14px; font-weight: 600; color: var(--text); }

.device {
  background: rgba(10, 16, 28, 0.45);
  border: 1px solid var(--border);
  border-radius: var(--radius-item);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.device .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.device .name { font-weight: 600; font-size: 14px; }
.device .sub {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.device .sub input {
  font-size: 11px;
  color: var(--text-dim);
  padding: 8px 10px;
  background: rgba(7, 11, 20, 0.6);
}
.device .meta { font-size: 11px; color: var(--muted); margin-top: 6px; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 28px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-item);
}

.footer { text-align: center; font-size: 11px; color: var(--muted); margin-top: 18px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(12, 18, 32, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  body { padding: 14px; align-items: flex-start; padding-top: 40px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: span 2; }
  .card { padding: 18px; }
}
