:root {
  --ink: #16202a;
  --muted: #64748b;
  --line: #d8e0e8;
  --surface: #ffffff;
  --soft: #f5f7fa;
  --navy: #17324d;
  --blue: #2463eb;
  --green: #157347;
  --yellow: #9a6700;
  --red: #b42318;
  --cyan: #036672;
  --shadow: 0 8px 24px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: var(--navy);
  color: #fff;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  font-weight: 700;
}

.brand-title {
  font-weight: 700;
  line-height: 1.15;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav button {
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  padding: 11px 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-note {
  margin-top: auto;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.lede {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 880px;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.danger {
  border-color: #fecaca;
  color: var(--red);
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.filters input,
.filters select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f7;
  color: #334155;
  white-space: nowrap;
}

.pill.awaiting_name,
.pill.label_needed {
  background: #fff7ed;
  color: var(--yellow);
}

.pill.submitted,
.pill.ready_for_production,
.pill.shipped,
.pill.delivered {
  background: #dcfce7;
  color: var(--green);
}

.pill.needs_review,
.pill.issue {
  background: #fee2e2;
  color: var(--red);
}

.pill.exported,
.pill.label_created {
  background: #dbeafe;
  color: var(--blue);
}

.pill.made {
  background: #cffafe;
  color: var(--cyan);
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.small-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 12px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-height: 40px;
  background: #fff;
}

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

.context {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.context-item {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.context-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.context-value {
  margin-top: 5px;
  font-weight: 700;
}

.notice {
  border-radius: 8px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  margin-bottom: 16px;
}

.notice.bad {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.notice.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .stats,
  .context,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }
}
