:root {
  --bg: #f4f1ed;
  --ink: #1e2528;
  --muted: #697276;
  --line: #ded7cf;
  --panel: #fffdf9;
  --accent: #0f7c73;
  --accent-2: #a13f58;
  --warn: #b66a00;
  --bad: #b53232;
  --good: #18794e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 260px 1fr;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(420px, 100%);
  padding: 0;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.login-card .brand {
  color: var(--ink);
  margin-bottom: 22px;
}

.login-card .brand small {
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card button {
  height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font: inherit;
  cursor: pointer;
}

#loginMessage {
  margin: 0;
  min-height: 20px;
  color: var(--bad);
  font-size: 13px;
}

.sidebar {
  background: #161b1d;
  color: #f8f2eb;
  padding: 24px 18px;
  min-height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-size: 26px;
  font-weight: 800;
}

.brand small {
  display: block;
  color: #b9c1c3;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button,
.auth button {
  border: 0;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

nav button {
  color: #dce3e5;
  background: transparent;
  text-align: left;
  padding: 12px 12px;
}

nav button.active,
nav button:hover {
  background: #253034;
  color: white;
}

main {
  padding: 28px;
  min-width: 0;
}

.topbar,
.panel-head,
.status-row,
.metrics,
.item {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 17px;
}

.auth {
  display: flex;
  gap: 10px;
}

.auth input {
  height: 40px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel);
}

.auth button,
.form-block button,
.scan-box button,
.toolbar button,
.action-stack button {
  height: 40px;
  padding: 0 16px;
  background: var(--ink);
  color: white;
}

button.secondary {
  background: #e8e2da;
  color: var(--ink);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.status-row {
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 13px;
}

.pill.live {
  color: var(--good);
  border-color: #badbc9;
  background: #f3fbf6;
}

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

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

.metrics article {
  padding: 17px;
}

.metrics span,
.metrics small,
.sub {
  color: var(--muted);
}

.metrics strong {
  display: block;
  font-size: 27px;
  margin: 8px 0 4px;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
}

.panel {
  min-height: 260px;
  overflow: hidden;
}

.panel.wide {
  grid-row: span 2;
}

.panel-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.list {
  display: grid;
  gap: 0;
}

.item {
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.item strong {
  display: block;
  font-size: 14px;
}

.item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  background: var(--accent);
}

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

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

.badge.medium {
  background: var(--accent);
}

.empty {
  color: var(--muted);
  padding: 18px 16px;
  line-height: 1.45;
}

[hidden] {
  display: none;
}

.import-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 10px;
  align-items: center;
}

.step span {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e8e2da;
  color: var(--ink);
  font-weight: 800;
  grid-row: span 2;
}

.step.active span {
  background: var(--accent);
  color: white;
}

.step small {
  color: var(--muted);
  margin-top: 3px;
}

.import-grid,
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.live-import,
.folder-section {
  margin-bottom: 16px;
}

.scan-box {
  display: grid;
  grid-template-columns: 190px 1fr 150px;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.progress-area {
  padding: 16px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.progress-head span {
  color: var(--accent);
  font-weight: 800;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e9e2db;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 260ms ease;
}

.progress-log {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.progress-log p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.progress-log p.done {
  color: var(--good);
  font-weight: 800;
}

.progress-log p.error {
  color: var(--bad);
  font-weight: 800;
}

.duplicate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.duplicate-actions button {
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font: inherit;
  padding: 9px 11px;
}

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

.folder-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

.folder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.folder-card.active,
.folder-card:hover {
  border-color: rgba(15, 124, 115, 0.35);
  background: #f6faf8;
}

.folder-card strong,
.folder-card span,
.folder-card small {
  display: block;
}

.folder-card span {
  color: var(--ink);
  margin-top: 8px;
}

.folder-card small {
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.35;
}

.form-block,
.review-body,
.check-list,
.action-stack {
  padding: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  font: inherit;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.form-block {
  display: grid;
  gap: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button.full {
  width: 100%;
}

.folder-list {
  display: grid;
  gap: 0;
}

.folder {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.folder.active,
.folder:hover {
  background: #f6faf8;
}

.folder strong,
.folder span {
  display: block;
}

.folder span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.toolbar select {
  width: auto;
  min-width: 150px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbf8f4;
}

td {
  font-size: 14px;
}

.product-cell {
  display: flex;
  gap: 12px;
  align-items: center;
}

.thumb,
.product-preview {
  background:
    linear-gradient(135deg, rgba(15, 124, 115, 0.16), rgba(161, 63, 88, 0.13)),
    #efe9e1;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.thumb {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}

.product-preview {
  min-height: 250px;
}

.mini {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.discount {
  color: var(--good);
  font-weight: 800;
}

.status {
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  color: white;
  background: var(--accent);
}

.status.review {
  background: var(--warn);
}

.status.ready {
  background: var(--good);
}

.status.uploaded {
  background: var(--accent-2);
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.review-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

.review-fields,
.check-list,
.action-stack {
  display: grid;
  gap: 12px;
}

.price-insight,
.variation-box {
  border: 1px solid var(--line);
  background: #fbf8f4;
  border-radius: 8px;
  padding: 12px;
}

.price-insight strong,
.variation-box strong {
  display: block;
  margin-bottom: 5px;
}

.price-insight span {
  color: var(--muted);
  font-size: 13px;
}

.variation-box div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.variation-box span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
}

.dot.good {
  background: var(--good);
}

.dot.warn {
  background: var(--warn);
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    padding: 16px;
  }

  .brand {
    margin-bottom: 16px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  nav button {
    flex: 0 0 auto;
    padding: 10px 12px;
  }

  main {
    padding: 18px;
  }

  .metrics,
  .grid,
  .import-flow,
  .import-grid,
  .review-grid,
  .folder-grid,
  .scan-box {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  h1 {
    font-size: 24px;
  }

  .auth {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth input {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .auth button {
    width: 100%;
    padding: 0 10px;
    font-size: 14px;
  }

  .workspace-head,
  .toolbar,
  .review-body {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }
}

@media (max-width: 420px) {
  .mark {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .brand small {
    font-size: 12px;
  }

  .auth button {
    font-size: 13px;
  }

  .step {
    padding: 12px;
  }

  .scan-box {
    padding: 14px;
  }
}
