/* ========================================
   Ozon 跨境运营中枢 v7.1 — Light/Dark Dual Theme
   ======================================== */

/* ---- Light Theme (default) ---- */
:root {
  --bg: #f0f2f5;
  --bg2: #e4e6eb;
  --surface: #ffffff;
  --surface2: #f5f6f8;
  --surface3: #ebecef;
  --border: rgba(0,0,0,0.06);
  --border2: rgba(0,0,0,0.10);
  --text: #1c1c1e;
  --text2: #6e6e73;
  --text3: #a1a1a6;
  --accent: #3b82f6;
  --accent2: #2563eb;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --glass: rgba(0,0,0,0.03);
  --glass2: rgba(255,255,255,0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --sh: 0 4px 24px rgba(0,0,0,0.08);
  --sh-sm: 0 2px 8px rgba(0,0,0,0.06);
  --sh-inset: inset 0 1px 2px rgba(0,0,0,0.04);
  --trans: 0.2s cubic-bezier(0.4,0,0.2,1);
  --sidebar-w: 220px;
  --content-pad: 32px;
}

/* ---- Dark Theme ---- */
html[data-theme="dark"] {
  --bg: #0a0a12;
  --bg2: #141420;
  --surface: #141420;
  --surface2: #1a1a28;
  --surface3: #222233;
  --border: rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.10);
  --text: #e8e8ed;
  --text2: #9898a8;
  --text3: #686878;
  --glass: rgba(255,255,255,0.04);
  --glass2: rgba(0,0,0,0.3);
  --sh: 0 4px 24px rgba(0,0,0,0.3);
  --sh-sm: 0 2px 8px rgba(0,0,0,0.2);
  --sh-inset: inset 0 1px 2px rgba(255,255,255,0.03);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-font-smoothing:antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background var(--trans), color var(--trans);
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select { font-family: inherit; outline: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text3); border-radius: 3px; }

/* ---- Page switching ---- */
.page { display: none !important; }
.page.active { display: flex !important; animation: fade .3s ease; }
@keyframes fade { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--trans);
}
.theme-toggle:hover { transform: scale(1.1); }

/* ---- Login ---- */
#login-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
  overflow: auto;
}
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(168,85,247,0.08) 0%, transparent 50%),
    var(--bg);
}
.login-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 400px;
  min-width: 320px;
  text-align: center;
  box-shadow: var(--sh);
  animation: slideUp .5s ease;
  box-sizing: border-box;
}
.login-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.login-icon svg { width: 32px; height: 32px; }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.login-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }

/* Input with icon */
.input-wrap {
  position: relative;
  margin-bottom: 12px;
}
.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--text3);
  pointer-events: none;
  transition: stroke var(--trans);
}
.input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: all var(--trans);
  box-sizing: border-box;
}
.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.input-wrap:focus-within .input-icon { stroke: var(--accent); }

/* Remember password */
.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 16px;
  cursor: pointer;
  user-select: none;
  text-align: left;
}
.remember-row input { display: none; }
.check-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
  flex-shrink: 0;
}
.check-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0;
  transition: opacity var(--trans);
}
.remember-row input:checked + .check-box {
  background: var(--accent);
  border-color: var(--accent);
}
.remember-row input:checked + .check-box::after { opacity: 1; }
.remember-label { font-size: 13px; color: var(--text2); }

.btn-login {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 20px; }
.login-footer {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  width: 100%;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  transition: all var(--trans);
}
.btn:hover { background: var(--accent2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: var(--surface3); color: var(--text); }
.btn-secondary:hover { background: var(--border2); }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 6px; width: auto;
  background: var(--surface3); color: var(--text); transition: all var(--trans); }
.btn-sm:hover { background: var(--accent); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ---- Sidebar ---- */
#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--glass2);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s ease, background var(--trans), border-color var(--trans);
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 12px;
  font-size: 17px; font-weight: 700;
  color: var(--text);
}
.sb-logo {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.sb-logo svg { width: 16px; height: 16px; fill: #fff; }
#sb-nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
#sb-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--trans);
}
#sb-nav a:hover { background: var(--glass); color: var(--text); }
#sb-nav a.active { background: var(--accent); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
  background: var(--red); color: #fff;
}
.sb-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sb-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
#sb-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700;
}

/* ---- Mobile ---- */
.mobile-toggle { display: none; }
.sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

/* ---- Main ---- */
#main {
  margin-left: var(--sidebar-w);
  padding: var(--content-pad);
  min-height: 100vh;
}
.module { display: none; }
.module.active { display: block; animation: slideUp .35s ease; }

.mod-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.mod-header h2 { font-size: 28px; font-weight: 700; color: var(--text); }
.mod-date { font-size: 13px; color: var(--text3); padding: 6px 14px; background: var(--surface); border-radius: 20px; border: 1px solid var(--border); }

.badge {
  font-size: 12px; padding: 4px 12px; border-radius: 20px;
  background: var(--accent); color: #fff; font-weight: 600;
}

/* ---- Cards & Panels ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: background var(--trans), border-color var(--trans);
}
.panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all var(--trans);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-size: 20px; }
.stat-card .stat-value { font-size: 30px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.stat-card .stat-label { font-size: 12px; color: var(--text2); }

.chart-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-bottom: 20px; }
.chart-wrap { height: 240px; position: relative; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; transition: border-color var(--trans); }
table th { color: var(--text3); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
table tr:hover { background: var(--glass); }

.status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-ok { background: rgba(34,197,94,0.12); color: var(--green); }
.status-warn { background: rgba(245,158,11,0.12); color: var(--orange); }
.status-bad { background: rgba(239,68,68,0.12); color: var(--red); }
.status-info { background: rgba(59,130,246,0.12); color: var(--accent); }
.status-neutral { background: rgba(128,128,128,0.08); color: var(--text2); }

.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.health-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.health-dot.orange { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.health-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ---- Pipeline ---- */
.pipe-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--surface2); border-radius: 10px; padding: 4px;
  border: 1px solid var(--border); width: fit-content;
}
.pipe-tab {
  padding: 9px 22px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: var(--text2); background: transparent; transition: all var(--trans);
}
.pipe-tab.active { background: var(--accent); color: #fff; }
.pipe-tab:hover:not(.active) { background: var(--glass); color: var(--text); }
.pipe-panel { display: none; }
.pipe-panel.active { display: block; animation: slideUp .3s ease; }

.pipeline-steps {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.pipeline-steps .step {
  flex: 1; min-width: 100px;
  padding: 14px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  position: relative;
  transition: all var(--trans);
}
.pipeline-steps .step.active { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,0.06); }
.pipeline-steps .step.done { border-color: var(--green); color: var(--green); }
.pipeline-steps .step .step-num { font-size: 20px; font-weight: 700; display: block; margin-bottom: 4px; }

.flex-row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.flex-2 {}
.flex-1 {}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%; padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: all var(--trans);
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.muted { color: var(--text3); font-size: 13px; }

/* ---- Batch Selection ---- */
.batch-search-row {
  display: flex; gap: 12px; align-items: flex-end;
}
.batch-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.batch-pagination {
  display: flex; justify-content: center; gap: 4px; margin-top: 14px;
}
.batch-pagination button {
  padding: 7px 14px; border-radius: 6px; font-size: 13px;
  background: var(--surface2); color: var(--text2); border: 1px solid var(--border);
  transition: all var(--trans);
}
.batch-pagination button:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.batch-pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.batch-pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* KMS 知识库灵感词 chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-block; padding: 5px 12px; border-radius: 14px;
  background: var(--surface2); color: var(--text1); border: 1px solid var(--border);
  font-size: 12px; cursor: pointer; transition: all var(--trans); user-select: none;
}
.chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-1px); }
.chip-accent { background: rgba(99,102,241,0.1); color: var(--accent); border-color: rgba(99,102,241,0.25); }
.chip-accent:hover { background: var(--accent); color: #fff; }

/* ── KMS 灵感面板：类目分组热词（v7.4.6 美化版） ── */
.kms-cat-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: all var(--trans);
  position: relative;
  overflow: hidden;
}
.kms-cat-group::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 2px 0 0 2px;
}
.kms-cat-group:hover { box-shadow: var(--sh-sm); border-color: var(--border2); }
.kms-cat-group[data-cat="home_storage"]::before { background: linear-gradient(180deg, #3b82f6, #60a5fa); }
.kms-cat-group[data-cat="kitchen"]::before { background: linear-gradient(180deg, #f59e0b, #fbbf24); }
.kms-cat-group[data-cat="electronics"]::before { background: linear-gradient(180deg, #8b5cf6, #a78bfa); }
.kms-cat-group[data-cat="beauty"]::before { background: linear-gradient(180deg, #ec4899, #f472b6); }
.kms-cat-group[data-cat="sports"]::before { background: linear-gradient(180deg, #22c55e, #4ade80); }
.kms-cat-group[data-cat="clothing"]::before { background: linear-gradient(180deg, #06b6d4, #22d3ee); }
.kms-cat-group[data-cat="tools"]::before { background: linear-gradient(180deg, #64748b, #94a3b8); }
.kms-cat-group[data-cat="toys"]::before { background: linear-gradient(180deg, #f97316, #fb923c); }
.kms-cat-group[data-cat="auto"]::before { background: linear-gradient(180deg, #6366f1, #818cf8); }
.kms-cat-group[data-cat="garden"]::before { background: linear-gradient(180deg, #059669, #34d399); }
.kms-cat-group[data-cat="office"]::before { background: linear-gradient(180deg, #78716c, #a8a29e); }
.kms-cat-group[data-cat="pet"]::before { background: linear-gradient(180deg, #e11d48, #fb7185); }
.kms-cat-group[data-cat="baby"]::before { background: linear-gradient(180deg, #d946ef, #e879f9); }
.kms-cat-group[data-cat="health"]::before { background: linear-gradient(180deg, #0369a1, #38bdf8); }
.kms-cat-group[data-cat="food"]::before { background: linear-gradient(180deg, #ea580c, #fdba74); }

.kms-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-left: 2px;
}
.kms-cat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}
.kms-cat-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  background: var(--surface2);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* 词云：flex 横排 chip 布局 */
.kms-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 2px;
}
.kms-word-row {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all .18s ease;
  max-width: 100%;
}
.kms-word-row:hover {
  border-color: var(--accent);
  background: rgba(59,130,246,.04);
  box-shadow: 0 1px 6px rgba(59,130,246,.1);
  transform: translateY(-1px);
}
.kms-word {
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 5px 10px 5px 12px;
  white-space: nowrap;
  transition: color .18s ease;
  line-height: 1.4;
}
.kms-word:hover { color: var(--accent); }
.kms-collect-btn {
  flex-shrink: 0;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 0 20px 20px 0;
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.kms-word-row:hover .kms-collect-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.kms-collect-btn:hover { background: var(--accent2) !important; }
.kms-collect-btn:disabled { opacity: .45; cursor: default; background: transparent !important; color: var(--text3) !important; }
.kms-more-btn {
  display: inline-flex;
  margin-top: 6px;
  margin-left: 2px;
  font-size: 11px;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px dashed var(--border2);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all .18s ease;
  letter-spacing: .02em;
}
.kms-more-btn:hover { color: var(--accent); border-color: var(--accent); background: rgba(59,130,246,.03); }

/* Queue item */
.queue-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface2); border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 13px; transition: all var(--trans);
}
.queue-item:hover { border-color: var(--accent); }
.queue-item .qi-title { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .qi-price { color: var(--accent); font-weight: 600; white-space: nowrap; }
.queue-item .qi-remove {
  width: 24px; height: 24px; border-radius: 50%; background: transparent;
  color: var(--text3); font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); cursor: pointer; flex-shrink: 0;
}
.queue-item .qi-remove:hover { background: rgba(239,68,68,.1); color: var(--red); }

/* Result row hover */
#batch-results tr.selected { background: rgba(59,130,246,.06); }

.search-box {
  position: relative; display: flex; align-items: center;
}
.search-box svg {
  position: absolute; left: 12px;
  width: 16px; height: 16px;
  stroke: var(--text3); pointer-events: none;
}
.search-input {
  padding: 10px 14px 10px 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  width: 260px;
  transition: all var(--trans);
}
.search-input:focus { border-color: var(--accent); width: 320px; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 8px; padding: 3px; border: 1px solid var(--border); }
.tab-btn {
  padding: 7px 16px; border-radius: 6px;
  font-size: 13px; color: var(--text2);
  background: transparent; transition: all var(--trans);
}
.tab-btn.active { background: var(--accent); color: #fff; }

/* ---- Compliance Cards ---- */
.compliance-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.compliance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--trans);
}
.compliance-card h4 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.compliance-card .severity {
  font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600;
}
.severity-critical { background: rgba(239,68,68,0.12); color: var(--red); }
.severity-high { background: rgba(245,158,11,0.12); color: var(--orange); }
.severity-medium { background: rgba(59,130,246,0.12); color: var(--accent); }
.compliance-card p { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ---- Alerts ---- */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all var(--trans);
}
.alert-item:hover { border-color: var(--border2); }
.alert-item .al-icon { font-size: 20px; flex-shrink: 0; }
.alert-item .al-body { flex: 1; }
.alert-item .al-title { font-size: 14px; font-weight: 600; color: var(--text); }
.alert-item .al-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.alert-item .al-time { font-size: 11px; color: var(--text3); white-space: nowrap; }

/* ---- Settings Grid ---- */
.settings-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.setting-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--trans);
}
.setting-item:last-child { border-bottom: none; }
.setting-item .sl { font-size: 14px; color: var(--text); }
.setting-item .sr { font-size: 13px; color: var(--text2); }

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--surface3);
  color: var(--text);
  border-radius: 24px;
  font-size: 14px;
  box-shadow: var(--sh);
  opacity: 0;
  transition: all .3s ease;
  z-index: 3000;
  pointer-events: none;
  border: 1px solid var(--border);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.ok { background: var(--green); color: #fff; border-color: transparent; }
#toast.err { background: var(--red); color: #fff; border-color: transparent; }

/* ---- Test Batch (v7.3) ---- */
#test-batches tr.selected { background: rgba(59,130,246,.06); }
#test-batches tr { cursor: pointer; }

.tb-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.tb-modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 480px;
  box-shadow: var(--sh); border: 1px solid var(--border);
  animation: slideUp .3s ease;
}
.tb-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

/* 批次详情 */
.tb-info-card {
  padding: 10px 12px; background: var(--surface2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.tb-info-label { font-size: 11px; color: var(--text3); margin-bottom: 2px; }
.tb-info-value { font-size: 13px; font-weight: 600; }

.tb-stat-mini {
  text-align: center; padding: 10px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* 策略卡片 */
.strategy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.strategy-card {
  padding: 16px; background: var(--surface2); border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: all var(--trans);
}
.strategy-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.sc-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sc-icon { font-size: 22px; }
.sc-header strong { font-size: 14px; }
.sc-risk {
  font-size: 10px; padding: 2px 7px; border-radius: 8px; margin-left: auto; font-weight: 600;
}
.sc-risk-low    { background: rgba(34,197,94,.12); color: var(--green); }
.sc-risk-medium { background: rgba(245,158,11,.12); color: var(--orange); }
.sc-risk-high   { background: rgba(239,68,68,.12); color: var(--red); }
.sc-desc { font-size: 12px; color: var(--text2); line-height: 1.5; margin: 0; }
.sc-meta { font-size: 11px; color: var(--text3); margin-top: 8px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .chart-row { grid-template-columns: 1fr; }
  .flex-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --content-pad: 16px; }
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  .mobile-toggle { display: flex; position: fixed; top: 12px; left: 12px; z-index: 101;
    width: 40px; height: 40px; border-radius: 8px; background: var(--surface); color: var(--text);
    align-items: center; justify-content: center; border: 1px solid var(--border); }
  .mobile-toggle svg { width: 18px; height: 18px; }
  .sb-overlay.active { display: block; }
  #main { margin-left: 0; padding-top: 60px; }
  .mod-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mod-header h2 { font-size: 22px; }
  .stat-row { grid-template-columns: 1fr; }
  .compliance-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .theme-toggle { top: auto; bottom: 16px; right: 16px; }
}

/* ── Module v7.4: 详情 / 操作 / 筛选 ── */
.form-control { padding:8px 12px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface2); color:var(--text); font-size:14px; font-family:inherit; }
.kv-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px 16px; }
.kv { display:flex; flex-direction:column; gap:4px; padding:10px 12px; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); }
.kv .k { font-size:12px; color:var(--text3); }
.kv .v { font-size:14px; font-weight:600; color:var(--text); word-break:break-all; }
.row-actions, .al-actions { display:flex; gap:6px; flex-wrap:wrap; white-space:nowrap; }
.al-actions { justify-content:flex-end; }
@media (max-width: 768px) {
  .kv-grid { grid-template-columns: 1fr; }
}

/* ── 动画增强 (v7.4.3) ── */
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes scaleIn { from { transform:scale(0.85); opacity:0; } to { transform:scale(1); opacity:1; } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: skeleton-shim 1.5s infinite; }
@keyframes skeleton-shim { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
.order-badge { display:inline-block;background:rgba(59,130,246,.1);color:var(--accent);font-weight:700;padding:2px 10px;border-radius:10px;font-size:12px;min-width:28px;text-align:center}
#order-by-product tr:hover { background: var(--surface2) !important; }
#order-by-product tr { transition: background .2s ease; }
