:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --panel: #ffffff;
  --line: #d8ddd0;
  --text: #20241d;
  --muted: #667060;
  --accent: #2f6f55;
  --accent-2: #7a4b2a;
  --danger: #b13d35;
  --soft: #edf3ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 650;
}

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

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

button.icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

button.icon.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: #fff7ee;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

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

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
}

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

h3 {
  font-size: 16px;
}

.status {
  min-height: 28px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.column {
  display: grid;
  gap: 14px;
}

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

.form-grid {
  display: grid;
  gap: 10px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

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

.tabs button.active {
  background: var(--accent);
  color: #fff;
}

.hidden {
  display: none !important;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 26px;
  line-height: 1.1;
}

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

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

.meal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f0f4ec;
  border-bottom: 1px solid var(--line);
  font-weight: 750;
}

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.entry:first-child {
  border-top: 0;
}

.entry small,
.empty {
  color: var(--muted);
}

.dish-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 260px;
  overflow: auto;
}

.dish {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.dish-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}

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

.dish-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dish-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--soft);
}

.dish-thumb.placeholder::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 13px auto;
  border-radius: 50%;
  border: 2px solid #b8c2ad;
}

.quick-dishes {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.quick-list button {
  max-width: 100%;
  border-color: var(--line);
  background: var(--soft);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-field {
  position: relative;
}

.combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(32, 36, 29, 0.12);
}

.combo-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.combo-option:last-child {
  border-bottom: 0;
}

.combo-option:hover,
.combo-option:focus {
  background: var(--soft);
  outline: none;
}

.combo-option small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 500;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 36, 29, 0.45);
}

.modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(32, 36, 29, 0.22);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin-bottom: 0;
}

.edit-image {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  overflow: hidden;
}

.edit-image-preview {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: #fff;
}

.edit-image-placeholder::before {
  content: "";
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #b8c2ad;
}

@media (max-width: 860px) {
  .grid,
  .summary,
  .two {
    grid-template-columns: 1fr;
  }

  header {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    text-align: left;
  }
}
