/* ============================================================
   家庭菜单 · 全栈版 样式
   温暖橙色主题 · 移动优先
   ============================================================ */
:root {
  --primary: #ff7a3d;
  --primary-dark: #e85f23;
  --primary-light: #fff1e8;
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #2c2420;
  --muted: #9b9088;
  --line: #efe7df;
  --danger: #e5484d;
  --ok: #2fa36b;
  --shadow: 0 6px 20px rgba(0,0,0,.07);
  --radius: 16px;
}
* { 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);
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}
h1,h2,h3 { margin: 0; font-weight: 700; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* ---------------- 按钮 ---------------- */
.btn {
  padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  transition: transform .08s, opacity .2s; background: var(--primary-light); color: var(--primary-dark);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn-block { width: 100%; padding: 13px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.link-btn { color: var(--muted); font-size: 13px; text-decoration: underline; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------------- 登录 ---------------- */
.auth-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #ff9a5a, #ff7a3d); padding: 20px; z-index: 50;
}
.auth-card {
  background: #fff; border-radius: 24px; padding: 30px 24px; width: 100%; max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2); text-align: center;
}
.auth-logo { font-size: 52px; }
.auth-title { font-size: 26px; margin: 6px 0 2px; }
.auth-sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.auth-tab.active { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow); }
.auth-form { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.auth-hint { color: var(--danger); font-size: 13px; text-align: center; min-height: 16px; margin: 4px 0 0; }
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; margin: -2px 0 2px; }
.remember-row input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ---------------- 字段 ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .search-input {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--text);
  outline: none; transition: border .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------------- App 框架 ---------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.03);
}
.family-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.family-switcher {
  display: flex; align-items: center; gap: 6px; background: var(--primary-light); color: var(--primary-dark);
  font-weight: 700; font-size: 16px; padding: 8px 14px; border-radius: 12px; max-width: 60%;
}
.family-switcher #current-family-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { font-size: 11px; }
.family-bar-right { display: flex; align-items: center; gap: 8px; }
.user-chip {
  background: var(--bg); border-radius: 20px; padding: 5px 12px; font-size: 13px; color: var(--text); font-weight: 600;
}
.family-dropdown {
  position: absolute; left: 14px; right: 14px; top: 56px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 30; max-height: 60vh; overflow-y: auto;
}
.family-dropdown .dd-item {
  display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 10px; width: 100%; text-align: left;
}
.family-dropdown .dd-item:hover { background: var(--bg); }
.family-dropdown .dd-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.family-dropdown .dd-tag { font-size: 11px; padding: 2px 7px; border-radius: 8px; background: var(--bg); color: var(--muted); }
.family-dropdown .dd-tag.admin { background: #fdeccb; color: #b5780a; }
.family-dropdown .dd-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.family-dropdown .dd-action { color: var(--primary-dark); font-weight: 600; padding: 11px 12px; width: 100%; text-align: left; border-radius: 10px; }
.family-dropdown .dd-action:hover { background: var(--primary-light); }

.app-main { flex: 1; padding: 14px 14px 90px; }
.view { animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 19px; }

/* ---------------- 工具栏 ---------------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-input { flex: 1; }
.cat-filter { padding: 11px 8px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }

/* ---------------- 菜品卡片 ---------------- */
.dish-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.dish-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; display: flex; flex-direction: column; transition: transform .1s;
}
.dish-card:active { transform: scale(.98); }
.dish-thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--primary-light); }
.dish-thumb-placeholder { width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; font-size: 38px; background: var(--primary-light); }
.dish-info { padding: 10px 12px; }
.dish-name { font-weight: 700; font-size: 15px; }
.dish-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 3px 8px; border-radius: 8px; background: var(--bg); color: var(--muted); }
.chip.cat { background: var(--primary-light); color: var(--primary-dark); }
.chip.diff-简单 { background: #e7f6ee; color: var(--ok); }
.chip.diff-中等 { background: #fef3da; color: #b5780a; }
.chip.diff-困难 { background: #fde7e7; color: var(--danger); }
.chip.ai { background: #e9ecff; color: #4a52c4; }

/* 点菜可选卡片 */
.dish-card.selectable { position: relative; }
.dish-card.selectable.selected { outline: 3px solid var(--primary); }
.dish-card .check-badge {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; display: none; align-items: center; justify-content: center; font-weight: 700;
}
.dish-card.selectable.selected .check-badge { display: flex; }

/* ---------------- 悬浮按钮 ---------------- */
.fab {
  position: fixed; right: 18px; bottom: 78px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 8px 22px rgba(255,122,61,.5);
  z-index: 15; max-width: calc(720px - 36px); left: 50%; transform: translateX(calc(360px - 46px));
}
.fab:active { transform: translateX(calc(360px - 46px)) scale(.92); }

/* ---------------- 底部导航 ---------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 720px;
  display: flex; background: #fff; border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 18;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; padding: 4px 0; }
.nav-item .nav-ico { font-size: 21px; }
.nav-item.active { color: var(--primary-dark); font-weight: 700; }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 40;
}
.modal-card {
  background: #fff; width: 100%; max-width: 720px; border-radius: 22px 22px 0 0; max-height: 90vh; display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; }
.modal-close { font-size: 20px; color: var(--muted); padding: 4px 8px; }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal-actions .btn { flex: 1; }

/* ---------------- 步骤编辑 ---------------- */
.step-item { display: flex; gap: 8px; align-items: flex-start; background: var(--bg); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.step-num { background: var(--primary); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.step-content { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.step-content textarea { padding: 8px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; min-height: 44px; }
.step-img-btn { font-size: 12px; color: var(--primary-dark); align-self: flex-start; }
.step-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; }
.step-del { color: var(--danger); font-size: 12px; flex-shrink: 0; }

/* ---------------- 图片上传 ---------------- */
.img-upload { display: flex; align-items: center; gap: 10px; }
.img-preview { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }

/* ---------------- 详情时间线 ---------------- */
.detail-cover { width: 100%; border-radius: 14px; margin-bottom: 12px; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-section-title { font-weight: 700; margin: 14px 0 8px; font-size: 15px; }
.ingredient-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ingredient-list .chip { background: var(--primary-light); color: var(--primary-dark); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-step { position: relative; margin-bottom: 16px; }
.tl-dot { position: absolute; left: -22px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.tl-text { font-size: 14px; }
.tl-img { width: 100%; max-width: 280px; border-radius: 12px; margin-top: 8px; }

/* ---------------- 订单 ---------------- */
.stats { display: flex; gap: 10px; margin-bottom: 14px; }
.stat-box { flex: 1; background: var(--card); border-radius: 14px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 22px; font-weight: 800; color: var(--primary-dark); }
.stat-label { font-size: 12px; color: var(--muted); }
.order-card { background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.order-top { display: flex; justify-content: space-between; align-items: center; }
.order-orderer { font-weight: 700; font-size: 16px; }
.order-time { color: var(--primary-dark); font-weight: 600; font-size: 14px; }
.order-items { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.order-note { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.order-actions { display: flex; gap: 8px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 8px; font-weight: 600; }
.badge.pending { background: #fdeccb; color: #b5780a; }
.badge.done { background: #e7f6ee; color: var(--ok); }
.badge.soon { background: #fde7e7; color: var(--danger); }

/* ---------------- 分析 ---------------- */
.analysis-input { width: 100%; min-height: 160px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; resize: vertical; margin-bottom: 12px; }
.analysis-card { background: var(--card); border-radius: 16px; padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.analysis-card .ac-title { font-weight: 700; font-size: 17px; margin-bottom: 10px; }
.analysis-edit input, .analysis-edit textarea { width: 100%; margin-bottom: 8px; }

/* ---------------- 家庭管理 ---------------- */
.fam-section { margin-bottom: 18px; }
.fam-section h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.fam-code-box { display: flex; align-items: center; gap: 8px; background: var(--primary-light); border-radius: 12px; padding: 12px; }
.fam-code { font-size: 22px; font-weight: 800; letter-spacing: 3px; color: var(--primary-dark); flex: 1; }
.member-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: none; }
.member-info { display: flex; flex-direction: column; }
.member-name { font-weight: 600; }
.member-role { font-size: 12px; color: var(--muted); }
.member-actions { display: flex; gap: 6px; }
.pending-row { display: flex; align-items: center; justify-content: space-between; padding: 10px; background: var(--bg); border-radius: 10px; margin-bottom: 6px; }
.empty-tip { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(44,36,32,.94); color: #fff;
  padding: 11px 20px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: 90%; text-align: center;
}
