:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #1f2326;
  --muted: #747b80;
  --line: #e7e9ec;
  --line-strong: #d7dce0;
  --yellow: #ffd34f;
  --yellow-strong: #f3b51b;
  --green: #1f6a5b;
  --green-soft: #e5f3ee;
  --red: #c24832;
  --red-soft: #fff0ec;
  --blue: #2f6f9f;
  --shadow: 0 12px 26px rgba(30, 36, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

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

h1 {
  font-size: 30px;
  line-height: 1.12;
  font-weight: 850;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
}

.app-shell {
  width: min(1440px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 14px 0 24px;
}

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

.subtle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background:
    linear-gradient(90deg, rgba(255, 211, 79, 0.98), rgba(255, 224, 118, 0.96)),
    var(--yellow);
  border: 1px solid rgba(202, 151, 21, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.store-title h1 {
  margin-top: 4px;
}

.header-actions,
.quick-bar,
.lunch-toggle,
.season-head,
.dialog-head,
.dialog-actions,
.maintenance-tools,
.section-title,
.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-actions {
  flex: none;
}

.primary-action,
.secondary-action,
.gear-button,
.cart-actions button,
.section-title button,
.managed-row button,
.maintenance-tools button,
.import-button,
.dialog-actions button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-action {
  min-width: 118px;
  padding: 0 18px;
  color: #191713;
  background: var(--yellow);
  border: 1px solid var(--yellow-strong);
}

.secondary-action {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(138, 110, 33, 0.24);
}

.gear-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(138, 110, 33, 0.24);
  font-size: 19px;
}

.quick-bar {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-row {
  flex: 1 1 auto;
  min-width: 260px;
}

input[type="search"],
input[type="number"],
input[type="text"],
select,
textarea,
#dishName,
#dishTags {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

input[type="search"]:focus,
input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--yellow-strong);
  box-shadow: 0 0 0 3px rgba(255, 211, 79, 0.28);
}

textarea {
  resize: vertical;
}

.lunch-toggle {
  flex: none;
}

.toggle-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

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

.toggle-card:has(input:checked) {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(31, 106, 91, 0.24);
}

.quick-count {
  display: grid;
  place-items: center;
  min-width: 92px;
  min-height: 42px;
  padding: 6px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quick-count strong {
  color: var(--green);
  font-size: 20px;
  line-height: 1;
}

.quick-count span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.ordering-layout {
  display: grid;
  grid-template-columns: 156px minmax(420px, 1fr) minmax(320px, 380px);
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}

.category-sidebar,
.dish-section,
.cart-panel,
.dish-dialog .dialog-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.category-sidebar,
.cart-panel {
  position: sticky;
  top: 12px;
}

.category-title {
  padding: 14px 12px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.filter-row {
  display: grid;
  gap: 2px;
  padding: 6px;
}

.filter-row button {
  min-height: 46px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
  font-weight: 750;
}

.filter-row button.active {
  color: var(--ink);
  background: var(--yellow);
}

.dish-section {
  min-width: 0;
  overflow: hidden;
}

.season-box {
  margin: 0;
  padding: 16px;
  background: linear-gradient(180deg, #f7fbf9, #ffffff);
  border-bottom: 1px solid var(--line);
}

.season-tabs {
  display: grid;
  grid-template-columns: repeat(4, 40px);
  gap: 6px;
}

.season-tabs button {
  min-height: 34px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
}

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

.produce-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.produce-chip,
.tag,
.recent-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.produce-chip {
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(31, 106, 91, 0.18);
}

.dish-grid {
  display: grid;
}

.dish-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  min-height: 132px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.dish-card.selected {
  background: #fffdf4;
}

.dish-card h3 {
  grid-column: 1;
  align-self: end;
  font-size: 19px;
  font-weight: 850;
}

.dish-topline {
  display: flex;
  gap: 8px;
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dish-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1;
}

.tag {
  color: var(--blue);
  background: #eef6fb;
  border: 1px solid #d9ebf5;
}

.dish-note {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dish-card .add-dish {
  grid-column: 2;
  grid-row: 1 / span 5;
  align-self: center;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: var(--yellow);
  border: 1px solid var(--yellow-strong);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.dish-card.selected .add-dish {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd2c8;
  font-size: 13px;
}

.cart-panel {
  padding: 16px;
}

.cart-count {
  flex: none;
  padding: 7px 12px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 850;
}

.selected-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.empty-state {
  padding: 14px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}

.selected-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.selected-item strong {
  display: block;
  margin-bottom: 4px;
}

.selected-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.selected-actions {
  display: grid;
  grid-template-columns: 32px 32px 32px;
  gap: 6px;
}

.selected-actions button {
  min-height: 32px;
  width: 32px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
}

.selected-actions button.locked {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.cart-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1.2fr;
  gap: 8px;
  margin-top: 10px;
}

.cart-actions button,
.section-title button {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.cart-actions .submit-order {
  color: #191713;
  background: var(--yellow);
  border-color: var(--yellow-strong);
}

.order-feedback {
  margin-top: 12px;
  padding: 12px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(31, 106, 91, 0.22);
  border-radius: var(--radius);
}

.order-feedback h3 {
  margin-bottom: 8px;
  color: var(--ink);
}

.order-feedback p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.order-feedback ul {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.order-feedback li {
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.summary-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.summary-section.compact {
  margin-top: 12px;
}

.section-title h3 {
  font-size: 16px;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.section-title span,
.section-title button {
  color: var(--muted);
  font-size: 12px;
}

.note-box,
.analysis-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.analysis-item {
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
}

.analysis-item strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.shopping-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.shopping-list li {
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.4;
}

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

.recent-chip {
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.dish-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(880px, calc(100vh - 28px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.dish-dialog::backdrop {
  background: rgba(20, 24, 25, 0.48);
}

.dialog-card {
  max-height: inherit;
  overflow: auto;
  padding: 18px;
}

.dialog-card.editing-dish .dialog-head {
  margin: -6px -6px 0;
  padding: 6px;
  background: #fff9df;
  border: 1px solid rgba(243, 181, 27, 0.34);
  border-radius: var(--radius);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

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

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

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

.check-line {
  align-items: center;
  grid-template-columns: auto 1fr;
  min-height: 42px;
  padding: 10px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.full-label {
  margin-top: 12px;
}

.chip-cloud,
.form-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-cloud label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.dialog-actions {
  margin-top: 14px;
}

.dialog-actions button {
  padding: 0 14px;
}

.dialog-actions .primary-action {
  width: auto;
  padding-inline: 20px;
}

.maintenance-tools {
  flex-wrap: wrap;
  justify-content: start;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.maintenance-tools button,
.import-button {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
}

.import-button input {
  display: none;
}

.admin-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-search {
  margin-top: 10px;
}

.order-history {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.order-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-row-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.order-row-head strong {
  display: block;
  margin-bottom: 3px;
}

.order-row-head span,
.order-empty {
  color: var(--muted);
  font-size: 12px;
}

.order-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 8px 5px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.order-chip button,
.order-row-head button,
.order-edit button {
  min-height: 28px;
  padding: 0 8px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.order-chip button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-height: 22px;
  padding: 0;
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd2c8;
  border-radius: 50%;
}

.order-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.managed-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.managed-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.managed-row span {
  color: var(--muted);
  font-size: 12px;
}

.managed-row button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
}

@media (max-width: 1180px) {
  .ordering-layout {
    grid-template-columns: 142px minmax(380px, 1fr);
  }

  .cart-panel {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 16px, 760px);
    padding-top: 8px;
  }

  .order-header,
  .quick-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .header-actions,
  .lunch-toggle {
    justify-content: stretch;
  }

  .header-actions button,
  .lunch-toggle .toggle-card {
    flex: 1;
  }

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

  .category-sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .category-title {
    display: none;
  }

  .filter-row {
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }

  .filter-row button {
    flex: 0 0 auto;
    min-height: 38px;
    text-align: center;
    white-space: nowrap;
  }

  h1 {
    font-size: 26px;
  }
}

@media (max-width: 560px) {
  .season-head,
  .cart-head,
  .section-title,
  .dialog-head {
    align-items: flex-start;
  }

  .season-tabs {
    grid-template-columns: repeat(2, 40px);
  }

  .dish-card {
    grid-template-columns: 1fr 40px;
    padding: 14px;
  }

  .form-grid,
  .form-grid.two,
  .managed-row {
    grid-template-columns: 1fr;
  }

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

  .order-row-head,
  .order-edit {
    grid-template-columns: 1fr;
  }
}
