:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --ink: #17211d;
  --muted: #65736c;
  --line: #dbe3dc;
  --accent: #116149;
  --accent-2: #d8ebe3;
  --warning: #a45b16;
  --shadow: 0 18px 42px rgba(29, 48, 39, 0.11);
}

* {
  box-sizing: border-box;
}

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

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

a {
  color: inherit;
}

.login-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

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

.brand-block p,
.topbar p,
.meta,
.waiting-card p {
  color: var(--muted);
}

.wechat-login,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.wechat-login {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.preview-login {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
}

.error {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 8px;
  background: #fff2ea;
  color: #8b3d0f;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.site-record {
  width: min(100%, 720px);
  margin: -22px auto 18px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.site-record a {
  color: inherit;
  text-decoration: none;
}

.site-record a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 6px 2px 18px;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
}

.ghost-button {
  min-width: 72px;
  background: #e7eee9;
  color: var(--accent);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.metric {
  min-height: 84px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 10px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 23px;
  line-height: 1.05;
}

.alerts {
  display: grid;
  gap: 8px;
}

.alert {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fff8ec;
  border: 1px solid #efd6b6;
  border-radius: 8px;
}

.alert > strong {
  flex: 0 0 auto;
  color: var(--warning);
}

.alert h2 {
  font-size: 15px;
}

.alert p {
  margin-top: 4px;
  color: #6f5a44;
  font-size: 13px;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 16px 0;
  padding: 4px;
  background: #e7eee9;
  border-radius: 8px;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 3px 8px rgba(24, 50, 39, 0.08);
}

.section {
  margin-top: 18px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: 19px;
}

.section-heading span {
  color: var(--muted);
  font-size: 14px;
}

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

.order-card,
.waiting-card,
.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-card {
  padding: 14px;
}

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

.card-head strong {
  font-size: 18px;
  line-height: 1.25;
}

.status {
  flex: 0 0 auto;
  padding: 5px 8px;
  background: var(--accent-2);
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
}

.progress-line {
  height: 8px;
  margin: 13px 0;
  overflow: hidden;
  background: #e6ece8;
  border-radius: 999px;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--accent);
}

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

.detail-grid div {
  min-width: 0;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid b {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.waiting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
}

.waiting-card strong {
  font-size: 16px;
}

.waiting-card p {
  margin-top: 4px;
  font-size: 13px;
}

.waiting-card > span {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

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

.canteen-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 34px;
  background:
    radial-gradient(circle at top left, rgba(255, 232, 185, 0.72), transparent 34%),
    linear-gradient(180deg, #fffaf1 0%, #f5f7f4 42%, #f5f7f4 100%);
}

.canteen-shell.wide {
  width: min(100%, 860px);
}

.canteen-hero,
.canteen-panel,
.thanks-panel,
.admin-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 220, 0.9);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(92, 69, 38, 0.08);
}

.canteen-hero {
  padding: 24px 20px 22px;
}

.canteen-mark,
.thanks-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #f2b84b;
  color: #3a2a12;
  font-weight: 900;
}

.canteen-hero h1,
.canteen-panel h1,
.thanks-panel h1 {
  font-size: 28px;
  line-height: 1.14;
}

.canteen-hero p,
.canteen-panel p,
.thanks-panel p {
  margin-top: 8px;
  color: #5f6d63;
  line-height: 1.58;
}

.kind-grid {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.kind-card {
  width: 100%;
  min-height: 94px;
  padding: 16px;
  border: 1px solid #e5ddca;
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  text-align: left;
}

.kind-card strong {
  display: block;
  font-size: 19px;
}

.kind-card span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
}

.canteen-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.canteen-links a,
.soft-link {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

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

.page-topbar a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.soft-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-weight: 800;
}

.canteen-panel {
  margin-bottom: 12px;
  padding: 18px;
}

.soft-label {
  color: #9a5c20 !important;
  font-size: 13px;
  font-weight: 900;
}

.form-row {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.form-row:first-child {
  margin-top: 0;
}

.form-row label {
  color: #26352d;
  font-weight: 800;
}

.rating-row,
.chip-row,
.mini-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rating-row button,
.chip-row button {
  min-height: 38px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #fff;
  color: #46564d;
  font-weight: 800;
}

.rating-row button {
  width: 44px;
}

.rating-row button.active,
.chip-row button.active {
  border-color: #f2b84b;
  background: #fff2d4;
  color: #70410e;
}

textarea,
.form-row input,
.admin-actions input,
.admin-actions select {
  width: 100%;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.form-row input,
.admin-actions input,
.admin-actions select {
  min-height: 42px;
  padding: 0 11px;
}

.photo-picker {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 15px;
  border: 1px dashed #d9bd82;
  border-radius: 8px;
  background: #fffaf0;
  color: #5b4f3c;
}

.photo-picker input {
  display: none;
}

.photo-picker span {
  color: #766a58;
  line-height: 1.45;
}

.photo-picker strong {
  color: #8a4e12;
}

.photo-preview,
.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.photo-preview figure {
  position: relative;
  margin: 0;
}

.photo-preview img,
.admin-photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid #e5ddca;
  border-radius: 8px;
}

.photo-preview button {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: rgba(23, 33, 29, 0.76);
  color: #fff;
  font-size: 12px;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.thanks-panel {
  margin-top: 18vh;
  padding: 24px 20px;
}

.thanks-mark {
  background: #d8ebe3;
  color: var(--accent);
  font-size: 24px;
}

.thanks-panel .soft-link {
  margin-top: 10px;
}

.admin-topbar {
  padding-top: 2px;
}

.canteen-admin-metrics,
.canteen-summary-grid {
  margin-top: 8px;
}

.admin-links {
  margin-bottom: 12px;
}

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

.admin-card {
  padding: 14px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-head strong {
  color: var(--muted);
  font-size: 13px;
}

.admin-card p {
  margin-top: 11px;
  line-height: 1.55;
}

.mini-chip-row {
  margin-top: 10px;
}

.mini-chip-row span {
  padding: 5px 8px;
  border-radius: 6px;
  background: #edf3ef;
  color: #415148;
  font-size: 12px;
  font-weight: 800;
}

.admin-photo-grid {
  margin-top: 10px;
}

.admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.admin-actions {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 74px;
  gap: 8px;
  margin-top: 12px;
}

.admin-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.summary-hero {
  margin-bottom: 12px;
}

.rank-list,
.improvement-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.rank-list div,
.improvement-list article {
  border: 1px solid #e3e8e4;
  border-radius: 8px;
  background: #fff;
}

.rank-list div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
}

.rank-list strong {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #fff2d4;
  color: #7c4b11;
}

.rank-list b {
  color: var(--accent);
}

.improvement-list article {
  padding: 12px;
}

.improvement-list strong {
  display: block;
  margin-top: 8px;
  color: var(--accent);
}

@media (max-width: 420px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .canteen-hero h1,
  .canteen-panel h1,
  .thanks-panel h1 {
    font-size: 25px;
  }
}
