:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1b1f23;
  --muted: #687077;
  --line: #dfe3df;
  --accent: #12715b;
  --accent-dark: #0c5746;
  --warn: #9a5b00;
  --bad: #a22929;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Arial, Helvetica, sans-serif;
}

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

.sidebar {
  background: #17211f;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.subtle {
  color: #aeb8b5;
  margin-top: 4px;
}

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

.nav-item {
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  color: #dce4e1;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: #263633;
}

.main {
  padding: 28px;
}

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

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

h1 {
  font-size: 26px;
}

h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

input {
  width: min(360px, 100%);
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

select,
textarea {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}

select {
  height: 38px;
}

textarea {
  font-family: Consolas, Monaco, monospace;
  resize: vertical;
}

.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  cursor: pointer;
}

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

.button.primary:hover {
  background: var(--accent-dark);
}

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

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

.orders-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.25fr);
  gap: 16px;
  align-items: start;
}

.catalogue-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(520px, 1.4fr);
  gap: 16px;
  align-items: start;
}

.row,
.head {
  display: grid;
  grid-template-columns: 150px 1fr 120px 150px 170px;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.head {
  min-height: 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.order-list-head,
.order-row {
  grid-template-columns: 1.2fr 160px 90px;
}

.catalogue-list-head,
.catalogue-row {
  grid-template-columns: 1fr 90px;
}

.order-row,
.catalogue-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.order-row:hover,
.order-row.selected,
.catalogue-row:hover,
.catalogue-row.selected {
  background: #f3f8f5;
}

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

.status {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e9efec;
  color: #26453d;
  font-size: 12px;
  font-weight: 700;
}

.status.tradeprint_submission_unknown,
.status.tradeprint_submission_failed {
  background: #f8e8e8;
  color: var(--bad);
}

.status.pending_review {
  background: #fff3d9;
  color: var(--warn);
}

.status.submitted_to_tradeprint {
  background: #def3ea;
  color: #0b604b;
}

.status.submitting_to_tradeprint {
  background: #e5eef7;
  color: #204e78;
}

/* Catalogue mapping status is a different axis from order status (it's
   "how far into being a real product" not "how far into fulfilment"), so
   it gets its own three colors instead of borrowing order-status ones —
   previously "Mapped internal" and "Unmapped" both fell back to the same
   pending_review orange, which read as if an unmapped product needed the
   same attention as one already mapped and awaiting enablement. */
.status.catalog-enabled {
  background: #def3ea;
  color: #0b604b;
}

.status.catalog-mapped {
  background: #e5eef7;
  color: #204e78;
}

.status.catalog-unmapped {
  background: #eceeec;
  color: var(--muted);
}

.status-inline {
  padding: 1px 8px;
  font-size: 10.5px;
  margin: 0 2px;
}

.muted {
  color: var(--muted);
}

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

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

.panel {
  padding: 18px;
}

.detail {
  position: sticky;
  top: 18px;
}

.detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 14px;
}

.notice.bad {
  border-color: #e6bcbc;
  background: #fff3f3;
  color: var(--bad);
}

.notice.good {
  border-color: #b7dfce;
  background: #f0faf5;
  color: #0b604b;
}

.notice.warn {
  border-color: #ead3a4;
  background: #fff8e8;
  color: var(--warn);
}

.facts {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 9px 14px;
  margin: 0 0 18px;
}

/* Two label/value pairs per row on wide panels — the catalogue detail panel
   in particular stacks several of these dl lists, and a single fixed
   150px/1fr column wastes most of the panel's width on short values like
   "26264" or "60%". Falls back to one pair per row narrower than 760px. */
#catalogueDetail .facts {
  grid-template-columns: 150px 1fr 150px 1fr;
}

@media (max-width: 760px) {
  #catalogueDetail .facts {
    grid-template-columns: 150px 1fr;
  }
}

.facts-more {
  margin: 0 0 18px;
}

.facts-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.facts-more[open] summary {
  margin-bottom: 12px;
}

.facts-more .facts,
.facts-more pre {
  margin-bottom: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.chip {
  display: inline-grid;
  gap: 2px;
  max-width: 230px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fbfcfb;
}

.chip.wide {
  max-width: 100%;
}

.chip strong {
  color: var(--muted);
  font-size: 11px;
}

.events {
  display: grid;
  gap: 8px;
}

.media-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.service-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.service-card {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.service-card strong {
  font-size: 14px;
}

.service-card span {
  color: var(--muted);
  font-size: 12px;
}

.event {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.event span {
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 14px;
  margin-bottom: 12px;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 320px));
  gap: 14px;
  margin-bottom: 14px;
}

.catalogue-margin {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form.wide-form label {
  min-width: min(100%, 320px);
  flex: 1 1 320px;
}

.actions.tight {
  margin: 0;
}

.artwork-upload {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

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

pre {
  overflow: auto;
  min-height: 120px;
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 6px;
  background: #f1f3f1;
  color: #202624;
}

pre.compact {
  min-height: 0;
  max-height: 360px;
}

.status-board {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.mini-table {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.mini-head,
.mini-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 90px 110px minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.mini-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  background: #fbfcfb;
}

.mini-row:last-child {
  border-bottom: 0;
}

.mini-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

dl {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px 18px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

.empty {
  padding: 24px;
  color: var(--muted);
}

.hidden {
  display: none;
}

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

  .sidebar {
    gap: 14px;
  }

  nav,
  .topbar,
  .toolbar {
    flex-wrap: wrap;
  }

  .row,
  .head,
  .mini-head,
  .mini-row {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .service-cards {
    grid-template-columns: 1fr;
  }

  .orders-layout,
  .catalogue-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .detail {
    position: static;
  }
}
