:root {
  --paper: #fbf7ef;
  --surface: #fffdfa;
  --line: #e8ded0;
  --ink: #26221e;
  --muted: #766c60;
  --tomato: #b84632;
  --tomato-dark: #863323;
  --olive: #61704a;
  --gold: #b9894e;
  --charcoal: #34302b;
  --soft: #f1e7d8;
  --danger: #b3261e;
  --shadow: 0 18px 45px rgba(49, 35, 24, 0.11);
}

* { box-sizing: border-box; }

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

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 48px);
  background: rgba(251, 247, 239, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 190px; background: transparent; color: inherit; padding: 0; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--charcoal); color: #fff5e8; font-family: Georgia, "Times New Roman", serif; font-size: 23px; }
.brand-image { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.wordmark { line-height: 1.02; text-align: left; }
.wordmark .en { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 24px; color: var(--charcoal); }
.wordmark .cn { display: block; margin-top: 4px; font-size: 14px; color: var(--tomato); }
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.nav-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.pill, .ghost, .primary, .danger, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  transition: transform 0.16s ease, background 0.16s ease, border 0.16s ease;
}
.pill { background: transparent; color: var(--muted); }
.pill.active, .pill:hover { background: var(--soft); color: var(--ink); }
.ghost { background: #fffaf3; border-color: var(--line); color: var(--ink); }
.ghost:hover, .primary:hover, .danger:hover, .icon-btn:hover { transform: translateY(-1px); }
.primary { background: var(--tomato); color: white; }
.danger { background: #fff3ef; color: var(--danger); border-color: #f0c7bd; }
.icon-btn { width: 38px; padding: 0; background: var(--surface); border-color: var(--line); color: var(--ink); }
.muted { color: var(--muted); }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 480px) 1fr; }
.auth-panel { padding: 42px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.auth-visual { min-height: 100vh; background: linear-gradient(90deg, rgba(38,34,30,.25), rgba(38,34,30,.05)), url("./assets/restaurant-hero.svg") center / cover no-repeat; }
.auth-tabs { display: flex; gap: 8px; padding: 5px; border-radius: 10px; background: var(--soft); }
.auth-tabs button { flex: 1; min-height: 40px; border-radius: 8px; background: transparent; color: var(--muted); }
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 6px 16px rgba(58,41,27,.1); }

.form-grid, .admin-list, .records { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: #fffaf4; border-radius: 8px; min-height: 42px; padding: 9px 11px; color: var(--ink); outline: none; }
.field textarea { min-height: 86px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,137,78,.16); }
.hint, .toast { border-radius: 8px; padding: 12px 14px; background: #f7efe4; color: var(--muted); border: 1px solid var(--line); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; color: var(--ink); box-shadow: var(--shadow); }

.content { padding: 28px clamp(18px, 4vw, 48px) 42px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 22px; align-items: stretch; margin-bottom: 24px; }
.hero-copy { padding: 34px; border-radius: 8px; background: var(--charcoal); color: #fff7eb; }
.hero-copy h1 { margin: 0 0 12px; font-size: 34px; line-height: 1.18; }
.hero-copy p { max-width: 680px; margin: 0; color: #e6d9ca; line-height: 1.8; }
.hero-image { min-height: 245px; border-radius: 8px; background: url("./assets/restaurant-hero.svg") center / cover no-repeat; box-shadow: var(--shadow); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 14px; }
.section-head h2, .section-head h3 { margin: 0; }

.store-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.store-tile, .product-card, .cart-line, .record-row, .admin-panel, .summary-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.store-tile { display: grid; gap: 10px; padding: 18px; text-align: left; box-shadow: 0 10px 24px rgba(54,39,27,.07); }
.store-tile strong { font-size: 18px; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 90px 200px 180px; gap: 12px; margin: 16px 0 18px; }
.catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.product-card { overflow: hidden; display: grid; min-height: 310px; }
.product-art { min-height: 132px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(184,70,50,.16), rgba(97,112,74,.14)), #f4eadc; color: var(--tomato-dark); font-size: 34px; font-family: Georgia, "Times New Roman", serif; }
.product-photo { width: 100%; height: 132px; object-fit: cover; background: #f4eadc; }
.image-preview { width: 140px; height: 96px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: #f4eadc; }
.product-body { display: grid; gap: 9px; padding: 14px; }
.product-title, .line-top, .cart-total { display: flex; justify-content: space-between; gap: 10px; }
.product-title { align-items: start; }
.product-title h3 { margin: 0; font-size: 17px; }
.price { color: var(--tomato-dark); font-weight: 700; }
.meta-list { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }

.cart-panel { position: sticky; top: 96px; display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fffdfa; box-shadow: var(--shadow); }
.cart-lines { display: grid; gap: 10px; max-height: 360px; overflow: auto; padding-right: 4px; }
.cart-line { padding: 12px; display: grid; gap: 9px; }
.qty-row { display: grid; grid-template-columns: 38px minmax(70px, 1fr) 38px; gap: 6px; align-items: center; }
.qty-row input { min-height: 38px; text-align: center; }
.cart-total { align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; }
.cart-total strong { font-size: 22px; color: var(--tomato-dark); }
.check-row { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.check-row input { width: 18px; height: 18px; }
.summary-panel { padding: 18px; display: grid; gap: 16px; }
.supplier-block { border-top: 1px solid var(--line); padding-top: 14px; }
.supplier-block h3 { margin: 0 0 10px; color: var(--olive); }
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.summary-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.urgent { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: #fff0e8; color: var(--danger); border: 1px solid #f1b7a7; font-weight: 700; font-size: 13px; }
.record-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px; }
.record-row .summary-panel { grid-column: 1 / -1; box-shadow: none; background: #fffaf4; }
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
.admin-menu { display: grid; align-content: start; gap: 8px; }
.admin-panel { padding: 18px; display: grid; gap: 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf4; }
.empty { border: 1px dashed #d7c7b5; border-radius: 8px; padding: 22px; text-align: center; color: var(--muted); }

@media (max-width: 980px) {
  .auth-layout, .hero, .catalog-layout, .admin-layout { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; border-right: 0; }
  .toolbar { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .hero-copy { padding: 24px; }
  .hero-copy h1 { font-size: 28px; }
  .record-row, .admin-item { grid-template-columns: 1fr; }
}
