:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #152238;
  --muted: #64748b;
  --line: #d9e1ec;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --warn: #b45309;
  --ok: #15803d;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f8fafc;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #0f172a;
  color: #e5edf6;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #14b8a6;
  color: #062923;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.login-copy h2,
.login-copy p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p {
  color: #99a8bd;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #1e293b;
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  color: #8fa0b6;
  font-size: 12px;
  word-break: break-all;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-pill {
  min-width: 88px;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e2e8f0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok {
  background: #dcfce7;
  color: var(--ok);
}

.status-pill.bad {
  background: #ffedd5;
  color: var(--warn);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-btn:hover {
  background: #f8fafc;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-copy {
  display: grid;
  align-content: center;
  gap: 10px;
}

.login-form,
.form-grid,
.control-stack {
  display: grid;
  gap: 14px;
}

.content,
.view {
  display: grid;
  gap: 18px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
}

.hidden {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 28px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.wide-left {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.timeline div,
.capability,
.device-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fafc;
}

.code-box {
  overflow: auto;
  min-height: 120px;
  max-height: 360px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #0f172a;
  color: #dbeafe;
  font-size: 12px;
}

.mini-code {
  overflow: auto;
  max-height: 120px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

.capability-grid,
.device-list {
  display: grid;
  gap: 10px;
}

.capability-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.capability strong,
.device-card strong {
  display: block;
  margin-bottom: 6px;
}

.capability span,
.device-card span {
  color: var(--muted);
  font-size: 12px;
}

.device-card.active {
  border-color: var(--brand);
  background: #ecfdf5;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch-row input {
  width: 22px;
  min-height: 22px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  border-radius: 8px;
  padding: 12px 14px;
  background: #0f172a;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  .shell,
  .login-panel,
  .two-column,
  .wide-left,
  .metrics,
  .capability-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}
