:root {
  --bg: #eef0ed;
  --surface: #ffffff;
  --surface-muted: #f7f8f6;
  --surface-strong: #e6eae5;
  --ink: #1f2623;
  --ink-soft: #48524d;
  --muted: #717b76;
  --line: #d9dfd8;
  --line-strong: #c2cbc1;
  --accent: #246b5b;
  --accent-soft: #e3f1ed;
  --accent-ink: #123d34;
  --pass: #157348;
  --pass-bg: #e4f3eb;
  --review: #9a5b12;
  --review-bg: #fff0d5;
  --danger: #b42318;
  --danger-bg: #fae4e1;
  --missing: #4b5563;
  --missing-bg: #eceff3;
  --focus: #1f7a68;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(31, 38, 35, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.workspace[hidden],
.review-nav[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

body.drawer-open {
  overflow: hidden;
}

body.review-action-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary:hover {
  background: #1d5d4f;
  color: #fff;
}

input,
select,
textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 5px 8px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-strong);
  color: #33413b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

td {
  background: #fff;
}

tbody tr:hover td {
  background: #fbfcfa;
}

.workbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(180px, 0.8fr) minmax(720px, 1fr);
  gap: 10px;
  align-items: end;
  min-height: 64px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(238, 240, 237, 0.97);
  backdrop-filter: blur(10px);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
  min-width: 0;
}

.header-primary-actions {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 8px;
  align-items: end;
  flex: 0 0 auto;
}

.brand-block {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.brand-block h1 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.2;
}

.message {
  min-height: 32px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink-soft);
  padding: 7px 10px;
  overflow-wrap: anywhere;
}

.message.ok {
  border-color: #b6d7c4;
  background: var(--pass-bg);
  color: var(--pass);
}

.message.error,
.sync-error {
  color: var(--danger);
}

.message.error {
  border-color: #e7b8b1;
  background: var(--danger-bg);
}

.import-strip {
  display: grid;
  grid-template-columns: 128px 104px minmax(132px, 1fr) auto;
  gap: 6px;
  align-items: end;
  flex: 1 1 430px;
  min-width: min(100%, 430px);
}

.utility-button {
  min-height: 32px;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}

.file-picker {
  min-width: 0;
}

.file-picker input {
  display: none;
}

.file-picker span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 5px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: calc(100vh - 69px);
  min-height: 0;
  overflow: hidden;
}

.review-nav {
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 0;
  overflow: auto;
  padding: 12px 10px;
  border-right: 1px solid var(--line-strong);
  background: #f5f7f4;
}

.nav-panel {
  padding: 0 0 12px;
}

.nav-panel + .nav-panel {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.batch-section,
.stats-section {
  padding-inline: 2px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-head.compact {
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 1.2;
}

.small-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.batch-list {
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.batch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.batch-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.batch {
  display: grid;
  width: 100%;
  gap: 5px;
  border-color: transparent;
  background: transparent;
  padding: 8px;
  text-align: left;
}

.batch-delete {
  min-width: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
}

.batch-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(185, 28, 28, 0.08);
}

.batch-main,
.batch-counts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.batch-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.batch-total,
.batch-source,
.batch-counts {
  color: var(--muted);
  font-size: 12px;
}

.batch-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 4px;
}

.batch-counts span {
  border-radius: 999px;
  background: var(--surface-muted);
  padding: 1px 6px;
  line-height: 1.45;
}

.batch-counts .passed {
  color: var(--pass);
}

.batch-counts .needs_review {
  color: var(--review);
}

.batch-counts .suspected_error {
  color: var(--danger);
}

.batch-counts .missing_data {
  color: var(--missing);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.stat {
  display: grid;
  gap: 3px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-left: 3px solid transparent;
  background: rgba(255, 255, 255, 0.74);
  padding: 7px 8px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  font-family: Consolas, "Courier New", monospace;
  font-size: 20px;
  line-height: 1.1;
}

.stat.total {
  background: rgba(255, 255, 255, 0.55);
  border-left-color: var(--accent);
}

.stat.passed {
  border-left-color: var(--pass);
}

.stat.needs_review {
  border-left-color: var(--review);
}

.stat.suspected_error {
  border-left-color: var(--danger);
}

.stat.missing_data {
  border-left-color: var(--missing);
}

.stat.passed strong,
.chip.passed {
  color: var(--pass);
}

.stat.needs_review strong,
.chip.needs_review {
  color: var(--review);
}

.stat.suspected_error strong,
.chip.suspected_error {
  color: var(--danger);
}

.stat.missing_data strong,
.chip.missing_data {
  color: var(--missing);
}

.stat.handled strong {
  color: var(--accent);
}

.drawer-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: visible;
}

.sync-section-head,
details.drawer-section summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.sync-section-head {
  cursor: default;
}

details.drawer-section summary::-webkit-details-marker {
  display: none;
}

details.drawer-section summary::after {
  content: "展开";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

details.drawer-section[open] summary::after {
  content: "收起";
}

.sync-section-head strong,
details.drawer-section summary strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.sync-state {
  flex: 1 1 190px;
  max-width: none;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  text-align: right;
}

.details-body {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
}

.sync-form {
  display: grid;
  gap: 8px;
}

.sync-details .sync-form {
  display: block;
}

.sync-details .sync-form > * + * {
  margin-top: 8px;
}

.sync-primary-source {
  display: block;
  border: 1px solid #b6d7c4;
  border-radius: var(--radius);
  background: #fbfefc;
  padding: 10px;
}

.sync-source-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.sync-source-heading strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.sync-source-heading p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.sync-source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sync-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin-top: 10px;
}

.sync-source-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 6px;
  justify-content: flex-start;
  min-width: 0;
  margin-top: 10px;
}

.sync-id-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  margin-top: 10px;
}

.sync-id-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 10px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13px;
}

.sync-id-details summary::after {
  content: "展开";
  color: var(--muted);
  font-size: 12px;
}

.sync-id-details[open] summary::after {
  content: "收起";
}

.sync-id-details label {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 10px 0;
}

.sync-id-details label:last-child {
  padding-bottom: 10px;
}

.sync-id-details input {
  color: var(--ink-soft);
  background: #f8fafc;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
}

.inline-check input,
.checkbox-label input {
  width: auto;
  min-height: auto;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.button-row button {
  min-width: 0;
  padding-inline: 6px;
}

.sync-action-row {
  display: grid;
  grid-template-columns: minmax(0, 180px);
  gap: 8px;
  justify-content: flex-start;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  min-width: 0;
}

.llm-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feishu-app-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 8px;
}

.feishu-callback-field input {
  color: var(--ink-soft);
  background: #f8fafc;
}

.feishu-webhook-compat {
  color: var(--ink-soft);
}

.feishu-actions {
  grid-template-columns: minmax(84px, 0.8fr) minmax(92px, 0.85fr) minmax(112px, 1fr) minmax(132px, 1.15fr);
}

.sync-error {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sync-diagnostics {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 10px;
}

.sync-diagnostics-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.sync-diagnostics-head p,
.sync-diagnostics-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sync-diagnostics-panel {
  display: grid;
  gap: 8px;
}

.sync-diagnostics-panel[hidden] {
  display: none !important;
}

.sync-diagnostics-body {
  display: grid;
  gap: 8px;
}

.sync-diagnostic-row {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
}

.sync-diagnostic-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.sync-diagnostic-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.sync-diagnostic-meta {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.sync-diagnostic-fields {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.sync-diagnostic-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sync-diagnostic-badge.ok {
  border-color: rgba(30, 126, 76, 0.3);
  background: var(--pass-bg);
  color: var(--pass);
}

.sync-diagnostic-badge.warn {
  border-color: rgba(180, 111, 20, 0.32);
  background: var(--review-bg);
  color: var(--review);
}

.ghost-refresh {
  position: relative;
  z-index: 1;
  min-height: 26px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding: 2px 6px;
  font-size: 12px;
}

.audit-log-wrap {
  max-height: 280px;
  overflow: auto;
  padding: 0;
}

.human-rule-wrap {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.human-rule-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px;
  gap: 6px;
}

.human-rule-table {
  min-width: 760px;
  font-size: 12px;
}

.human-rule-table th,
.human-rule-table td {
  padding: 7px;
}

.human-rule-shortcut {
  display: grid;
  gap: 10px;
}

.rule-library-view {
  grid-column: 1 / -1;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.rule-library-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.rule-library-head h2 {
  margin: 2px 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.rule-library-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rule-library-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 72px 72px;
  gap: 8px;
  margin-bottom: 8px;
}

.rule-library-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feishu-preview-view {
  grid-column: 1 / -1;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.feishu-preview-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.feishu-preview-head h2 {
  margin: 2px 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.feishu-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.feishu-preview-card {
  display: grid;
  place-items: start center;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #f5f7fb;
  padding: 22px;
  box-shadow: var(--shadow);
}

.feishu-card-shell {
  display: grid;
  width: min(680px, 100%);
  gap: 10px;
  border: 1px solid #d7dfec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(37, 51, 74, 0.12);
  padding: 18px;
}

.feishu-card-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.feishu-card-header strong,
.feishu-card-section strong {
  display: block;
  font-size: 15px;
}

.feishu-card-header span:last-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.feishu-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e7f0ff;
  color: #2456a6;
  font-weight: 800;
}

.feishu-card2-shell.orange .feishu-card-icon {
  background: var(--review-bg);
  color: var(--review);
}

.feishu-card2-shell.green .feishu-card-icon {
  background: var(--pass-bg);
  color: var(--pass);
}

.feishu-card-markdown {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  color: var(--ink-soft);
  padding: 9px 10px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.feishu-card-markdown strong,
.feishu-card-markdown b {
  color: var(--ink);
}

.feishu-card-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.feishu-card-column {
  min-width: 0;
  display: grid;
}

.feishu-card-column .feishu-card-markdown {
  height: 100%;
}

.feishu-card-hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 2px 0;
}

.feishu-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.feishu-card-stats > div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 9px;
}

.feishu-card-stats span,
.feishu-pending-fields em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.feishu-card-stats strong {
  font-size: 22px;
  line-height: 1.1;
}

.feishu-card-section {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.feishu-status-grid,
.feishu-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feishu-pending-list,
.feishu-reason-list {
  display: grid;
  gap: 7px;
}

.feishu-pending-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.feishu-pending-fields {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  min-width: 0;
}

@media (max-width: 680px) {
  .feishu-card-columns {
    grid-template-columns: 1fr;
  }
}

.feishu-pending-fields span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feishu-pending-fields b {
  color: var(--ink);
  font-size: 12px;
}

.feishu-pending-tags {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.feishu-pending-tags span {
  border: 1px solid #e2c4a8;
  border-radius: 999px;
  background: #fff7ed;
  color: #935f1f;
  padding: 3px 7px;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.feishu-reason-list span {
  border-left: 3px solid #9bb7e8;
  background: #f3f7ff;
  color: var(--ink-soft);
  padding: 6px 8px;
}

.feishu-card-actions button,
.feishu-card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-color: #8fb0eb;
  border: 1px solid #8fb0eb;
  border-radius: var(--radius);
  background: #eef5ff;
  color: #2456a6;
  padding: 5px 10px;
  font-weight: 700;
  text-decoration: none;
}

.feishu-card-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.feishu-card-button.danger {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

.rule-scope {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.rule-actions {
  display: flex;
  gap: 6px;
}

.audit-table {
  min-width: 640px;
  font-size: 12px;
}

.audit-table th,
.audit-table td {
  padding: 7px;
}

.audit-time {
  white-space: nowrap;
}

.audit-summary {
  min-width: 160px;
  overflow-wrap: anywhere;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(31, 38, 35, 0.28);
}

.review-action-backdrop {
  position: fixed;
  inset: 0;
  z-index: 42;
  background: rgba(31, 38, 35, 0.18);
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 41;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(720px, calc(100vw - 48px));
  height: 100vh;
  border-left: 1px solid var(--line-strong);
  background: #f8faf7;
  box-shadow: -18px 0 44px rgba(31, 38, 35, 0.18);
}

.review-action-panel {
  position: fixed;
  top: 70px;
  right: 12px;
  z-index: 43;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - 86px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfa;
  box-shadow: 0 18px 48px rgba(31, 38, 35, 0.18);
}

.settings-backdrop[hidden],
.settings-drawer[hidden],
.review-action-backdrop[hidden],
.review-action-panel[hidden] {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.drawer-head h2 {
  margin: 2px 0 0;
  font-size: 17px;
}

.drawer-body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 18px;
}

.review-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.review-action-head h2 {
  margin: 2px 0 0;
  font-size: 16px;
}

.review-action-body {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 16px;
}

.review-action-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.review-action-facts div {
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.review-action-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.review-action-facts dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.decision-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.decision-group button {
  min-height: 36px;
  background: var(--surface);
  font-weight: 700;
}

.decision-group button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.review-note-label textarea {
  min-height: 96px;
}

.rule-save-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 10px;
}

.rule-save-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 10px;
  overflow: hidden;
}

.workspace-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.status-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 3px;
}

.status-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  padding: 4px 8px;
  font-weight: 700;
}

.status-tabs button span {
  min-width: 22px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  padding: 1px 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  text-align: center;
}

.status-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.status-tabs button.active span {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.table-actions {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 60px 88px;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
}

.review-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  padding: 8px 12px;
  margin-bottom: 8px;
}

.toolbar-summary {
  min-width: 0;
}

.toolbar-summary h2,
.toolbar-summary .summary {
  margin: 0;
}

.summary-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.page-info {
  color: var(--ink-soft);
  font-size: 13px;
}

.page-controls {
  display: flex;
  align-items: end;
  gap: 8px;
}

.page-controls label {
  min-width: 86px;
}

.page-controls select {
  min-height: 32px;
}

.page-controls button {
  min-width: 72px;
}

.page-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: var(--surface-strong);
  color: var(--muted);
}

.review-toolbar h2 {
  margin: 2px 0 0;
  font-size: 16px;
}

.summary {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.result-table-wrap {
  height: 100%;
  max-height: none;
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.result-table {
  min-width: 1056px;
  table-layout: fixed;
  font-size: 13px;
}

.result-table th,
.result-table td {
  vertical-align: top;
}

.col-type {
  width: 76px;
}

.col-product-id {
  width: 116px;
}

.col-shop {
  width: 72px;
}

.col-link {
  width: 152px;
}

.col-spec {
  width: 104px;
}

.col-qty {
  width: 56px;
}

.col-ship {
  width: 184px;
}

.col-status {
  width: 68px;
}

.col-reason {
  width: 172px;
}

.col-review-state {
  width: 74px;
}

.col-review-action {
  width: 70px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.row-number,
.quantity-cell,
.shop-cell {
  color: var(--ink-soft);
  white-space: nowrap;
}

.subtle-line,
.muted,
.score {
  color: var(--muted);
  font-size: 12px;
}

.product-summary,
.score {
  display: block;
  margin-top: 2px;
}

.product-id-cell {
  padding-top: 8px;
}

.product-id-value {
  display: block;
  max-width: 100%;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.group-title,
.shipping-summary {
  color: var(--ink);
  font-weight: 700;
}

.group-summary-cell {
  background: #fcfdfb;
}

.cell-text {
  min-width: 0;
}

.group-summary-head {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.group-summary-head .subtle-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shipping-summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.shipping-summary-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.shipping-meta-row {
  min-width: 0;
}

.shipping-action-slot {
  display: flex;
  align-items: flex-start;
  padding-top: 1px;
}

.group-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 1px 7px;
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.group-badge.multi {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.group-badge.single {
  background: var(--surface-strong);
  color: var(--ink-soft);
}

.analysis-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.analysis-tag {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  padding: 1px 5px;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.analysis-tag.alert {
  border-color: rgba(185, 28, 28, 0.3);
  background: #fef2f2;
  color: #991b1b;
  font-weight: 700;
}

.analysis-tags.compact {
  flex-wrap: nowrap;
  overflow: hidden;
}

.analysis-tag.compact {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-children {
  display: grid;
  gap: 0;
  min-width: 720px;
}

.group-child {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(118px, 148px) 48px;
  gap: 8px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

.group-child-header {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom-style: solid;
  background: #f4f7f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.group-child:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.group-child .analysis-tags {
  grid-column: 1 / -1;
  margin-top: 0;
  padding-left: 52px;
}

.wrap-cell {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.order-cell {
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.line-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp.two-line {
  -webkit-line-clamp: 2;
}

.link-name,
.shipping-name {
  line-height: 1.45;
}

.spec-cell {
  color: var(--ink-soft);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chip.passed {
  background: var(--pass-bg);
}

.chip.needs_review {
  background: var(--review-bg);
}

.chip.suspected_error {
  background: var(--danger-bg);
}

.chip.missing_data {
  background: var(--missing-bg);
}

.reasons {
  color: var(--ink-soft);
  line-height: 1.42;
}

.reasons-list {
  display: grid;
  gap: 4px;
}

.reason-line {
  position: relative;
  padding-left: 10px;
  overflow-wrap: anywhere;
}

.reason-line + .reason-line {
  margin-top: 4px;
}

.reason-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
}

.review-status-cell,
.review-action-cell {
  text-align: left;
}

.review-action-cell {
  padding-left: 6px;
  padding-right: 6px;
}

.decision-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink-soft);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.decision-chip.confirmed_pass {
  background: var(--pass-bg);
  color: var(--pass);
}

.decision-chip.confirmed_error {
  background: var(--danger-bg);
  color: var(--danger);
}

.decision-chip.ignored {
  background: var(--missing-bg);
  color: var(--missing);
}

.row-review-button {
  width: 100%;
  min-height: 28px;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.row-review-button:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.row-detail-button {
  width: fit-content;
  min-height: 24px;
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--accent-ink);
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
}

.row-detail-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.group-detail-section {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.group-detail-head {
  display: grid;
  gap: 2px;
}

.review-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.review-detail-summary > div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 8px;
  min-width: 0;
}

.review-detail-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.review-detail-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.review-detail-actions {
  display: flex;
  justify-content: flex-start;
}

.review-full-details {
  min-width: 0;
}

.group-detail-section .group-children {
  max-height: min(430px, 52vh);
  overflow: auto;
  overflow-x: auto;
  padding-right: 4px;
}

.empty {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-note {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 18px 10px;
  text-align: center;
}

@media (max-width: 1180px) {
  .workbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-primary-actions {
    grid-template-columns: repeat(4, minmax(max-content, 1fr));
    flex: 1 1 360px;
  }

  .import-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .shell {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .workspace-tools {
    grid-template-columns: 1fr;
  }

  .table-actions {
    grid-template-columns: minmax(180px, 1fr) 64px 92px;
  }

  .rule-library-toolbar {
    grid-template-columns: minmax(180px, 1fr) 72px 72px;
  }

  .result-table-wrap {
    min-height: 0;
  }
}

@media (max-width: 820px) {
  body {
    height: auto;
    overflow: auto;
  }

  .workbar {
    position: static;
    padding: 12px;
  }

  .import-strip {
    grid-template-columns: 1fr 1fr;
  }

  .shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .review-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
    overflow: visible;
  }

  .settings-drawer {
    width: 100vw;
  }

  .batch-list {
    max-height: 240px;
    overflow: auto;
  }

  .workspace {
    padding: 10px;
    display: block;
    overflow: visible;
  }

  .table-actions {
    grid-template-columns: 1fr 1fr;
  }

  .sync-picker-grid,
  .sync-source-actions,
  .sync-action-row {
    grid-template-columns: 1fr;
  }

  .rule-library-head,
  .rule-library-actions {
    display: grid;
    justify-content: stretch;
  }

  .rule-library-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .rule-library-toolbar input {
    grid-column: 1 / -1;
  }

  .status-tabs button {
    flex: 0 0 auto;
  }

  .review-toolbar {
    display: grid;
    align-items: start;
  }

  .page-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .feishu-pending-fields {
    grid-template-columns: 1fr;
  }

  .summary-line {
    display: grid;
    gap: 2px;
  }

  .summary {
    text-align: left;
  }

  .result-table-wrap {
    max-height: 70vh;
    min-height: 360px;
  }

  .review-action-panel {
    top: 0;
    right: 0;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 520px) {
  .import-strip,
  .header-actions,
  .header-primary-actions,
  .field-grid,
  .feishu-app-fields,
  .button-row,
  .table-actions,
  .rule-library-toolbar,
  .page-controls,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .settings-drawer {
    width: 100vw;
  }

  .sync-state {
    flex-basis: 100%;
    text-align: left;
  }
}
