/* =============================================================================
 * WQ-DSS 控制台 · 布局与组件（app.css）
 * ========================================================================== */

/* hidden 属性必须优先于组件自身的 display 声明（否则 .boot/.shell 的 display:grid 会覆盖它）。 */
[hidden] { display: none !important; }

/* ------------------------------- 首屏骨架 ------------------------------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--wq-bg);
  z-index: 1000;
}
.boot-card { text-align: center; }
.boot-logo { display: grid; place-items: center; margin-bottom: var(--sp-3); }
.boot-title { font-size: var(--fs-xl); font-weight: 600; }
.boot-sub { margin-top: var(--sp-2); color: var(--wq-text-3); font-size: var(--fs-sm); }

/* ------------------------------- 应用外壳 ------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* 侧边栏 */
.sidebar {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-right: 1px solid var(--wq-border);
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--wq-border-2);
  background: var(--wq-primary);
  color: #fff;
}
.brand-mark { display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: var(--fs-lg); letter-spacing: .04em; }
.brand-text small { font-size: var(--fs-xs); opacity: .85; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-2);
}
.nav-group-title {
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  font-size: var(--fs-xs);
  letter-spacing: .08em;
  color: var(--wq-text-3);
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--wq-radius-sm);
  color: var(--wq-text-2);
  font-size: var(--fs-md);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}
.nav-item svg { flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: var(--wq-surface-3); color: var(--wq-text); }
.nav-item.active {
  background: var(--wq-primary-050);
  color: var(--wq-primary-600);
  border-color: var(--wq-primary-100);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--wq-border-2);
  font-size: var(--fs-xs);
  color: var(--wq-text-3);
}
.sidebar-foot .ver { margin-left: auto; }

/* 主区 */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.topbar {
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  background: var(--wq-surface);
  border-bottom: 1px solid var(--wq-border);
  gap: var(--sp-4);
}
.crumbs { font-size: var(--fs-lg); font-weight: 600; color: var(--wq-text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--wq-border);
  background: var(--wq-surface);
  border-radius: var(--wq-radius-sm);
  color: var(--wq-text-2);
}
.icon-btn:hover { background: var(--wq-surface-3); color: var(--wq-text); }
.badge-dot {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--wq-danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
}

.userbox { display: flex; align-items: center; gap: var(--sp-3); }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--wq-primary);
  color: #fff;
  font-weight: 600;
  font-size: var(--fs-md);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta b { font-size: var(--fs-md); }
.user-meta small { color: var(--wq-text-3); font-size: var(--fs-xs); }

.content {
  flex: 1;
  overflow: auto;
  padding: var(--sp-5);
  min-height: 0;
}

/* ------------------------------- 页面结构 ------------------------------- */
.page { max-width: 1440px; margin: 0 auto; }
.page-head {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.page-head .page-title { font-size: var(--fs-2xl); font-weight: 600; }
.page-head .page-desc { color: var(--wq-text-2); font-size: var(--fs-sm); margin-top: 2px; }
.page-head .page-actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar .spacer { margin-left: auto; }

/* 栅格 */
.grid { display: grid; gap: var(--sp-4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }

/* ------------------------------- 卡片 ------------------------------- */
.card {
  background: var(--wq-surface);
  border: 1px solid var(--wq-border);
  border-radius: var(--wq-radius);
  box-shadow: var(--wq-shadow-xs);
}
.card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--wq-border-2);
}
.card-head .card-title { font-size: var(--fs-lg); font-weight: 600; }
.card-head .card-actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.card-body { padding: var(--sp-4); }
.card-body.tight { padding: var(--sp-3); }
.card-body.flush { padding: 0; }

/* 统计卡 */
.stat {
  background: var(--wq-surface);
  border: 1px solid var(--wq-border);
  border-radius: var(--wq-radius);
  padding: var(--sp-4);
  box-shadow: var(--wq-shadow-xs);
}
.stat .stat-label { color: var(--wq-text-2); font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }
.stat .stat-value { font-size: var(--fs-3xl); font-weight: 700; margin-top: var(--sp-2); letter-spacing: -.01em; }
.stat .stat-value small { font-size: var(--fs-md); font-weight: 500; color: var(--wq-text-3); margin-left: 4px; }
.stat .stat-foot { margin-top: var(--sp-1); font-size: var(--fs-xs); color: var(--wq-text-3); }
.stat.accent { border-left: 3px solid var(--wq-primary); }
.stat.ok { border-left: 3px solid var(--wq-success); }
.stat.warn { border-left: 3px solid var(--wq-warn); }
.stat.danger { border-left: 3px solid var(--wq-danger); }

/* 迷你进度条 */
.meter { height: 6px; border-radius: 999px; background: var(--wq-surface-3); overflow: hidden; margin-top: var(--sp-2); }
.meter > i { display: block; height: 100%; background: var(--wq-primary); }
.meter.warn > i { background: var(--wq-warn); }
.meter.danger > i { background: var(--wq-danger); }
.meter.ok > i { background: var(--wq-success); }

/* ------------------------------- 表格 ------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
table.tbl th,
table.tbl td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--wq-border-2);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
table.tbl thead th {
  background: var(--wq-surface-2);
  color: var(--wq-text-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--wq-border);
}
table.tbl tbody tr:hover { background: var(--wq-surface-2); }
table.tbl tbody tr.selected { background: var(--wq-primary-050); }
table.tbl td.wrap { white-space: normal; }
table.tbl .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-empty { padding: var(--sp-7); text-align: center; color: var(--wq-text-3); }

.pager {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--wq-border-2);
  font-size: var(--fs-sm);
  color: var(--wq-text-2);
}
.pager .pager-info { margin-right: auto; }
.pager .pages { display: flex; gap: var(--sp-1); align-items: center; }
.pager button {
  min-width: 30px;
  height: 30px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--wq-border);
  background: var(--wq-surface);
  border-radius: var(--wq-radius-sm);
  color: var(--wq-text-2);
}
.pager button:hover:not(:disabled) { background: var(--wq-surface-3); }
.pager button.active { background: var(--wq-primary); border-color: var(--wq-primary); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------- 按钮 ------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--wq-border-strong);
  background: var(--wq-surface);
  color: var(--wq-text);
  border-radius: var(--wq-radius-sm);
  font-size: var(--fs-md);
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--wq-surface-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--wq-primary); border-color: var(--wq-primary); color: #fff; }
.btn-primary:hover { background: var(--wq-primary-600); border-color: var(--wq-primary-600); }
.btn-danger { background: var(--wq-surface); border-color: var(--wq-danger); color: var(--wq-danger); }
.btn-danger:hover { background: var(--wq-danger-bg); }
.btn-danger-solid { background: var(--wq-danger); border-color: var(--wq-danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.94); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--wq-text-2); }
.btn-ghost:hover { background: var(--wq-surface-3); color: var(--wq-text); }
.btn-sm { height: 26px; padding: 0 var(--sp-2); font-size: var(--fs-sm); }
.btn-xs { height: 22px; padding: 0 6px; font-size: var(--fs-xs); }
.btn-block { width: 100%; justify-content: center; }

/* ------------------------------- 表单 ------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.field > label { font-size: var(--fs-sm); color: var(--wq-text-2); font-weight: 500; }
.field .req { color: var(--wq-danger); margin-left: 2px; }
.input, .select, .textarea {
  height: 32px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--wq-border-strong);
  border-radius: var(--wq-radius-sm);
  background: var(--wq-surface);
  font-size: var(--fs-md);
  color: var(--wq-text);
  font-family: inherit;
  width: 100%;
}
.textarea { height: auto; min-height: 72px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--wq-primary);
  box-shadow: var(--focus-ring);
  outline: none;
}
.input.invalid, .select.invalid { border-color: var(--wq-danger); }
.field .hint { font-size: var(--fs-xs); color: var(--wq-text-3); }
.field .err { font-size: var(--fs-xs); color: var(--wq-danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-4); }
.form-grid .span-2 { grid-column: span 2; }

.checkbox { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--wq-primary); cursor: pointer; }

.switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: #CBD1D9; transition: background .15s; }
.switch .track::after { content: ""; display: block; width: 16px; height: 16px; margin: 2px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--wq-shadow-xs); }
.switch input:checked + .track { background: var(--wq-primary); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ------------------------------- 徽标/标签 ------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--wq-radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 18px;
  background: var(--wq-neutral-bg);
  color: var(--wq-text-2);
  border: 1px solid transparent;
}
.badge.ok { background: var(--wq-success-bg); color: #0B7A44; }
.badge.warn { background: var(--wq-warn-bg); color: #96690A; }
.badge.danger { background: var(--wq-danger-bg); color: #B3261E; }
.badge.info { background: var(--wq-info-bg); color: var(--wq-primary-600); }
.badge.approval { background: var(--wq-approval-bg); color: #96690A; }

.tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--wq-border);
  border-radius: var(--wq-radius-sm);
  background: var(--wq-surface-2);
  font-size: var(--fs-xs);
  color: var(--wq-text-2);
  font-family: var(--wq-mono);
}

.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
.kv dt { color: var(--wq-text-3); }
.kv dd { margin: 0; color: var(--wq-text); }

/* ------------------------------- 标签页 ------------------------------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--wq-border); margin-bottom: var(--sp-4); }
.tabs button {
  padding: var(--sp-2) var(--sp-4);
  border: none;
  background: transparent;
  color: var(--wq-text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: var(--fs-md);
}
.tabs button:hover { color: var(--wq-text); }
.tabs button.active { color: var(--wq-primary-600); border-bottom-color: var(--wq-primary); font-weight: 600; }

/* ------------------------------- 目录树 ------------------------------- */
.tree { font-size: var(--fs-md); }
.tree-node > .tree-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--wq-radius-sm);
  cursor: pointer;
}
.tree-node > .tree-label:hover { background: var(--wq-surface-3); }
.tree-node > .tree-label.active { background: var(--wq-primary-050); color: var(--wq-primary-600); }
.tree-children { margin-left: var(--sp-3); border-left: 1px dashed var(--wq-border); padding-left: var(--sp-2); }
.tree-caret { width: 14px; display: inline-grid; place-items: center; color: var(--wq-text-3); }
.tree-label .tname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------- 三态勾选（授权矩阵） ------------------------------- */
.tri {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--wq-radius-sm);
  border: 1px solid var(--wq-border);
  background: var(--wq-surface);
  font-size: 13px;
  line-height: 1;
  color: var(--wq-text-3);
  transition: background .1s, border-color .1s;
}
.tri:hover { border-color: var(--wq-border-strong); }
.tri.allow { background: var(--wq-success-bg); border-color: #9AD6B4; color: #0B7A44; }
.tri.deny { background: var(--wq-danger-bg); border-color: #EBA9A3; color: #B3261E; }
.tri.approval { background: var(--wq-approval-bg); border-color: #EAD08A; color: #96690A; }
.tri.none { color: #B9BFC8; }

.matrix td, .matrix th { text-align: center; }
.matrix th.rowh { text-align: left; position: sticky; left: 0; background: var(--wq-surface-2); z-index: 2; }
.matrix td.rowh { text-align: left; position: sticky; left: 0; background: var(--wq-surface); z-index: 2; border-right: 1px solid var(--wq-border-2); }
.matrix thead th.rowh { z-index: 3; }

/* ------------------------------- 模态 ------------------------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.38);
  display: grid;
  place-items: center;
  z-index: 2000;
  padding: var(--sp-5);
}
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--wq-surface);
  border-radius: var(--wq-radius-lg);
  box-shadow: var(--wq-shadow-lg);
  overflow: hidden;
}
.modal.wide { width: min(920px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--wq-border-2);
}
.modal-head h3 { font-size: var(--fs-lg); }
.modal-close { margin-left: auto; border: none; background: transparent; color: var(--wq-text-3); font-size: 20px; line-height: 1; }
.modal-body { padding: var(--sp-5); overflow: auto; }
.modal-foot {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--wq-border-2);
  background: var(--wq-surface-2);
}

/* ------------------------------- Toast ------------------------------- */
.toast-wrap {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 380px;
}
.toast {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--wq-radius);
  background: var(--wq-surface);
  border: 1px solid var(--wq-border);
  border-left: 3px solid var(--wq-primary);
  box-shadow: var(--wq-shadow-md);
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--wq-success); }
.toast.error { border-left-color: var(--wq-danger); }
.toast.warn { border-left-color: var(--wq-warn); }
.toast .toast-msg { font-size: var(--fs-md); word-break: break-word; }
.toast .toast-x { margin-left: auto; border: none; background: transparent; color: var(--wq-text-3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ------------------------------- 通知面板 ------------------------------- */
.notify-panel {
  position: fixed;
  top: calc(var(--topbar-h) + var(--sp-3));
  right: var(--sp-5);
  width: 360px;
  max-height: 70vh;
  overflow: auto;
  background: var(--wq-surface);
  border: 1px solid var(--wq-border);
  border-radius: var(--wq-radius);
  box-shadow: var(--wq-shadow-lg);
  z-index: 1500;
}
.notify-item { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--wq-border-2); }
.notify-item:last-child { border-bottom: none; }
.notify-item.unread { background: var(--wq-primary-050); }
.notify-item .n-title { font-weight: 600; font-size: var(--fs-md); }
.notify-item .n-body { color: var(--wq-text-2); font-size: var(--fs-sm); margin-top: 2px; }
.notify-item .n-time { color: var(--wq-text-3); font-size: var(--fs-xs); margin-top: 4px; }

/* ------------------------------- 登录页 ------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--wq-bg);
}
.login-hero {
  position: relative;
  background: linear-gradient(140deg, #0A4E99 0%, #0066CC 55%, #0B74D6 100%);
  color: #fff;
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.login-hero::before {
  content: "";
  position: absolute;
  right: 40px;
  top: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}
.login-hero h1 { color: #fff; font-size: 30px; }
.login-hero .hero-sub { color: rgba(255,255,255,.86); margin-top: var(--sp-3); max-width: 460px; }
.hero-feats { display: grid; gap: var(--sp-3); margin-top: var(--sp-6); position: relative; z-index: 1; }
.hero-feat { display: flex; gap: var(--sp-3); align-items: center; font-size: var(--fs-md); color: rgba(255,255,255,.95); }
.hero-feat .fi { width: 30px; height: 30px; border-radius: var(--wq-radius-sm); background: rgba(255,255,255,.14); display: grid; place-items: center; }
.login-foot { font-size: var(--fs-xs); color: rgba(255,255,255,.7); position: relative; z-index: 1; }

.login-panel { display: grid; place-items: center; padding: var(--sp-8); }
.login-form { width: min(360px, 100%); }
.login-form .logo-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.login-form .logo-row b { font-size: var(--fs-xl); }
.captcha-row { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); }
.captcha-img {
  display: grid;
  place-items: center;
  min-width: 120px;
  height: 32px;
  padding: 0 var(--sp-3);
  border: 1px dashed var(--wq-border-strong);
  border-radius: var(--wq-radius-sm);
  background: var(--wq-surface-2);
  font-family: var(--wq-mono);
  font-size: var(--fs-lg);
  letter-spacing: .06em;
  color: var(--wq-primary-700);
  cursor: pointer;
  user-select: none;
}

/* ------------------------------- 图表 ------------------------------- */
.chart { width: 100%; height: 220px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.legend { display: flex; gap: var(--sp-4); font-size: var(--fs-sm); color: var(--wq-text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ------------------------------- 杂项 ------------------------------- */
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.split.wide-left { grid-template-columns: 340px minmax(0, 1fr); }
.panel-scroll { max-height: 560px; overflow: auto; }
.hr { height: 1px; background: var(--wq-border-2); margin: var(--sp-4) 0; border: 0; }
.empty { padding: var(--sp-7); text-align: center; color: var(--wq-text-3); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wq-text-3); }
.dot.on { background: var(--wq-success); box-shadow: 0 0 0 3px rgba(15,157,88,.16); }
.dot.off { background: var(--wq-danger); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--wq-border);
  border-top-color: var(--wq-primary);
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-6); justify-content: center; color: var(--wq-text-3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--wq-surface-3); font-size: var(--fs-sm); color: var(--wq-text-2);
  cursor: pointer; border: 1px solid transparent;
}
.chip.active { background: var(--wq-primary-050); color: var(--wq-primary-600); border-color: var(--wq-primary-100); }
.cell-actions { display: flex; gap: 6px; }
.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--wq-border-2); }
.list-row:last-child { border-bottom: none; }
.progress-inline { display: flex; align-items: center; gap: var(--sp-2); }

/* ------------------------------- 补充组件（控制端 T16–T19） ------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }

/* 授权矩阵头部与图例 */
.matrix-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--wq-border-2);
}
.matrix-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.matrix-path { font-family: var(--wq-mono); font-size: var(--fs-md); color: var(--wq-text); }
.matrix-inherit { margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--wq-text-2); }
.matrix-wrap { max-height: 620px; overflow: auto; border: 1px solid var(--wq-border-2); border-radius: var(--wq-radius-sm); }
.matrix-legend { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--wq-text-2); flex-wrap: wrap; }
.matrix-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.matrix-legend .tri { cursor: default; }

.subject-cell { display: flex; align-items: center; gap: var(--sp-2); }
.subject-cell .subject-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.icon-x { border: none; background: transparent; color: var(--wq-text-3); display: inline-grid; place-items: center; padding: 2px; border-radius: var(--wq-radius-sm); }
.icon-x:hover { color: var(--wq-danger); background: var(--wq-danger-bg); }
.cell-tri { text-align: center; padding: 4px !important; }

.dirty-flag { font-size: var(--fs-sm); color: var(--wq-warn); }

/* 标签集合 */
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag.danger { border-color: #EBA9A3; background: var(--wq-danger-bg); color: #B3261E; }
.tag.info { border-color: var(--wq-primary-100); background: var(--wq-primary-050); color: var(--wq-primary-600); }

/* 开关网格（DLP） */
.switch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-2); }
.switch-cell { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); color: var(--wq-text-2); cursor: pointer; user-select: none; }
.form-section-title { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--fs-sm); font-weight: 600; color: var(--wq-text-2); letter-spacing: .02em; }

/* 键值网格（详情/状态） */
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-5); }
.kv-grid .kv { display: grid; grid-template-columns: 130px 1fr; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); align-items: baseline; }
.kv .kv-k { color: var(--wq-text-3); }
.kv .kv-v { color: var(--wq-text); word-break: break-all; }

/* 进度条（备份盘） */
.meter-fill { display: block; height: 100%; background: var(--wq-primary); border-radius: 999px; }

/* 校验/裁决结果 */
.verify-head, .eff-summary { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }

/* 通知面板补充 */
.notify-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--wq-border-2); position: sticky; top: 0; background: var(--wq-surface); }
.notify-head .btn { margin-left: auto; }
.notify-list { display: block; }
.notify-title { font-weight: 600; font-size: var(--fs-md); }
.notify-body { color: var(--wq-text-2); font-size: var(--fs-sm); margin-top: 2px; }
.notify-time { color: var(--wq-text-3); font-size: var(--fs-xs); margin-top: 4px; }
.notify-item { cursor: pointer; }
.dot.online { background: var(--wq-success); box-shadow: 0 0 0 3px rgba(15,157,88,.16); }
.dot.offline { background: var(--wq-danger); }

@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .switch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .switch-grid { grid-template-columns: 1fr; }
}

/* ------------------------------- 响应式 ------------------------------- */
@media (max-width: 1280px) {
  .grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.wide-left { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-6 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
