:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6978;
  --line: #d9dee7;
  --panel: #ffffff;
  --page: #f5f7fa;
  --accent: #136f63;
  --accent-weak: #e4f3ef;
  --warn: #9a5b00;
  --warn-weak: #fff2d6;
  --bad: #a23a34;
  --bad-weak: #fae8e6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.warning {
  background: var(--warn-weak);
  border-color: #e6c37b;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h1,
h2,
h3 {
  margin: 0;
}

.topbar h1 {
  font-size: 22px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar-actions,
.export-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 24px 28px;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

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

.view {
  display: none;
  padding-top: 16px;
}

.view.active {
  display: block;
}

#reviewView.active {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
}

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

.filters {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--ink);
  background: #fff;
}

.product-list {
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.product-row {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

.product-row.active {
  background: var(--accent-weak);
}

.product-row strong {
  font-size: 13px;
}

.row-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.detail-panel {
  min-height: 640px;
  padding: 18px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-header h2 {
  font-size: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef1f6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.good {
  background: var(--accent-weak);
  color: var(--accent);
}

.badge.warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-weak);
  color: var(--bad);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.field,
.rule-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.wide {
  grid-column: 1 / -1;
}

.rule-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.rule-list li {
  margin: 5px 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.assortment-layout,
.exports-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.assortment-layout > div,
.exports-grid > article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.queue-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.queue {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.queue h3 {
  font-size: 16px;
}

.queue ul {
  min-height: 42px;
  margin: 10px 0 0;
  padding-left: 18px;
}

textarea {
  width: 100%;
  min-height: 520px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 900px) {
  .topbar,
  .detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #reviewView.active,
  .assortment-layout,
  .exports-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
