:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #147d70;
  --accent-strong: #0f6258;
  --accent-soft: #e4f4f1;
  --blue: #2563eb;
  --amber: #b45309;
  --amber-soft: #fff4df;
  --danger: #c2413a;
  --danger-soft: #fff0ee;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

a {
  color: var(--accent);
}

.page {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

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

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

.brand-logo {
  width: 96px;
  height: 46px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

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

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

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

.small {
  font-size: 13px;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel + .panel {
  margin-top: 16px;
}

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

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #b9dcd5;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.notice.closed {
  border-color: #f3c1bd;
  background: var(--danger-soft);
}

.notice strong {
  white-space: nowrap;
}

.grid-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 10px;
}

.choice {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.choice:hover {
  border-color: var(--accent);
}

.choice.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.choice:disabled,
button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

label {
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(20, 125, 112, 0.2);
  outline-offset: 2px;
}

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

.meal-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 140px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.meal-row.disabled {
  color: var(--muted);
  background: #eef1f5;
}

.meal-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.meal-label input {
  width: 18px;
  min-height: 18px;
}

.meal-price {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 15px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.btn:hover {
  background: var(--accent-strong);
}

.btn.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.btn.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn.danger {
  background: var(--danger);
}

.btn.danger:hover {
  background: #a83631;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf2ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.message {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: #edf2ff;
  color: #1d4ed8;
}

.message.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.message.success {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.success-box {
  display: grid;
  gap: 12px;
}

.result-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.qr {
  width: min(220px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  object-fit: contain;
}

.site-footer {
  margin-top: 24px;
  padding: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cancel-result {
  display: grid;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
}

.modal {
  width: min(460px, 100%);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.modal p {
  line-height: 1.65;
}

.admin-shell {
  display: grid;
  gap: 16px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

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

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: #f1f5f9;
  color: #344054;
  font-weight: 750;
  white-space: nowrap;
}

td.actions {
  white-space: nowrap;
}

.inline-select {
  min-width: 122px;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 14px;
}

.login-card {
  width: min(420px, 100%);
  margin: 80px auto;
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  .page {
    width: min(100% - 20px, 1120px);
    padding-top: 14px;
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .meal-row {
    grid-template-columns: 1fr 112px;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 22px;
  }

  .panel {
    padding: 14px;
  }

  .grid-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .filters,
  .meal-row {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
