/* 运营工作台 —— 单文件样式。冷静的工业仪表盘：状态先于装饰，移动优先，系统字体，无第三方依赖。 */

:root {
  --bg: #f2f6f8;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --ink: #17262e;
  --muted: #5b6e79;
  --subtle: #64777f;
  --line: #dce5e9;
  --line-strong: #cbd8de;
  --primary: #087f74;
  --primary-dark: #06665e;
  --primary-soft: #e3f4f1;
  --blue: #2b66b8;
  --blue-soft: #eaf2fc;
  --success: #147758;
  --success-soft: #e5f4ee;
  --warning: #98620e;
  --warning-soft: #fff3d9;
  --danger: #b43f45;
  --danger-soft: #fdecee;
  --neutral: #5b6e79;
  --neutral-soft: #eef2f4;
  --heat-0: #eef2f4;
  --heat-1: #d9efec;
  --heat-2: #b4e0da;
  --heat-3: #7fc9bf;
  --heat-4: #087f74;
  --shadow: 0 1px 2px rgba(23, 38, 46, 0.04), 0 8px 24px rgba(23, 38, 46, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --side-w: 248px;
  --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;
  --dur: 180ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 720; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3, .wb-h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 10px; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea[readonly] { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.text-danger { color: var(--danger); }
.is-hidden { display: none !important; }
.wb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wb-skip { position: absolute; left: 8px; top: -48px; padding: 10px 14px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 50; }
.wb-skip:focus { top: 8px; }
.wb-icon { width: 20px; height: 20px; flex: none; }

/* ---------------------------------------------------------------- 布局 */
.wb-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.wb-side {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 14px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-right: 1px solid var(--line);
}
.wb-brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: var(--ink); min-height: var(--tap); }
.wb-brand:hover { text-decoration: none; }
.wb-brand .wb-icon { color: var(--primary); width: 24px; height: 24px; }
.wb-brand-name { font-weight: 760; font-size: 1.05rem; }
.wb-brand small { color: var(--muted); font-size: 0.72rem; margin-left: auto; }
.wb-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.wb-nav-item {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 12px;
  border-radius: 10px; color: var(--ink); font-weight: 560; transition: background var(--dur) var(--ease);
}
.wb-nav-item .wb-icon { color: var(--muted); }
.wb-nav-item:hover { background: var(--surface-2); text-decoration: none; }
.wb-nav-item.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.wb-nav-item.is-active .wb-icon { color: var(--primary); }
.wb-side-foot { margin-top: auto; padding: 8px 10px; }
.wb-live { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.82rem; }
.wb-live .orb { background: var(--line-strong); }
.wb-live[data-state="open"] .orb { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.wb-live[data-state="error"] .orb { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }

.wb-col { display: flex; flex-direction: column; min-width: 0; }
.wb-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 22px 10px;
  background: rgba(242, 246, 248, 0.86); -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.wb-project { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wb-top-right { display: flex; align-items: center; gap: 10px; }
.wb-user { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.wb-user .wb-icon { color: var(--subtle); }
.wb-user-name { color: var(--ink); font-weight: 600; }
.wb-tabs { display: none; }
.wb-main { padding: 20px 22px calc(28px + env(safe-area-inset-bottom)); max-width: 1480px; width: 100%; display: flex; flex-direction: column; gap: 18px; }

/* ---------------------------------------------------------------- 页头 / 栅格 */
.wb-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.wb-lede { color: var(--muted); margin-top: 4px; font-size: 0.92rem; }
.wb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wb-grid { display: grid; gap: 18px; min-width: 0; }
.wb-grid > * { min-width: 0; }
.wb-grid-overview { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.wb-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wb-grid-review { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.wb-grid-config { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.wb-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------------------------------------------------------------- 卡片 */
.wb-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.wb-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.wb-card-head p { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.wb-card-body { padding: 16px 18px; }
.wb-card-body + .wb-card-body, .wb-card-body + .wb-table-wrap { border-top: 1px solid var(--line); }
.wb-empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.wb-empty p:first-child { font-weight: 600; color: var(--ink); }
.wb-empty-hint { font-size: 0.85rem; margin-top: 6px; }
.wb-more { padding: 10px 18px 14px; font-size: 0.9rem; }

/* ---------------------------------------------------------------- KPI */
.wb-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wb-kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 10px; min-height: 92px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink);
  position: relative; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
a.wb-kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(23, 38, 46, 0.06), 0 12px 28px rgba(23, 38, 46, 0.09); }
.wb-kpi-label { font-size: 0.74rem; font-weight: 650; letter-spacing: 0.02em; color: var(--muted); }
.wb-kpi-value { font-size: 2rem; font-weight: 780; line-height: 1.1; }
.wb-kpi-sub { font-size: 0.76rem; color: var(--subtle); }
.wb-kpi::after { content: ""; position: absolute; right: 14px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.wb-kpi.tone-success::after { background: var(--success); }
.wb-kpi.tone-warning::after { background: var(--warning); }
.wb-kpi.tone-danger::after { background: var(--danger); }
.wb-kpi.tone-info::after { background: var(--blue); }

/* ---------------------------------------------------------------- 状态词汇 */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 650; line-height: 1.5; white-space: nowrap; vertical-align: middle;
  color: var(--neutral); background: var(--neutral-soft);
}
.chip-success { color: var(--success); background: var(--success-soft); }
.chip-warning { color: var(--warning); background: var(--warning-soft); }
.chip-danger { color: var(--danger); background: var(--danger-soft); }
.chip-info { color: var(--blue); background: var(--blue-soft); }
.chip-check { white-space: normal; align-items: baseline; max-width: 100%; }
.chip-check b { font-weight: 720; }
.chip-reason { font-weight: 500; }
.chip-scope-product { color: var(--neutral); background: var(--neutral-soft); }
.chip-scope-industry { color: var(--blue); background: var(--blue-soft); }
.chip-scope-customer { color: var(--warning); background: var(--warning-soft); }
.chip-scope-project { color: var(--primary-dark); background: var(--primary-soft); }
.orb { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); flex: none; }
.orb-success { background: var(--success); }
.orb-warning { background: var(--warning); }
.orb-danger { background: var(--danger); }
.orb-info { background: var(--blue); }
.wb-notice { margin: 14px 22px 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--success-soft); color: var(--success); font-weight: 600; }
.wb-notice-err { background: var(--danger-soft); color: var(--danger); }
.wb-notice-warn { background: var(--warning-soft); color: var(--warning); }
.wb-toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; width: min(92vw, 480px); }
.wb-toast-item { padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: var(--shadow); animation: wb-arrive var(--dur) var(--ease); }
.wb-toast-item.err { background: var(--danger); }
.wb-toast-item.ok { background: var(--success); }
@keyframes wb-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 表单与按钮 */
.wb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 650; font-size: 0.92rem; white-space: nowrap; background: var(--surface); color: var(--ink);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.wb-btn:hover { text-decoration: none; }
.wb-btn.primary { background: var(--primary); color: #fff; }
.wb-btn.primary:hover:not(:disabled) { background: var(--primary-dark); }
.wb-btn.secondary { border-color: var(--line-strong); }
.wb-btn.secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.wb-btn.ghost { color: var(--muted); }
.wb-btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.wb-btn-block { width: 100%; }
.wb-btn .wb-icon { width: 18px; height: 18px; }
.wb-input, .wb-select-plain {
  min-height: var(--tap); padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); width: 100%;
}
.wb-input:focus, .wb-select-plain:focus, .wb-select-shell:focus-within, .wb-input-shell:focus-within { border-color: var(--primary); outline: none; }
.wb-input:focus, .wb-select-plain:focus { box-shadow: 0 0 0 2px var(--primary-soft); }
textarea.wb-input { min-height: 160px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.wb-code { font-family: var(--mono); font-size: 0.86rem; }
.wb-input-sm { min-height: 38px; }
.wb-file { padding: 8px 12px; }
.wb-select-plain { -webkit-appearance: none; appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6e79' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
.wb-select-shell, .wb-input-shell {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); max-width: 100%;
}
.wb-select-shell select, .wb-input-shell .wb-input { border: 0; background: transparent; min-height: calc(var(--tap) - 2px); padding: 0; min-width: 0; color: var(--ink); }
.wb-select-shell select { -webkit-appearance: none; appearance: none; padding-right: 22px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6e79' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right center; font-weight: 600; }
.wb-select-shell select:focus, .wb-input-shell .wb-input:focus { outline: none; box-shadow: none; }
.wb-live-filter .wb-input { width: 220px; }
.wb-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 650; color: var(--muted); min-width: 0; }
.wb-field > .wb-input, .wb-field > .wb-select-plain { font-weight: 500; font-size: 0.95rem; color: var(--ink); }
.wb-form { display: flex; flex-direction: column; gap: 14px; }
.wb-form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.wb-form-inline .wb-field { flex: 1 1 180px; }
.wb-form-inline .wb-btn { flex: none; }
.wb-form-inline > p { flex-basis: 100%; }
.wb-check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 0.92rem; }
.wb-check input { width: 20px; height: 20px; accent-color: var(--primary); }
.wb-switch { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.wb-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wb-switch-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background var(--dur) var(--ease); flex: none; }
.wb-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform var(--dur) var(--ease); }
.wb-switch input:checked + .wb-switch-track { background: var(--primary); }
.wb-switch input:checked + .wb-switch-track::after { transform: translateX(18px); }
.wb-switch input:focus-visible + .wb-switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.wb-switch input:disabled ~ * { opacity: 0.6; cursor: not-allowed; }
.wb-switch-text { font-size: 0.85rem; color: var(--muted); }

/* ---------------------------------------------------------------- 表格 */
.wb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wb-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.wb-table th, .wb-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); white-space: nowrap; }
/* 长文本列允许换行；桌面表格宽于容器时在卡片内横向滚动，不整页滚动 */
.wb-table td[data-label="说明"], .wb-table td[data-label="错误"], .wb-table td[data-label="原因"], .wb-table td[data-label="目标"], .wb-table td[data-label="QA"], .wb-table td[data-label="历史别名"], .wb-table td[data-label="期望状态词"], .wb-diff td { white-space: normal; min-width: 200px; }
.wb-table td[data-label="设备"], .wb-table td[data-label="报告"], .wb-table td[data-label="模板"] { min-width: 150px; }
.wb-table-wrap .wb-ledger { min-width: 860px; }
.wb-table thead th { background: var(--surface-2); color: var(--muted); font-size: 0.76rem; font-weight: 680; letter-spacing: 0.02em; white-space: nowrap; position: sticky; top: 0; }
.wb-table tbody tr:last-child td { border-bottom: 0; }
.wb-table tbody tr:hover td { background: var(--surface-2); }
.wb-table td .muted.small { display: block; }
.wb-table tr.is-error td { background: var(--danger-soft); }
.wb-cell-actions { white-space: nowrap; }
.wb-cell-actions .wb-btn { min-height: 38px; padding: 0 12px; font-size: 0.85rem; }
.wb-cell-actions .wb-btn + .wb-btn { margin-left: 4px; }
.wb-col-check, .wb-col-check input { width: 20px; height: 20px; accent-color: var(--primary); }
.wb-bar { display: inline-block; width: 84px; height: 8px; border-radius: 999px; background: var(--neutral-soft); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.wb-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.wb-kw, .wb-params { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.wb-files { display: flex; flex-wrap: wrap; gap: 4px; }
.wb-file-link { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); font-size: 0.8rem; font-weight: 650; }
.wb-problems summary, .wb-json summary, .wb-event-payload summary { cursor: pointer; color: var(--primary); font-size: 0.82rem; font-weight: 600; }
.wb-problems ul { margin: 6px 0 0; padding-left: 16px; color: var(--danger); font-size: 0.82rem; }
.wb-json pre { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 0.76rem; max-width: 420px; max-height: 240px; overflow: auto; }
.wb-reassign { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.wb-reassign .wb-select-plain { width: auto; min-width: 110px; max-width: 150px; min-height: 38px; padding-top: 0; padding-bottom: 0; font-size: 0.85rem; }
.wb-reassign .wb-input-sm { width: 140px; font-size: 0.85rem; }
.wb-reassign .wb-btn { min-height: 38px; }
.wb-plan-result { border-top: 1px solid var(--line); }
.wb-plan-result .wb-card-body { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.wb-why { color: var(--muted); font-size: 0.82rem; }

/* ---------------------------------------------------------------- 热力图 */
.heat-table th.heat-b, .heat-table th.heat-f, .heat-table th.heat-r { white-space: nowrap; color: var(--ink); font-weight: 680; background: var(--surface); }
.heat-table th.heat-b { font-size: 1rem; }
.heat-table th.heat-f { color: var(--muted); }
.heat-cells { padding: 8px 10px; white-space: normal; min-width: 260px; }
.heat-asset { display: inline-flex; flex-direction: column; gap: 4px; margin: 4px 10px 4px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; vertical-align: top; min-width: 190px; }
.heat-tag { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 0.88rem; }
.heat-tag .muted { font-weight: 500; font-size: 0.78rem; }
.heat-wos { display: flex; flex-wrap: wrap; gap: 6px; }
.heat-cell { display: inline-flex; align-items: center; gap: 8px; padding: 5px 9px; border-radius: 8px; color: var(--ink); font-size: 0.8rem; font-weight: 600; border: 1px solid transparent; }
.heat-cell:hover { text-decoration: none; border-color: var(--primary); }
.heat-cell .chip { font-size: 0.7rem; padding: 0 7px; }
.heat-pct { font-weight: 750; }
.heat-0 { background: var(--heat-0); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); }
.heat-4 { background: var(--heat-4); color: #fff; }
.heat-4 .chip { background: rgba(255, 255, 255, 0.92); }
.heat-legend { display: flex; align-items: center; gap: 6px 4px; flex-wrap: wrap; padding: 10px 18px 14px; color: var(--muted); font-size: 0.76rem; }
.heat-swatch { display: inline-block; width: 16px; height: 12px; border-radius: 3px; margin-left: 10px; border: 1px solid var(--line); }
.heat-legend .heat-swatch:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- 事件 */
.wb-events { list-style: none; margin: 0; padding: 6px 0; max-height: 640px; overflow: auto; }
.wb-event { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.wb-event:last-child { border-bottom: 0; }
.wb-event .orb { margin-top: 7px; }
.wb-event-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wb-event-type { font-size: 0.8rem; font-weight: 650; color: var(--ink); }
.wb-event-brief { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.wb-event-payload pre { font-size: 0.74rem; color: var(--muted); margin-top: 4px; }
.wb-event-time { font-size: 0.78rem; color: var(--subtle); white-space: nowrap; }

/* ---------------------------------------------------------------- 审校 */
.wb-review-list, .wb-sheet { list-style: none; margin: 0; padding: 0; }
.wb-review-item { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.wb-review-item:last-child { border-bottom: 0; }
.wb-thumb { display: block; width: 160px; height: 120px; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.wb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wb-thumb-lg { width: 100%; height: 165px; }
.wb-thumb-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; color: var(--muted); font-size: 0.72rem; }
.wb-review-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wb-review-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wb-review-title strong { font-size: 1rem; }
.wb-review-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.8rem; }
.wb-slot { color: var(--subtle); }
.wb-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-review-actions, .wb-sheet-actions { display: flex; flex-direction: column; gap: 6px; }
.wb-review-actions .wb-btn, .wb-sheet-actions .wb-btn { min-height: 40px; padding: 0 12px; font-size: 0.85rem; }
.wb-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 16px 18px; }
.wb-sheet-item { display: flex; flex-direction: column; gap: 8px; }
.wb-sheet-meta { display: flex; flex-direction: column; font-size: 0.85rem; }
.wb-sheet-actions { flex-direction: row; }
.wb-sheet-actions .wb-btn { flex: 1; padding: 0 8px; }

/* ---------------------------------------------------------------- 配置中心 */
.wb-layer-versions { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-tree { list-style: none; margin: 0; padding-left: 14px; border-left: 1px solid var(--line); }
.wb-card-body > .cfg-tree { padding-left: 0; border-left: 0; }
.cfg-tree li { padding: 2px 0; }
.cfg-key { font-weight: 650; font-size: 0.88rem; }
.cfg-branch { cursor: pointer; padding: 4px 0; color: var(--primary-dark); }
.cfg-leaf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 3px 0; }
.cfg-val { color: var(--ink); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.wb-diff td, .wb-diff th { font-size: 0.82rem; }
.wb-diff tr.diff-added td { background: var(--success-soft); }
.wb-diff tr.diff-removed td { background: var(--danger-soft); }
.wb-diff tr.diff-modified td { background: var(--warning-soft); }

/* ---------------------------------------------------------------- 登录 */
.wb-auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 16px; }
.wb-auth { width: 100%; max-width: 420px; }
.wb-auth-head { flex-direction: column; align-items: flex-start; gap: 8px; }
.wb-brand-static { padding: 0; min-height: 0; color: var(--primary-dark); }
.wb-auth-card .wb-form { gap: 16px; }

/* ---------------------------------------------------------------- 标签打印 */
.wb-labels-body { background: var(--bg); }
.wb-labels-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.wb-labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 18px; }
.wb-label { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; padding: 12px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; break-inside: avoid; }
.wb-label-qr { width: 128px; height: 128px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line-strong); border-radius: 8px; overflow: hidden; }
.wb-label-qr img { width: 128px; height: 128px; }
.wb-label-payload { font-family: var(--mono); font-size: 0.62rem; padding: 6px; overflow-wrap: anywhere; color: var(--muted); }
.wb-label-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wb-label-tag { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.wb-label-line { font-size: 0.85rem; color: var(--muted); }
.wb-label-foot { margin-top: auto; font-size: 0.7rem; color: var(--subtle); }
@media print {
  .wb-no-print { display: none !important; }
  body { background: #fff; }
  .wb-labels { padding: 0; gap: 8px; grid-template-columns: repeat(2, 1fr); }
  .wb-label { box-shadow: none; }
}

/* ---------------------------------------------------------------- 部件（嵌入） */
.wb-widget { font: 16px/1.5 var(--font); color: var(--ink); }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .wb-grid-overview, .wb-grid-review, .wb-grid-config { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .wb-grid-two { grid-template-columns: minmax(0, 1fr); }
  .wb-review-item { grid-template-columns: 120px minmax(0, 1fr); }
  .wb-review-actions { grid-column: 1 / -1; flex-direction: row; }
  .wb-review-actions .wb-btn { flex: 1; }
  .wb-thumb { width: 120px; height: 90px; }
}
@media (max-width: 760px) {
  .wb-shell { grid-template-columns: minmax(0, 1fr); }
  .wb-side { display: none; }
  .wb-top { padding-left: 16px; padding-right: 16px; }
  .wb-hide-sm { display: none; }
  .wb-user-name { display: none; }
  .wb-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .wb-tabs::-webkit-scrollbar { display: none; }
  .wb-tab { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 14px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 0.92rem; }
  .wb-tab.is-active { background: var(--primary-soft); color: var(--primary-dark); }
  .wb-tab:hover { text-decoration: none; }
  .wb-main { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); gap: 14px; }
  .wb-notice { margin: 12px 16px 0; }
  .wb-page-head { align-items: stretch; flex-direction: column; }
  .wb-filters { width: 100%; }
  .wb-filters .wb-select-shell, .wb-filters .wb-input-shell { flex: 1 1 140px; }
  .wb-live-filter, .wb-live-filter .wb-input { width: 100%; }
  .wb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .wb-kpi { min-height: 84px; padding: 10px 12px 8px; }
  .wb-kpi-value { font-size: 1.7rem; }
  .wb-card-head { padding: 14px 16px 10px; }
  .wb-card-body { padding: 14px 16px; }

  /* 表格 → 账本卡片（热力图除外：容器内横向滚动）。卡片形态不再需要桌面版的 860px 下限，否则卡片被撑宽要横向滚 */
  .wb-table-wrap .wb-ledger { min-width: 0; }
  .wb-ledger, .wb-ledger tbody, .wb-ledger tr, .wb-ledger td { display: block; }
  .wb-ledger thead { display: none; }
  .wb-ledger tr { position: relative; padding: 12px 16px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .wb-ledger tr:last-child { border-bottom: 0; }
  .wb-ledger td { padding: 0; border: 0; min-width: 0; }
  .wb-ledger td::before { content: attr(data-label); display: block; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.02em; color: var(--subtle); margin-bottom: 2px; }
  .wb-ledger td[data-label="设备"], .wb-ledger td[data-label="报告"], .wb-ledger td[data-label="位号"], .wb-ledger td[data-label="名称"], .wb-ledger td[data-label="模板"], .wb-ledger td[data-label="绑定"] { grid-column: 1 / -1; }
  .wb-ledger td[data-label="设备"]::before, .wb-ledger td[data-label="报告"]::before, .wb-ledger td[data-label="位号"]::before, .wb-ledger td[data-label="名称"]::before, .wb-ledger td[data-label="模板"]::before, .wb-ledger td[data-label="绑定"]::before { display: none; }
  .wb-ledger td.wb-cell-chip { position: absolute; right: 16px; top: 12px; }
  .wb-ledger td.wb-cell-chip::before { display: none; }
  .wb-ledger td.wb-cell-actions, .wb-ledger td.wb-cell-switch, .wb-ledger td[data-label="操作"], .wb-ledger td[data-label="改派"] { grid-column: 1 / -1; white-space: normal; }
  .wb-ledger td.wb-cell-actions .wb-btn { min-height: var(--tap); }
  .wb-ledger td.wb-col-check { position: absolute; right: 16px; top: 44px; width: 20px; }
  .wb-ledger td.wb-col-check::before { display: none; }
  .wb-ledger tbody tr:hover td { background: transparent; }
  .wb-reassign { flex-wrap: wrap; }
  .wb-reassign .wb-select-plain, .wb-reassign .wb-input-sm { flex: 1 1 120px; width: auto; max-width: none; }
  .wb-reassign .wb-btn { flex: 1 1 100%; }
  .wb-review-item { grid-template-columns: minmax(0, 1fr); }
  .wb-thumb { width: 100%; height: 160px; }
  .wb-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 16px; gap: 10px; }
  .wb-label { grid-template-columns: 96px minmax(0, 1fr); }
  .wb-label-qr, .wb-label-qr img { width: 96px; height: 96px; }
}
@media (max-width: 480px) {
  .wb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-sheet { grid-template-columns: minmax(0, 1fr); }
  .wb-ledger tr { grid-template-columns: minmax(0, 1fr); }
  .wb-project { flex: 1; }
  .wb-project .wb-select-shell { flex: 1; }
}

/* ---------------------------------------------------------------- 模板工作室 */
.wb-crumbs { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.wb-crumbs code { color: var(--muted); }
.wb-subnav { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-subnav a { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 0.88rem; }
.wb-subnav a:hover { text-decoration: none; border-color: var(--primary); color: var(--primary-dark); }
.wb-tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; align-items: start; }
.wb-fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 14px 14px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.wb-fieldset legend { padding: 0 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.wb-fs-root { border: 0; padding: 0; margin: 0; min-width: 0; }
.wb-fs-root:disabled .wb-input, .wb-fs-root:disabled .wb-select-plain { opacity: 0.8; background: var(--surface-2); }
.wb-fs-root:disabled .wb-band .wb-btn, .wb-fs-root:disabled .wb-band-add { display: none; }
.wb-margins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.wb-group { border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); min-width: 0; }
.wb-group + .wb-group, .wb-group .wb-group { margin-top: 12px; }
.wb-group .wb-group { border-left-color: var(--blue); background: var(--surface); }
.wb-group-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 8px; }
.wb-group-head .chip { align-self: center; margin-bottom: 8px; }
.wb-field-inline { flex: 0 1 220px; }
.wb-field-inline.wb-grow { flex: 1 1 280px; }
.wb-proto { margin: 0 0 10px; overflow-wrap: anywhere; }
.wb-bands { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wb-band { display: grid; grid-template-columns: minmax(150px, 2fr) minmax(120px, 1.2fr) repeat(4, minmax(60px, 0.55fr)) minmax(84px, 0.8fr) minmax(130px, 1fr) 40px; gap: 6px 8px; align-items: end; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.wb-band-head { background: transparent; border: 0; padding: 0 10px; font-size: 0.72rem; font-weight: 680; color: var(--muted); letter-spacing: 0.02em; }
.wb-band .wb-field > span { display: none; }
.wb-band .wb-input, .wb-band .wb-select-plain { min-height: 38px; padding-left: 8px; padding-right: 8px; }
.wb-band .wb-select-plain { padding-right: 24px; background-position: right 6px center; }
.wb-band .wb-btn { min-height: 38px; padding: 0 8px; }
.wb-band.is-removed { opacity: 0.55; background: var(--danger-soft); }
.wb-band.is-removed .wb-input, .wb-band.is-removed .wb-select-plain { text-decoration: line-through; }
.wb-band-add { align-self: flex-start; }
.wb-pending-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wb-pending-item { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(200px, 1fr); gap: 8px 14px; align-items: center; padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.wb-pending-item.is-open { background: var(--warning-soft); border-color: transparent; }
.wb-pending-item.is-done { display: flex; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); min-height: var(--tap); }
.wb-pending-item .wb-check { align-items: center; }
.wb-pending-item .wb-check strong { font-weight: 650; }
.wb-savebar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(23, 38, 46, 0.05); z-index: 5; }
.wb-trial-facts { color: var(--muted); font-size: 0.88rem; }
.wb-trial-issues { margin: 0; padding-left: 16px; font-size: 0.85rem; }

/* ---------------------------------------------------------------- 抽查台 */
.wb-kpi.is-active { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.wb-input-n { width: 64px; text-align: center; }
.wb-spot-list { list-style: none; margin: 0; padding: 0; }
.wb-spot-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 18px; padding: 16px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.wb-spot-item:last-child { border-bottom: 0; }
.wb-spot-head { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wb-spot-item .wb-sheet { grid-column: 1 / -1; padding: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wb-sheet-compact .wb-thumb { width: 100%; height: 110px; }
.wb-spot-actions { flex-direction: row; }
.wb-spot-more { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- 作业 / 密钥 */
.wb-job-payload { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.wb-secret-value { flex: 2 1 260px; }

@media (max-width: 760px) {
  .wb-job-payload { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .wb-band-head { display: none; }
  .wb-band { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .wb-band .wb-field > span { display: block; }
  .wb-band .wb-field:nth-of-type(1) { grid-column: 1 / -1; }
  .wb-band .wb-input, .wb-band .wb-select-plain, .wb-band .wb-btn { min-height: var(--tap); }
  .wb-band .wb-btn { grid-column: 1 / -1; }
  .wb-group-head .wb-field-inline, .wb-group-head .wb-field-inline.wb-grow { flex: 1 1 100%; }
  .wb-pending-item { grid-template-columns: minmax(0, 1fr); padding: 10px 14px; }
  .wb-savebar .wb-field { flex-basis: 100%; }
  .wb-savebar .wb-btn { flex: 1 1 100%; }
  .wb-spot-item { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .wb-spot-actions .wb-btn { flex: 1; min-height: var(--tap); }
  .wb-spot-item .wb-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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