/* ============ 基础 ============ */
:root {
  --bg: #070b10;
  --bg-soft: #0a1017;
  --panel: #0e151f;
  --panel-2: #111a26;
  --panel-3: #16212f;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #e8eef7;
  --muted: #93a3b8;
  --muted-2: #64748b;
  --accent: #2dd4bf;
  --accent-bright: #5eead4;
  --accent-dim: rgba(45, 212, 191, 0.12);
  --blue: #38bdf8;
  --blue-dim: rgba(56, 189, 248, 0.12);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.12);
  --success: #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --font: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.55;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); display: inline-block; flex: none; }
.dot-accent { background: var(--accent); box-shadow: 0 0 8px rgba(45, 212, 191, 0.75); }
.dot-success { background: var(--success); box-shadow: 0 0 8px rgba(52, 211, 153, 0.65); }
.dot-danger { background: var(--danger); box-shadow: 0 0 8px rgba(248, 113, 113, 0.6); }
.dot-warning { background: var(--warning); box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
.dot-pulse { animation: pulse 2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ============ 通用控件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.1s ease, box-shadow 0.16s ease;
  text-decoration: none;
}
.btn:hover { background: var(--panel-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  border-color: transparent;
  color: #04221d;
  font-weight: 700;
  box-shadow: 0 6px 22px rgba(45, 212, 191, 0.22);
}
.btn-primary:hover { background: linear-gradient(135deg, #7ff5e2, #36e0c9); border-color: transparent; }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(148, 163, 184, 0.08); }

.btn-danger { background: var(--danger-dim); border-color: rgba(248, 113, 113, 0.3); color: #fca5a5; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.5); }

.btn-sm { height: 31px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: all 0.16s ease;
}
.icon-btn:hover { background: rgba(148, 163, 184, 0.1); color: var(--text); border-color: var(--border); }
.icon-btn .icon { width: 19px; height: 19px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(45, 212, 191, 0.22);
  color: var(--accent-bright);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.live-chip .dot { width: 6px; height: 6px; background: var(--accent); animation: pulse 2s infinite; }
.live-chip.offline { background: var(--danger-dim); border-color: rgba(248, 113, 113, 0.25); color: #fca5a5; }
.live-chip.offline .dot { background: var(--danger); animation: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  border: 1px solid transparent;
}
.badge .dot { width: 5px; height: 5px; }
.badge-label { background: var(--blue-dim); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.18); }
.badge-engrave { background: var(--purple-dim); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.18); }
.badge-success { background: var(--success-dim); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.18); }
.badge-danger { background: var(--danger-dim); color: #fca5a5; border-color: rgba(248, 113, 113, 0.18); }
.badge-warning { background: var(--warning-dim); color: #fcd34d; border-color: rgba(251, 191, 36, 0.18); }
.badge-accent { background: var(--accent-dim); color: var(--accent-bright); border-color: rgba(45, 212, 191, 0.2); }
.badge-muted { background: rgba(148, 163, 184, 0.08); color: var(--muted); }
.badge-online { background: var(--success-dim); color: #6ee7b7; }
.badge-offline { background: rgba(148, 163, 184, 0.08); color: var(--muted-2); }

/* ============ 登录 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(45, 212, 191, 0.1), transparent 60%),
    radial-gradient(900px 600px at 100% 110%, rgba(56, 189, 248, 0.09), transparent 55%),
    var(--bg);
}
.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 25%, transparent 75%);
  pointer-events: none;
}
.login-aurora {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  top: -280px;
  right: -160px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.14), transparent 65%);
  filter: blur(30px);
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  padding: 42px 38px 30px;
  background: linear-gradient(180deg, rgba(20, 30, 43, 0.92), rgba(11, 17, 25, 0.94));
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
  animation: fadeUp 0.45s ease both;
}
.login-brand { display: flex; align-items: center; gap: 15px; margin-bottom: 34px; }
.login-brand h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.login-brand p { color: var(--muted); font-size: 12.5px; margin-top: 3px; letter-spacing: 0.02em; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--accent);
  background: linear-gradient(160deg, rgba(45, 212, 191, 0.16), rgba(56, 189, 248, 0.07));
  border: 1px solid rgba(45, 212, 191, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 16px rgba(45, 212, 191, 0.08);
  flex: none;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-mark-lg { width: 54px; height: 54px; border-radius: 15px; }
.brand-mark-lg svg { width: 34px; height: 34px; }

.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.02em; }
.input-group { position: relative; display: flex; align-items: center; }
.input-action {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.input-action:hover { color: var(--text); background: rgba(148, 163, 184, 0.1); }
.input-action .icon { width: 17px; height: 17px; }

.login-card .input-group input {
  width: 100%;
  height: 46px;
  padding: 0 46px 0 14px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(7, 11, 16, 0.6);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
  font-size: 14px;
}
.login-card .input-group input:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}
.login-card form .btn { margin-top: 16px; height: 46px; font-size: 14px; }
.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 12.5px;
}
.login-hint {
  margin-top: 18px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--warning-dim);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: #fcd34d;
  font-size: 12px;
  line-height: 1.65;
}
.login-hint code {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}
.login-footnote {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-2);
  font-size: 11.5px;
}
.login-footer {
  position: absolute;
  bottom: 22px;
  z-index: 2;
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* ============ 应用框架 ============ */
.app-page {
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(45, 212, 191, 0.045), transparent 60%),
    var(--bg);
}
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 246px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #0b1219 0%, #080d13 100%);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 24px; }
.brand-text { min-width: 0; }
.brand-name { font-size: 16.5px; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 9px; color: var(--muted-2); letter-spacing: 0.22em; margin-top: 1px; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; padding: 0 0 10px; }
.nav-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
  font-weight: 600;
  padding: 16px 12px 7px;
  text-transform: uppercase;
}
.nav-label:first-child { padding-top: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
}
.nav-item .icon { width: 17px; height: 17px; opacity: 0.85; }
.nav-item:hover { background: rgba(148, 163, 184, 0.07); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.14), rgba(45, 212, 191, 0.04));
  color: var(--accent-bright);
  border-color: rgba(45, 212, 191, 0.18);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.6);
}
.nav-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted-2);
  background: rgba(148, 163, 184, 0.09);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 600;
}
.nav-item.active .nav-count { color: var(--accent-bright); background: rgba(45, 212, 191, 0.12); }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.server-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(52, 211, 153, 0.06);
  color: var(--muted);
  font-size: 11.5px;
}
.nav-item-quiet { height: 36px; font-size: 12.5px; color: var(--muted-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 76px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 16, 0.72);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.topbar-date { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; letter-spacing: 0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-bright);
  background: linear-gradient(145deg, rgba(45, 212, 191, 0.18), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(45, 212, 191, 0.25);
  margin-left: 2px;
}
.mobile-only { display: none; }

.content {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 30px 70px;
  animation: fadeUp 0.25s ease both;
}
.section-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-desc { color: var(--muted); font-size: 12.5px; margin-top: 4px; max-width: 680px; line-height: 1.7; }
.toolbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ============ 概览 ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative;
  padding: 18px 20px 17px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.35), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.kpi:hover::after { opacity: 1; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
}
.kpi-icon.blue { background: var(--blue-dim); color: var(--blue); }
.kpi-icon.purple { background: var(--purple-dim); color: var(--purple); }
.kpi-icon.warning { background: var(--warning-dim); color: var(--warning); }
.kpi-icon .icon { width: 17px; height: 17px; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; color: var(--muted-2); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 7px; display: flex; align-items: center; gap: 6px; }
.kpi-meta .dot { width: 5px; height: 5px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-title .icon { width: 16px; height: 16px; color: var(--accent); }
.panel-link { background: none; border: 0; color: var(--muted); font-size: 12px; padding: 4px; display: inline-flex; align-items: center; gap: 5px; }
.panel-link:hover { color: var(--accent-bright); }
.panel-body { padding: 16px 20px 20px; }

.device-overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.device-tile {
  padding: 15px 16px 13px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 16, 0.35);
  transition: border-color 0.16s, background 0.16s;
  cursor: pointer;
}
.device-tile:hover { border-color: var(--border-strong); background: rgba(7, 11, 16, 0.55); }
.device-tile.is-online { border-color: rgba(52, 211, 153, 0.16); }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tile-name { font-size: 13.5px; font-weight: 600; }
.tile-sub { font-size: 11px; color: var(--muted-2); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.tile-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted-2); }
.tile-status.online { color: #6ee7b7; }
.tile-foot { margin-top: 13px; padding-top: 11px; border-top: 1px dashed var(--border); font-size: 11px; color: var(--muted-2); display: flex; justify-content: space-between; gap: 8px; }

.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.07); }
.activity-item:first-child { padding-top: 2px; }
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.07);
  color: var(--muted);
}
.activity-icon.success { background: var(--success-dim); color: var(--success); }
.activity-icon.failed { background: var(--danger-dim); color: var(--danger); }
.activity-icon.pending { background: var(--warning-dim); color: var(--warning); }
.activity-icon .icon { width: 14px; height: 14px; }
.activity-main { flex: 1; min-width: 0; }
.activity-title { font-size: 12.5px; font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.activity-title .time { font-size: 10.5px; color: var(--muted-2); font-weight: 400; white-space: nowrap; }
.activity-sub { font-size: 11px; color: var(--muted-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-action {
  padding: 14px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 16, 0.35);
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  transition: all 0.16s;
}
.quick-action:hover { border-color: rgba(45, 212, 191, 0.35); color: var(--text); background: var(--accent-dim); }
.quick-action .icon { width: 18px; height: 18px; color: var(--accent); }
.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  background: var(--warning-dim);
  color: #fcd34d;
  font-size: 12.5px;
  margin-bottom: 18px;
  line-height: 1.6;
}
.notice-banner .icon { width: 17px; height: 17px; margin-top: 1px; flex: none; }
.notice-banner a { color: #fde68a; }

/* ============ 表格 ============ */
.table-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted-2);
  font-weight: 600;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 16, 0.3);
  white-space: nowrap;
}
.table td { padding: 14px 18px; border-bottom: 1px solid rgba(148, 163, 184, 0.07); vertical-align: middle; font-size: 13px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.14s; }
.table tbody tr:hover { background: rgba(148, 163, 184, 0.035); }
.table .cell-main { font-weight: 550; }
.table .cell-sub { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.table .row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.table .num { font-variant-numeric: tabular-nums; }
.table-scroll-hint { display: none; }
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-toolbar .spacer { flex: 1; }

.device-cell { display: flex; align-items: center; gap: 12px; }
.device-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  border: 1px solid var(--border);
}
.device-avatar.online { background: var(--accent-dim); color: var(--accent); border-color: rgba(45, 212, 191, 0.22); }
.device-avatar .icon { width: 18px; height: 18px; }

.thumb-qr {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  display: block;
  object-fit: contain;
  border: 1px solid var(--border);
}
.code-content { font-family: var(--mono); font-size: 12.5px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.copy-mini { border: 0; background: transparent; color: var(--muted-2); padding: 3px; border-radius: 5px; display: inline-flex; }
.copy-mini:hover { color: var(--accent); background: var(--accent-dim); }
.copy-mini .icon { width: 13px; height: 13px; }
.binding-chips { display: flex; flex-wrap: wrap; gap: 5px; max-width: 330px; }
.binding-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.075);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  max-width: 100%;
}
.binding-chip b { color: var(--text); font-weight: 500; }
.binding-chip span { color: var(--muted-2); }
.binding-chip .icon { width: 11px; height: 11px; color: var(--accent); }

/* ============ 空状态 / 加载 ============ */
.empty {
  padding: 54px 24px;
  text-align: center;
  color: var(--muted-2);
}
.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.06);
  border: 1px dashed var(--border-strong);
  color: var(--muted-2);
}
.empty-icon .icon { width: 22px; height: 22px; }
.empty-title { color: var(--muted); font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.empty-desc { font-size: 12px; line-height: 1.7; max-width: 420px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.loading-wrap { padding: 60px 0; display: flex; justify-content: center; }
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

/* ============ 表单 ============ */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; line-height: 1.65; }
.field-hint code { font-family: var(--mono); background: rgba(148, 163, 184, 0.1); padding: 1px 5px; border-radius: 4px; font-size: 11px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: rgba(7, 11, 16, 0.55);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 74px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.09);
}
.input::placeholder, .textarea::placeholder { color: #4b5a6d; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.select option { background: #111a26; color: var(--text); }
.input-wrap-btn { display: flex; gap: 8px; }
.input-wrap-btn .input { flex: 1; }
.mono-input { font-family: var(--mono); font-size: 12.5px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: rgba(7, 11, 16, 0.3); }
.switch-label { font-size: 13px; font-weight: 500; }
.switch-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  transition: background 0.18s;
  cursor: pointer;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d5dde8;
  top: 3px;
  left: 3px;
  transition: transform 0.18s, background 0.18s;
}
.switch input:checked + .switch-slider { background: rgba(45, 212, 191, 0.6); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); background: #04221d; }

/* 绑定编辑器 */
.binding-editor { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.binding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  background: rgba(7, 11, 16, 0.35);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.binding-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.binding-row { display: grid; grid-template-columns: 1.15fr 1fr 32px; gap: 8px; align-items: center; }
.binding-row .select { height: 36px; font-size: 12.5px; }
.binding-row .btn-remove { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted-2); }
.binding-row .btn-remove:hover { background: var(--danger-dim); color: var(--danger); }
.binding-row .btn-remove .icon { width: 14px; height: 14px; }
.binding-empty { padding: 14px 13px; color: var(--muted-2); font-size: 12px; }

/* ============ 弹窗 ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 5, 8, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeUp 0.16s ease both;
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #121c28, #0d131c);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease both;
}
.modal.modal-lg { max-width: 760px; }
.modal.modal-sm { max-width: 440px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }
.modal-close { margin: -6px -8px 0 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 22px 19px;
  border-top: 1px solid var(--border);
}
.modal-foot .left { margin-right: auto; }
.form-error-inline {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--danger-dim);
  border: 1px solid rgba(248, 113, 113, 0.22);
  color: #fca5a5;
  font-size: 12px;
}
.confirm-message { font-size: 13.5px; color: var(--muted); line-height: 1.75; }
.confirm-message b { color: var(--text); font-weight: 600; }

/* 扫码端 / 配置信息 */
.info-block { background: rgba(7, 11, 16, 0.4); border: 1px solid var(--border); border-radius: 11px; padding: 14px 15px; }
.info-block + .info-block { margin-top: 12px; }
.info-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); font-weight: 600; margin-bottom: 8px; }
.url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(2, 5, 8, 0.55);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-bright);
  word-break: break-all;
}
.url-box .spacer { flex: 1; }
.step-list { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.step-list li { position: relative; padding-left: 28px; font-size: 12.5px; color: var(--muted); line-height: 1.65; counter-increment: step; }
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.25);
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-list code, .info-block code { font-family: var(--mono); font-size: 11.5px; background: rgba(148, 163, 184, 0.1); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.code-block {
  position: relative;
  margin: 0;
  padding: 12px 13px;
  border-radius: 9px;
  background: rgba(2, 5, 8, 0.6);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: #a5d6c8;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow: auto;
}
.code-block-wrap { position: relative; }
.code-block-wrap .copy-float { position: absolute; top: 7px; right: 7px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.code-block-wrap .copy-float:hover { color: var(--accent); border-color: rgba(45, 212, 191, 0.3); }

/* 二维码打印预览 */
.qr-print-preview { display: flex; gap: 24px; align-items: center; }
.qr-print-card {
  width: 210px;
  flex: none;
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.qr-print-card img { width: 170px; height: 170px; display: block; margin: 0 auto; }
.qr-print-brand { font-size: 10px; letter-spacing: 0.18em; color: #666; margin-bottom: 10px; font-weight: 700; }
.qr-print-code { font-family: var(--mono); font-size: 12px; margin-top: 10px; color: #111; word-break: break-all; }
.qr-print-meta { font-size: 11px; color: #555; margin-top: 5px; line-height: 1.5; }

/* ============ Toast ============ */
.toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 400px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(17, 26, 38, 0.97);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  pointer-events: auto;
  animation: fadeUp 0.2s ease both;
}
.toast .icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast-success { border-color: rgba(52, 211, 153, 0.3); }
.toast-success .icon { color: var(--success); }
.toast-error { border-color: rgba(248, 113, 113, 0.35); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--blue); }
.toast.leaving { animation: toastOut 0.2s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateX(12px); } }

/* ============ 打印 ============ */
.print-sheet { display: none; }
@media print {
  @page { margin: 8mm; }
  html, body { background: #fff !important; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block !important; color: #000; }
  .print-label {
    width: 92mm;
    padding: 6mm 4mm;
    border: 1px dashed #999;
    margin: 0 auto;
    text-align: center;
    page-break-inside: avoid;
  }
  .print-label .pl-brand { font-size: 9pt; letter-spacing: 0.2em; color: #666; font-weight: 700; }
  .print-label img { width: 58mm; height: 58mm; display: block; margin: 4mm auto; }
  .print-label .pl-code { font-family: var(--mono); font-size: 11pt; font-weight: 700; word-break: break-all; }
  .print-label .pl-meta { font-size: 8.5pt; color: #333; margin-top: 2mm; line-height: 1.5; }
  .print-label .pl-note { font-size: 8pt; color: #555; margin-top: 1.5mm; }
}

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.45);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 5, 8, 0.6);
    backdrop-filter: blur(3px);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .mobile-only { display: inline-flex; }
  .topbar { height: 68px; padding: 0 18px; }
  .content { padding: 20px 18px 60px; }
  .topbar h1 { font-size: 18px; }
}

@media (max-width: 620px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px 15px; border-radius: 13px; }
  .kpi-value { font-size: 24px; }
  .kpi-icon { width: 29px; height: 29px; }
  .kpi-meta { font-size: 10.5px; }
  .live-chip { display: none; }
  .topbar-date { display: none; }
  .section-toolbar { align-items: stretch; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .quick-actions { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .binding-row { grid-template-columns: 1fr 1fr 32px; }
  .qr-print-preview { flex-direction: column; align-items: stretch; }
  .qr-print-card { width: 100%; display: flex; align-items: center; gap: 16px; text-align: left; }
  .qr-print-card img { width: 96px; height: 96px; margin: 0; flex: none; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 18px 18px 12px 12px; }
  .modal-head { padding: 17px 17px 13px; }
  .modal-body { padding: 17px; }
  .modal-foot { padding: 13px 17px 16px; }
  .toast-root { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; min-width: 0; }
  .content { padding: 18px 14px 56px; }
  .table th, .table td { padding: 12px 14px; }
  .device-overview-grid { grid-template-columns: 1fr; }
}

/* ============ 补充组件 ============ */
.stack { display: flex; flex-direction: column; gap: 16px; }
.select-sm { height: 32px; font-size: 12.5px; border-radius: 8px; padding-right: 30px; }
.spinning .icon { animation: spin 0.8s linear infinite; }
.device-tile:focus-visible { outline: 2px solid rgba(45, 212, 191, 0.5); outline-offset: 2px; }

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 30px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 13px;
  background: rgba(7, 11, 16, 0.35);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: rgba(45, 212, 191, 0.55);
  background: var(--accent-dim);
}
.upload-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  margin-bottom: 6px;
}
.upload-icon .icon { width: 20px; height: 20px; }
.upload-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.upload-sub { font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }
.file-picked {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(45, 212, 191, 0.22);
  background: rgba(45, 212, 191, 0.06);
}
.file-picked > .icon { color: var(--accent); flex: none; }
.file-picked-main { flex: 1; min-width: 0; }
.file-picked-name { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picked-size { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.binding-add { margin-top: 9px; }
