/* ============================================================
   配餐管理系统 · 全局样式（橙色调 · 移动端优先）
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary:#FF7A45; --primary-d:#EA6A2F; --primary-l:#FFF3ED;
  --green:#10b981; --red:#F56C6C; --blue:#3BAFDA;
  --ink:#1F2937; --muted:#909399; --line:#E4E7ED; --bg:#FAFAFA; --card:#fff;
}
html,body { font-family: system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif; background:var(--bg); color:var(--ink); }
button { cursor:pointer; font-family:inherit; }
input,select,textarea { font-family:inherit; font-size:14px; }

/* 顶栏 */
.topbar { background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50; }
.topbar-inner { max-width:1280px; margin:0 auto; padding:10px 16px; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.brand { font-size:17px; font-weight:700; color:var(--ink); }
.brand-sub { font-size:12px; color:var(--muted); font-weight:400; margin-left:6px; }
@media (max-width:640px){ .brand-sub{display:none;} }
.topbar-right { margin-left:auto; display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); }

.container { max-width:1280px; margin:16px auto 60px; padding:0 16px; }

/* ============ 入口页 ============ */
.entry { max-width:420px; margin:0 auto; text-align:center; padding:40px 16px 20px; }
.entry-icon { width:104px; height:104px; margin:0 auto 20px; background:linear-gradient(135deg,#FF7A45,#fb923c); border-radius:28px; display:flex; align-items:center; justify-content:center; font-size:52px; box-shadow:0 12px 30px rgba(255,122,69,.35); }
.entry-title { font-size:28px; font-weight:800; color:var(--ink); }
.entry-sub { font-size:13px; color:var(--muted); margin-top:8px; letter-spacing:1px; }
.entry-btns { margin-top:40px; display:flex; flex-direction:column; gap:14px; }
.entry-btn { display:flex; align-items:center; justify-content:center; gap:10px; padding:17px; border-radius:16px; font-size:17px; font-weight:700; border:0; }
.entry-btn.p { background:var(--primary); color:#fff; box-shadow:0 8px 20px rgba(255,122,69,.3); }
.entry-btn.p:hover { background:var(--primary-d); }
.entry-btn.m { background:#10b981; color:#fff; box-shadow:0 8px 20px rgba(16,185,129,.3); }
.entry-btn.m:hover { background:#059669; }
.entry-btn.w { background:#fff; color:var(--ink); border:1px solid var(--line); }
.entry-btn.w:hover { border-color:var(--primary); color:var(--primary-d); }
.entry-modules { margin-top:44px; font-size:12px; color:#d6d3d1; letter-spacing:2px; }

/* ============ 前厅（移动端风格） ============ */
.front-wrap { max-width:520px; margin:0 auto; }
.wb-head { background:linear-gradient(135deg,#FF7A45,#fb923c); border-radius:16px; padding:18px 18px 14px; color:#fff; margin-bottom:14px; }
.wb-head h2 { font-size:19px; font-weight:700; }
.wb-head p { font-size:12px; opacity:.85; margin-top:3px; }

.seg { display:flex; background:#fff; border:1px solid var(--line); border-radius:12px; padding:4px; gap:4px; }
.seg-btn { flex:1; padding:10px; border:0; border-radius:9px; background:transparent; font-size:15px; font-weight:700; color:var(--muted); }
.seg-btn.on { background:var(--primary); color:#fff; box-shadow:0 3px 10px rgba(255,122,69,.25); }

.card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; margin-bottom:14px; box-shadow:0 1px 3px rgba(0,0,0,.04); }
.card h3 { font-size:15px; margin-bottom:12px; display:flex; align-items:center; gap:8px; }
.card h3 .sub { font-size:12px; color:var(--muted); font-weight:400; }

.field { margin-bottom:12px; }
.field-label { font-size:13px; color:#6b7280; margin-bottom:6px; font-weight:600; display:flex; justify-content:space-between; align-items:center; }
.field-label .hint { font-size:11px; color:var(--muted); font-weight:400; }
.input-box { width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:12px; background:#fff; outline:none; }
.input-box:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(255,122,69,.12); }
textarea.input-box { resize:vertical; min-height:60px; }
.frow { display:flex; gap:10px; align-items:flex-end; }
.frow > div { flex:1; }

.btn { border:0; border-radius:12px; padding:10px 18px; font-size:14px; font-weight:700; background:#e5e7eb; color:var(--ink); }
.btn:hover { filter:brightness(.96); }
.btn-p { background:var(--primary); color:#fff; }
.btn-p:hover { background:var(--primary-d); }
.btn-g { background:var(--green); color:#fff; }
.btn-r { background:var(--red); color:#fff; }
.btn-b { background:var(--blue); color:#fff; }
.btn-w { background:#fff; border:1px solid var(--line); color:var(--ink); }
.btn-sm { padding:5px 11px; font-size:12px; border-radius:9px; }
.btn[disabled] { opacity:.5; cursor:not-allowed; }
.btn-block { width:100%; padding:14px; font-size:16px; }

/* 统计卡片 */
.stat-cards { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.stat-card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:12px; text-align:center; }
.stat-card .t { font-size:12px; color:var(--muted); }
.stat-card .v { font-size:24px; font-weight:800; color:var(--ink); margin-top:4px; }
.stat-card .v small { font-size:12px; color:var(--muted); font-weight:400; }

/* 底部导航 */
.bottom-nav { position:fixed; left:50%; transform:translateX(-50%); bottom:0; width:100%; max-width:520px; background:#fff; border-top:1px solid var(--line); display:flex; z-index:100; padding-bottom:env(safe-area-inset-bottom); }
.nav-item { flex:1; display:flex; flex-direction:column; align-items:center; gap:2px; padding:9px 0 8px; border:0; background:transparent; font-size:11px; color:var(--muted); }
.nav-item .ico { font-size:20px; line-height:1; display:flex; }
.nav-item .ico svg { display:block; }
.nav-item.on { color:var(--primary); font-weight:700; }
.nav-item.on .ico { transform:translateY(-1px); }

/* 通用表格 */
table { width:100%; border-collapse:collapse; font-size:13px; }
th,td { padding:8px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle; }
th { background:#f9fafb; color:var(--muted); font-weight:600; white-space:nowrap; }
tr:hover td { background:#fafaf9; }
.tbl-wrap { overflow-x:auto; }
.tac { text-align:center; }
.tright { text-align:right; }
.num { font-variant-numeric:tabular-nums; }

/* 菜品选择卡 */
.grid { display:grid; gap:12px; }
.dish-pick { border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; cursor:pointer; position:relative; transition:.15s; }
.dish-pick:hover { border-color:var(--primary); }
.dish-pick img { width:100%; height:92px; object-fit:cover; display:block; background:#f3f4f6; }
.dish-pick .nm { padding:6px 8px; font-size:12.5px; font-weight:600; line-height:1.3; }
.dish-pick .tr { padding:0 8px 8px; font-size:11px; color:var(--muted); min-height:28px; }
.dish-pick .tag { position:absolute; top:6px; left:6px; font-size:11px; background:rgba(0,0,0,.55); color:#fff; padding:2px 7px; border-radius:6px; }
.dish-pick .sel { position:absolute; top:6px; right:6px; width:22px; height:22px; border-radius:50%; background:var(--primary); color:#fff; display:none; align-items:center; justify-content:center; font-size:13px; font-weight:700; }
.dish-pick.picked { border-color:var(--primary); box-shadow:0 0 0 2px rgba(255,122,69,.18); }
.dish-pick.picked .sel { display:flex; }

/* 模态 */
.modal-mask { position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:200; display:flex; align-items:center; justify-content:center; padding:16px; }
.modal { background:#fff; border-radius:16px; padding:20px; width:100%; max-width:640px; max-height:85vh; overflow:auto; }
.modal h3 { margin-bottom:12px; font-size:16px; }
.modal-close { float:right; border:0; background:transparent; font-size:20px; color:var(--muted); }
/* 侧边操作说明按钮：平时隐藏，操作后滑出，5秒无操作自动隐藏 */
#helpBtn{position:fixed;right:0;top:46%;z-index:150;display:flex;align-items:center;gap:7px;background:var(--primary);color:#fff;border:0;border-radius:12px 0 0 12px;padding:11px 14px;font-size:13px;font-weight:600;cursor:pointer;box-shadow:-4px 4px 14px rgba(255,122,69,.35);transition:transform .35s ease,opacity .35s ease}
#helpBtn .ico{font-size:16px;line-height:1}
#helpBtn .lbl{white-space:nowrap}
#helpBtn:hover{background:var(--primary-d)}
#helpBtn.hide{transform:translateX(105%);opacity:0;pointer-events:none}
@media (max-width:560px){ #helpBtn{top:auto;bottom:96px;right:0;padding:9px 12px;border-radius:10px 0 0 10px} }
@media (max-width:560px){ .modal { padding:12px; } .modal h3 { font-size:15px; } }

/* 提示 */
.toast { position:fixed; left:50%; bottom:36px; transform:translateX(-50%); background:rgba(17,24,39,.92); color:#fff; padding:10px 18px; border-radius:10px; font-size:14px; z-index:300; display:none; max-width:90%; }
.toast.show { display:block; animation:fadeIn .2s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* 分享卡（截图区） */
.share-card { width:750px; background:#fff; padding:26px; font-family:inherit; }
.share-head { text-align:center; padding-bottom:14px; border-bottom:3px solid var(--primary); margin-bottom:16px; }
.share-head h1 { font-size:26px; color:var(--primary-d); }
.share-head .meta { color:var(--muted); font-size:14px; margin-top:4px; }
.share-dishes { display:flex; flex-wrap:wrap; gap:12px; }
.share-dish { width:150px; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; }
.share-dish img { width:100%; height:100px; object-fit:cover; display:block; }
.share-dish .nm { padding:6px 8px 2px; font-size:14px; font-weight:700; text-align:center; }
.share-dish .tr { padding:0 8px 8px; font-size:11px; color:var(--muted); text-align:center; min-height:26px; }
.share-nutri { margin-top:16px; background:var(--primary-l); border-radius:12px; padding:14px 16px; font-size:14px; line-height:1.9; }
.share-nutri b { color:var(--primary-d); }
.share-quote { margin-top:12px; font-size:15px; color:#374151; text-align:center; padding:10px; font-style:italic; }
.share-foot { margin-top:14px; text-align:right; color:var(--muted); font-size:13px; border-top:1px dashed var(--line); padding-top:10px; }

/* 统计行（菜品统计） */
.stat-row { display:grid; grid-template-columns:140px repeat(8,1fr) 90px; gap:6px; align-items:center; margin-bottom:6px; }
.stat-row input { padding:6px 8px; }
@media (max-width:900px){ .stat-row{grid-template-columns:100px repeat(4,1fr);} }

.chip { display:inline-block; padding:2px 8px; border-radius:999px; background:#f3f4f6; font-size:12px; color:var(--muted); }
.chip.warn { background:#fee2e2; color:var(--red); font-weight:600; }

.empty { text-align:center; color:var(--muted); padding:28px 0; font-size:14px; }

.ai-badge { display:inline-flex; align-items:center; gap:4px; font-size:11px; color:var(--blue); background:#eff6ff; border:1px solid #bfdbfe; border-radius:6px; padding:2px 6px; }

/* 品类下拉 */
.inv-cat-item { padding:10px 12px; cursor:pointer; display:flex; justify-content:space-between; align-items:center; }
.inv-cat-item:hover { background:var(--primary-l); }
.inv-cat-add { padding:10px 12px; cursor:pointer; color:var(--green); font-weight:700; border-top:1px dashed var(--line); }
.inv-cat-add:hover { background:#ecfdf5; }

/* 后台框架（平台版同款：宽屏侧边栏 + 窄屏横滑标签） */
.admin-shell { display:flex; align-items:flex-start; gap:16px; }
.admin-sb { width:210px; flex-shrink:0; position:sticky; top:70px; background:#fff; border:1px solid var(--line); border-radius:16px; overflow:hidden; }
.admin-sb-brand { padding:14px 16px; font-size:15px; font-weight:800; border-bottom:1px solid var(--line); background:var(--primary-l); color:var(--primary-d); }
.admin-sb-menu { padding:8px; display:flex; flex-direction:column; gap:2px; }
.admin-sb-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:9px; cursor:pointer; font-size:13.5px; color:var(--muted); }
.admin-sb-item:hover { background:#f5f5f4; }
.admin-sb-item svg { flex-shrink:0; }
.admin-sb-item.on { background:var(--primary-l); color:var(--primary-d); font-weight:700; border-right:2px solid var(--primary); }
.admin-sb-foot { border-top:1px solid var(--line); padding:10px 12px; }
.admin-sb-home { display:flex; align-items:center; gap:8px; width:100%; border:0; background:transparent; color:var(--muted); font-size:13px; padding:8px; border-radius:9px; }
.admin-sb-home:hover { background:#f5f5f4; color:var(--ink); }
.admin-main { flex:1; min-width:0; }
.admin-menu-bar { position:sticky; top:56px; z-index:30; display:flex; gap:6px; overflow-x:auto; padding:10px 12px; background:#fff; border:1px solid var(--line); border-radius:14px; margin-bottom:12px; scrollbar-width:none; }
.admin-menu-bar::-webkit-scrollbar { display:none; }
.admin-menu { padding:8px 14px; border-radius:999px; cursor:pointer; font-size:13px; color:var(--muted); background:#f3f4f6; white-space:nowrap; flex-shrink:0; display:inline-flex; align-items:center; gap:6px; }
.admin-menu:hover { background:#e5e7eb; }
.admin-menu.on { background:var(--primary); color:#fff; font-weight:600; }
@media (min-width:1024px){ .admin-menu-bar{display:none;} }
@media (max-width:1023px){ .admin-sb{display:none;} }

/* 数据看板 */
.kpi-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.kpi-card { border-radius:14px; padding:14px; }
.kpi-label { font-size:12px; color:var(--muted); }
.kpi-val { font-size:22px; font-weight:800; margin-top:4px; }
.dash-x { font-size:11px; color:var(--muted); text-align:center; margin-top:4px; }
.legend { display:flex; flex-wrap:wrap; gap:12px; font-size:12px; color:var(--muted); }
.legend i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:4px; }
.top10 { display:flex; flex-direction:column; gap:8px; }
.top10-row { display:grid; grid-template-columns:74px 1fr 72px; align-items:center; gap:8px; font-size:12px; }
.top10-name { color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.top10-bar { height:12px; background:#f3f4f6; border-radius:6px; overflow:hidden; }
.top10-bar div { height:100%; border-radius:6px; }
.top10-amt { text-align:right; color:var(--muted); font-variant-numeric:tabular-nums; }
@media (max-width:720px){ .kpi-grid{grid-template-columns:repeat(2,1fr);} .top10-row{grid-template-columns:64px 1fr 66px;} }

/* 配餐历史卡片 */
.mp-card { border:1px solid var(--line); border-radius:14px; padding:12px 14px; margin-bottom:10px; background:#fff; }
.mp-head { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.mp-head b { font-size:14px; }
.mp-dishes { font-size:13px; color:var(--ink); line-height:1.6; }
.mp-quote { margin-top:8px; font-size:12.5px; color:var(--primary-d); background:var(--primary-l); border-radius:8px; padding:8px 10px; }

/* 账户预测 */
.fund-bal { font-size:30px; font-weight:800; color:var(--primary-d); margin-top:6px; font-variant-numeric:tabular-nums; }
.settle-row { border:1px solid var(--line); border-radius:12px; padding:10px 12px; margin-bottom:8px; cursor:pointer; background:#fff; }
.settle-row:hover { border-color:var(--primary); }
.settle-m { display:flex; align-items:center; gap:8px; font-weight:700; font-size:14px; }
.settle-d { font-size:12px; color:var(--muted); margin-top:4px; }

/* 后台表格窄屏自动转卡片（需配合 JS decorateTables 注入 data-label） */
@media (max-width:560px){
  #adminBody .tbl-wrap { overflow:visible; }
  #adminBody .tbl-wrap table { display:block; width:100%; }
  #adminBody .tbl-wrap thead, #adminBody .tbl-wrap tr:first-child { display:none; }
  #adminBody .tbl-wrap tbody { display:block; }
  #adminBody .tbl-wrap tr { display:block; background:#fff; border:1px solid var(--line); border-radius:12px; padding:4px 12px; margin-bottom:10px; }
  #adminBody .tbl-wrap td { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:7px 0; border:none; border-bottom:1px dashed #f1f0ec; text-align:right; font-weight:400; }
  #adminBody .tbl-wrap td:last-child { border-bottom:none; }
  #adminBody .tbl-wrap td::before { content:attr(data-label); flex-shrink:0; font-size:12px; color:var(--muted); font-weight:400; max-width:48%; text-align:left; }
  #adminBody .tbl-wrap tr th { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 0; border:none; background:transparent; font-weight:700; text-align:right; }
  #adminBody .tbl-wrap tr th::before { content:attr(data-label); font-size:12px; color:var(--muted); font-weight:400; flex-shrink:0; max-width:48%; text-align:left; }
  #adminBody .tbl-wrap .empty { display:block; padding:22px; text-align:center; color:var(--muted); font-size:13px; }
}

.trace-item { font-size:12px; display:inline-flex; align-items:center; gap:3px; background:#f9fafb; border:1px solid var(--line); border-radius:8px; padding:4px 8px; }
.trace-item:has(input:checked) { background:var(--primary-l); border-color:var(--primary); }

/* 菜品统计卡片 */
.dish-stat-card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:12px 14px; margin-bottom:10px; }
.dsc-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.dsc-head b { font-size:15px; }
.chip.saved { background:var(--primary-l); color:var(--primary-d); font-weight:700; }
.dsc-tip { font-size:11px; color:var(--muted); margin-bottom:8px; }
.dsc-section { border-top:1px dashed var(--line); padding-top:8px; margin-top:8px; }
.dsc-sec-title { font-size:12px; font-weight:700; color:var(--muted); margin-bottom:8px; }
.dsc-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; }
.dsc-field { display:flex; align-items:center; gap:8px; }
.dsc-field .dsc-label { font-size:12px; color:var(--muted); flex:1; }
.dsc-field .input-box { width:70px; padding:7px 8px; text-align:center; font-size:15px; font-weight:700; }

.grid-2 { grid-template-columns:repeat(2,1fr); }
.grid-3 { grid-template-columns:repeat(3,1fr); }
.grid-4 { grid-template-columns:repeat(4,1fr); }
@media (max-width:900px){ .grid-3,.grid-4{grid-template-columns:repeat(2,1fr);} .grid-2{grid-template-columns:1fr;} }
@media (max-width:560px){ .grid-3,.grid-4{grid-template-columns:repeat(2,1fr);} }
