/* 工艺与质量 / PPAP — 企业级 B 端设计规范 v2 */
:root {
  /* 主色系 */
  --primary: #1664ff;
  --primary-hover: #0e50d9;
  --primary-dark: #0a3eaa;
  --primary-light: #eaf0ff;
  --primary-mid: #c5d8ff;

  /* 背景层次 */
  --bg-body: #f0f2f7;
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f0f5ff;
  --bg-input: #ffffff;

  /* 边框 */
  --border: #e4e8f0;
  --border-light: #eef1f6;
  --border-focus: #1664ff;

  /* 文字 */
  --text: #1a2033;
  --text-secondary: #4a5568;
  --text-muted: #8896ab;
  --text-placeholder: #a8b3c3;

  /* 语义色 */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 48, 0.04);
  --shadow-sm: 0 1px 4px rgba(16, 24, 48, 0.06), 0 1px 2px rgba(16, 24, 48, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 48, 0.08), 0 2px 6px rgba(16, 24, 48, 0.06);
  --shadow-lg: 0 10px 32px rgba(16, 24, 48, 0.12), 0 4px 12px rgba(16, 24, 48, 0.08);
  --shadow-primary: 0 4px 14px rgba(22, 100, 255, 0.28);

  /* 圆角 */
  --radius-xs: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* 字体 */
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", "SF Mono", ui-monospace, monospace;

  /* 布局 */
  --topbar-h: 58px;
  --sidebar-w: 256px;

  /* 过渡 */
  --transition: 0.18s ease;
  --transition-slow: 0.3s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-body);
  line-height: 1.55;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  height: auto;
  min-height: var(--topbar-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  padding-bottom: 0;
  gap: 0.4rem 1rem;
  background: linear-gradient(135deg, #1a3fcc 0%, var(--primary) 60%, #2e5bff 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(22, 64, 220, 0.25);
}

.topbar-brand {
  flex-shrink: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  padding: 0.25rem 0;
}
.topbar-logo:hover { opacity: 0.9; }

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  border: 1px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-title { font-size: 0.94rem; font-weight: 700; letter-spacing: -0.01em; }
.logo-sub { font-size: 0.7rem; opacity: 0.78; font-weight: 400; margin-top: 1px; }

.topbar-context {
  flex: 1 1 400px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  min-width: 0;
  padding: 0 0.25rem;
}

.ctx-label {
  font-size: 0.72rem;
  opacity: 0.85;
  white-space: nowrap;
  font-weight: 500;
}

.topbar-context .ctx-select,
.topbar-context .ctx-input {
  height: 30px;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  font-size: 0.82rem;
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
  transition: background var(--transition), border-color var(--transition);
}

.topbar-context .ctx-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
  opacity: 1;
}

.topbar-context .ctx-input:focus,
.topbar-context .ctx-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.topbar-context .ctx-input:-webkit-autofill,
.topbar-context .ctx-input:-webkit-autofill:hover,
.topbar-context .ctx-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff;
  box-shadow: 0 0 0 1000px rgba(22, 64, 220, 0.4) inset !important;
}

.topbar-context .ctx-select option {
  color: var(--text);
  background: #fff;
}

.ctx-part-wrap {
  position: relative;
  flex: 1 1 140px;
  max-width: 200px;
}

.ctx-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 400;
}

.ctx-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.92;
}
.ctx-check input { accent-color: #fff; }

.ctx-btn {
  height: 30px;
  padding: 0 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.8rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.ctx-btn:hover { background: rgba(255, 255, 255, 0.24); }

.ctx-chips {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0 0.5rem 0.45rem 1.5rem;
  order: 10;
}

.ctx-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.72rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition);
}

.ctx-chip:hover { background: rgba(255, 255, 255, 0.28); }

.ctx-chip-part {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.ctx-chip-x {
  opacity: 0.85;
  font-size: 0.9rem;
  line-height: 1;
}

.ctx-input.ctx-input-scoped {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.topbar-icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.topbar-icon-btn:hover { background: rgba(255, 255, 255, 0.22); }

.notify-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  border: 1.5px solid var(--primary);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.topbar-user:hover { background: rgba(255, 255, 255, 0.12); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

/* ===== 壳层布局 ===== */
.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  align-self: stretch;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-inner {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.75rem 0.65rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-footer {
  flex-shrink: 0;
  padding: 0.6rem 0.85rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-sidebar);
}

.sidebar-footer-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

/* ===== 页头 ===== */
.page-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem 0.7rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.page-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-desc {
  margin: 0.2rem 0 0;
  font-size: 0.83rem;
  color: var(--text-secondary);
  max-width: 52ch;
  line-height: 1.5;
}

.page-route {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--bg-page);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1.25rem 1.5rem 2.5rem;
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== 侧栏搜索区 ===== */
.sidebar-search label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.sidebar-search .sidebar-select {
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.86rem;
  font-family: var(--font);
}

.sidebar-search .wrap { position: relative; }

.sidebar-search input, .input {
  width: 100%;
  padding: 0.46rem 0.65rem 0.46rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.86rem;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.list-toolbar .input { padding-left: 0.65rem; }

.sidebar-search input:focus, .input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.1);
}

.icon-search {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-hint {
  font-size: 0.71rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.6rem;
  background: var(--bg-page);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.btn-row { margin-top: 0.5rem; }

/* ===== 按钮 ===== */
.btn-primary {
  width: 100%;
  padding: 0.52rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.86rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform 0.1s;
  letter-spacing: 0.01em;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-primary);
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  padding: 0.46rem 0.9rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--primary-mid);
  color: var(--primary);
}
.btn-secondary:active:not(:disabled) { transform: scale(0.98); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-danger-outline {
  border-color: #fca5a5;
  color: var(--danger);
}
.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-ghost {
  padding: 0.46rem 0.9rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--primary-mid);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.86rem;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition);
}
.btn-ghost:hover { background: #dce8ff; }

/* ===== 侧栏导航 ===== */
.sidebar-nav { flex: 1; }

.nav-group { margin-bottom: 0.15rem; }

.nav-group-head {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  padding: 0.52rem 0.65rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: var(--font);
}

a.nav-group-link {
  text-decoration: none;
}

.nav-group-chev {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  margin-right: 0.15rem;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.nav-group-chev:hover {
  background: var(--bg-page);
  color: var(--text-secondary);
}
.nav-group-toggle:hover,
a.nav-group-link:hover {
  background: var(--bg-page);
  color: var(--text-secondary);
}
.nav-group[data-open="true"] .nav-group-link {
  color: var(--primary);
}

.nav-group-toggle .nav-group-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-group-toggle .ico { color: inherit; }

.chev {
  font-size: 0.65rem;
  transition: transform var(--transition);
  opacity: 0.75;
}
.nav-group[data-open="false"] .nav-children { display: none; }
.nav-group[data-open="false"] .nav-group-chev .chev { transform: rotate(-90deg); }

.nav-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.1rem 0 0.25rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.52rem 0.65rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.nav-item .ico { flex-shrink: 0; color: var(--text-muted); transition: color var(--transition); }
.nav-item .nav-label { flex: 1; min-width: 0; }
.nav-item .badge {
  font-size: 0.63rem;
  font-weight: 700;
  padding: 0.08rem 0.38rem;
  border-radius: var(--radius-full);
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--primary);
}
.nav-item:hover .ico { color: var(--primary); }

.nav-item[aria-current="true"] {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-color: rgba(22, 100, 255, 0.15);
}
.nav-item[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-item[aria-current="true"] .ico { color: var(--primary); }
.nav-item[aria-current="true"] .badge {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Home 单项导航 */
.nav-list { margin-bottom: 0.35rem; }
.nav-list .nav-item {
  font-weight: 600;
  font-size: 0.9rem;
}

.status-dot {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.06rem 0.38rem;
  border-radius: var(--radius-xs);
  margin-left: auto;
  white-space: nowrap;
}
.status-live {
  background: var(--success-light);
  color: var(--success);
}
.status-cli {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== 视图面板 ===== */
.view-panel[hidden] { display: none !important; }

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card-hub {
  border-color: rgba(22, 100, 255, 0.12);
  box-shadow: 0 2px 12px rgba(22, 100, 255, 0.06), var(--shadow-sm);
}
.card-head { margin-bottom: 1rem; }
.card-title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.card-sub {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}
.card-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.card-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

/* ===== 工作台 Hub 卡片 ===== */
.hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.85rem;
}

.hub-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform 0.15s ease;
}
.hub-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #6ea6ff);
  opacity: 0;
  transition: opacity var(--transition);
}
.hub-card:hover {
  border-color: var(--primary-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.hub-card:hover::before { opacity: 1; }
.hub-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.hub-card .hub-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.hub-card-body { flex: 1; min-width: 0; }
.hub-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.35;
}
.hub-card .n {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.03em;
}
.hub-card .n-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Hub 分组标题 */
.hub-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hub-group-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.hub-group-header:first-child { margin-top: 0; }

/* ===== 面包屑 / 工具栏 ===== */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.breadcrumb strong { color: var(--text); font-weight: 600; }
.breadcrumb button.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  font-family: var(--font);
}
.breadcrumb button.link:hover { text-decoration: underline; }

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.form-field label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.28rem;
}
.list-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  align-self: center;
  margin-left: auto;
}
.list-toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ===== 表格 ===== */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(68vh, 720px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.83rem;
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border-light);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.data-table td.cell-full {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 5rem;
  max-width: none;
}
.data-table th {
  background: var(--primary-light);
  color: var(--text);
  font-weight: 600;
  font-size: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1.5px solid var(--primary-mid);
  letter-spacing: 0.01em;
}

.dim-report-table thead th.dim-meas-group {
  text-align: center;
  background: #dce9ff;
  color: var(--primary-hover);
  z-index: 2;
}
.dim-report-table thead tr:nth-child(2) th {
  top: 2.35rem;
  z-index: 2;
  text-align: center;
  font-weight: 500;
  font-size: 0.8125rem;
  min-width: 3.25rem;
}
.dim-report-table thead tr:first-child th[rowspan="2"] {
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td { background: #eff6ff; }
.data-table tbody tr:hover td {
  background: #dbeafe !important;
  transition: background 0.1s;
}

table:not(.data-table) {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.83rem;
}
table:not(.data-table) th,
table:not(.data-table) td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
}
table:not(.data-table) th {
  background: var(--primary-light);
  font-weight: 600;
}

.table-host .data-table td {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

tr.list-row { cursor: pointer; }
tr.list-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.col-highlight { color: var(--primary); font-weight: 600; }

.list-row-check, #listSelectAll {
  cursor: pointer;
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* ===== 加载 / 错误 ===== */
.loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(240, 242, 247, 0.72);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}
.loading-overlay.visible { display: flex; }

.loading-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.35rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
}
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2.5px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.err {
  display: none;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 0.86rem;
  line-height: 1.5;
}
.err.visible { display: block; }

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== 页面顶栏：面包屑 + 操作 ===== */
.page-head-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.page-head-main { flex: 1; min-width: 0; }
.detail-page-head .page-head-main {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.detail-page-head .detail-back { flex-shrink: 0; margin-top: 0.05rem; }
.page-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  align-self: center;
}

.toolbar-compact .btn-primary,
.toolbar-compact .btn-secondary,
.btn-compact {
  width: auto;
  padding: 0.28rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
}
.toolbar-compact .btn-primary { min-width: 0; }

.crud-list-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-right: 0;
}
.path {
  font-size: 0.73rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 0;
  font-family: var(--font-mono);
}
#detailPath.detail-path { margin-bottom: 0; }

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.meta > div {
  background: var(--bg-page);
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  font-size: 0.83rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.meta span.label {
  display: block;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

section.block { margin-bottom: 1.75rem; }
section.block h3,
section.block h4 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
section.block h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
  margin-left: 0.4rem;
}

.photo-inline {
  max-height: 120px;
  max-width: 280px;
  margin-top: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
a.link-muted { color: var(--primary); font-size: 0.8rem; }

.determine-box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px dashed var(--primary-mid);
  background: var(--primary-light);
}

.sheet-bubbles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.85rem 0; }
.sheet-bubbles .bubble {
  padding: 0.32rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.81rem;
  cursor: pointer;
  transition: all var(--transition);
}
.sheet-bubbles .bubble:hover { border-color: var(--primary-mid); color: var(--primary); background: var(--primary-light); }
.sheet-bubbles .bubble[aria-selected="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ===== 占位 / PPAP 步骤 ===== */
.placeholder-panel .tag {
  display: inline-block;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-xs);
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}
.placeholder-panel pre {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  overflow-x: auto;
  line-height: 1.6;
}

.ppap-steps {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.ppap-steps h3 {
  font-size: 0.9rem;
  margin: 0 0 1rem;
  color: var(--text);
  font-weight: 600;
}
.step-bar {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.step-item {
  flex: 1;
  text-align: center;
  position: relative;
}
.step-item::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.step-item:first-child::before { display: none; }
.step-item.done::before,
.step-item.active::before { background: var(--primary); }

.step-dot {
  width: 28px;
  height: 28px;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  background: var(--bg-page);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: all var(--transition);
}
.step-item.active .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(22, 100, 255, 0.18);
}
.step-item.done .step-dot {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}
.step-label {
  font-size: 0.71rem;
  color: var(--text-secondary);
  padding: 0 0.2rem;
  line-height: 1.35;
}
.step-item.active .step-label { color: var(--primary); font-weight: 600; }
.step-item.done .step-label { color: var(--success); }

/* ===== 建议下拉 ===== */
.suggest {
  position: absolute;
  z-index: 100;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: none;
}
.suggest[aria-hidden="false"] { display: block; }
.suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.86rem;
  font-family: var(--font);
  color: var(--text);
}
.suggest button:hover { background: var(--bg-hover); color: var(--primary); }

.ico {
  display: inline-block;
  flex-shrink: 0;
  font-size: 1.125rem;
  line-height: 1;
  vertical-align: -0.12em;
  font-style: normal;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .app-shell {
    flex-direction: column;
    flex: none;
    min-height: calc(100vh - var(--topbar-h));
    overflow: visible;
  }
  .sidebar {
    width: 100%;
    align-self: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
    overflow-y: auto;
  }
  .sidebar-footer { display: none; }
  .main-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .main-content { overflow: auto; }
  .page-header { flex-direction: column; }
}

@media (max-width: 768px) {
  .page-head-bar { flex-wrap: wrap; align-items: flex-start; }
  .page-head-actions { width: 100%; justify-content: flex-end; max-width: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 0.75rem; }
  .logo-sub { display: none; }
  .user-name { display: none; }
  .main-content { padding: 0.85rem; }
  .hub-cards { grid-template-columns: 1fr 1fr; }
  .step-label { font-size: 0.63rem; }
}

/* ===== CRUD 编辑 ===== */
.crud-header-form {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.crud-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}
.crud-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
}
.crud-field span {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.crud-field input {
  padding: 0.38rem 0.55rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-family: var(--font);
  background: var(--bg-input);
}
.crud-field input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.1);
}
.crud-toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}
.crud-edit-table .crud-cell-input {
  width: 100%;
  min-width: 4rem;
  padding: 0.28rem 0.42rem;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font: inherit;
  font-family: var(--font);
  background: transparent;
  transition: border-color var(--transition), background var(--transition);
}
.crud-edit-table .crud-cell-input:hover,
.crud-edit-table .crud-cell-input:focus {
  border-color: var(--border);
  background: var(--bg-input);
  outline: none;
}
.crud-edit-table .crud-cell-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 100, 255, 0.1);
}
.crud-actions-col { width: 3rem; text-align: center; }
.btn-icon-danger {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.btn-icon-danger:hover { background: var(--danger-light); }

.crud-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.crud-dialog {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 440px;
  width: 92vw;
  box-shadow: var(--shadow-lg);
}
.crud-dialog::backdrop { background: rgba(16, 24, 48, 0.45); }
.crud-dialog form { padding: 1.5rem; }
.crud-dialog-title { margin: 0 0 0.85rem; font-size: 1rem; font-weight: 700; }
.crud-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* ===== 详情只读 ===== */
#detailContent .table-wrap { max-height: none; overflow: visible; }
#detailContent .determine-box .table-wrap { max-height: min(220px, 40vh); overflow: auto; }
#detailContent section.block .table-wrap { max-height: none; overflow: visible; }
#detailContent .dim-report-table-wrap {
  max-height: min(70vh, 640px);
  overflow: auto;
  contain: strict;
  -webkit-overflow-scrolling: touch;
}
#detailContent .dim-report-table-wrap.is-loading {
  opacity: 0.65;
  pointer-events: none;
}
#detailContent .dim-report-table tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 2rem;
}
.dim-report-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--surface-2, #f1f5f9);
  border-radius: 6px;
  font-size: 0.85rem;
}
.dim-report-pager-actions {
  display: flex;
  gap: 0.4rem;
}
.dim-report-loading {
  padding: 1rem 0.25rem;
}

.dim-report-table { width: max-content; min-width: 100%; }
.dim-report-table th, .dim-report-table td { white-space: nowrap; }
.dim-report-table td.cell-full { white-space: pre-wrap; }
.detail-sheet-pane .meta > div { max-width: none; }

.crud-cell-textarea {
  width: 100%;
  min-width: 8rem;
  min-height: 2.5rem;
  padding: 0.38rem 0.55rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-family: var(--font);
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}
.crud-field .crud-cell-textarea { min-height: 3rem; }
.crud-edit-table td.cell-full { min-width: 6rem; }

.crud-media-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 10rem;
}
.crud-media-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.75rem;
}
.crud-media-preview .photo-inline { max-width: 120px; max-height: 80px; }

/* ===== Hub 零件汇总 ===== */
.hub-parts-section {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}
.hub-parts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}
.hub-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.hub-parts-filter {
  min-width: 200px;
  flex: 1 1 180px;
  max-width: 280px;
}
.hub-parts-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}
.hub-parts-table-host {
  max-height: min(52vh, 520px);
  overflow: auto;
}

.parts-summary-table .col-part-no {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-card);
  min-width: 8.5rem;
}
.parts-summary-table thead .col-part-no { z-index: 2; }
.parts-summary-table .col-count-head {
  font-size: 0.77rem;
  white-space: nowrap;
  text-align: center;
  min-width: 4.5rem;
}
.parts-summary-table .col-count { text-align: center; }
.parts-summary-table .count-zero { color: var(--text-muted); }
.parts-summary-table .count-link {
  border: none;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.84rem;
  padding: 0.14rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.parts-summary-table .count-link:hover {
  background: var(--primary);
  color: #fff;
}
.summary-part-row { cursor: pointer; }
.summary-part-row:hover td { background: var(--bg-hover); }
.summary-part-row .col-total {
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
}
.summary-part-row.row-incomplete .col-part-no strong { color: var(--primary); }
.parts-summary-table .col-complete { min-width: 6.5rem; }

/* 完整度进度条 */
.completeness-bar {
  position: relative;
  height: 1.2rem;
  background: #e8edf5;
  border-radius: var(--radius-full);
  overflow: hidden;
}
.completeness-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--warning), #fbbf24);
  transition: width 0.35s ease;
  border-radius: var(--radius-full);
}
.completeness-bar.mid .completeness-fill {
  background: linear-gradient(90deg, var(--primary), #6ea6ff);
}
.completeness-bar.full .completeness-fill {
  background: linear-gradient(90deg, var(--success), #34d399);
}
.completeness-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
}

.hub-filter-check, .list-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}

.part-hub-completeness {
  margin: 0.75rem 0 1rem;
  max-width: 340px;
}
.part-hub-comp-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 0.3rem;
}

.part-hub-row.is-empty td { color: var(--text-muted); background: #fafbfe; }
.part-hub-row.is-empty .col-action .link-btn {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.86rem;
}
.recent-parts-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.recent-part-chip {
  display: inline-block;
  margin: 0 0.25rem 0.25rem 0;
  padding: 0.22rem 0.55rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  font-size: 0.77rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.recent-part-chip:hover {
  border-color: var(--primary-mid);
  color: var(--primary);
  background: var(--primary-light);
}

.sidebar-search-compact .sidebar-hint { margin: 0; }

.hub-cards-fold { margin-top: 0; }
.hub-cards-fold summary {
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.hub-cards-fold summary::before {
  content: "›";
  transition: transform var(--transition);
  font-size: 1rem;
  line-height: 1;
}
.hub-cards-fold[open] summary::before { transform: rotate(90deg); }
.hub-cards-fold[open] summary { margin-bottom: 0.65rem; }

.part-hub-row { cursor: pointer; }
.part-hub-row:hover td { background: var(--bg-hover); }
.part-hub-row.is-empty { opacity: 0.52; cursor: default; }
.part-hub-row.is-empty:hover td { background: transparent; }

/* ===== 客户上下文条 ===== */
.customer-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, #f0f5ff 100%);
  border: 1px solid rgba(22, 100, 255, 0.18);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.customer-banner[hidden] { display: none !important; }
.cust-banner-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}
.cust-banner-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-hover);
}
.cust-banner-code {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.cust-banner-total { font-size: 0.82rem; color: var(--text-secondary); }
.cust-banner-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.cust-banner-hint.muted { color: var(--text-muted); }
.cust-banner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.cust-stat-chip {
  font-size: 0.72rem;
  padding: 0.16rem 0.55rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}

/* ===== 操作引导 ===== */
.workflow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, #f8faff 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(22, 100, 255, 0.14);
}
.workflow-step {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.workflow-num {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
  box-shadow: 0 2px 6px rgba(22, 100, 255, 0.35);
}
.workflow-text strong { color: var(--text); }

.topbar-context .ctx-select {
  min-width: 11rem;
  max-width: 22rem;
}

.empty-hint {
  padding: 1.5rem;
  line-height: 1.65;
  color: var(--text-secondary);
  text-align: left;
  max-width: 36rem;
}

.welcome-fail h2 { margin-top: 0; font-size: 1.1rem; font-weight: 700; }
.welcome-tips {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.7;
}
.welcome-tips code {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  background: var(--bg-page);
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--primary);
}

.card-hub .hub-parts-section { margin-top: 0; }

/* ===== Hub 分组标题（首页全部模块分组） ===== */
.hub-cards .hub-group-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

/* ===== 登录页 ===== */
/* 未登录首屏：仅显示登录卡片，隐藏主界面（JS 加载前由 html.login-gate 生效） */
html.login-gate .topbar,
html.login-gate .sidebar,
html.login-gate #pageHeader,
html.login-gate #customerBanner,
html.login-gate #loading,
html.login-gate #err {
  display: none !important;
}

html.login-gate .app-shell > .main-wrap {
  max-width: none;
  margin: 0;
  padding: 0;
}

html.login-gate .main-content > .view-panel {
  display: none !important;
}

html.login-gate .main-content > #viewLogin {
  display: block !important;
}

html.login-gate #viewLogin[hidden] {
  display: block !important;
}

/* 侧边栏/顶栏隐藏时，登录容器铺满全屏 */
.topbar:hidden ~ .app-shell .sidebar,
.topbar:hidden { display: none !important; }

.topbar:hidden ~ .app-shell {
  display: block;
}

.topbar:hidden ~ .app-shell > .sidebar {
  display: none !important;
}

.topbar:hidden ~ .app-shell > .main-wrap {
  max-width: none;
  margin: 0;
  padding: 0;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg, #fff);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  padding: 2.5rem 2.25rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a3fcc, #1664ff);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.login-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.login-form { display: flex; flex-direction: column; gap: 1.15rem; }

.login-field { display: flex; flex-direction: column; gap: 0.35rem; }

.login-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-input {
  height: 42px;
  padding: 0 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.93rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,100,255,.12);
}

.login-error {
  font-size: 0.83rem;
  color: #d32f2f;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  line-height: 1.4;
}

.login-btn {
  height: 44px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 0.35rem;
}
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

.login-footer {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== 顶部栏：用户信息 & 登录按钮 ===== */
.btn-login-entry {
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  cursor: pointer;
  transition: all .18s;
}
.btn-login-entry:hover {
  background: var(--primary);
  color: #fff;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-right: 0.5rem;
}

.user-role-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.role-admin { background: #e8eaf6; color: #3f51b5; }
.role-guest { background: #f0f0f0; color: #666; }
.role-qe { background: #ecfdf3; color: #166534; }

.btn-logout {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all .18s;
  margin-left: 0.3rem;
}
.btn-logout:hover {
  color: #d32f2f;
  border-color: #d32f2f;
  background: #fef2f2;
}

/* ===== 管理看板 ===== */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.5rem;
}

.admin-stat-card {
  background: linear-gradient(135deg, #f5f7fa, #e8ecf1);
  border-radius: 12px;
  padding: 1.1rem 1rem;
  text-align: center;
  border: 1px solid var(--border);
}

.admin-stat-num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.admin-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.admin-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light, #eee);
}

.admin-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.85rem;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  margin-left: auto;
}

.action-tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  white-space: nowrap;
}
.action-login    { background: #e8f5e9; color: #2e7d32; }
.action-logout   { background: #fafafa; color: #666; }
.action-data_create { background: #e3f2fd; color: #1565c0; }
.action-data_update { background: #fff8e1; color: #f57c00; }
.action-data_delete { background: #fce4ec; color: #c62828; }
.action-data_upload { background: #e3f2fd; color: #1565c0; }
.action-cmm, .action-cmm_session, .action-cmm_upload, .action-cmm_assign,
.action-cmm_template, .action-cmm_mapping, .action-cmm_generate, .action-cmm_download {
  background: #e0f2f1; color: #00695c;
}
.action-fi, .action-fi_session, .action-fi_guide, .action-fi_cmm, .action-fi_export {
  background: #f3e5f5; color: #6a1b9a;
}
.action-ppap, .action-ppap_export { background: #fff3e0; color: #e65100; }
.action-gdt, .action-gdt_ocr { background: #e8eaf6; color: #3949ab; }
.action-customer { background: #eceff1; color: #455a64; }

.admin-more-link {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}
.admin-more-link a {
  color: var(--primary);
  text-decoration: none;
}
.admin-more-link a:hover { text-decoration: underline; }

.audit-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}
.audit-filters .input {
  min-width: 0;
  flex: 0 1 auto;
}
.audit-filter-select { width: 180px; max-width: 100%; }
.audit-filter-q { flex: 1 1 220px; min-width: 160px; }
.audit-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.audit-pager-info {
  font-size: 0.86rem;
  color: var(--text-muted);
}
.audit-pager-btns { display: flex; gap: 0.5rem; }
.audit-detail-cell { max-width: 420px; }
.audit-detail-summary {
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
}
.audit-detail-meta {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.audit-logs-table td { vertical-align: top; }

.text-muted {
  font-size: 0.86rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0;
}
.hub-cards .hub-group-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* 暂无数据的 Hub 卡片 */
.hub-card.hub-card-empty {
  opacity: 0.56;
  pointer-events: auto;
}
.hub-card.hub-card-empty .hub-card-icon {
  background: var(--bg-page);
  color: var(--text-muted);
}
.hub-card.hub-card-empty .n {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 600;
}
.hub-card.hub-card-empty:hover {
  opacity: 0.8;
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

/* ===================================================================
   Design v3 — 简洁工作台（覆盖旧版顶栏/布局样式）
   =================================================================== */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-mid: #bfdbfe;
  --bg-body: #f8fafc;
  --bg-page: #f1f5f9;
  --bg-sidebar: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --topbar-h: 56px;
  --sidebar-w: 228px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* —— 顶栏：白底简洁 —— */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  flex-wrap: nowrap;
  padding: 0 1rem;
  gap: 0.75rem;
  background: #fff;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover {
  background: var(--bg-page);
  color: var(--text);
}

.topbar-logo { color: var(--text); }
.topbar-logo:hover { opacity: 1; color: var(--primary); }

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.95rem;
}

.logo-title { font-size: 0.92rem; color: var(--text); }
.logo-sub { display: none; }

.topbar-center {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  margin: 0 auto;
}

.cmd-search {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.75rem 0 2.25rem;
  min-height: 38px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.cmd-search:focus-within {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fff;
}

.cmd-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.cmd-search-input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-family: var(--font);
  color: var(--text);
  padding: 0.45rem 0;
  outline: none;
}
.cmd-search-input::placeholder { color: var(--text-muted); }
.cmd-search-input.ctx-input-scoped {
  font-weight: 600;
  color: var(--primary);
}

.cmd-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 500;
}

.ctx-chips-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.15rem 0;
}

.ctx-chips-inline .ctx-chip {
  border: 1px solid var(--primary-mid);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font);
}
.ctx-chips-inline .ctx-chip:hover { background: #dbeafe; }

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

.cmd-customer-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.cmd-customer-filter input { margin: 0; cursor: pointer; }

.customer-select,
.cmd-customer-select {
  height: 28px;
  max-width: 118px;
  padding: 0 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-page);
  color: var(--text);
  font-size: 0.75rem;
  font-family: var(--font);
  cursor: pointer;
  flex-shrink: 0;
}
.customer-select:disabled,
.cmd-customer-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.customer-select:not(:disabled):focus,
.cmd-customer-select:not(:disabled):focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  background: #fff;
}

.hub-breadcrumb {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}
.hub-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}
.hub-breadcrumb a:hover { text-decoration: underline; }

.customer-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.customer-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.customer-card:hover {
  border-color: var(--primary-mid);
  box-shadow: var(--shadow-sm);
}
.customer-card:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.customer-card-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.customer-card-total {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.customer-card-total .n {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.customer-card-total .n-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.customer-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.customer-stat-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--bg-page);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.customer-stat-pill strong {
  color: var(--text);
  font-weight: 700;
}
#customerEditDialog .form-field {
  margin-bottom: 0.85rem;
}
#customerEditDialog .form-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}
#customerEditDialog textarea.input {
  resize: vertical;
  min-height: 4rem;
}
.customer-edit-err {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--danger, #dc2626);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover:not(:disabled) {
  background: var(--bg-page);
  color: var(--primary);
}
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.topbar-user {
  color: var(--text);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
}
.topbar-user:hover { background: var(--bg-page); }

.user-avatar {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-mid);
}

.btn-login-entry {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}
.btn-login-entry:hover { background: var(--primary-hover); }

/* 隐藏旧版顶栏元素 */
.topbar-context,
.topbar-icon-btn,
.ctx-label,
.ctx-btn,
.ctx-check,
.topbar-context .ctx-select,
.topbar-context .ctx-input,
.ctx-part-wrap,
.ctx-chips:not(.ctx-chips-inline) { display: none !important; }

.customer-banner { display: none !important; }

.icon-btn .ico {
  font-size: 1.125rem;
}

.hub-card-icon .ico {
  font-size: 1.35rem;
}

/* 刷新按钮加载态 */
.icon-btn.is-loading .ico {
  animation: spin 0.7s linear infinite;
}
.loading-bar { display: none !important; }

.recent-part-item {
  display: none;
}

.recent-part-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.1rem 0.35rem 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: #fff;
  max-width: 100%;
  transition: border-color var(--transition), background var(--transition);
}
.recent-part-chip:hover {
  border-color: var(--primary-mid);
  background: var(--primary-light);
}
.recent-part-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  line-height: 1.35;
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-part-chip:hover .recent-part-link {
  color: var(--primary);
}
.recent-part-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition), color var(--transition);
}
.recent-part-remove:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}


/* —— Toast 错误 —— */
.toast-err,
.err {
  position: sticky;
  top: 0;
  z-index: 40;
  display: none;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.86rem;
  box-shadow: var(--shadow-sm);
}
.toast-err.visible,
.err.visible { display: block; }

/* —— 页头精简 —— */
.page-header {
  padding: 1rem 1.5rem 0.75rem;
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.page-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 60ch;
}
.page-route { display: none; }

.main-content {
  padding: 0 1.5rem 2rem;
}

/* —— 侧栏 —— */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.sidebar-inner {
  padding: 0.65rem 0.5rem 1rem;
}
.sidebar-footer {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border-light);
}
.sidebar-footer-text { display: none; }
.sidebar-planned-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.sidebar-planned-toggle input { accent-color: var(--primary); }

.sidebar-hint { display: none; }

.recent-parts {
  padding: 0 0.35rem 0.65rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-light);
}
.recent-parts-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.4rem;
}
.recent-part-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.1rem 0.35rem 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: #fff;
  max-width: 100%;
  transition: border-color var(--transition), background var(--transition);
}
.recent-part-link {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-part-chip:hover {
  border-color: var(--primary-mid);
  background: var(--primary-light);
}
.recent-part-chip:hover .recent-part-link {
  color: var(--primary);
}

.nav-item {
  padding: 0.52rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.nav-item[aria-current="true"] {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

body.sidebar-collapsed .sidebar {
  width: 0;
  overflow: hidden;
  border: none;
}
body.sidebar-collapsed .sidebar-toggle { color: var(--primary); }

/* —— 内容面板 —— */
.panel-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.panel-center {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 420px;
  margin: 2rem auto;
}
.panel-empty { max-width: 640px; }

.section-head { margin-bottom: 1rem; }
.pfd-flow-table .pfd-mark-col,
.pfd-flow-table .pfd-mark-cell {
  text-align: center;
  width: 3.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.pfd-mark-select {
  min-width: 3rem;
  text-align: center;
}

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.section-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.section-desc {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.subsection-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1.25rem 0 0.65rem;
}
.section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.text-muted { color: var(--text-muted); font-size: 0.84rem; }

.btn-auto { width: auto; }

/* —— Hub KPI —— */
.hub-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.hub-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
}
.hub-kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.hub-kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.hub-kpi.hub-kpi-accent {
  border-color: var(--primary-mid);
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
}

/* —— Hub 卡片 —— */
.hub-cards {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}
.hub-card {
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}
.hub-card:hover {
  transform: none;
  border-color: var(--primary-mid);
  box-shadow: var(--shadow-md);
}
.hub-card .hub-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.hub-card .n { font-size: 1.35rem; }
.hub-card-empty { opacity: 0.65; }
.hub-card-empty .n { color: var(--text-muted); }

.hub-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.hub-filter-check input { accent-color: var(--primary); }

.workflow-strip { display: none !important; }
.card-hub { border: none; box-shadow: none; padding: 0; background: transparent; }

/* —— 列表页 —— */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.list-search-field {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  margin: 0;
}
.field-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-with-icon { padding-left: 2rem !important; }
.list-meta { display: block; margin-top: 0.2rem; font-size: 0.78rem; }

.detail-head-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.detail-back { flex-shrink: 0; }

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.ppap-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}

.ppap-readiness-box {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-page);
}

.ppap-readiness-box.is-ready {
  border-color: #86efac;
  background: #f0fdf4;
}

.ppap-readiness-stats {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ppap-missing {
  color: #b91c1c;
}

.ppap-warn {
  color: #a16207;
}

.ppap-ready-ok {
  color: #15803d;
}

.ppap-ready-no {
  color: #b91c1c;
}

.welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.spinner-lg { width: 1.75rem; height: 1.75rem; margin: 1rem auto 0; }

/* —— 表格 —— */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-page);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}
.data-table tbody tr:nth-child(even) td { background: #eff6ff; }
.data-table tbody tr:nth-child(odd) td { background: #fff; }
.data-table tbody tr:hover td { background: #dbeafe !important; }
.data-table td { padding: 0.55rem 0.75rem; font-size: 0.84rem; }

.parts-summary-table .col-part-no { font-weight: 600; }
.row-incomplete td { background: #eff6ff !important; }
.row-incomplete:hover td { background: #dbeafe !important; }

/* —— 响应式 —— */
@media (max-width: 900px) {
  .topbar-center { max-width: none; }
  .customer-select { max-width: 110px; }
  .user-name, .user-role-badge { display: none; }
  body:not(.sidebar-collapsed) .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    bottom: 0;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 640px) {
  .page-header { padding: 0.75rem 1rem 0.5rem; }
  .main-content { padding: 0 1rem 1.5rem; }
  .panel-section { padding: 1rem; }
  .hub-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* 侧栏：统一各级字号与图标 */
.sidebar-nav {
  --nav-font-size: 0.9rem;
}
.sidebar-nav .nav-group-toggle,
.sidebar-nav a.nav-group-link,
.sidebar-nav .nav-item,
.sidebar-nav .nav-list .nav-item {
  font-size: var(--nav-font-size);
}
.sidebar-nav .ico {
  font-size: 1.15rem;
}
.sidebar-nav .nav-group-toggle .nav-group-label {
  gap: 0.52rem;
}
.sidebar-nav .nav-group-chev {
  width: 1.85rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

/* 终检数据录入 */
.fi-entry .fi-steps {
  margin-bottom: 1.25rem;
}
.fi-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.fi-checkboxes {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.fi-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.fi-upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.fi-table-wrap {
  max-height: 420px;
  overflow: auto;
}
.fi-table-wrap .input-sm {
  min-width: 4.5rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
}
.fi-status-err {
  color: var(--danger, #b91c1c);
}
.fi-panel + .fi-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #e2e8f0);
}

.fi-guide-section {
  margin-top: 1rem;
}
.fi-subtitle {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.fi-guide-table {
  max-height: 280px;
  overflow: auto;
}
.fi-guide-list .btn-link {
  white-space: nowrap;
}

/* 三坐标 → 尺寸报告 */
.cmm-export .cmm-row-map-wrap {
  max-height: 320px;
  overflow: auto;
}
.cmm-export .fi-subtitle {
  margin-top: 1.25rem;
}
.cmm-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}
.cmm-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cmm-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
}
.cmm-dot-ok { background: #2e7d4f; }
.cmm-dot-empty { background: #ccc; }
.cmm-dot-conflict { background: #e6a817; }
.cmm-grid-shell {
  position: relative;
  margin-bottom: 1rem;
}
.cmm-grid-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  color: var(--text-muted, #666);
  pointer-events: none;
}
.cmm-grid-loading.is-visible {
  display: flex;
}
.cmm-preview-grid-wrap {
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid var(--border-subtle, #ddd);
  border-radius: 6px;
}
.cmm-preview-grid {
  font-size: 0.82rem;
  border-collapse: separate;
  border-spacing: 0;
}
.cmm-preview-grid th,
.cmm-preview-grid td {
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle, #eee);
  border-right: 1px solid var(--border-subtle, #eee);
}
.cmm-preview-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-raised, #f5f5f5);
  font-weight: 600;
}
.cmm-sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface, #fff);
  min-width: 3rem;
  font-weight: 600;
}
.cmm-sticky-col2 {
  position: sticky;
  left: 3rem;
  z-index: 1;
  background: var(--surface, #fff);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmm-sticky-col3 {
  position: sticky;
  left: 13rem;
  z-index: 1;
  background: var(--surface, #fff);
  min-width: 3.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cmm-sticky-col4 {
  position: sticky;
  left: calc(13rem + 3.25rem);
  z-index: 1;
  background: var(--surface, #fff);
  min-width: 3.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cmm-tol-col {
  color: var(--text-muted, #64748b);
  font-size: 0.85rem;
}
.cmm-preview-grid thead .cmm-sticky-col,
.cmm-preview-grid thead .cmm-sticky-col2,
.cmm-preview-grid thead .cmm-sticky-col3,
.cmm-preview-grid thead .cmm-sticky-col4 {
  z-index: 3;
  background: var(--surface-raised, #f5f5f5);
}
.cmm-meas-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
}
.cmm-cell-ok {
  background: #e8f5ec;
  color: #1a5c34;
}
.cmm-cell-empty {
  background: #fafafa;
  color: #bbb;
}
.cmm-cell-conflict {
  background: #fff8e6;
  color: #9a6700;
}
.cmm-cell-out-of-range {
  background: #ffe8e8;
  color: #b42318;
  font-weight: 600;
}
.cmm-dot-out {
  background: #ef4444;
}
.cmm-append-hint {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--info-light);
  color: #1d4ed8;
  font-size: 0.78rem;
}
.cmm-meas-col-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  margin: 0.65rem 0 1rem;
}
.cmm-meas-col-card {
  flex: 1 1 auto;
  min-width: min(100%, 28rem);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  background: linear-gradient(180deg, var(--surface, #fff) 0%, var(--surface-raised, #f8fafc) 100%);
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.cmm-meas-col-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}
.cmm-meas-col-card-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.cmm-meas-col-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text, #0f172a);
}
.cmm-meas-col-card-sub {
  font-size: 0.72rem;
  line-height: 1.3;
}
.cmm-meas-col-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.cmm-meas-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  border: 1px solid transparent;
}
.cmm-meas-badge--auto {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.cmm-meas-badge--manual {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}
.cmm-meas-col-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 900px) {
  .cmm-meas-col-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .cmm-meas-col-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.cmm-meas-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 3.75rem;
  padding: 0.5rem 0.35rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-subtle, #e2e8f0);
  background: var(--surface, #fff);
  text-align: center;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.cmm-meas-kpi-label {
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}
.cmm-meas-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text, #0f172a);
}
.cmm-meas-kpi--base {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.cmm-meas-kpi--total {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}
.cmm-meas-kpi--total .cmm-meas-kpi-value {
  color: #1d4ed8;
}
.cmm-meas-kpi--blank {
  border-color: #e2e8f0;
  background: #fafafa;
}
.cmm-meas-kpi--blank .cmm-meas-kpi-value {
  color: #475569;
}
.cmm-meas-kpi--filled {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
}
.cmm-meas-kpi--filled .cmm-meas-kpi-value {
  color: #15803d;
}
.cmm-meas-kpi--new {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}
.cmm-meas-kpi--new .cmm-meas-kpi-value {
  color: #b45309;
}
.cmm-add-blank-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  min-height: 2.5rem;
  padding-inline: 0.85rem;
}
.cmm-add-blank-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: rgba(22, 100, 255, 0.12);
  color: var(--primary, #1664ff);
  font-weight: 700;
  line-height: 1;
}
.cmm-cell-editable {
  cursor: pointer;
}
.cmm-cell-editable:hover {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: -2px;
}
.cmm-cell-val {
  display: block;
  font-weight: 500;
}
.cmm-cell-src {
  display: block;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
  max-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmm-cell-editor {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cmm-cell-editor[hidden] {
  display: none !important;
}
.cmm-cell-editor-card {
  background: var(--surface, #fff);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  padding: 1rem 1.25rem;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow: auto;
}
.cmm-row-editable {
  cursor: pointer;
  color: var(--link, #2563eb);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.cmm-row-editable:hover {
  background: #eff6ff;
}
.cmm-map-show-all-rows {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin: 0.35rem 0 0.5rem;
  color: var(--text-muted, #64748b);
}
.cmm-cell-src--assign {
  color: var(--primary, #1664ff);
  font-style: italic;
}
.cmm-feat-preview {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text, #0f172a);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
}
.cmm-cell-editor-hint {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}
.cmm-cell-editor-card select[size] {
  min-height: 10rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}
.cmm-row-editor-card {
  width: min(520px, 100%);
}
.cmm-cell-editor-fields {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.cmm-assign-src {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  vertical-align: middle;
}
.cmm-row-parsing td {
  background: #f0f7ff;
}
.cmm-row-pending td {
  color: #888;
}
.cmm-status-parsing {
  color: #1d4ed8;
  font-style: italic;
}
.cmm-parse-ok {
  color: #2e7d4f;
  font-size: 0.82rem;
}
.cmm-num-toolbar {
  margin-bottom: 0.5rem;
}
.cmm-assign-table-wrap {
  max-height: 360px;
  overflow: auto;
  margin-bottom: 0.75rem;
}
.cmm-assign-hint {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.cmm-vendor-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.35rem;
}
.cmm-vendor-zeiss {
  background: #e8f0fe;
  color: #1a56db;
}
.cmm-vendor-hexagon {
  background: #fef3e2;
  color: #b45309;
}
.cmm-vendor-unknown {
  background: #f3f4f6;
  color: #6b7280;
}
.cmm-fill-progress {
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}
.cmm-export-name-field {
  min-width: 220px;
  flex: 1;
  max-width: 320px;
}
.cmm-done-name-row {
  max-width: 420px;
  margin: 0.75rem 0 1rem;
}
.cmm-mapping-drawer {
  margin-top: 0.5rem;
  border: 1px solid var(--border-subtle, #ddd);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.cmm-mapping-drawer summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.cmm-mapping-drawer-body {
  margin-top: 0.75rem;
}
.cmm-fname {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmm-preview-toolbar .cmm-arch-field {
  min-width: 160px;
}

/* 源文件预览（PDF / 模板） */
.cmm-file-preview-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 1rem;
  margin-top: 1rem;
  min-height: 420px;
}
.cmm-template-preview-layout {
  grid-template-columns: 1fr;
  min-height: 360px;
}
.cmm-file-view-panel-full {
  grid-column: 1 / -1;
}
.cmm-file-list-panel {
  border: 1px solid var(--border-subtle, #ddd);
  border-radius: 6px;
  padding: 0.5rem;
  overflow: auto;
  max-height: 520px;
}
.cmm-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cmm-file-list-item {
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  border-radius: 4px;
  cursor: pointer;
  word-break: break-all;
  line-height: 1.35;
}
.cmm-file-list-item:hover {
  background: var(--surface-raised, #f0f0f0);
}
.cmm-file-list-item.active {
  background: #e3f0ff;
  font-weight: 600;
}
.cmm-file-list-name {
  display: block;
}
.cmm-file-list-meta {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.15rem;
  font-weight: 400;
}
.cmm-upload-progress {
  margin: 0.75rem 0 1rem;
  max-width: 520px;
}
.cmm-upload-progress-bar {
  height: 8px;
  background: #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}
.cmm-upload-progress-fill {
  height: 100%;
  width: 0%;
  background: #1976d2;
  border-radius: 4px;
  transition: width 0.15s ease;
}
.cmm-upload-progress-text {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
}
.fi-upload-label.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.cmm-file-view-panel {
  border: 1px solid var(--border-subtle, #ddd);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  overflow: hidden;
}
.cmm-view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle, #ddd);
  background: var(--surface-raised, #f5f5f5);
}
.cmm-view-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
}
.cmm-view-tab.active {
  background: var(--surface, #fff);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent, #2563eb);
}
.cmm-view-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.cmm-pdf-iframe {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: none;
  background: #525659;
}
.cmm-parsed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  background: var(--surface-raised, #f8f8f8);
  border-bottom: 1px solid var(--border-subtle, #eee);
}
.cmm-parsed-table-wrap {
  max-height: 340px;
}
.cmm-sheet-preview-wrap {
  max-height: min(65vh, 520px);
  overflow: auto;
  border: 1px solid var(--border-subtle, #eee);
  border-radius: 4px;
}
.cmm-sheet-grid {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 100%;
}
.cmm-sheet-grid td {
  border: 1px solid #d0d0d0;
  padding: 0.2rem 0.4rem;
  vertical-align: middle;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 12rem;
}
.cmm-sheet-cell {
  background: #fff;
}
.cmm-sheet-merged {
  background: #fafafa;
  text-align: center;
}
.cmm-sheet-empty {
  background: #fefefe;
  min-width: 1.5rem;
}
@media (max-width: 900px) {
  .cmm-file-preview-layout {
    grid-template-columns: 1fr;
  }
  .cmm-source-split {
    grid-template-columns: 1fr;
  }
}
.cmm-source-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}
.cmm-sheet-preview-sm {
  max-height: 280px;
}
.cmm-pdf-iframe-sm {
  min-height: 280px;
  margin-top: 0.5rem;
}
.cmm-source-drawer {
  margin-bottom: 0.75rem;
}

/* CMM 向导体验优化 */
.cmm-export {
  padding-bottom: 4.5rem;
}
.cmm-wizard-head {
  margin-bottom: 1rem;
}
.cmm-progress-summary {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  text-align: center;
}
.cmm-step-bar .step-item {
  background: none;
  border: none;
  cursor: default;
  padding: 0;
  font: inherit;
  width: 100%;
}
.cmm-step-bar .step-item:not([disabled]) {
  cursor: pointer;
}
.cmm-step-bar .step-item:not([disabled]):hover .step-label {
  color: var(--primary);
}
.cmm-step-bar .step-item.error .step-dot {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b42318;
}
.cmm-resume-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
}
.cmm-resume-modal.is-visible {
  display: flex;
}
.cmm-resume-card {
  background: var(--bg-card, #fff);
  border-radius: var(--radius-lg, 8px);
  padding: 1.25rem 1.5rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
}
.cmm-resume-card h4 {
  margin: 0 0 0.5rem;
}
.cmm-dropzone {
  border: 2px dashed var(--border, #cbd5e1);
  border-radius: var(--radius-lg, 8px);
  padding: 2rem 1.5rem;
  text-align: center;
  margin: 1rem 0;
  transition: border-color 0.15s, background 0.15s;
}
.cmm-dropzone.is-dragover {
  border-color: var(--primary);
  background: rgba(22, 100, 255, 0.04);
}
.cmm-dropzone.is-busy {
  opacity: 0.65;
  pointer-events: none;
}
.cmm-dropzone-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
}
.cmm-dropzone-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}
.cmm-auto-advance-opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.cmm-upload-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.cmm-upload-file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  background: var(--surface-raised, #f8fafc);
}
.cmm-upload-file-item.is-done { background: #ecfdf3; }
.cmm-upload-file-item.is-error { background: #fef2f2; }
.cmm-upload-file-item.is-parsing { background: #eff6ff; }
.cmm-upload-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmm-upload-file-meta {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
}
.cmm-parsing-banner {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.85rem;
}
.cmm-parsing-banner.is-warn {
  background: #fff8e6;
  color: #9a6700;
}
.cmm-global-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 1.25rem;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
  font-size: 0.82rem;
}
.cmm-dock-stat {
  color: var(--text-secondary, #475569);
}
.cmm-dock-add {
  margin-left: auto;
}
.cmm-status-line {
  margin-bottom: 3rem;
}
.cmm-tpl-picker {
  margin-top: 0.75rem;
}
.cmm-sheet-select-row {
  margin: 0.75rem 0 0.25rem;
  max-width: 28rem;
}
.cmm-sheet-select-row .form-field {
  margin: 0;
}
.cmm-sheet-select-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}
.cmm-tpl-search-row {
  align-items: end;
  margin-bottom: 0.75rem;
}
.cmm-tpl-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}
.cmm-tpl-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.cmm-tpl-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.cmm-offset-banner {
  padding: 0.55rem 0.75rem;
  margin: 0.75rem 0;
  border-radius: 6px;
  background: #ecfdf3;
  color: #166534;
  font-size: 0.85rem;
  border: 1px solid #bbf7d0;
}
.cmm-tpl-panel-body {
  position: relative;
  min-height: 12rem;
}
.cmm-tpl-panel-body.is-loading-template,
#cmmPanelTemplate.is-loading-template .cmm-tpl-panel-body {
  pointer-events: none;
}
#cmmPanelTemplate.is-loading-template .cmm-tpl-panel-body > *:not(.cmm-tpl-loading) {
  opacity: 0.45;
  filter: grayscale(0.15);
}
.cmm-tpl-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
  border-radius: 8px;
}
.cmm-tpl-loading[hidden] {
  display: none !important;
}
.cmm-tpl-loading.is-visible {
  display: flex;
}
.cmm-tpl-loading-card {
  text-align: center;
  padding: 1.5rem 2rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-width: 22rem;
}
.cmm-tpl-loading-title {
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.cmm-tpl-loading-hint {
  margin: 0;
  font-size: 0.82rem;
}
.cmm-arch-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.cmm-arch-card {
  display: block;
  cursor: pointer;
}
.cmm-arch-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cmm-arch-card-body {
  display: block;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-subtle, #ddd);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.35;
}
.cmm-arch-card input:checked + .cmm-arch-card-body {
  border-color: var(--primary);
  background: rgba(22, 100, 255, 0.06);
}
.cmm-arch-card-body small {
  display: block;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.cmm-arch-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.cmm-grid-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.cmm-filter-chip,
.cmm-summary-chip {
  border: 1px solid var(--border-subtle, #ddd);
  background: var(--surface, #fff);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.cmm-filter-chip.active,
.cmm-summary-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.cmm-filter-chip.active {
  background: rgba(22, 100, 255, 0.08);
  font-weight: 600;
}
.cmm-summary-chip {
  margin-right: 0.15rem;
}
.cmm-summary-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.cmm-filter-empty {
  text-align: center;
  padding: 1.5rem;
}
.cmm-map-search {
  width: 100%;
  max-width: 320px;
  margin-bottom: 0.75rem;
}
.cmm-parsed-search-row {
  padding: 0.35rem 0.5rem 0;
}
.cmm-row-actions {
  white-space: nowrap;
}
.cmm-field-hint {
  font-size: 0.82rem;
  margin-top: 0.25rem;
}
.cmm-export-history-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
}
.cmm-export-history-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-subtle, #eee);
}

/* ===================================================================
   Design v4 — 交互增强（Toast / 加载 / 快捷键 / 动效）
   =================================================================== */

.text-muted {
  text-align: inherit;
  padding: 0;
}

.toast-err { display: none !important; }

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-md);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  flex-shrink: 0;
  margin-top: 0.05rem;
  font-size: 1rem;
  line-height: 1;
}

.toast-error .toast-icon { color: var(--danger); }
.toast-success .toast-icon { color: var(--success); }
.toast-info .toast-icon { color: var(--info, #3b82f6); }

.toast-body { flex: 1; min-width: 0; word-break: break-word; }

.toast-close {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition), color var(--transition);
}
.toast-close:hover {
  background: var(--bg-page);
  color: var(--text);
}

.cmd-kbd {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  line-height: 1.3;
  pointer-events: none;
  user-select: none;
}

.cmd-search:focus-within .cmd-kbd {
  opacity: 0.35;
}

.suggest button.is-active,
.suggest button:focus-visible {
  background: var(--primary-light);
  color: var(--primary);
  outline: none;
}

.view-panel:not([hidden]) {
  animation: view-enter 0.16s ease;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 系统设置（微盘同步） ===== */
.sysset-page {
  max-width: 1120px;
  margin: 0 auto;
  animation: view-enter 0.2s ease;
}

.sysset-ico {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}

.sysset-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f8faff 0%, #eef3ff 48%, #f5f8ff 100%);
  border: 1px solid var(--primary-mid);
  box-shadow: var(--shadow-sm);
}

.sysset-hero-main {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex: 1;
  min-width: 240px;
}

.sysset-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
  flex-shrink: 0;
}
.sysset-hero-icon .sysset-ico { width: 26px; height: 26px; }

.sysset-hero-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.sysset-hero-desc {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
  max-width: 52ch;
  line-height: 1.5;
}

.sysset-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sysset-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.sysset-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.sysset-btn-icon.is-busy { opacity: 0.75; pointer-events: none; }
#wsRefreshBtn.is-spinning .sysset-ico {
  animation: sysset-spin 0.8s linear infinite;
}
@keyframes sysset-spin { to { transform: rotate(360deg); } }

.sysset-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.sysset-pill--sm { font-size: 0.7rem; padding: 0.12rem 0.5rem; }
.sysset-pill--on { background: var(--success-light); color: #047857; }
.sysset-pill--off { background: #f1f5f9; color: var(--text-muted); }
.sysset-pill--ok { background: var(--success-light); color: #047857; }
.sysset-pill--err { background: var(--danger-light); color: #b91c1c; }
.sysset-pill--idle { background: var(--info-light); color: #1d4ed8; }

.sysset-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.sysset-metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.65rem;
  text-align: center;
  transition: box-shadow var(--transition);
}
.sysset-metric:hover { box-shadow: var(--shadow-xs); }

.sysset-metric-val {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--primary);
}
.sysset-metric--green .sysset-metric-val { color: var(--success); }
.sysset-metric--amber .sysset-metric-val { color: var(--warning); }
.sysset-metric--red .sysset-metric-val { color: var(--danger); }
.sysset-metric--teal .sysset-metric-val { color: #0d9488; }
.sysset-metric--blue .sysset-metric-val { color: var(--info); }
.sysset-metric--muted .sysset-metric-val { color: var(--text-muted); }

.sysset-metric-lbl {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.sysset-run-log {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.82rem;
}
.sysset-run-log-label {
  font-weight: 700;
  color: var(--text-secondary);
}
.sysset-run-log-time {
  font-family: var(--font-mono);
  color: var(--text);
}
.sysset-run-log-msg {
  color: var(--text-muted);
  flex: 1 1 100%;
  font-size: 0.8rem;
  line-height: 1.45;
}

.sysset-api-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.sysset-api-status--ok { border-color: #86efac; background: #f0fdf4; }
.sysset-api-status--err { border-color: #fca5a5; background: #fef2f2; }
.sysset-api-status--idle { border-color: #fcd34d; background: #fffbeb; }
.sysset-api-status-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  grid-column: 1;
}
.sysset-api-status-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text);
}
.sysset-api-chip {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.05);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}
.sysset-api-status-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.sysset-api-status-meta .sysset-mono {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.sysset-api-checked { margin-left: auto; }
#wsProbeApiBtn { grid-column: 2; grid-row: 1; }

.sysset-pending {
  margin: 0.85rem 0 1rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.sysset-pending--alert {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, var(--bg-card) 48%);
}
.sysset-pending--ok {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #ecfdf5 0%, var(--bg-card) 55%);
}
.sysset-pending-head { margin-bottom: 0.75rem; }
.sysset-pending-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}
.sysset-pending-desc {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.sysset-pending-name {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sysset-pending-acts {
  white-space: nowrap;
  display: flex;
  gap: 0.35rem;
}
.sysset-pending-more {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sysset-logs-section {
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}
.sysset-logs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.sysset-logs-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.sysset-logs-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.sysset-logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.sysset-logs-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  white-space: nowrap;
}
.sysset-logs-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.sysset-log-time {
  font-family: var(--font-mono);
  white-space: nowrap;
  color: var(--text);
}
.sysset-log-cat { white-space: nowrap; color: var(--text-secondary); }
.sysset-log-msg { line-height: 1.45; color: var(--text); min-width: 220px; }
.sysset-log-details {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  word-break: break-all;
}
.sysset-log-level {
  display: inline-flex;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.sysset-log-level--info { background: #dbeafe; color: #1d4ed8; }
.sysset-log-level--warn { background: #fef3c7; color: #b45309; }
.sysset-log-level--err { background: #fee2e2; color: #b91c1c; }
.sysset-log-level--muted { background: #f1f5f9; color: #64748b; }
.sysset-empty--compact { padding: 1.25rem; }

.sysset-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sysset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}

.sysset-card-head { margin-bottom: 1rem; }
.sysset-card-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}
.sysset-card-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sysset-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
  flex: 1;
}

.sysset-field { display: flex; flex-direction: column; gap: 0.35rem; }
.sysset-field--full { grid-column: 1 / -1; }

.sysset-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.sysset-label small {
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.sysset-optional {
  font-style: normal;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.sysset-hint {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.sysset-mono { font-family: var(--font-mono); font-size: 0.86rem; }

.sysset-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-page);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.sysset-switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}
.sysset-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.sysset-switch-track {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: #cbd5e1;
  transition: background var(--transition);
  position: relative;
}
.sysset-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--transition);
}
.sysset-switch input:checked + .sysset-switch-track {
  background: var(--primary);
}
.sysset-switch input:checked + .sysset-switch-track::after {
  transform: translateX(20px);
}
.sysset-switch input:focus-visible + .sysset-switch-track {
  box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.25);
}

.sysset-interval-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sysset-interval-input { max-width: 140px; }
.sysset-interval-unit {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.sysset-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.sysset-preset {
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 0.22rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.sysset-preset:hover {
  border-color: var(--primary-mid);
  color: var(--primary);
}
.sysset-preset.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.sysset-card-foot {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.sysset-save-msg {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
}

.sysset-rules-section { margin-top: 0.25rem; }

.sysset-rules-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.sysset-section-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.sysset-section-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 56ch;
}

.sysset-rules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
}

.sysset-rule {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.05rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.sysset-rule:hover {
  border-color: var(--primary-mid);
  box-shadow: var(--shadow-sm);
}
.sysset-rule.is-disabled {
  opacity: 0.72;
  background: #fafbfc;
}

.sysset-rule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.sysset-rule-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}
.sysset-rule-order {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.sysset-rule-name {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}
.sysset-rule-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.btn-sm {
  padding: 0.28rem 0.55rem !important;
  font-size: 0.76rem !important;
}

.sysset-kind {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-full);
}
.sysset-kind--blue { background: #dbeafe; color: #1d4ed8; }
.sysset-kind--teal { background: #ccfbf1; color: #0f766e; }
.sysset-kind--purple { background: #ede9fe; color: #6d28d9; }
.sysset-kind--amber { background: #fef3c7; color: #b45309; }

.sysset-rule-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
}
.sysset-rule-meta-item { display: contents; }
.sysset-rule-meta dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
}
.sysset-rule-meta dd {
  margin: 0;
  text-align: right;
  color: var(--text);
}
.sysset-rule-meta code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-page);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-xs);
}

.sysset-rule-kws {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.sysset-kw {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.sysset-kw-empty {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-style: italic;
}

.sysset-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.sysset-empty-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.sysset-empty-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: var(--text);
}
.sysset-empty-desc {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
}

.sysset-dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.sysset-dialog-grid .sysset-field--full { grid-column: 1 / -1; }

.sysset-loading .sysset-skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f8f9fb 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: sysset-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-lg);
}
.sysset-skeleton--hero { height: 120px; margin-bottom: 1rem; }
.sysset-skeleton-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.sysset-skeleton--card { height: 220px; }
.sysset-skeleton--rules { height: 160px; }
@keyframes sysset-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.sysset-error {
  padding: 2rem;
  text-align: center;
}
.sysset-error h3 { margin: 0 0 0.5rem; }

@media (max-width: 900px) {
  .sysset-layout { grid-template-columns: 1fr; }
  .sysset-fields { grid-template-columns: 1fr; }
  .sysset-metrics { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  .sysset-hero { padding: 1rem; }
  .sysset-hero-actions { width: 100%; }
  .sysset-hero-actions .btn-auto { flex: 1; justify-content: center; }
  .sysset-metrics { grid-template-columns: repeat(2, 1fr); }
  .sysset-rules { grid-template-columns: 1fr; }
  .sysset-dialog-grid { grid-template-columns: 1fr; }
  .sysset-skeleton-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .toast-host {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
  .cmd-kbd { display: none; }
}


/* ---- 公差标注识别 ---- */
.gdt-ocr { padding-bottom: 2rem; }
.gdt-status { margin: 0 0 1rem; font-size: 0.88rem; }
.gdt-status.ok { color: #157347; }
.gdt-status.warn { color: #9a6700; }
.gdt-status.err { color: #b42318; }
.gdt-status a { color: inherit; text-decoration: underline; }
.gdt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.gdt-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
}
.gdt-card-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.gdt-upload {
  border: 2px dashed var(--border, #d1d5db);
  border-radius: 10px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2, #f8fafc);
  transition: border-color 0.15s, background 0.15s;
}
.gdt-upload:hover,
.gdt-upload.dragover {
  border-color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.04);
}
.gdt-upload-icon { font-size: 1.75rem; color: var(--muted, #64748b); margin-bottom: 0.5rem; }
.gdt-upload .small { margin-top: 0.35rem; font-size: 0.8rem; }
.gdt-preview {
  margin-top: 0.85rem;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a08;
}
.gdt-preview img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}
.gdt-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.gdt-controls input[type="range"] { flex: 1; min-width: 100px; }
.gdt-conf-val {
  font-variant-numeric: tabular-nums;
  min-width: 2.4rem;
  text-align: right;
}
.gdt-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  color: var(--muted, #64748b);
  font-size: 0.88rem;
}
.gdt-loading[hidden],
.gdt-error[hidden],
.gdt-preview[hidden],
.gdt-annotated[hidden] {
  display: none !important;
}
.gdt-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: gdt-spin 0.8s linear infinite;
}
@keyframes gdt-spin { to { transform: rotate(360deg); } }
.gdt-error {
  margin-top: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b42318;
  font-size: 0.88rem;
}
.gdt-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted, #64748b);
}
.gdt-layout-box {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.gdt-layout-text {
  font-family: "Cambria Math", "Segoe UI Symbol", "Consolas", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 1.02rem;
}
.gdt-label {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
  margin-bottom: 0.35rem;
}
.gdt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.gdt-stat {
  background: var(--surface-2, #f8fafc);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.gdt-stat-val { font-weight: 600; font-size: 1.05rem; }
.gdt-stat-val.mono {
  font-family: "Cambria Math", "Segoe UI Symbol", monospace;
  font-size: 0.92rem;
  font-weight: 500;
}
.gdt-annotated {
  display: block;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #0f172a08;
}
.gdt-subhead { margin: 0 0 0.5rem; font-size: 0.9rem; }
.gdt-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.8rem;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}
.gdt-table { font-size: 0.85rem; }
@media (max-width: 900px) {
  .gdt-grid { grid-template-columns: 1fr; }
}
