/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #e8590c;       /* 暖橙，主色 */
  --primary-soft: #fff0e6;
  --bg: #faf7f2;            /* 米白背景 */
  --card: #ffffff;
  --text: #2f2a26;
  --text-sub: #8a8078;
  --line: #efe8e0;
  --danger: #d9480f;
  --green: #2f9e44;
  --radius: 14px;
  --shadow: 0 1px 6px rgba(60, 40, 20, 0.07);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 76px; /* 给底部导航留空间 */
  min-height: 100vh;
}

.hidden { display: none !important; }
.pre { white-space: pre-wrap; line-height: 1.7; color: var(--text); }

/* ============ 头部 ============ */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-title { font-size: 1.15rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 8px; }
.mode-badge {
  font-size: 0.7rem; color: #a05a00; background: #fff3d6;
  border: 1px solid #f0d9a0; border-radius: 999px; padding: 2px 8px;
}
.role-chip {
  font-size: 0.8rem; color: var(--primary);
  background: var(--primary-soft); border: 1px solid #ffd8bf;
  border-radius: 999px; padding: 4px 10px; cursor: pointer;
}

/* ============ 页面通用 ============ */
main { padding: 14px 16px; max-width: 640px; margin: 0 auto; }
.page-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.page-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.page-title-row .page-title { margin-bottom: 0; }

.empty { text-align: center; padding: 56px 0 40px; color: var(--text-sub); }
.empty-emoji { font-size: 2.6rem; margin-bottom: 10px; }
.empty-sub { font-size: 0.82rem; margin-top: 4px; }

/* ============ 按钮与输入 ============ */
.btn {
  border: none; border-radius: 10px; padding: 11px 18px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.75; }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid #d9cfc5; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #f3c2ad; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-small { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }

.input {
  width: 100%; padding: 11px 12px; font-size: 0.95rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text);
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--primary); }
textarea.input { resize: vertical; }

/* ============ 菜单页 ============ */
.search-row { margin-bottom: 10px; }
.search-input { border-radius: 999px; padding-left: 16px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text-sub); font-size: 0.85rem; cursor: pointer;
}
.chip-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.dish-list { display: flex; flex-direction: column; gap: 12px; }
.dish-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow); cursor: pointer;
}
.dish-photo {
  position: relative; width: 76px; height: 76px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
}
.dish-photo img { width: 100%; height: 100%; object-fit: cover; }
.dish-photo-placeholder { font-size: 1.8rem; }
.dish-info { flex: 1; min-width: 0; }
.dish-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.dish-cat { font-size: 0.75rem; color: var(--text-sub); }
.sold-out .dish-photo img { filter: grayscale(1); opacity: 0.7; }
.sold-out .dish-name { color: var(--text-sub); }
.soldout-tag {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 0.65rem; text-align: center; padding: 2px 0;
}
h3 .soldout-tag { position: static; background: #eee; color: #999; padding: 2px 8px; border-radius: 6px; font-size: 0.7rem; }

.dish-actions { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid #d9cfc5; background: var(--card);
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--text);
}
.qty-plus { background: var(--primary); border-color: var(--primary); color: #fff; }
.qty-num { min-width: 18px; text-align: center; font-weight: 700; }

/* ============ 点单篮 ============ */
.cart-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.cart-name { font-weight: 600; }
.cart-footer { margin-top: 16px; }
.cart-footer .input { margin-bottom: 4px; }

/* ============ 订单页 ============ */
.order-card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-who { font-weight: 700; font-size: 0.92rem; }
.status { font-size: 0.72rem; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.st-pending { background: #fff3d6; color: #a05a00; }
.st-cooking { background: var(--primary-soft); color: var(--primary); }
.st-done { background: #e6f7ea; color: var(--green); }
.st-cancelled { background: #f1f0ee; color: var(--text-sub); }
.order-items { line-height: 1.6; font-size: 0.92rem; }
.order-note {
  margin-top: 8px; font-size: 0.82rem; color: var(--text-sub);
  background: var(--bg); border-radius: 8px; padding: 8px 10px;
}
.order-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
}
.order-time { font-size: 0.75rem; color: var(--text-sub); }
.order-actions { display: flex; gap: 8px; }

/* ============ 管理页 ============ */
.manage-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 10px; margin-bottom: 10px; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.manage-thumb {
  width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  background: var(--primary-soft); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.manage-thumb img { width: 100%; height: 100%; object-fit: cover; }
.manage-info { flex: 1; min-width: 120px; }
.manage-actions { display: flex; gap: 6px; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  position: relative; flex: 1; border: none; background: none;
  padding: 8px 0 10px; font-size: 0.72rem; color: var(--text-sub);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer;
}
.tab-icon { font-size: 1.3rem; }
.tab.active { color: var(--primary); font-weight: 700; }
.badge {
  position: absolute; top: 4px; right: calc(50% - 26px);
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 0.65rem; line-height: 17px; text-align: center;
}

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(30, 20, 10, 0.45); }
.modal-body {
  position: relative; width: 100%; max-width: 640px; max-height: 86vh;
  overflow-y: auto; background: var(--card);
  border-radius: 18px 18px 0 0; padding: 20px 18px 28px;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-body h3 { font-size: 1.15rem; margin-bottom: 6px; }
.modal-body h4 { margin: 16px 0 6px; font-size: 0.9rem; color: var(--primary); }
.detail-photo { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }

/* 表单 */
.field { display: block; margin-top: 14px; }
.field-label { display: block; font-size: 0.82rem; color: var(--text-sub); margin-bottom: 6px; }
.cat-row { display: flex; flex-direction: column; gap: 8px; }
.file-input { font-size: 0.85rem; }
.photo-preview { margin-top: 8px; }
.photo-preview img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-actions .btn { min-width: 96px; }

/* ============ 遮罩层（角色/口令） ============ */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.overlay-card {
  width: 100%; max-width: 340px; text-align: center;
  background: var(--card); border-radius: 20px; padding: 32px 24px;
  box-shadow: 0 4px 24px rgba(60, 40, 20, 0.1);
}
.overlay-emoji { font-size: 3rem; margin-bottom: 12px; }
.overlay-card h2 { font-size: 1.2rem; margin-bottom: 6px; }
.overlay-card p { color: var(--text-sub); font-size: 0.9rem; margin-bottom: 18px; }
.overlay-card .input { margin-bottom: 4px; }
.error-text { color: var(--danger); font-size: 0.8rem; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 60; background: rgba(40, 30, 22, 0.9); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 0.85rem;
  max-width: 86vw; text-align: center;
}
.toast-error { background: rgba(180, 50, 10, 0.94); }
