:root {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #18332f;
  background: #e8efeb;
  --ink: #18332f;
  --muted: #667773;
  --green: #64e800;
  --dark: #173936;
  --line: #dce5e1;
  --soft: #eef4f1;
  --exact: #377807;
  --exact-bg: #eaf8e6;
  --fallback: #98600d;
  --fallback-bg: #fff3dd;
  --missing: #a32e29;
  --missing-bg: #fde9e7;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1000px 420px at 10% -10%, rgba(100, 232, 0, 0.12), transparent 55%),
    linear-gradient(180deg, #f4f8f5 0%, #e4ece8 100%);
  color: var(--ink);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.mock-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: baseline;
  padding: 10px 18px;
  background: #173936;
  color: #d7e6e2;
  font-size: 13px;
}
.mock-banner strong {
  color: var(--green);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--dark);
  color: var(--green);
  font-family: Manrope, DM Sans, sans-serif;
  font-weight: 800;
  font-size: 13px;
}
.brand strong { display: block; font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }
.top-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--muted);
}
.top-meta span {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 18px;
  padding: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.browse-pane,
.order-pane {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(22, 48, 44, 0.05);
  min-width: 0;
}
.order-pane {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.pane-head { margin-bottom: 16px; }
.pane-head.compact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.kicker {
  margin: 0 0 6px;
  color: #4f960f;
  font-size: 11px;
  letter-spacing: 1.4px;
  font-weight: 800;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 6px;
  font-family: Manrope, DM Sans, sans-serif;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.04em;
}
h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.03em; }
.sub { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #53645f;
  min-width: 180px;
}
.field.grow { flex: 1; min-width: 220px; }
.field small { font-weight: 400; color: var(--muted); }
.field input,
.field select {
  border: 1px solid #cfdad6;
  border-radius: 9px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: #68b72c;
  box-shadow: 0 0 0 3px rgba(100, 232, 0, 0.15);
}

.group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.group-tabs button {
  border: 1px solid var(--line);
  background: #f7faf8;
  color: #4d5f5a;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}
.group-tabs button.active {
  background: #edf8e8;
  border-color: #b7e08f;
  color: #2f6d08;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.product-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fbfdfb;
  text-align: left;
  padding: 0;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: rise 0.35s ease both;
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: #9ad35f;
  box-shadow: 0 12px 24px rgba(22, 48, 44, 0.08);
}
.product-card .thumb {
  aspect-ratio: 1;
  background: #eef3f0;
  position: relative;
  overflow: hidden;
}
.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card .thumb .placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.product-card .body {
  padding: 10px 11px 12px;
  display: grid;
  gap: 4px;
}
.product-card strong { font-size: 13px; }
.product-card .desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .meta-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  color: #6d7e79;
  margin-top: 2px;
}

.accuracy {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.accuracy.exact-color { background: var(--exact-bg); color: var(--exact); }
.accuracy.near-color { background: #e8f1ff; color: #1e4f9a; }
.accuracy.style-fallback { background: var(--fallback-bg); color: var(--fallback); }
.accuracy.no-photo { background: var(--missing-bg); color: var(--missing); }

.order-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.order-summary span {
  background: var(--soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.order-sections { display: grid; gap: 12px; }
.dept-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fbfdfb;
  animation: rise 0.3s ease both;
}
.dept-section header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 11px 13px;
  background: #f2f6f4;
  border-bottom: 1px solid var(--line);
}
.dept-section header strong { font-size: 14px; }
.dept-section header small { color: var(--muted); font-size: 11px; }
.line-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  align-items: center;
}
.line-row:first-of-type { border-top: 0; }
.line-row img,
.line-row .no-img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef3f0;
}
.line-row .no-img {
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
}
.line-row strong,
.line-row span,
.line-row small { display: block; }
.line-row strong { font-size: 13px; }
.line-row span { font-size: 12px; color: #415450; margin-top: 2px; }
.line-row small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.line-actions { display: grid; gap: 6px; justify-items: end; }
.line-actions button {
  border: 0;
  background: transparent;
  color: #7a8b86;
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
}

.order-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.primary,
.secondary {
  border-radius: 9px;
  padding: 10px 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary {
  border: 1px solid #3c840b;
  background: var(--green);
  color: #16320c;
}
.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}
.hint { margin: 0; font-size: 11px; color: var(--muted); }

dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}
dialog::backdrop { background: rgba(16, 36, 32, 0.45); }
.add-form header,
.add-form footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.add-form header { border-bottom: 1px solid var(--line); }
.add-form footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.add-form h3 { margin: 0; font-size: 17px; }
.icon-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
}
.add-body {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  padding: 16px;
}
.add-body img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  background: #eef3f0;
}
.add-body .field { margin-top: 10px; }
#add-meta { margin: 0; font-size: 13px; line-height: 1.4; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  background: #eaf8e6;
  color: #2c6806;
  border: 1px solid #bdddac;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  animation: rise 0.25s ease both;
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .order-pane {
    position: static;
    max-height: none;
  }
  .add-body { grid-template-columns: 1fr; }
  .add-body img { width: 100%; height: 180px; }
}
