:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d8dee6;
  --text: #17202a;
  --muted: #637083;
  --brand: #0f6b6e;
  --brand-strong: #0a4f52;
  --warn: #b86b00;
  --danger: #b42318;
  --ok: #177245;
  --chip: #e8f3f3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: #eef2f5;
  color: var(--text);
}

button.secondary:hover {
  background: #dfe7ed;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.toolbar,
.metrics,
.workspace {
  display: grid;
  gap: 16px;
}

.toolbar {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 16px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
  line-height: 1.4;
}

.toolbar p,
.product-meta,
label,
.counter-line,
.saved-state,
.product-id {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  padding: 16px;
}

.metrics span {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

.metrics label {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.workspace {
  grid-template-columns: 260px minmax(0, 1fr) 340px;
  align-items: start;
}

.panel {
  padding: 16px;
}

.filters,
.single-tagger {
  position: sticky;
  top: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  margin-top: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: white;
  padding: 10px;
}

textarea {
  resize: vertical;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

.counter-line {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  font-size: 14px;
}

.section-head,
.product-title-row,
.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.product-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.product-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-image {
  width: 132px;
  aspect-ratio: 1 / 1.22;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f5;
  border: 1px solid var(--line);
}

.product-title-row {
  align-items: start;
}

.product-id {
  display: inline-block;
  margin-bottom: 3px;
  font-size: 12px;
}

.product-link {
  white-space: nowrap;
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
}

.product-meta {
  margin-top: 6px;
  font-size: 13px;
}

.tag-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.review-row {
  margin-top: 12px;
}

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pills button {
  background: #eef2f5;
  color: var(--text);
  padding: 8px 10px;
}

.status-pills button.active[data-status="approved"] {
  background: var(--ok);
  color: white;
}

.status-pills button.active[data-status="needs_fix"] {
  background: var(--warn);
  color: white;
}

.status-pills button.active[data-status="rejected"] {
  background: var(--danger);
  color: white;
}

.single-tagger button {
  width: 100%;
  margin-top: 14px;
}

.result-block {
  margin-top: 16px;
}

.result-block h3 {
  margin-bottom: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--brand-strong);
  padding: 4px 10px;
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .single-tagger {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .toolbar,
  .metrics,
  .workspace,
  .product-card,
  .tag-edit-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .actions,
  .section-head,
  .product-title-row,
  .review-row {
    align-items: stretch;
    flex-direction: column;
  }

  .product-image {
    width: 100%;
    max-height: 280px;
  }
}
