/* ============================================================
   fwood 设备接入平台 · 管理后台样式
   ============================================================ */
:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e4e9f0;
  --border-strong: #d3dbe6;
  --text: #0f1b2d;
  --text-2: #475569;
  --muted: #7c899e;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --primary-soft: #eaf1ff;
  --ok: #0f9f6e;
  --ok-soft: #e6f8f0;
  --warn: #d98a04;
  --warn-soft: #fff6e5;
  --danger: #dc4b4b;
  --danger-soft: #fdecec;
  --violet: #7c5cd6;
  --violet-soft: #f1edfd;
  --sidebar: #111a2b;
  --sidebar-t: #a7b4c8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .05);
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 10px 28px -12px rgba(15, 27, 45, .18);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
svg { display: block; }
a { color: var(--primary); text-decoration: none; }
code {
  background: #eef2f8;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12.5px;
}
::selection { background: rgba(37, 99, 235, .18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #c6d0dd;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #a5b2c4; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: -.01em;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #f8fafc; border-color: #c1cbd8; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #3b82f6, var(--primary));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px -3px rgba(37, 99, 235, .45);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #2f76ef, var(--primary-d));
  border-color: var(--primary-d);
  color: #fff;
}
.btn.ghost { background: #fff; }
.btn.danger { background: #fff; border-color: #f0c3c3; color: var(--danger); }
.btn.danger:hover { background: #fdf2f2; border-color: #e3a5a5; color: #c33636; }
.btn.link { height: auto; padding: 2px 4px; border: none; background: transparent; color: var(--primary); font-size: 12.5px; }
.btn.link:hover { background: transparent; color: var(--primary-d); text-decoration: underline; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible {
  outline: 2px solid rgba(37, 99, 235, .5);
  outline-offset: 2px;
}

/* ---------------- 表单 ---------------- */
.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; padding: 9px 11px; line-height: 1.6; resize: vertical; }
.input::placeholder { color: #a6b1c2; }
.input:hover { border-color: #bfc9d7; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.input.sm { width: auto; min-width: 156px; height: 34px; font-size: 13px; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  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='%237c899e' 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 11px center;
  cursor: pointer;
}
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
input[type="file"].input { padding: 7px 10px; height: auto; font-size: 12.5px; color: var(--muted); }

.field { display: block; margin-bottom: 15px; }
.field > span { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.field .hint, .hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2 .span2, .span2 { grid-column: span 2; }
.chk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-2);
}
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-field { display: flex; gap: 8px; align-items: center; }
.inline-field .input { flex: 1; min-width: 0; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.actions-col { flex-direction: column; align-items: stretch; }

/* 带文字标签的选项开关（如“仅在线”）；与指令队列的滑动开关 .switch 区分，避免样式相互覆盖 */
.opt-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 12.5px; color: var(--text-2); white-space: nowrap; flex: none; }
.opt-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 20px;
  background: #d6dee9;
  transition: background .18s;
  flex: none;
}
.opt-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 27, 45, .25);
  transition: transform .18s;
}
.opt-switch input:checked + .opt-track { background: var(--primary); }
.opt-switch input:checked + .opt-track::after { transform: translateX(16px); }
.opt-switch input:focus-visible + .opt-track { outline: 2px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

.seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #eef2f8;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(800px 500px at 100% 110%, rgba(14, 165, 233, .08), transparent 55%),
    var(--bg);
}
.login-shell {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 40px 90px -45px rgba(15, 27, 45, .5);
}
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 48px 44px;
  color: #e2e8f0;
  background: linear-gradient(155deg, #111a2b 0%, #16233a 45%, #163f74 100%);
  overflow: hidden;
}
.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-brand::before {
  width: 320px;
  height: 320px;
  right: -130px;
  top: -120px;
  background: radial-gradient(circle, rgba(56, 189, 248, .28), transparent 65%);
}
.login-brand::after {
  width: 260px;
  height: 260px;
  left: -100px;
  bottom: -130px;
  background: radial-gradient(circle, rgba(59, 130, 246, .22), transparent 65%);
}
.login-brand > * { position: relative; z-index: 1; }
.login-brand h1 { margin: 0 0 8px; font-size: 25px; line-height: 1.3; letter-spacing: -.02em; color: #fff; }
.login-brand p { margin: 0; font-size: 13px; line-height: 1.75; color: #a9b8ce; }
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6, #22d3ee);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 12px 26px -8px rgba(34, 211, 238, .55);
  flex: none;
}
.brand-mark.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 13px; }
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 46px;
}
.login-head { margin-bottom: 26px; }
.login-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.login-logo { display: none; }
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.login-field > label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.login-field > .input { height: 42px; }
.pass-box { position: relative; }
.pass-box > .input { height: 42px; padding-right: 44px; }
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pass-toggle:hover { background: #eef2f8; color: var(--text-2); }
.pass-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.pass-toggle svg { width: 18px; height: 18px; }
.pass-toggle .i-off { display: none; }
.pass-toggle[data-on="1"] .i-on { display: none; }
.pass-toggle[data-on="1"] .i-off { display: block; }
/* 隐藏浏览器内置的密码显示/清除控件（Chrome121+ 眼睛、Edge 眼睛与清除），避免与自定义按钮叠成两个眼睛 */
.pass-box .input::-webkit-toggle-password { -webkit-appearance: none !important; display: none !important; }
.pass-box .input::-ms-reveal, .pass-box .input::-ms-clear { display: none !important; }
.login-submit { height: 42px; margin-top: 8px; font-size: 14px; }
.login-submit:disabled { opacity: .7; cursor: progress; }
.error-box {
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid #f3c8c8;
  border-radius: 9px;
  background: #fdf0f0;
  color: #b42323;
  font-size: 12.5px;
}

/* ---------------- 应用骨架 ---------------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  background: linear-gradient(180deg, #111a2b, #0c1421);
  color: var(--sidebar-t);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 20px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.side-brand-text b { display: block; color: #f1f5f9; font-size: 15px; line-height: 1.2; }
.side-brand-text small { display: block; margin-top: 2px; color: #6d7f99; font-size: 11.5px; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; padding: 0 2px; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-group-t {
  padding: 0 12px 6px;
  color: #5b6c86;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-t);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, .85);
}
.nav-ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item.active .nav-ico { opacity: 1; }
.side-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .05);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .15);
  flex: none;
}
.side-status-text b { display: block; color: #dbe4f0; font-size: 12px; font-weight: 600; }
.side-status-text small { display: block; margin-top: 1px; color: #6d7f99; font-size: 11px; white-space: nowrap; }
.nav-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.crumb i { font-style: normal; color: #c3cbd8; }
.crumb b { color: var(--text); font-size: 14px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: #f8fafc; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid #d7e4ff;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.user-chip { display: flex; align-items: center; gap: 9px; padding-left: 14px; border-left: 1px solid var(--border); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: var(--primary-d);
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.user-meta b { display: block; font-size: 12.5px; line-height: 1.2; color: var(--text); }
.user-meta small { color: var(--muted); font-size: 11px; }

.content { flex: 1; overflow-y: auto; padding: 26px 30px 44px; }
.view { max-width: 1400px; margin: 0 auto; animation: fadeUp .22s ease; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-sub { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 面板 / 统计 / 列表 ---------------- */
.panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h3 { margin: 0; font-size: 14.5px; letter-spacing: -.01em; }
.panel-sub { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
/* 每日在线设备数图表 */
.chart-panel { margin-bottom: 20px; }
.online-chart { width: 100%; height: 260px; display: flex; align-items: center; justify-content: center; }
.online-chart-svg { width: 100%; height: 100%; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-ylab, .chart-xlab { fill: var(--muted); font-size: 10px; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--primary); opacity: .08; stroke: none; }
.chart-dot { fill: #fff; stroke: var(--primary); stroke-width: 2; }
.chart-dot.today { fill: var(--ok); stroke: var(--ok); }
.stat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #e2e8f0; }
.stat-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #64748b;
  flex: none;
}
.stat-ico svg { width: 20px; height: 20px; }
.stat-body .num {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-body .lbl { margin-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.stat.primary .stat-ico { background: var(--primary-soft); color: var(--primary); }
.stat.primary::after { background: linear-gradient(90deg, #93c5fd, #2563eb); }
.stat.ok .stat-ico { background: var(--ok-soft); color: var(--ok); }
.stat.ok::after { background: linear-gradient(90deg, #6ee7b7, #10b981); }
.stat.warn .stat-ico { background: var(--warn-soft); color: var(--warn); }
.stat.warn::after { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.stat.danger .stat-ico { background: var(--danger-soft); color: var(--danger); }
.stat.danger::after { background: linear-gradient(90deg, #fca5a5, #ef4444); }
.stat.info .stat-ico { background: #e8f3ff; color: #0b7fd4; }
.stat.info::after { background: linear-gradient(90deg, #7dd3fc, #0ea5e9); }
.stat.violet .stat-ico { background: var(--violet-soft); color: var(--violet); }
.stat.violet::after { background: linear-gradient(90deg, #c4b5fd, #8b5cf6); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  transition: background .15s, border-color .15s;
}
.mini-item:hover { background: #f4f8ff; border-color: #d3e2ff; }
.mini-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.mini-device { color: var(--text-2); font-size: 12px; }
.mini-msg { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-time { margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.mini-list > .muted { padding: 4px 2px; }
.type-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-d);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
}

/* ---------------- 工具栏 ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.search-box { position: relative; }
.search-box .input { width: 300px; padding-left: 34px; }
.search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #9aa7ba;
  pointer-events: none;
}

/* ---------------- 表格 ---------------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  color: var(--text-2);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fbff; }
.cell-main { color: var(--text); font-size: 12.5px; font-weight: 600; }
.cell-sub { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.cell-nowrap { white-space: nowrap; }
.num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pill + .pill { margin-left: 6px; }
/* 启用 / 停用滑动开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.cell-clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 7px;
  background: #f1f5f9;
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
}
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; flex: none; }
.pill.on { background: var(--ok-soft); color: #0b7d57; }
.pill.off { background: #f1f5f9; color: #64748b; }
.pill.queued { background: var(--warn-soft); color: #a56900; }
.pill.sent { background: var(--primary-soft); color: var(--primary-d); }
.pill.success { background: var(--ok-soft); color: #0b7d57; }
.pill.failed { background: var(--danger-soft); color: #b93030; }
.pill.unsupported { background: var(--violet-soft); color: #6d4bc7; }
.pill.active { background: var(--primary-soft); color: var(--primary-d); }
.pill.once { background: var(--warn-soft); color: #a56900; }
.pill.enabled { background: var(--ok-soft); color: #0b7d57; }
.pill.disabled { background: #f1f5f9; color: #64748b; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 48px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: #fff;
  text-align: center;
}
.empty-ico {
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #94a3b8;
}
.empty-ico svg { width: 22px; height: 22px; }
.empty b { color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.empty small { color: var(--muted); font-size: 12px; }

/* ---------------- 指令下发 / 版本分栏 ---------------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.side-stack { position: sticky; top: 4px; display: flex; flex-direction: column; gap: 18px; }
.type-desc {
  margin: 2px 0 15px;
  padding: 9px 12px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.cmd-fields { margin-bottom: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.cmd-fields > .field:last-child { margin-bottom: 0; }
.preview-panel .code-preview { min-height: 170px; }
.actions-col { margin-top: 16px; }
.actions-col .btn { height: 38px; }
.tip-panel { background: linear-gradient(180deg, #f8fbff, #fff); }
.tip-panel h3 { margin: 0 0 8px; font-size: 13px; }
.tip-panel ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

.code-preview {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .04);
  border-radius: 10px;
  background: #0f172a;
  color: #c7d6f5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.img-meta { margin-top: 6px; color: var(--muted); font-size: 12px; }
.img-meta.over { color: var(--danger); font-weight: 600; }
.img-thumb { max-width: 132px; max-height: 132px; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; }

.form-sec { padding: 18px 0; border-top: 1px solid var(--border); }
.form-sec:first-child { padding-top: 0; border-top: none; }
.form-sec-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.form-sec-head::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }
.form-sec-head h3 { margin: 0; font-size: 13.5px; }
.rule-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.rule-list b { color: var(--text-2); }
.sim-result {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ---------------- 弹窗 / Toast ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  animation: fadeIn .16s ease;
}
.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 40px 90px -24px rgba(15, 23, 42, .6);
  animation: pop .18s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.modal-actions .btn.danger { margin-right: auto; }
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.detail-code { color: var(--text); font-size: 14px; font-weight: 600; word-break: break-all; }
.detail-sub { margin-top: 4px; color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 9px 16px; font-size: 13px; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.kv .v { color: var(--text-2); word-break: break-all; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(80vw, 520px);
  padding: 11px 18px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 20px 45px -14px rgba(15, 23, 42, .65);
  transform: translateX(-50%);
  animation: toastIn .2s ease;
}
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none; }
.toast.ok::before { background: #34d399; }
.toast.err::before { background: #f87171; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .side-stack { position: static; }
}
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .sidebar { width: 76px; padding: 16px 10px; }
  .side-brand { justify-content: center; padding: 2px 0 16px; }
  .side-brand-text, .nav-group-t, .nav-label, .side-status-text { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .side-status { justify-content: center; padding: 10px 0; }
  .side-nav { gap: 8px; }
}
@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: 262px;
    padding: 18px 14px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 30px 0 70px rgba(15, 23, 42, .4);
  }
  .app.nav-open .sidebar { transform: none; }
  .side-brand { justify-content: flex-start; padding: 4px 8px 20px; }
  .side-brand-text, .side-status-text { display: block; }
  .nav-group-t { display: block; }
  .nav-label { display: inline; }
  .nav-item { justify-content: flex-start; padding: 10px 12px; }
  .side-status { justify-content: flex-start; padding: 10px 12px; }
  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
  }
  .icon-btn { display: inline-flex; }
  .topbar { height: 58px; padding: 0 16px; }
  .crumb > span, .crumb i { display: none; }
  .content { padding: 20px 16px 34px; }
  .user-meta { display: none; }
  .user-chip { padding-left: 12px; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px; gap: 10px; }
  .stat-ico { width: 36px; height: 36px; border-radius: 10px; }
  .stat-ico svg { width: 17px; height: 17px; }
  .stat-body .num { font-size: 21px; }
  .stat-body .lbl { font-size: 11.5px; }
  .form-grid, .grid-2 { grid-template-columns: 1fr; }
  .grid-2 .span2, .span2 { grid-column: span 1; }
  .search-box, .search-box .input { width: 100%; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-right { justify-content: flex-end; }
  .page-head h2 { font-size: 19px; }
  .panel { padding: 16px; }
  .login-shell { grid-template-columns: 1fr; max-width: 430px; }
  .login-brand { display: none; }
  .login-card { padding: 38px 26px; }
  .login-logo { display: grid; width: 42px; height: 42px; margin-bottom: 16px; font-size: 13px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-card { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .kv { grid-template-columns: 108px 1fr; }
  .detail-head { flex-direction: column; }
  .actions .btn:not(.link), .actions-col .btn { flex: 1; }
}
