:root {
  --bg: #f4f0e6;
  --ink: #1b1e24;
  --muted: #5e6572;
  --card: #fffdf8;
  --line: #ddd2bd;
  --brand: #2b6e5f;
  --brand-2: #17493f;
  --warn: #b43333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #e9ddc2 0%, transparent 30%),
    radial-gradient(circle at left 20%, #d8ebdf 0%, transparent 20%),
    var(--bg);
}

.layout {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1.1fr 1fr;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
}

.muted {
  margin: 0 0 14px;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

select,
input,
textarea,
button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 220px;
  margin-top: 10px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button {
  cursor: pointer;
  border-color: transparent;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

button:hover {
  background: var(--brand-2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button.secondary {
  background: #efebe2;
  color: var(--ink);
  border: 1px solid var(--line);
}

.cat-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
  background: #fff;
}

.dislikes-wrap {
  margin-top: 12px;
}

.dislikes-label {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

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

.toggle-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-pill span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.toggle-pill input:checked + span {
  background: #ffe8d1;
  border-color: #d18a43;
  color: #3a2a1c;
  font-weight: 700;
}

.input-warn {
  margin: 8px 0 0;
  min-height: 18px;
  color: var(--warn);
  font-size: 13px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  min-height: 380px;
}

#outputSummary {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.overview-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.overview-row {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #efe8d8;
}

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

.overview-qty {
  font-weight: 700;
}

.overview-name {
  min-width: 0;
}

.overview-empty {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.meta {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
}

#warnings {
  margin-top: 10px;
}

.warn {
  margin: 6px 0 0;
  color: var(--warn);
  font-size: 14px;
}

.ok {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--brand-2);
}

details {
  margin-top: 14px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.reorder-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.reorder-card {
  grid-column: 1 / -1;
}

.reorder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.reorder-toggle {
  display: inline-flex;
  gap: 6px;
}

.reorder-tab {
  background: #efebe2;
  color: var(--ink);
  border: 1px solid var(--line);
}

.reorder-tab:hover {
  background: #e3dccd;
}

.reorder-tab.is-active {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

.reorder-copy-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.reorder-copy-status {
  margin: 0;
  min-height: 20px;
}

.reorder-copy-status.is-ok {
  color: var(--brand-2);
}

.reorder-copy-status.is-error {
  color: var(--warn);
}

.reorder-panels {
  margin-top: 8px;
}

.reorder-panel {
  display: none;
}

.reorder-panel.is-active {
  display: block;
}

.default-set-editors {
  margin-top: 14px;
  border-top: 1px solid #efe8d8;
  padding-top: 12px;
}

.default-set-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.default-set-tabs {
  display: inline-flex;
  gap: 6px;
}

.default-set-tab {
  background: #efebe2;
  color: var(--ink);
  border: 1px solid var(--line);
}

.default-set-tab:hover {
  background: #e3dccd;
}

.default-set-tab.is-active {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

.default-context-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.default-context-tab {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.default-context-tab:hover {
  background: #efebe2;
}

.default-context-tab.is-active {
  background: #e3dccd;
  border-color: #c9bfae;
}

.default-set-summary {
  margin-bottom: 8px;
}

.default-set-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
}

.default-set-total.is-valid {
  border-color: #85b7aa;
  color: var(--brand-2);
  background: #ecf8f4;
}

.default-set-total.is-invalid {
  border-color: #db9c9c;
  color: #7b1f1f;
  background: #fff0f0;
}

.default-set-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.default-set-row {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #efe8d8;
  font-size: 13px;
}

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

.default-set-row-id {
  color: var(--muted);
  font-size: 12px;
}

.default-set-row-name {
  min-width: 0;
}

.default-set-row-qty input {
  width: 74px;
  text-align: right;
  padding: 6px 8px;
}

.default-set-validation {
  margin-top: 8px;
  min-height: 20px;
}

.default-set-meta {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.default-set-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.default-set-status {
  min-height: 20px;
}

.default-set-status.is-ok {
  color: var(--brand-2);
}

.default-set-status.is-error {
  color: var(--warn);
}

.reorder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: 520px;
  overflow: auto;
}

.order-item {
  display: grid;
  grid-template-columns: 24px 64px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #efe8d8;
  font-size: 13px;
  cursor: grab;
}

.order-item.is-dragging {
  opacity: 0.5;
  background: #f7f3ea;
}

.order-item:last-child {
  border-bottom: 0;
}

.drag-handle {
  color: var(--muted);
  font-weight: 700;
  cursor: grab;
}

.order-id {
  color: var(--muted);
  font-size: 12px;
}

.order-name {
  min-width: 0;
}

.order-type {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--muted);
}

.order-actions {
  display: inline-flex;
  gap: 4px;
}

.order-btn {
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  background: #efebe2;
  color: var(--ink);
  border: 1px solid var(--line);
}

.order-btn:hover {
  background: #e3dccd;
}

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

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

  .toggle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .reorder-list {
    max-height: 380px;
  }

  .default-set-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .default-set-row {
    grid-template-columns: 72px 1fr 80px;
    gap: 8px;
  }
}
