/* =========================================================================
   餐厅 SaaS 母版 — 共享设计系统
   两套语气：
     .app-admin  后台：紧凑、工具化、可扫读，弱装饰
     .app-shop   前台：温暖、食欲感、大触控目标
   约束：卡片圆角 <= 8px；letter-spacing 恒为 0；字号不随视口缩放。
   ========================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Source Han Sans SC', 'Noto Sans CJK SC', sans-serif;
  --font-num: 'SF Mono', 'JetBrains Mono', 'Cascadia Mono', Consolas, 'Courier New', monospace;

  /* 中性色：暖灰，避免冷蓝灰单调 */
  --c-bg: #f4f2ef;
  --c-surface: #ffffff;
  --c-surface-2: #faf8f6;
  --c-surface-3: #f0ede9;
  --c-line: #e2ddd7;
  --c-line-strong: #cec7bf;
  --c-text: #22201d;
  --c-text-2: #5a544d;
  --c-text-3: #8b847c;
  --c-text-inv: #ffffff;

  /* 功能色 */
  --c-accent: #1d6fe0;
  --c-accent-weak: #e8f0fd;
  --c-accent-strong: #1558b4;
  --c-ok: #158a4a;
  --c-ok-weak: #e3f5ea;
  --c-warn: #b26a00;
  --c-warn-weak: #fdf1dc;
  --c-danger: #c22f2f;
  --c-danger-weak: #fdeaea;
  --c-info: #0f7b8a;
  --c-info-weak: #e0f4f6;

  /* 品牌色（前台主题覆盖） */
  --c-brand: #c8451f;
  --c-brand-dark: #9c3315;
  --c-brand-weak: #fdece5;
  --c-brand-ink: #3a1a0f;

  --r-xs: 3px;
  --r-sm: 5px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-pill: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;

  --sh-1: 0 1px 2px rgba(28, 24, 20, 0.06);
  --sh-2: 0 2px 8px rgba(28, 24, 20, 0.08);
  --sh-3: 0 8px 28px rgba(28, 24, 20, 0.16);

  --topbar-h: 52px;
  --sidebar-w: 208px;
  --shopbar-h: 60px;

  --dur: 140ms;
}

/* 前台四套主题：由商家在「店铺设置」中选择，字段 restaurants.theme */
[data-theme='ember'] {
  --c-brand: #c8451f;
  --c-brand-dark: #9c3315;
  --c-brand-weak: #fdece5;
  --c-brand-ink: #3a1a0f;
}

[data-theme='jade'] {
  --c-brand: #1c7d55;
  --c-brand-dark: #14603f;
  --c-brand-weak: #e4f4ec;
  --c-brand-ink: #10281d;
}

[data-theme='ink'] {
  --c-brand: #2f4a52;
  --c-brand-dark: #20353b;
  --c-brand-weak: #e6eef0;
  --c-brand-ink: #16242a;
}

[data-theme='plum'] {
  --c-brand: #a52846;
  --c-brand-dark: #7f1c34;
  --c-brand-weak: #fbe8ec;
  --c-brand-ink: #33101a;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
p,
figure,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: 600;
  letter-spacing: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: -0.15em;
}

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--c-text-3);
}

.strike {
  text-decoration: line-through;
  color: var(--c-text-3);
}

.nowrap {
  white-space: nowrap;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.row-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.right {
  margin-left: auto;
}

.text-right {
  text-align: right;
}

.clamp-1 {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}

.btn:hover:not(:disabled) {
  background: var(--c-surface-3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  border-color: var(--c-accent);
  background: var(--c-accent);
  color: var(--c-text-inv);
}

.btn-primary:hover:not(:disabled) {
  background: var(--c-accent-strong);
  border-color: var(--c-accent-strong);
}

.btn-brand {
  border-color: var(--c-brand);
  background: var(--c-brand);
  color: var(--c-text-inv);
}

.btn-brand:hover:not(:disabled) {
  background: var(--c-brand-dark);
  border-color: var(--c-brand-dark);
}

.btn-danger {
  border-color: var(--c-danger);
  color: var(--c-danger);
  background: var(--c-surface);
}

.btn-danger:hover:not(:disabled) {
  background: var(--c-danger-weak);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--c-text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.btn-sm {
  min-height: 28px;
  padding: 0 8px;
  font-size: 13px;
}

.btn-lg {
  min-height: 44px;
  padding: 0 20px;
  font-size: 15px;
  border-radius: var(--r-md);
}

.btn-block {
  width: 100%;
}

/* 图标按钮：语义靠 icon + title tooltip，不靠文字 */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-text-2);
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}

.btn-icon:hover:not(:disabled) {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.btn-icon.is-danger:hover:not(:disabled) {
  background: var(--c-danger-weak);
  color: var(--c-danger);
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon.is-on {
  background: var(--c-accent-weak);
  color: var(--c-accent);
}

/* 分段控件：模式切换 */
.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: var(--c-surface-3);
}

.segmented button {
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--c-text-2);
  font-size: 13px;
  white-space: nowrap;
}

.segmented button[aria-pressed='true'] {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--sh-1);
  font-weight: 600;
}

/* 开关：真实绑定后端布尔字段 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--c-line-strong);
  transition: background var(--dur);
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform var(--dur);
}

.switch input:checked + .switch-track {
  background: var(--c-ok);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.switch input:disabled + .switch-track {
  opacity: 0.5;
}

/* ------------------------------------------------------------------ forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-2);
}

.field-hint {
  font-size: 12px;
  color: var(--c-text-3);
}

/* 行内文字按钮：用在提示语里的「登录」这类动作，不该长成一个方块按钮。 */
.link-btn {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: var(--c-accent);
  text-decoration: underline;
  cursor: pointer;
  /* 手指点得中：即使外观是一行文字，可点区域也保持 28px 高。
     这里不放在 pointer: coarse 媒体查询里 —— 窄窗口的桌面浏览器同样会被手指或触控板误点，
     而且巡检脚本量的就是真实盒子高度。 */
  display: inline-block;
  min-height: 28px;
  line-height: 28px;
}

.link-btn:hover {
  opacity: 0.8;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: 14px;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-weak);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--c-surface-3);
  color: var(--c-text-3);
}

.input-invalid {
  border-color: var(--c-danger);
}

.select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a544d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 15px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--c-accent);
}

/* 触屏上 16px 的原生勾选框太小，放大到易点尺寸（视觉仍由 accent-color 控制） */
@media (hover: none) and (pointer: coarse) {
  .check input {
    width: 20px;
    height: 20px;
  }

  /* 保证整行 label 达到易点高度，点文字也能切换 */
  .check,
  .switch {
    min-height: 28px;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-3) var(--sp-4);
}

.form-grid .span-2 {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: span 1;
  }
}

/* 步进器：固定宽度，hover 不产生布局位移 */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-surface);
}

.stepper button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--c-text-2);
}

.stepper button:hover:not(:disabled) {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.stepper button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stepper-value {
  min-width: 32px;
  text-align: center;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

/* ----------------------------------------------------------------- tables */

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.table th {
  font-weight: 600;
  color: var(--c-text-2);
  font-size: 12px;
  white-space: nowrap;
  background: var(--c-surface-2);
  position: sticky;
  top: 0;
}

.table tbody tr:hover {
  background: var(--c-surface-2);
}

.table .num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------- chips / badges */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--c-surface-3);
  color: var(--c-text-2);
}

.chip-ok {
  background: var(--c-ok-weak);
  color: var(--c-ok);
}

.chip-warn {
  background: var(--c-warn-weak);
  color: var(--c-warn);
}

.chip-danger {
  background: var(--c-danger-weak);
  color: var(--c-danger);
}

.chip-info {
  background: var(--c-info-weak);
  color: var(--c-info);
}

.chip-brand {
  background: var(--c-brand-weak);
  color: var(--c-brand-dark);
}

/* 功能开关矩阵（第十六轮，平台门店详情：套餐默认 + 本店单独设置） */
.ft-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
}

/* 被本店单独设置过的行：一眼看出「这家店跟套餐不一样」（GPT 审计：双值必须可见） */
.ft-row.ft-custom {
  background: var(--c-warn-weak);
}

.ft-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  padding: 0;
  border: 1px solid var(--c-line-strong);
  border-radius: 999px;
  background: var(--c-surface-3);
  cursor: pointer;
  transition: background 0.15s;
}

.ft-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: left 0.15s;
}

.ft-switch[aria-checked='true'] {
  background: var(--c-ok);
  border-color: var(--c-ok);
}

.ft-switch[aria-checked='true']::after {
  left: 16px;
}

.ft-switch:disabled {
  opacity: 0.5;
  cursor: default;
}

.ft-name {
  flex: 1;
  font-size: 13px;
  color: var(--c-text);
}

.ft-meta {
  font-size: 12px;
  color: var(--c-text-3);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--c-danger);
  color: var(--c-text-inv);
  line-height: 1;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
}

.card-body {
  padding: var(--sp-4);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-line);
}

.card:not(.card-bordered) {
  border: 0;
  box-shadow: var(--sh-1);
}

/* ---------------------------------------------------------------- stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.stat-card .stat-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--c-text-3);
}

/* ------------------------------------------------------------ tab bar */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--c-line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs button {
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--c-text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur), border-color var(--dur);
}

.tabs button[aria-selected='true'] {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

.tabs button:hover:not([aria-selected='true']) {
  color: var(--c-text);
  background: var(--c-surface-2);
}

/* ------------------------------------------------------------ notifications */

.toast-container {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--sh-3);
  border: 1px solid var(--c-line);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast-ok {
  border-left: 3px solid var(--c-ok);
}

.toast-warn {
  border-left: 3px solid var(--c-warn);
}

.toast-danger {
  border-left: 3px solid var(--c-danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------- modal */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(0, 0, 0, 0.45);
  animation: fade-in 120ms;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  animation: modal-in 140ms ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) 0;
  font-size: 15px;
  font-weight: 600;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-line);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
}

/* ------------------------------------------------------ empty state */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4);
  color: var(--c-text-3);
  text-align: center;
}

.empty .icon {
  opacity: 0.4;
}

/* ------------------------------------------------------ loading */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--c-line);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  min-height: 40vh;
  color: var(--c-text-3);
}

/* -------------------------------------------------------------- error page */

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-4);
}

.error-card {
  text-align: center;
}

.error-card .error-code {
  font-size: 56px;
  font-weight: 800;
  color: var(--c-line);
  line-height: 1;
}

.error-card h1 {
  margin: var(--sp-3) 0 var(--sp-4);
  font-size: 16px;
  font-weight: 500;
}

/* =========================================================================
   后台外壳（商家 / 平台）：工具化、密集、可扫读
   ========================================================================= */

.app-admin {
  min-height: 100vh;
  background: var(--c-bg);
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-4);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
}

/* 店名从 div 改成 button（点它切换门店），要先把浏览器默认按钮样式压掉，
   否则会冒出边框/灰底/小一号字体。外观必须和改造前一模一样。 */
button.admin-brand {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 6px;
  margin: 0 -6px;
  font-family: inherit;
  color: inherit;
  text-align: left;
  border-radius: var(--r-sm);
  cursor: pointer;
}

button.admin-brand:hover {
  background: var(--c-bg-2, rgba(0, 0, 0, 0.04));
}

/* 只登录了一家门店时没什么可切，不给「可点」的暗示。 */
button.admin-brand.is-single {
  cursor: default;
}

button.admin-brand.is-single:hover {
  background: none;
}

.admin-brand-caret {
  display: flex;
  align-items: center;
  flex: none;
  color: var(--c-text-3);
}

/* display:flex 会盖掉 HTML 的 hidden 属性（hidden 只等于 display:none 的默认值），
   不补这一条，只登录一家门店时那个箭头照样显示 —— 实测踩到过。 */
.admin-brand-caret[hidden] {
  display: none;
}

/* 「别的门店来活了」角标（商家反馈 n34：不切换也要知道别的店来了单）。 */
.admin-brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--c-danger, #d92d20);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* 同上那条教训：display:inline-flex 会盖掉 hidden 属性，必须显式补一条。 */
.admin-brand-badge[hidden] {
  display: none;
}

/* 切换器里标出「这家有几笔待处理」，省得商家逐家点进去看。 */
.shop-activity-dot {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(217, 45, 32, 0.1);
  color: var(--c-danger, #d92d20);
  font-size: 11px;
  font-weight: 600;
}

.admin-brand .admin-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--c-brand);
  color: #fff;
}

.admin-brand-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--c-text-3);
}

.admin-shell {
  display: flex;
  align-items: flex-start;
}

.admin-nav {
  position: sticky;
  top: var(--topbar-h);
  flex: none;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-2);
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
}

.admin-nav-group {
  padding: var(--sp-3) var(--sp-3) 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-3);
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--c-text-2);
  font-size: 13.5px;
  transition: background var(--dur), color var(--dur);
}

.admin-nav a:hover {
  background: var(--c-surface-3);
  color: var(--c-text);
}

.admin-nav a.is-active {
  background: var(--c-accent-weak);
  color: var(--c-accent-strong);
  font-weight: 600;
}

.admin-nav a.is-locked {
  opacity: 0.55;
}

.admin-nav a .right {
  margin-left: auto;
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: var(--sp-4) var(--sp-5) var(--sp-8);
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.page-head h1 {
  font-size: 18px;
}

.page-head .page-sub {
  font-size: 13px;
  color: var(--c-text-3);
}

.page-head .page-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel {
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  font-size: 14px;
  font-weight: 600;
  flex-wrap: wrap;
}

.panel-head .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.panel-body {
  padding: var(--sp-4);
}

.panel-body.is-flush {
  padding: 0;
}

.panel-note {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-line);
  font-size: 12px;
  color: var(--c-text-3);
}

.split {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.split-3 {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.split-aside {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
}

.filter-bar .input,
.filter-bar .select {
  width: auto;
  min-width: 130px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .icon {
  position: absolute;
  left: 8px;
  color: var(--c-text-3);
  pointer-events: none;
}

.search-box .input {
  padding-left: 30px;
  min-width: 190px;
}

/* 后台移动端：侧栏变抽屉 + 底部导航 */
.admin-drawer-mask {
  display: none;
}

.admin-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .admin-main {
    padding: var(--sp-3) var(--sp-4) var(--sp-8);
  }

  .split,
  .split-aside {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .admin-nav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 500;
    height: 100vh;
    width: 250px;
    transform: translateX(-100%);
    transition: transform 180ms ease-out;
    box-shadow: var(--sh-3);
  }

  .app-admin.nav-open .admin-nav {
    transform: translateX(0);
  }

  .app-admin.nav-open .admin-drawer-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.4);
  }

  .admin-main {
    padding-bottom: calc(var(--shopbar-h) + var(--sp-6));
  }

  .admin-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 320;
    display: flex;
    height: var(--shopbar-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--c-surface);
    border-top: 1px solid var(--c-line);
  }

  .admin-bottom-nav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    font-size: 11px;
    color: var(--c-text-3);
  }

  .admin-bottom-nav a.is-active {
    color: var(--c-accent);
  }

  .page-head h1 {
    font-size: 16px;
  }
}

.nav-toggle {
  display: none;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }
}

/* =========================================================================
   前台数字门店：温暖、有食欲、大触控目标，移动优先
   ========================================================================= */

.app-shop {
  min-height: 100vh;
  background: var(--c-bg);
  padding-bottom: calc(var(--shopbar-h) + env(safe-area-inset-bottom));
}

.shop-topbar {
  position: sticky;
  top: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 50px;
  padding: 0 var(--sp-4);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
}

.shop-topbar.is-transparent {
  background: transparent;
  border-bottom-color: transparent;
}

.shop-topbar-title {
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
}

/* 「逛逛附近」入口。原先只有一个网格图标，商家验收时反馈「看不出这是干什么的」，
   所以补上文字标签；透明顶栏（首页大图上）时加一层半透明底以保证可读。 */
.topbar-portal-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--c-line-strong);
  border-radius: 6px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 12.5px;
  white-space: nowrap;
}

.shop-topbar.is-transparent .topbar-portal-link {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(20, 20, 22, 0.42);
  color: #fff;
  backdrop-filter: blur(6px);
}

/* PC 顶部导航默认隐藏，仅大屏出现（移动端用底部栏） */
.shop-topbar-nav {
  display: none;
}

/* 全幅 hero：背景图 + 图上文字，不用左右分栏卡片 */
.shop-hero {
  position: relative;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--sp-6) var(--sp-4) var(--sp-5);
  color: #fff;
  overflow: hidden;
  background: var(--c-brand-ink);
}

.shop-hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(16, 10, 6, 0.88) 0%,
    rgba(16, 10, 6, 0.55) 42%,
    rgba(16, 10, 6, 0.2) 100%
  );
}

.shop-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.shop-hero-id {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.shop-logo {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: var(--r-lg);
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: var(--c-surface-3);
}

.shop-hero h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.shop-hero-tagline {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.shop-hero-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.92);
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(3px);
  font-weight: 500;
}

.hero-pill.is-open {
  background: rgba(21, 138, 74, 0.9);
}

.hero-pill.is-closed {
  background: rgba(0, 0, 0, 0.45);
}

/* 第三种状态：不在营业时间，但商家开了「非营业时间也接单」，此刻真能下单（n35b）。
   颜色刻意取琥珀色而不是绿色或黑色 —— 说「营业中」会让顾客以为堂食开着，
   说「休息中」是假话（单是真收得下的）。它就该长得像「另一回事」。 */
.hero-pill.is-offhours {
  background: rgba(180, 108, 12, 0.88);
}

.shop-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shop-hero-actions .btn {
  min-height: 40px;
}

.shop-hero-actions .btn-glass {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(4px);
}

.shop-hero-actions .btn-glass:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* 店家主动休息时的「暂停下单」按钮（n35：「只要休息就店家变灰」）。
   灰掉而不是隐藏：位置留着，顾客一眼看出是「现在不行」而不是「这店没有点餐」。 */
.shop-hero-actions .is-resting {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(120, 120, 120, 0.55);
  color: rgba(255, 255, 255, 0.75);
  cursor: not-allowed;
  backdrop-filter: blur(4px);
}

/* 内容区：整幅分段，不做浮动卡片式分区 */
.shop-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4);
}

.shop-section + .shop-section {
  padding-top: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.section-head h2 {
  font-size: 16px;
}

.section-head .section-sub {
  font-size: 12.5px;
  color: var(--c-text-3);
}

.section-head .right {
  margin-left: auto;
  font-size: 13px;
  color: var(--c-brand-dark);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 32px;
  padding-left: 6px;
}

.shop-info-band {
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
}

.info-list {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.info-row .icon {
  margin-top: 2px;
  color: var(--c-brand);
}

.info-row-label {
  font-size: 12px;
  color: var(--c-text-3);
}

.info-row-value {
  font-size: 13.5px;
  word-break: break-word;
}

/* 可点击的信息行（电话、地址导航）在触屏上要有足够的点击高度 */
a.info-row-value {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}

/* 页脚的文字链接同样需要可点高度 */
footer.shop-section a.row {
  min-height: 28px;
}

.hours-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--sp-3);
  font-size: 13px;
}

.hours-table dt {
  color: var(--c-text-3);
  white-space: nowrap;
}

/* 菜品卡片：横向布局，图片固定比例，移动端易点 */
.dish-list {
  display: grid;
  gap: var(--sp-2);
}

.dish-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.dish-card.is-out {
  opacity: 0.62;
}

.dish-thumb {
  position: relative;
  width: 96px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-surface-3);
}

.dish-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--c-text-3);
}

.dish-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dish-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.dish-desc {
  font-size: 12.5px;
  color: var(--c-text-3);
  line-height: 1.45;
}

.dish-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.dish-foot {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  margin-top: auto;
}

.price {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--c-brand-dark);
  font-weight: 700;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.price .price-symbol {
  font-size: 12px;
  font-family: var(--font-sans);
}

.price-lg {
  font-size: 20px;
}

.price-md {
  font-size: 17px;
}

.price-sm {
  font-size: 14px;
}

.price-list {
  font-size: 12px;
  color: var(--c-text-3);
  text-decoration: line-through;
  font-family: var(--font-num);
}

.dish-foot .right {
  margin-left: auto;
}

/* 团购卡片 */
.deal-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.deal-card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
  text-align: left;
  border: 0;
  padding: 0;
  width: 100%;
}

.deal-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--c-surface-3);
}

.deal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.deal-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--c-brand);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
}

.deal-sold-out {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.deal-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--sp-3);
  flex: 1;
}

.deal-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
}

.deal-sub {
  font-size: 12.5px;
  color: var(--c-text-3);
}

.deal-foot {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-2);
}

.progress {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--c-surface-3);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--c-brand);
}

/* 优惠券 */
.coupon-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.coupon-card {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 208px;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1px dashed var(--c-brand);
}

.coupon-amount {
  display: flex;
  align-items: baseline;
  gap: 1px;
  color: var(--c-brand-dark);
  font-weight: 700;
  font-family: var(--font-num);
  font-size: 22px;
  flex: none;
}

.coupon-amount small {
  font-size: 12px;
  font-family: var(--font-sans);
}

.coupon-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.coupon-name {
  font-size: 13px;
  font-weight: 600;
}

.coupon-rule {
  font-size: 11.5px;
  color: var(--c-text-3);
}

/* 评价 */
.review-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-line);
}

.review-item:last-child {
  border-bottom: 0;
}

.stars {
  display: inline-flex;
  gap: 1px;
  color: #e8a33d;
}

.stars .icon {
  fill: currentColor;
}

.stars .is-empty {
  color: var(--c-line-strong);
  fill: none;
}

.star-input {
  display: inline-flex;
  gap: 2px;
}

.star-input button {
  display: flex;
  padding: 3px;
  border: 0;
  background: transparent;
  color: var(--c-line-strong);
}

.star-input button.is-on {
  color: #e8a33d;
}

.star-input button.is-on .icon {
  fill: currentColor;
}

.review-reply {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--c-surface-3);
  font-size: 12.5px;
  color: var(--c-text-2);
}

/* 底部操作栏（移动端主要交互入口） */
.shop-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 320;
  display: flex;
  height: var(--shopbar-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
}

.shop-bottom-bar a {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  font-size: 11px;
  color: var(--c-text-3);
}

.shop-bottom-bar a.is-active {
  color: var(--c-brand);
  font-weight: 600;
}

.shop-bottom-bar .badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 4px;
}

/* 购物车结算条：悬浮在底部栏之上 */
.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--shopbar-h) + env(safe-area-inset-bottom));
  z-index: 330;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-4);
  background: var(--c-brand-ink);
  color: #fff;
  box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.18);
}

.cart-bar .price {
  color: #fff;
}

.cart-bar-count {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--c-brand);
}

.cart-bar-count .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #fff;
  color: var(--c-brand-dark);
}

.cart-bar-summary {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.cart-bar-note {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.75);
}

/* 底部抽屉（规格选择 / 购物车 / 表单） */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 120ms;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: sheet-up 180ms ease-out;
  padding-bottom: env(safe-area-inset-bottom);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  font-size: 15px;
  font-weight: 600;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.sheet-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-line);
}

@media (min-width: 720px) {
  .sheet-mask {
    align-items: center;
  }

  .sheet {
    border-radius: var(--r-lg);
    max-height: 82vh;
  }

  @keyframes sheet-up {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
  }
}

/* 规格选项 */
.option-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: 14px;
}

.option-chip[aria-pressed='true'] {
  border-color: var(--c-brand);
  background: var(--c-brand-weak);
  color: var(--c-brand-dark);
  font-weight: 600;
}

.option-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 菜单页：分类导航 + 菜品列表 */
.menu-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  max-width: 1120px;
  margin: 0 auto;
  align-items: start;
}

.menu-cats {
  position: sticky;
  top: 50px;
  max-height: calc(100vh - 50px - var(--shopbar-h));
  overflow-y: auto;
  background: var(--c-surface-3);
  border-right: 1px solid var(--c-line);
}

.menu-cats button {
  display: block;
  width: 100%;
  padding: 13px 8px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--c-text-2);
  font-size: 13px;
  text-align: center;
  line-height: 1.3;
}

.menu-cats button[aria-selected='true'] {
  background: var(--c-surface);
  border-left-color: var(--c-brand);
  color: var(--c-text);
  font-weight: 600;
}

.menu-body {
  min-width: 0;
  padding: var(--sp-3) var(--sp-3) var(--sp-6);
}

.menu-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-2);
}

/* 订单/凭证展示 */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13.5px;
}

.kv-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.kv-row dt {
  flex: none;
  min-width: 72px;
  color: var(--c-text-3);
  font-size: 13px;
}

.kv-row dd {
  min-width: 0;
  word-break: break-word;
}

/* 后台里的 kv-row 用 span/span 而不是 dt/dd（订单详情、概览等），
   同样需要「左标签、右数值」的对齐，否则数值会紧贴标签。 */
.kv-row > span:first-child {
  min-width: 0;
}

.kv-row > span + span {
  flex: none;
  margin-left: auto;
  text-align: right;
}

.total-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13.5px;
}

.total-row.is-final {
  padding-top: var(--sp-2);
  margin-top: var(--sp-1);
  border-top: 1px solid var(--c-line);
  font-weight: 600;
}

/* 核销码 */
.voucher-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-brand-weak);
  border: 1px dashed var(--c-brand);
}

.voucher-digits {
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--c-brand-ink);
}

/* 时段选择 */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
}

.slot-btn {
  min-height: 40px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-family: var(--font-num);
  font-size: 14px;
}

.slot-btn[aria-pressed='true'] {
  border-color: var(--c-brand);
  background: var(--c-brand-weak);
  color: var(--c-brand-dark);
  font-weight: 600;
}

.slot-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

.date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.date-btn {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 62px;
  padding: 7px 4px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-size: 12px;
  color: var(--c-text-2);
}

.date-btn strong {
  font-family: var(--font-num);
  font-size: 15px;
  color: var(--c-text);
}

.date-btn[aria-pressed='true'] {
  border-color: var(--c-brand);
  background: var(--c-brand-weak);
}

.date-btn[aria-pressed='true'] strong {
  color: var(--c-brand-dark);
}

/* 提示条 */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  background: var(--c-info-weak);
  color: #0b5d68;
}

.notice-warn {
  background: var(--c-warn-weak);
  color: #8a5200;
}

.notice-danger {
  background: var(--c-danger-weak);
  color: #9c2626;
}

.notice-ok {
  background: var(--c-ok-weak);
  color: #0f6b39;
}

.notice .icon {
  margin-top: 1px;
  flex: none;
}

/* =========================================================================
   三端适配
   手机 <= 719px   : 底部操作栏、单列、大触控目标（默认样式）
   平板 720-1023px : 竖屏两列 / 横屏三列，仍保留底部栏
   PC   >= 1024px  : 顶部导航替代底部栏，多列大屏排布
   ========================================================================= */

@media (min-width: 720px) {
  .shop-hero {
    min-height: 360px;
    padding: var(--sp-8) var(--sp-6) var(--sp-6);
  }

  .shop-hero h1 {
    font-size: 30px;
  }

  .shop-hero-tagline {
    font-size: 15px;
  }

  .shop-logo {
    width: 66px;
    height: 66px;
  }

  .shop-section {
    padding: var(--sp-6) var(--sp-6);
  }

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

  .menu-layout {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .menu-body {
    padding: var(--sp-4);
  }

  .cart-bar {
    padding: 12px var(--sp-6);
  }
}

/* 平板横屏：给菜单更多列 */
@media (min-width: 900px) and (max-width: 1023px) and (orientation: landscape) {
  .dish-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .app-shop {
    padding-bottom: 0;
  }

  /* PC 上用顶部导航，隐藏底部栏 */
  .shop-bottom-bar {
    display: none;
  }

  .shop-topbar {
    height: 58px;
    padding: 0 var(--sp-6);
  }

  .shop-topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: var(--sp-4);
  }

  .shop-topbar-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--r-sm);
    font-size: 14px;
    color: var(--c-text-2);
  }

  .shop-topbar-nav a:hover {
    background: var(--c-surface-3);
    color: var(--c-text);
  }

  .shop-topbar-nav a.is-active {
    background: var(--c-brand-weak);
    color: var(--c-brand-dark);
    font-weight: 600;
  }

  .shop-hero {
    min-height: 420px;
    padding: var(--sp-8) var(--sp-7) var(--sp-7);
  }

  .shop-hero h1 {
    font-size: 36px;
  }

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

  .menu-layout {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: var(--sp-4);
    padding: 0 var(--sp-6);
  }

  .menu-cats {
    top: 58px;
    max-height: calc(100vh - 58px);
    border-right: 0;
    background: transparent;
  }

  .menu-cats button {
    text-align: left;
    border-left: 0;
    border-radius: var(--r-sm);
    padding: 10px 12px;
  }

  .menu-cats button[aria-selected='true'] {
    background: var(--c-brand-weak);
    color: var(--c-brand-dark);
  }

  .cart-bar {
    bottom: 0;
    padding: 14px var(--sp-7);
  }

  .shop-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: var(--sp-5);
    align-items: start;
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--sp-5) var(--sp-6);
  }
}

@media (min-width: 1440px) {
  .shop-hero-inner,
  .shop-section,
  .menu-layout,
  .shop-page-grid {
    max-width: 1240px;
  }

  .dish-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 触屏设备：加大所有可点区域 */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 40px;
  }

  .btn-sm {
    min-height: 34px;
  }

  .btn-icon {
    width: 38px;
    height: 38px;
  }

  .stepper button {
    width: 36px;
    height: 36px;
  }

  .input,
  .select {
    min-height: 40px;
  }
}

@media print {
  .admin-topbar,
  .admin-nav,
  .admin-bottom-nav,
  .shop-bottom-bar,
  .cart-bar,
  .page-actions,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .qr-print-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10mm !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================================
   本地服务平台入口（统一门户）
   ========================================================================= */

.portal-hero {
  position: relative;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--sp-8) var(--sp-4) var(--sp-6);
  color: #fff;
  overflow: hidden;
  background: #241812;
}

.portal-hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(18, 12, 8, 0.9) 6%, rgba(18, 12, 8, 0.35) 100%);
}

.portal-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.portal-hero h1 {
  font-size: 26px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

.portal-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  font-size: 13.5px;
  color: var(--c-text-2);
}

.portal-cat[aria-pressed='true'] {
  border-color: var(--c-brand);
  background: var(--c-brand-weak);
  color: var(--c-brand-dark);
  font-weight: 600;
}

.portal-cat:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.store-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}

.store-card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: box-shadow var(--dur);
}

.store-card:hover {
  box-shadow: var(--sh-2);
}

/* 休息中的门店整体灰置（商家 2026-09-06 n35b）。
   他的原话：「本地服务里休息和营业中状态标识不明显，休息中可以在本地服务中
   整体灰置并置后」。「置后」在服务端排序里做，这里只管「一眼看出来」。

   刻意不用 pointer-events:none —— 休息中的店照样要能点进去看菜单、看营业时间，
   只是现在下不了单。灰置是提示，不是封路。 */
.store-card-resting {
  opacity: 0.62;
}

.store-card-resting .store-media {
  /* 图片降饱和：休息中的店不该和营业中的店抢眼。 */
  filter: grayscale(0.85);
}

.store-card-resting:hover {
  opacity: 0.85;
}

/* 休息中的状态标签要和营业中拉开距离（他说「标识不明显」）。
   营业中是绿底绿字，休息中原来是默认灰底灰字，两者放一起分量太接近。 */
.chip-rest {
  background: var(--c-surface-3);
  color: var(--c-text-2);
  border: 1px solid var(--c-line);
  font-weight: 600;
}

.store-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--c-surface-3);
}

.store-media > img:not(.store-logo) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-logo {
  position: absolute;
  bottom: -16px;
  left: var(--sp-3);
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 2px solid #fff;
  object-fit: cover;
  background: var(--c-surface-3);
}

.store-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  flex: 1;
}

.store-name {
  font-size: 15px;
  font-weight: 600;
}

.rating-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  color: #b8791f;
  font-weight: 600;
}

/* =========================================================================
   登录页（商家 / 平台共用）
   ========================================================================= */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-4);
  background: var(--c-bg);
}

.login-box {
  width: 100%;
  max-width: 380px;
  padding: var(--sp-6);
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}

.login-box h1 {
  font-size: 19px;
  margin-bottom: 4px;
}

.login-box .login-sub {
  font-size: 13px;
  color: var(--c-text-3);
  margin-bottom: var(--sp-5);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.login-demo {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-line);
  font-size: 12.5px;
  color: var(--c-text-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-demo code {
  font-family: var(--font-num);
  color: var(--c-text-2);
}

/* =========================================================================
   图表（纯 CSS/SVG，无第三方依赖）
   ========================================================================= */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 148px;
  padding-top: var(--sp-3);
}

.bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  max-width: 26px;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--c-accent);
  transition: height var(--dur);
}

.bar-fill.is-muted {
  background: var(--c-line-strong);
}

.bar-label {
  font-size: 10.5px;
  color: var(--c-text-3);
  font-family: var(--font-num);
  /* 手机上柱子只有 ~20px 宽，日期标签必须允许换行/收缩，否则会撑破图表容器 */
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.25;
}

.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px var(--sp-3);
  font-size: 13px;
  align-items: center;
}

.hbar-track {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--c-surface-3);
  overflow: hidden;
}

.hbar-track span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--c-accent);
}

/* =========================================================================
   桌码打印
   ========================================================================= */

.qr-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}

.qr-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-3);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: #fff;
  break-inside: avoid;
}

.qr-tile img {
  width: 100%;
  max-width: 132px;
  aspect-ratio: 1 / 1;
}

.qr-tile-code {
  font-size: 15px;
  font-weight: 700;
}

.qr-tile-hint {
  font-size: 11px;
  color: var(--c-text-3);
  text-align: center;
}

/* 图片选择器 */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--sp-2);
}

.media-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-surface-3);
  padding: 0;
}

.media-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-tile[aria-pressed='true'] {
  border-color: var(--c-accent);
}

.media-tile-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}

.media-tile-actions .btn-icon {
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--sh-1);
}

.media-tile-cat {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 5px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10.5px;
}

.thumb-preview {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--c-surface-3);
  border: 1px solid var(--c-line);
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--sp-5);
  border: 1px dashed var(--c-line-strong);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  color: var(--c-text-3);
  font-size: 13px;
  text-align: center;
}

.drop-zone.is-over {
  border-color: var(--c-accent);
  background: var(--c-accent-weak);
  color: var(--c-accent-strong);
}
