/* 订单跟单系统样式。全部自托管，系统字体，不引用任何外部资源。 */
:root {
  --bg: #F3F4F1;
  --surface: #FFFFFF;
  --ink: #1F2A44;
  --ink-2: #4A5468;
  --muted: #7A8292;
  --line: #D9DCD6;
  --line-2: #E8EAE5;
  --accent: #3B5BA9;
  --accent-soft: #E6ECF8;
  --done: #2F7D5B;
  --crit: #C2362B;
  --crit-soft: #FBEAE8;
  --warn: #A86A12;
  --warn-soft: #FBF1DF;
  --info: #6B7280;
  --info-soft: #EEF0F2;
  --font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Noto Sans CJK SC", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: stretch; gap: 8px; padding: 0 16px; min-height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; white-space: nowrap; padding-right: 8px; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #C9D2E6; display: flex; align-items: center; padding: 0 14px; white-space: nowrap; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav a.on { color: #fff; border-bottom-color: #8FA6DB; font-weight: 600; }
.nav .badge { margin-left: 6px; }
.usermenu { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.usermenu button, .usermenu a.btn-top { background: transparent; color: #C9D2E6; border: 1px solid #3A4766; border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.usermenu button:hover, .usermenu a.btn-top:hover { color: #fff; border-color: #8FA6DB; text-decoration: none; }
.who { font-size: 13px; color: #C9D2E6; }
.who b { color: #fff; font-weight: 600; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 16px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- 按钮与表单 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2F4C93; }
.btn.danger { color: var(--crit); }
.btn.danger:hover { border-color: var(--crit); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); padding: 4px 8px; }
.btn.ghost:hover { border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly], input:disabled, select:disabled, .ro { background: var(--bg); color: var(--ink-2); border-color: var(--line-2); opacity: 1; -webkit-text-fill-color: var(--ink-2); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
label.f .lab { display: flex; justify-content: space-between; gap: 6px; }
label.f .lab em { font-style: normal; color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; max-width: 200px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel > h2 { margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

.msg { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.msg.err { background: var(--crit-soft); color: #8E2219; }
.msg.ok { background: #E4F2EA; color: #1F5A40; }
.msg.note { background: var(--info-soft); color: var(--ink-2); }
.msg ul { margin: 6px 0 0; padding-left: 20px; }

.tag { display: inline-block; font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--info-soft); color: var(--ink-2); white-space: nowrap; }
.tag.pending { background: transparent; border: 1px dashed var(--muted); color: var(--ink-2); line-height: 16px; }
.tag.crit { background: var(--crit-soft); color: var(--crit); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--crit); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }

/* ---------- 环节轨道：系统的标志元素 ---------- */
.rail { display: flex; gap: 6px; align-items: stretch; }
.rail .seg { flex: 1; min-width: 0; }
.rail .seg-name { font-size: 11px; color: var(--muted); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .notches { display: flex; gap: 2px; }
.rail .n { flex: 1; height: 8px; background: var(--line-2); }
.rail .seg .n:first-child { border-radius: 4px 0 0 4px; }
.rail .seg .n:last-child { border-radius: 0 4px 4px 0; }
.rail .n.done { background: var(--done); }
.rail .n.cur { background: var(--accent); }
.rail.big { gap: 10px; }
.rail.big .n { height: auto; min-height: 44px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--bg); color: var(--muted); font-size: 12px; line-height: 1.3; border-top: 4px solid var(--line); }
.rail.big .n b { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.rail.big .n.done { background: #EEF6F1; border-top-color: var(--done); }
.rail.big .n.done b { color: var(--done); }
.rail.big .n.cur { background: var(--accent-soft); border-top-color: var(--accent); }
.rail.big .n.cur b { color: var(--accent); }
.rail.big .seg-name { font-size: 12px; font-weight: 600; color: var(--ink-2); }

/* ---------- 首页 ---------- */
.stats { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px; }
.stat { flex: 1 1 140px; padding: 14px 18px; border-right: 1px solid var(--line-2); }
.stat:last-child { border-right: 0; }
.stat .v { font-size: 26px; font-weight: 650; line-height: 1.1; }
.stat .v.crit { color: var(--crit); }
.stat .k { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat .v.dim { font-size: 15px; font-weight: 500; color: var(--muted); padding-top: 8px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.quick a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--ink); }
.quick a:hover { border-color: var(--accent); text-decoration: none; }
.quick a b { display: block; }
.quick a span { font-size: 13px; color: var(--muted); }

/* ---------- 异常清单 ---------- */
.exc-list { list-style: none; margin: 0; padding: 0; }
.exc { display: grid; grid-template-columns: 4px 1fr auto; gap: 0 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line-2); }
.exc:first-child { border-top: 0; }
.exc .bar { align-self: stretch; border-radius: 2px; background: var(--info); }
.exc.critical .bar { background: var(--crit); }
.exc.warn .bar { background: var(--warn); }
.exc .t { font-weight: 600; }
.exc .t a { color: var(--ink); }
.exc .d { color: var(--ink-2); font-size: 14px; }
.exc .m { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.exc .ref { font-weight: 600; color: var(--accent); margin-right: 6px; }
.empty { padding: 22px 0; color: var(--muted); }

/* ---------- 订单列表 ---------- */
.stagefilter { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.stagefilter .grp { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.stagefilter .grp .gname { font-size: 12px; color: var(--muted); padding: 0 8px 0 6px; }
.stagefilter button { border: 0; background: transparent; font: inherit; font-size: 13px; padding: 4px 9px; border-radius: 5px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.stagefilter button.on { background: var(--ink); color: #fff; }
.stagefilter button .c { color: var(--muted); margin-left: 3px; font-size: 12px; }
.stagefilter button.on .c { color: #C9D2E6; }
.olist { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.ocard { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink); }
.ocard:hover { border-color: var(--accent); text-decoration: none; }
.ocard .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ocard .ref { font-size: 17px; font-weight: 650; }
.ocard .who { color: var(--ink-2); font-size: 13px; margin: 2px 0 10px; color: var(--ink-2); }
.ocard .facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.ocard .facts b { color: var(--ink); font-weight: 600; }

.ocard .cover { position: absolute; inset: 0; border-radius: 10px; }
.ocard .thumb { position: relative; z-index: 1; }
.ocard .who-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; }
.ocard .who-row .who { margin: 0; }

/* ---------- 订单编辑器 ---------- */
.ed-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.ed-head .ref { font-size: 24px; font-weight: 700; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.savebar { position: sticky; bottom: 0; z-index: 10; background: rgba(243,244,241,.96); border-top: 1px solid var(--line); padding: 10px 0; display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; }
.savebar .dirty { color: var(--warn); font-size: 13px; }
.section-note { font-size: 13px; color: var(--muted); margin: -6px 0 12px; }
.linesum { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.linesum b { color: var(--ink); font-size: 18px; margin-right: 3px; }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
th { background: #F7F8F6; color: var(--ink-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.wrap { min-width: 220px; }
table.lines td { padding: 4px 5px; vertical-align: middle; }
table.lines input { padding: 5px 6px; font-size: 13px; }
table.lines td.idx { color: var(--muted); text-align: center; width: 30px; }
table.lines tr.mismatch td { background: var(--crit-soft); }
table.lines .w-style { min-width: 96px; } table.lines .w-color { min-width: 120px; } table.lines .w-item { min-width: 260px; }
table.lines .w-num { min-width: 86px; } table.lines .w-fac { min-width: 120px; }
.add-line { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.add-line .btn { border-style: dashed; border-color: var(--accent); color: var(--accent); font-weight: 600; }

.notes { list-style: none; padding: 0; margin: 12px 0 0; }
.notes li { padding: 8px 0; border-top: 1px solid var(--line-2); }
.notes li .meta { font-size: 12px; color: var(--muted); }
.notes li .body { white-space: pre-wrap; }

/* ---------- 总表 ---------- */
table.sheet td { white-space: nowrap; }
table.sheet tr.first td { border-top: 2px solid var(--line); }
table.sheet td.item { white-space: normal; min-width: 260px; }
.cnt { display: inline-block; font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 6px; font-weight: 600; }
.sheet-wrap { max-height: 70vh; overflow: auto; }

/* ---------- 买手 ---------- */
.co { margin-bottom: 22px; }
.co-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 10px; }
.co-head h2 { font-size: 19px; }
.grp-name { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 8px; }
.bcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.bcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--ink); }
.bcard:hover { border-color: var(--accent); text-decoration: none; }
.bcard .nm { font-weight: 650; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin-top: 8px; color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; color: var(--ink); font-weight: 500; }
.kv dt { color: var(--muted); }
.dist { display: grid; gap: 10px; }
.dist .row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.dist .track { background: var(--bg); height: 14px; border-radius: 3px; overflow: hidden; }
.dist .fill { height: 100%; background: var(--accent); }
.dist .fill.s9 { background: var(--done); }
.dist .seghd { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.tl li { position: relative; padding: 6px 0 6px 10px; font-size: 14px; }
.tl li::before { content: ""; position: absolute; left: -20px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.tl li.closed::before { border-color: var(--done); background: var(--done); }
.tl .dt { font-weight: 600; margin-right: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 到货 ---------- */
.acards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.acard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.acard.unlinked { border-left: 4px solid var(--warn); }
.acard.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.acard.shipped { opacity: .65; }
.acard .h { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px 24px; display: grid; gap: 14px; }
.login .mark { display: flex; align-items: center; gap: 10px; }
.login .mark svg { width: 34px; height: 34px; }
.login .langs { text-align: right; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; padding: 0 12px; gap: 0; }
  .brand { min-height: 44px; flex: 1; }
  .usermenu { min-height: 44px; }
  .nav { order: 3; flex-basis: 100%; }
  .nav a { padding: 10px 12px; }
  .who { display: none; }
  main { padding: 16px 12px 60px; }
  .two { grid-template-columns: 1fr; }
  .olist { grid-template-columns: 1fr; }
  .stat { flex-basis: 50%; border-bottom: 1px solid var(--line-2); }
  .rail.big { flex-direction: column; gap: 8px; }
  .dist .row { grid-template-columns: 84px 1fr 32px; }
  .exc { grid-template-columns: 4px 1fr; }
  .exc .m { grid-column: 2; text-align: left; }
  .toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- v2 补充 ---------- */
.mt { margin-top: 14px; } .mt-s { margin-top: 8px; } .nomb { margin-bottom: 0; } .pad { padding: 12px; }
.inline { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.inline input[type=checkbox] { width: auto; }
.end { display: flex; align-items: flex-end; gap: 8px; }
.nowrap { white-space: nowrap; }
.ctr { text-align: center; }
.center { justify-content: center; }
.sp { flex: 1; }
h2.mt { margin: 6px 0 10px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; }
.tiny-link { display: block; font-size: 11px; margin-top: 2px; }
.tag.okc { background: #E4F2EA; color: var(--done); }
.warnc { color: var(--warn); }
.msg.warnbox { background: var(--warn-soft); color: #6B4508; }
.sumline { margin: 8px 0; font-size: 14px; color: var(--ink-2); }
table.lines tr.blocked td { background: #FAFAF7; }
tr.mismatch td { background: var(--crit-soft); }
table.lines .w-size { min-width: 110px; } table.lines .w-ratio { min-width: 90px; } table.lines .w-bd { min-width: 150px; color: var(--ink-2); }
table.lines td.imgc, table.sheet td.imgc { white-space: nowrap; }
table.mini { width: auto; min-width: 60%; margin-top: 8px; }
table.mini td, table.mini th { padding: 4px 8px; }
table.mini input { padding: 4px 6px; max-width: 110px; }
.kv.wide { grid-template-columns: max-content 1fr max-content 1fr; gap: 4px 14px; }
.kv.wide dd { text-align: left; }
.inline-f { max-width: 260px; margin-bottom: 10px; }

/* 缩略图与查看器 */
.thumb { display: inline-flex; align-items: center; justify-content: center; position: relative; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; cursor: zoom-in; vertical-align: middle; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.ph { cursor: default; font-size: 10px; color: var(--muted); background: var(--bg); text-align: center; line-height: 1.1; word-break: break-all; }
.thumb .cnt2 { position: absolute; right: 2px; bottom: 2px; background: rgba(31,42,68,.85); color: #fff; font-size: 10px; line-height: 14px; padding: 0 4px; border-radius: 7px; }
.thumb.big { width: 100%; max-width: 420px; height: auto; aspect-ratio: 1; }
.ph.big { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 420px; aspect-ratio: 1; background: var(--bg); color: var(--muted); border-radius: 8px; font-size: 20px; font-weight: 600; }
.modal { position: fixed; inset: 0; background: rgba(20,26,40,.72); z-index: 60; display: grid; place-items: center; padding: 16px; }
.viewer { background: var(--surface); border-radius: 12px; padding: 14px; max-width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.viewer.small-modal { max-width: 460px; width: 100%; }
.vimg { border: 0; padding: 0; background: var(--bg); cursor: pointer; display: block; border-radius: 8px; overflow: hidden; }
.vimg img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; }
.vbar { display: flex; align-items: center; justify-content: center; gap: 10px; }
.vpage { font-size: 13px; color: var(--ink-2); min-width: 36px; text-align: center; }
.dots { display: flex; gap: 6px; } .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .dot.on { background: var(--accent); }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slot { border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; display: grid; gap: 6px; }
.slot-img { height: 120px; display: grid; place-items: center; background: var(--bg); border-radius: 6px; }
.slot-img img { max-height: 120px; max-width: 100%; object-fit: contain; }

/* 出货 / 入库卡片 */
.ship-cards { display: grid; gap: 10px; margin-top: 12px; }
.scard { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #FCFCFA; }
.scard.editing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.scard-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.files { list-style: none; padding: 0; margin: 6px 0; } .files li { padding: 4px 0; }
.steps { padding-left: 0; list-style: none; margin: 0; display: grid; gap: 12px; }
.steps > li { border-left: 4px solid var(--line); padding: 4px 0 4px 12px; }
.steps > li.done { border-left-color: var(--done); }
ul.plain { padding-left: 18px; margin: 0; }

/* 款式库 */
.stgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.stcard { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--ink); }
.stcard:hover { border-color: var(--accent); text-decoration: none; }
.stimg { position: relative; flex: none; width: 72px; height: 72px; border-radius: 6px; overflow: hidden; background: var(--bg); display: grid; place-items: center; }
.stimg img { width: 72px; height: 72px; object-fit: cover; }
.stimg .ph { font-size: 11px; color: var(--muted); padding: 4px; text-align: center; word-break: break-all; }
.stimg .cnt2 { position: absolute; right: 3px; bottom: 3px; background: rgba(31,42,68,.85); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 7px; }
.stbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pgroup { border-top: 1px solid var(--line-2); padding: 8px 0; }
.pg-h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* 财务 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.panel.period.await { border-color: var(--warn); }
details summary { cursor: pointer; color: var(--accent); }
@media (max-width: 760px) {
  .kv.wide { grid-template-columns: max-content 1fr; }
  .slots { grid-template-columns: 1fr 1fr; }
  table.mini { min-width: 100%; }
}
.grid + .section-note, form + .section-note { margin-top: 8px; }

/* v3：待老板处理标签、大数字、出库 */
.tag.boss { background: var(--accent-soft, #e8edf8); color: var(--accent, #2f4a8a); border: 1px solid currentColor; }
.stat .v.warnv { color: var(--warn); }
.bignum { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.exc .m .tag + .tag { margin-left: 4px; }
.toolbar input[type=date][data-od] { flex: 0 0 auto; width: auto; }

/* ---- v4：三块横向表、逐行附件、变更日志、留言、款式库 ---- */
.block .scroll { max-width: 100%; }
table.wide-t td, table.wide-t th { white-space: nowrap; }
table.wide-t input, table.wide-t select { min-width: 0; }
td.w-date input { width: 9.6em; }
td.w-d { font-variant-numeric: tabular-nums; color: var(--ink-2); }
td.w-yn select { width: 5.5em; }
td.w-qc select { width: 7em; }
td.w-sc { white-space: nowrap; }
td.w-na { min-width: 16em; }
td.w-na .chk { display: flex; align-items: center; gap: 4px; margin-top: 2px; white-space: nowrap; color: var(--ink-2); }
td.w-na input[type="text"] { width: 15em; }
tr.risk td, td.riskc { background: var(--crit-soft); }
table.sheet tr.risk td { background: var(--crit-soft); }
.blocklog { margin-top: 10px; }
.blocklog summary { cursor: pointer; color: var(--ink-2); }
ul.logs { list-style: none; padding: 0; margin: 6px 0 0; max-height: 280px; overflow: auto; }
ul.logs li { padding: 4px 0; border-bottom: 1px solid var(--line, #e6e8ee); font-size: 13px; }
.stage-h { margin: 22px 0 10px; font-size: 15px; color: var(--ink-2); }
.attrow { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.attbox { flex: 1 1 260px; min-width: 0; }
.attbox h3 { font-size: 14px; margin: 0 0 6px; }
img.attthumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; vertical-align: middle; }
.tag.hot { background: #fff1e0; color: #a45200; }
.stcard.deleted { opacity: .6; }
ul.msgs { list-style: none; padding: 0; margin: 0; }
.msg-item { border-left: 4px solid var(--line, #d8dce6); padding: 8px 10px; margin: 0 0 8px; background: var(--card, #fff); border-radius: 6px; }
.msg-item.crit { border-left-color: var(--crit); background: var(--crit-soft); }
.msg-item.soon { border-left-color: var(--crit); }
.msg-item.done { opacity: .7; }
.msg-item .mb { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-item .mr { margin-top: 4px; padding: 6px 8px; background: #f3f6fb; border-radius: 6px; overflow-wrap: anywhere; }
.msg-item .toolbar input { flex: 1 1 200px; min-width: 0; }
.f.span2 { grid-column: span 2; }
.f.span2 textarea { min-height: 70px; }
@media (max-width: 640px) { .f.span2 { grid-column: auto; } }
td.w-ship select { width: 9.5em; }

/* ---- 第六版：紧凑显示、池子、导入 ---- */
/* 长表在自己的框内滚动，表头 sticky（纵向滚动在框内，横向滚动不变） */
.block .scroll, .scroll.tall, .scroll.sheet-wrap { max-height: 72vh; overflow: auto; }
.scroll th { z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
/* 三块行高收紧 */
.block table.lines td, table.lines.compact td { padding: 2px 4px; }
.block table.lines th, table.lines.compact th { padding: 5px 6px; }
.block table.lines input, .block table.lines select, table.lines.compact input, table.lines.compact select { padding: 3px 5px; font-size: 12.5px; }
.block table.lines .small { font-size: 11.5px; line-height: 1.3; }
.tag.pool { background: #EEF0FA; color: #3B4A8C; border: 1px solid #C9D0EE; }
/* 生产进度摘要：状态 · n/6 + 小圆点 + 进度条 */
td.w-ms { white-space: nowrap; }
.mssum { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; vertical-align: middle; }
.mdots { display: inline-flex; gap: 3px; }
.mdot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: inline-block; }
.mdot.on { background: var(--done); }
.mbar { width: 46px; height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; display: inline-block; }
.mbar i { display: block; height: 100%; background: var(--done); }
tr.msrow td { background: #FAFBF8; }
.msgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; padding: 4px 0; white-space: normal; }
.msgrid .f { margin: 0; }
/* 导入预览 */
.importrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
table.imp td input { min-width: 70px; width: 100%; }
table.imp th select { font-size: 12px; padding: 2px 4px; min-width: 120px; }
table.imp .hname { font-weight: 400; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
table.imp td.raw { white-space: nowrap; font-size: 12px; }
table.imp td.flags { min-width: 90px; }
table.imp td:nth-child(4) { white-space: nowrap; }
table.imp td.flags .tag + .tag { margin-left: 3px; }
table.lines tr.skiprow td { color: var(--muted); background: #F6F6F3; }
table.lines tr.flagrow td.flags { background: var(--warn-soft); }
table.lines tr.selrow td { background: #F1F4FC; }
.splitlist { margin: 6px 0 0; padding-left: 18px; font-size: 13px; max-height: 220px; overflow: auto; }
@media (max-width: 640px) { .block .scroll, .scroll.tall { max-height: 64vh; } .mbar { display: none; } }
.nowrap { white-space: nowrap; }
.viewer.small-modal.wide-modal { max-width: 760px; }

/* 横向 / 纵向滚动条始终显示（Mac 默认会自动隐藏滚动条，宽表不好拖） */
.scroll { scrollbar-width: auto; scrollbar-color: #9AA3B5 #EEF0F3; }
.scroll::-webkit-scrollbar { -webkit-appearance: none; width: 12px; height: 12px; }
.scroll::-webkit-scrollbar-track { background: #EEF0F3; border-radius: 6px; }
.scroll::-webkit-scrollbar-thumb { background: #9AA3B5; border-radius: 6px; border: 2px solid #EEF0F3; min-width: 40px; }
.scroll::-webkit-scrollbar-thumb:hover { background: #6F7A90; }
.scroll::-webkit-scrollbar-corner { background: #EEF0F3; }
.scroll-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; max-width: 100%; }
.scroll-nav .snb { flex: none; width: 40px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-size: 14px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.scroll-nav .snb:hover:not(:disabled) { background: var(--accent-soft, #e8edf8); color: var(--accent, #2f4a8a); border-color: currentColor; }
.scroll-nav .snb:disabled { opacity: .35; cursor: default; }
.scroll-top { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; height: 14px; scrollbar-width: auto; scrollbar-color: #9AA3B5 #EEF0F3; }
.scroll-top > div { height: 1px; }
.scroll-top::-webkit-scrollbar { -webkit-appearance: none; height: 12px; }
.scroll-top::-webkit-scrollbar-track { background: #EEF0F3; border-radius: 6px; }
.scroll-top::-webkit-scrollbar-thumb { background: #9AA3B5; border-radius: 6px; border: 2px solid #EEF0F3; }
.scroll-top::-webkit-scrollbar-thumb:hover { background: #6F7A90; }
td.w-na .chk input[type="checkbox"] { width: auto; min-width: 0; margin: 0; }
table.lines .w-subpo { min-width: 96px; }
/* 生产段（不是环节，按里程碑显示进度） */
.rail .n.pfill { position: relative; overflow: hidden; border-radius: 4px; }
.rail .n.pfill i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--done); opacity: .75; }
.rail.big .pseg { min-height: 44px; padding: 6px 8px; background: var(--bg); border-top: 4px solid var(--line); display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; font-size: 12px; color: var(--muted); }
.rail.big .pseg b { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.rail.big .prodseg.done .pseg { background: #EEF6F1; border-top-color: var(--done); }
.rail.big .prodseg.done .pseg b { color: var(--done); }
.rail.big .prodseg.cur .pseg { border-top-color: var(--accent); }
.rail .pbar { height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.rail .pbar i { display: block; height: 100%; background: var(--done); }
.rail.big .prodseg { flex: .7; }
.seg-group + .seg-group { margin-top: 6px; }
table.shipq input { width: 90px; }
table.shipq tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.ship-cards > .scard { min-width: 0; max-width: 100%; }
.savebar .advbtn { background: var(--done); border-color: var(--done); color: #fff; font-weight: 600; }
.savebar .advbtn:hover { filter: brightness(1.08); }
.bcard { position: relative; }
.bcard .cover { position: absolute; inset: 0; border-radius: 8px; }
.bcard .nm button, .bcard .bcontact a { position: relative; z-index: 1; }
.bcard .bcontact { margin: 4px 0 6px; line-height: 1.5; color: var(--ink-2); }
.bcard:hover { border-color: var(--accent); }
.mimgs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mimg { position: relative; display: inline-block; }
.mimg img { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; background: #fff; }
.mimg-del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--crit); font-size: 13px; line-height: 16px; cursor: pointer; padding: 0; }
