:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #202124;
  --muted: #667085;
  --line: #dfded8;
  --brand: #176b5d;
  --brand-dark: #0f5146;
  --accent: #c05232;
  --soft: #e9f3ef;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.2;
}

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

.topbar p,
.hint,
.info-block p {
  color: var(--muted);
  line-height: 1.7;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.tab,
button,
.ghost {
  border: 0;
  cursor: pointer;
  border-radius: 6px;
  padding: 10px 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.tab {
  background: transparent;
}

.tab.active {
  background: var(--brand);
  color: #fff;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

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

.two {
  grid-template-columns: minmax(320px, 420px) 1fr;
}

.order-layout {
  grid-template-columns: 420px 1fr;
  align-items: start;
}

.card,
.info-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(20, 24, 28, 0.05);
}

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

.step-head {
  display: grid;
  gap: 4px;
}

.step-head span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.step-head h2 {
  margin-bottom: 4px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.date-filter span {
  color: #394150;
  font-size: 14px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 93, 0.13);
}

.field-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.field-group legend {
  color: #394150;
  font-size: 14px;
  padding: 0;
}

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

.meal-choice {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid #cfd4dc;
  background: #fff;
  color: var(--text);
  text-align: left;
  padding: 14px;
}

.meal-choice strong {
  min-width: 64px;
  color: var(--accent);
  font-size: 20px;
}

.meal-choice span {
  color: #394150;
  line-height: 1.5;
}

.meal-choice.active {
  border-color: var(--brand);
  background: var(--soft);
  box-shadow: 0 0 0 3px rgba(23, 107, 93, 0.13);
}

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

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

.ghost {
  background: var(--soft);
  color: var(--brand-dark);
}

.hidden {
  display: none;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 18px;
}

.summary > div,
.date-filter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.summary strong {
  font-size: 24px;
}

.password-card {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  align-items: end;
  margin-bottom: 18px;
}

.password-card h2 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

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

.meal-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfaf7;
}

.meal-item strong {
  display: block;
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}

.total-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: 8px;
  background: #fbf2ee;
  color: var(--accent);
}

.confirm-panel {
  display: grid;
  gap: 16px;
}

.confirm-panel.hidden {
  display: none;
}

.confirm-note {
  border: 1px solid #f2c7b8;
  border-radius: 8px;
  background: #fff7f3;
  color: var(--accent);
  line-height: 1.6;
  padding: 12px 13px;
}

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

.confirm-details > div,
.balance-after {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfaf7;
}

.balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-details .wide {
  grid-column: 1 / -1;
}

.confirm-details span,
.balance-after span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.confirm-details strong,
.balance-after strong {
  line-height: 1.5;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.order-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.order-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-item strong {
  color: var(--brand-dark);
}

.order-status {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
}

.order-status.confirmed {
  background: var(--soft);
  color: var(--brand-dark);
}

.order-status.cancelled {
  background: #f2f4f7;
  color: var(--muted);
}

.cancel-order {
  justify-self: start;
}

.orders-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.orders-pagination span {
  color: var(--muted);
  font-size: 14px;
  min-width: 90px;
  text-align: center;
}

.orders-pagination .ghost {
  min-width: 82px;
  border: 1px solid var(--line);
  background: #fff;
}

.meta {
  color: var(--muted);
  line-height: 1.6;
}

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

.table-card {
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

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

th {
  background: #f1eee7;
  color: #4b5563;
  font-weight: 600;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .order-item header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }

  .two,
  .order-layout,
  .summary,
  .meal-list,
  .confirm-details,
  .balance-grid,
  .password-card,
  .action-row {
    grid-template-columns: 1fr;
  }

  .tabs,
  .tab,
  .summary .ghost,
  .summary .primary,
  #exportBtn,
  #exportOrdersBtn {
    width: 100%;
  }

  .orders-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .orders-pagination .ghost {
    width: 100%;
  }
}
