:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #f0f5f2;
  --text: #17211d;
  --muted: #6b7771;
  --border: #dce5df;
  --green: #18784d;
  --green-dark: #105a39;
  --green-soft: #e4f3eb;
  --red: #c74737;
  --red-soft: #ffe9e5;
  --amber: #f5b640;
  --shadow: 0 18px 55px rgba(24, 52, 39, 0.1);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(246, 248, 247, 0.86), rgba(246, 248, 247, 0.9)),
    linear-gradient(135deg, rgba(24, 120, 77, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(199, 71, 55, 0.08), transparent 30%),
    url("assets/food-background.png") center / cover fixed,
    var(--bg);
  color: var(--text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: calc(100% - 36px);
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 0;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.ghost-button,
.danger-button,
.primary-button,
.tab,
.quantity-control button {
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.ghost-button,
.danger-button {
  min-height: 42px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

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

.ghost-button:hover,
.danger-button:hover,
.primary-button:hover,
.quantity-control button:hover {
  transform: translateY(-1px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
  align-items: start;
  min-width: 0;
}

.order-panel,
.summary-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 229, 223, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.order-panel {
  padding: 26px;
}

.summary-panel {
  position: sticky;
  top: 20px;
  padding: 22px;
}

.section-heading,
.summary-top,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.person-picker {
  flex: 1;
  min-width: 260px;
}

.person-picker .field-label {
  margin-top: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

.section-heading p,
.summary-top p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.today-card,
.grand-total {
  min-width: 142px;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  text-align: right;
}

.today-card span,
.grand-total span,
.form-footer span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.today-card strong,
.grand-total strong,
.form-footer strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.order-form {
  margin-top: 26px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

select {
  min-height: 48px;
  padding: 0 40px 0 14px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 21px,
    calc(100% - 14px) 21px;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

textarea {
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 120, 77, 0.12);
}

.menu-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 16px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(300px, 48%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.search-wrap input {
  min-height: auto;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.menu-list {
  display: grid;
  gap: 16px;
}

.menu-category {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.menu-category h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

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

.menu-item {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #eadfb9;
  background: #fbf6e7;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.menu-item.selected {
  border-color: rgba(24, 120, 77, 0.32);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(24, 120, 77, 0.12);
}

.item-copy strong,
.item-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.item-copy {
  min-width: 0;
}

.item-copy strong {
  font-size: 14px;
}

.item-copy span {
  margin-top: 4px;
  color: #8a6a22;
  font-size: 13px;
  font-weight: 700;
}

.menu-item.selected .item-copy span {
  color: var(--green);
}

.portion-control {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 10px;
  padding: 3px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
}

.portion-control button {
  min-width: 42px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.portion-control button.active {
  background: var(--green);
  color: #fff;
}

.quantity-control {
  display: grid;
  grid-template-columns: 34px 30px 34px;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.quantity-control button {
  width: 34px;
  height: 34px;
  background: #fff;
  color: #8a6a22;
  border: 1px solid var(--border);
  font-size: 20px;
  line-height: 1;
}

.menu-item.selected .quantity-control button {
  color: var(--green);
  border-color: rgba(24, 120, 77, 0.24);
}

.quantity-control output {
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.form-footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.primary-button {
  min-height: 50px;
  padding: 0 22px;
  background: var(--green);
  color: #fff;
}

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

.form-message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.summary-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.tab {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(23, 33, 29, 0.08);
}

.summary-section {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.summary-section.item-pool {
  background: rgba(228, 243, 235, 0.78);
  border-color: rgba(24, 120, 77, 0.22);
}

.summary-section.people-pool {
  background: rgba(251, 246, 231, 0.9);
  border-color: #eadfb9;
}

.summary-section h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.item-pool h3 {
  color: var(--green-dark);
}

.people-pool h3 {
  color: #7d5b17;
}

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

.summary-row,
.person-card,
.empty-state {
  border-radius: 8px;
  padding: 14px;
}

.item-pool .summary-row,
.item-pool .empty-state {
  background: #ffffff;
}

.people-pool .person-card,
.people-pool .empty-state {
  background: #ffffff;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.summary-row strong,
.person-card strong {
  font-size: 14px;
}

.summary-row span,
.summary-row small,
.person-card span,
.person-card small,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.summary-row small,
.person-card small {
  display: block;
  margin-top: 5px;
  line-height: 1.45;
}

.row-total {
  color: var(--green);
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: right;
}

.person-card {
  display: grid;
  gap: 10px;
}

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

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

.remove-order {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--red);
  font-weight: 800;
}

.note {
  border-left: 3px solid var(--amber);
  padding-left: 10px;
}

.hidden {
  display: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
  padding: 18px 0 6px;
  color: rgba(23, 33, 29, 0.62);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.site-footer span + span {
  position: relative;
}

.site-footer span + span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -8px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
}

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

  .summary-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: calc(100% - 24px);
    max-width: 1380px;
    padding-top: 16px;
  }

  .topbar,
  .section-heading,
  .form-footer,
  .menu-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .order-panel,
  .summary-panel {
    padding: 16px;
  }

  .today-card,
  .grand-total {
    width: 100%;
    text-align: left;
  }

  .search-wrap {
    width: 100%;
  }

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

  .menu-item {
    align-items: flex-start;
  }

  .primary-button {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }

  .site-footer span + span::before {
    display: none;
  }
}
