/* ============================================================
   Darksword Console — 阿里云控制台风格（Fusion Design 对齐）
   主色 #FF6A00 / 背景 #F5F7FA / 卡片白 4px 圆角 / 全宽布局
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 品牌与语义色（对齐阿里云 Fusion） */
  --brand: #FF6A00;
  --brand-hover: #FF8533;
  --brand-active: #E55F00;
  --brand-bg: #FFF3E8;
  --brand-border: #FFD8BF;

  --link: #0064C8;

  --success: #00A854;
  --success-bg: #E8F8F0;
  --success-border: #B7E9CE;

  --warning: #E9A100;
  --warning-bg: #FFF7E8;
  --warning-border: #FFE0A3;

  --danger: #F04134;
  --danger-bg: #FFEFED;
  --danger-border: #FFC9C4;

  --info: #0064C8;
  --info-bg: #E8F2FF;
  --info-border: #BFD9F7;

  /* 背景层次 */
  --bg-page: #F5F7FA;
  --bg-card: #FFFFFF;
  --bg-subtle: #FAFBFC;
  --bg-hover: #F5F9FF;
  --bg-active: #FFF3E8;
  --bg-fill: #F2F4F7;

  /* 边框 */
  --border: #E8EBF0;
  --border-strong: #D9DEE7;
  --border-focus: #FFB380;

  /* 文字 */
  --text-1: #1A1A1A;
  --text-2: #5C6675;
  --text-3: #8A94A6;
  --text-4: #B3BAC7;
  --text-inv: #FFFFFF;

  /* 间距 */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  /* 圆角（阿里云偏方正） */
  --r-sm: 2px; --r-md: 4px; --r-lg: 6px; --r-xl: 8px; --r-full: 999px;

  /* 字号 */
  --f-xs: 12px; --f-sm: 12px; --f-md: 13px; --f-lg: 14px;
  --f-xl: 16px; --f-2xl: 20px; --f-3xl: 28px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .03);
  --sh-2: 0 2px 8px rgba(0, 0, 0, .08);
  --sh-3: 0 4px 16px rgba(0, 0, 0, .12);
  --sh-4: 0 8px 32px rgba(0, 0, 0, .16);

  /* 动效 */
  --e-out: cubic-bezier(.22, .61, .36, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 240ms;

  --sidebar-w: 208px;
  --sidebar-w-min: 56px;
  --topbar-h: 52px;

  --font: "Alibaba PuHuiTi 2.0", "Alibaba PuHuiTi", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* 深色主题（保留，但默认浅色） */
:root[data-theme="dark"] {
  --bg-page: #12161F;
  --bg-card: #1A1F2B;
  --bg-subtle: #202634;
  --bg-hover: #232B3B;
  --bg-active: #2A2018;
  --bg-fill: #232B3B;

  --border: #2A3242;
  --border-strong: #3A4457;
  --border-focus: #FF8533;

  --text-1: #E9EDF5;
  --text-2: #A5AFC2;
  --text-3: #74809A;
  --text-4: #57617A;
  --text-inv: #12161F;

  --brand-bg: #34220F;
  --brand-border: #5C3A18;
  --success-bg: #11301F;
  --success-border: #1D5433;
  --warning-bg: #332708;
  --warning-border: #5C4610;
  --danger-bg: #351816;
  --danger-border: #5C2420;
  --info-bg: #12243A;
  --info-border: #1C3D5C;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .3);
  --sh-2: 0 2px 8px rgba(0, 0, 0, .4);
  --sh-3: 0 4px 16px rgba(0, 0, 0, .5);
  --sh-4: 0 8px 32px rgba(0, 0, 0, .6);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--f-md);
  line-height: 1.5715;
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
h1, h2, h3, h4, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--brand); }
::selection { background: var(--brand-bg); color: var(--brand-active); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 布局：全宽，无居中留白 ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  transition: grid-template-columns var(--t-base) var(--e-out);
}
.app.collapsed { grid-template-columns: var(--sidebar-w-min) 1fr; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: var(--s2);
  height: var(--topbar-h); padding: 0 var(--s4);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto; cursor: pointer;
}
.brand-mark {
  width: 24px; height: 24px; flex: 0 0 auto; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font-weight: 700; font-size: 13px;
}
.brand-name {
  font-size: var(--f-lg); font-weight: 600; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; color: var(--text-1);
}
.brand-name em { color: var(--brand); font-style: normal; }
.app.collapsed .brand-name { display: none; }

.nav { flex: 1 1 auto; overflow-y: auto; padding: var(--s2) 0 var(--s6); }
.nav-group { margin-bottom: var(--s2); }
.nav-label {
  padding: var(--s3) var(--s4) 6px;
  font-size: var(--f-xs); font-weight: 400; letter-spacing: 0;
  color: var(--text-3);
  white-space: nowrap; overflow: hidden;
}
.app.collapsed .nav-label { display: none; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--s2);
  height: 38px; padding: 0 var(--s4); margin: 1px 0;
  color: var(--text-2); cursor: pointer; user-select: none;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--brand); }
.nav-item.active {
  background: var(--bg-active);
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 500;
}
.nav-icon { flex: 0 0 16px; width: 16px; height: 16px; display: grid; place-items: center; }
.nav-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  flex: 0 0 auto; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  font-size: 11px; border-radius: var(--r-full);
  background: var(--bg-fill); color: var(--text-2);
}
.app.collapsed .nav-text, .app.collapsed .nav-badge { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 0; border-left-width: 3px; }

.sidebar-foot {
  flex: 0 0 auto; padding: var(--s2) var(--s2) var(--s3);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.who {
  display: flex; align-items: center; gap: var(--s2);
  padding: 6px var(--s2); border-radius: var(--r-md);
  cursor: pointer; transition: background var(--t-fast);
  min-width: 0;
}
.who:hover { background: var(--bg-hover); }
.avatar {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--bg-fill); color: var(--text-2);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.who-meta { min-width: 0; }
.who-name { font-size: var(--f-md); color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 11px; color: var(--text-3); }
.app.collapsed .who-meta { display: none; }
.app.collapsed .who { justify-content: center; }

/* ---------- 主区域 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-page); }

.topbar {
  flex: 0 0 auto; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.icon-btn {
  flex: 0 0 auto; width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--brand); }
.icon-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--f-md); }
.crumbs .sep { color: var(--text-4); }
.crumbs .cur { color: var(--text-1); font-weight: 500; }
.crumbs .dim { color: var(--text-3); }

.topbar-spacer { flex: 1 1 auto; }

.search-trigger {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 var(--s3);
  min-width: 220px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-subtle); color: var(--text-3);
  cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
  font-size: var(--f-md);
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--bg-card); }
.kbd {
  font-family: var(--mono); font-size: 11px; line-height: 1;
  padding: 2px 5px; border-radius: var(--r-sm);
  background: var(--bg-fill); border: 1px solid var(--border); color: var(--text-3);
}

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 8px; border-radius: var(--r-md);
  font-size: 12px; background: var(--bg-subtle); color: var(--text-2);
  border: 1px solid var(--border);
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.status-pill.down .dot { background: var(--danger); }

/* 内容区：全宽 + 适度内边距，不留居中空白 */
.content {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: var(--s4) var(--s5) var(--s7);
}
.page { width: 100%; animation: pageIn var(--t-slow) var(--e-out) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 页头 ---------- */
.page-head {
  display: flex; align-items: flex-end; gap: var(--s4);
  margin-bottom: var(--s4); flex-wrap: wrap;
}
.page-title { font-size: var(--f-2xl); font-weight: 600; color: var(--text-1); letter-spacing: 0; }
.page-sub { color: var(--text-3); font-size: var(--f-md); margin-top: 4px; }
.page-actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; padding: 0 var(--s4);
  border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--bg-card); color: var(--text-1);
  font-size: var(--f-md); cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.btn[disabled] { opacity: .5; pointer-events: none; cursor: not-allowed; }

.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-primary:active { background: var(--brand-active); border-color: var(--brand-active); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; color: var(--brand); }

.btn-danger { background: var(--bg-card); border-color: var(--danger-border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

.btn-sm { height: 26px; padding: 0 var(--s2); font-size: 12px; gap: 3px; }
.btn-lg { height: 36px; padding: 0 var(--s5); font-size: var(--f-lg); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.card-title { font-size: var(--f-lg); font-weight: 600; color: var(--text-1); }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: var(--s4); }
.card-body.flush { padding: 0; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: var(--s4);
}
.kpi {
  position: relative; padding: var(--s4);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.kpi:hover { border-color: var(--brand-border); box-shadow: var(--sh-2); }
.kpi-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.kpi-value {
  margin-top: 6px; font-size: var(--f-3xl); font-weight: 600;
  color: var(--text-1); line-height: 1.2; font-variant-numeric: tabular-nums;
}

/* ---------- 工具条 / 筛选 ---------- */
.toolbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--bg-card);
}
.field {
  display: flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 var(--s2);
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-bg); }
.field input, .field select {
  border: 0; background: transparent; outline: 0;
  font-size: var(--f-md); min-width: 0; color: var(--text-1);
}
.field input::placeholder { color: var(--text-4); }
.field select { cursor: pointer; }
.field-search { min-width: 240px; }
.field-search input { width: 100%; }

.seg {
  display: inline-flex; gap: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg-card);
}
.seg button {
  height: 28px; padding: 0 12px;
  border: 0; border-right: 1px solid var(--border);
  background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--brand); background: var(--bg-hover); }
.seg button.on { background: var(--brand); color: #fff; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--f-md); }
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 10px var(--s4);
  text-align: left; font-size: 12px; font-weight: 500;
  color: var(--text-2); white-space: nowrap;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.tbl thead th.sortable { cursor: pointer; user-select: none; }
.tbl thead th.sortable:hover { color: var(--brand); }
.tbl tbody td {
  padding: 11px var(--s4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.selected { background: var(--brand-bg); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }

/* 复选框 */
.cbx {
  appearance: none; width: 14px; height: 14px; margin: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-card); cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.cbx:hover { border-color: var(--brand); }
.cbx:checked { background: var(--brand); border-color: var(--brand); }
.cbx:checked::after {
  content: ""; width: 7px; height: 4px;
  border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* ---------- 状态徽章 / 圆点 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: var(--r-sm);
  font-size: 12px; white-space: nowrap;
  background: var(--bg-fill); color: var(--text-2);
  border: 1px solid transparent;
}
.badge.ok { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge.warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge.accent { background: var(--brand-bg); color: var(--brand); border-color: var(--brand-border); }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* 状态单元格（圆点 + 文字） */
.state-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex: 0 0 auto; }
.state-dot.ok { background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.state-dot.danger { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-bg); }
.state-dot.accent { background: var(--brand); box-shadow: 0 0 0 2px var(--brand-bg); }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
  background: var(--bg-card);
}
.pager .spacer { flex: 1 1 auto; }
.pager button {
  min-width: 26px; height: 26px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-card); color: var(--text-2); cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.pager button:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); }
.pager button[disabled] { opacity: .45; pointer-events: none; }
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 骨架屏 ---------- */
.sk { background: var(--bg-fill); border-radius: var(--r-sm); position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sk-line { height: 10px; margin: 6px 0; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }

/* ---------- 空状态 ---------- */
.empty {
  display: grid; place-items: center; gap: var(--s2);
  padding: var(--s9) var(--s4); text-align: center;
}
.empty-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--bg-fill); color: var(--text-4);
}
.empty-title { font-size: var(--f-lg); color: var(--text-2); }
.empty-text { font-size: var(--f-md); color: var(--text-3); max-width: 420px; line-height: 1.6; }

/* ---------- 抽屉 ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--e-out);
}
.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(600px, 94vw);
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--sh-4);
  transform: translateX(100%);
  transition: transform var(--t-slow) var(--e-out);
  will-change: transform;
}
.drawer.open { transform: none; }
.drawer-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.drawer-title { font-size: var(--f-xl); font-weight: 600; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: var(--s5); }
.drawer-foot {
  flex: 0 0 auto; display: flex; gap: var(--s2); justify-content: flex-end;
  padding: var(--s3) var(--s5); border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

/* ---------- 命令面板 ---------- */
.palette-wrap {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: start center;
  padding-top: 12vh;
  background: rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--e-out);
}
.palette-wrap.open { opacity: 1; pointer-events: auto; }
.palette {
  width: min(560px, 92vw);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-4);
  overflow: hidden;
  transform: translateY(-6px);
  transition: transform var(--t-base) var(--e-out);
}
.palette-wrap.open .palette { transform: none; }
.palette-input {
  width: 100%; height: 44px; padding: 0 var(--s5);
  border: 0; border-bottom: 1px solid var(--border);
  background: transparent; outline: 0;
  font-size: var(--f-lg);
}
.palette-input::placeholder { color: var(--text-4); }
.palette-list { max-height: 46vh; overflow-y: auto; padding: var(--s2); }
.palette-item {
  display: flex; align-items: center; gap: var(--s2);
  padding: 8px var(--s3); border-radius: var(--r-md);
  cursor: pointer; color: var(--text-2); font-size: var(--f-md);
}
.palette-item:hover, .palette-item.on { background: var(--bg-active); color: var(--brand); }
.palette-item .hint { margin-left: auto; font-size: 11px; color: var(--text-4); font-family: var(--mono); }
.palette-empty { padding: var(--s6); text-align: center; color: var(--text-3); }

/* ---------- Toast ---------- */
.toasts {
  position: fixed; right: var(--s5); top: var(--s5); z-index: 90;
  display: flex; flex-direction: column; gap: var(--s2);
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s2);
  min-width: 240px; max-width: 400px;
  padding: 10px var(--s4);
  background: var(--bg-card); color: var(--text-1);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  pointer-events: auto;
  animation: toastIn var(--t-base) var(--e-out) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut var(--t-fast) both; }
@keyframes toastOut { to { opacity: 0; transform: translateX(12px); } }
.toast-bar { flex: 0 0 3px; align-self: stretch; border-radius: 2px; background: var(--brand); }
.toast.ok .toast-bar { background: var(--success); }
.toast.err .toast-bar { background: var(--danger); }
.toast.warn .toast-bar { background: var(--warning); }
.toast-msg { flex: 1 1 auto; font-size: var(--f-md); line-height: 1.6; }
.toast-close { flex: 0 0 auto; color: var(--text-4); cursor: pointer; background: none; border: 0; padding: 0 2px; }
.toast-close:hover { color: var(--text-2); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; gap: var(--s4); }
.form-row { display: grid; gap: 6px; }
.form-label { font-size: 12px; color: var(--text-2); }
.form-hint { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 var(--s3);
  background: var(--bg-card); color: var(--text-1);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  outline: 0; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea {
  height: auto; min-height: 84px; padding: 6px var(--s3); resize: vertical;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--brand); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-bg);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.select optgroup { font-weight: 600; color: var(--text-3); background: var(--bg-card); }
.select option { font-weight: 400; color: var(--text-1); background: var(--bg-card); padding: 4px; }

/* ---------- 详情列表 ---------- */
.dl { display: grid; grid-template-columns: 120px 1fr; gap: var(--s2) var(--s4); align-items: start; }
.dl dt { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.dl dd { margin: 0; font-size: var(--f-md); color: var(--text-1); word-break: break-word; line-height: 1.6; }
.dl dd.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- 分隔 / 段落 ---------- */
.hr { height: 1px; background: var(--border); margin: var(--s4) 0; border: 0; }
.section-title {
  font-size: 12px; font-weight: 500; color: var(--text-3);
  margin: var(--s4) 0 var(--s2);
}
.stack { display: grid; gap: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }

/* ---------- 页签 ---------- */
.tabs {
  display: flex; gap: 0; padding: 0 var(--s2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; background: var(--bg-card);
}
.tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  height: 40px; padding: 0 var(--s3);
  border: 0; background: transparent; color: var(--text-2);
  font-size: var(--f-md); cursor: pointer; white-space: nowrap;
  transition: color var(--t-fast);
}
.tab:hover { color: var(--brand); }
.tab.on { color: var(--brand); font-weight: 500; }
.tab.on::after {
  content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: -1px;
  height: 2px; background: var(--brand); border-radius: 1px;
}
.tab-n {
  min-width: 17px; height: 16px; padding: 0 4px;
  display: inline-grid; place-items: center;
  font-size: 11px; border-radius: var(--r-full);
  background: var(--bg-fill); color: var(--text-3);
}
.tab.on .tab-n { background: var(--brand-bg); color: var(--brand); }

/* ---------- chip ---------- */
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--bg-fill); border: 1px solid var(--border);
  color: var(--text-2); font-size: 12px; font-family: var(--mono);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 提示条 ---------- */
.notice {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px var(--s4); margin-bottom: var(--s4);
  border-radius: var(--r-md);
  font-size: var(--f-md); line-height: 1.6;
  border: 1px solid var(--info-border);
  background: var(--info-bg); color: var(--text-1);
}
.notice.warn { background: var(--warning-bg); border-color: var(--warning-border); }
.notice svg { flex: 0 0 auto; margin-top: 2px; color: var(--info); }
.notice.warn svg { color: var(--warning); }

/* ---------- 设备详情头部 ---------- */
.dev-head {
  display: flex; align-items: center; gap: var(--s3);
  margin-bottom: var(--s4); flex-wrap: wrap;
}

/* ---------- 实时状态 ---------- */
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  display: inline-block;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* ---------- 命令说明面板 ---------- */
.cmd-desc {
  padding: 10px var(--s3);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  min-height: 44px;
}

/* ---------- 登录 ---------- */
.auth-shell {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 460px at 50% -10%, var(--brand-bg), transparent 62%),
    var(--bg-page);
}
.auth {
  width: min(380px, 92vw);
  padding: var(--s7);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  animation: pageIn var(--t-slow) var(--e-out) both;
}
.auth-brand { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s6); }
.auth-title { font-size: var(--f-xl); font-weight: 600; }
.auth-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.auth .form-grid { gap: var(--s4); }
.auth-err {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 8px var(--s3); border-radius: var(--r-md);
  background: var(--danger-bg); color: var(--danger);
  font-size: 12px; line-height: 1.6;
  border: 1px solid var(--danger-border);
  word-break: break-word;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .content { padding: var(--s3) var(--s4) var(--s6); }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: var(--sidebar-w-min) 1fr; }
  .app .brand-name, .app .nav-text, .app .nav-badge,
  .app .who-meta, .app .nav-label { display: none; }
  .app .nav-item { justify-content: center; padding: 0; }
  .app .who { justify-content: center; }
}
@media (max-width: 720px) {
  .content { padding: var(--s3); }
  .page-title { font-size: var(--f-xl); }
  .search-trigger { display: none; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dt { margin-top: 6px; }
  .drawer { width: 100vw; }
  .tbl thead th, .tbl tbody td { padding: 9px var(--s3); }
}

/* LIVE-STAMP: 详情页实时刷新指示 */
.live-stamp{position:absolute;right:12px;top:50%;transform:translateY(-50%);
  font-size:11px;color:var(--tx-3);letter-spacing:.2px;
  display:inline-flex;align-items:center;gap:5px}
.live-stamp::before{content:"";width:6px;height:6px;border-radius:50%;
  background:#22c55e;box-shadow:0 0 0 0 rgba(34,197,94,.6);
  animation:livePulse 1.8s ease-out infinite}
@keyframes livePulse{
  0%{box-shadow:0 0 0 0 rgba(34,197,94,.55)}
  70%{box-shadow:0 0 0 7px rgba(34,197,94,0)}
  100%{box-shadow:0 0 0 0 rgba(34,197,94,0)}
}
.tabs{position:relative}
