/* 思源黑体（Noto Sans SC，SIL OFL 开源可商用）：子集化，覆盖 GB2312 常用字 + 界面全部文案。
   中文标题/正文/数字统一走它；字重 400/500/700 三档。缺字自动回退到系统字体栈。
   放在最前、用 font-display:swap 保证字体没下完也能先显示系统字，不白屏。 */
@font-face {
  font-family: "Source Han Sans SC";
  src: url("/fonts/sourcehansans-sc-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Han Sans SC";
  src: url("/fonts/sourcehansans-sc-medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Han Sans SC";
  src: url("/fonts/sourcehansans-sc-bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
:root {
  --font-ui: "Source Han Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #f4f6f3;
  --card: #ffffff;
  --ink: #16211b;
  --ink-2: #3d4b43;
  --muted: #74837a;
  --line: #e4e8e2;
  --line-2: #eef1ec;
  --brand: #2f7d4f;
  --brand-dark: #256a41;
  --brand-soft: #e9f3ec;
  --amber: #b7791f;
  --amber-soft: #fdf3e2;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --blue: #2563a8;
  --blue-soft: #e9f0f9;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22, 33, 27, .06), 0 8px 24px rgba(22, 33, 27, .06);
  --shadow-sm: 0 1px 2px rgba(22, 33, 27, .08);
  /* 糖果色板（导航分组左边线 / 图标 tone）：刻意不随皮肤换色，只做点缀；
     B 皮肤深色侧栏会在 themes.css 里整体调亮一档 */
  --tone-mint: #2f9e6e;
  --tone-sky: #3b7fc4;
  --tone-blush: #d06a8b;
  --tone-apricot: #c9852b;
  --tone-lilac: #8b6fc4;
  --tone-sand: #a8905f;
  --tone-rose: #d0564a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 420px at 12% -8%, #e4f1e8 0%, rgba(228, 241, 232, 0) 60%),
    radial-gradient(700px 380px at 92% 108%, #fdf1e0 0%, rgba(253, 241, 224, 0) 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 26px; box-shadow: var(--shadow); text-align: center;
}
.login-card h1 { font-size: 20px; margin: 12px 0 4px; }
.login-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 22px; letter-spacing: .04em; }
.login-card .field { text-align: left; }
.login-err { margin-top: 12px; color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 700; margin: 0 auto;
  box-shadow: 0 6px 16px rgba(47, 125, 79, .28);
}
.brand-mark.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; margin: 0; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }

/* ---------- 框架 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 96px; flex: 0 0 96px; background: #fbfcfa; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.side-head { display: flex; gap: 10px; align-items: center; padding: 16px 16px 12px; justify-content: center; }
.side-head > div:last-child { display: none; }
.side-title { font-weight: 700; font-size: 14.5px; }
.side-sub { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.side-foot { justify-content: center; }
.side-foot .me { display: none; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }

/* ---------- 导航：图标轨道（桌面） + 抽屉（手机） ----------
   桌面侧栏收成 96px 图标轨道：每个分组一枚图标 + 下方两字标签常驻；
   hover/点击图标在右侧浮出该组项目。手机仍用原来的抽屉，分组照新 7 组排。
   颜色全走皮肤变量（skin / tone / brand 系列），换肤不受影响。 */
.nav-drawer { display: none; }
/* 桌面导航高度撑满：8 枚按钮沿整条侧栏均匀铺开，不再挤在上半截留一大片空白。
   每枚按钮用 --ico-tone 派生浅彩底 + 加深线条，图标和底色拉开；颜色仍全部来自皮肤/tone 变量。 */
.nav-rail { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: space-between; gap: 4px; padding: 2px 0 4px; }
.rail-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 80px; min-height: 58px; padding: 9px 2px 7px; border: none; border-radius: 13px;
  background: none; color: var(--ink-2); cursor: pointer; transition: background .12s, color .12s;
}
.rail-btn:hover, .rail-btn.open { background: var(--brand-soft); }
.rail-btn .ico {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  background: color-mix(in srgb, var(--ico-tone, var(--brand)) 18%, var(--skin-bar-bg, #f0f3ee));
  color: color-mix(in srgb, var(--ico-tone, var(--brand)) 82%, var(--ink));
}
.rail-btn .ico svg { width: 23px; height: 23px; display: block; stroke-width: 1.7; }
.rail-btn.tone-mint { --ico-tone: var(--tone-mint); }
.rail-btn.tone-sky { --ico-tone: var(--tone-sky); }
.rail-btn.tone-blush { --ico-tone: var(--tone-blush); }
.rail-btn.tone-apricot { --ico-tone: var(--tone-apricot); }
.rail-btn.tone-lilac { --ico-tone: var(--tone-lilac); }
.rail-btn.tone-sand { --ico-tone: var(--tone-sand); }
.rail-btn.tone-rose { --ico-tone: var(--tone-rose); }
.rail-label { font-size: 12px; line-height: 1.2; font-weight: 500; white-space: nowrap; }
.rail-btn.active { color: var(--brand-dark); }
.rail-btn.active::before {
  content: ''; position: absolute; left: -6px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 2px; background: var(--skin-side-active-bar, var(--brand));
}
.rail-hero .ico { background: var(--brand); color: #fff; }
.rail-hero.active .ico { box-shadow: 0 0 0 2px var(--brand-soft); }
.rail-dot { position: absolute; top: 7px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.nav-flyout {
  position: fixed; z-index: 80; min-width: 176px; max-width: 220px; padding: 6px;
  background: var(--skin-surface, #fff); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 40, 25, .16);
}
.flyout-title {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px 8px; margin-bottom: 3px;
  border-bottom: 1px solid var(--line-2); font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .04em;
}
.flyout-title i { width: 3px; height: 12px; border-radius: 2px; background: var(--brand); }
.flyout-title.tone-mint i { background: var(--tone-mint); }
.flyout-title.tone-sky i { background: var(--tone-sky); }
.flyout-title.tone-blush i { background: var(--tone-blush); }
.flyout-title.tone-apricot i { background: var(--tone-apricot); }
.flyout-title.tone-lilac i { background: var(--tone-lilac); }
.flyout-title.tone-sand i { background: var(--tone-sand); }
.flyout-title.tone-rose i { background: var(--tone-rose); }
.flyout-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px;
  border: none; border-radius: 8px; background: none; color: var(--ink-2);
  font-size: 13px; cursor: pointer; text-align: left;
}
.flyout-item:hover { background: var(--brand-soft); }
.flyout-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.flyout-item .ico { width: 18px; height: 18px; display: grid; place-items: center; opacity: .9; }
.flyout-item .ico svg { width: 15px; height: 15px; }
.flyout-item .badge-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; min-width: 17px; height: 17px; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; }
@media (prefers-reduced-motion: reduce) { .rail-btn { transition: none; } }
/* 分组标题：中性色小字 + 2px 糖果色左边线（tone 来自 NAV 的 group.tone） */
.nav-group {
  display: flex; align-items: center; gap: 7px;
  margin: 14px 4px 3px; padding: 0 8px; font-size: 11.5px; color: var(--muted); letter-spacing: .1em;
}
.nav-group i { flex: 0 0 2px; width: 2px; height: 12px; border-radius: 1px; background: var(--brand); }
.nav-group.tone-mint i { background: var(--tone-mint); }
.nav-group.tone-sky i { background: var(--tone-sky); }
.nav-group.tone-blush i { background: var(--tone-blush); }
.nav-group.tone-apricot i { background: var(--tone-apricot); }
.nav-group.tone-lilac i { background: var(--tone-lilac); }
.nav-group.tone-sand i { background: var(--tone-sand); }
.nav-group.tone-rose i { background: var(--tone-rose); }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); cursor: pointer; font-size: 13.5px; margin: 1px 0; border: none; background: none;
  width: 100%; text-align: left;
}
.nav-item:hover { background: #f0f3ee; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
/* 激活左线：与皮肤联动（B 深色侧栏在 themes.css 里换金色），未激活时不占视觉 */
.nav-item::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px;
  background: var(--skin-side-active-bar, var(--brand)); opacity: 0; transition: opacity .12s;
}
.nav-item.active::before { opacity: 1; }
.nav-item .ico { width: 18px; height: 18px; display: grid; place-items: center; opacity: .9; }
.nav-item .ico svg { width: 16px; height: 16px; display: block; }
.ico.tone-mint { color: var(--tone-mint); }
.ico.tone-sky { color: var(--tone-sky); }
.ico.tone-blush { color: var(--tone-blush); }
.ico.tone-apricot { color: var(--tone-apricot); }
.ico.tone-lilac { color: var(--tone-lilac); }
.ico.tone-sand { color: var(--tone-sand); }
.ico.tone-rose { color: var(--tone-rose); }
.nav-item .badge-count {
  margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px;
  min-width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center; padding: 0 5px;
}
/* 总览：侧栏顶部 hero 大按钮。主色底白字（同 .btn.primary），皮肤 B~E 的 --brand 均为深色，对比安全。 */
.nav-hero {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: calc(100% - 8px); margin: 4px 4px 12px; padding: 11px 13px;
  background: var(--brand); color: #fff; border: none; border-radius: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
  box-shadow: var(--shadow-sm); transition: filter .14s, transform .14s;
}
.nav-hero:hover { filter: brightness(1.08); }
.nav-hero:active { transform: translateY(1px); }
.nav-hero:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-hero.active { box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), var(--shadow-sm); }
.nav-hero .ico { width: 22px; height: 22px; flex: 0 0 22px; background: rgba(255,255,255,.18); border-radius: 7px; }
.nav-hero .ico svg { width: 16px; height: 16px; }
.nav-hero .ico.tone-mint { color: #fff; }
.nav-hero-label { flex: 1; }
.nav-hero .badge-count { background: #fff; color: var(--brand); }
@media (prefers-reduced-motion: reduce) { .nav-hero { transition: none; } .nav-hero:active { transform: none; } }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.me { font-size: 12.5px; color: var(--ink-2); flex: 1; min-width: 0; }
.me b { display: block; font-size: 13px; }
.me span { color: var(--muted); font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 20px;
  background: rgba(244, 246, 243, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 19px; letter-spacing: 0; }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.pill { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
/* 顶栏铃铛：跳提醒中心，徽标数与侧栏「提醒中心」同源；无权限时 JS 整个收起 */
.top-bell {
  position: relative; width: 34px; height: 34px; border: 1px solid var(--line);
  border-radius: var(--skin-r-btn, 9px); background: var(--skin-surface, #fff);
  color: var(--ink-2); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.top-bell:hover { background: var(--skin-surface-hover, #f7f9f6); color: var(--ink); }
.top-bell svg { width: 17px; height: 17px; display: block; }
.bell-cnt {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 10.5px; line-height: 16px; text-align: center; font-weight: 600;
}
.top-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-size: 13px; font-weight: 600; overflow: hidden;
}
.icon-btn {
  display: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 16px; line-height: 1;
}
.view { padding: 18px 20px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }
/* 页面切换淡入（一次性，非循环）：JS 只在路由变化时重放 view-in 类 */
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view.view-in { animation: viewIn .16s ease; }
@media (prefers-reduced-motion: reduce) { .view.view-in { animation: none; } }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 15.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* grid 内卡片的间距交给 gap，别再吃 .card + .card 的上下 margin（否则并排卡片顶部错开 14px） */
.grid > .card { margin-top: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 7px 13px; border-radius: 9px; cursor: pointer; font-size: 13px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f7f9f6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #f0cfcc; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f0f3ee; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 页内分页切换（如发货的「待发货 / 发货记录」）
   这套组件之前只有 HTML 类名没有样式，按钮落到浏览器默认外观，跟全站按钮不搭。
   这里按 .btn.sm 的规格补齐，选中态沿用主色实心，保证视觉统一。 */
.tabs { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 4px 9px; font-size: 12.5px; border-radius: 7px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.tab:hover { background: #f7f9f6; }
.tab:active { transform: translateY(1px); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab.active:hover { background: var(--brand-dark); }

/* 表格行尾的操作按钮组：统一外观与间距，
   不再依赖 HTML 里的空格撑开距离（原来按钮会直接贴在一起） */
.rowact { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

/* 角色权限勾选：按模块分组，一行一条权限 */
.perm-groups { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fbfcfa; }
.perm-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.perm-item { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12.5px; line-height: 1.4; }
.perm-item input { flex: none; }
.perm-item span { flex: 1; }
.perm-item code { font-size: 11px; color: var(--muted); }
@media (max-width: 700px) { .perm-groups { grid-template-columns: 1fr; } }

.field { display: block; margin-bottom: 11px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 125, 79, .12);
}
.field textarea { min-height: 68px; resize: vertical; }
.field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.field.inline > span { margin: 0; }
.field.inline input { width: auto; }
.radio-group { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 4px; }
.radio-inline { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-size: 13.5px; cursor: pointer; }
.radio-inline input[type=radio] { width: auto; margin: 0; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }

/* 自定义字段块（html 类型） */
.lbl { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

/* 类别下拉 + 管理按钮：下拉占满，按钮固定在右侧 */
.cat-pick { display: flex; gap: 6px; align-items: center; }
.cat-pick select { flex: 1; min-width: 0; }
.cat-pick .btn { flex: 0 0 auto; white-space: nowrap; }

/* 类别管理弹层：一行一个选项，右侧 × 移除 */
.cat-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: 4px 10px; margin-bottom: 10px; }
.cat-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13.5px; }
.cat-row:last-child { border-bottom: none; }
.cat-row .del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.cat-row .del:hover { color: var(--danger, #c0392b); }
.cat-add { display: flex; gap: 6px; }
.cat-add input { flex: 1; min-width: 0; }

/* 查重弹层里每组的一条候选 */
.dup-row { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13.5px; cursor: pointer; }
.dup-row:last-child { border-bottom: none; }
.dup-row input { margin: 0; }

/* 整数步进器：点一次 ±1 */
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
  width: 34px; height: 36px; font-size: 17px; line-height: 1; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
}
.stepper button:first-child { border-radius: 9px 0 0 9px; }
.stepper button:last-child { border-radius: 0 9px 9px 0; }
.stepper button:hover { background: #eceff0; }
.stepper input {
  width: 64px; height: 36px; text-align: center; border-left: 0; border-right: 0;
  border-radius: 0; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 发货记录里的收货人：宠物名大字 + 主人名小字 */
.who { display: flex; flex-direction: column; line-height: 1.32; }
.who .pet { font-size: 14px; font-weight: 600; }
.who .owner { font-size: 11.5px; color: var(--muted); }

/* 快递公司下拉 + 新增 */
.courier-line { display: flex; gap: 6px; align-items: center; }
.courier-line select { flex: 1; }

/* 宠物档案块：与上方客户信息共用 .form-grid 两列，输入框同宽对齐 */
.petline { padding: 2px 0 4px; border-bottom: 1px dashed var(--line-2); }
.petline:last-of-type { border-bottom: none; }
.petline-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.petline-head .pt { font-size: 12.5px; color: var(--muted); }
.petline .radio-group { padding-top: 2px; }

/* 配方行：原料 配比 每份用量 加工要求 损耗 删除（比通用明细行多一列加工要求） */
.lines .lrow.recipeline { grid-template-columns: 1.7fr .65fr .8fr 1.25fr .6fr 26px; }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.tbl th { font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: .04em; background: #fafbf9; position: sticky; top: 0; }
table.tbl tbody tr:hover { background: #fafbf8; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.wrap { white-space: normal; min-width: 180px; }
table.tbl tfoot td { font-weight: 600; background: #fafbf9; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* 菜谱页：卡片里的表格原先紧贴上边框和左右边框，这里单独放宽 */
.cookbook .card-head { flex-wrap: wrap; row-gap: 6px; }
.cookbook > .hint { padding: 12px 4px; }
.cookbook .card-body.tight .hint { padding: 8px 14px 10px; }
.cookbook .card-body.tight table.tbl th,
.cookbook .card-body.tight table.tbl td { padding: 10px 14px; }
/* 屏幕上让首/末列与卡片标题对齐（同为 14px），不再贴边；打印时由 @media print 归零 */
.cookbook .card-body.tight table.tbl th:first-child,
.cookbook .card-body.tight table.tbl td:first-child { padding-left: 14px; }
.cookbook .card-body.tight table.tbl th:last-child,
.cookbook .card-body.tight table.tbl td:last-child { padding-right: 14px; }
.cookbook .cook-batch { padding: 16px 14px; border-bottom: 1px solid var(--line); }
.cookbook .cook-batch:last-child { border-bottom: 0; padding-bottom: 2px; }

/* 下拉旁边直接补一条：新建供应商这类当场要加名字的场景 */
.inline-add { display: flex; gap: 6px; align-items: center; }
.inline-add select { flex: 1; min-width: 0; }
.inline-add .btn { flex: 0 0 auto; padding: 6px 10px; }

/* 菜谱勾选表：产量输入框右对齐、数字等宽 */
.cookbook .qty-in { text-align: right; font-variant-numeric: tabular-nums; }
.cookbook input.ck { width: 15px; height: 15px; cursor: pointer; }
.cookbook input.ck:disabled { cursor: not-allowed; opacity: .45; }

/* 打印区：屏幕上按 A4 一页页显示（所见即所得），打印时一个 .print-page 占一张纸 */
.cookbook-print { margin-top: 18px; }
.print-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.print-head h2 { margin: 0; font-size: 17px; }
.cook-card { break-inside: avoid; page-break-inside: avoid; }
.steps { margin-top: 10px; padding: 10px 0 2px; border-top: 1px solid var(--line-2); }
.steps .lbl { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; margin-bottom: 4px; }
.steps-body { font-size: 13px; line-height: 1.85; }

/* 一张纸 = 一个 .print-page：横向 A4（297×210mm），屏幕上按纸的比例画出来，打印时强制换页 */
.print-page {
  position: relative;
  width: 277mm;
  max-width: 100%;
  min-height: 190mm;
  margin: 0 auto 16px;
  background: #fff;
  border: 1px dashed var(--line);
}
/* 一页里几份内容并排：菜谱 3 份，备料/分餐表按栏数分栏 */
.page-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 6mm;
  align-items: start;
}
.alloc-grid { grid-template-columns: repeat(auto-fit, minmax(110mm, 1fr)); }
/* 并排后每列只有纸宽的 1/3，配比与损耗列让位给加工要求（本批需用量已含损耗） */
.cookbook-print .cook-card table.tbl th:nth-child(2),
.cookbook-print .cook-card table.tbl td:nth-child(2),
.cookbook-print .cook-card table.tbl th:nth-child(5),
.cookbook-print .cook-card table.tbl td:nth-child(5) { display: none; }
/* 窄列里标题行折行显示，别撑破列宽 */
.cookbook-print .cook-card .card-head { flex-wrap: wrap; gap: 2px 6px; }
.cookbook-print .cook-card .card-head .spacer { display: none; }

/* 分餐表：这批做出来的份数分别要给哪些宠物 */
.alloc-card { margin-bottom: 10px; }
.alloc-note { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-2); }

/* 打印：只留菜谱本身，导航/按钮/筛选条都不出纸 */
@media print {
  @page { size: A4 landscape; margin: 10mm 10mm; }
  html, body { background: #fff; }
  body * { visibility: hidden; }
  .cookbook-print, .cookbook-print * { visibility: visible; }
  .cookbook-print { position: absolute; left: 0; top: 0; width: 100%; margin: 0; }
  .no-print { display: none !important; }
  .card { border: 0; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .card-body { padding: 0; }
  table.tbl th { background: #fff !important; position: static; }
  table.tbl th, table.tbl td { border-bottom: 1px solid #999; padding: 6px 8px; white-space: normal; }
  /* 打印时卡片无边框，首/末列与批次块恢复贴边，不浪费纸张留白 */
  .cookbook .card-body.tight table.tbl th:first-child,
  .cookbook .card-body.tight table.tbl td:first-child { padding-left: 0; }
  .cookbook .card-body.tight table.tbl th:last-child,
  .cookbook .card-body.tight table.tbl td:last-child { padding-right: 0; }
  .cookbook .cook-batch { padding-left: 0; padding-right: 0; }
  .cookbook .card-body.tight .hint { padding-left: 0; padding-right: 0; }

  /* 打印档：横向纸纵向只有 190mm 可用，3 份是并排的不是叠的，所以字号能放宽 */
  .print-page { width: auto; min-height: 0; margin: 0; border: 0; break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .cookbook-print { font-size: 10pt; }
  .print-head { margin-bottom: 5px; }
  .print-head h2 { font-size: 13pt; }
  .cook-card { margin-bottom: 0; }
  .cook-card .card-head h3 { font-size: 11pt; }
  table.tbl th, table.tbl td { padding: 2px 5px; font-size: 9pt; line-height: 1.25; }
  .steps { margin-top: 4px; padding: 4px 0 2px; }
  .steps .lbl { font-size: 8.5pt; margin-bottom: 2px; }
  .steps-body { font-size: 9.5pt; line-height: 1.3; }
}

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; background: #f0f2ef; color: var(--ink-2); line-height: 1.7;
}
.tag.green { background: var(--brand-soft); color: var(--brand-dark); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.gray { background: #f1f3f0; color: var(--muted); }

/* 票据缩略图：列表里直接看到票，点开是原图（需要登录，链接不对外） */
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs .thumb,
.thumbs .thumb-wrap { position: relative; display: inline-block; }
.thumbs .thumb {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; background: #f7f8f6; display: inline-flex; align-items: center; justify-content: center;
}
.thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .thumb:hover { border-color: var(--brand); }
.thumbs .thumb-pdf { font-size: 11px; color: var(--muted); }
.thumbs .thumb-x {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; line-height: 16px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--danger);
  font-size: 12px; cursor: pointer; padding: 0;
}

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow-sm);
}
.stat .k { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: linear-gradient(160deg, #f2f9f4, #fff); border-color: #d9e9de; }

.section-title { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; }
.section-title h3 { font-size: 15.5px; }
.section-title .line { flex: 1; height: 1px; background: var(--line); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar input[type=date], .toolbar select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand); }

/* 散落输入框统一皮肤：只补视觉（边框/圆角/底色/焦点），不改尺寸与布局。
   颜色全走皮肤变量，A~E 各皮肤（含深色）自动跟随。 */
.pf-ipt, .cat-add input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.pf-ipt:focus, .cat-add input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.pf-ipt:disabled, .cat-add input:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 列表分页（主列表超过 20 条才出现） ---------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 12px 0 2px; }
.pager button {
  min-width: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--skin-surface); color: var(--ink-2); cursor: pointer; font-size: 12.5px;
}
.pager button:hover { border-color: var(--brand); color: var(--brand-dark); }
.pager button.cur { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.pager-info { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* 弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(18, 26, 21, .38); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--card); border-radius: 14px; box-shadow: 0 20px 60px rgba(15, 25, 20, .28);
  width: 100%; max-width: 520px; margin: auto 0; animation: pop .16s ease;
}
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 15px; }
.modal-head .x { margin-left: auto; border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 16px; max-height: min(72vh, 640px); overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }

.toast-root { position: fixed; right: 16px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e2b23; color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: pop .16s ease; max-width: 380px;
  white-space: pre-line;   /* 后端提示里带 \n 的（如「已被用过…改用下架」）能分行显示 */
}
.toast.err { background: #7f2318; }
.toast.ok { background: #24613f; }

/* 明细行编辑器 */
.lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lines .lrow { display: grid; grid-template-columns: 2fr .7fr .8fr .8fr 26px; gap: 6px; padding: 6px; align-items: center; border-bottom: 1px solid var(--line-2); }
.lines .lrow.head { background: #fafbf9; font-size: 11.5px; color: var(--muted); }
.lines .lrow input, .lines .lrow select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; width: 100%; outline: none; min-width: 0; }
.lines .lrow .del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.lines-foot { padding: 6px; background: #fafbf9; }

/* ---------- 可搜索下拉 combobox（原料多时用，浮层挂 body 不被裁切） ---------- */
.combo { display: block; position: relative; min-width: 0; }
.combo-input { width: 100%; }
.combo-list {
  position: fixed; z-index: 130; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; padding: 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--skin-surface); box-shadow: var(--shadow);
}
.combo-list button {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink); font-family: inherit; font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-list button:hover, .combo-list button.on { background: var(--brand-soft); color: var(--brand-dark); }
.combo-list button.empty { color: var(--muted); cursor: default; }
.line-total { font-size: 13px; color: var(--ink-2); text-align: right; padding: 2px 4px; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 16px; border-left: 2px solid var(--line); }
.timeline li:before { content: ''; position: absolute; left: -5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li.done:before { background: var(--brand); }
.timeline li.wait:before { background: #cfd6cf; }
.timeline .t { font-size: 12px; color: var(--muted); }

.bar { height: 6px; border-radius: 999px; background: #eef1ec; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }

.menu-mask { display: none; }
@media (max-width: 900px) {
  .icon-btn { display: block; }
  .sidebar {
    width: 232px; flex-basis: 232px;
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .18); height: 100vh;
  }
  .side-head { justify-content: flex-start; }
  .side-head > div:last-child { display: block; }
  .side-foot { justify-content: flex-start; }
  .side-foot .me { display: block; }
  .nav-rail { display: none; }
  .nav-drawer { display: block; }
  .nav-flyout { display: none; }
  .sidebar.open { transform: none; }
  .menu-mask { display: block; position: fixed; inset: 0; background: rgba(15, 22, 18, .35); z-index: 25; }
  .view { padding: 14px 12px 80px; }
  .topbar { padding: 10px 12px; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cookbook .grid.c2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-mask { padding: 10px 8px; }
  .lines .lrow { grid-template-columns: 1.6fr .6fr .8fr 26px; }
  .lines .lrow .col-extra { display: none; }
  /* 窄屏只保留 原料 / 配比 / 加工要求 / 删除 */
  .lines .lrow.recipeline { grid-template-columns: 1.5fr .7fr 1.3fr 26px; }
  .lines .lrow.recipeline [data-amt],
  .lines .lrow.recipeline [data-k="loss_rate"] { display: none; }
}
/* 手机窄屏：长表格改「精简卡片 + 点行展开」，避免右侧列被卡片边缘裁切。
   只在 .table-wrap.mobile-card 上生效（由 JS 按列数自动标记）；前 3 列常显，
   其余列收起，点行尾箭头展开。DOM 不变，按钮事件绑定不受影响。 */
.m-row-more { display: none; }
@media (max-width: 560px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .stat .v { font-size: 19px; }
  .table-wrap.mobile-card { overflow-x: visible; }
  .table-wrap.mobile-card table.tbl,
  .table-wrap.mobile-card tbody,
  .table-wrap.mobile-card tr { display: block; width: 100%; }
  .table-wrap.mobile-card thead { display: none; }
  .table-wrap.mobile-card tbody tr {
    border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px;
    padding: 4px 0; background: var(--card); position: relative; overflow: hidden;
  }
  .table-wrap.mobile-card tbody tr.clickable { cursor: default; }
  .table-wrap.mobile-card td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 0; padding: 7px 12px; white-space: normal; text-align: left !important;
    font-size: 13px; min-width: 0;
  }
  .table-wrap.mobile-card td[data-lbl]::before {
    content: attr(data-lbl); flex: 0 0 auto; color: var(--muted); font-size: 12px;
    font-weight: 500; letter-spacing: .02em;
  }
  .table-wrap.mobile-card td.col-hide { display: none; }
  .table-wrap.mobile-card tr.expanded td.col-hide { display: flex; }
  /* 展开箭头放首行右上角 */
  .table-wrap.mobile-card .m-row-more {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; right: 8px; top: 8px; width: 26px; height: 26px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--skin-surface);
    color: var(--muted); font-size: 14px; cursor: pointer; padding: 0; z-index: 1;
  }
  .table-wrap.mobile-card tr.expanded .m-row-more { color: var(--brand); border-color: var(--brand); }
  .table-wrap.mobile-card td:first-child { padding-right: 40px; }
  .table-wrap.mobile-card tfoot { display: none; }
}

/* ---------- 商品页「操作 ▾」折叠菜单 ----------
   表格容器 .table-wrap 有 overflow-x:auto，菜单放在 <td> 里会被裁切；
   所以菜单挂在 document.body 下，用 position:fixed 按触发按钮位置定位。
   z-index 60：高于侧栏(30)/顶栏(20)，低于弹窗(100)与提示条(200)。 */
.actmenu {
  position: fixed; z-index: 60; min-width: 138px; max-width: 220px;
  display: flex; flex-direction: column; gap: 2px; padding: 5px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(20, 40, 25, .16);
}
.actmenu-title {
  font-size: 11.5px; color: var(--muted); padding: 4px 8px 7px;
  border-bottom: 1px solid var(--line-2); margin-bottom: 3px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.actmenu-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 7px 9px; border: 0; border-radius: 7px; background: #fff;
  color: var(--ink-2, #33453a); font-size: 13px; font-family: inherit;
  white-space: nowrap;
}
.actmenu-item:hover { background: var(--brand-soft); color: var(--brand-dark); }
.actmenu-item.danger { color: var(--danger); }
.actmenu-item.danger:hover { background: var(--danger-soft); }
[data-acts].open { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

/* ---------- 订单页「分享下单码」（2026-11-09） ---------- */
.share-btn {
  border-color: #c9e2d1;
  background: linear-gradient(135deg, #f1faf4 0%, #ffffff 100%);
  color: var(--brand-dark);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(47, 125, 79, .08);
}
.share-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 3px 12px rgba(47, 125, 79, .16);
}
.share-btn .share-btn-ico { width: 16px; height: 16px; flex: 0 0 auto; }
.share-btn span { line-height: 1.2; }

.shareqr-wrap { text-align: center; padding: 2px 2px 4px; }
.shareqr-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px;
  padding: 4px 12px; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand-dark); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.shareqr-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.shareqr-card {
  display: inline-block; padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 6px 22px rgba(22, 33, 27, .10);
}
.shareqr-img { display: block; width: 220px; height: 220px; border-radius: 8px; image-rendering: pixelated; }
.shareqr-tip {
  max-width: 360px; margin: 12px auto 14px; color: var(--muted);
  font-size: 12.5px; line-height: 1.65;
}
.shareqr-link {
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: #f7faf8; border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 10px;
}
.shareqr-link-ico { flex: 0 0 auto; color: var(--brand); }
.shareqr-url {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--ink-2);
}
.shareqr-url:hover { color: var(--brand); text-decoration: underline; }
.shareqr-link .btn { flex: 0 0 auto; }
.shareqr-fallback {
  padding: 22px 16px; border: 1px dashed var(--line); border-radius: 14px; background: #fafcfb;
}
.shareqr-fallback-t { font-weight: 600; margin-bottom: 4px; }
/* ---------- 配方「补剂」栏 ----------
   与主料行同容器但独立一组；5 列：补剂 / 每份用量 / 单位 / 排序 / 删除。
   特异性高于上面的窄屏 .lines .lrow 规则，避免窄屏被压成 4 列后第 5 项溢出。 */
.supp-title { margin: 14px 0 6px; }
.lines.supp-lines .lrow.suppline,
.lines.supp-lines .lrow.suppline.head {
  grid-template-columns: 1.9fr .8fr .7fr .8fr 26px;
}
.supp-sort { display: flex; gap: 2px; justify-content: flex-start; }
.supp-sort .btn { padding: 2px 7px; line-height: 1.2; }
/* 定制方案弹窗里的补剂行：补剂 / 每份用量 / 单位 / 删除（无排序列） */
.lines.supp-lines .lrow.cpsuppline,
.lines.supp-lines .lrow.cpsuppline.head {
  grid-template-columns: 1.9fr .9fr .8fr 26px;
}
/* 菜谱打印里的补剂块：内部标示，跟着主料表一起分页 */
.supp-block { margin-top: 8px; }
.supp-block-title { font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 4px 2px; }
@media (max-width: 900px) {
  .lines.supp-lines .lrow.suppline,
  .lines.supp-lines .lrow.suppline.head {
    grid-template-columns: 1.6fr .8fr .7fr .8fr 26px;
  }
  .lines.supp-lines .lrow.cpsuppline,
  .lines.supp-lines .lrow.cpsuppline.head {
    grid-template-columns: 1.6fr .9fr .8fr 26px;
  }
}

/* ---------- 导航组折叠（点组标题收起/展开）----------
   只加在这一段，删掉即回滚；颜色全走现有变量，深色皮肤 B 不用单独适配。 */
.nav-group {
  width: calc(100% - 8px); border: none; background: none; font: inherit;
  text-align: left; cursor: pointer; border-radius: 8px;
  transition: background .12s, color .12s;
}
.nav-group:hover { background: var(--brand-soft); color: var(--brand-dark); }
.nav-group:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.nav-group-label { flex: 1; }
.nav-group-caret {
  width: 12px; height: 12px; flex: 0 0 12px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: .55; transition: transform .15s ease;
}
.nav-group.folded .nav-group-caret { transform: rotate(-90deg); }
.nav-item.in-fold { display: none; }
@media (prefers-reduced-motion: reduce) {
  .nav-group, .nav-group-caret { transition: none; }
}

/* ---------- 总览：卡片/待办可点直达 ----------
   只在 .stat-go / .todo-go 上加反馈，纯展示卡（收入/毛利）保持原样不可点。 */
.stat { position: relative; }
.stat-go { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.stat-go:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31, 41, 35, .08); }
.stat-go:focus-visible, .todo-go:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stat-arrow {
  position: absolute; top: 10px; right: 12px; font-size: 14px; color: var(--brand);
  opacity: 0; transform: translateX(-3px); transition: opacity .15s, transform .15s;
}
.stat-go:hover .stat-arrow, .stat-go:focus-visible .stat-arrow { opacity: 1; transform: none; }
.todo-go { cursor: pointer; transition: background .12s; border-radius: 8px; }
.todo-go:hover { background: var(--brand-soft); }
.todo-go > div { display: flex; align-items: center; gap: 6px; }
.todo-arrow { margin-left: auto; color: var(--brand); opacity: 0; transition: opacity .12s; white-space: nowrap; }
.todo-go:hover .todo-arrow, .todo-go:focus-visible .todo-arrow { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .stat-go, .stat-arrow, .todo-arrow, .todo-go { transition: none; }
  .stat-go:hover { transform: none; }
}

/* ---------- 总览统计卡：按业务语义分组，每组自占整行、组内平分对齐 ----------
   13 张卡拍平进 c4 会落单（第 13 张右侧空三格）。切成 4/2/3/4 四组后
   每组都是完整一行。颜色全部走现有变量，深色皮肤 B 无需单独适配。 */
.dash-group + .dash-group { margin-top: 16px; }
.dash-group-hd { display: flex; align-items: center; gap: 10px; margin: 0 0 9px; }
.dash-group-hd h3 {
  margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  color: var(--muted); white-space: nowrap;
}
.dash-group-hd .line { flex: 1; height: 1px; background: var(--line); }
@media (prefers-reduced-motion: reduce) { .dash-group-hd { transition: none; } }

/* ==========================================================================
   手机后台体验增强（R20261122-7）
   全部沿用现有 --skin-/--brand-/--tone- 变量，不改换肤逻辑、不动颜色语义。
   只在窄屏(≤560px)与刘海屏生效；桌面端与打印完全不受影响。
   ========================================================================== */

/* 1) 输入框 16px：iOS Safari 对 <16px 的输入框聚焦时会整页放大，
      收起后不还原，体验很差。窄屏统一抬到 16px。 */
@media (max-width: 560px) {
  .field input, .field select, .field textarea,
  input.pf-ipt, input[data-nf], input[type="text"], input[type="number"],
  input[type="date"], input[type="tel"], select, textarea {
    font-size: 16px;
  }
}

/* 2) 刘海屏安全区：viewport-fit=cover 已开，这里把顶部栏、抽屉、弹窗底边
      让开刘海/home 条。带 fallback，老浏览器忽略 env() 不影响原布局。 */
@supports (padding: env(safe-area-inset-bottom)) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .sidebar { padding-top: env(safe-area-inset-top, 0px); }
  .view { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* 3) 弹窗底部抽屉化：窄屏时从屏幕底部滑上来，顶部一条拖拽提示，
      保存/取消按钮吸底并让开 home 条。桌面端仍是居中的卡片。 */
@media (max-width: 560px) {
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none; width: 100%; border-radius: 18px 18px 0 0; margin: 0;
    animation: sheet-up .2s ease;
  }
  .modal::before {
    content: ''; display: block; width: 38px; height: 4px; border-radius: 999px;
    background: var(--line); margin: 9px auto 0;
  }
  .modal-head { padding-top: 10px; }
  .modal-body { max-height: 68vh; }
  .modal-foot {
    position: sticky; bottom: 0; background: var(--card);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .modal-foot .btn { min-height: 44px; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .7; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

/* 4) 登录页：按钮抬到 48px 触控友好，卡片让开刘海。 */
@media (max-width: 560px) {
  .login-wrap { padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .login-card .btn.primary.block { min-height: 48px; font-size: 16px; }
}

/* 5) 抽屉导航窄屏：宽度不超过 82vw，避免小屏被抽屉盖满；触控目标 ≥44px。 */
@media (max-width: 560px) {
  .sidebar { width: min(232px, 82vw); }
  .nav-drawer [data-nav], .nav-drawer [data-group] > button { min-height: 44px; }
  .side-foot .btn, .topbar .icon-btn { min-height: 44px; min-width: 44px; }
}

/* 6) 录单分段折叠：窄屏下把「定制/分批发货/金额」三段折成可点开的手风琴，
      客户信息与商品明细保持展开。纯展示层：只切换 .fold-open，
      不碰任何 data-* 绑定、不改 DOM 结构，由 pages-sales.js 事件委托驱动。 */
@media (max-width: 560px) {
  .fold-sec > .section-title { cursor: pointer; user-select: none; }
  .fold-sec > .section-title::after {
    content: '⌄'; float: right; color: var(--muted); font-weight: 400;
    transition: transform .15s ease;
  }
  .fold-sec.fold-open > .section-title::after { transform: rotate(180deg); }
  .fold-sec > .fold-body { display: none; }
  .fold-sec.fold-open > .fold-body { display: block; }
}
@media (prefers-reduced-motion: reduce) { .fold-sec > .section-title::after { transition: none; } }
