/* 设计：参考 Apple 的系统界面——浅灰底、白色圆角卡片、细分隔线、系统蓝强调色、左侧边栏导航 */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #e8e8ed;
  --field: #d2d2d7;
  --accent: #0071e3;
  --accent-ink: #0066cc;
  --accent-soft: #e8f2fd;
  --warn: #b25000;
  --warn-soft: #fff4e5;
  --bad: #d70015;
  --bad-soft: #fff0f1;
  --ok: #1d8a3a;
  --ok-soft: #eaf7ee;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --side: 232px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: .01em;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 左侧边栏 */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 40;
  background: rgba(250,250,252,.92); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 14px; font-weight: 600; font-size: 16px; letter-spacing: .02em; }
.logo { display: inline-block; width: 30px; height: 30px; border-radius: 8px; object-fit: cover; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.mbar .logo { width: 26px; height: 26px; border-radius: 7px; margin-right: 8px; vertical-align: -7px; }
.side nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.side .grp { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: .06em; padding: 16px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-size: 14px; margin: 1px 0; }
.side nav a:hover { background: rgba(0,0,0,.045); text-decoration: none; }
.side nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.ico { width: 18px; height: 18px; display: inline-grid; place-items: center; flex: none; }
.ico svg, .mbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side nav a .ico { color: var(--muted); }
.side nav a.on .ico { color: var(--accent); }
.side .me { border-top: 1px solid var(--line); padding: 14px 16px 16px; display: grid; grid-template-columns: 34px 1fr; gap: 4px 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e3e3e8; color: var(--muted); display: grid; place-items: center; font-weight: 600; }
.side .who b { display: block; font-size: 13px; }
.side .who span { font-size: 12px; color: var(--muted); }
.side .links { grid-column: 1 / -1; display: flex; gap: 14px; font-size: 12px; margin-top: 6px; }
.side .links a { color: var(--muted); }
.side .links a:hover { color: var(--accent-ink); }

body.has-side main.wrap { margin-left: var(--side); max-width: none; padding: 28px 36px 64px; }
body.has-side main.wrap > * { max-width: 1240px; }
.mbar, .scrim { display: none; }

/* 窄屏：侧边栏变抽屉 */
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.12); background: #fbfbfd; }
  .nav-toggle:checked ~ .side { transform: none; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 30; }
  .mbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 50px; padding: 0 14px;
          background: rgba(250,250,252,.9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
  .mbar .brand { font-weight: 600; font-size: 16px; }
  .mbtn { margin: 0; padding: 6px; border-radius: 8px; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
  .mbtn svg { width: 22px; height: 22px; }
  body.has-side main.wrap { margin-left: 0; padding: 18px 16px 56px; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 22px; padding-bottom: 60px; }
h1 { font-size: 26px; margin: 0 0 18px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; }
.sub { color: var(--muted); font-size: 13px; }
h1 + .sub, .head + .sub { margin-top: -6px !important; }

.panel { background: var(--panel); border: 0; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .panel { margin-bottom: 0; }
.grid + .panel, .grid + form.panel, .grid + .grid { margin-top: 18px; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; } }

/* 数字卡片 */
.stat { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; display: block; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
a.stat:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.07); }
.stat .n { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 12px; background: transparent; white-space: nowrap; border-bottom-color: var(--field); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafc; }
.nowrap { white-space: nowrap; }

/* 表单 */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=file], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--field); border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=file] { padding: 7px 10px; background: #fbfbfd; }
input::file-selector-button { border: 0; background: #e8e8ed; color: var(--ink); padding: 5px 12px; border-radius: 7px; margin-right: 10px; font: inherit; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.15); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; flex-wrap: wrap; background: #e8e8ed; border-radius: 10px; padding: 3px; gap: 2px; }
.seg label { white-space: nowrap; margin: 0; padding: 6px 14px; cursor: pointer; color: var(--ink); border-radius: 8px; font-size: 14px; }
.seg input { display: none; }
.seg input:checked + span { font-weight: 600; }
.seg label:has(input:checked) { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.btn { display: inline-block; padding: 8px 16px; border-radius: 980px; border: 0; background: #e8e8ed; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.45; transition: background .15s ease; }
.btn:hover { background: #dcdce1; text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #0077ed; }
.btn.danger { color: var(--bad); background: var(--bad-soft); }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 状态与提示 */
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #f0f0f3; color: var(--muted); white-space: nowrap; }
.tag.s-待审核 { background: var(--accent-soft); color: var(--accent-ink); }
.tag.s-打回, .tag.s-开具失败 { background: var(--bad-soft); color: var(--bad); }
.tag.s-已通过 { background: var(--accent-soft); color: var(--accent); }
.tag.s-已开票, .tag.s-已交付 { background: var(--ok-soft); color: var(--ok); }
.tag.flag { background: var(--warn-soft); color: var(--warn); }
.flash { padding: 11px 16px; border-radius: 12px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.note { background: var(--warn-soft); color: #7a3b00; padding: 11px 16px; border-radius: 12px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.bad { color: var(--bad); }
.over { color: var(--bad); font-weight: 600; }

/* 申请表单 */
.steps { counter-reset: s; }
.step h2::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; margin-right: 8px; }
.picker { position: relative; }
.picker .list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; max-height: 280px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 4px; }
.picker .list div { border-radius: 8px; }
.picker .list div { padding: 8px 10px; cursor: pointer; }
.picker .list div:hover, .picker .list div.on { background: var(--accent-soft); }
.buyers { display: grid; gap: 8px; }
.buyer { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.buyer:hover { border-color: var(--accent); }
.buyer.on { border-color: var(--accent); background: var(--accent-soft); }
.buyer input { margin-top: 4px; }
.buyer .t { font-weight: 600; }
.balance { display: flex; gap: 22px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.balance div span { display: block; color: var(--muted); font-size: 12px; }
.balance b { font-size: 16px; }
.lines input.qty, .lines input.price { width: 90px; padding: 5px 8px; text-align: right; }
.lines tr.picked { background: var(--accent-soft); }
.sum-bar { position: sticky; bottom: 14px; z-index: 10; background: rgba(255,255,255,.88); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.sum-bar b { font-size: 20px; font-variant-numeric: tabular-nums; }
dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-all; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: absolute; left: -5px; top: 13px; }

.login { max-width: 380px; margin: 12vh auto; }
.login .panel { padding: 32px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters > div { min-width: 120px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips a { padding: 4px 13px; border-radius: 999px; color: var(--ink); background: #e8e8ed; font-size: 13px; }
.chips a:hover { text-decoration: none; background: #dcdce1; }
.chips a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 520px) {
  .g2 { grid-template-columns: 1fr; }
  main.wrap { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 14px; }
  .sum-bar { padding: 10px 14px; }
  .filters > div { min-width: 0; flex: 1 1 40%; }
}
.tag.s-已生成批次 { background: #f3eefc; color: #6e3fc4; }
.tag.s-红冲申请中 { background: var(--warn-soft); color: var(--warn); }
.tag.s-已红冲 { background: #eef0ee; color: var(--muted); text-decoration: line-through; }
.bar { display: inline-block; width: calc(100% - 52px); height: 6px; background: #f0f0f3; border-radius: 3px; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.chips a.on { background: var(--accent); color: #fff; }
a.tag:hover { text-decoration: none; background: #e6e6eb; }
@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 21px; }
  .grid { gap: 12px; }
  .tbl-wrap table { min-width: 620px; }
  .panel { border-radius: 12px; }
}
.smart { background: #f5f8fd; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.smart textarea { min-height: 64px; background: #fff; }
@keyframes fillflash { from { background: #e3f0ff; } to { background: #fff; } }
.flashfill { animation: fillflash 1.6s ease; border-color: var(--accent) !important; }

/* 申请表单：明细选择 */
.qtybox { display: inline-flex; gap: 6px; align-items: center; }
.lines .btn.all { padding: 3px 9px; font-size: 12px; }
.more-row td { text-align: center; padding: 14px; }
.only-m { display: none; }
@media (max-width: 700px) {
  .only-m { display: inline; }
  .chips a.only-m { display: inline-block; }
  .filters .more { display: none; }
  .filters.open .more { display: block; }
  .tbl-wrap table.lines { min-width: 0; }
  table.lines thead { display: none; }
  table.lines, table.lines tbody { display: block; }
  .lines tr[data-id] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  .lines tr[data-id] td { border: 0; padding: 0; text-align: left; white-space: normal; }
  .lines td.c-prod { grid-column: 1 / -1; order: -2; font-weight: 500; }
  .lines td.c-pref { grid-column: 1 / -1; order: -1; }
  .lines td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
  .lines td.c-qty { grid-column: span 2; }
  .lines input.qty, .lines input.price { width: 100%; text-align: left; padding: 8px 10px; font-size: 16px; }
  .qtybox { display: flex; }
  .qtybox .btn.all { padding: 8px 12px; font-size: 14px; }
  .lines tr.picked { background: var(--accent-soft); border-radius: 10px; padding: 12px 10px; }
  .sum-bar { bottom: 8px; padding: 10px 14px; }
  .sum-bar .btn { padding: 10px 18px; }
}

/* 添加到桌面提示；桌面图标打开时避开刘海 */
.a2hs { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 14px; border-left: 4px solid var(--accent); }
.a2hs-t { display: flex; justify-content: space-between; align-items: center; }
.a2hs-t button { border: 0; background: #e8e8ed; border-radius: 980px; padding: 3px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.a2hs p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .mbar { padding-top: env(safe-area-inset-top); height: calc(50px + env(safe-area-inset-top)); } }
@media (display-mode: standalone) { .side { padding-top: env(safe-area-inset-top); } }
table.perm td.c, table.perm th.c { text-align: center; width: 90px; }
table.perm input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
table.perm tr.grp-row td { background: #f5f5f7; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 12px; }
.zc-frame { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; height: calc(100vh - 150px); min-height: 480px; }
.zc-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- v0.9 返回 / 抽屉 / 底部标签栏 / 轻动效 ---------- */
.backlink { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; color: var(--accent); margin: -6px 0 10px; padding: 4px 0; }
.backlink:hover { text-decoration: none; opacity: .75; }

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.28); opacity: 0; transition: opacity .24s ease; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--bg, #f5f5f7); display: flex; flex-direction: column;
                box-shadow: -10px 0 40px rgba(0,0,0,.14); transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
               border-bottom: 1px solid var(--line); background: rgba(250,250,252,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.drawer-panel iframe { flex: 1; border: 0; width: 100%; background: transparent; }
body.embed main.wrap { padding: 16px 18px 40px; max-width: none; }
body.embed .backlink { display: none; }

.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); opacity: 0; z-index: 80;
         background: rgba(29,29,31,.9); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; transition: all .3s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.flash { transition: opacity .35s ease, height .35s ease, margin .35s ease, padding .35s ease; overflow: hidden; }
.flash.gone { opacity: 0; height: 0 !important; margin: 0; padding-top: 0; padding-bottom: 0; }

/* 页面进入：内容轻轻上浮淡入，前几个卡片依次出现（总时长 < 0.4 秒） */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
main.wrap > .head, main.wrap > .sub, main.wrap > .panel, main.wrap > .grid, main.wrap > .chips, main.wrap > form { animation: rise .38s cubic-bezier(.2,.8,.2,1) both; }
main.wrap > :nth-child(2) { animation-delay: .03s; } main.wrap > :nth-child(3) { animation-delay: .06s; }
main.wrap > :nth-child(4) { animation-delay: .09s; } main.wrap > :nth-child(5) { animation-delay: .12s; }
main.wrap > :nth-child(n+6) { animation-delay: .15s; }
.btn { transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s ease; }
.btn:active { transform: scale(.97); }

/* 同比分析 */
.up { color: var(--ok); font-weight: 500; }
.down { color: var(--bad); font-weight: 500; }
table.cmp th.c { text-align: center; border-bottom: 1px solid var(--line); }
table.cmp tr.sub td { background: #f7f7fa; font-weight: 600; }
table.cmp tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }
.stat .hint { font-size: 12px; margin-top: 4px; }
select.g { padding: 3px 6px; font-size: 13px; }
select.g.ovr { border-color: var(--accent); }

/* 手机底部标签栏 */
.tabbar { display: none; }
@media (max-width: 900px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
            background: rgba(250,250,252,.92); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar label { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); margin: 0; cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--accent); }
  body.has-side main.wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sum-bar { bottom: calc(66px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.batchbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 8px; background: #f5f5f7; border-radius: 10px; position: sticky; top: 0; z-index: 5; }
.batchbar > span:first-child { margin-right: auto; font-size: 13px; color: var(--muted); }
.own { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
tr.dirty td { background: #fffbe6; }
@media (max-width: 900px) { .batchbar { top: 50px; } }
.batchbar select, .batchbar input[type=text] { width: auto; max-width: 100%; }
details.sps summary { cursor: pointer; font-size: 13px; color: var(--accent); margin-top: 4px; }
.spsbox { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 2px 8px; max-height: 180px; overflow: auto; padding: 6px 0; min-width: 220px; }
.spsbox label { margin: 0; font-size: 13px; color: var(--ink); white-space: nowrap; }
.rolecard { background: #f5f5f7; border-radius: 12px; padding: 10px 12px; width: 170px; }
.rolecard input[type=text], .rolecard select { width: 100%; }
.rolecard.add { background: var(--accent-soft); width: 210px; }
/* 按规格选 */
.spbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sp-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-spec { background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.chip-spec em { font-style: normal; color: var(--warn); }
@media (max-width: 900px) {
  .lines-sec.sp-mode .table-part { display: none; }
  .spbar .btn.primary { width: 100%; padding: 12px; font-size: 16px; }
}
[hidden] { display: none !important; }
.bsearch { width: 100%; margin-bottom: 8px; }
/* 已开发票台账 */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal a { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.cal a:hover { text-decoration: none; filter: brightness(.96); }
.cal a b { font-size: 14px; }
.cal a.zero { background: #f0f0f3; color: var(--faint); }
.cal a.zero.we { opacity: .55; }
.cal a.zero:not(.we) { background: var(--warn-soft); color: var(--warn); }
tr.unassigned td { background: #fffbf2; }
.cal .wh { text-align: center; font-size: 11px; color: var(--faint); }
.drafts { display: flex; flex-direction: column; gap: 8px; }
.draft { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f5f5f7; }
.draft a { display: flex; flex-direction: column; color: var(--ink); }
.draft a:hover { text-decoration: none; }
.draft a b { color: var(--accent-ink); }
details.ctedit summary { display: inline; cursor: pointer; font-size: 12px; color: var(--accent); margin-left: 6px; }


/* ===================== v0.18：和工作台统一的 Apple 风格 =====================
   侧栏和页面同一个浅灰底，不分割；选中菜单浅灰胶囊；分段 / 筛选选中黑底白字；主按钮蓝色胶囊；
   卡片纯白大圆角、无阴影；标题大而粗；小卡片悬停轻轻浮起 */
:root { --radius: 18px; --shadow: none; --accent-soft: #eef4fd; }
body { letter-spacing: -.005em; }
.side { background: var(--bg); border-right: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.side .brand { padding: 26px 22px 14px; font-size: 17px; }
.logo { box-shadow: none; }
.side .grp { font-size: 12px; font-weight: 500; letter-spacing: 0; padding: 18px 10px 6px; }
.side nav a { padding: 8px 10px; border-radius: 10px; }
.side nav a:hover { background: rgba(0,0,0,.04); }
.side nav a.on { background: #e8e8ed; color: var(--ink); font-weight: 600; }
.side nav a.on .ico { color: var(--ink); }
.side nav a.towb { color: var(--accent); margin-bottom: 4px; }
.side nav a.towb .ico { color: var(--accent); }
.side .me { border-top: 0; }
.avatar { background: #e8e8ed; color: var(--ink); }
body.has-side main.wrap { padding: 40px 48px 72px; }
@media (max-width: 900px) {
  .side { background: #f5f5f7; }
  .mbar { background: rgba(245,245,247,.85); }
  body.has-side main.wrap { padding: 20px 16px 56px; }
}
h1 { font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.12; margin-bottom: 22px; }
.head { margin-bottom: 26px; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 14px; }
@media (max-width: 600px) { h1 { font-size: 28px; } h2 { font-size: 17px; } }
.panel { border-radius: var(--radius); box-shadow: none; padding: 24px 26px; }
@media (max-width: 520px) { .panel { padding: 16px; } }
.stat { border-radius: var(--radius); box-shadow: none; padding: 18px 20px; }
.stat .n { font-size: 30px; letter-spacing: -.02em; }
.stat, .panel.kpi { transition: transform .35s cubic-bezier(.22,.8,.2,1), box-shadow .35s cubic-bezier(.22,.8,.2,1); }
a.stat:hover, .grid > .stat:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 2px 6px rgba(0,0,0,.04), 0 14px 32px rgba(0,0,0,.09); }
@media (hover: none) { a.stat:hover, .grid > .stat:hover { transform: none; box-shadow: none; } }
.btn { padding: 9px 20px; font-weight: 400; }
.btn.small { padding: 5px 13px; }
.seg { border-radius: 999px; padding: 4px; }
.seg label { border-radius: 999px; padding: 6px 16px; }
.seg label:has(input:checked) { background: #1d1d1f; color: #fff; box-shadow: none; }
.chips a { padding: 6px 15px; }
.chips a.on { background: #1d1d1f; color: #fff; }
th { color: var(--faint); border-bottom-color: var(--line); }
td { border-bottom-color: #f0f0f2; }
tbody tr:hover { background: #f7f7f9; }
.bar { height: 4px; border-radius: 2px; background: #e8e8ed; }
.bar span { border-radius: 2px; }
.flash { border-radius: 14px; }
.note { border-radius: 14px; }
.a2hs { border-left: 0; }
.sum-bar { border-radius: 18px; }
.step h2::before { background: #1d1d1f; }
.buyer, .draft, .rolecard, .batchbar, .smart { border-radius: 14px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=tel], input[type=search], select, textarea { border-radius: 12px; }

/* 登录页（员工 / 客户）：居中、大标题、大输入框、黑底白字登录按钮 */
.alogin { min-height: 88vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px 0 40px; }
.alogin .logo { width: 88px; height: 88px; border-radius: 21px; }
.alogin h1 { margin: 22px 0 6px; font-size: 32px; }
.alogin .sub { margin: 0 0 28px !important; font-size: 15px; }
.alogin form { width: 360px; max-width: 100%; text-align: left; }
.alogin input[type=text], .alogin input[type=password], .alogin input[type=tel] { height: 56px; font-size: 17px; padding: 0 18px; margin-bottom: 12px; border-radius: 12px; }
.alogin .go { width: 100%; height: 56px; border: 0; border-radius: 12px; background: #000; color: #fff; font: inherit; font-size: 18px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; transition: background .2s, transform .1s; }
.alogin .go:hover { background: #2a2a2c; }
.alogin .go:active { transform: scale(.985); }
.alogin .go svg { width: 22px; height: 22px; }
.alogin .hint { display: block; text-align: center; margin-top: 16px; font-size: 13px; }
.alogin .flash { text-align: center; }
body.login-bg { background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, #f5f5f7 60%, #eeeef2 100%) fixed; }
.head form.row select, .head form.row input[type=text] { width: auto; }

/* ===================== v0.19 销售看板（和工作台主页同一套样式） ===================== */
:root { --accent-light: #d6e6fb; --st-ok: #248a3d; --st-warn: #c45f00; --st-bad: #d70015; --last: #d2d2d7; --muted2: #86868b; }
.g64 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) { .g64 { grid-template-columns: 1fr; } }
.monthbar { display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 999px; padding: 4px; }
.monthbar a { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); font-size: 18px; }
.monthbar a:hover { background: #f0f0f3; text-decoration: none; }
.monthbar select { border: 0; font-weight: 600; font-size: 15px; padding: 4px 6px; background: transparent; width: auto; box-shadow: none !important; }
.seg a { padding: 6px 16px; border-radius: 999px; color: var(--ink); font-size: 14px; position: relative; z-index: 1; transition: color .25s; }
.seg a:hover { text-decoration: none; }
.seg a.on { background: #1d1d1f; color: #fff; }
.seg.has-ind a.on { background: transparent; }
.seg-ind { position: absolute; z-index: 0; border-radius: 999px; background: #1d1d1f; pointer-events: none; }
.seg.has-ind { position: relative; }
.kpi { position: relative; }
.kpi .l { color: var(--muted); font-size: 14px; }
.kpi .n { font-size: 38px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin: 6px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .meta { font-size: 12.5px; color: var(--faint); }
.kpi .bar { display: block; width: auto; height: 4px; border-radius: 2px; background: #e8e8ed; margin: 14px 0 0; position: relative; overflow: visible; }
.kpi .bar span { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.kpi .bar i { position: absolute; top: -4px; width: 1.5px; height: 12px; background: var(--ink); opacity: .3; }
.panel.kpi, .need { transition: transform .35s cubic-bezier(.22,.8,.2,1), box-shadow .35s cubic-bezier(.22,.8,.2,1); }
.panel.kpi:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 2px 6px rgba(0,0,0,.04), 0 14px 32px rgba(0,0,0,.09); }
@media (hover: none) { .panel.kpi:hover { transform: none; box-shadow: none; } }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: 2px; background: var(--c); }
.legend .dash::before { background: none; border-top: 2px dashed var(--c); height: 0; }
.rings { display: flex; justify-content: space-around; gap: 10px; flex-wrap: wrap; text-align: center; }
.rings .rl { font-size: 13px; font-weight: 600; margin-top: 4px; }
.rings .rm { font-size: 12px; color: var(--faint); }
.rings > div { transition: transform .35s cubic-bezier(.22,.8,.2,1); }
.rings > div:hover { transform: translateY(-3px) scale(1.03); }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
tr.sub td { background: #fafafc; font-weight: 600; }
tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
th.c { text-align: center; }
/* 离任务还差 */
.need { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.need .nd-h { font-size: 15px; font-weight: 600; min-width: 110px; }
.need .nd-g { display: flex; gap: 40px; flex-wrap: wrap; flex: 1; }
.need .nd-g > div { display: flex; flex-direction: column; }
.need .nd-g b { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.need .nd-g span { font-size: 13px; color: var(--muted); margin-top: 2px; }
.need .nd-g em { font-style: normal; font-size: 13px; color: var(--accent); margin-top: 4px; font-weight: 500; }
.need .nd-d b { color: var(--muted); }
.need .nd-d em { color: var(--faint) !important; font-weight: 400 !important; }
.need.done .nd-h { color: var(--ok); }
@media (max-width: 640px) {
  .grid.g4 { gap: 12px; }
  .panel.kpi { padding: 16px 16px 18px; }
  .kpi .l { font-size: 13px; }
  .kpi .n { font-size: 27px; margin: 4px 0 2px; }
  .kpi .meta { font-size: 12px; }
  .need .nd-g { gap: 22px; }
  .need .nd-g b { font-size: 24px; }
  .grid.g4 { grid-template-columns: 1fr 1fr; }
}
/* 同页切换：旧内容淡出、新内容浮现 */
.swap-out { opacity: 0 !important; transform: translateY(4px) !important; transition: opacity .15s ease, transform .15s ease !important; pointer-events: none; }
@keyframes swapin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.swap-in { animation: swapin .34s cubic-bezier(.22,.8,.2,1) both !important; animation-delay: calc(var(--i, 0) * 40ms) !important; }
.prow .hl { opacity: 0; transition: opacity .2s; }
.prow:hover .hl { opacity: 1; }
.prow .lb { transition: font-weight .2s; }
.prow:hover .lb { font-weight: 700; }
.chart-trend .tbar { transition: opacity .2s; }
main[data-swap] .head h1 + .sub { margin-top: 8px !important; }
@media (max-width: 640px) {
  .need { flex-direction: column; align-items: stretch; gap: 14px; }
  .need .nd-g { display: grid; grid-template-columns: 1fr 1fr 0.7fr; gap: 12px; }
  .need .nd-g em { font-size: 12px; }
  .need .nd-d em { display: none; }
}

/* 原地刷新（解锁后等）：变了的块轻轻淡入，不位移 */
@keyframes calmin { from { opacity: .35; } to { opacity: 1; } }
.calm-in { animation: calmin .45s ease both; }
/* v0.25 停用的开票单位 */
tr.off td { color: #a1a1a6; }
tr.off td b { color: #86868b; }
