:root {
  --bg: #f6f6f4; --card: #fff; --ink: #1a1a1a; --muted: #6b6b6b;
  --line: #dcdcd6; --danger: #b3261e; --ok: #1f6f43; --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 32px 20px 64px; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 860px; margin: 0 auto; }
header { margin-bottom: 24px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
label {
  display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-bottom: 6px; font-weight: 600;
}
input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; font-variant-numeric: tabular-nums; background: #fff; color: var(--ink);
}
input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
.po-row { max-width: 280px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 0 8px 8px 0; border-bottom: 1px solid var(--line);
}
td { padding: 8px 8px 8px 0; vertical-align: middle; }
td:last-child, th:last-child { padding-right: 0; width: 36px; }
.col-sku { width: 50%; } .col-num { width: 22%; }
.row-remove {
  background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--muted);
  cursor: pointer; width: 32px; height: 34px; font-size: 18px; line-height: 1; padding: 0;
}
.row-remove:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.row-remove:disabled { opacity: 0.3; cursor: default; }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
button.primary, button.ghost { font: inherit; font-weight: 600; border-radius: 7px; cursor: pointer; padding: 10px 18px; }
button.primary { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
button.primary:hover:not(:disabled) { background: #000; }
button.primary:disabled { opacity: 0.5; cursor: default; }
button.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.ghost:hover { border-color: var(--ink); }
.summary { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.summary .per-sku { display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }
.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; white-space: pre-wrap; display: none; }
.alert.show { display: block; }
.alert.error { background: #fdecea; color: var(--danger); border: 1px solid #f3c4c0; }
.alert.ok { background: #e9f5ee; color: var(--ok); border: 1px solid #c3e2d1; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.password-row { max-width: 280px; margin-top: 16px; }
.spin {
  display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -1px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SKU autocomplete */
.ac {
  position: fixed; z-index: 50; display: none;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  max-height: 384px; overflow-y: auto;
}
.ac.show { display: block; }
.ac-item {
  padding: 7px 10px; cursor: pointer;
  border-bottom: 1px solid #f2f2ee;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item.on, .ac-item:hover { background: #f0f0eb; }
.ac-top {
  display: flex; gap: 9px; align-items: baseline; min-width: 0;
}
.ac-sku {
  font-weight: 600; font-variant-numeric: tabular-nums;
  white-space: nowrap; flex: none;
}
/* the discriminating part: which variant this SKU actually is */
.ac-var {
  font-weight: 500; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* the listing title, with any shared prefix already stripped */
.ac-name {
  color: var(--muted); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
