:root {
  color-scheme: light;
  --ink: #1e1a16;
  --muted: #675d52;
  --line: #e3dacb;
  --paper: #f3efe6;
  --card: #fffdf8;
  --side: #1c2822;
  --side-ink: #e7efe9;
  --accent: #0f6e56;
  --accent-dark: #0c5a47;
  --bad: #8d2b2b;
  --warn: #8a4b08;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 "Segoe UI", "Helvetica Neue", sans-serif;
}

a { color: var(--accent-dark); }

button, .button, input, select, textarea { font: inherit; }

button, .button {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover, .button:hover { background: var(--accent-dark); }

button.quiet, a.quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid #d5cbbd;
}

button.quiet:hover, a.quiet:hover { background: #f6f1e8; }

button.danger {
  background: transparent;
  color: var(--bad);
  border: 1px solid #e4b4b4;
}

button.danger:hover { background: #fdf2f2; }

input, select, textarea {
  width: 100%;
  border: 1px solid #d9d0c3;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: white;
  color: var(--ink);
}

textarea { min-height: 5.5rem; resize: vertical; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.side {
  background: var(--side);
  color: var(--side-ink);
  padding: 1.1rem 0.9rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  flex-direction: column;
  color: white;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.2rem 0.55rem 0.8rem;
}

.brand small {
  font-weight: 500;
  color: #b7c7be;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.side nav { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-label {
  margin: 0.85rem 0.55rem 0.2rem;
  color: #8ea399;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side nav a {
  color: var(--side-ink);
  text-decoration: none;
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
}

.side nav a:hover, .side nav a.active { background: #2a3b33; }

.side nav a.active { box-shadow: inset 3px 0 0 #8dceB0; }

.side-foot {
  margin-top: auto;
  padding: 1rem 0.55rem 0.2rem;
}

.side-foot p { margin: 0 0 0.45rem; font-size: 0.92rem; }

main { padding: 1.4rem 1.5rem 3rem; }

.page { max-width: 1120px; }

.page-head h1, .auth-card h1 { margin: 0 0 0.25rem; font-size: 1.7rem; }

.page-head p, .intro { margin: 0 0 1rem; color: var(--muted); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.panel h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
}

.stat span { display: block; color: var(--muted); font-size: 0.82rem; }

.stat strong { display: block; font-size: 1.6rem; margin-top: 0.15rem; }

.stat:hover { border-color: #b7cfc4; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

td, th {
  padding: 0.55rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.num { text-align: right; font-variant-numeric: tabular-nums; }

.sku, .mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }

.banner {
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin: 0 0 1rem;
}

.banner.ok { background: #e5f6ee; color: #0d4f3d; }

.banner.bad { background: #fdecec; color: var(--bad); }

.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: #eeeae3;
}

.chip.ordered { background: #d9e8ff; }
.chip.partial { background: #ffe8c2; color: var(--warn); }
.chip.received, .chip.shipped { background: #d5f2e3; color: #0d4f3d; }
.chip.cancelled { background: #f3d6d6; color: var(--bad); }

.form-row { display: flex; flex-direction: column; gap: 0.28rem; margin-bottom: 0.75rem; }

.form-row label, .check { font-size: 0.82rem; font-weight: 650; font-weight: 600; }

.grid-2, .grid-3 {
  display: grid;
  gap: 0.75rem;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1.4fr 1fr 1fr; }

.inline-form, .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }

.inline-form .form-row { margin: 0; min-width: 10rem; flex: 1; }

.actions { margin-top: 0.4rem; }

.check { display: flex; gap: 0.45rem; align-items: center; font-weight: 500; }

.check input { width: auto; }

.muted { color: var(--muted); }

.plus { color: var(--accent-dark); font-weight: 700; }
.minus { color: var(--bad); font-weight: 700; }

.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.scan-input {
  font-size: 1.45rem;
  padding: 0.75rem 0.85rem;
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
}

.split { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

.label-sheet { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.label-card {
  width: 280px;
  border: 1px dashed #c9bfb0;
  background: white;
  padding: 0.75rem;
}

.label-card svg { width: 100%; height: auto; display: block; }
.label-card strong, .label-card span { display: block; }
.label-card .sku { margin-top: 0.25rem; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.3rem 1.3rem 1.1rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.empty { color: var(--muted); margin: 0.2rem 0 0; }

@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: sticky; top: 0; height: auto; z-index: 2; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { display: none; }
  .side nav a { white-space: nowrap; }
  .side-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
  .stats, .split, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media print {
  .side, .noprint, .banner { display: none !important; }
  body, .shell, main, .page { display: block; background: white; max-width: none; }
  .panel, .label-card { break-inside: avoid; }
}
