:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-bg: #eff6ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.brand .brand-mark {
  color: var(--accent);
  font-weight: 700;
}

.brand .brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.topbar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar-link.active {
  background: var(--accent-bg);
  border-color: var(--accent-soft);
  color: var(--accent);
}

.topbar-link-accent {
  background: #0f172a;
  color: #fff;
}

.topbar-link-accent:hover {
  background: #1e293b;
  color: #fff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill.ok {
  background: var(--success-soft);
  color: #166534;
  border-color: transparent;
}
.status-pill.ok::before { background: var(--success); }

.status-pill.error {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: transparent;
}
.status-pill.error::before { background: var(--danger); }

.status-pill.warn {
  background: var(--warn-soft);
  color: #92400e;
  border-color: transparent;
}
.status-pill.warn::before { background: var(--warn); }

/* ---------- buttons ---------- */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 120ms ease, border-color 120ms ease;
}

button:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

button.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

button.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}

button.btn-primary-focus {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

button.btn-primary-focus:hover {
  background: #111827;
  border-color: #111827;
}

button.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: transparent;
  padding: 4px 8px;
}

button.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

a.inline-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

a.inline-link:hover {
  text-decoration: underline;
}

button.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

button.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ---------- inputs ---------- */
input, textarea, select {
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

input[type="file"] {
  padding: 4px;
  font-size: 12px;
}

textarea {
  resize: vertical;
  min-height: 56px;
  font-family: var(--font-mono);
}

input.num {
  width: 80px;
}

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.collector-hero-card .card-body {
  padding-top: 20px;
}

.collector-launch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.collector-launch-panel,
.collector-side-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 18px;
}

.collector-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
  max-width: 60ch;
}

.collector-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.action-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.action-link-primary {
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  border-color: transparent;
  color: #fff;
}

.action-link-primary:hover {
  color: #fff;
  filter: brightness(1.03);
}

.collector-side-panel {
  display: grid;
  gap: 12px;
}

.collector-feature {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.collector-feature-kicker {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.collector-feature strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.collector-feature p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

/* Cascading category select (used in Manual Entry form) */
.cascading-cat {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.cascading-cat select {
  width: 100%;
}

@media (max-width: 700px) {
  .cascading-cat {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .topbar-nav {
    width: 100%;
    order: 3;
    overflow-x: auto;
  }

  .collector-launch-grid {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.sidebar-head .count {
  color: var(--text-soft);
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.batch-row {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border-radius: var(--radius);
  margin: 2px 0;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: left;
  background: transparent;
  color: var(--text);
  width: 100%;
  position: relative;
}

.batch-row:hover {
  background: var(--surface-2);
}

.batch-row.selected {
  background: var(--accent-bg);
  border-color: var(--accent-soft);
}

.batch-row .batch-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  gap: 8px;
}

.batch-row-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-row .batch-row-file {
  font-size: 10px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-row .batch-row-meta {
  font-size: 10px;
  color: var(--muted);
}

.task-row {
  padding: 7px 8px;
  border-radius: var(--radius);
  margin: 2px 0;
  font-size: 10px;
}

.task-row + .task-row {
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
}

.task-row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.task-row-top strong {
  font-size: 11px;
  font-weight: 600;
}

.task-row-url {
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row-error {
  color: var(--danger);
  font-size: 10px;
  margin-top: 2px;
}

/* ---------- main content ---------- */
.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fafc 0%, #f6f7f9 100%);
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.content-head-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.content-head-title .meta {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 6px;
  font-family: inherit;
}

.content-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.tabbar { display: none; }

.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-soft);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.tab:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: transparent;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

.tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.tab.active .tab-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-dev {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.tab-dev.active {
  color: var(--accent);
}

.tab-pane {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 28px;
  display: grid;
  gap: 16px;
  align-content: start;
}

/* sub-tabbar within a tab pane (used in 02 货盘导入) */
.sub-tabbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
}

.sub-tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-soft);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
}

.sub-tab:hover {
  background: var(--surface);
  color: var(--text);
}

.sub-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.sub-pane {
  display: grid;
  gap: 12px;
}

/* ---------- card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

/* color accent: left-edge color strip + tinted card-head */
.card[data-accent],
.pool-card[data-pool] {
  --card-accent: #2563eb;
  --card-accent-soft: #eff6ff;
}

.card[data-accent]::before,
.pool-card[data-pool]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--card-accent);
  z-index: 1;
}

.pool-card { position: relative; }

.card[data-accent="blue"]   { --card-accent: #2563eb; --card-accent-soft: #eff6ff; }
.card[data-accent="green"]  { --card-accent: #16a34a; --card-accent-soft: #f0fdf4; }
.card[data-accent="orange"] { --card-accent: #d97706; --card-accent-soft: #fffbeb; }
.card[data-accent="red"]    { --card-accent: #dc2626; --card-accent-soft: #fef2f2; }
.card[data-accent="purple"] { --card-accent: #7c3aed; --card-accent-soft: #f5f3ff; }
.card[data-accent="cyan"]   { --card-accent: #0891b2; --card-accent-soft: #ecfeff; }
.card[data-accent="slate"]  { --card-accent: #475569; --card-accent-soft: #f1f5f9; }

.pool-card[data-pool="manual_pending"]       { --card-accent: #d97706; --card-accent-soft: #fffbeb; }
.pool-card[data-pool="amz_ready"]            { --card-accent: #2563eb; --card-accent-soft: #eff6ff; }
.pool-card[data-pool="cross_platform_ready"] { --card-accent: #16a34a; --card-accent-soft: #f0fdf4; }

.card[data-accent] > .card-head:first-of-type,
.pool-card[data-pool] > .pool-head {
  background: var(--card-accent-soft);
}

.card[data-accent] > .card-head:first-of-type > span:first-child,
.pool-card[data-pool] > .pool-head > div:first-child .pool-title {
  color: var(--text);
  font-weight: 600;
}

.section-title-icon {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--card-accent);
  text-transform: uppercase;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.6);
  margin-right: 6px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.card-head .muted {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 12px 14px;
}

/* ---------- pipeline funnel ---------- */
.pipeline-card .card-body {
  padding: 16px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  overflow: visible;
  padding: 0;
}

.pipe-node {
  min-width: 0;
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  position: relative;
  cursor: default;
  transition: border-color 120ms ease, background 120ms ease;
  box-shadow: var(--shadow-sm);
}

.pipe-topline {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pipe-node.empty {
  background: var(--surface-2);
  color: var(--muted);
}

.pipe-node.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.pipe-node.stalled {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.pipe-stage {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}

.pipe-stage-title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.pipe-node.active .pipe-stage {
  color: var(--accent);
}

.pipe-node.stalled .pipe-stage {
  color: var(--warn);
}

.pipe-count {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}

.pipe-sub {
  font-size: 11px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  line-height: 1.45;
  min-height: 32px;
}

.pipe-desc {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.55;
  flex: 1 1 auto;
}

.pipe-rate {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}

.pipe-rate.success {
  background: var(--success-soft);
  border-color: transparent;
  color: #166534;
}

.pipe-rate.warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: #92400e;
}

.pipe-rate.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: #991b1b;
}

.pipe-node.empty .pipe-count,
.pipe-node.empty .pipe-sub {
  color: var(--muted);
}

.pipe-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.pipe-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pipeline-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.pipeline-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.pipeline-legend .dot.active { background: var(--accent-bg); border: 1px solid var(--accent); }
.pipeline-legend .dot.stalled { background: var(--warn-soft); border: 1px solid var(--warn); }
.pipeline-legend .dot.empty { background: var(--surface-2); border: 1px solid var(--border-strong); }

/* ---------- KPI ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.kpi-value {
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}

.kpi.accent .kpi-value { color: var(--accent); }
.kpi.success .kpi-value { color: var(--success); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.danger .kpi-value { color: var(--danger); }

.overview-issue-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

/* ---------- table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.data-table .url-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
}

.data-table .error-cell {
  max-width: 220px;
  color: var(--danger);
  font-size: 11px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.chip.success {
  background: var(--success-soft);
  color: #166534;
  border-color: transparent;
}

.chip.warn {
  background: var(--warn-soft);
  color: #92400e;
  border-color: transparent;
}

.chip.danger {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: transparent;
}

.chip.accent {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px;
}

/* ---------- bar (gap chart inside table) ---------- */
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  width: 100%;
  min-width: 80px;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.bar-fill.warn { background: var(--warn); }
.bar-fill.danger { background: var(--danger); }

/* ---------- field row (SKU inspect / crawler probe) ---------- */
.field-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.field-row:last-child { border-bottom: 0; }

.field-row .field-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.field-row .field-value {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.field-row.missing .field-name {
  color: var(--danger);
}

.field-row .field-flags {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-self: end;
}

/* ---------- output / code ---------- */
.code {
  margin: 0;
  padding: 12px 14px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  overflow: auto;
  border-radius: 0;
  max-height: 360px;
  white-space: pre-wrap;
  word-break: break-word;
}

.code.mini { max-height: 240px; font-size: 11px; }

.output-strip {
  border-top: 1px solid var(--border);
  background: var(--surface);
  max-height: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body[data-layout="focus"] .layout {
  grid-template-columns: 1fr;
}

body[data-layout="focus"] .sidebar,
body[data-layout="focus"] .output-strip {
  display: none;
}

body[data-layout="focus"] .content {
  width: min(1180px, 100%);
  margin: 0 auto;
  background: transparent;
}

body[data-layout="focus"] .content-head {
  margin: 18px 0 0;
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
}

body[data-layout="focus"] .tab-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  box-shadow: var(--shadow);
}

body[data-layout="batch"] .output-strip {
  display: none;
}

body[data-layout="batch"] .layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body[data-layout="batch"] .sidebar {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1fr);
  gap: 10px;
  padding: 12px 24px 0;
  background: transparent;
  border-right: 0;
  overflow: visible;
  align-items: start;
}

body[data-layout="batch"] .sidebar-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  min-height: 0;
}

body[data-layout="batch"] .sidebar-head {
  margin-bottom: 6px;
}

body[data-layout="batch"] .sidebar-section:first-child {
  max-width: 420px;
}

body[data-layout="batch"] .sidebar-section:last-child {
  max-height: 280px;
  overflow: auto;
}

.empty-state.compact {
  padding: 8px 4px;
  font-size: 11px;
}

body[data-layout="batch"] .content {
  overflow: visible;
  background: transparent;
}

body[data-layout="batch"] .content-head {
  margin: 18px 24px 0;
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
}

body[data-layout="batch"] .tab-pane {
  margin: 0 24px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  box-shadow: var(--shadow);
}

.batch-context-bar {
  margin: 0 24px;
  padding: 0;
}

.batch-context-card {
  border-left: 3px solid var(--accent);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-top: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 14px 18px;
}

.batch-context-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.batch-context-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.batch-context-title {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.batch-context-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.batch-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.batch-workflow {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.batch-workflow-copy {
  min-width: 0;
}

.batch-workflow-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.batch-workflow-title {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.batch-workflow-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.batch-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.output-strip .card {
  border: 0;
  border-radius: 0;
  background: transparent;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.output-strip .code {
  flex: 1;
  border-radius: 0;
  max-height: none;
}

/* ---------- form helpers ---------- */
.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.form-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.form-row > input,
.form-row > textarea {
  flex: 1 1 200px;
}

.form-row input[type="file"] {
  flex: 1 1 240px;
}

.form-row .input-flex {
  flex: 1 1 200px;
}

.empty-state {
  padding: 28px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.muted { color: var(--muted); }
.text-soft { color: var(--text-soft); }
.mono { font-family: var(--font-mono); }
.num-cell { font-variant-numeric: tabular-nums; }

/* ---------- SKU pools (homepage) ---------- */
.pool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 200px;
}

.pool-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
}

.pool-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.pool-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.pool-count {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
}

.pool-card[data-pool="manual_pending"] .pool-count { color: var(--warn); }
.pool-card[data-pool="cross_platform_ready"] .pool-count { color: var(--success); }

.pool-body {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
}

.pool-item {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.pool-item:last-child { border-bottom: 0; }

.pool-item-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.pool-item-line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.pool-item-line1 .mono {
  font-size: 12px;
  color: var(--text);
}

.pool-item-name {
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pool-item-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pool-item button {
  padding: 4px 9px;
  font-size: 11px;
  white-space: nowrap;
}

.pool-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.pool-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
}

/* ---------- manual entry form ---------- */
.field-group {
  border-top: 1px solid var(--border);
  padding: 14px 0 6px;
}

.field-group:first-child { border-top: 0; padding-top: 4px; }

.field-group h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.field-grid.full {
  grid-template-columns: 1fr;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field.span2 { grid-column: span 2; }

.form-field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.form-field .req {
  font-size: 10px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.02em;
}

.form-field .hint {
  font-size: 11px;
  color: var(--muted);
}

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

.dim-row input { font-family: var(--font-mono); font-size: 12px; }

.manual-result {
  padding: 14px;
}

.manual-result-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- AI rewrite diff view ---------- */
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}

.diff-row {
  display: contents;
}

.diff-label {
  grid-column: 1 / -1;
  padding: 6px 14px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.diff-cell {
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  word-break: break-word;
  background: var(--surface);
  min-height: 32px;
}

.diff-cell.right { border-right: 0; }

.diff-cell.original {
  color: var(--text-soft);
  background: var(--surface-2);
}

.diff-cell.changed.right {
  background: #f0f9ff;
}

.diff-cell ul {
  margin: 0;
  padding-left: 18px;
}

.diff-cell li { margin-bottom: 2px; }

.diff-cell .img-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.diff-cell .img-list img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.diff-cell pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.diff-header > div {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-right: 1px solid var(--border);
}

.diff-header > div:last-child { border-right: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .overview-issue-grid {
    grid-template-columns: 1fr;
  }
  .pool-grid {
    grid-template-columns: 1fr;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .field-row .field-flags { justify-self: start; }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .form-field.span2 { grid-column: auto; }
  .diff-grid, .diff-header { grid-template-columns: 1fr; }
  .diff-cell, .diff-header > div { border-right: 0; }
  body[data-layout="focus"] .content {
    width: 100%;
  }
  body[data-layout="focus"] .content-head {
    margin-top: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body[data-layout="focus"] .tab-pane {
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 0;
    box-shadow: none;
  }
  body[data-layout="batch"] .sidebar {
    grid-template-columns: 1fr;
    padding: 12px 12px 0;
  }
  body[data-layout="batch"] .content-head,
  body[data-layout="batch"] .tab-pane,
  .batch-context-bar {
    margin-left: 12px;
    margin-right: 12px;
  }
  body[data-layout="batch"] .content-head {
    margin-top: 12px;
  }
  .batch-context-top,
  .batch-workflow {
    flex-direction: column;
    align-items: flex-start;
  }
  .batch-workflow-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .pipeline {
    grid-template-columns: 1fr;
  }
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .pipe-node {
    min-height: 0;
  }
  .topbar {
    padding: 0 12px;
  }
}
