:root {
  --primary: #FF6B35;
  --primary-dark: #E85A26;
  --bg: #FFF7F0;
  --card: #FFFFFF;
  --text: #2B2B2B;
  --muted: #8A8A8A;
  --line: #F0E4D8;
  --danger: #E53935;
  --success: #43A047;
  --warning: #FB8C00;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  height: 100%;
}
.hidden { display: none !important; }

/* ===== 视图 ===== */
.view { min-height: 100vh; }
#view-main, #view-chef { display: flex; flex-direction: column; height: 100vh; }

/* ===== 认证页 ===== */
.auth-box { max-width: 380px; margin: 0 auto; padding: 48px 24px; text-align: center; }
.logo { font-size: 56px; }
.app-title { font-size: 26px; margin: 12px 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 28px; font-size: 14px; }
.form { text-align: left; }
.tab-switch { display: flex; background: #F3EAE0; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tab-switch .tab { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 8px; font-size: 15px; color: var(--muted); }
.tab-switch .tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; margin-bottom: 12px; background: #fff; }
.input:focus { outline: none; border-color: var(--primary); }
.divider { text-align: center; color: var(--muted); margin: 16px 0; position: relative; font-size: 13px; }
.divider::before, .divider::after { content:""; position:absolute; top:50%; width:42%; height:1px; background:var(--line); }
.divider::before { left:0; } .divider::after { right:0; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 10px; padding: 13px 18px; font-size: 16px; cursor: pointer; width: 100%; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:disabled { background: #FFB79A; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-text { background: transparent; color: var(--muted); font-size: 14px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 14px; width: auto; border-radius: 8px; }
.btn-block { margin: 12px 0; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; text-align: center; }

/* ===== 顶栏 & 底栏 ===== */
#topbar, #chefTopbar {
  display: flex; align-items: center; padding: 14px 16px;
  background: #fff; position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
  padding-top: calc(14px + env(safe-area-inset-top));
}
.topbar-title { flex: 1; font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }
.back-btn { border: none; background: transparent; font-size: 26px; cursor: pointer; padding: 0 8px; color: var(--text); }

#tabbar {
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item { flex: 1; border: none; background: transparent; padding: 8px 0 6px; font-size: 11px; color: var(--muted); position: relative; cursor: pointer; }
.tab-item.active { color: var(--primary); }
.tab-icon { display: block; font-size: 22px; margin-bottom: 2px; }
.badge { position: absolute; top: 2px; right: 50%; transform: translateX(18px); background: var(--danger); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; font-style: normal; }

/* ===== 主内容 ===== */
#mainContent { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.page { padding: 12px 14px; }

/* 厨房头 */
.kitchen-header { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.kitchen-avatar { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: #FFE0D0; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.kitchen-name { font-size: 17px; font-weight: 700; }
.kitchen-announce { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* 分类 chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 菜品网格 */
.dish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dish-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; }
.dish-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #F6EEE6; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.dish-info { padding: 10px 12px; }
.dish-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.dish-desc { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #FFF0E8; color: var(--primary-dark); }
.tag.soldout { background: #eee; color: var(--muted); }
.dish-card.soldout { opacity: .55; }
.soldout-flag { position: absolute; }

/* 搜索 */
.search-bar { margin-bottom: 12px; }
.search-bar .input { margin-bottom: 0; }

/* 购物车 */
.cart-list { display: flex; flex-direction: column; gap: 12px; }
.cart-kitchen { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.cart-kitchen-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: none; }
.cart-item-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #F6EEE6; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; }
.cart-item-remark { font-size: 12px; color: var(--muted); }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 16px; cursor: pointer; }
.cart-footer { margin-top: 14px; }

/* 点单 */
.status-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.status-tabs .chip { flex: 0 0 auto; }
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-status { font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.st-pending { background: #FFF3E0; color: var(--warning); }
.st-accepted { background: #E3F2FD; color: #1976D2; }
.st-cooking { background: #F3E5F5; color: #8E24AA; }
.st-completed { background: #E8F5E9; color: var(--success); }
.st-rejected { background: #FFEBEE; color: var(--danger); }
.st-cancelled { background: #EEEEEE; color: var(--muted); }
.order-items { font-size: 14px; margin-bottom: 6px; color: var(--text); }
.order-meta { font-size: 12px; color: var(--muted); }
.order-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.order-actions .btn-sm { flex: 1; }

/* 我的 */
.me-card { background: linear-gradient(135deg, #FF8A50, #FF6B35); border-radius: var(--radius); padding: 20px; color: #fff; display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.me-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; font-size: 30px; }
.me-name { font-size: 19px; font-weight: 700; }
.me-family { font-size: 13px; opacity: .9; }
.menu-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-icon { font-size: 20px; }
.menu-item .mi-arrow { margin-left: auto; color: var(--muted); }

/* 厨师工作台 */
.chef-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.chef-tab { flex: 1; border: none; background: transparent; padding: 12px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.chef-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
#chefContent { flex: 1; overflow-y: auto; padding: 12px 14px; }
.list-block { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; }
.list-row .lr-title { font-size: 15px; font-weight: 600; }
.list-row .lr-sub { font-size: 12px; color: var(--muted); }

/* ===== 弹层 ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-sheet { position: relative; width: 100%; max-height: 88vh; background: #fff; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1; font-size: 17px; font-weight: 700; }
.modal-close { border: none; background: transparent; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow-y: auto; }

.detail-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; background: #F6EEE6; }
.detail-title { font-size: 20px; font-weight: 700; margin: 12px 0 4px; }
.detail-desc { font-size: 14px; color: var(--muted); line-height: 1.6; }
.detail-section { margin-top: 14px; font-size: 14px; }
.qty-picker { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.qty-picker .qty-btn { width: 36px; height: 36px; font-size: 20px; }
.qty-picker .qty-val { font-size: 20px; font-weight: 700; min-width: 30px; text-align: center; }
.field-label { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }

/* 空状态 / 加载 */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 30px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,.82); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 200; max-width: 80%; text-align: center; }

/* 图片上传 */
.upload-box { border: 2px dashed var(--line); border-radius: 12px; padding: 20px; text-align: center; color: var(--muted); cursor: pointer; }
.upload-box img { max-width: 100%; border-radius: 8px; margin-bottom: 6px; }
