/* ============================================================
   家庭食堂 · 网页端管理后台
   admin.css — 桌面端布局，视觉令牌沿用 design-contract.md（唯一来源）
   ============================================================ */

/* ---------- 设计令牌（与 styles.css 同源，不新增颜色/圆角） ---------- */
:root {
  --primary: #E0632F;
  --primary-deep: #C24E1F;
  --primary-soft: #FDEDE3;
  --bg: #FAF6F0;
  --surface: #FFFFFF;
  --surface-2: #F6F0E7;
  --border: #EDE3D5;
  --text: #2E2A25;
  --text-sub: #9C9083;
  --text-faint: #C9BCAB;
  --green: #6B9A5E;
  --green-soft: #EDF3E8;
  --gold: #E8A33D;
  --gold-soft: #FBF3E2;
  --danger: #CE4A3D;
  --danger-soft: #FBEAE7;
  --cat-meat: #C2503C;      --cat-meat-soft: #FAEAE6;
  --cat-veg: #6B9A5E;       --cat-veg-soft: #EDF3E8;
  --cat-soup: #D98E32;      --cat-soup-soft: #FBF0DE;
  --cat-staple: #B0894F;    --cat-staple-soft: #F5EEDF;
  --cat-cold: #5D8CA8;      --cat-cold-soft: #E7F0F5;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;
  --shadow-card: 0 1px 2px rgba(46,42,37,.05), 0 6px 20px rgba(46,42,37,.05);
  --font-display: 'Songti SC', 'STSong', 'Noto Serif SC', 'SimSun', serif;
  --font-body: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: linear-gradient(160deg, #F5ECDF 0%, #F1E4D2 45%, #EDDCC6 100%);
  min-height: 100vh;
}

/* ---------- 登录门 ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #F5ECDF 0%, #F1E4D2 45%, #EDDCC6 100%);
  padding: 24px;
}
.gate-card {
  width: 400px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  padding: 36px 32px 24px;
  text-align: center;
}
.gate-brand h1 { font-family: var(--font-display); font-size: 26px; letter-spacing: 4px; margin-top: 14px; }
.gate-sub { font-size: 12px; color: var(--text-sub); margin-top: 6px; }
.gate-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--primary-soft); color: var(--primary);
}
.gate-tip { font-size: 13px; color: var(--text-sub); margin: 24px 0 14px; }
/* 家庭口令：服务端按 FAMILY_PASSCODE 校验，生产未配置则拒绝登录 */
.gate-pass { margin-bottom: 14px; }
.gate-pass .inp { width: 100%; }
.gate-users { display: flex; flex-direction: column; gap: 10px; }
.gate-user {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); transition: border-color .15s, background .15s;
}
.gate-user:hover { border-color: var(--primary); background: #FFFDFB; }
.gate-user:disabled { opacity: .6; cursor: wait; }
.gu-info { flex: 1; min-width: 0; }
.gu-info b { font-size: 14px; }
/* 徽章必须 inline-block（紧凑药丸）；描述文字单独撑行。
 * 注意选择器要排除 .role-badge，否则 block 会把徽章拉成通栏长条 */
.gu-info .role-badge { display: inline-block; margin-left: 6px; vertical-align: 1px; }
.gu-info span:last-child { display: block; font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.gate-note { font-size: 11px; color: var(--text-faint); margin-top: 18px; }

/* 头像（沿用原型三色渐变） */
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 15px;
}
.av-warm { background: linear-gradient(135deg, #E0632F, #C24E1F); }
.av-blue { background: linear-gradient(135deg, #5D8CA8, #3E6E8C); }
.av-green { background: linear-gradient(135deg, #6B9A5E, #4E7A43); }
.role-badge {
  display: inline-block; font-size: 10px; line-height: 1; padding: 4px 8px;
  border-radius: 999px; font-weight: 500;
}
.role-badge.admin { background: var(--primary-soft); color: var(--primary-deep); }
.role-badge.member { background: var(--green-soft); color: var(--green); }

/* ---------- 主框架 ----------
 * 注意：必须用 #admin 而非 .admin —— 角色徽章的类名就是 role-badge admin，
 * 用类选择器会让 admin 徽章误吃主布局样式（min-height:100vh 把徽章撑成巨块）。 */
#admin { display: flex; min-height: 100vh; }
.side {
  flex: none; width: 216px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.side-logo {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.side-title b { display: block; font-family: var(--font-display); font-size: 15px; letter-spacing: 2px; }
.side-title span { font-size: 10px; color: var(--text-sub); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  font-size: 13px; color: var(--text-sub);
  transition: background .15s, color .15s;
}
.side-nav-btn:hover { background: var(--surface-2); color: var(--text); }
.side-nav-btn.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.side-user {
  margin-top: auto; padding: 12px 10px 0;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.side-user .avatar { width: 34px; height: 34px; font-size: 13px; }
.su-info { flex: 1; min-width: 0; }
.su-info b { display: block; font-size: 13px; }
.su-info span { font-size: 10px; color: var(--text-sub); }
.su-logout { color: var(--text-sub); font-size: 11px; padding: 6px 8px; border-radius: var(--r-sm); }
.su-logout:hover { background: var(--danger-soft); color: var(--danger); }

/* 宽屏下整体居中：flex-grow 撑满后由 max-width 收口，剩余空间交给 auto 边距 */
.main { flex: 1; min-width: 0; width: 100%; padding: 24px 28px; max-width: 1200px; margin: 0 auto; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.panel-head h2 { font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; }
.panel-sub { font-size: 12px; color: var(--text-sub); }
.panel-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(217,88,30,.18); }
.btn-primary:hover { background: var(--primary-deep); }
.btn-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--text-sub); }
.btn-ghost:hover { border-color: var(--text-faint); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B93A2F; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-sub);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.inp {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font-size: 13px; outline: none;
  transition: border-color .15s;
}
.inp:focus { border-color: var(--primary); }
textarea.inp { height: auto; padding: 10px 12px; resize: vertical; }
.search {
  width: 220px; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 搜索框：图标 + 输入 + 确认按钮（一体化胶囊） */
.search-box {
  display: flex; align-items: center;
  width: 300px; height: 38px; padding: 0 5px 0 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:hover { border-color: var(--text-faint); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.sb-icon { flex: none; color: var(--text-faint); transition: color .15s; }
.search-box:focus-within .sb-icon { color: var(--primary); }
.sb-input {
  flex: 1; min-width: 0; height: 100%; padding: 0 10px;
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text);
}
.sb-input::placeholder { color: var(--text-faint); }
.sb-btn {
  flex: none; height: 28px; padding: 0 14px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 500;
  transition: background .15s, transform .1s;
}
.sb-btn:hover { background: var(--primary-deep); }
.sb-btn:active { transform: scale(.95); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; color: var(--text-sub);
  transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary-deep); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 菜谱卡片（网格：桌面最多 4 列，居中） ---------- */
.recipe-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.recipe-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(46,42,37,.06), 0 12px 28px rgba(46,42,37,.08); }
.rc-cover { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.rc-cover img { width: 100%; height: 100%; object-fit: cover; }
.rc-cover .cat-tag {
  position: absolute; left: 8px; top: 8px;
  backdrop-filter: blur(4px); background: rgba(255,255,255,.85);
}
.rc-body { padding: 10px 12px 12px; }
.rc-name {
  display: block; font-family: var(--font-display); font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
  font-size: 11px; color: var(--text-sub);
}
.rc-meta i { width: 2px; height: 2px; border-radius: 50%; background: var(--text-faint); }
.rc-acts {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.rc-ops { display: flex; gap: 2px; }
.cat-tag { padding: 3px 10px; border-radius: 999px; font-size: 10px; }
.cat-tag.荤菜 { background: var(--cat-meat-soft); color: var(--cat-meat); }
.cat-tag.素菜 { background: var(--cat-veg-soft); color: var(--cat-veg); }
.cat-tag.汤羹 { background: var(--cat-soup-soft); color: var(--cat-soup); }
.cat-tag.主食 { background: var(--cat-staple-soft); color: var(--cat-staple); }
.cat-tag.凉菜 { background: var(--cat-cold-soft); color: var(--cat-cold); }
.rr-add {
  display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--green); color: var(--green); font-size: 12px;
}
.rr-add:hover { background: var(--green-soft); }
.rr-add:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 「加入」弹层（今日三餐 / 未来 7 天） ---------- */
/* z-index 必须高于 .mask(60)：遮罩 DOM 在后，同层时遮罩会盖住弹层导致点不动 */
.add-to-sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px)); max-height: 82vh; overflow: auto;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(46,42,37,.18); padding: 18px 20px 20px;
  z-index: 64;
  animation: pop .18s ease-out;
}
.at-hint { font-size: 12px; color: var(--text-sub); margin: 2px 0 14px; }
.at-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.at-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
}
.at-day b { font-size: 12px; color: var(--text-sub); font-weight: 600; }
.at-day b.cur { color: var(--primary); }
.at-day > span { font-size: 10px; color: var(--text-faint); }
.at-meals { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; width: 100%; }
.at-meal {
  height: 26px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--border); color: var(--text-sub);
  background: var(--surface-2);
}
.at-meal:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.empty {
  padding: 60px 0; text-align: center; color: var(--text-faint); font-size: 13px;
}

/* 可点开详情的元素：统一指针 + 轻微反馈 */
.recipe-card { cursor: pointer; }
.recipe-card:hover .rc-name { color: var(--primary-deep); }
.meal-item[data-detail] { cursor: pointer; border-radius: var(--r-sm); }
.meal-item[data-detail]:hover { background: var(--primary-soft); }
.pd-chip[data-detail] { cursor: pointer; }
.pd-chip[data-detail]:hover { background: var(--primary-soft); }

/* ---------- 菜谱详情（只读浮层） ----------
 * z-index 必须高于 .mask(60) / .drawer(61) / .confirm(62)：
 * 详情是从卡片点开的顶层浮层，被任何遮罩盖住都会导致"点不动" */
.detail {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 66;
  width: min(720px, calc(100vw - 40px));
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(46,42,37,.22);
  animation: pop .18s ease-out;
}
.detail-hero { flex: none; position: relative; height: 208px; background: var(--surface-2); }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-close {
  position: absolute; right: 12px; top: 12px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(4px); color: var(--text);
}
.detail-close:hover { background: #fff; }
.d-main { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 8px; }
.d-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.d-title-row h3 { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.d-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12px; color: var(--text-sub);
}
.d-meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }
.d-desc { margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--text-sub); }
.d-block { margin-top: 22px; }
.d-block h4 {
  font-size: 13px; font-weight: 600; margin-bottom: 12px;
  padding-left: 10px; border-left: 3px solid var(--primary);
}
.d-block h4 em { font-style: normal; font-weight: 400; color: var(--text-faint); }
.ing-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.ing-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.ing-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ing-amount { flex: none; font-size: 12px; color: var(--text-sub); }
.step-list { display: flex; flex-direction: column; gap: 12px; }
.step-item { display: flex; gap: 10px; font-size: 13px; line-height: 1.65; }
.step-num {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-deep); font-size: 11px;
}
.step-text { min-width: 0; }
.d-none { padding: 6px 0; font-size: 12px; color: var(--text-faint); }
.detail-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--border); background: var(--bg);
}
.detail-spacer { flex: 1; }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 今日菜单 ---------- */
.today-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.meal-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-card);
}
.meal-col h4 { font-size: 13px; color: var(--text-sub); margin-bottom: 12px; display: flex; justify-content: space-between; }
.meal-col h4 em { font-style: normal; color: var(--primary); font-family: var(--font-display); }
.meal-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.meal-item img { width: 32px; height: 32px; border-radius: var(--r-sm); object-fit: cover; }
.meal-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-empty { padding: 24px 0; text-align: center; font-size: 12px; color: var(--text-faint); }

/* ---------- 成员表 ---------- */
.member-table { display: flex; flex-direction: column; gap: 10px; }
.member-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 16px;
}
.mr-info { flex: 1; }
.mr-info b { display: block; font-size: 14px; }
/* 成员行结构：名字（块）→ 徽章（紧凑药丸）+ 说明文字（同行内流） */
.mr-info .role-badge { display: inline-block; margin-top: 4px; }
.mr-cur { font-size: 11px; color: var(--green); }

/* ---------- 弹层：抽屉表单 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(46,42,37,.42);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: 460px; max-width: 92vw;
  background: var(--surface);
  border-radius: var(--r-xl) 0 0 var(--r-xl);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(46,42,37,.18);
  animation: drawer-in .28s cubic-bezier(.32,.72,.24,1);
}
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-family: var(--font-display); font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  flex: none; display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg);
  border-radius: 0 0 0 var(--r-xl);
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 8px; font-weight: 500; }
.field label i { color: var(--danger); font-style: normal; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.ferr { font-size: 11px; color: var(--danger); margin-top: 6px; }
.cover-tip { font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.cover-preview {
  margin-top: 10px; display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--text-sub); word-break: break-all;
}
.cover-preview img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row-line { display: flex; gap: 8px; align-items: center; }
.row-line .inp-name { flex: 1.4; }
.row-line .inp-amt { flex: 1; }
.row-del {
  flex: none; width: 34px; height: 38px; border-radius: var(--r-md);
  color: var(--text-sub); display: inline-flex; align-items: center; justify-content: center;
}
.row-del:hover { background: var(--danger-soft); color: var(--danger); }
.add-row {
  margin-top: 8px; width: 100%; height: 36px;
  border: 1px dashed var(--border); border-radius: var(--r-md);
  color: var(--text-sub); font-size: 12px;
}
.add-row:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 删除确认 ---------- */
.confirm {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 62; width: 340px;
  background: var(--surface); border-radius: var(--r-xl);
  padding: 24px; box-shadow: 0 20px 60px rgba(46,42,37,.25);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translate(-50%,-46%) scale(.96); opacity: 0; } }
.confirm h4 { font-size: 15px; margin-bottom: 8px; }
.confirm p { font-size: 13px; color: var(--text-sub); line-height: 1.6; margin-bottom: 18px; }
.confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  z-index: 70; padding: 10px 18px; border-radius: 999px;
  background: var(--text); color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.alert { background: var(--danger); }

/* ---------- 周计划 ---------- */
.week-nav { display: flex; align-items: center; gap: 10px; }
.week-label { font-size: 14px; font-weight: 600; min-width: 56px; text-align: center; }
.week-days {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.plan-day {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-card);
}
.plan-day.cur { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), var(--surface) 42%); }
.pd-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pd-head b { font-size: 14px; }
.plan-day.cur .pd-head b { color: var(--primary-deep); }
.pd-count { font-size: 12px; color: var(--text-sub); margin-left: auto; }
.pd-apply {
  font-size: 12px; color: var(--green); background: var(--green-soft);
  border-radius: 999px; padding: 4px 10px;
}
.pd-apply:hover { background: var(--green); color: #fff; }
.plan-meal-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0 2px; }
.pmr-label { flex: none; width: 34px; font-size: 12px; color: var(--text-sub); padding-top: 4px; }
.pmr-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pd-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border-radius: 999px;
  font-size: 12px; padding: 4px 6px 4px 10px;
}
.pd-chip i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  font-style: normal; font-size: 11px; color: var(--text-sub);
}
.pd-chip i:hover { background: var(--danger-soft); color: var(--danger); }
.pmr-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px dashed var(--border); color: var(--text-sub); font-size: 13px;
}
.pmr-add:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pmr-add:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 审计日志 ---------- */
.audit-table { display: flex; flex-direction: column; gap: 2px; }
.audit-row {
  display: grid; grid-template-columns: 96px 96px 96px 1fr; gap: 12px;
  align-items: baseline; padding: 10px 14px;
  background: var(--surface); border-radius: var(--r-sm); font-size: 13px;
}
.audit-row:nth-child(odd) { background: var(--surface-2); }
.ar-time { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ar-user { font-weight: 600; }
.ar-action { color: var(--primary-deep); }
.ar-detail { color: var(--text-sub); }

/* ---------- 周计划选菜弹层 ---------- */
.plan-picker {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 62; width: 380px; max-width: calc(100vw - 40px);
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: 0 20px 60px rgba(46,42,37,.25);
  padding: 18px 20px; animation: pop .18s ease-out;
}
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.picker-head h3 { font-size: 15px; }
.plan-picker .search { width: 100%; margin-bottom: 10px; }
.picker-list {
  max-height: 340px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.pick-item {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 8px 10px; border-radius: var(--r-md);
}
.pick-item:hover { background: var(--primary-soft); }
.pick-item img { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; flex: none; background: var(--surface-2); }
.pi-info b { display: block; font-size: 13px; }
.pi-info span { display: block; font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* 列数自适应：≥1040px 四列；800-1040px 三列；≤800px 两列（760 移动端再收紧间距） */
@media (max-width: 1040px) {
  .recipe-table { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .recipe-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #admin { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; }
  .side-brand { padding: 0 12px 0 0; }
  .side-nav { flex-direction: row; }
  .side-user { margin: 0 0 0 auto; border: none; padding: 0; }
  .main { padding: 16px; }
  .today-cols { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .search-box { width: 100%; }
  .week-days { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 72px 1fr; }
  .ar-action, .ar-detail { grid-column: 2; }
  .recipe-table { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .at-days { grid-template-columns: repeat(4, 1fr); }
  .detail-hero { height: 150px; }
  .d-main { padding: 16px 18px 6px; }
  .ing-list { grid-template-columns: 1fr; }
  .detail-foot { padding: 12px 18px; }
}
