:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --ink: #20231f;
  --muted: #68706a;
  --line: #d8dfd8;
  --green: #23745a;
  --green-2: #e0eee7;
  --amber: #a46216;
  --amber-2: #fff0d8;
  --red: #b53b3b;
  --red-2: #fde7e7;
  --teal: #166d7a;
  --teal-2: #e2f2f4;
  --shadow: 0 18px 50px rgba(31, 41, 35, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 245, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #1f3d35;
  color: #fff;
  font-weight: 800;
}

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

h1 {
  font-size: 17px;
}

h2,
h3 {
  font-size: 16px;
}

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

.tabs {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
}

.subtab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 7px 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 720;
}

.filter-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 720;
}

.tab.active,
.subtab.active,
.filter-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 8px rgba(20, 35, 28, 0.08);
}

.filter-tab.active {
  border-color: #83b9a0;
  background: var(--green-2);
  color: var(--green);
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.merchant-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side {
  display: grid;
  gap: 18px;
}

.merchant-page {
  display: none;
}

.merchant-page.active {
  display: block;
}

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

.merchant-split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.merchant-split.wide-left {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

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

.panel-body {
  padding: 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

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

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

.form {
  display: grid;
  gap: 11px;
}

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

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow: auto;
  margin-bottom: 14px;
}

.chip,
.cash-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.chip.active,
.cash-pill {
  border-color: #83b9a0;
  background: var(--green-2);
  color: var(--green);
  font-weight: 720;
}

.badge.green {
  border-color: transparent;
  background: var(--green-2);
  color: var(--green);
}

.badge.amber {
  border-color: transparent;
  background: var(--amber-2);
  color: var(--amber);
}

.badge.red {
  border-color: transparent;
  background: var(--red-2);
  color: var(--red);
}

.badge.teal {
  border-color: transparent;
  background: var(--teal-2);
  color: var(--teal);
}

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

.dish,
.row,
.order,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dish-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px 8px 0 0;
  object-fit: cover;
  background: var(--surface-2);
}

.dish-body,
.row,
.order,
.notice {
  padding: 11px;
}

.dish-title,
.row-title,
.order-head,
.notice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

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

.qty {
  display: grid;
  grid-template-columns: 36px minmax(38px, 1fr) 36px;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.qty span {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 760;
}

.icon,
.ghost,
.primary,
.danger,
.mini {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 7px 10px;
  font-weight: 720;
}

.icon {
  width: 36px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
}

.primary {
  background: var(--green);
  color: #fff;
}

.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  border-color: #f3c3c3;
  background: var(--red-2);
  color: var(--red);
}

.mini {
  min-height: 32px;
  font-size: 13px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.cart {
  position: sticky;
  top: 84px;
}

.cart-list,
.list,
.orders,
.notice-list {
  display: grid;
  gap: 9px;
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 17px;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}

.stat strong {
  display: block;
  font-size: 22px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
  margin-top: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 20, 0.42);
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(18, 29, 24, 0.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 16px;
}

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

.empty {
  min-height: 110px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  max-width: min(520px, calc(100vw - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #1f3d35;
  color: #fff;
  box-shadow: 0 16px 40px rgba(18, 29, 24, 0.22);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1040px) {
  .customer-layout,
  .merchant-layout,
  .merchant-split,
  .merchant-split.wide-left {
    grid-template-columns: 1fr;
  }

  .cart {
    position: static;
  }

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

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    padding: 12px;
  }

  .menu-grid,
  .two,
  .inline-form,
  .stats {
    grid-template-columns: 1fr;
  }
}
