:root {
  color-scheme: light;
  --bg: #f4f7f3;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --text: #243043;
  --muted: #647185;
  --line: #dfe6dc;
  --primary: #ec633e;
  --primary-dark: #cf4b2f;
  --green: #278b5c;
  --warn: #b24a34;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

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

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.header-actions,
.login-row,
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-panel,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.login-panel {
  max-width: 560px;
}

.login-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(236, 99, 62, 0.12);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

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

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.danger-button {
  background: #fff1ed;
  color: var(--warn);
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: -4px -4px 18px;
  padding: 0 4px 12px;
}

.tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 800;
}

.tab.active {
  border-color: rgba(236, 99, 62, 0.3);
  background: #fff2ec;
  color: var(--primary-dark);
}

.message {
  min-height: 24px;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.message.error {
  color: var(--warn);
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.table-list {
  display: grid;
  gap: 10px;
}

.row-item {
  display: grid;
  grid-template-columns: 84px 1fr 110px 96px 92px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.row-item.level-row {
  grid-template-columns: 70px repeat(4, minmax(0, 1fr)) 92px;
}

.row-item.recipe-row {
  grid-template-columns: 70px 1.3fr repeat(3, minmax(0, 1fr)) 92px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.orders-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border-top: 1px dashed var(--line);
  margin-top: 2px;
  padding-top: 10px;
}

.orders-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-row {
  display: grid;
  grid-template-columns: 1fr 1fr 92px;
  gap: 10px;
}

.raw-json {
  min-height: 560px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 14px 36px;
  }

  .app-header,
  .header-actions,
  .login-row,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    overflow-x: auto;
  }

  .form-grid,
  .metrics-grid,
  .row-item,
  .row-item.level-row,
  .row-item.recipe-row,
  .order-row {
    grid-template-columns: 1fr;
  }
}
