/* TK矩阵 · 极昼石板·琥珀雷达 视觉主题（零构建原生 CSS） */
:root {
  --bg-canvas: #f2f5f9;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-topbar: #0f172a;
  --bg-topbar-hover: #1e293b;
  --bg-topbar-active: #0d9488;
  --ink-primary: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --ink-inverse: #f8fafc;
  --border: #dce3ee;
  --border-strong: #c5d0e0;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e6f7f5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #059669;
  --success-soft: #d1fae5;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* ==================== 登录页 ==================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 20%, #1e293b 0%, #0f172a 55%, #09101d 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.login-brand p {
  margin: 2px 0 0;
  font-size: 12px;
}

.login-footnote {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0d9488, #f59e0b);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.brand-mark.sm {
  width: 30px;
  height: 30px;
  font-size: 13px;
  border-radius: 8px;
}

/* ==================== 顶栏（4 级自适应降级，严禁横向滚动条） ==================== */
.app-shell {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 54px;
  width: 100%;
  max-width: 100%;
  background: var(--bg-topbar);
  color: var(--ink-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.primary-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  overflow: visible;
}

.nav-items {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease;
}

.nav-btn:hover {
  background: var(--bg-topbar-hover);
  color: #fff;
}

.nav-btn.active {
  background: var(--bg-topbar-active);
  color: #fff;
  font-weight: 600;
}

.nav-ico {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-ico svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 4 级降级模式：full -> short -> icon -> more */
.topbar[data-nav-mode="full"] .nav-label-short { display: none; }
.topbar[data-nav-mode="full"] .nav-label-full { display: inline; }

.topbar[data-nav-mode="short"] .nav-label-full { display: none; }
.topbar[data-nav-mode="short"] .nav-label-short { display: inline; }

.topbar[data-nav-mode="icon"] .nav-label-full,
.topbar[data-nav-mode="icon"] .nav-label-short { display: none; }
.topbar[data-nav-mode="icon"] .nav-btn { padding: 0 8px; }

.topbar[data-nav-mode="more"] .nav-label-full,
.topbar[data-nav-mode="more"] .nav-label-short { display: none; }
.topbar[data-nav-mode="more"] .nav-btn { padding: 0 7px; }

.nav-more-wrap {
  position: relative;
  flex-shrink: 0;
}

.nav-more-menu {
  position: absolute;
  right: 0;
  top: 40px;
  min-width: 196px;
  max-width: calc(100vw - 24px);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 120;
}

.nav-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #e2e8f0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.nav-more-item:hover { background: rgba(255, 255, 255, 0.08); }
.nav-more-item.active { background: var(--bg-topbar-active); color: #fff; font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.expiry-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
  white-space: nowrap;
}

.expiry-badge.perm {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.expiry-badge.urgent {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.55);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-size: 12px;
  white-space: nowrap;
}

.role-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #0d9488;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
}

.btn-icon-ghost {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #e2e8f0;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-icon-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ==================== 主内容容器 ==================== */
.main-content {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 18px 40px;
  min-width: 0;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-primary);
}

.page-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-secondary);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ==================== 通用卡片 / 布局 ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

/* 21 指标卡网格 */
.metrics-grid-21 {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card.tone-warn {
  border-color: #f59e0b;
  background: #fffbeb;
}

.metric-label {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-unit {
  font-size: 11px;
  color: var(--ink-muted);
}

/* ==================== 按钮与表单 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.btn:hover:not(:disabled) { background: var(--bg-subtle); border-color: #94a3b8; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
}
.btn-amber:hover:not(:disabled) { background: #b45309; }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--accent);
}

.ctrl-sm {
  height: 32px;
  padding: 2px 10px !important;
  line-height: 1.3;
  font-size: 12px !important;
}

/* ==================== 表格（容器内滚动，绝不撑宽页面） ==================== */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: var(--ink-secondary);
  font-weight: 600;
  font-size: 12px;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ==================== 徽章 / 提示 / 空态 ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok { background: var(--success-soft); color: #065f46; }
.badge-warn { background: var(--amber-soft); color: #92400e; }
.badge-danger { background: var(--danger-soft); color: #991b1b; }
.badge-info { background: var(--info-soft); color: #1e40af; }
.badge-neutral { background: #e2e8f0; color: #334155; }

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid transparent;
  word-break: break-word;
}
.alert-info { background: var(--info-soft); border-color: #93c5fd; color: #1e3a8a; }
.alert-warn { background: var(--amber-soft); border-color: #fcd34d; color: #78350f; }
.alert-danger { background: var(--danger-soft); border-color: #fca5a5; color: #7f1d1d; }
.alert-ok { background: var(--success-soft); border-color: #6ee7b7; color: #065f46; }

.empty-state {
  padding: 28px 18px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-state h4 { margin: 0; font-size: 15px; color: var(--ink-primary); }
.empty-state p { margin: 0; max-width: 520px; font-size: 13px; color: var(--ink-secondary); }

/* ==================== 选项卡 / 向导步骤条 ==================== */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn:hover { background: #e2e8f0; color: var(--ink-primary); }
.tab-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.wizard-step:hover { border-color: var(--accent); }
.wizard-step.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-step.active .step-num { background: rgba(255,255,255,0.22); color: #fff; }

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--ink-primary);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-title {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== 专业 10 步工作台（左纵导航 + 右主表单，移动端自动收折） ==================== */
.wb-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.wb-sidebar {
  position: sticky;
  top: 68px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wb-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}

.wb-sidebar .wizard-step {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 8px;
}

.wb-sidebar .wizard-step:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.wb-sidebar .wizard-step.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.wb-sidebar .wizard-step.active .step-num {
  background: var(--accent);
  color: #fff;
}

.wb-acc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wb-acc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.wb-acc-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.wb-pill-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wb-pill-btn:hover { border-color: var(--accent); }
.wb-pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ==================== 素材库卡片墙与目录树 ==================== */
.library-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
}

.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}

.folder-item:hover { background: #eef2f7; }
.folder-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.material-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.material-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.material-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.material-thumb {
  height: 110px;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px;
  font-size: 12px;
}

.material-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.material-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== SVG 趋势图 / 日志控制台 / 弹窗 ==================== */
.svg-chart-wrap {
  width: 100%;
  overflow: hidden;
}

.svg-chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.stream-console {
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 120px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.score-ring {
  width: 86px;
  height: 86px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  border: 6px solid var(--accent);
  flex-shrink: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-panel {
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-topbar);
  color: #fff;
}

.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--accent);
  word-break: break-word;
}
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--amber); }

/* ==================== AI 投手驾驶舱 & 素材自检专属样式 ==================== */
.ai-hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 60%, #0f172a 100%);
  color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ai-hero-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #14b8a6;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-mini-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.ai-mini-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  min-width: 0;
}
.ai-mini-tile .v { font-size: 16px; font-weight: 700; color: var(--ink-primary); }
.ai-mini-tile .k { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.ai-ladder-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.ai-ladder-step {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fff;
  min-width: 0;
}
.ai-ladder-step.ok { border-color: #10b981; background: #f0fdf4; }
.ai-ladder-step.fail { border-color: #f59e0b; background: #fffbeb; }

/* ==================== 响应式断点：1440 / 768 / 390 / 380 无横向溢出 ==================== */
@media (max-width: 1200px) {
  .metrics-grid-21 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .material-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ai-ladder-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .metrics-grid-21 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-mini-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-ladder-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-layout { grid-template-columns: 1fr; }
  .wb-sidebar { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .wb-sidebar-head { grid-column: 1 / -1; }
  .wb-acc-grid { grid-template-columns: 1fr; }
  .library-layout { grid-template-columns: 1fr; }
  .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { padding: 0 8px; gap: 6px; }
  .brand-title { display: none; }
  .user-name-label { display: none; }
  .expiry-badge { max-width: 92px; overflow: hidden; text-overflow: ellipsis; padding: 2px 6px; font-size: 10px; }
  .main-content { padding: 12px 10px 32px; }
  .metrics-grid-21 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .ai-mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-ladder-list { grid-template-columns: 1fr; }
  .material-grid { grid-template-columns: 1fr; }
  .wizard-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .card { padding: 12px; }
  .page-title { font-size: 18px; }
}

@media (max-width: 400px) {
  .topbar { padding: 0 6px; gap: 4px; }
  .user-pill { padding: 2px 5px; }
  .btn-icon-ghost { padding: 3px 6px; font-size: 11px; }
  .nav-more-text { display: none; }
  #btn-change-pwd { display: none; }
}
