:root {
  color-scheme: dark;
  --bg: #0d1110;
  --surface: #151c19;
  --surface-raised: #1b2521;
  --surface-soft: #202b26;
  --ink: #edf6f1;
  --muted: #9cafaa;
  --line: #304039;
  --accent: #36c895;
  --accent-strong: #8ee7c4;
  --green: #45d39d;
  --blue: #82aaff;
  --amber: #f2c46d;
  --orange: #f0a451;
  --red: #ff827b;
  --violet: #b7a1ff;
  --cyan: #6bd6e8;
  --rose: #f28aaa;
  --field-default: #17201c;
  --field-default-head: #222e28;
  --field-default-line: #405248;
  --field-global: #16261e;
  --field-global-head: #20362b;
  --field-global-line: #58bc86;
  --field-map: #151f32;
  --field-map-head: #202d48;
  --field-map-line: #779df0;
  --field-enemy: #2a2116;
  --field-enemy-head: #3a2d1b;
  --field-enemy-line: #d49a48;
  --field-modifier: #211b32;
  --field-modifier-head: #302648;
  --field-modifier-line: #ad91ee;
  --field-tile: #142a29;
  --field-tile-head: #1d3a38;
  --field-tile-line: #58c6c1;
  --field-row: #111916;
  --field-row-alt: #18231f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  color: #edf6f1;
  background: #0f1714;
  border-right: 1px solid #25352f;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(142, 231, 196, 0.38);
  border-radius: 8px;
  color: #06120e;
  background: #8ee7c4;
  font-weight: 800;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand-block p {
  margin: 5px 0 0;
  color: #9cafaa;
  font-size: 13px;
}

.environment-control,
.profile-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(142, 231, 196, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.profile-control {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: -12px;
}

.active-profile-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: -12px;
  padding: 10px;
  border: 1px solid rgba(130, 170, 255, 0.24);
  border-radius: 8px;
  background: rgba(130, 170, 255, 0.08);
}

.active-profile-control span {
  display: block;
  margin-bottom: 2px;
  color: #9cafaa;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.active-profile-control strong {
  display: block;
  color: #edf6f1;
  font-size: 15px;
}

.active-profile-control button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(142, 231, 196, 0.32);
  border-radius: 6px;
  color: #07130f;
  background: #8ee7c4;
  font-size: 12px;
  font-weight: 800;
}

.active-profile-control button:disabled {
  cursor: not-allowed;
  color: #7c9188;
  background: rgba(255, 255, 255, 0.08);
}

.env-button,
.profile-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: #c9d8d1;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.env-button.is-active,
.profile-button.is-active {
  color: #07130f;
  background: #8ee7c4;
}

.config-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(142, 231, 196, 0.12);
  border-radius: 8px;
  color: #e4eee9;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
}

.config-button svg {
  width: 18px;
  height: 18px;
}

.config-button.is-active {
  border-color: rgba(142, 231, 196, 0.62);
  background: rgba(54, 200, 149, 0.14);
}

.config-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7d9289;
}

.nav-dot.is-dirty {
  background: #f4b740;
}

.nav-dot.is-error {
  background: #e45b50;
}

.nav-dot.is-warn {
  background: #f4b740;
}

.nav-dot.is-good {
  background: #42c38f;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  gap: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.icon-button {
  width: 40px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.icon-button svg,
.primary-button svg {
  width: 18px;
  height: 18px;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.secondary-button {
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.view-toggle-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;
}

.primary-button {
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--accent-strong);
  color: #06120e;
  background: var(--accent);
}

.primary-button:disabled {
  cursor: not-allowed;
  border-color: #48574f;
  color: #8d9b95;
  background: #344139;
}

.summary-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.summary-actions[hidden] {
  display: none;
}

.summary-actions select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.summary-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.is-good {
  color: var(--accent-strong);
  border-color: rgba(54, 200, 149, 0.42);
  background: rgba(54, 200, 149, 0.14);
}

.status-pill.is-warn {
  color: var(--amber);
  border-color: rgba(242, 196, 109, 0.38);
  background: rgba(242, 196, 109, 0.12);
}

.status-pill.is-error {
  color: var(--red);
  border-color: rgba(255, 130, 123, 0.42);
  background: rgba(255, 130, 123, 0.12);
}

.status-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.validation-details {
  display: grid;
  gap: 8px;
}

.validation-details[hidden] {
  display: none;
}

.validation-message {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.35;
}

.validation-message strong {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.validation-message span {
  overflow-wrap: anywhere;
}

.validation-message.is-error {
  color: var(--red);
  border-color: rgba(255, 130, 123, 0.42);
  background: rgba(255, 130, 123, 0.12);
}

.validation-message.is-warn {
  color: var(--amber);
  border-color: rgba(242, 196, 109, 0.38);
  background: rgba(242, 196, 109, 0.12);
}

.config-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.config-preview[hidden] {
  display: none;
}

.config-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.config-preview-header h3 {
  margin: 0;
  font-size: 15px;
}

.config-preview-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.config-preview-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.level-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  padding: 14px;
}

.level-preview-card {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
}

.level-preview-card.is-challenge {
  border-color: rgba(54, 200, 149, 0.42);
  background: rgba(54, 200, 149, 0.1);
}

.level-preview-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.level-preview-topline strong {
  font-size: 16px;
}

.level-preview-topline span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
}

.level-preview-modifier {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.level-preview-warning {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(242, 196, 109, 0.38);
  border-radius: 999px;
  color: var(--amber);
  background: rgba(242, 196, 109, 0.12);
  font-size: 11px;
  font-weight: 850;
}

.audio-preview-table-wrap {
  overflow-x: auto;
}

.audio-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audio-preview-table th,
.audio-preview-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.audio-preview-table th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audio-preview-table code {
  color: var(--text);
}

.audio-preview-table .is-good {
  color: var(--accent-strong);
}

.audio-preview-table .is-warn {
  color: var(--amber);
}

.audio-volume-input {
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  min-height: 30px;
  padding: 0 8px;
  width: 72px;
}

.audio-volume-input:focus {
  border-color: var(--accent);
  outline: none;
}

.audio-action-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.audio-upload-button,
.audio-remove-button {
  align-items: center;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  padding: 0 10px;
}

.audio-remove-button {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.audio-remove-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.audio-upload-button input {
  display: none;
}

.compact-button {
  min-height: 32px;
  padding: 0 12px;
}

.playtest-summary {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.playtest-summary[hidden] {
  display: none;
}

.playtest-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.playtest-summary-header h3 {
  margin: 0;
  font-size: 15px;
}

.playtest-summary-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.playtest-summary-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.summary-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 360px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.summary-empty svg {
  width: 34px;
  height: 34px;
  color: var(--accent);
}

.summary-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.summary-empty span {
  font-size: 13px;
}

.summary-warning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(242, 196, 109, 0.32);
  color: var(--amber);
  background: rgba(242, 196, 109, 0.12);
  font-size: 13px;
  font-weight: 800;
}

.summary-warning-banner svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.summary-stat-card {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-stat-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-stat-card strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.summary-aggregate-wrap {
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--line);
  overflow: auto;
  background: var(--surface-raised);
}

.summary-aggregate-table {
  min-width: 980px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.summary-table-wrap {
  overflow: auto;
}

.summary-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.summary-table th {
  color: var(--muted);
  background: var(--surface-raised);
  font-size: 12px;
  font-weight: 850;
}

.summary-primary {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
}

.summary-secondary {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.summary-number {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.summary-number.is-negative {
  color: var(--red);
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
}

.summary-pill.is-good {
  color: var(--accent-strong);
  border-color: rgba(54, 200, 149, 0.42);
  background: rgba(54, 200, 149, 0.14);
}

.summary-pill.is-warn {
  color: var(--amber);
  border-color: rgba(242, 196, 109, 0.38);
  background: rgba(242, 196, 109, 0.12);
}

.summary-delete-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 130, 123, 0.42);
  border-radius: 8px;
  color: var(--red);
  background: rgba(255, 130, 123, 0.12);
  font-size: 12px;
  font-weight: 850;
}

.summary-detail-row td {
  padding-top: 0;
  background: var(--surface-raised);
}

.summary-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.summary-details summary {
  min-height: 38px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.summary-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.summary-detail-block {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.summary-detail-block.is-wide {
  align-content: start;
}

.summary-detail-block strong {
  color: var(--ink);
  font-size: 13px;
}

.summary-screenshot {
  display: block;
  max-width: 320px;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.summary-customer-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.summary-customer-card strong {
  color: var(--ink);
  font-size: 13px;
}

.summary-details pre {
  max-height: 280px;
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  overflow: auto;
  color: #d7e6de;
  background: #101713;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 360px;
  grid-template-rows: minmax(420px, 1fr) 220px;
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.content-grid.is-json-hidden {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(520px, 1fr) 220px;
}

.content-grid.is-json-hidden .editor-panel {
  display: none;
}

.content-grid.is-json-hidden .side-panel {
  grid-column: 1;
}

.editor-panel,
.side-panel,
.diff-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-panel {
  display: flex;
  flex-direction: column;
}

.side-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.diff-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.panel-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#jsonEditor {
  flex: 1;
  width: 100%;
  min-height: 360px;
  padding: 16px;
  border: 0;
  resize: none;
  outline: none;
  color: #d7e6de;
  background: #101713;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

.field-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #0f1513;
  overflow: auto;
}

.field-group {
  --group-bg: var(--field-default);
  --group-head: var(--field-default-head);
  --group-line: var(--field-default-line);
  border: 1px solid color-mix(in srgb, var(--group-line) 62%, var(--line));
  border-radius: 8px;
  background: var(--group-bg);
  box-shadow: inset 4px 0 0 var(--group-line);
  overflow: hidden;
}

.field-group summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  min-height: 42px;
  padding: 9px 12px 9px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  background: var(--group-head);
}

.field-group summary > span:nth-child(2) {
  color: var(--orange);
}

.field-group summary::marker {
  color: var(--muted);
}

.field-group.depth-0 > summary {
  background: var(--group-head);
}

.field-group.depth-1 > summary {
  background: color-mix(in srgb, var(--group-head) 72%, var(--surface));
}

.field-group.depth-2,
.field-group.depth-3 {
  --group-bg: #151d19;
  --group-head: #202a25;
}

.field-group[data-field-key="GlobalSettings"] {
  --group-bg: var(--field-global);
  --group-head: var(--field-global-head);
  --group-line: var(--field-global-line);
}

.field-group[data-field-key="Levels"] {
  --group-bg: #15211b;
  --group-head: #203127;
  --group-line: #6e9c80;
}

.field-group[data-field-key="Map"] {
  --group-bg: var(--field-map);
  --group-head: var(--field-map-head);
  --group-line: var(--field-map-line);
}

.field-group[data-field-key="EnemyConfig"],
.field-group[data-field-key="EnemySettings"],
.field-group[data-field-parent="EnemySettings"],
.field-group[data-field-key="EnemyQueue1"],
.field-group[data-field-key="EnemyQueue2"],
.field-group[data-field-key="EnemyQueue3"],
.field-group[data-field-parent="EnemyQueue1"],
.field-group[data-field-parent="EnemyQueue2"],
.field-group[data-field-parent="EnemyQueue3"] {
  --group-bg: var(--field-enemy);
  --group-head: var(--field-enemy-head);
  --group-line: var(--field-enemy-line);
}

.field-group[data-field-key="StageModifierConfig"] {
  --group-bg: var(--field-modifier);
  --group-head: var(--field-modifier-head);
  --group-line: var(--field-modifier-line);
}

.field-group[data-field-key="TileMods"] {
  --group-bg: var(--field-tile);
  --group-head: var(--field-tile-head);
  --group-line: var(--field-tile-line);
}

.field-group[data-field-context="evaluation"] {
  --group-bg: #111b17;
  --group-head: #1b2a22;
  --group-line: #7fd0a8;
}

.field-group.evaluation-config-section[data-field-key="cluster-bonus"] {
  --group-head: #22291b;
  --group-line: #a0c25a;
}

.field-group.evaluation-config-section[data-field-key="pattern-frame"] {
  --group-head: #28251b;
  --group-line: #e1b34a;
}

.field-group.evaluation-config-section[data-field-key="scoring-number-text"] {
  --group-head: #1b252c;
  --group-line: #75b8d9;
}

.field-group.evaluation-config-section[data-field-key="headline-text"] {
  --group-head: #2a1f29;
  --group-line: #c985c1;
}

.field-group.evaluation-config-section[data-field-key="bento-score-handoff"] {
  --group-head: #2a241b;
  --group-line: #d7a04f;
}

.field-group.evaluation-config-section[data-field-key="post-receipt-customer"] {
  --group-head: #241f2d;
  --group-line: #b394e8;
}

.field-group.evaluation-config-section[data-field-key="daily-goal-reward"] {
  --group-head: #1b2a2b;
  --group-line: #76d6d0;
}

.field-group.evaluation-config-section[data-field-key="hot-cold-moisture"] {
  --group-head: #1b2430;
  --group-line: #78a8e6;
}

.field-group.evaluation-config-section[data-field-key="adjacency-traits"] {
  --group-head: #231e2c;
  --group-line: #a98de0;
}

.evaluation-config-section-body {
  gap: 10px;
}

.field-group-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid color-mix(in srgb, var(--group-line) 38%, var(--line));
  background: color-mix(in srgb, var(--group-bg) 74%, var(--bg));
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--group-line, var(--line)) 30%, var(--line));
  border-radius: 8px;
  background: var(--field-row);
}

.field-row[data-field-parent="Map"] {
  background: color-mix(in srgb, var(--field-map) 66%, var(--surface));
}

.field-row[data-field-context="global"] {
  background: color-mix(in srgb, var(--field-global) 68%, var(--surface));
}

.field-row[data-field-context="map"] {
  background: color-mix(in srgb, var(--field-map) 66%, var(--surface));
}

.field-row[data-field-context="enemy"] {
  background: color-mix(in srgb, var(--field-enemy) 70%, var(--surface));
}

.field-row[data-field-context="modifier"] {
  background: color-mix(in srgb, var(--field-modifier) 66%, var(--surface));
}

.field-row[data-field-context="tile"] {
  background: color-mix(in srgb, var(--field-tile) 68%, var(--surface));
}

.field-group[data-field-context="item"] {
  --group-bg: #111b17;
  --group-head: #18251f;
  --group-line: #6e9c80;
}

.field-row[data-field-parent="EnemySettings"],
.field-row[data-field-parent="EnemyQueue1"],
.field-row[data-field-parent="EnemyQueue2"],
.field-row[data-field-parent="EnemyQueue3"] {
  background: color-mix(in srgb, var(--field-enemy) 70%, var(--surface));
}

.field-row[data-field-parent="StageModifierConfig"] {
  background: color-mix(in srgb, var(--field-modifier) 66%, var(--surface));
}

.field-row[data-field-parent="TileMods"],
.field-row[data-field-key="TileMods"] {
  background: color-mix(in srgb, var(--field-tile) 68%, var(--surface));
}

.field-label-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.field-row label {
  color: #d5e3dc;
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.field-row input,
.field-row textarea,
.field-row select {
  min-height: 34px;
  width: 100%;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #0f1613;
}

.field-row select {
  appearance: none;
  cursor: pointer;
  padding-right: 44px;
  border-color: #4d6258;
  background-color: #101916;
  background-image:
    linear-gradient(45deg, transparent 50%, #8ee7c4 50%),
    linear-gradient(135deg, #8ee7c4 50%, transparent 50%),
    linear-gradient(to right, #2d3b35, #2d3b35);
  background-position:
    calc(100% - 19px) 14px,
    calc(100% - 13px) 14px,
    calc(100% - 38px) 0;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 1px 100%;
}

.field-row select:hover,
.field-row select:focus {
  border-color: var(--green);
  background-color: #111d18;
}

.field-row textarea {
  min-height: 76px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.4;
}

.enum-checkbox-list {
  display: grid;
  gap: 6px;
}

.checkbox-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #2f4038;
  border-radius: 6px;
  background: #0e1713;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.checkbox-row span {
  min-width: 0;
  color: #d5e3dc;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.field-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.field-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #0f1613;
}

.field-icon-button:hover,
.field-icon-button:focus {
  color: var(--red);
  border-color: rgba(255, 130, 123, 0.42);
  background: rgba(255, 130, 123, 0.12);
}

.field-icon-button svg {
  width: 16px;
  height: 16px;
}

.tray-reroll-costs-field {
  gap: 10px;
}

.tray-reroll-cost-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.tray-reroll-cost-item {
  display: grid;
  grid-template-columns: 70px minmax(74px, 1fr) 34px;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid #32423b;
  border-radius: 6px;
  background: #101916;
}

.tray-reroll-cost-item span {
  color: #d5e3dc;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tray-reroll-cost-item input {
  min-height: 32px;
  padding: 0 8px;
}

.tray-reroll-cost-item .field-icon-button {
  width: 34px;
  min-height: 32px;
}

.tray-reroll-cost-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.field-summary-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.field-summary-actions .field-summary {
  min-width: 0;
}

.field-help {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--blue);
  background: transparent;
  flex: 0 0 auto;
}

.field-help:hover,
.field-help:focus-visible {
  background: rgba(130, 170, 255, 0.14);
}

.field-help svg {
  width: 16px;
  height: 16px;
}

.item-price-library > summary > span:nth-child(2) {
  color: var(--amber);
}

.item-price-library-body {
  gap: 10px;
}

.item-price-category {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, #6e9c80 34%, var(--line));
  border-radius: 8px;
  background: #0d1713;
}

.item-price-category-header {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: start;
  align-items: center;
  gap: 8px;
}

.item-price-category-header h4 {
  margin: 0;
  color: var(--orange);
  font-size: 13px;
  font-weight: 900;
}

.item-price-category-header > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.item-price-category-add {
  min-height: 28px;
  padding: 0 8px;
  gap: 4px;
  border-radius: 6px;
  font-size: 11px;
}

.item-price-category-add svg {
  width: 13px;
  height: 13px;
}

.item-price-header,
.item-price-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 88px 34px;
  justify-content: start;
  gap: 6px;
  align-items: center;
}

.item-price-header {
  width: fit-content;
  max-width: 100%;
  padding: 0 2px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.item-price-row {
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  border: 1px solid color-mix(in srgb, #6e9c80 30%, var(--line));
  border-radius: 8px;
  background: #0f1815;
}

.item-price-row select,
.item-price-row input {
  min-height: 30px;
  width: 100%;
  min-width: 0;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #0b1210;
  font-size: 12px;
}

.item-price-row select {
  appearance: none;
  cursor: pointer;
  max-width: 220px;
  padding-right: 34px;
  border-color: #4d6258;
  background-color: #101916;
  background-image:
    linear-gradient(45deg, transparent 50%, #8ee7c4 50%),
    linear-gradient(135deg, #8ee7c4 50%, transparent 50%),
    linear-gradient(to right, #2d3b35, #2d3b35);
  background-position:
    calc(100% - 16px) 13px,
    calc(100% - 10px) 13px,
    calc(100% - 30px) 0;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 1px 100%;
}

.item-price-row input {
  text-align: center;
  font-weight: 900;
}

.item-price-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.item-price-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.item-library-card {
  display: grid;
  width: 100%;
  grid-template-columns: none;
  justify-content: stretch;
  align-items: stretch;
  gap: 10px;
  padding: 10px;
}

.item-library-card-header {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.item-library-card-header strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.item-library-card-header span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-library-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 180px));
  gap: 8px;
  align-items: end;
}

.item-library-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.item-library-field > span:first-child {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
}

.item-library-field input,
.item-library-field select {
  min-height: 30px;
  width: 100%;
  min-width: 0;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #0b1210;
  font-size: 12px;
}

.item-library-field select {
  appearance: none;
  cursor: pointer;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, #8ee7c4 50%),
    linear-gradient(135deg, #8ee7c4 50%, transparent 50%),
    linear-gradient(to right, #2d3b35, #2d3b35);
  background-position:
    calc(100% - 16px) 13px,
    calc(100% - 10px) 13px,
    calc(100% - 28px) 0;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 1px 100%;
}

.item-library-toggle {
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
}

.item-library-toggle input {
  width: 36px;
  min-height: 24px;
  accent-color: var(--mint);
}

.pattern-scoring-library > summary > span:nth-child(2) {
  color: var(--amber);
}

.pattern-scoring-body {
  gap: 12px;
}

.pattern-scoring-note,
.pattern-scoring-rule-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pattern-scoring-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, #6e9c80 34%, var(--line));
  border-radius: 8px;
  background: #0d1713;
}

.pattern-scoring-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pattern-scoring-section-header h4 {
  margin: 0;
  color: var(--orange);
  font-size: 13px;
  font-weight: 900;
}

.pattern-scoring-section-header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pattern-scoring-card-summary {
  grid-template-columns: minmax(0, 1fr) auto 38px;
}

.pattern-scoring-card-header {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.pattern-scoring-card-header .pattern-scoring-field > span:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.pattern-scoring-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 150px));
  gap: 8px;
  align-items: end;
}

.pattern-scoring-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pattern-scoring-field > span:first-child {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
}

.pattern-scoring-field input,
.pattern-scoring-field select {
  min-height: 30px;
  width: 100%;
  min-width: 0;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #0b1210;
  font-size: 12px;
}

.pattern-scoring-field input[type="number"] {
  text-align: center;
  font-weight: 900;
}

.pattern-scoring-field select {
  appearance: none;
  cursor: pointer;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, #8ee7c4 50%),
    linear-gradient(135deg, #8ee7c4 50%, transparent 50%),
    linear-gradient(to right, #2d3b35, #2d3b35);
  background-position:
    calc(100% - 16px) 13px,
    calc(100% - 10px) 13px,
    calc(100% - 28px) 0;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 1px 100%;
}

.pattern-scoring-toggle .switch-field {
  min-height: 30px;
}

.pattern-mask-editor {
  display: grid;
  gap: 8px;
}

.pattern-mask-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pattern-mask-header span:first-child {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.pattern-mask-header span:last-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pattern-mask-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pattern-mask-paint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
}

.pattern-mask-paint select {
  width: 58px;
  min-height: 30px;
  padding: 4px 24px 4px 8px;
  color: var(--text);
  border: 1px solid #405248;
  border-radius: 6px;
  background: var(--panel-dark);
  font-weight: 900;
}

.pattern-mask-toolbar-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pattern-mask-grid {
  display: grid;
  gap: 5px;
  width: max-content;
}

.pattern-mask-cell {
  width: 38px;
  min-height: 38px;
  border: 1px solid #44564d;
  border-radius: 7px;
  color: #06120e;
  font-size: 13px;
  font-weight: 950;
}

.pattern-mask-cell.is-pattern {
  border-color: rgba(142, 231, 196, 0.76);
  background: #8ee7c4;
}

.pattern-mask-cell.is-filler {
  color: #9cafaa;
  border-color: #405248;
  background: #19231f;
}

.food-tray-blueprint-card-body > .pattern-scoring-field {
  max-width: 100%;
}

.food-tray-toolbar {
  align-items: flex-end;
  gap: 10px 12px;
}

.food-tray-toolbar .pattern-mask-paint {
  flex: 0 0 auto;
}

.food-tray-toolbar .pattern-mask-paint select {
  min-width: 76px;
  width: auto;
}

.food-tray-toolbar .food-tray-mode-paint select {
  min-width: 92px;
}

.food-tray-toolbar .food-tray-group-paint select {
  min-width: 64px;
}

.food-tray-toolbar .food-tray-food-paint select {
  min-width: 104px;
}

.food-tray-toolbar .pattern-mask-toolbar-hint {
  flex: 1 1 260px;
  min-width: 220px;
  line-height: 1.35;
}

.food-tray-cell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
}

.food-tray-cell-group {
  line-height: 1;
}

.food-tray-cell-food {
  position: absolute;
  right: 4px;
  bottom: 3px;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #06120e;
  background: rgba(255, 255, 255, 0.72);
  font-size: 9px;
  font-weight: 950;
}

.food-tray-cell.food-tray-food-c {
  background: #f2d36b;
  border-color: rgba(242, 211, 107, 0.88);
}

.food-tray-cell.food-tray-food-f {
  background: #82d58a;
  border-color: rgba(130, 213, 138, 0.88);
}

.food-tray-cell.food-tray-food-p {
  background: #f28f7f;
  border-color: rgba(242, 143, 127, 0.9);
}

.food-tray-cell.food-tray-food-d {
  background: #cda7ff;
  border-color: rgba(205, 167, 255, 0.88);
}

.food-tray-cell.is-filler .food-tray-cell-food {
  display: none;
}

.pattern-scoring-actions {
  padding-top: 2px;
}

.item-shape-editor {
  display: grid;
  width: fit-content;
  max-width: 100%;
  gap: 8px;
  padding-top: 2px;
}

.item-shape-editor-header,
.item-shape-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.item-shape-editor-header > span:first-child,
.item-shape-grid-label {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
}

.item-shape-editor-header > span:last-child {
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
}

.item-shape-control-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 10px;
}

.item-shape-grid-wrap {
  display: grid;
  gap: 4px;
}

.item-shape-grid {
  display: grid;
  gap: 4px;
}

.item-shape-cell {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #416355;
  border-radius: 6px;
  color: #1b1508;
  background: #ccf1e3;
  font-size: 12px;
  font-weight: 1000;
}

.item-shape-cell.is-empty {
  border-style: dashed;
  color: var(--muted);
  background: #14211d;
}

.item-shape-cell.is-pivot {
  border-color: #f7bd45;
  background: #f7bd45;
}

.item-shape-grid-pivot .item-shape-cell:not(:disabled):hover,
.item-shape-grid-cells .item-shape-cell:hover {
  transform: translateY(-1px);
}

.bento-shape-library-body {
  gap: 12px;
}

.bento-shape-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, #6e9c80 38%, var(--line));
  border-radius: 8px;
  background: #111b17;
}

.bento-shape-card-group {
  display: block;
  padding: 0;
  overflow: hidden;
}

.bento-shape-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 38px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px 8px 14px;
  cursor: pointer;
  background: #17241e;
}

.bento-shape-card-summary::marker {
  color: var(--muted);
}

.bento-shape-summary-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.bento-shape-summary-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--amber);
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bento-shape-summary-title span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bento-shape-summary-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bento-shape-summary-meta.is-good {
  color: var(--green);
}

.bento-shape-summary-meta.is-warn {
  color: var(--amber);
}

.bento-shape-card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid color-mix(in srgb, #6e9c80 34%, var(--line));
  background: #111b17;
}

.bento-shape-card-group .bento-shape-card-header {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}

.designed-order-card {
  gap: 8px;
  padding: 10px;
}

.designed-order-card .bento-shape-card-header {
  grid-template-columns: auto minmax(180px, 1fr) 34px 34px 34px;
  gap: 6px;
}

.designed-order-card .bento-shape-card-header input,
.bento-shape-expected-score input {
  min-height: 32px;
}

.designed-order-card .switch-field {
  min-height: 32px;
}

.designed-order-card .field-icon-button {
  width: 34px;
  min-height: 34px;
}

.designed-order-body {
  display: grid;
  grid-template-columns: minmax(220px, max-content) minmax(300px, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.bento-shape-library > summary > span:nth-child(2),
.designed-orders-field > summary > span:nth-child(2) {
  color: var(--amber);
}

.designed-order-top-controls {
  display: grid;
  grid-column: 2;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 170px);
  gap: 8px;
  align-items: end;
}

.designed-order-select-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.designed-order-select-field > span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.designed-order-select-field select {
  min-height: 32px;
  width: 100%;
  min-width: 0;
  border: 1px solid #4d6258;
  border-radius: 7px;
  padding: 0 44px 0 10px;
  color: var(--ink);
  background-color: #101916;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%),
    linear-gradient(to right, #2d3b35, #2d3b35);
  background-position:
    calc(100% - 19px) 13px,
    calc(100% - 13px) 13px,
    calc(100% - 35px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 1px 22px;
  appearance: none;
}

.designed-order-select-field select:hover,
.designed-order-select-field select:focus {
  border-color: var(--green);
  background-color: #111d18;
}

.designed-demand-editor {
  display: grid;
  grid-column: 2;
  gap: 6px;
}

.designed-demand-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.designed-demand-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 7px;
  border: 1px solid #30443b;
  border-radius: 8px;
  background: #0f1815;
}

.designed-demand-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d5e3dc;
  font-size: 12px;
  font-weight: 900;
}

.designed-demand-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(142, 231, 196, 0.12);
}

.designed-demand-field.is-protein .designed-demand-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 130, 123, 0.14);
}

.designed-demand-field.is-veg .designed-demand-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(142, 231, 196, 0.14);
}

.designed-demand-field.is-carb .designed-demand-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(242, 196, 109, 0.14);
}

.designed-demand-field.is-dessert .designed-demand-dot {
  background: var(--rose);
  box-shadow: 0 0 0 3px rgba(242, 138, 170, 0.16);
}

.designed-demand-controls {
  display: grid;
  grid-template-columns: 28px minmax(34px, 1fr) 28px;
  gap: 4px;
  align-items: center;
}

.designed-demand-controls input {
  min-height: 28px;
  width: 100%;
  min-width: 0;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  padding: 0 6px;
  color: var(--ink);
  background: #0b1210;
  text-align: center;
  font-weight: 900;
}

.designed-demand-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 28px;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  color: var(--ink);
  background: #14211c;
}

.designed-demand-stepper:hover,
.designed-demand-stepper:focus-visible {
  border-color: var(--green);
  color: #06120e;
  background: var(--green);
}

.designed-demand-stepper svg {
  width: 14px;
  height: 14px;
}

.designed-specific-request-editor {
  display: grid;
  grid-column: 2;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #30443b;
  border-radius: 8px;
  background: #0d1713;
}

.designed-specific-request-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.designed-specific-request-header > span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.designed-specific-request-header .switch-field {
  min-height: 28px;
}

.designed-specific-request-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
}

.designed-specific-count-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.designed-specific-count-field > span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.designed-specific-request-preview {
  grid-column: 1 / -1;
  min-height: 28px;
  padding: 7px 9px;
  border: 1px solid rgba(142, 231, 196, 0.26);
  border-radius: 7px;
  color: var(--green);
  background: rgba(54, 200, 149, 0.08);
  font-size: 12px;
  font-weight: 850;
}

.designed-order-shape-editor {
  --designed-shape-cell-size: 30px;
  grid-column: 1;
  grid-row: 1 / span 3;
  align-content: start;
  min-width: 0;
}

.designed-order-shape-editor .field-control-row {
  display: grid;
  min-width: min(100%, 220px);
}

.designed-order-shape-editor .bento-shape-grid {
  grid-auto-rows: var(--designed-shape-cell-size);
  gap: 4px;
}

.designed-order-shape-editor .bento-shape-cell {
  width: var(--designed-shape-cell-size);
  min-height: var(--designed-shape-cell-size);
  border-radius: 6px;
}

.designed-order-body > .bento-shape-status {
  grid-column: 1 / -1;
}

.bento-shape-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(132px, 0.45fr);
  gap: 8px;
  align-items: center;
}

.bento-shape-card-header input,
.bento-shape-expected-score input {
  min-height: 34px;
  border: 1px solid #3d4d46;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #0f1613;
}

.bento-shape-expected-score {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(74px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bento-shape-expected-score span {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.bento-shape-expected-score {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(74px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bento-shape-expected-score span {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.inventory-size-controls {
  display: inline-grid;
  grid-template-columns: auto 74px auto 74px;
  align-items: center;
  justify-content: start;
  gap: 8px;
  max-width: max-content;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--orange) 34%, var(--line));
  border-radius: 8px;
  background: rgba(240, 164, 81, 0.08);
}

.inventory-size-label {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.inventory-size-separator {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.inventory-size-controls select {
  min-height: 34px;
  width: 74px;
  border: 1px solid #5c5a42;
  border-radius: 6px;
  padding: 0 28px 0 10px;
  color: var(--ink);
  background-color: #101916;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--orange) 50%),
    linear-gradient(135deg, var(--orange) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 14px,
    calc(100% - 9px) 14px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  appearance: none;
}

.inventory-size-controls select:hover,
.inventory-size-controls select:focus {
  border-color: var(--orange);
}

.bento-shape-grid {
  display: grid;
  grid-template-columns: repeat(5, 38px);
  grid-auto-rows: 38px;
  gap: 5px;
}

.bento-soup-editor {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.bento-soup-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
}

.bento-soup-editor-header span:first-child {
  color: var(--amber);
}

.bento-soup-editor-header span:last-child {
  color: var(--cyan);
}

@media (max-width: 1100px) {
  .designed-order-body {
    grid-template-columns: 1fr;
  }

  .designed-order-shape-editor {
    grid-column: auto;
    grid-row: auto;
  }

  .designed-order-top-controls,
  .designed-demand-editor,
  .designed-specific-request-editor {
    grid-column: auto;
  }

  .designed-demand-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .designed-order-card .bento-shape-card-header {
    grid-template-columns: auto minmax(0, 1fr) 34px 34px 34px;
  }

  .item-price-header {
    display: none;
  }

  .item-price-row {
    grid-template-columns: minmax(0, 1fr) 90px 38px;
  }

  .designed-order-top-controls,
  .designed-demand-grid {
    grid-template-columns: 1fr;
  }
}

.bento-soup-grid {
  display: grid;
  grid-template-columns: repeat(5, 38px);
  grid-auto-rows: 38px;
  gap: 5px;
}

.bento-shape-cell {
  width: 38px;
  min-height: 38px;
  border: 1px solid #44564d;
  border-radius: 7px;
  background: #0f1613;
}

.bento-shape-cell.is-active {
  border-color: rgba(142, 231, 196, 0.72);
  background: #d7e2dc;
}

.bento-shape-cell.is-disabled {
  border-color: rgba(255, 130, 123, 0.5);
  background:
    linear-gradient(135deg, transparent 43%, rgba(255, 130, 123, 0.9) 44%, rgba(255, 130, 123, 0.9) 56%, transparent 57%),
    #222a26;
}

.bento-shape-cell.is-soup-covered {
  color: #06120e;
  border-color: #9b5d35;
  background: #c46f35;
  font-size: 13px;
  font-weight: 950;
}

.bento-shape-cell.is-soup-anchor {
  border-color: #ffd36a;
  box-shadow: inset 0 0 0 2px rgba(255, 211, 106, 0.55);
}

.bento-soup-cell {
  width: 38px;
  min-height: 38px;
  border: 1px dashed #44564d;
  border-radius: 7px;
  color: #06120e;
  background: #111b17;
  font-size: 13px;
  font-weight: 950;
}

.bento-soup-cell.is-active {
  background: #202c27;
}

.bento-soup-cell.is-valid-anchor {
  cursor: pointer;
  border-color: rgba(142, 231, 196, 0.5);
}

.bento-soup-cell.is-soup-covered {
  border-style: solid;
  border-color: #9b5d35;
  background: #c46f35;
}

.bento-soup-cell.is-selected-anchor {
  color: #06120e;
  border-color: #ffd36a;
  background: #f3b548;
}

.bento-soup-cell.is-disabled:not(.is-soup-covered) {
  opacity: 0.45;
}

.bento-shape-preset-row,
.bento-shape-chip-list,
.bento-shape-actions,
.bento-soup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.bento-shape-preset-button,
.bento-shape-chip,
.bento-shape-clear-button,
.bento-shape-add-button {
  min-height: 34px;
  border: 1px solid #3d4d46;
  border-radius: 7px;
  padding: 0 10px;
  color: #d5e3dc;
  background: #0f1613;
  font-size: 12px;
  font-weight: 800;
}

.bento-shape-chip.is-selected {
  color: #06120e;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.bento-shape-clear-button {
  width: fit-content;
}

.bento-shape-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bento-shape-status.is-good {
  color: var(--green);
}

.bento-shape-status.is-warn {
  color: var(--amber);
}

.bento-shape-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.switch-field {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
  gap: 10px;
  min-height: 34px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #46554f;
  transition: background 0.16s ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e8f3ed;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  content: "";
  transition: transform 0.16s ease;
}

.switch-field input:checked + .switch-track {
  background: var(--accent);
}

.switch-field input:checked + .switch-track::after {
  transform: translateX(18px);
}

#diffView {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  color: #d7e6de;
  background: #101713;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.diff-added {
  color: var(--accent-strong);
}

.diff-removed {
  color: var(--red);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .config-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .content-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .diff-panel {
    grid-column: auto;
  }

}

@media (max-width: 560px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .config-nav {
    grid-template-columns: 1fr;
  }

  .toolbar h2 {
    font-size: 24px;
  }

  .content-grid {
    gap: 12px;
  }
}
