:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --paper: #ffffff;
  --ink: #1d2526;
  --muted: #64706b;
  --line: #dbe1dc;
  --green: #16755a;
  --green-strong: #0f6049;
  --amber: #b96c12;
  --red: #be3a34;
  --blue: #2f67bd;
  --mint: #e8f5ef;
  --sun: #fff3d9;
  --rose: #fff0ee;
  --shadow: 0 12px 30px rgba(29, 37, 38, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.brand {
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.nav button,
.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 8px 12px;
}

.nav button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.primary-button {
  background: var(--green);
  color: white;
  border-color: var(--green);
  font-weight: 700;
}

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

.danger-button {
  background: var(--rose);
  color: var(--red);
  border-color: #ffd1cb;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.section {
  margin-bottom: 22px;
}

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

.section-title {
  margin: 0;
  font-size: 22px;
}

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

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

.panel {
  padding: 16px;
}

.card {
  padding: 14px;
}

.summary-workspace {
  gap: 18px;
}

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

.subpanel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 16px;
}

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

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
}

.meal-select.meal-lunch {
  border-color: #74b49b;
  background: #f0faf5;
}

.meal-select.meal-tea {
  border-color: #e3b45f;
  background: #fff7e8;
}

.meal-select.meal-dinner {
  border-color: #7fa7de;
  background: #eef5ff;
}

.meal-select option {
  color: var(--ink);
  background: white;
}

.field textarea {
  min-height: 82px;
  resize: vertical;
}

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

.stack {
  display: grid;
  gap: 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--mint);
  color: var(--green-strong);
}

.badge.warn {
  background: var(--sun);
  color: var(--amber);
}

.badge.closed {
  background: var(--rose);
  color: var(--red);
}

.menu-image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2ef;
}

.store-menu-header {
  align-items: center;
}

.menu-thumb-button {
  width: 128px;
  height: 82px;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: white;
}

.menu-thumb-button:hover {
  border-color: var(--green);
}

.menu-thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.menu-image-modal {
  width: min(920px, 100%);
}

.menu-image-full {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2ef;
}

.category-title {
  margin: 18px 0 8px;
  font-size: 16px;
}

.item-list {
  display: grid;
  gap: 8px;
}

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

.price {
  font-weight: 800;
  color: var(--green-strong);
}

.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: white;
}

.option-chip input {
  width: 16px;
  height: 16px;
}

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

.summary-line:last-child {
  border-bottom: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: white;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 13px;
  background: #f1f4f0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tfoot td {
  font-weight: 800;
  background: var(--mint);
}

.data-table .number {
  text-align: right;
  white-space: nowrap;
  font-weight: 800;
}

.summary-date-field {
  max-width: 240px;
}

.day-summary-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.person-order-line {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 4px 0;
}

.person-order-line + .person-order-line {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 10px;
}

.person-order-line strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green-strong);
}

.meal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.person-order-line.meal-lunch strong {
  color: var(--green-strong);
}

.person-order-line.meal-lunch .meal-dot {
  background: #16755a;
}

.person-order-line.meal-tea strong {
  color: #98620d;
}

.person-order-line.meal-tea .meal-dot {
  background: #d78b17;
}

.person-order-line.meal-dinner strong {
  color: #245eaa;
}

.person-order-line.meal-dinner .meal-dot {
  background: #2f67bd;
}

.person-order-line em {
  color: var(--ink);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 25;
  width: min(680px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.cart-bar button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 8px 13px;
  background: #f6c453;
  color: #1d2526;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  background: rgba(12, 20, 20, 0.48);
  padding: 18px;
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.modal-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.empty {
  border: 1px dashed #c8d1cb;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.copy-box {
  white-space: pre-wrap;
  background: #111817;
  color: white;
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
}

@media (max-width: 760px) {
  .topbar-inner {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .store-menu-header {
    align-items: flex-start;
  }

  .menu-thumb-button {
    width: 112px;
    height: 72px;
  }

  .brand-title {
    font-size: 18px;
  }

  .main {
    padding-inline: 12px;
  }

  .panel {
    padding: 13px;
  }

  .subpanel {
    padding: 13px;
  }

  .person-order-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .summary-date-field {
    max-width: none;
  }

  .day-summary-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
