:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e6e8eb;
  --text: #1f2430;
  --text-sub: #6b7280;
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-tint: #fff4ec;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 4px 16px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116;
    --surface: #1b1e26;
    --border: #2d313d;
    --text: #f3f4f6;
    --text-sub: #9ca3af;
    --primary: #f97316;
    --primary-dark: #fb923c;
    --primary-tint: #2a1b0f;
    --danger: #f87171;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

html { color-scheme: light dark; }

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 属性必须始终生效，不能被下方 display 声明覆盖 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== 顶部栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  height: 44px; width: 44px;
  border-radius: 10px;
  background: #F7F3EC;          /* 品牌底色米象牙，确保 logo 米象牙背景与容器融为一体 */
  box-shadow: 0 2px 6px rgba(232, 75, 50, 0.18);
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.brand-text h1 { font-size: 17px; font-weight: 700; }
.brand-text p { font-size: 12px; color: var(--text-sub); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.api-hint { font-size: 12px; color: var(--text-sub); }
.api-hint a { color: var(--primary); text-decoration: none; }

/* ===== 布局 ===== */
.layout { display: flex; height: calc(100vh - 60px); }

/* ===== 侧栏 ===== */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kg-list { list-style: none; overflow-y: auto; padding: 0 8px; flex: 1; }
.kg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.12s;
}
.kg-item:hover { background: #f2f3f5; }
.kg-item.active { background: var(--primary-tint); }
.kg-item .dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.kg-item.active .dot { background: var(--primary); }
/* 名称 + 公众号名两行；.kg-main 占满剩余宽度并允许收缩（否则 ellipsis 不生效） */
.kg-item .kg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.kg-item .kg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.kg-item .kg-sub { font-size: 11px; color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kg-item .kg-count { font-size: 11px; color: var(--text-sub); }
.kg-item .kg-del {
  border: none; background: transparent; color: #cbd5e1; cursor: pointer;
  font-size: 14px; padding: 0 2px; visibility: hidden;
}
.kg-item:hover .kg-del { visibility: visible; }
.kg-item .kg-del:hover { color: var(--danger); }
.sidebar-foot {
  padding: 12px 16px;
  font-size: 11px;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}
.sidebar-foot code { background: #f2f3f5; padding: 1px 5px; border-radius: 4px; font-size: 10px; }

/* ===== 主内容 ===== */
.content { flex: 1; overflow-y: auto; padding: 24px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-sub);
  gap: 8px;
}
.empty-emoji { font-size: 56px; }
.empty-state h2 { font-size: 18px; color: var(--text); margin-top: 8px; }
.empty-state p { font-size: 13px; }
.empty-state .btn { margin-top: 12px; }

.kg-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
/* 名称 / 公众号胶囊 / 周次统计 —— 三者同行，放不下时整块换行（手机端常见）。
   min-width:0 + flex:1 让标题区可收缩，避免长园名把右侧按钮顶出去 */
.kg-title { flex: 1 1 auto; min-width: 0; }
.kg-title-row { display: flex; align-items: center; gap: 10px; row-gap: 8px; flex-wrap: wrap; }
.kg-title h2 { font-size: 22px; font-weight: 700; }
/* 公众号标注：品牌色「实心」胶囊 —— 表示身份（食谱来自哪个公众号），与名称同行 */
.kg-account {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-account::before { content: '📢'; font-size: 11px; }
/* 周次统计：中性「描边」胶囊 —— 表示数据量，刻意不用品牌色与公众号胶囊区分开 */
.kg-stats {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.kg-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ===== 周卡片 ===== */
.weeks { display: flex; flex-direction: column; gap: 16px; }
.week-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.week-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.week-badge {
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
}
.week-dates { color: var(--text-sub); font-size: 13px; flex: 1; }
.week-src { font-size: 12px; color: #94a3b8; }
.week-src:first-of-type { background: var(--primary-tint); color: var(--primary-dark); padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.week-head .btn { flex-shrink: 0; }
.week-head .icon-btn {
  border: none; background: transparent; cursor: pointer; color: #94a3b8;
  font-size: 13px; padding: 4px 8px; border-radius: 6px;
}
.week-head .icon-btn:hover { background: #f2f3f5; color: var(--text); }
.week-head .icon-btn.danger:hover { color: var(--danger); }

.meal-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.meal-table th, .meal-table td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.meal-table th { background: #fafbfc; color: var(--text-sub); font-weight: 600; font-size: 12px; white-space: nowrap; }
.meal-table td.col-day { white-space: nowrap; font-weight: 600; width: 96px; }
.meal-table td.col-day .date { font-size: 11px; color: var(--text-sub); font-weight: 400; display: block; }
.meal-table tr:last-child td { border-bottom: none; }
.meal-table td .meal-text { color: #374151; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #f2f3f5; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== 输入 ===== */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
textarea.input { resize: vertical; min-height: 54px; line-height: 1.6; }

/* ===== 弹窗 ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; }
.modal-close { border: none; background: transparent; font-size: 18px; cursor: pointer; color: var(--text-sub); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--border);
}

/* 抓取区 */
.fetch-box { margin-bottom: 18px; }
.fetch-row { display: flex; gap: 10px; }
.fetch-row .input { flex: 1; }
.fetch-status { margin-top: 8px; font-size: 13px; min-height: 20px; }
.fetch-status.ok { color: #059669; }
.fetch-status.err { color: var(--danger); }
.fetch-status.loading { color: var(--text-sub); }

/* 文章公众号 ↔ 幼儿园登记的公众号 不一致时的提示条 */
.account-hint {
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--primary-tint);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.7;
}
.account-hint b { color: var(--primary-dark); }
.account-hint .btn-mini { margin-left: 6px; background: var(--surface); }

/* Excel 导入提示条 */
.excel-box {
  background: var(--primary-tint);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}
.excel-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.excel-label { font-weight: 700; color: var(--primary-dark); }
.excel-file {
  background: #fff;
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 6px;
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text);
}
.excel-hint { color: var(--text-sub); font-size: 12px; }

.article-meta {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.article-meta .a-title { font-weight: 600; }
.article-meta .a-sub { color: var(--text-sub); font-size: 12px; margin-top: 2px; }

/* 图片对照 */
.images-box { margin-bottom: 16px; }
.images-label { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.images-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.img-wrap {
  position: relative; flex-shrink: 0;
  width: 200px; height: 160px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #fafbfc;
}
.img-wrap img {
  width: 100%; height: 100%; object-fit: contain; cursor: zoom-in;
}
.img-wrap.fallback img { display: none; }
.img-fallback {
  position: absolute; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-sub); font-size: 13px; gap: 4px; text-align: center;
  background: transparent;
}
.img-fallback small { font-size: 11px; opacity: 0.8; }
.img-wrap.fallback .img-fallback { display: flex; }

/* 表单 */
.week-form .form-row { display: flex; gap: 14px; margin-bottom: 14px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--text-sub); font-weight: 600; }
.field-note { margin-bottom: 14px; }
.table-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: auto; }
.meal-table.editing td { padding: 6px 8px; }
.meal-table.editing td textarea { width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-size: 12px; font-family: inherit; resize: vertical; min-height: 56px; background: #fafbfc; }
.meal-table.editing td textarea:focus { border-color: var(--primary); background: #fff; outline: none; }
.meal-table.editing th { padding: 8px; }
.form-tip { font-size: 12px; color: var(--text-sub); margin-top: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-count { color: var(--primary); font-weight: 600; }
.btn-mini { padding: 3px 9px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
/* 日期列：星期 + 日期 + 删除按钮（星期行可增删，不写死） */
.meal-table td.col-day { position: relative; padding-right: 24px; }
.meal-table td.col-day .wd { display: block; }
.meal-table td.col-day .day-del {
  position: absolute; top: 6px; right: 4px;
  border: none; background: transparent; cursor: pointer;
  color: #cbd5e1; font-size: 11px; line-height: 1; padding: 2px 3px; border-radius: 4px;
}
.meal-table td.col-day .day-del:hover { background: #fee2e2; color: var(--danger); }

/* ===== 灯箱 ===== */
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: rgba(255,255,255,0.15); color: #fff; border: none;
  font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.toast.err { background: var(--danger); }

/* ===== 暗色模式补色 ===== */
@media (prefers-color-scheme: dark) {
  .kg-item:hover,
  .week-head .icon-btn:hover,
  .btn-ghost:hover { background: rgba(255,255,255,0.06); }

  .week-src { color: var(--text-sub); }

  .meal-table th { background: #242834; }
  .meal-table td .meal-text { color: #d1d5db; }

  .article-meta,
  .meal-table.editing td textarea,
  .img-wrap,
  .sidebar-foot code { background: #242834; }

  .meal-table.editing td textarea:focus { background: #1b1e26; }

  .input { background: #1b1e26; }

  .modal-backdrop { background: rgba(0,0,0,0.7); }
  .modal { box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
}

/* ===== 自动更新面板 ===== */
.modal-wide { max-width: 1080px; }

.badge-dot {
  margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; display: inline-block;
}

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.switch input { display: none; }
.switch-track {
  width: 34px; height: 20px; border-radius: 10px; background: #cbd5e1;
  position: relative; transition: background .15s; flex-shrink: 0;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }

/* 状态条 */
.auto-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--bg); border-radius: 10px; font-size: 12px; color: var(--text-sub);
}
.status-item b { color: var(--text); }

/* 分区 */
.auto-sec { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.auto-sec-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.auto-sec-head h4 { font-size: 14px; font-weight: 600; }
.auto-sec-head > *:last-child:not(:first-child) { margin-left: auto; }
.auto-sec-actions { display: flex; gap: 8px; }
.auto-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.auto-field { display: flex; flex-direction: column; gap: 6px; }
.auto-label { font-size: 12px; color: var(--text-sub); }
.auto-hint { font-size: 12px; color: var(--text-sub); line-height: 1.5; }
.auto-field-row { display: flex; flex-wrap: wrap; gap: 18px; }
.auto-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.auto-inline .input-sm { width: 70px; }
.input-sm { padding: 6px 10px; font-size: 13px; }
.auto-notify { display: flex; gap: 8px; }
.auto-notify select { width: 180px; flex-shrink: 0; }
.auto-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auto-save-hint { font-size: 12px; color: var(--text-sub); }
.auto-save-hint.ok { color: #059669; }
.auto-save-hint.err { color: var(--danger); }

/* 时段选择 */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-sub);
  font-size: 12px; cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* 状态标签 */
.src-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.src-tag.ok { background: #ecfdf5; color: #047857; }
.src-tag.err { background: #fef2f2; color: #b91c1c; }
.src-tag.warn { background: #fffbeb; color: #b45309; }
.src-tag.off { background: var(--bg); color: var(--text-sub); }

/* 数据源表单 */
.src-field { display: flex; flex-direction: column; gap: 5px; }
.src-field-type { max-width: 520px; }
.src-label { font-size: 12px; color: var(--text-sub); }
.src-label .req { font-style: normal; font-size: 11px; color: var(--danger); }
.src-hint { font-size: 11px; color: var(--text-sub); line-height: 1.5; }
.src-caution {
  font-size: 12px; line-height: 1.6; color: #b45309;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 12px;
}
.src-status-line { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text-sub); }
.src-error {
  font-size: 12px; color: var(--danger); background: #fef2f2;
  border-radius: 8px; padding: 8px 12px; word-break: break-all; line-height: 1.6;
}
.src-hook { display: flex; flex-direction: column; gap: 5px; }
.hook-url {
  display: block; font-size: 12px; background: var(--bg); padding: 8px 10px;
  border-radius: 8px; word-break: break-all; color: var(--text);
}
.src-test-result { font-size: 12px; white-space: pre-wrap; line-height: 1.6; color: var(--text-sub); }
.src-test-result.ok { color: #047857; }
.src-test-result.err { color: var(--danger); }

/* 运行结果 */
.auto-run-result { font-size: 13px; line-height: 1.6; }
.auto-run-result.loading { color: var(--text-sub); }
.auto-run-result.err { color: var(--danger); }
.run-head { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.run-row { border-left: 3px solid var(--border); padding: 6px 0 6px 10px; margin-bottom: 8px; }
.run-row.ok { border-left-color: #10b981; }
.run-row.err { border-left-color: var(--danger); }
.run-row.muted { border-left-color: #cbd5e1; }
.run-row-head { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.run-row-head span { color: var(--text-sub); }
.run-row-list { margin: 6px 0 0 16px; font-size: 12px; color: var(--text-sub); list-style: disc; }

/* 待确认队列 */
.count-pill {
  display: inline-block; min-width: 18px; padding: 1px 7px; border-radius: 999px;
  background: var(--primary-tint); color: var(--primary-dark); font-size: 12px; font-weight: 600;
}
.draft-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.draft-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.draft-kg { font-size: 13px; font-weight: 600; color: var(--text); }
.draft-week { color: var(--text); }
.draft-title { font-size: 13px; margin-bottom: 6px; word-break: break-all; }
.draft-title a { color: var(--primary); text-decoration: none; }
.draft-title a:hover { text-decoration: underline; }
.draft-reasons { margin: 0 0 10px 16px; font-size: 12px; color: #b45309; list-style: disc; }
.draft-actions { display: flex; gap: 8px; }

.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { background: #fef2f2; }

@media (prefers-color-scheme: dark) {
  .src-tag.ok { background: rgba(16,185,129,.15); color: #6ee7b7; }
  .src-tag.err { background: rgba(239,68,68,.15); color: #fca5a5; }
  .src-tag.warn { background: rgba(245,158,11,.15); color: #fcd34d; }
  .src-caution { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.35); color: #fcd34d; }
  .src-error { background: rgba(239,68,68,.12); }
  .src-test-result.ok,
  .auto-save-hint.ok { color: #6ee7b7; }
  .draft-reasons { color: #fcd34d; }
  .switch-track { background: #4b5563; }
  .chip { background: var(--surface); }
  .btn-ghost.danger:hover { background: rgba(239,68,68,.12); }
}

/* ===== 局域网访问提示（侧栏底部） ===== */
.lan-hint { margin-top: 8px; line-height: 1.7; }
.lan-hint code {
  display: inline-block; background: #f2f3f5; padding: 1px 6px; border-radius: 4px;
  font-size: 11px; color: var(--primary-dark); margin: 2px 0;
}
.lan-tip { opacity: .8; }
@media (prefers-color-scheme: dark) {
  .lan-hint code { background: #242834; color: #fdba74; }
}

/* ===== 访问密码弹窗 ===== */
.modal-narrow { max-width: 440px; }
.pw-note {
  font-size: 12px; line-height: 1.6; color: var(--text-sub);
  background: var(--bg); border-radius: 8px; padding: 9px 12px; margin-bottom: 14px;
}
.pw-field { margin-bottom: 12px; }
.form-error {
  background: #fef2f2; color: var(--danger);
  font-size: 13px; line-height: 1.5;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 12px;
  word-break: break-word;
}
@media (prefers-color-scheme: dark) {
  .form-error { background: rgba(239, 68, 68, .12); }
}

/* =========================================================================
   移动端适配（手机更新数据）
   设计要点：
   1) 桌面是「左侧栏 + 表格式主区」，手机改为「顶部横向切换条 + 单列卡片」
   2) 两种表格（只读展示 / 编辑录入）一律转成「每天一张卡片、餐次竖排」，
      利用 data-label 属性把表头文字变成单元格前缀
   3) 输入类控件字号 ≥16px，避免 iOS 聚焦时自动放大页面
   4) 触摸目标 ≥ 40px，弹窗全屏化，底部按钮吸底
   ========================================================================= */

/* 桌面也用 dvh（移动端地址栏收缩时 100vh 会跳） */
@supports (height: 100dvh) {
  .layout { height: calc(100dvh - 60px); }
}

@media (max-width: 768px) {
  html { -webkit-text-size-adjust: 100%; }
  body {
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
  }

  /* ---------- 顶部栏 ---------- */
  .topbar {
    height: auto;
    min-height: 52px;
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .brand { flex: 0 1 auto; min-width: 0; gap: 9px; }
  .logo { height: 36px; width: 36px; border-radius: 8px; }
  .brand-text { min-width: 0; }
  .brand-text h1 {
    font-size: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .brand-text h1 .h1-sub { display: none; }   /* 手机只留品牌名，否则顶栏必换行 */
  .brand-text p { display: none; }
  .api-hint { display: none; }
  .top-actions { flex: 0 0 auto; gap: 6px; margin-left: auto; }
  .top-actions .btn { min-height: 36px; padding: 7px 11px; font-size: 13px; }
  .top-actions .btn-txt { display: none; }   /* 顶栏窄：退出只留图标 */
  .top-actions .btn-json { display: none; }  /* 「导出 JSON」→「导出」 */
  .badge-dot { margin-left: 2px; }

  /* ---------- 布局：不再固定高度，整页滚动 ---------- */
  .layout { flex-direction: column; height: auto; }
  .content { flex: none; overflow: visible; padding: 12px 12px 40px; }

  /* ---------- 侧栏 → 顶部横向幼儿园切换条 ---------- */
  .sidebar {
    width: 100%;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-head { padding: 10px 12px 6px; }
  .sidebar-head .btn { min-height: 34px; padding: 6px 12px; }
  .kg-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    flex: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .kg-list::-webkit-scrollbar { display: none; }
  .kg-item {
    flex: 0 0 auto;
    margin-bottom: 0;
    padding: 9px 12px;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
  }
  .kg-item:hover { background: transparent; }         /* 触摸端没有 hover，避免粘住 */
  .kg-item.active { border-color: var(--primary); }
  .kg-item .kg-del { visibility: visible; padding: 0 4px; }  /* 手机无 hover，删除键常显 */
  .kg-item .kg-sub { display: none; }   /* 手机是横向胶囊条，只留一行名称 */
  .sidebar-foot { display: none; }

  /* ---------- 幼儿园标题区 ---------- */
  .empty-state { height: auto; padding: 56px 16px; text-align: center; }
  .empty-emoji { font-size: 44px; }
  .kg-header { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .kg-title h2 { font-size: 19px; }
  /* 手机宽度放不下三项：名称独占一行，两个胶囊（公众号 + 周次统计）并排第二行，
     好过让「统计」孤零零占一行 */
  .kg-title-row h2 { flex: 1 0 100%; }
  .kg-title-row { gap: 8px; row-gap: 8px; }
  .kg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .kg-actions #btnImport { flex: 1 1 100%; order: -1; justify-content: center; }
  .kg-actions #btnRenameKg,
  .kg-actions #btnImportExcel { flex: 1 1 0; justify-content: center; }

  /* ---------- 周卡片头部：三行布局 ----------
     行1 = 周次 + 来源；行2 = 日期；行3 = 编辑 / 删除（右对齐）
     ⚠️ 别改成「日期和按钮同行」：日期长度随备注变化，宽度差 1px 就会把
     「删除」挤到下一行单独一个按钮，布局会在不同周之间跳来跳去。
     用 order 重排而非改 DOM，桌面端结构不受影响。 */
  .weeks { gap: 12px; }
  .week-head { flex-wrap: wrap; padding: 12px; gap: 8px; row-gap: 6px; }
  .week-head .week-badge { order: 1; flex-shrink: 0; font-size: 12.5px; padding: 3px 10px; }
  .week-head .week-src { order: 2; flex-shrink: 0; font-size: 11.5px; }
  .week-head .week-dates {
    order: 4;
    flex: 1 1 100%;                 /* 独占一行，长度不影响按钮排布 */
    min-width: 0;
    font-size: 12px;
  }
  .week-head .icon-btn {
    order: 5;
    flex-shrink: 0;                 /* 不能被压扁，否则「🗑 删除」会被裁成「删」 */
    white-space: nowrap;
    min-height: 34px; padding: 6px 10px; font-size: 12.5px;
    border: 1px solid var(--border); border-radius: 8px;
  }
  .week-head .icon-btn[data-act="edit"] { margin-left: auto; }  /* 按钮组靠右 */

  /* ---------- 表格通用：block 化（thead 隐藏，td 带 data-label 前缀） ---------- */
  .meal-table,
  .meal-table thead,
  .meal-table tbody,
  .meal-table tr,
  .meal-table th,
  .meal-table td { display: block; width: auto; }
  .meal-table thead { display: none; }
  .meal-table { font-size: 13.5px; }

  .meal-table tr { border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .meal-table tr:last-child { border-bottom: none; }
  .meal-table td { border: none; padding: 4px 0; }
  .meal-table td.col-day {
    display: flex;
    align-items: baseline;
    gap: 8px;
    width: auto;
    padding: 0 0 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border);
  }
  .meal-table td.col-day .wd { font-size: 14.5px; font-weight: 700; }
  .meal-table td.col-day .date { display: inline; font-size: 11.5px; }
  .meal-table td .meal-text.muted { color: var(--text-sub); }
  .meal-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 1px;
  }

  /* ---------- 编辑表格：每天一张输入卡片 ---------- */
  .table-wrap { border: none; border-radius: 0; overflow: visible; }
  .meal-table.editing tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  .meal-table.editing td { padding: 0; }
  .meal-table.editing td.col-day {
    display: flex;
    position: relative;
    padding: 0 38px 8px 0;
  }
  .meal-table.editing td.col-day .wd { font-size: 14.5px; font-weight: 700; }
  .meal-table.editing td.col-day .date { display: inline; font-size: 11.5px; }
  .meal-table.editing td.col-day .day-del {
    position: absolute; top: 0; right: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface);
  }
  .meal-table.editing td[data-label] { padding: 6px 0 0; }
  .meal-table.editing td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px; font-weight: 600; color: var(--text-sub);
    margin-bottom: 4px;
  }
  .meal-table.editing td textarea {
    min-height: 64px;
    padding: 9px 11px;
    font-size: 16px;          /* <16px 时 iOS 聚焦会放大整页 */
    line-height: 1.55;
    border-radius: 8px;
    background: var(--bg);
  }

  /* ---------- 表单字段 ---------- */
  .week-form .form-row { flex-direction: column; gap: 10px; margin-bottom: 12px; }
  .field { flex: none; }
  .field-note { margin-bottom: 12px; }
  .form-tip { font-size: 12px; gap: 8px; }

  /* ---------- 表单控件：加大触摸目标 + 16px 字号 ---------- */
  .input { font-size: 16px; min-height: 44px; padding: 10px 12px; }
  .input-sm { font-size: 16px; width: 100%; }
  .btn { min-height: 42px; padding: 10px 16px; font-size: 14px; }
  .btn-sm { min-height: 38px; padding: 8px 13px; font-size: 13px; }
  .btn-mini { min-height: 34px; padding: 6px 12px; font-size: 13px; }
  .auto-inline .input-sm { width: 84px; }

  /* ---------- 抓取区 / 图片条 ---------- */
  .fetch-row { flex-direction: column; }
  .fetch-row .btn { justify-content: center; }
  .img-wrap { width: 150px; height: 122px; }
  .images-label { font-size: 11.5px; }

  /* ---------- 弹窗：全屏 ---------- */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal, .modal-wide {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .modal-head {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top));
    flex: 0 0 auto;
  }
  .modal-head h3 { font-size: 16px; }
  .modal-close {
    width: 40px; height: 40px; margin-right: -6px;
    font-size: 22px; border-radius: 10px;
  }
  .modal-body { padding: 14px; -webkit-overflow-scrolling: touch; }
  .modal-foot {
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
    flex: 0 0 auto;
  }
  .modal-foot .btn { flex: 1; justify-content: center; }

  /* ---------- 自动更新面板 ---------- */
  .auto-status { padding: 10px 12px; gap: 8px; font-size: 12px; }
  .auto-sec-head { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .auto-sec-head > *:last-child:not(:first-child) { margin-left: 0; }
  .auto-sec-actions { width: 100%; }
  .auto-sec-actions .btn { flex: 1; justify-content: center; }
  .auto-body { padding: 12px; gap: 10px; }
  .auto-field-row { flex-direction: column; gap: 10px; }
  .auto-inline { width: 100%; font-size: 13px; }
  .auto-notify { flex-direction: column; }
  .auto-notify select { width: 100%; }
  .auto-actions .btn { flex: 1 1 auto; }
  .chip { padding: 8px 14px; font-size: 13px; min-height: 36px; }
  .switch-track { width: 40px; height: 24px; border-radius: 12px; }
  .switch-track::after { width: 20px; height: 20px; }
  .switch input:checked + .switch-track::after { transform: translateX(16px); }
  .draft-card { padding: 12px; }
  .draft-head { gap: 8px; }
  .draft-actions { flex-wrap: wrap; }
  .draft-actions .btn { flex: 1 1 0; justify-content: center; }
  .hook-url { font-size: 11.5px; }
  .src-field-type { max-width: none; }
  .run-row-head { flex-direction: column; gap: 2px; }

  /* ---------- Toast ---------- */
  .toast {
    left: 12px; right: 12px;
    transform: none;
    text-align: center;
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

/* 超窄屏（iPhone SE 等）再压一档 */
@media (max-width: 380px) {
  .brand-text h1 { font-size: 13px; }
  .top-actions .btn { padding: 7px 9px; font-size: 12.5px; }
  .kg-actions #btnRenameKg,
  .kg-actions #btnImportExcel { font-size: 12.5px; padding-left: 8px; padding-right: 8px; }
}

/* ==========================================================================
   菜谱库（特色菜谱的做法详情）
   ========================================================================== */

/* ---------- 侧栏视图切换 ---------- */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px 8px;
  border-bottom: 1px solid var(--border);
}
.side-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.side-nav-btn:hover { background: #f2f3f5; }
.side-nav-btn.active {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.side-nav-ico { font-size: 15px; line-height: 1; }
.side-nav-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-sub);
}
.side-nav-btn.active .side-nav-count { background: #fff; color: var(--primary-dark); }

/* ---------- 菜谱库视图 ---------- */
.recipe-panel { padding: 4px 2px 40px; }
.rv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rv-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rv-title h2 { font-size: 20px; font-weight: 800; }
.rv-stats { font-size: 12px; color: var(--text-sub); }
.rv-actions { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 280px; }
.rv-actions .input { flex: 1; min-width: 160px; }
.rv-hint {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.7;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.rv-hint strong { color: var(--text); }

.rv-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.rv-tab {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-sub);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}
.rv-tab:hover { border-color: var(--primary); color: var(--primary-dark); }
.rv-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.rv-tab .rv-tab-n { opacity: 0.75; margin-left: 4px; }

.rv-list { display: flex; flex-direction: column; gap: 10px; }
.rv-empty {
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
  padding: 50px 16px;
  background: var(--surface);
  border-radius: 12px;
}

/* ---------- 菜谱卡片 ---------- */
.rc-card {
  display: flex;
  gap: 14px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.rc-cover {
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--primary-tint);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-cover-ph { font-size: 30px; line-height: 1; opacity: 0.55; }
.rc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rc-line1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rc-name { font-size: 15.5px; font-weight: 700; }
.rc-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.rc-badge.on { background: #dcfce7; color: #15803d; }
.rc-badge.off { background: #f1f5f9; color: #64748b; }
.rc-intro { font-size: 12.5px; color: var(--text-sub); line-height: 1.6; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.rc-chip.warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.rc-actions { display: flex; flex-direction: column; gap: 8px; justify-content: center; flex-shrink: 0; }
.rc-actions .btn { white-space: nowrap; }

/* 未建做法的菜（快捷新建） */
.rc-card.rc-quick { border-style: dashed; box-shadow: none; background: transparent; }
.rc-quick .rc-name { font-weight: 600; color: var(--text-sub); }

/* 菜单视图顶部的一行提示（点菜名加做法）*/
.menu-hint {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.7;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.menu-hint strong { color: var(--text); }
/* 提示里拿菜名芯片当图例用 → 不能有指针/悬停效果，否则像是在演示「可以点这里」 */
.menu-hint .dish-chip { cursor: default; }
.menu-hint .dish-chip:hover { background: none; }

/* 周次表格里的菜名：点一下就能新增 / 编辑这道菜的做法 */
/* padding 配负 margin：hover 底色块略微外扩，但文字位置纹丝不动 */
.dish-chip {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 3px;
  margin: 0 -3px;
  transition: background-color 0.15s, color 0.15s;
}
.dish-chip:hover { background: var(--primary-tint); }

/* 还没建做法：灰色虚线底边，暗示「这里可以补齐」 */
.dish-chip.dish-no-recipe { border-bottom: 1px dashed rgba(148, 163, 184, 0.55); }
.dish-chip.dish-no-recipe:hover { border-bottom-color: var(--primary); color: var(--primary-dark); }

/* 已有做法（已关联详情页 / 未关联草稿都算）*/
.dish-has-recipe {
  color: var(--primary-dark);
  font-weight: 600;
  border-bottom: 1px dashed currentColor;
}

/* ---------- 菜谱编辑弹窗 ---------- */
.rf-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--primary-tint);
  margin-bottom: 16px;
  cursor: pointer;
}
.rf-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.rf-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #cbd5e1;
  transition: background 0.18s;
}
.rf-switch-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s;
}
.rf-switch input:checked + .rf-switch-track { background: var(--primary); }
.rf-switch input:checked + .rf-switch-track::after { transform: translateX(20px); }
.rf-switch-text { display: flex; flex-direction: column; gap: 2px; }
.rf-switch-text b { font-size: 14px; }
.rf-switch-text small { font-size: 11.5px; color: var(--text-sub); }

/* 一键抓取：参考链接 + 抓取按钮（菜谱表单最上面一条） */
.rf-fetch {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: var(--bg);
}
.rf-fetch-row { display: flex; align-items: center; gap: 8px; }
.rf-fetch-icon { flex: 0 0 auto; font-size: 15px; }
.rf-fetch-row .input { flex: 1 1 auto; min-width: 0; }
.rf-fetch-row .btn { flex: 0 0 auto; white-space: nowrap; }
.rf-fetch-hint {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-sub);
}
.rf-fetch-hint strong { color: var(--text); font-weight: 600; }
.rf-fetch-hint.ok { color: #059669; }
.rf-fetch-hint.err { color: var(--danger); }
.rf-fetch-hint.warn { color: #b45309; }
.rf-fetch-hint.busy { color: var(--text-sub); }
.rf-fetch-hint .btn { margin-top: 7px; }
.rf-fetch-warn { color: #b45309; }
.rf-fetch-note { color: var(--text-sub); }

.rf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 6px;
}

.rf-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.rf-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.rf-block-head > span { font-size: 13px; font-weight: 700; }
.rf-block-head small { font-size: 11.5px; color: var(--text-sub); }

.rf-cover-row { display: flex; gap: 14px; align-items: flex-start; }
.rf-cover {
  position: relative;
  flex: 0 0 150px;
  width: 150px;
  height: 112px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rf-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rf-cover-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 22px;
  color: var(--text-sub);
}
.rf-cover-ph small { font-size: 11.5px; }
.rf-cover-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rf-cover-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* 封面框 / 步骤配图框：可聚焦（粘贴要有落点）、可拖入 */
.rf-cover:focus-visible, .rf-step-img:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.rf-cover.is-drop, .rf-step-img.is-drop {
  position: relative;
  border-style: solid;
  border-color: var(--primary);
  background: rgba(232, 75, 50, 0.08);
}
.rf-cover.is-drop::after, .rf-step-img.is-drop::after {
  content: '松手即上传';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2px 0;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  text-align: center;
}
.rf-upload-hint { font-size: 11.5px; color: var(--text-sub); min-height: 16px; }
.rf-upload-hint.err { color: var(--danger); }
.rf-upload-hint.ok { color: #059669; }

.rf-rows { display: flex; flex-direction: column; gap: 8px; }
.rf-row { display: flex; align-items: center; gap: 8px; }
.rf-row .input { flex: 1; min-width: 0; }
.rf-row .rf-amount { flex: 0 0 130px; }
.rf-row .rf-del {
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-sub);
  cursor: pointer;
  font-size: 14px;
}
.rf-row .rf-del:hover { color: var(--danger); border-color: var(--danger); }

.rf-steps .rf-row { align-items: flex-start; }
.rf-idx {
  flex: 0 0 26px;
  height: 26px;
  margin-top: 4px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.rf-step-main { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: flex-start; }
.rf-step-main .input { flex: 1; }
.rf-step-img {
  flex: 0 0 84px;
  width: 84px; height: 62px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
}
.rf-step-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rf-occur {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  line-height: 1.7;
}

/* =========================================================================
   订单与权益（小程序虚拟支付）
   ========================================================================= */
.order-panel { padding: 4px 2px 40px; }

/* 概览卡片 */
.ov-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.ov-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.ov-card-v { font-size: 19px; font-weight: 800; line-height: 1.2; }
.ov-card-k { font-size: 12px; color: var(--text-sub); }
.ov-card.is-ok .ov-card-v { color: #10b981; }
.ov-card.is-warn .ov-card-v { color: #d97706; }
.ov-card.is-refund .ov-card-v { color: var(--danger); }

.ov-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.ov-toolbar .input { flex: 1; min-width: 200px; max-width: 340px; }
/* 状态页签复用 .rv-tab 外观，但工具栏里不需要它自带的下边距 */
.ov-status-tabs { margin-bottom: 0; }

/* 表格：横向可滚，列都很窄不至于挤爆 */
.ov-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.ov-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ov-table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-sub);
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--bg);
}
.ov-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.ov-table tr:last-child td { border-bottom: none; }
.ov-table .num { text-align: right; white-space: nowrap; }
.ov-table code { font-size: 12px; }
.ov-sub {
  display: block; font-size: 11px; color: var(--text-sub); margin-top: 2px;
  word-break: break-all;
}
.ov-time { white-space: nowrap; }
.ov-id { max-width: 190px; }
.ov-empty { text-align: center; color: var(--text-sub); padding: 28px 0 !important; }

/* 状态标签 */
.ov-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.ov-badge.ok { background: #e7f6ee; color: #047857; }
.ov-badge.pend { background: #fef3c7; color: #b45309; }
.ov-badge.refund { background: #fee2e2; color: #b91c1c; }
.ov-badge.off { background: #eceff3; color: #64748b; }

.ov-more { margin-top: 12px; text-align: center; }

@media (prefers-color-scheme: dark) {
  .ov-badge.ok { background: rgba(16, 185, 129, .15); color: #6ee7b7; }
  .ov-badge.pend { background: rgba(245, 158, 11, .15); color: #fcd34d; }
  .ov-badge.refund { background: rgba(239, 68, 68, .15); color: #fca5a5; }
  .ov-badge.off { background: #262b36; color: #94a3b8; }
  .ov-card.is-ok .ov-card-v { color: #34d399; }
  .ov-card.is-warn .ov-card-v { color: #fbbf24; }
}

/* 深色模式：几处浅色底需要换深色 */
@media (prefers-color-scheme: dark) {
  .kg-item:hover, .side-nav-btn:hover, .btn-ghost:hover { background: #232733; }
  .side-nav-btn.active .side-nav-count { background: #2a1b0f; color: var(--primary); }
  .rc-badge.on { background: #14351f; color: #4ade80; }
  .rc-badge.off { background: #262b36; color: #94a3b8; }
  .rc-chip.warn { background: #3a2d0c; border-color: #5a4510; color: #fbbf24; }
  .rf-step-img { background: #14161c; }
  .rf-cover.is-drop, .rf-step-img.is-drop { background: #2a1b0f; }
  .rf-upload-hint.ok { color: #34d399; }
  .rf-fetch { background: #14161c; }
  .rf-fetch-hint.ok { color: #34d399; }
  .rf-fetch-hint.warn, .rf-fetch-warn { color: #fbbf24; }
}

/* 手机：侧栏切换条横排；菜谱卡片与表单竖排 */
@media (max-width: 768px) {
  .side-nav {
    flex-direction: row;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: none;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav-btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
  }
  .side-nav-txt { flex: none; }

  .rv-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .rv-actions { flex-direction: column; align-items: stretch; min-width: 0; }
  .rv-actions .btn { justify-content: center; }
  .rv-title h2 { font-size: 18px; }

  .rc-card { flex-direction: column; gap: 10px; }
  .rc-cover { flex: none; width: 100%; height: 150px; }
  .rc-actions { flex-direction: row; }
  .rc-actions .btn { flex: 1 1 0; justify-content: center; }

  .rf-grid { grid-template-columns: 1fr; }

  /* 抓取条：手机上输入框独占一行，按钮整行（触摸目标 ≥40px） */
  .rf-fetch-row { flex-wrap: wrap; }
  .rf-fetch-row .input { flex: 1 1 100%; }
  .rf-fetch-row .btn { flex: 1 1 100%; justify-content: center; min-height: 40px; }
  .rf-cover-row { flex-direction: column; }
  .rf-cover { width: 100%; height: 170px; flex: none; }
  .rf-cover-side { width: 100%; }
  .rf-cover-side .btn { width: 100%; justify-content: center; min-height: 40px; }
  /* 手机上三个按钮排两列：选择文件 / 粘贴图片，清除封面独占一行 */
  .rf-cover-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .rf-cover-btns .btn:last-child { grid-column: 1 / -1; }
  .rf-row { flex-wrap: wrap; }
  .rf-row .rf-amount { flex: 1 1 100px; }
  .rf-step-main { flex-direction: column; }
  .rf-step-img { width: 100%; height: 120px; flex: none; }
  .rf-row textarea.input { min-height: 78px; }

  /* 订单与权益：卡片两列，表格横向滚（列窄，强行铺开会看不清） */
  .ov-cards { grid-template-columns: repeat(2, 1fr); }
  .ov-toolbar { flex-direction: column; align-items: stretch; }
  .ov-toolbar .input { max-width: none; }
  .ov-table th, .ov-table td { padding: 8px 9px; }
  .ov-id { max-width: 140px; }
}


