/* HuaDesk Ops shell — 叠在 Polar theme.css 之上 */
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.err { color: var(--danger); min-height: 1.2em; }
.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-1);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}
.btn:hover { background: var(--surface-3); }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(217,71,84,.35); }
.btn.sm { padding: 3px 8px; font-size: 12px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--border-highlight), var(--shadow-1);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-hd h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card.fill { flex: 1; }
.pre {
  margin: 0;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
}
.pre.small { max-height: 160px; font-size: 11px; }

/* —— 登录页（对齐 tun 双栏） —— */
.login-wrap {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100%;
  position: relative;
  z-index: 1;
}
.login-aside {
  position: relative;
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(600px 400px at 20% 20%, rgba(8, 127, 136, .14), transparent 70%),
    linear-gradient(160deg, var(--surface-1), var(--surface-2));
  border-right: 1px solid var(--border);
}
.aside-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  background: transparent;
  box-shadow: 0 10px 24px -16px rgba(15, 23, 42, .45);
}
.aside-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-name { font-size: 17px; font-weight: 660; letter-spacing: -.02em; }
.aside-copy { max-width: 400px; }
.lead {
  font-size: 26px;
  line-height: 1.32;
  font-weight: 640;
  letter-spacing: -.03em;
  margin: 12px 0 24px;
  color: var(--text-1);
}
.feat {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text-2);
  font-size: 14px;
}
.feat li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.45; }
.feat .dot { margin-top: 5px; flex-shrink: 0; }
.aside-foot { font-size: 12px; color: var(--text-3); }
.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 30px;
  gap: 12px;
}
.login-card h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -.03em;
}
.login-sub { margin: 0 0 4px; font-size: 13px; }
.login-card > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.login-card input[type="text"],
.login-card input[type="password"],
.login-card input:not([type]),
.dlg-form input,
.dlg-form select {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text-1);
  min-height: 40px;
}
.login-card input:focus,
.dlg-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.remember-row { margin-top: 2px; }
.remember {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-size: 13px !important;
  color: var(--text-2);
  cursor: pointer;
}
.remember input { width: auto; min-height: auto; accent-color: var(--accent); }
.btn-block { width: 100%; min-height: 40px; margin-top: 4px; }
.btn.primary {
  background: linear-gradient(145deg, var(--accent-grad-a), var(--accent-grad-b));
}
.hint-demo {
  margin-top: 8px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: .02em;
}
.dlg-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.dlg-form input, .dlg-form select { width: 100%; }
.gap12 { gap: 12px; }
.t2 { color: var(--text-2); }
.t3 { color: var(--text-3); }

@media (max-width: 900px) {
  .login-aside { display: none; }
  .login-wrap { grid-template-columns: 1fr; }
}

/* —— 应用壳：左栏 + 主区（对齐 tun Shell） —— */
.shell {
  display: flex;
  height: 100%;
  height: 100dvh;
  position: relative;
  z-index: 1;
}
.sidebar {
  width: 216px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: rgba(var(--glass-rgb), .7);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(8px);
  transition: width .28s var(--ease-premium);
}
.sidebar.collapsed { width: 66px; }
.sidebar.collapsed .side-name,
.sidebar.collapsed .nav-eyebrow,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .health-lb,
.sidebar.collapsed .health-metric,
.sidebar.collapsed .health-foot,
.sidebar.collapsed #health-state { display: none; }
.sidebar.collapsed .health-card { padding: 8px; display: flex; justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar.collapsed .nav-item.active::before { left: 0; }
.sidebar.collapsed .side-brand { padding: 0; justify-content: center; }

.side-brand {
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.side-logo {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: transparent;
}
.side-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-group { margin-bottom: 14px; }
.nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 0 10px 8px; border: 0; background: transparent;
  cursor: pointer; color: inherit; font: inherit; text-align: left;
}
.nav-group-toggle:hover { color: var(--text-1); }
.nav-group-toggle .nav-caret {
  flex: none; color: var(--text-3); transition: transform .18s var(--ease-premium);
}
.nav-group.collapsed .nav-group-toggle .nav-caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-eyebrow { font-size: 10px; }
.sidebar.collapsed .nav-group-toggle .nav-caret { display: none; }
.sidebar.collapsed .nav-group.collapsed .nav-group-items { display: block; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  height: 40px; padding: 0 11px; border-radius: 9px; border: 0;
  background: transparent; color: var(--text-2); font: inherit; font-weight: 520;
  cursor: pointer; position: relative; transition: background .16s, color .16s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.nav-item.nav-item-muted { opacity: 0.78; font-weight: 480; }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-ico { display: flex; flex: none; }
.nav-text { white-space: nowrap; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-family: var(--mono); font-size: 11px; display: flex; align-items: center; justify-content: center;
  color: #7a5200; background: rgba(251,191,36,.28);
}
.nav-badge:not(.hidden) {
  animation: badge-pulse 2.4s var(--ease-premium) infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .35); }
  50% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0); }
}
.side-foot {
  padding: 10px 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.health-card {
  padding: 12px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(var(--glass-rgb), .5);
}
.health-title { display: flex; align-items: center; gap: 7px; }
.health-title b { font-size: 12px; font-weight: 580; }
.health-title .mono { margin-left: auto; color: var(--st-online); font-size: 10px; }
.health-title .mono.off { color: var(--st-offline); }
.live-i {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: var(--st-online); position: relative;
}
.live-i::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit;
  animation: side-beat 1.9s var(--ease-premium) infinite;
}
.live-i.off { background: var(--st-offline); }
.live-i.off::after { animation: none; }
@keyframes side-beat { to { transform: scale(2.6); opacity: 0; } }
.health-metric { margin-top: 10px; }
.health-metric .line {
  display: flex; justify-content: space-between; color: var(--text-2); font-size: 11px;
}
.health-metric .line b { color: var(--text-1); font-size: 11px; }
.meter { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 2px; background: var(--surface-3); }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s var(--ease-premium); }
.health-foot {
  display: flex; justify-content: space-between; margin-top: 10px;
  color: var(--text-3); font-family: var(--mono); font-size: 10px;
}
.collapse-btn {
  width: 100%; height: 34px; border: 1px solid var(--border); background: transparent;
  border-radius: 8px; color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .16s;
}
.collapse-btn:hover { background: var(--surface-2); color: var(--text-1); }

.nav-mask {
  position: fixed; inset: 0; z-index: 18;
  background: rgba(25, 45, 55, .24); backdrop-filter: blur(1px);
}
.sidebar.mobile {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 20;
  transform: translateX(-100%);
  transition: transform .28s var(--ease-premium);
  box-shadow: var(--shadow-2);
}
.sidebar.mobile.open { transform: translateX(0); }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--glass-rgb), .6);
  backdrop-filter: blur(8px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-icon-btn {
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.topbar-icon-btn:hover { color: var(--text-1); border-color: var(--border-strong); }
.nav-toggle { display: none; }
.crumb-root { font-size: 13px; color: var(--text-3); }
.crumb-sep { color: var(--text-3); font-size: 13px; }
.crumb-cur { font-size: 15px; font-weight: 620; letter-spacing: -.02em; }
.user-chip {
  cursor: default; padding: 5px 10px 5px 6px; border-radius: 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 640; color: #fff;
  background: linear-gradient(145deg, var(--accent-grad-a), var(--accent-grad-b));
}

.content {
  flex: 1; min-height: 0; overflow: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.tab-pane { display: flex; flex-direction: column; gap: 16px; min-height: 0; flex: 1; }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  padding: 14px 16px;
}
.kpi .label { color: var(--text-2); font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 600; margin-top: 4px; }
.kpi .value.mono { font-size: 18px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.dot.up { background: var(--st-online); }
.dot.down { background: var(--st-alarm); }
.dot.unknown { background: var(--st-offline); }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 0;
}
.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
th {
  position: sticky; top: 0;
  background: var(--surface-2);
  z-index: 1;
  color: var(--text-2);
  font-weight: 500;
}
td.mono { font-size: 12px; }
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: var(--surface-3);
}
.badge.ok { background: rgba(52,211,153,.15); color: #067a4f; }
.badge.warn { background: rgba(251,191,36,.18); color: #8a6500; }
.badge.off { background: rgba(107,114,128,.15); color: var(--text-2); }
tr.row-locked td { color: var(--text-3); background: rgba(107, 114, 128, .06); }
tr.row-locked .muted { color: var(--text-3); }
.ops-locked { font-size: 12px; user-select: none; pointer-events: none; }
.ops-cell { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-title { margin: 0; font-size: 18px; font-weight: 620; letter-spacing: -.02em; }
.page-hint { margin: 6px 0 0; font-size: 13px; max-width: 560px; line-height: 1.45; }
.filter-input, .filter-select {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 10px; padding: 8px 12px; font: inherit; color: var(--text-1);
  min-height: 36px;
}
.filter-input { width: min(240px, 100%); }
.filter-select { min-width: 120px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }

.badge.ty-shared { background: rgba(8,127,136,.12); color: var(--accent); }
.badge.ty-once { background: rgba(96,165,250,.15); color: #2563eb; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-lb { font-size: 12px; color: var(--text-2); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer;
}
.seg-btn.active {
  background: var(--accent-dim); color: var(--accent);
  border-color: rgba(var(--accent-rgb), .35); font-weight: 600;
}
.cmd-block { max-height: none; background: #0A0C10; color: #E8EEF2; }
/* 安装命令：强制换行，避免横向滚动把 curl / --role 裁掉 */
.cmd-box {
  width: 100%;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.45;
  min-height: 4.5em;
}

.statusbar {
  height: 28px; flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  border-top: 1px solid var(--border);
  background: rgba(var(--glass-rgb), .82);
  backdrop-filter: blur(8px);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.status-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-item b { color: var(--text-1); font-weight: 600; }
.status-item.off { color: var(--st-offline); }
.spacer { flex: 1; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--st-online); position: relative;
}
.live-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit;
  animation: side-beat 1.9s var(--ease-premium) infinite;
}
.live-dot.off { background: var(--st-offline); }
.live-dot.off::after { animation: none; }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .sidebar:not(.mobile) { display: none; }
  .sidebar.mobile { display: flex; }
  .user-meta { display: none; }
  .content { padding: 12px; }
  .topbar { padding: 0 12px; }
}

dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  background: var(--surface-1);
  color: var(--text-1);
  box-shadow: var(--shadow-pop);
  max-width: 560px;
  width: calc(100% - 32px);
}
dialog.dlg-groups {
  max-width: 540px;
  width: min(540px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-1);
  color: var(--text-1);
  box-shadow: var(--shadow-pop);
}
.dlg-groups-inner { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 4px; }
.dlg-groups-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 4px;
}
.dlg-groups-hd h3 { margin: 0; font-size: 16px; font-weight: 650; }
.dlg-groups-hint { margin: 0 0 8px; font-size: 12px; line-height: 1.45; }
.dlg-groups-ft {
  display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.dlg-x {
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.dlg-x:hover { background: var(--surface-2); color: var(--text-1); }
.btn.plain.danger,
.btn.danger.plain {
  background: transparent;
  border: 1px solid rgba(217,71,84,.35);
  color: var(--danger);
}
.btn.plain.danger:hover,
.btn.danger.plain:hover { background: rgba(217,71,84,.08); }
.color-swatch {
  position: relative; width: 28px; height: 28px; flex: none;
  border-radius: 6px; cursor: pointer; display: inline-flex;
  border: 1px solid var(--border-strong);
  overflow: hidden; background: var(--surface-2);
}
.color-swatch input[type="color"] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%;
  cursor: pointer; border: 0; padding: 0;
}
.color-swatch-face {
  display: block; width: 100%; height: 100%; pointer-events: none;
  border-radius: 5px;
}
.icon-btn {
  border: 0; background: transparent; color: var(--text-3);
  padding: 4px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-1); }
dialog::backdrop { background: rgba(16,35,45,.35); }
.dlg-form { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.dlg-form h3 { margin: 0; }
.dlg-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-hd h3 { margin: 0; flex: 1; min-width: 0; }
.dlg-confirm-msg { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.chk-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; max-height: 180px; overflow: auto; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-1); }
.chk input { margin: 0; }
select.input.sm, .input.sm { min-height: 34px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-1); }

/* 设备页：对齐 tun Console 左栏设备树 + 可拖分隔条 + 右栏详情 */
.devices-tab { gap: 0 !important; min-height: 0; flex: 1; }
.devices-console {
  --dev-pane-w: 320px;
  display: grid;
  grid-template-columns: minmax(240px, var(--dev-pane-w)) 6px minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  flex: 1;
}
.split-bar {
  flex: 0 0 auto;
  position: relative;
  background: transparent;
  z-index: 2;
}
.split-bar-x { width: 6px; cursor: col-resize; touch-action: none; }
.split-bar-x::after {
  content: "";
  position: absolute;
  top: 18%; bottom: 18%; left: 2px; width: 2px;
  border-radius: 1px;
  background: var(--border);
  transition: background .16s;
}
.split-bar:hover::after,
body.is-resizing-x .split-bar-x::after { background: var(--accent); }
body.is-resizing { user-select: none; }
body.is-resizing-x { cursor: col-resize !important; }
body.is-resizing-x * { cursor: col-resize !important; }

.dev-pane {
  display: flex; flex-direction: column; overflow: hidden; min-height: 0; min-width: 0;
  padding: 0 !important;
  margin-right: 6px;
}
.detail-pane { margin-left: 6px; }
.dp-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--border); flex: none; }
.dp-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-3);
}
.dp-search .input { border: 0; background: transparent; flex: 1; min-height: 34px; padding-left: 0; }
.dp-search .input:focus { outline: none; box-shadow: none; }
.status-seg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 3px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.status-seg .seg {
  border: 0; background: transparent; color: var(--text-2);
  border-radius: 8px; padding: 6px 4px; font: inherit; font-size: 12px;
  cursor: pointer; font-weight: 520;
}
.status-seg .seg:hover { color: var(--text-1); background: var(--surface-1); }
.status-seg .seg.active {
  background: var(--surface-1); color: var(--text-1); font-weight: 640;
  box-shadow: var(--shadow-1);
}
.seg-lb { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 100%; }
.seg-lb .dot { width: 6px; height: 6px; }
.seg-lb .dot::after { display: none; }
.seg-n {
  font-family: var(--mono); font-size: 10px; font-variant-numeric: tabular-nums; opacity: .6;
}
.seg-zero { opacity: .38; }
.seg-pending { color: var(--st-pending); font-weight: 600; }
.seg-pending .seg-n { opacity: 1; color: var(--st-pending); }

/* 类型筛选：设备端 / 用户端 */
.kind-seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 3px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.kind-seg .seg {
  border: 0; background: transparent; color: var(--text-2);
  border-radius: 8px; padding: 5px 4px; font: inherit; font-size: 11.5px;
  cursor: pointer; font-weight: 520;
}
.kind-seg .seg:hover { color: var(--text-1); background: var(--surface-1); }
.kind-seg .seg.active {
  background: var(--surface-1); color: var(--text-1); font-weight: 640;
  box-shadow: var(--shadow-1);
}
.kind-seg .seg[data-kind="device"].active { color: #4B5563; }
.kind-seg .seg[data-kind="user"].active { color: var(--accent); }
.kind-ico {
  width: 10px; height: 10px; border-radius: 2px; display: inline-block;
  flex: none; position: relative;
}
.kind-ico-device {
  background: rgba(107, 114, 128, .35);
  box-shadow: inset 0 0 0 1px rgba(107, 114, 128, .45);
}
.kind-ico-user {
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(8, 127, 136, .4);
}

.dp-list { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.dp-group { margin-bottom: 6px; }
.dp-group + .dp-group { border-top: 1px solid var(--border); padding-top: 6px; }
.dp-group-title {
  width: 100%; display: flex; align-items: center; gap: 7px; padding: 8px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left;
  font-size: 14px; font-weight: 600; color: var(--text-1);
  transition: background .14s, color .14s;
}
.dp-group-title:hover { background: var(--surface-2); }
.dp-group-title .gname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-group-title .gcount { margin-left: auto; font-size: 12px; }
.gcaret { flex: none; color: var(--text-3); transition: transform .18s ease; }
.dp-group.open .gcaret,
.dp-feed.open .gcaret { transform: rotate(90deg); }
.gdot { width: 8px; height: 8px; border-radius: 3px; flex: none; display: inline-block; }
/* 树形引导线：展开设备挂在竖线下 */
.dp-children { position: relative; margin: 2px 0 2px 15px; border-left: 1px solid var(--border); }
.dp-group-empty { padding: 5px 10px 6px 14px; color: var(--text-3); font-size: 12px; }
.dp-item {
  width: 100%; position: relative; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left;
  transition: background .14s, box-shadow .14s;
  font: inherit; color: inherit;
}
.dp-item:hover { background: var(--surface-2); }
.dp-item.active { background: var(--accent-dim); }
/* 角色色条：设备端灰 / 用户端 accent */
.dp-item::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 2px; background: rgba(107, 114, 128, .45);
}
.dp-item.kind-client::before,
.dp-item.kind-user::before { background: var(--accent); }
.dp-item.active::before { width: 3px; background: var(--accent); }
.dp-item.kind-device.active::before { background: #6B7280; }
.dp-item.is-pending {
  background: rgba(251, 191, 36, .08);
}
.dp-item.is-pending:hover { background: rgba(251, 191, 36, .14); }
.dp-item.is-pending.active { background: rgba(251, 191, 36, .16); }
.dp-item .dot,
.status-seg .dot,
.feed-row .dot,
.card-title .dot { flex: none; margin-right: 0; }
.content:has(#tab-devices:not(.hidden)) { overflow: hidden; padding-bottom: 12px; }
#tab-devices:not(.hidden) { overflow: hidden; height: 100%; }
.content:has(#tab-groups:not(.hidden)) { overflow: hidden; padding-bottom: 12px; }
#tab-groups:not(.hidden) { overflow: hidden; height: 100%; gap: 0; }
.dp-name {
  flex: 1; min-width: 0; font-weight: 560; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-1);
}
.dp-name.name-offline { color: var(--text-3); font-weight: 500; }
.dp-fwd { flex: none; font-size: 12px; color: var(--text-2); }
.dp-pending {
  flex: none; background: rgba(251,191,36,.22); color: #A5720F;
  animation: badge-pulse 2.4s var(--ease-premium) infinite;
}
.dp-kind {
  flex: none; font-size: 10px; padding: 1px 5px;
  letter-spacing: .02em;
}
.dp-kind.kind-device {
  background: rgba(107, 114, 128, .14); color: #4B5563;
}
.dp-kind.kind-client,
.dp-kind.kind-user {
  background: rgba(8, 127, 136, .12); color: var(--accent);
}
.badge.kind-device { background: rgba(107, 114, 128, .14); color: #4B5563; }
.badge.kind-client,
.badge.kind-user { background: rgba(8, 127, 136, .12); color: var(--accent); }

.role-hint {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 12px; line-height: 1.45; color: var(--text-2);
}
.role-hint.kind-client,
.role-hint.kind-user {
  border-color: rgba(8, 127, 136, .22);
  background: var(--accent-dim);
}
.role-hint.kind-device {
  border-color: rgba(107, 114, 128, .2);
}
.role-hint b { color: var(--text-1); font-weight: 600; }

.toast-msg {
  position: fixed; right: 16px; bottom: 40px; z-index: 99;
  padding: 10px 14px; border-radius: 10px; color: #fff; font-size: 13px;
  box-shadow: var(--shadow-2);
  animation: toast-in .22s var(--ease-premium);
}
.toast-msg.ok { background: var(--accent); }
.toast-msg.err { background: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-badge:not(.hidden),
  .dp-pending { animation: none; }
  .toast-msg { animation: none; }
}

.dp-feed { flex: none; border-top: 1px solid var(--border); }
.dp-feed-head {
  width: 100%; display: flex; align-items: center; gap: 7px; padding: 9px 14px; border: 0;
  background: transparent; cursor: pointer; text-align: left;
  font-size: 13px; font-weight: 600; color: var(--text-2); font: inherit;
}
.dp-feed-head:hover { background: var(--surface-2); color: var(--text-1); }
.dp-feed-head .gname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-feed-head .gcount { margin-left: auto; font-size: 12px; color: var(--text-3); }
.dp-feed-list { max-height: 220px; overflow-y: auto; padding: 2px 8px 8px; }
.feed-row {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left; font-size: 12px; font: inherit; color: inherit;
}
.feed-row:hover { background: var(--surface-2); }
.feed-row .dot { flex: none; width: 6px; height: 6px; }
.feed-row .dot::after { display: none; }
.feed-text { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.feed-act { flex: none; color: var(--text-1); }
.feed-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 11px; }
.feed-time { flex: none; font-size: 11px; color: var(--text-3); }

.detail-pane { display: flex; flex-direction: column; overflow-y: auto; min-height: 0; gap: 12px; }
.empty-detail { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 240px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-top: 4px; }
.detail-grid .dl-full { grid-column: 1 / -1; }
.detail-grid.is-offline { opacity: .72; filter: grayscale(.55); }
.dl { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dp-detail-name { font-size: 16px; font-weight: 650; }
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }

.grp-manage-list { display: flex; flex-direction: column; gap: 0; max-height: 360px; overflow: auto; }
.grp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px; border-radius: 8px; border: 1px solid transparent;
}
.grp-row + .grp-row { border-top: 1px solid var(--border); border-radius: 0; }
.grp-row.dragging { opacity: .5; }
.grp-row.over { border: 1px dashed var(--accent); border-radius: 8px; background: var(--accent-dim); }
.grp-row .drag-handle {
  display: flex; align-items: center; color: var(--text-3); cursor: grab;
  padding: 2px; border-radius: 6px; flex: none;
}
.grp-row .drag-handle:hover { color: var(--text-1); background: var(--surface-2); }
.grp-row .drag-handle:active { cursor: grabbing; }
.grp-row .grp-name {
  flex: 1; min-width: 0; font-weight: 540; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grp-row .grp-cnt { width: 88px; text-align: right; font-size: 12px; flex: none; }
.grp-row .grp-edit-input { min-width: 0; }
.grp-add {
  display: flex; align-items: center; gap: 10px;
  padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--border);
}

/* —— 分组设置：左轨右详 —— */
.grp-set-wrap {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grp-set-wrap > .page-head { flex: none; }
.grp-set-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
}
.grp-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}
.grp-rail-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px; flex: none; border-bottom: 1px solid var(--border);
}
.grp-rail-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.grp-rail-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; color: var(--text-1); background: transparent;
  transition: background .14s, border-color .14s;
}
.grp-rail-item:hover { background: var(--surface-2); }
.grp-rail-item.active {
  background: var(--accent-dim);
  border-color: rgba(8, 127, 136, .22);
}
.grp-rail-item.dragging { opacity: .5; }
.grp-rail-item.over { border: 1px dashed var(--accent); background: var(--accent-dim); }
.grp-rail-item .drag-handle {
  display: flex; align-items: center; color: var(--text-3); cursor: grab;
  padding: 2px; border-radius: 6px; flex: none;
}
.grp-rail-item .drag-handle:hover { color: var(--text-1); background: var(--surface-2); }
.grp-rail-item .drag-handle:active { cursor: grabbing; }
.grp-rail-meta {
  min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.grp-rail-name {
  font-size: 13px; font-weight: 580;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grp-rail-stats { font-size: 11px; }

.grp-detail {
  min-height: 0; overflow-y: auto; padding: 0;
  align-self: stretch;
}
.grp-detail-inner {
  max-width: 720px; padding: 18px 20px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.grp-detail-hd {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px;
}
.grp-detail-title { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.grp-detail-form { display: flex; flex-direction: column; gap: 10px; }
.stack-field {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  font-size: 12px; color: var(--text-2); font-weight: 540;
}
.stack-field .input,
.stack-field input.input,
.stack-field input[type="text"],
.stack-field input:not([type="color"]) {
  width: 100%;
}
.form-section-lb {
  margin: 10px 0 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-2); font-weight: 650;
}
.form-section-lb.danger-zone { color: var(--danger); }
.field-hint { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.empty-state {
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--text-3); font-size: 13px;
}
.grp-member-summary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.grp-member-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 64px;
}
.grp-member-stat b { font-size: 16px; font-weight: 650; color: var(--text-1); }

@media (max-width: 960px) {
  .devices-console {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 40vh) 1fr;
    gap: 12px;
  }
  .split-bar-x { display: none; }
  .dev-pane { margin-right: 0; max-height: none; }
  .detail-pane { margin-left: 0; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .grp-set-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .grp-rail {
    max-height: none;
  }
  .grp-rail-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    padding: 8px 10px;
  }
  .grp-rail-item {
    flex: none;
    min-width: 148px;
  }
  .grp-detail-inner { max-width: none; }
}
@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; }
  .status-seg { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .kpi-row, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .kpi-row, .grid-2 { grid-template-columns: 1fr; }
  .crumb-root, .crumb-sep { display: none; }
}

/* 总览接入检查 — 状态条，非装饰卡墙 */
.ov-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 14px;
}
.ov-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  text-align: left;
  max-width: 100%;
}
button.ov-check { cursor: pointer; }
button.ov-check:hover { border-color: var(--accent); }
.ov-check-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--text-3);
}
.ov-check.ok .ov-check-dot { background: #067a4f; }
.ov-check.bad .ov-check-dot { background: #b45309; }
.ov-check.bad { border-color: rgba(180, 83, 9, .35); }
.ov-check-lb { font-weight: 560; white-space: nowrap; }
.ov-check-hint { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.ov-check-card .card-hd { padding-bottom: 0; }

/* —— IA 2026-08：总览统计 / 分段 / 分组授权 —— */
.tabseg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  width: fit-content;
  flex: none;
}
.tabseg button {
  border: 0;
  background: transparent;
  height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.tabseg button.on {
  background: var(--surface-1);
  color: var(--accent);
  font-weight: 560;
  box-shadow: 0 1px 2px rgba(28, 58, 74, 0.08);
}
.kpi-row-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.kpi.is-click { cursor: pointer; }
.kpi.ok .value { color: var(--success, #0d9d72); }
.health-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.health-strip .hcard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-1);
  font: inherit;
  color: inherit;
  text-align: left;
}
.health-strip .hcard.is-click { cursor: pointer; }
.health-strip .ey {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
}
.health-strip .v {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 560;
  margin-top: 4px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
}
.ov-panel-body { padding: 8px 16px 16px; }
.stack-bars {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
  margin: 4px 0 10px;
}
.stack-bars i { display: block; height: 100%; }
.ov-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.ov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bar-list { display: grid; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 40px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.bar-row .lb {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row .n {
  font-family: var(--mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.bar-fill.on { background: var(--st-online, #34d399); }
.bar-fill.pend { background: var(--st-pending, #fbbf24); }
.bar-fill.off { background: var(--st-offline, #6b7280); }
.ov-feed { max-height: 280px; overflow: auto; }
.ov-ev {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  width: 100%;
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}
.ov-ev:last-child { border-bottom: none; }
.ov-todo { cursor: pointer; }
.ov-todo:hover { background: rgba(8, 127, 136, 0.035); }
.ov-ev .t { font-family: var(--mono); color: var(--text-3); }
.ov-ev .b { color: var(--text-1); font-weight: 520; }
.ov-ev .d { color: var(--text-2); margin-top: 2px; word-break: break-all; }
.grp-detail-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 0;
  overflow: auto;
}
.grp-stack-sec {
  flex: 0 0 auto;
  min-width: 0;
  padding: 12px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.grp-stack-sec:last-child {
  border-bottom: none;
  flex: 1 1 auto;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
.grp-stack-lb {
  margin: 0 0 10px;
}
.grp-auth-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  line-height: 1.45;
  padding: 0;
}
.grp-settings-host {
  min-height: 0;
  padding: 0;
}
.grp-settings-host .grp-detail-inner {
  padding: 0;
}
/* 外层已有「设置参数」，内层顶栏略收 */
.grp-settings-host .grp-detail-hd {
  margin-bottom: 8px;
}
.ab-in-group {
  flex: 1;
  min-height: 280px;
}
#health-card { cursor: pointer; }
@media (max-width: 1100px) {
  .kpi-row-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .health-strip { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-row-5 { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
