:root {
  /* 吐司卡片: cream page, white rounded cards, caramel sidebar, toast-orange accent */
  --bg: #fffaf0;
  --side: #7f5534;
  --list: #fff4df;
  --line: #eedcbd;
  --text: #4a321d;
  --muted: #86664a;
  --heading: #7a4f2a;
  --accent: #f0a35e;
  --accent-ink: #a85a17;
  --chip-ink: #7a3d0c; /* accent text on the --sel chip fill (AA) */
  --on-accent: #3b2412;
  --sel: #ffe2b8;
  --sel-soft: #fbecd2;
  --danger: #c4372b;
  --card: #ffffff;
  --col-bg: #fff1d8;
  --side-ink: #fff3d9;
  --side-muted: #f3dcbb;
  --side-sel: #fff3d9;
  --side-sel-ink: #6b4423;
  --ship-bg: #f4ecdf;
  --ship-ink: #7a6753;
  --toast: rgba(74, 50, 29, .95);
  --shadow: 0 16px 40px rgba(120, 80, 40, .20), 0 2px 6px rgba(120, 80, 40, .08);
  --card-shadow: 0 3px 10px rgba(120, 80, 40, .10);
  --card-shadow-hover: 0 6px 18px rgba(120, 80, 40, .16);
  --r-card: 14px;
  --r-panel: 18px;
  --r-ctl: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  /* warm cocoa version of the same theme */
  :root {
    --bg: #1d1712; --side: #2b2018; --list: #221b15; --line: #3b2f25; --text: #f3e8d8; --muted: #bba489; --heading: #f5c48a;
    --accent: #f0a35e; --accent-ink: #f5b273; --chip-ink: #f5b273; --on-accent: #2a1a0c; --sel: #4a3420; --sel-soft: #2d241c; --card: #2a221b; --col-bg: #251e18;
    --side-ink: #f3e8d8; --side-muted: #bba489; --side-sel: #4a3420; --side-sel-ink: #ffd9a8; --danger: #ff7b6b;
    --ship-bg: #2a231d; --ship-ink: #a8977f; --toast: rgba(58, 44, 32, .97);
    --shadow: 0 16px 44px rgba(0, 0, 0, .55); --card-shadow: 0 2px 8px rgba(0, 0, 0, .35); --card-shadow-hover: 0 6px 16px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
#app { height: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: var(--r-ctl); padding: 7px 14px; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 65%, #6b3510); }
.btn.primary:active { transform: translateY(1px); box-shadow: none; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.wide { width: 100%; padding: 10px; text-align: center; display: block; }
.btn:disabled { opacity: .5; }
.link-btn { background: none; border: 0; padding: 4px 6px; cursor: pointer; color: var(--accent-ink); border-radius: 8px; font-weight: 600; white-space: nowrap; }
.link-btn:hover { background: var(--sel-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.accent { color: var(--accent-ink); font-weight: 600; }
.input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-ctl); padding: 9px 11px; font: inherit; color: var(--text); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* auth */
.auth-page { display: grid; place-items: center; background: radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 46%), radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--side) 18%, transparent), transparent 50%), var(--bg); }
.auth-card { width: min(360px, calc(100vw - 32px)); background: var(--card); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--heading); font-size: 14px; justify-content: center; margin-bottom: 4px; }
.brand.small { font-size: 14px; justify-content: flex-start; margin: 0; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(#f7c27f, #e8893a); position: relative; display: inline-block; }
.brand-mark::after { content: ""; position: absolute; left: 5px; right: 5px; top: 7px; height: 8px; border-top: 2px solid #fff; border-bottom: 2px solid #fff; }
.brand.small .brand-mark { width: 18px; height: 18px; }
.brand.small .brand-mark::after { left: 4px; right: 4px; top: 5px; height: 7px; }
.auth-tabs { display: flex; background: var(--sel-soft); border-radius: var(--r-ctl); padding: 3px; }
.auth-tabs button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.auth-tabs button.on { background: var(--card); color: var(--text); box-shadow: var(--card-shadow); font-weight: 600; }
.auth-err { color: var(--danger); font-size: 13px; min-height: 0; }
.auth-err:empty { display: none; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 300px 1fr; height: 100%; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane-folders { background: var(--side); color: var(--side-ink); border-right: 0;
  /* the caramel sidebar re-points the shared tokens so everything inside stays readable */
  --text: var(--side-ink); --muted: var(--side-muted); --heading: var(--side-ink); --accent-ink: var(--side-ink); --line: color-mix(in srgb, var(--side-ink) 18%, transparent); --sel-soft: color-mix(in srgb, var(--side-ink) 12%, transparent); }
.pane-list { background: var(--list); border-right: 1px solid var(--line); }
.pane-note { background: var(--bg); }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 8px; min-height: 48px; }
.pane-folders .pane-head { justify-content: space-between; }
.pane-foot { padding: 8px 10px; border-top: 1px solid var(--line); }
.folder-scroll, .note-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.folder { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: var(--r-ctl); margin: 1px 0; cursor: pointer; }
.folder:hover { background: var(--sel-soft); }
.folder.on { background: var(--side-sel); color: var(--side-sel-ink); font-weight: 700; box-shadow: 0 3px 10px rgba(60, 30, 10, .18); }
.folder.on .count { color: var(--side-sel-ink); }
.folder .count { color: var(--muted); font-size: 13px; }
.folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-sep { font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }

.list-head { justify-content: space-between; }
.list-title { font-weight: 800; color: var(--heading); font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-count { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; }
.head-actions { display: flex; gap: 2px; }
.search-wrap { padding: 0 12px 8px; }
.search { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-ctl); padding: 7px 10px; font: inherit; color: var(--text); outline: none; }
.group { font-size: 12px; font-weight: 700; color: var(--text); padding: 12px 10px 4px; }
.note-row { display: block; padding: 9px 12px; border-radius: var(--r-card); position: relative; }
.note-row + .note-row::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--line); }
.note-row.on { background: var(--card); box-shadow: var(--card-shadow), 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.note-row.on::before, .note-row.on + .note-row::before { display: none; }
.note-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-sub { display: flex; gap: 8px; font-size: 13px; margin-top: 2px; }
.note-date { color: var(--text); flex: none; }
.note-snippet { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-share { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); text-align: center; padding: 48px 12px; font-size: 14px; }

/* note */
.note-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 48px; border-bottom: 1px solid transparent; }
.note-top-right { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.toolbar { display: flex; align-items: center; gap: 1px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.toolbar::-webkit-scrollbar { display: none; }
.tb { background: none; border: 0; padding: 5px 8px; border-radius: 9px; cursor: pointer; color: var(--muted); white-space: nowrap; font-size: 14px; }
.tb:hover { background: var(--sel-soft); color: var(--text); }
.tb.on { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tb-b { font-weight: 800; } .tb-i { font-style: italic; font-family: Georgia, serif; } .tb-u { text-decoration: underline; } .tb-s { text-decoration: line-through; }
.tb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; flex: none; }
.status { font-size: 12px; color: var(--muted); }
.status.offline { color: var(--danger); }
.avatars { display: flex; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; background: #aaa; border: 2px solid var(--bg); flex: none; }
.avatars .avatar + .avatar { margin-left: -8px; }
.note-scroll-area { flex: 1; overflow-y: auto; padding: 0 0 80px; }
.note-date-top { text-align: center; color: var(--muted); font-size: 12px; padding: 14px 0 4px; }
.banner { margin: 10px auto 0; max-width: 760px; background: var(--sel-soft); color: var(--muted); border-radius: var(--r-ctl); padding: 6px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; justify-content: center; }
.note-empty, .loading { color: var(--muted); text-align: center; padding: 80px 20px; }
.editor { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.ProseMirror { outline: none; min-height: 60vh; min-height: 60dvh; line-height: 1.55; font-size: 16px; padding-top: 6px; word-wrap: break-word; }
.ProseMirror > :first-child { font-size: 14px; font-weight: 800; color: var(--heading); line-height: 1.3; margin-top: 4px; }
.ProseMirror p { margin: 0 0 2px; }
.ProseMirror h1, .ProseMirror h2, .ProseMirror h3 { color: var(--heading); font-weight: 800; }
.ProseMirror h1 { font-size: 14px; font-weight: 800; color: var(--heading); margin: 14px 0 4px; }
.ProseMirror h2 { font-size: 14px; font-weight: 750; color: var(--heading); margin: 12px 0 4px; }
.ProseMirror h3 { font-size: 14px; font-weight: 700; margin: 10px 0 2px; }
.ProseMirror ul, .ProseMirror ol { padding-left: 24px; margin: 2px 0; }
.ProseMirror blockquote { border-left: 3px solid var(--accent); margin: 6px 0; padding-left: 12px; color: var(--muted); }
.ProseMirror code { background: var(--sel-soft); border-radius: 4px; padding: 1px 4px; font-size: .92em; }
.ProseMirror pre { background: var(--sel-soft); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.ProseMirror img { max-width: 100%; border-radius: 10px; display: block; margin: 8px 0; }
.ProseMirror img.ProseMirror-selectednode { outline: 3px solid var(--accent); }
.ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--muted); float: left; height: 0; pointer-events: none; }
ul[data-type="taskList"] { list-style: none; padding-left: 2px; }
ul[data-type="taskList"] li { display: flex; align-items: flex-start; gap: 8px; margin: 3px 0; }
ul[data-type="taskList"] li > label { flex: none; margin-top: 2px; user-select: none; }
ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
ul[data-type="taskList"] input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent); margin: 0; cursor: pointer; display: grid; place-items: center; background: var(--card); }
ul[data-type="taskList"] input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
ul[data-type="taskList"] input[type="checkbox"]:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
ul[data-type="taskList"] li[data-checked="true"] > div { color: var(--muted); }
.ProseMirror table { border-collapse: collapse; width: 100%; margin: 8px 0; table-layout: fixed; }
.ProseMirror td, .ProseMirror th { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; min-width: 40px; }
.ProseMirror th { background: var(--sel-soft); font-weight: 600; text-align: left; }
.ProseMirror .selectedCell { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.collab-caret { position: relative; margin-left: -1px; margin-right: -1px; border-left: 2px solid; word-break: normal; pointer-events: none; }
.collab-label { position: absolute; top: -1.35em; left: -2px; font-size: 11px; font-weight: 600; line-height: 1; color: #fff; padding: 2px 5px; border-radius: 4px 4px 4px 0; white-space: nowrap; user-select: none; }
.ProseMirror-yjs-selection { opacity: .9; }

/* menus & modals */
.menu { position: fixed; z-index: 60; background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 5px; min-width: 180px; display: flex; flex-direction: column; }
.menu-item { background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 9px; cursor: pointer; }
.menu-item:hover:not(:disabled) { background: var(--sel-soft); }
.menu-item:disabled { color: var(--muted); font-size: 13px; cursor: default; }
.menu-item.danger { color: var(--danger); }
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(60, 38, 18, .30); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: var(--r-panel); box-shadow: var(--shadow); width: min(460px, 100%); padding: 18px; display: grid; gap: 12px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-title { font-weight: 800; font-size: 14px; color: var(--heading); }
.modal-text { line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.share { display: grid; gap: 8px; }
.share-sec { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.invite-row { display: flex; gap: 6px; }
.invite-row .input { flex: 1; }
select.role, select.input { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--r-ctl); padding: 6px 8px; font: inherit; }
.people { display: grid; gap: 4px; }
.person { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.person-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.person-name small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-role { color: var(--muted); font-size: 13px; }
.person.pending .avatar { background: color-mix(in srgb, var(--muted) 45%, var(--card)); }
.link-row { display: flex; align-items: center; gap: 6px; }
.link-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.link-label small { color: var(--muted); font-size: 12px; }
.link-url { padding: 5px 8px; font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--toast); color: #fff7ea; padding: 9px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(60, 38, 18, .25); font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 80; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.back { display: none; }
.guest-shell { grid-template-columns: 1fr; }

/* tablet: hide folders column */
@media (max-width: 1000px) and (min-width: 721px) and (min-height: 501px), (max-width: 1000px) and (min-width: 721px) and (pointer: fine) {
  .shell { grid-template-columns: 180px 260px 1fr; }
  .editor { padding: 0 20px; }
}
/* mobile: one pane at a time */
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .shell { grid-template-columns: 1fr; }
  .shell .pane { display: none; }
  .shell[data-pane="folders"] .pane-folders, .shell[data-pane="list"] .pane-list, .shell[data-pane="note"] .pane-note { display: flex; }
  .back { display: inline-block; padding-left: 0; }
  .guest-shell .back { display: none; }
  .note-top { flex-wrap: wrap; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); }
  .note-top .toolbar { order: 3; flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 4px; }
  .pane-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .list-title { font-size: 14px; }
  .editor { padding: 0 16px; }
  .ProseMirror { font-size: 17px; }
  .note-row { padding: 11px 12px; }
  .folder { padding: 11px 12px; font-size: 16px; }
}

/* edit attribution */
.link-btn.toggled { background: color-mix(in srgb, var(--accent) 18%, transparent); font-weight: 600; }
.attr-hl { background: color-mix(in srgb, var(--ac) 22%, transparent); border-bottom: 2px solid color-mix(in srgb, var(--ac) 70%, transparent); border-radius: 2px; }
.attr-hl.unseen { background: color-mix(in srgb, var(--ac) 30%, transparent); }
.changes-banner { color: var(--text); }
.activity { display: grid; gap: 10px; }
.act-list { display: grid; gap: 2px; max-height: 50vh; max-height: 50dvh; overflow-y: auto; }
.act-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.act-row.new { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.act-new { font-size: 11px; font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 8px; padding: 1px 7px; }

/* highlight, links, import drop */
.ProseMirror mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
@media (prefers-color-scheme: dark) { .ProseMirror mark { background: #7a5d00; } }
.ProseMirror a { color: var(--accent-ink); text-decoration: underline; cursor: pointer; }
.tb-hl { background: linear-gradient(transparent 55%, #fde68a 55%); border-radius: 9px; }
.pane-list.drop { outline: 2px dashed var(--accent); outline-offset: -6px; background: color-mix(in srgb, var(--accent) 6%, var(--list)); }
ul[data-type="taskList"] li > div > p + p { color: var(--muted); }

/* ---------- order boards ---------- */
.folder-sep.with-btn { display: flex; justify-content: space-between; align-items: center; }
.sep-btn { font-size: 12px; padding: 2px 6px; font-weight: 600; }
.board-link .count { font-size: 11px; }
.shell[data-mode="board"] { grid-template-columns: 220px 1fr; }
.shell[data-mode="board"] .pane-list { display: none; }
.guest-shell[data-mode="board"] { grid-template-columns: 1fr; }
.ob { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ob-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px 6px; min-height: 48px; }
.ob-title { font-size: 14px; font-weight: 800; color: var(--heading); cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-live { font-size: 12px; color: var(--muted); }
.ob-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.ob-tools { display: flex; gap: 8px; align-items: center; padding: 0 16px 10px; }
.ob-search { max-width: 320px; }
.ob-month, .ob-tools select { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--r-ctl); padding: 6px 8px; font: inherit; font-size: 14px; }
.segs { display: inline-flex; background: var(--sel-soft); border-radius: var(--r-ctl); padding: 2px; flex: none; }
.seg { border: 0; background: none; padding: 5px 12px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 14px; white-space: nowrap; }
.seg.on { background: var(--card); color: var(--text); box-shadow: var(--card-shadow); font-weight: 600; }
.ob-tabs { display: none; }
.ob-body { flex: 1; min-height: 0; overflow: auto; padding: 0 16px 24px; }
.ob-cols { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; align-items: start; min-height: 100%; }
.ob-col { background: var(--col-bg); border-radius: var(--r-panel); padding: 8px; min-height: 160px; border: 2px solid transparent; }
.ob-col.drop { border-color: var(--accent); }
.col-head { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; padding: 4px 6px 8px; }
.col-head .n { color: var(--muted); font-weight: 400; font-size: 13px; }
.col-head .link-btn { margin-left: auto; font-size: 13px; }
.col-cards { display: grid; gap: 8px; }
.col-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 6px; }
.col-more { font-size: 12px; margin-top: 6px; width: 100%; }
.ob-card { background: var(--card); border-radius: var(--r-card); padding: 10px 12px; cursor: pointer; border-left: 0;
  /* status shows as a soft inner stripe that follows the rounded corner */
  box-shadow: inset 3px 0 0 var(--stc, transparent), var(--card-shadow); }
.ob-card:hover { box-shadow: inset 3px 0 0 var(--stc, transparent), var(--card-shadow-hover); }
.ob-card.dragging { opacity: .4; }
.ob-card.st-printing { --stc: #5b8def; }
.ob-card.st-ready { --stc: var(--accent); }
.ob-card.st-shipped { --stc: #3fa45f; opacity: .9; }
.c-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.c-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-total { font-size: 13px; color: var(--text); flex: none; }
.c-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 4px; align-items: center; }
.c-prog { display: inline-flex; align-items: center; gap: 4px; }
.bar { width: 36px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; display: inline-block; }
.bar i { display: block; height: 100%; background: var(--accent); }
.due { color: var(--muted); }
.due.red, .f-after.red { color: var(--danger); font-weight: 600; }
.c-track { font-family: ui-monospace, Menlo, monospace; }
.c-pay { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--sel-soft); color: var(--muted); white-space: nowrap; }
.pill.st-printing, .seg.on.st-printing { background: #dbeafe; color: #1d4ed8; }
.pill.st-ready, .seg.on.st-ready { background: var(--sel); color: var(--accent-ink); }
.pill.st-shipped, .seg.on.st-shipped { background: #dcfce7; color: #15803d; }
.ob-table-wrap { overflow-x: auto; }
.ob-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ob-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ob-table td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ob-table tr { cursor: pointer; }
.ob-table tbody tr:hover { background: var(--sel-soft); }
.ob-table .strong { font-weight: 600; }
.ob-ro { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--sel-soft); color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 12px; }
/* detail drawer */
.ob-detail-back { position: fixed; inset: 0; z-index: 40; background: rgba(60, 38, 18, .22); display: flex; justify-content: flex-end; }
.ob-detail { width: min(480px, 100%); height: 100%; background: var(--card); box-shadow: var(--shadow); overflow-y: auto; padding: 14px 18px 40px; display: flex; flex-direction: column; gap: 12px; }
.d-head { display: flex; gap: 8px; align-items: center; }
.d-name { flex: 1; font-size: 14px; font-weight: 700; border: 0; background: none; color: var(--text); outline: none; padding: 4px 0; font-family: inherit; min-width: 0; }
.status-segs { width: 100%; display: flex; }
.status-segs .seg { flex: 1; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f.wide { grid-column: 1 / -1; }
.fl { font-size: 12px; color: var(--muted); }
.f-after { font-size: 12px; color: var(--muted); }
.f .input { padding: 7px 9px; }
textarea.input { resize: vertical; font-family: inherit; }
.contact summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.contact .sum-hint { margin-left: 8px; color: var(--muted); opacity: .7; }
.contact textarea { margin-top: 6px; width: 100%; }
.d-sec { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.items { display: grid; gap: 4px; }
.it { border-radius: 8px; }
.it-row { display: flex; gap: 6px; align-items: center; }
.it-row input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent); margin: 0; flex: none; cursor: pointer; display: grid; place-items: center; background: var(--card); }
.it-row input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.it-row input[type=checkbox]:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.it-row input:not([type]) , .it-row input[class^="it-"] { border: 0; border-bottom: 1px solid transparent; background: none; color: var(--text); font: inherit; font-size: 14px; padding: 3px 2px; min-width: 0; outline: none; }
.it-row input[class^="it-"]:focus { border-bottom-color: var(--accent); }
.it-name { flex: 2; font-weight: 500; }
.it-color { flex: 1.6; color: var(--muted) !important; }
.it-brand { flex: .8; color: var(--muted) !important; font-size: 13px !important; }
.it-qty { width: 32px; flex: none; text-align: center; }
.it .x { color: var(--muted); font-size: 12px; }
.it.done .it-name { color: var(--muted); text-decoration: line-through; }
.it-more { flex: none; color: var(--muted); }
.it-spec { display: block; width: calc(100% - 26px); margin-left: 26px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; resize: none; padding: 0 2px; outline: none; field-sizing: content; }
.it-spec.empty { display: none; }
.it:focus-within .it-spec.empty { display: block; }
.it-kids { margin-left: 26px; display: grid; gap: 2px; }
.add-item { align-self: flex-start; }
.log { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.log-row { display: flex; gap: 8px; }
.log-t { flex: none; width: 76px; }
.log-who { flex: none; color: var(--text); }
.del-order { align-self: flex-start; margin-top: 8px; }
/* paste */
.modal.modal-wide { width: min(1080px, 100%); height: min(760px, calc(100vh - 32px)); height: min(760px, calc(100dvh - 32px)); grid-template-rows: auto 1fr auto; }
.paste { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-height: 0; }
.paste-left { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.paste-ta { flex: 1; resize: none; font-family: ui-monospace, Menlo, "PingFang SC", monospace; font-size: 13px; line-height: 1.5; min-height: 240px; }
.paste-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.paste-pv { overflow-y: auto; display: grid; gap: 10px; align-content: start; min-height: 0; padding-right: 2px; }
.pv-card { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); padding: 10px 12px; }
.pv-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.pv-meta .warn { color: var(--danger); }
.pv-items { display: grid; gap: 3px; font-size: 13px; }
.pv-item { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pv-item.child { margin-left: 22px; }
.pv-box { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent); flex: none; }
.pv-box.on { background: var(--accent); border-color: var(--accent); }
.pv-color, .pv-brand { color: var(--muted); }
.pv-brand::before { content: "· "; }
.pv-qty { font-weight: 600; }
.pv-spec { flex-basis: 100%; margin-left: 20px; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .shell[data-mode="board"] { grid-template-columns: 1fr; }
  .ob-head { flex-wrap: wrap; padding: 8px 12px 4px; padding-top: max(8px, env(safe-area-inset-top)); }
  .ob-title { font-size: 14px; flex: 1; }
  .ob-actions { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .ob-tools { padding: 0 12px 8px; flex-wrap: wrap; }
  .ob-search { max-width: none; flex: 1 1 100%; }
  .ob-tabs { display: flex; margin: 0 12px 8px; background: var(--sel-soft); border-radius: var(--r-ctl); padding: 2px; }
  .ob-tab { flex: 1; border: 0; background: none; padding: 7px 2px; border-radius: 10px; font-size: 13px; color: var(--muted); }
  .ob-tab.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: var(--card-shadow); }
  .ob-tab .n { margin-left: 3px; font-size: 12px; }
  .ob-body { padding: 0 12px 24px; }
  .is-board .ob-cols { grid-template-columns: 1fr; }
  .is-board .ob-col { display: none; background: none; padding: 0; }
  .is-board .ob-col.tab-on { display: block; }
  .is-board .col-head { display: none; }
  .is-board .ob-col.tab-on .col-head:has(.link-btn) { display: flex; }
  .is-list .ob-tabs { display: none; }
  .ob-detail { width: 100%; padding-top: max(14px, env(safe-area-inset-top)); }
  .fields { grid-template-columns: 1fr; }
  .modal.modal-wide { height: calc(100vh - 32px); height: calc(100dvh - 32px); }
  .paste { grid-template-columns: 1fr; grid-template-rows: 40% 1fr; }
}

/* 预备发货, selection, linked notes */
.ob-card.st-prep { --stc: #e2732e; }
.pill.st-prep, .seg.on.st-prep { background: #ffedd5; color: #c2410c; }
.ob-card.selected { box-shadow: 0 0 0 2px var(--accent), var(--card-shadow); }
.c-sel { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent); flex: none; margin-right: 6px; cursor: pointer; display: inline-grid; place-items: center; align-self: center; }
.c-sel.on { background: var(--accent); border-color: var(--accent); }
.c-sel.on::after { content: ""; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.c-top .c-name { flex: 1; min-width: 0; }
.c-pay span + span { margin-left: 6px; }
.c-src { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--sel-soft); color: var(--muted); }
.c-warn { color: #c2410c; font-size: 12px; }
.col-head { flex-wrap: wrap; }
.col-head .link-btn + .link-btn { margin-left: 0; }
.src-banner { background: var(--sel-soft); border-radius: var(--r-ctl); padding: 6px 10px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.status-segs .seg { padding: 5px 4px; font-size: 13px; }
.ship-all { display: grid; gap: 8px; max-height: 55vh; max-height: 55dvh; overflow-y: auto; }
.ship-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; font-size: 14px; }
.ship-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack { display: grid; gap: 10px; max-height: 65vh; max-height: 65dvh; overflow-y: auto; }
.pack > .link-btn { justify-self: start; }
.pack-card { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); padding: 8px 12px; font-size: 13px; user-select: text; }
.pack-contact { white-space: pre-wrap; color: var(--text); margin: 4px 0; }
.pack-items { color: var(--muted); display: grid; gap: 1px; }
.pack-items .child { margin-left: 16px; }
.pack-items .spec { margin-left: 16px; font-size: 12px; }
.note-boards { text-align: center; font-size: 12px; color: var(--muted); margin-top: -2px; }
.note-boards a { color: var(--accent-ink); }
.synced-tag { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--sel); color: var(--accent-ink); margin-left: 4px; }
.ProseMirror .flash { animation: flash 2s ease; border-radius: 4px; }
@keyframes flash { 0%, 60% { background: var(--sel); } 100% { background: transparent; } }
.muted { color: var(--muted); }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .ob-tab { font-size: 12px; padding: 7px 0; }
  .ob-tab .n { margin-left: 1px; }
  .ship-row { grid-template-columns: 90px 1fr; }
}
.ob-detail .input:disabled { background: transparent; border-color: transparent; color: var(--text); opacity: 1; padding-left: 0; }

/* 已取消 */
.ob-cols { grid-template-columns: repeat(5, minmax(190px, 1fr)) auto; }
.cancel-col { width: 210px; background: transparent; border: 1px dashed var(--line); }
.cancel-col.collapsed { width: 40px; min-height: 160px; padding: 4px 0; }
.cancel-toggle { width: 100%; border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; font-size: 14px; text-align: left; }
.cancel-col.collapsed .cancel-toggle { writing-mode: vertical-rl; display: flex; align-items: center; justify-content: flex-start; gap: 6px; padding: 8px 0; text-align: center; }
.cancel-col.collapsed .chev { display: none; }
.cancel-toggle .chev { margin-left: auto; }
.ob-card.cancelled { opacity: .62; --stc: color-mix(in srgb, var(--muted) 50%, transparent); background: var(--card); }
.ob-card.cancelled .c-name, td.strike { text-decoration: line-through; color: var(--muted); }
.pill.st-cancelled, .seg.on.st-cancelled { background: var(--sel-soft); color: var(--muted); }
.cancel-banner { background: var(--sel-soft); border-radius: var(--r-ctl); padding: 6px 10px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.status-segs { flex-wrap: wrap; }
.ob-filter { height: 34px; border-radius: var(--r-ctl); color: var(--text); border: 1px solid var(--line); background: var(--card); padding: 0 8px; font: inherit; font-size: 13px; }
.ob-detail .del-order + .del-order { margin-top: 0; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .is-board .ob-cols { grid-template-columns: 1fr; }
  .cancel-col, .cancel-col.collapsed { width: auto; border: 0; }
  .is-board .cancel-col .cancel-toggle { display: none; }
  .ob-tab[data-st="cancelled"] { flex: 0 0 auto; font-size: 11px; padding: 7px 6px; }
}
.ob-cols.cancel-open { grid-template-columns: repeat(5, minmax(150px, 1fr)) auto; }
.ob-cols.cancel-open .cancel-col { width: 190px; }

/* Cards never wider than their column: grid/flex children default to min-width:auto (min-content),
   so a long nowrap name with emoji used to push the card past the column edge. */
.ob-cols > .ob-col { min-width: 0; }
.col-cards { grid-template-columns: minmax(0, 1fr); }
.ob-card { min-width: 0; max-width: 100%; box-sizing: border-box; }
.c-top { min-width: 0; align-items: center; }
.c-top .c-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-top .c-total, .c-top .c-sel { flex: 0 0 auto; white-space: nowrap; }
.c-sub, .c-pay { min-width: 0; }
.c-sub > * { min-width: 0; }
.c-track { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (max-width: 1100px) and (min-width: 721px) and (min-height: 501px), (max-width: 1100px) and (min-width: 721px) and (pointer: fine) {
  .ob-cols, .ob-cols.cancel-open { grid-template-columns: repeat(5, minmax(150px, 1fr)) auto; }
}
.ob-cols { grid-template-columns: repeat(5, minmax(160px, 1fr)) auto; }
.ob-cols.cancel-open { grid-template-columns: repeat(5, minmax(140px, 1fr)) auto; }
@media (max-width: 1100px) and (min-width: 721px) and (min-height: 501px), (max-width: 1100px) and (min-width: 721px) and (pointer: fine) {
  .ob-cols, .ob-cols.cancel-open { grid-template-columns: repeat(5, minmax(140px, 1fr)) auto; }
}
/* Long names wrap to at most two lines instead of collapsing to "…" in narrow columns. */
.c-top { align-items: flex-start; }
.c-top .c-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; }
.c-top .c-total { line-height: 1.35; padding-top: 1px; }
.c-top .c-sel { margin-top: 1px; }
.ob-cols, .ob-cols.cancel-open { grid-template-columns: repeat(5, minmax(165px, 1fr)) auto; }
@media (max-width: 1100px) and (min-width: 721px) and (min-height: 501px), (max-width: 1100px) and (min-width: 721px) and (pointer: fine) {
  .ob-cols, .ob-cols.cancel-open { grid-template-columns: repeat(5, minmax(165px, 1fr)) auto; }
}

/* Board fills the viewport; each column scrolls on its own so every drop target stays visible. */
@media (min-width: 721px) and (min-height: 501px), (min-width: 721px) and (pointer: fine) {
  .is-board .ob-body { overflow-x: auto; overflow-y: hidden; padding-bottom: 12px; }
  .is-board .ob-cols { height: 100%; min-height: 0; align-items: stretch; }
  .is-board .ob-col { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
  .is-board .ob-col > .col-head { flex: none; }
  .is-board .ob-col > .col-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; padding: 2px 2px 24px; margin: -2px -2px 0; }
  .is-board .ob-col > .col-more { flex: none; }
  .is-board .cancel-col.collapsed { min-height: 0; }
}

/* Hidden scrollbars on the order board (scrolling still works by wheel, trackpad, touch, drag). */
.ob .ob-body, .ob .col-cards, .ob .ob-tabs, .ob .ob-table-wrap, .ob-detail { scrollbar-width: none; -ms-overflow-style: none; }
.ob .ob-body::-webkit-scrollbar, .ob .col-cards::-webkit-scrollbar, .ob .ob-tabs::-webkit-scrollbar, .ob .ob-table-wrap::-webkit-scrollbar, .ob-detail::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* Soft fade at the bottom of a column when more cards are below. */
.is-board .col-cards.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }

/* 待打印 merged into 打印中: four working columns. */
.ob-cols, .ob-cols.cancel-open { grid-template-columns: repeat(4, minmax(180px, 1fr)) auto; }
@media (max-width: 1100px) and (min-width: 721px) and (min-height: 501px), (max-width: 1100px) and (min-width: 721px) and (pointer: fine) {
  .ob-cols, .ob-cols.cancel-open { grid-template-columns: repeat(4, minmax(170px, 1fr)) auto; }
}
/* Wider order detail drawer on desktop. */
@media (min-width: 721px) and (min-height: 501px), (min-width: 721px) and (pointer: fine) {
  .ob-detail { width: clamp(440px, 45vw, 560px); padding: 16px 24px 40px; }
}

/* ---------- phones ---------- */
/* iOS Safari zooms the whole page (and leaves it zoomed) when a field under 16px gets focus. */
@media (max-width: 720px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.d-name), select, textarea,
  .it-row input[class^="it-"], .it-brand { font-size: 16px !important; }
}
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  /* paste / bulk import: textarea on top, preview below, nothing overlapping */
  .paste { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .paste-left { min-height: 0; }
  .paste-ta { flex: none; min-height: 0; height: 26vh; height: 26dvh; }
  .paste-bar { flex-wrap: wrap; row-gap: 2px; }
  .modal-back { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .modal.modal-wide { height: calc(100vh - 20px); height: calc(100dvh - 20px); padding: 14px; }
  .invite-row { flex-wrap: wrap; }
  .invite-row .input { flex: 1 1 160px; min-width: 0; }
  /* drawer: always the full screen, scrolls inside */
  .ob-detail-back { justify-content: stretch; }
  .ob-detail { width: 100%; max-width: none; height: 100%; padding: 12px 16px 40px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(40px, env(safe-area-inset-bottom)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .it-row { flex-wrap: nowrap; min-width: 0; }
  .it-name { min-width: 0; flex: 2 1 0; }
  .it-color { min-width: 0; flex: 1.4 1 0; }
  .it-brand { min-width: 0; flex: 1 1 0; }
  .ob-body { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .ob.ro .ob-body { padding-bottom: 56px; }
  .ob-tools .ob-month { flex: 1 1 auto; min-width: 0; }
  .note-top-right { gap: 0; }
  .note-top-right .link-btn { padding: 6px 5px; }
}
.ob-ro { pointer-events: none; z-index: 5; }
/* Landscape phones: header + tabs would eat most of the height, so the whole board scrolls as one page. */
@media (pointer: coarse) and (max-height: 500px) {
  .ob { overflow-y: auto; overscroll-behavior: contain; }
  .ob .ob-body { flex: none; overflow: visible; min-height: auto; }
  .ob > * { flex-shrink: 0; }
}
/* Read-only (note-linked) fields in the drawer: iOS Safari paints disabled inputs at ~40% opacity in grey,
   which made the whole drawer look stuck/disabled. Show them as normal text. */
.ob-detail input:disabled, .ob-detail textarea:disabled, .ob-detail select:disabled { opacity: 1; -webkit-text-fill-color: currentColor; color: var(--text); }
.ob-detail .it-color:disabled, .ob-detail .it-brand:disabled, .ob-detail .it-spec:disabled { color: var(--muted) !important; }
.ob-detail .it.done .it-name:disabled { color: var(--muted); }
.ob-detail .seg:disabled { opacity: 1; -webkit-text-fill-color: currentColor; }
/* Phones: the drawer's title row with 完成 stays pinned while the drawer scrolls. */
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .ob-detail .d-head { position: sticky; top: calc(-1 * max(12px, env(safe-area-inset-top))); z-index: 3; background: var(--card); margin: calc(-1 * max(12px, env(safe-area-inset-top))) -16px 0; padding: max(12px, env(safe-area-inset-top)) 16px 8px; }
  .ob-detail .d-head .link-btn { padding: 8px 10px; }
}

/* ---------- order detail as a paper receipt ---------- */
.ob-detail-back { background: rgba(60, 38, 18, .28); }
.ob-detail {
  --rcpt-paper: #fbf6eb;
  --rcpt-ink: #2a2418;
  --rcpt-stage: #f1e2c8;
  --rcpt-dash: #cbbfa8;
  --rcpt-num: ui-monospace, "SF Mono", Menlo, "Cascadia Mono", "Noto Sans Mono CJK SC", monospace;
  background: var(--rcpt-stage);
  color: var(--rcpt-ink);
  gap: 0;
}
@media (prefers-color-scheme: dark) {
  .ob-detail { --rcpt-stage: #171210; --rcpt-dash: #8a7f6a; }
  .ob-detail-back { background: rgba(0, 0, 0, .5); }
}
/* Chrome (完成 + status) stays pinned above the paper. */
.ob-detail .d-chrome {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--rcpt-stage);
  padding: 12px 4px 10px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}
.ob-detail .d-head { display: flex; align-items: center; gap: 8px; }
.ob-detail .d-chrome-title { font-weight: 700; font-size: 14px; color: var(--text); letter-spacing: .04em; }
.ob-detail .d-head .link-btn { margin-left: auto; font-weight: 650; color: var(--accent-ink); padding: 8px 10px; }
.ob-detail .d-chrome .src-banner,
.ob-detail .d-chrome .cancel-banner,
.ob-detail .d-chrome .c-warn { margin: 0; }
/* Paper sits on the stage; serrated edges are triangles of paper on the stage. */
.rcpt-wrap {
  position: relative;
  padding: 10px 6px 28px;
  flex: none;
}
.rcpt-wrap::before,
.rcpt-wrap::after {
  content: "";
  display: block;
  height: 10px;
  margin: 0 2px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' preserveAspectRatio='none'><polygon points='0,10 6,0 12,10' fill='%23fbf6eb'/></svg>");
  background-size: 12px 10px;
  background-repeat: repeat-x;
  pointer-events: none;
}
.rcpt-wrap::after { transform: scaleY(-1); margin-top: 0; }
.rcpt {
  /* the paper stays light in dark mode, so text inside uses the paper's ink */
  --text: var(--rcpt-ink);
  --muted: #776d5c;
  position: relative;
  background: var(--rcpt-paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 27px, rgba(42, 36, 24, .035) 28px);
  color: var(--rcpt-ink);
  padding: 18px 22px 16px;
  margin: 0 2px;
  box-shadow: 0 14px 32px rgba(40, 30, 10, .16), 0 1px 0 rgba(255, 255, 255, .4) inset;
  overflow: visible;
  min-width: 0;
}
.rcpt-shop {
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .42em;
  text-indent: .42em;
  line-height: 1.2;
  padding: 8px 28px 2px;
}
.rcpt-sub {
  text-align: center;
  letter-spacing: .55em;
  font-size: 9px;
  color: #776d5c;
  margin: 6px 0 2px;
}
.rcpt-sub::before { content: "✱  ✱  ✱"; letter-spacing: .55em; }
.rcpt-dash {
  height: 1px;
  margin: 12px 0;
  background: repeating-linear-gradient(90deg, var(--rcpt-dash) 0 5px, transparent 5px 9px);
}
.rcpt-headmeta { display: grid; gap: 2px; }
.rcpt-kv, .rcpt .f { display: grid; grid-template-columns: 4.2em 1fr; gap: 6px 10px; align-items: baseline; min-width: 0; }
.rcpt .f.wide { grid-template-columns: 4.2em 1fr; grid-column: auto; }
.rcpt .fl, .rcpt-kv .k { font-size: 12px; color: #776d5c; letter-spacing: .08em; }
.rcpt .f .input, .rcpt .d-name, .rcpt .f-after {
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 3px 0;
  min-width: 0;
  width: 100%;
  color: var(--rcpt-ink);
  font: inherit;
}
.rcpt .d-name { font-size: 14px; font-weight: 700; padding: 2px 0; }
.rcpt .f .input:focus, .rcpt .d-name:focus, .rcpt textarea.input:focus {
  border-bottom-color: var(--accent);
  outline: none;
  box-shadow: none;
}
.rcpt .f .input:disabled, .rcpt .d-name:disabled, .rcpt textarea.input:disabled {
  opacity: 1;
  -webkit-text-fill-color: currentColor;
  color: var(--rcpt-ink);
}
.rcpt .f .input::placeholder, .rcpt .d-name::placeholder { color: #c3bbaa; }
.rcpt input[type=date]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }
.rcpt .num, .rcpt-total, .rcpt-amt-line, .it-qty-wrap, .rcpt-barcap {
  font-family: var(--rcpt-num);
  font-variant-numeric: tabular-nums;
}
.rcpt-seclabel { font-size: 11px; letter-spacing: .18em; color: #776d5c; margin-bottom: 6px; }
/* Item rows: name, then grey color/brand, qty on the right. */
.rcpt .items { display: grid; gap: 8px; }
.rcpt .it { min-width: 0; }
.rcpt .it-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  gap: 6px 8px;
  align-items: start;
  min-width: 0;
}
.rcpt .it-row input[type=checkbox] { margin-top: 2px; background: var(--rcpt-paper); }
.rcpt .it-main { min-width: 0; display: grid; gap: 0; }
.rcpt .it-name {
  width: 100%;
  font-weight: 600;
  font-size: 14px;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: none;
  color: var(--rcpt-ink);
  padding: 1px 0;
  min-width: 0;
  outline: none;
}
.rcpt .it-name:focus, .rcpt .it-sub input:focus, .rcpt .it-qty:focus, .rcpt .it-spec:focus { border-bottom-color: var(--accent); }
.rcpt .it-sub { display: flex; flex-wrap: wrap; gap: 0 10px; min-width: 0; }
.rcpt .it-sub input {
  flex: 1 1 6em;
  min-width: 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: none;
  color: #776d5c;
  font: inherit;
  font-size: 12px;
  padding: 0;
  outline: none;
}
.rcpt .it-qty-wrap { display: inline-flex; align-items: baseline; gap: 1px; flex: none; padding-top: 2px; font-size: 14px; }
.rcpt .it-qty-wrap .x { color: #776d5c; font-size: 12px; }
.rcpt .it-qty {
  width: 2.2em;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: none;
  text-align: right;
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 0;
  outline: none;
  color: var(--rcpt-ink);
}
.rcpt .it-spec {
  display: block;
  width: 100%;
  margin: 1px 0 0;
  border: 0;
  background: none;
  color: #776d5c;
  font: inherit;
  font-size: 12px;
  resize: none;
  padding: 0;
  outline: none;
  field-sizing: content;
}
.rcpt .it-more { color: #776d5c; padding: 0 2px; }
.rcpt .it.done .it-name { color: #776d5c; text-decoration: line-through; }
.rcpt .it.child { margin-left: 18px; }
.rcpt .it.child .it-row { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
.rcpt .add-item { margin-top: 6px; padding-left: 30px; }
.rcpt-amt { margin-top: 2px; }
.rcpt-amt-lines { display: grid; justify-items: end; gap: 1px; padding: 4px 0 2px; font-size: 14px; }
.rcpt-amt-line { display: grid; grid-template-columns: 1em 6.5em; gap: 6px; }
.rcpt-amt-line .op { color: #776d5c; text-align: right; }
.rcpt-amt-line .num { text-align: right; }
.rcpt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 2px solid var(--rcpt-ink);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .06em;
}
.rcpt-total .num { font-size: 14px; font-weight: 800; }
.rcpt .contact summary { color: #776d5c; }
.rcpt .log { font-size: 11px; color: #776d5c; gap: 2px; }
.rcpt .log-who { color: var(--rcpt-ink); }
.rcpt-thanks {
  text-align: center;
  font-weight: 700;
  letter-spacing: .35em;
  font-size: 12px;
  margin: 16px 0 8px;
  color: var(--rcpt-ink);
}
.rcpt-bar { margin-top: 4px; }
.rcpt-barcode {
  display: flex;
  align-items: stretch;
  justify-content: center;
  height: 36px;
  gap: 1px;
  padding: 0 8%;
}
.rcpt-barcode i { display: block; background: #2a2418; width: 1.5px; flex: none; }
.rcpt-barcode i.wide { width: 3px; }
.rcpt-barcode i.b0 { width: 1px; height: 70%; align-self: end; }
.rcpt-barcode i.b1 { width: 2px; }
.rcpt-barcode i.b2 { width: 1px; }
.rcpt-barcode i.b3 { width: 2.5px; height: 85%; align-self: end; }
.rcpt-barcode i.b4 { width: 1px; height: 60%; align-self: end; }
.rcpt-barcode i.b5 { width: 3px; }
.rcpt-barcap { text-align: center; font-size: 10px; letter-spacing: .28em; color: #776d5c; margin-top: 4px; }
/* Status as a rubber stamp in the corner. */
.rcpt-stamp {
  position: absolute;
  right: 14px;
  top: 22px;
  z-index: 2;
  pointer-events: none;
  border: 2.5px solid currentColor;
  border-radius: 4px;
  padding: 3px 8px 2px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .16em;
  line-height: 1.2;
  transform: rotate(-16deg);
  opacity: .88;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset;
  background: rgba(251, 246, 235, .2);
  white-space: nowrap;
}
.rcpt-stamp.st-printing { color: #2b6cb0; }
.rcpt-stamp.st-ready { color: #b47f00; }
.rcpt-stamp.st-prep { color: #c2410c; }
.rcpt-stamp.st-shipped { color: #15803d; }
.rcpt-stamp.st-cancelled { color: #b42318; font-size: 18px; padding: 5px 10px; transform: rotate(-18deg); top: 36px; }
.rcpt.cancelled { filter: grayscale(.25); }
.rcpt.cancelled .d-name, .rcpt.cancelled .rcpt-shop { text-decoration: line-through; }
.ob-detail > .del-order { margin: 4px 10px 0; align-self: flex-start; }
/* Desktop: keep the measured drawer width, give the paper a little side room. */
@media (min-width: 721px) and (min-height: 501px), (min-width: 721px) and (pointer: fine) {
  .ob-detail { padding: 0 16px 32px; }
  .rcpt { padding: 22px 24px 18px; }
}
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .ob-detail { padding: 0 10px max(28px, env(safe-area-inset-bottom)); padding-top: 0; }
  /* Override the earlier sticky-on-d-head rule; chrome is the sticky unit. */
  .ob-detail .d-head { position: static; margin: 0; padding: 0; background: none; }
  .ob-detail .d-chrome { padding-top: max(12px, env(safe-area-inset-top)); }
  .rcpt .it-sub input, .rcpt .it-spec, .rcpt .it-name, .rcpt .it-qty { font-size: 16px !important; }
  .rcpt-shop { font-size: 14px; padding: 8px 36px 2px; }
  .rcpt-stamp { font-size: 13px; right: 8px; top: 16px; }
  .rcpt-stamp.st-cancelled { font-size: 16px; }
}
/* Receipt field extras: duration hint, contact, 备注, barcode overflow. */
.rcpt .f > .f-after { grid-column: 2; font-size: 12px; color: #776d5c; }
.rcpt .f > .f-after.red { color: #b42318; }
.rcpt .f.wide { grid-template-columns: 1fr; }
.rcpt .f.wide .fl { letter-spacing: .18em; }
.rcpt textarea.input, .rcpt .contact .input {
  border: 0;
  border-bottom: 1px dashed transparent;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 3px 0;
  min-width: 0;
  width: 100%;
  color: var(--rcpt-ink);
  font: inherit;
  resize: vertical;
}
.rcpt textarea.input:focus, .rcpt .contact .input:focus {
  border-bottom-color: var(--accent);
  outline: none;
  box-shadow: none;
}
.rcpt .contact summary {
  font-size: 12px;
  letter-spacing: .08em;
  color: #776d5c;
  padding: 4px 0;
}
.rcpt .contact .sum-hint { font-size: 12px; letter-spacing: 0; color: #776d5c; opacity: 1; }
.rcpt-barcode { overflow: hidden; flex-wrap: nowrap; }
.rcpt.cancelled { filter: none; }
.rcpt.cancelled .rcpt-shop { text-decoration: none; }
.rcpt-amt .f .input { font-family: var(--rcpt-num); font-variant-numeric: tabular-nums; text-align: right; }
.d-chrome .status-segs { background: color-mix(in srgb, #fff 45%, transparent); }
/* Fixes: checked ticks, empty placeholders, compact color/brand, amt alignment. */
.rcpt .it-row input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.rcpt .it-spec.empty { display: none; }
.rcpt .it:focus-within .it-spec.empty { display: block; }
.rcpt .it-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  justify-content: flex-start;
  min-width: 0;
}
.rcpt .it-sub input {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  field-sizing: content;
}
.rcpt .it-sub input::placeholder,
.rcpt .it-spec::placeholder,
.rcpt .it-qty::placeholder { color: transparent; }
.rcpt .it:focus-within .it-sub input::placeholder,
.rcpt .it:focus-within .it-spec::placeholder,
.rcpt .it:focus-within .it-qty::placeholder,
.rcpt .it:hover .it-sub input::placeholder,
.rcpt .it:hover .it-spec::placeholder { color: #c3bbaa; }
.rcpt-amt-lines {
  display: grid;
  justify-items: end;
  gap: 0;
  padding: 2px 0 0;
  font-size: 13px;
  color: #6f6758;
}
.rcpt-amt-line {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-width: 4em;
}
.rcpt-amt-line .op { color: #776d5c; }
.rcpt-amt-line .num { text-align: right; min-width: 3em; }
.ob-detail .d-chrome { box-shadow: 0 8px 14px -6px color-mix(in srgb, var(--rcpt-stage) 90%, #000); }
.rcpt textarea.input, .rcpt .contact .input { resize: none; field-sizing: content; }
/* 预备发货/已发货 with unticked items: quiet hint, status is not changed by ticks. */
.c-unfin { font-size: 11px; color: #a16207; background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; padding: 0 5px; line-height: 16px; white-space: nowrap; }
.rcpt-unfin { margin-left: 8px; font-size: 11px; letter-spacing: .04em; color: #a16207; border: 1px dashed #d6b45a; border-radius: 3px; padding: 0 4px; }
/* Empty 规格备注 opens only while typing in that item's own text fields — not when its checkbox
   (or a sub-item) has focus, which shifted the rows below mid-tap. */
.rcpt .it:focus-within .it-spec.empty { display: none; }
.rcpt .it-main:focus-within > .it-spec.empty { display: block; }
.rcpt .it:focus-within .it-sub input::placeholder,
.rcpt .it:focus-within .it-spec::placeholder,
.rcpt .it:focus-within .it-qty::placeholder { color: transparent; }
.rcpt .it-row:has(.it-main :focus, .it-qty:focus) .it-sub input::placeholder,
.rcpt .it-row:has(.it-main :focus, .it-qty:focus) .it-spec::placeholder,
.rcpt .it-row:has(.it-main :focus, .it-qty:focus) .it-qty::placeholder { color: #c3bbaa; }

/* ---------- board stats strip ---------- */
.ob-stats { display: flex; align-items: stretch; gap: 10px; padding: 0 16px 10px; flex: none; }
.st-tiles { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.st-tile { background: var(--card); border: 0; box-shadow: var(--card-shadow); border-radius: 16px; padding: 7px 12px 6px; min-width: 0; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name hint" "val val"; align-items: baseline; column-gap: 6px; }
.st-name { grid-area: name; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-hint { grid-area: hint; font-size: 11px; color: var(--muted); opacity: .8; white-space: nowrap; }
.st-val { grid-area: val; font-size: 14px; font-weight: 800; color: var(--accent-ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.st-tile[data-stat="unshipped"] .st-val { color: var(--heading); }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .ob-stats { flex-direction: column; gap: 4px; padding: 0 12px 8px; }
  .st-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .st-tile { padding: 5px 10px 4px; border-radius: 14px; }
  .st-val { font-size: 14px; }
}
@media (pointer: coarse) and (max-height: 500px) {
  .st-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ob-stats { flex-direction: row; }
}

/* ---------- 产品目录 ---------- */
.pd-tools .pd-search { flex: 1 1 220px; min-width: 0; max-width: 420px; }
.pd-banner { margin: 0 16px 10px; padding: 8px 12px; border-radius: var(--r-ctl); background: var(--sel-soft); color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 24px; overscroll-behavior: contain; }
.pd-count { font-size: 12px; color: var(--muted); padding: 2px 2px 8px; }
.pd-empty { padding: 60px 16px; text-align: center; color: var(--muted); display: grid; gap: 14px; justify-items: center; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.pd-card, .pd-row { border: 0; box-shadow: var(--card-shadow); background: var(--card); border-radius: var(--r-panel); padding: 0; text-align: left; cursor: pointer; color: var(--text); overflow: hidden; -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.pd-card { display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.pd-card:hover, .pd-row:hover { box-shadow: var(--card-shadow-hover); }
.pd-card:active { transform: scale(.985); }
.pd-thumb { position: relative; background: var(--sel-soft); display: grid; place-items: center; overflow: hidden; }
.pd-card .pd-thumb { aspect-ratio: 1 / 1; width: 100%; }
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pd-thumb.empty span { font-size: 34px; font-weight: 700; color: color-mix(in srgb, var(--muted) 55%, transparent); }
.pd-card-body { padding: 10px 12px 12px; display: grid; gap: 4px; min-width: 0; }
.pd-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-spec { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line; word-break: break-word; }
.pd-meta, .pd-row-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 2px; }
.pd-m { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.pd, .pd-back { -webkit-tap-highlight-color: transparent; }
.pd-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--sel); color: var(--chip-ink); font-size: 12px; font-weight: 600; white-space: nowrap; border: 0; }
.pd-list { display: grid; gap: 8px; }
.pd-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; width: 100%; }
.pd-thumb.sm { width: 56px; height: 56px; border-radius: 12px; flex: none; }
.pd-thumb.sm.empty span { font-size: 20px; }
.pd-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pd-row-main .pd-spec { -webkit-line-clamp: 1; }
.pd-row-meta { flex: none; justify-content: flex-end; max-width: 45%; margin: 0; }

/* drawer */
.pd-back { position: fixed; inset: 0; z-index: 40; background: rgba(60, 38, 18, .24); display: flex; justify-content: flex-end; }
.pd-drawer { width: min(460px, 100%); height: 100%; background: var(--card); box-shadow: var(--shadow); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.pd-dhead { position: sticky; top: 0; z-index: 3; background: var(--card); display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pd-dtitle { flex: 1; text-align: center; font-weight: 700; font-size: 14px; }
.pd-dspacer { width: 44px; }
.pd-form { display: grid; gap: 14px; padding: 16px 18px 40px; }
.pd-photo { position: relative; border-radius: var(--r-panel); background: var(--sel-soft); overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.pd-photo img { width: 100%; height: 100%; object-fit: contain; display: block; -webkit-user-drag: none; }
.pd-photo-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 15px; cursor: pointer; border: 1.5px dashed var(--line); border-radius: 12px; }
.pd-photo-actions { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.pd-photo:not(.has) .pd-photo-actions { position: static; display: none; }
.pd-photo-actions .btn { padding: 6px 12px; font-size: 14px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(6px); }
.pd-photo.busy::after { content: "处理中…"; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--card) 70%, transparent); font-size: 14px; }
.pd-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pd-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pd-time { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pd-unit { position: relative; display: flex; align-items: center; }
.pd-unit .input { padding-right: 46px; }
.pd-unit span { position: absolute; right: 11px; color: var(--muted); font-size: 14px; pointer-events: none; }
.pd-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.pd-chip.pick { cursor: pointer; background: var(--sel-soft); color: var(--text); font-weight: 500; padding: 4px 10px; }
.pd-chip.pick:hover { background: var(--sel); }
.pd-stamp { font-size: 12px; color: var(--muted); }
.pd-del { justify-self: start; padding: 8px 0; }
.pd-form input:disabled, .pd-form textarea:disabled { opacity: 1; -webkit-text-fill-color: currentColor; color: var(--text); background: var(--sel-soft); }
.pd-form input[type=number] { -moz-appearance: textfield; }
.pd-form input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pd-tools .pd-search { flex: 1 1 100%; max-width: none; }
  .pd-tools .pd-filament { flex: 1 1 auto; min-width: 0; }
  .pd-search, .pd-tools select, .pd-form .input { font-size: 16px; }
  .pd-body { padding: 0 12px 24px; -webkit-overflow-scrolling: touch; }
  .ob.ro .pd-body { padding-bottom: 56px; }
  .pd-banner { margin: 0 12px 8px; }
  .pd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pd-card-body { padding: 8px 10px 10px; }
  .pd-row-meta { display: none; }
  .pd-row-main .pd-meta { display: flex; }
  .pd-back { justify-content: stretch; }
  .pd-drawer { width: 100%; height: 100%; height: 100dvh; -webkit-overflow-scrolling: touch; }
  .pd-dhead { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .pd-dhead .link-btn { padding: 8px 10px; }
  .pd-form { padding: 14px 16px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) and (max-height: 500px) {
  .pd .pd-body { flex: none; overflow: visible; min-height: auto; }
  .pd-photo { aspect-ratio: 16 / 9; }
}
.pd-row-main .pd-meta { display: none; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) { .pd-row-main .pd-meta { display: flex; } }
/* 产品目录: 规格 (variants) in the product form */
.pd-sec { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 800; color: var(--heading); margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.pd-var-count { font-size: 12px; font-weight: 400; color: var(--muted); }
.pd-vars { display: grid; gap: 10px; }
.pd-var { border: 1px solid var(--line); border-radius: var(--r-card); padding: 10px 12px 12px; display: grid; gap: 10px; background: color-mix(in srgb, var(--sel-soft) 45%, var(--card)); }
.pd-var-head { display: flex; align-items: center; gap: 6px; min-height: 28px; }
.pd-var-n { font-size: 13px; font-weight: 700; color: var(--muted); flex: 1; }
.pd-var-tools { display: flex; gap: 2px; }
.pd-vbtn { min-width: 34px; padding: 4px 8px; font-size: 15px; }
.pd-vbtn:disabled { opacity: .3; cursor: default; background: none; }
.pd-row3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; }
.pd-var-empty { color: var(--muted); font-size: 14px; padding: 4px 0; }
.pd-vadd { justify-self: start; }
.pd-meta { row-gap: 3px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pd-row3 { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pd-vbtn { min-width: 40px; min-height: 36px; padding: 6px 10px; }
  .pd-vadd { justify-self: stretch; padding: 10px; }
}
/* 规格 v3: 耗材类型 per 规格, 打印时间 in minutes */
.pd-row3 { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); }
.pd-var .pd-sugg { margin-top: -4px; }
.pd-var .pd-chip.pick { background: var(--card); border: 1px solid var(--line); }
.pd-chip.pick.on { background: var(--sel); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.pd-unit .input[data-key=v_min] { padding-right: 52px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pd-row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pd-row3 .pd-f-fil { grid-column: 1 / -1; }
  .pd-var .pd-sugg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -12px; padding-right: 12px; }
  .pd-var .pd-sugg::-webkit-scrollbar { display: none; }
  .pd-var .pd-chip.pick { flex: none; padding: 6px 12px; font-size: 14px; }
}

/* ---------- 产品目录 v4: prominent product search, 搜索规格, big desktop editor ---------- */
.pd [hidden], .pd-back [hidden] { display: none !important; }
.pd-tools { flex-wrap: wrap; row-gap: 8px; }
.pd-tools .pd-searchbar { flex: 1 1 420px; min-width: 0; }
.pd-searchbar, .pd-vsearchbar { position: relative; display: flex; align-items: center; min-width: 0; }
.pd-search { width: 100%; height: 44px; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 128px 0 40px; font: inherit; font-size: 16px; color: var(--text); outline: none; box-shadow: 0 1px 2px rgba(0,0,0,.04); -webkit-appearance: none; appearance: none; }
.pd-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.pd-search::-webkit-search-cancel-button, .pd-vsearch::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.pd-sicon { position: absolute; left: 14px; top: 50%; width: 14px; height: 14px; margin-top: -8px; border: 2px solid var(--muted); border-radius: 50%; pointer-events: none; }
.pd-sicon::after { content: ""; position: absolute; width: 2px; height: 7px; background: var(--muted); right: -4px; bottom: -6px; transform: rotate(-45deg); border-radius: 1px; }
.pd-sclear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--sel-soft); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.pd-sclear:hover { background: var(--line); color: var(--text); }
.pd-searchbar .pd-sclear { right: 92px; }
.pd-searchbar .pd-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); padding: 0; white-space: nowrap; pointer-events: none; max-width: 80px; text-align: right; }
.pd-filters { display: flex; gap: 8px; align-items: center; flex: none; }
.pd-filters .pd-filament { height: 36px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pd-tools .pd-searchbar { flex: 1 1 100%; }
  .pd-filters { flex: 1 1 100%; }
  .pd-filters .pd-filament { flex: 1 1 auto; min-width: 0; }
  .pd-search { padding-right: 116px; }
  .pd-searchbar .pd-sclear { right: 84px; }
  .pd-searchbar .pd-count { max-width: 72px; }
}
/* Landscape phones scroll the whole page: keep the search on screen. */
@media (pointer: coarse) and (max-height: 500px) {
  .pd .pd-tools { position: sticky; top: 0; z-index: 4; background: var(--bg); padding-top: 6px; }
}

/* 搜索规格 */
.pd-sec { flex-wrap: wrap; align-items: center; row-gap: 8px; }
.pd-sec .pd-vsearchbar { margin-left: auto; flex: 0 1 320px; }
.pd-vsearch { height: 36px; padding: 0 38px 0 36px; border-radius: 10px; }
.pd-vsearchbar .pd-sicon { left: 12px; }
.pd-vsearchbar .pd-sclear { right: 5px; width: 26px; height: 26px; }
.pd-var-nomatch { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; display: grid; gap: 6px; justify-items: center; }
.pd-vhead { display: none; }
.pd-vlab { display: inline; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pd-sec .pd-vsearchbar { flex: 1 1 100%; margin-left: 0; }
  .pd-vsearch { height: 44px; font-size: 16px; }
}

/* Desktop: the product editor is a big centred panel, 规格 as a table. Phones keep the full-screen form. */
@media (min-width: 721px) and (min-height: 501px), (min-width: 721px) and (pointer: fine) {
  .pd-back { justify-content: center; align-items: center; padding: 3vh 2vw; background: rgba(60, 38, 18, .32); }
  .pd-drawer { width: min(1100px, 92vw); height: min(900px, 94vh); height: min(900px, 94dvh); border-radius: 22px; box-shadow: 0 24px 80px rgba(60, 38, 18, .28); }
  .pd-dhead { padding: 14px 22px; border-radius: 16px 16px 0 0; }
  .pd-dtitle { font-size: 14px; }
  .pd-form { padding: 22px 28px 40px; gap: 16px; }
  .pd-top { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
  .pd-top .pd-photo { aspect-ratio: 1 / 1; }
  .pd-topf { display: grid; gap: 14px; }
  .pd-topf textarea { min-height: 150px; }
  .pd-vbar { position: sticky; top: var(--dh, 52px); z-index: 2; background: var(--card); margin: 0 -28px; padding: 0 28px; box-shadow: 0 6px 8px -8px rgba(0,0,0,.18); }
  .pd-vbar .pd-sec { padding: 14px 0 10px; }
  .pd-vhead, .pd-var { display: grid; grid-template-columns: 30px minmax(0, 1.4fr) minmax(0, 1.05fr) 96px 112px minmax(0, 2fr) 112px; column-gap: 10px; }
  .pd-vhead { font-size: 12px; color: var(--muted); padding: 0 10px 8px; }
  .pd-vars { gap: 0; }
  .pd-var { grid-template-areas: "n name fil w m note tools" ". sugg sugg sugg sugg sugg ."; align-items: start; row-gap: 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 8px 10px; }
  .pd-var:hover, .pd-var:focus-within { background: color-mix(in srgb, var(--sel-soft) 60%, var(--card)); }
  .pd-var-head, .pd-row3 { display: contents; }
  .pd-var .fl, .pd-vlab { display: none; }
  .pd-var-n { grid-area: n; align-self: center; text-align: center; font-variant-numeric: tabular-nums; }
  .pd-var-tools { grid-area: tools; align-self: center; justify-content: flex-end; }
  .pd-f-name { grid-area: name; } .pd-f-fil { grid-area: fil; } .pd-f-w { grid-area: w; } .pd-f-m { grid-area: m; } .pd-f-note { grid-area: note; }
  .pd-var .input { padding: 7px 9px; font-size: 14px; }
  .pd-var .pd-unit .input { padding-right: 30px; }
  .pd-var .pd-unit .input[data-key=v_min] { padding-right: 40px; }
  .pd-var .pd-unit span { right: 8px; font-size: 12px; }
  .pd-var textarea.input { min-height: 34px; height: 34px; resize: vertical; field-sizing: content; max-height: 160px; line-height: 1.35; }
  .pd-var .pd-sugg { grid-area: sugg; display: none; margin: 0; }
  .pd-var.fil-focus .pd-sugg { display: flex; }
  .pd-var .pd-vbtn { min-width: 28px; padding: 4px 6px; }
  .pd-vadd { margin-top: 4px; }
}
.pd-tools .pd-searchbar .pd-search { max-width: none; flex: 1 1 auto; }
/* search box: room on the right for the count, plus the × while there is a query */
.pd-search { padding-right: 64px; }
.pd-searchbar .pd-sclear { right: 58px; }
.pd-searchbar.has-q .pd-search { padding-right: 100px; }
.pd-searchbar .pd-count { max-width: 56px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pd-search { padding: 0 54px 0 38px; }
  .pd-searchbar.has-q .pd-search { padding-right: 96px; }
  .pd-searchbar .pd-sclear { right: 54px; }
  .pd-searchbar .pd-count { right: 10px; max-width: 48px; }
  .pd-search::placeholder { font-size: 15px; }
}

/* ----- 编辑痕迹 tooltip + 编辑记录 panel ----- */
.mark-tip { position: fixed; z-index: 80; background: var(--toast); color: #fff7ea; font-size: 13px; padding: 6px 12px; border-radius: 999px; box-shadow: 0 6px 18px rgba(60, 38, 18, .28); pointer-events: none; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.mark-tip[hidden] { display: none !important; }
.mark-tip .mt-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mark-tip .mt-time { color: #f3dcbb; }
.attr-hl { cursor: help; }
.hx-back { position: fixed; inset: 0; z-index: 45; background: rgba(60, 38, 18, .32); display: flex; align-items: center; justify-content: center; padding: 4vh 2vw; -webkit-tap-highlight-color: transparent; }
.hx { width: min(1040px, 94vw); height: min(780px, 90vh); background: var(--card); border-radius: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.hx-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.hx-head b { font-size: 14px; font-weight: 800; color: var(--heading); }
.hx-sub { color: var(--muted); font-size: 13px; flex: 1; }
.hx-x { border: 0; background: none; color: var(--accent-ink, var(--accent)); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.hx-body { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.hx-list { background: var(--list); border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.hx-foot { margin-top: auto; padding: 10px 6px 4px; }
.hx-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-card); text-align: left; cursor: pointer; color: var(--text); font: inherit; width: 100%; }
.hx-item:hover { background: var(--sel-soft); }
.hx-item.on { background: var(--card); box-shadow: var(--card-shadow), 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.hx-item.new { box-shadow: inset 3px 0 0 var(--accent); }
.hx-meta { display: grid; gap: 1px; flex: 1; min-width: 0; }
.hx-who { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.hx-meta small { color: var(--muted); font-size: 12.5px; }
.hx-sum .plus, .hx-sumbig .plus { color: #1a7f37; font-weight: 600; }
.hx-sum .minus, .hx-sumbig .minus { color: #cf222e; font-weight: 600; }
.hx-chev { color: var(--muted); font-size: 18px; }
.hx-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hx-dhead { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.hx-dmeta { display: grid; }
.hx-dmeta small { color: var(--muted); }
.hx-backbtn { display: none; border: 0; background: none; color: var(--accent-ink, var(--accent)); font: inherit; cursor: pointer; padding: 4px 0; }
.hx-bar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; flex-wrap: wrap; }
.hx-sumbig { font-size: 14px; flex: 1; white-space: nowrap; }
.hx-line.head .hx-text { font-weight: 700; }
.hx-dbody { flex: 1; overflow: auto; padding: 0 18px 18px; }
.hx-empty { color: var(--muted); padding: 28px 18px; line-height: 1.6; }
.hx-diff { font-size: 14.5px; line-height: 1.6; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); overflow: hidden; }
.hx-line { display: flex; gap: 8px; padding: 1px 10px 1px 0; white-space: pre-wrap; word-break: break-word; }
.hx-sign { width: 22px; flex: none; text-align: center; color: var(--muted); user-select: none; }
.hx-text { flex: 1; min-width: 0; }
.hx-line.add { background: rgba(26, 127, 55, .10); }
.hx-line.add .hx-sign { color: #1a7f37; }
.hx-line.del { background: rgba(207, 34, 46, .08); }
.hx-line.del .hx-sign { color: #cf222e; }
.hx-line.chg { background: rgba(212, 167, 44, .08); }
.hx-diff ins { text-decoration: none; background: rgba(26, 127, 55, .22); color: #116329; border-radius: 3px; }
.hx-diff del { text-decoration: line-through; background: rgba(207, 34, 46, .16); color: #a40e26; border-radius: 3px; }
.hx-fold { display: block; width: 100%; border: 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); background: var(--sel-soft); color: var(--muted); font: inherit; font-size: 13px; padding: 4px 10px; text-align: left; cursor: pointer; }
.hx-full .hx-line { padding-left: 10px; }
.hx-full .hx-sign { display: none; }
@media (prefers-color-scheme: dark) {
  .hx-diff ins { color: #7ee2a0; } .hx-diff del { color: #ff9a9f; }
  .hx-sum .plus, .hx-sumbig .plus { color: #4ac26b; } .hx-sum .minus, .hx-sumbig .minus { color: #ff7b72; }
}
@media (max-width: 760px) {
  .hx-back { padding: 0; }
  .hx { width: 100vw; height: 100dvh; border-radius: 0; }
  .hx-sub { display: none; }
  .hx-head b { flex: 1; }
  .hx-body { grid-template-columns: 1fr; }
  .hx-list { border-right: 0; }
  .hx-detail { display: none; }
  .hx.show-detail .hx-list { display: none; }
  .hx.show-detail .hx-detail { display: flex; }
  .hx.show-detail .hx-head { display: none; }
  .hx-backbtn { display: inline; margin-right: 4px; }
  .hx-dhead { flex-wrap: wrap; padding: 10px 14px; }
  .hx-dhead .hx-backbtn { width: 100%; text-align: left; }
  .hx-bar { padding: 10px 14px; }
  .hx-dbody { padding: 0 10px 18px; }
  .hx-diff { font-size: 15px; }
}

/* ----- 已发货 orders inside a linked note (decorations only) ----- */
.ProseMirror .ord-shipped { color: var(--ship-ink); background: var(--ship-bg); margin-top: 0; margin-bottom: 0; padding-left: 10px; padding-right: 10px; }
.ProseMirror .ord-shipped.ord-ship-head { border-radius: var(--r-card) var(--r-card) 0 0; padding-top: 6px; margin-top: 6px; }
.ProseMirror .ord-shipped.ord-ship-last { border-radius: 0 0 var(--r-card) var(--r-card); padding-bottom: 6px; margin-bottom: 6px; }
.ProseMirror .ord-shipped.ord-ship-head.ord-ship-last { border-radius: var(--r-card); }
.ProseMirror .ord-shipped:not(.ord-ship-last) { box-shadow: 0 6px 0 var(--ship-bg); position: relative; z-index: 0; }
.ProseMirror .ord-shipped mark { opacity: .6; }
.ProseMirror .ord-shipped input[type=checkbox] { opacity: .55; }
.ProseMirror .ord-ship-hidden { display: none !important; }
.ProseMirror .ord-ship-head:has(+ .ord-ship-hidden) { border-radius: var(--r-card); padding-bottom: 6px; margin-bottom: 6px; box-shadow: none; }
.ship-w { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; vertical-align: 1px; user-select: none; white-space: nowrap; }
.ship-badge { display: inline-block; background: #e6f4ea; color: #1a7f37; border: 1px solid #b7e1c1; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; }
.ship-toggle { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.ship-toggle:hover { background: rgba(0,0,0,.06); color: var(--text); }
@media (prefers-color-scheme: dark) {
  .ship-badge { background: #12361f; color: #6fdd8b; border-color: #1f5c33; }
}
@media (pointer: coarse) { .ship-toggle { padding: 6px 8px; font-size: 13px; } }

/* ---------- 耗材记录 ---------- */
.fm-tools { flex-wrap: wrap; }
.fm-tools .pd-searchbar { flex: 1 1 340px; }
.fm-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fm-filter { height: 36px; max-width: 170px; }
.fm-sum { padding: 0 16px 10px; flex: none; }
.fm-sum .st-tile[data-stat="using"] .st-val { color: var(--fm-using-ink); }
.fm-sum .st-tile[data-stat="sealed"] .st-val { color: var(--heading); }
.fm, .fm-drawer { --fm-using-bg: #dcfce7; --fm-using-ink: #15803d; --fm-using-bar: #3fa45f; --fm-ret-bg: #ece7f3; --fm-ret-ink: #5e4f7d; --fm-ret-bar: #a89cc4; --fm-empty-bg: #efe7dc; --fm-empty-ink: #6b5643; }
@media (prefers-color-scheme: dark) { .fm, .menu, .fm-drawer { --fm-using-bg: #1d3826; --fm-using-ink: #86e0a5; --fm-using-bar: #4fbf75; --fm-ret-bg: #2f2a3a; --fm-ret-ink: #c9bde3; --fm-ret-bar: #7f73a0; --fm-empty-bg: #322a22; --fm-empty-ink: #c2ad93; } }
.fm-st { display: inline-flex; align-items: center; gap: 3px; border: 0; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--sel-soft); color: var(--chip-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chip-ink) 18%, transparent); }
button.fm-st { cursor: pointer; }
button.fm-st::after { content: ""; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4.5px solid currentColor; opacity: .7; }
button.fm-st:hover { filter: brightness(.97); box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 22%, transparent); }
.fm-st.st-using { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.fm-st.st-empty { background: var(--fm-empty-bg); color: var(--fm-empty-ink); box-shadow: none; }
/* 已退货: its own muted lilac; the row dims and the price is struck through (refunded, not in 总花费) */
.fm-st.st-returned { background: var(--fm-ret-bg); color: var(--fm-ret-ink); box-shadow: none; }
.fm-status .seg.on.st-returned { color: var(--fm-ret-ink); }
.fm-sum .fm-ret-hint { color: var(--fm-ret-ink); opacity: 1; font-weight: 600; }
.fm-empty .btn { margin-top: 2px; }
/* form */
/* edit form: header with name + status, grouped sections, coloured status pills, sticky footer */
.fm-drawer { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.fm-fhead { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.fm-hmain { flex: 1; min-width: 0; display: grid; gap: 7px; }
.fm-htitle { font-size: 14px; font-weight: 800; color: var(--heading); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-hsub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; min-height: 22px; }
.fm-hbrand { font-weight: 700; color: var(--accent-ink); }
.fm-hnew { color: var(--muted); }
.fm-x { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--sel-soft); color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.fm-x:hover { background: var(--line); color: var(--text); }
.fm-drawer .fm-form { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 12px; padding: 16px 20px 20px; }
.fm-sec { background: var(--card); border-radius: var(--r-panel); box-shadow: var(--card-shadow); padding: 12px 16px 16px; display: grid; gap: 12px; }
.fm-sec-t { margin: 0; font-size: 13px; font-weight: 800; color: var(--heading); letter-spacing: .04em; }
.fm-fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fm-fl { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-height: 18px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fm-fl label { cursor: default; }
.fm-mng { font-size: 12px; font-weight: 700; padding: 0 2px; color: var(--accent-ink); }
.fm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fm-grid3 { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 12px; }
.fm-form .input { height: 42px; border-radius: var(--r-ctl); background-color: var(--card); }
.fm-form textarea.input { height: auto; min-height: 88px; resize: vertical; line-height: 1.5; padding-top: 9px; }
.fm-form select.input.fm-sel { appearance: none; -webkit-appearance: none; padding: 0 32px 0 11px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.fm-unit { position: relative; display: flex; align-items: center; }
.fm-unit .input { width: 100%; padding-right: 34px; font-variant-numeric: tabular-nums; }
.fm-unit.pre .input { padding-left: 28px; padding-right: 10px; }
.fm-u { position: absolute; right: 12px; color: var(--muted); font-size: 14px; font-weight: 600; pointer-events: none; }
.fm-unit.pre .fm-u { right: auto; left: 12px; }
.fm-form input[type=date] { min-height: 42px; font-variant-numeric: tabular-nums; }
.fm-form input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }
@media (prefers-color-scheme: dark) { .fm-form input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.85); } }
.fm-form input[type=number] { -moz-appearance: textfield; }
.fm-form input[type=number]::-webkit-inner-spin-button, .fm-form input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fm-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; background: none; padding: 0; }
.fm-status .seg { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; border-radius: 999px; background: var(--card); color: var(--muted); font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--line); }
.fm-status .seg:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, var(--line)); }
.fm-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.fm-status .seg.st-sealed { --pc: var(--chip-ink); --pb: var(--sel-soft); }
.fm-status .seg.st-using { --pc: var(--on-accent); --pb: var(--accent); }
.fm-status .seg.st-empty { --pc: var(--fm-empty-ink); --pb: var(--fm-empty-bg); }
.fm-status .seg.st-returned { --pc: var(--fm-ret-ink); --pb: var(--fm-ret-bg); }
.fm-status .seg.on { background: var(--pb); color: var(--pc); font-weight: 800; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 45%, transparent); }
.fm-status .seg.on .fm-dot { opacity: 1; }
.fm-stamp { padding: 0 4px; }
.fm-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; background: var(--card); border-top: 1px solid var(--line); }
.fm-foot-r { display: flex; gap: 10px; }
.fm-foot .btn { min-width: 88px; height: 40px; }
.fm-del { font-weight: 700; padding: 8px 4px; }
.fm-form select:disabled, .fm-form .input:disabled { opacity: 1; -webkit-text-fill-color: currentColor; color: var(--text); background-color: var(--sel-soft); }
.fm-form select.input.fm-sel:disabled { background-image: none; }
/* 品牌 / 类型 panel */
.fm-opts-back { z-index: 45; }
.fm-opts-body { display: grid; gap: 12px; padding: 14px 18px 24px; }
.fm-opts-tabs { width: 100%; display: flex; }
.fm-opts-tabs .seg { flex: 1; padding: 8px; }
.fm-opts-hint { font-size: 12px; color: var(--muted); }
.fm-opts { display: grid; gap: 6px; }
.fm-opt { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; background: var(--list); border-radius: var(--r-ctl); padding: 6px 6px 6px 12px; }
.fm-opt-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-opt-n { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fm-opt-tools { display: flex; gap: 0; }
.fm-opt-tools .link-btn { padding: 6px 8px; font-size: 13px; }
.fm-opt-tools .link-btn:disabled { opacity: .3; }
.fm-opts-empty { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }
.fm-opt-addrow { display: flex; gap: 8px; }
.fm-opt-addrow .input { flex: 1; min-width: 0; }
@media (min-width: 721px) and (min-height: 501px), (min-width: 721px) and (pointer: fine) {
  .fm-drawer, .fm-optpanel { width: min(620px, 92vw); height: auto; max-height: 92vh; max-height: 92dvh; }
  .fm-optpanel { width: min(520px, 92vw); }
  .fm-drawer { width: min(640px, 92vw); }
  .fm-drawer .fm-form { padding: 18px 24px 22px; }
  .fm-fhead { padding: 18px 24px 14px; }
  .fm-foot { padding: 12px 24px; border-radius: 0 0 22px 22px; }
}
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .fm-tools .pd-searchbar { flex: 1 1 100%; }
  .fm-filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 6px; }
  .fm-filter { max-width: none; width: 100%; min-width: 0; height: 40px; font-size: 16px; }
  .fm-sum { padding: 0 12px 8px; }
  .fm-st { padding: 6px 12px; font-size: 13px; }
  .fm-grid3 { grid-template-columns: 1fr 1fr; }
  .fm-grid3 > :last-child { grid-column: 1 / -1; }
  .fm-grid2 { gap: 10px; }
  .fm-fhead { padding: 12px 16px 12px; padding-top: max(12px, env(safe-area-inset-top)); }
  .fm-htitle { font-size: 14px; }
  .fm-drawer .fm-form { padding: 12px 12px 16px; gap: 10px; }
  .fm-sec { padding: 12px 14px 14px; }
  .fm-form .input { height: 46px; }
  .fm-form textarea.input { height: auto; }
  .fm-status { grid-template-columns: 1fr 1fr; }
  .fm-status .seg { padding: 11px 6px; font-size: 15px; }
  .fm-foot { padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .fm-foot .btn { height: 44px; min-width: 96px; font-size: 16px; }
  .fm-form select, .fm-form .input, .fm-opt-addrow .input { font-size: 16px; }
  .fm-opt-tools .link-btn { padding: 8px 9px; }
  .fm-opts-body { padding: 12px 14px max(24px, env(safe-area-inset-bottom)); }
}


/* 耗材 cards: spool icon, name + 品牌 · 类型, big remaining weight + status pill, progress bar, price footer */
.fm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.fm-card { background: var(--card); border-radius: var(--r-panel); box-shadow: var(--card-shadow); padding: 14px 16px 12px; cursor: pointer; color: var(--text); display: grid; gap: 10px; min-width: 0;
  transition: box-shadow .15s, transform .15s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; --sp: var(--accent); --sp-bg: var(--sel-soft); --bar: var(--accent); }
.fm-card:hover { box-shadow: var(--card-shadow-hover); }
.fm-card:active { transform: scale(.99); }
.fm-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fm-ctop { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.fm-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--sp-bg); display: grid; place-items: center; }
.fm-spool { width: 34px; height: 34px; }
.fm-spool .sp-flange { fill: color-mix(in srgb, var(--sp) 30%, var(--card)); stroke: color-mix(in srgb, var(--sp) 70%, #000 10%); stroke-width: 1.4; }
.fm-spool .sp-wind { fill: var(--sp); }
.fm-spool .sp-line { fill: none; stroke: color-mix(in srgb, var(--sp) 55%, #000 25%); stroke-width: .7; opacity: .55; }
.fm-spool .sp-hub { fill: var(--card); stroke: color-mix(in srgb, var(--sp) 70%, #000 10%); stroke-width: 1.2; }
.fm-spool .sp-hole { fill: color-mix(in srgb, var(--sp) 45%, var(--card)); }
.fm-spool .sp-end { fill: none; stroke: var(--sp); stroke-width: 1.6; stroke-linecap: round; }
.fm-main { min-width: 0; display: grid; gap: 3px; align-content: start; padding-top: 2px; }
.fm-name { font-weight: 800; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-note { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-cright { display: grid; justify-items: end; gap: 6px; }
.fm-rem { font-size: 14px; font-weight: 800; line-height: 1.1; color: var(--heading); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.fm-prog { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.fm-bar { height: 8px; border-radius: 999px; background: var(--sel-soft); overflow: hidden; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent); }
.fm-bar i { display: block; height: 100%; border-radius: inherit; background: var(--bar); min-width: 0; transition: width .2s; }
.fm-pct { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.fm-cfoot { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; align-items: center; gap: 6px; min-height: 30px; }
.fm-cfoot-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-more { flex: none; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; width: 32px; height: 26px; margin: -4px -6px -4px 0; border-radius: 8px; cursor: pointer; display: grid; place-items: center; letter-spacing: 1px; }
.fm-more:hover, .fm-more:focus-visible { background: var(--sel-soft); color: var(--accent-ink); }
@media (pointer: coarse) { .fm-more { width: 44px; height: 36px; margin: -9px -10px -9px 0; } }
.fm-foot-l { display: flex; align-items: center; gap: 6px; }
.fm-hcopy { color: var(--chip-ink); font-weight: 600; }
.fm-card.st-sealed { --sp: #e9b06e; --bar: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.fm-card.st-using { --sp: var(--accent); --sp-bg: var(--sel); }
.fm-card.st-empty { --sp: #b9a68f; --sp-bg: var(--fm-empty-bg); --bar: #b9a68f; }
.fm-card.st-returned { --sp: var(--fm-ret-bar); --sp-bg: var(--fm-ret-bg); --bar: var(--fm-ret-bar); }
.fm-card.st-empty .fm-rem, .fm-card.st-returned .fm-rem, .fm-card.st-returned .fm-name { color: var(--muted); }
.fm-card.st-returned .fm-cfoot-t { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.fm-remhint { font-size: 12px; font-weight: 700; color: var(--accent-ink); }
.fm-perg { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 16px; margin-top: -4px; }
@media (max-width: 1180px) and (min-width: 721px) { .fm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .fm-grid { grid-template-columns: 1fr; gap: 10px; }
  .fm-card { padding: 12px 14px 10px; }
  .fm-st { padding: 6px 12px; font-size: 13px; }
  .fm-rem { font-size: 14px; }
}
@media (pointer: coarse) and (max-height: 500px) { .fm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 打印管理 nav group */
.pm-sep { margin-top: 6px; }
.print-link .count { font-size: 11px; }
/* ---------- 打印设置: existing parts (ob-head, st-tiles, fm-sec, fm-fld, btn, pd-row, pill); only layout glue here ---------- */
.ps .ps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.ps .fm-sec .input { height: 42px; border-radius: var(--r-ctl); }
.ps-elec { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.ps-elec::-webkit-inner-spin-button, .ps-elec::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ps .ps-unit-w .input { padding-right: 82px; }
.ps .ps-tok-w .input { padding-right: 46px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ps-eye { position: absolute; right: 4px; width: 36px; height: 34px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.ps-eye:hover, .ps-eye.on { color: var(--accent-ink); background: var(--sel-soft); }
.ps-svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ps-hint { margin: -4px 0 0; line-height: 1.55; }
.ps-prev { margin: 0; }
.ps-prev-v { color: var(--accent-ink); font-size: 13px; }
.ps-state-v { font-size: 12px; color: var(--muted); font-weight: 600; }
.ps-state-v.on { color: var(--chip-ink); }
.ps-act { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.ps-act .btn { min-width: 112px; height: 40px; }
.ps-list-sec { margin-top: 18px; display: grid; gap: 8px; }
.ps-list-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 2px; }
.ps-count { color: var(--muted); font-weight: 600; }
.ps-list-sec.busy .ps-list { opacity: .55; }
.ps .ps-pr { cursor: default; user-select: text; }
.ps-pr-ic { color: var(--heading); }
.ps-pr-ic .ps-svg { width: 24px; height: 24px; }
.ps-err { margin: 0; color: #a42a20; background: #fdecea; }
@media (prefers-color-scheme: dark) { .ps-err { color: #ffb4a8; background: #3a1f1b; } }
.ps-empty { padding: 36px 16px; background: var(--card); border-radius: var(--r-panel); box-shadow: var(--card-shadow); }
.ps-online { font-size: 12px; font-weight: 700; padding: 2px 10px; }
.ps-online.off { color: #6b5643; }
@media (prefers-color-scheme: dark) { .ps-online.off { color: #d1bca0; } }
@media (max-width: 900px) { .ps .ps-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .ps .fm-sec .input { height: 46px; font-size: 16px; }
  .ps-act .btn { flex: 1; height: 46px; }
  .ps-act .ps-clear { padding: 10px 14px; }
}

/* 导入 JSON report */
.fm-imp-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.fm-imp-err { margin-top: 10px; padding: 8px 10px; border-radius: var(--r-ctl); background: var(--sel-soft); color: var(--danger); font-size: 13px; display: grid; gap: 2px; }

/* ---------- 打印记录: fm-card cards, fm-st pills, st-tiles summary; layout glue only ---------- */
.pr { --pr-done-bg: #dcfce7; --pr-done-ink: #15803d; --pr-fail-bg: #fdecea; --pr-fail-ink: #a42a20; --fm-empty-bg: #efe7dc; --fm-empty-ink: #6b5643; }
@media (prefers-color-scheme: dark) { .pr { --pr-done-bg: #1d3826; --pr-done-ink: #86e0a5; --pr-fail-bg: #3a1f1b; --pr-fail-ink: #ffb4a8; --fm-empty-bg: #322a22; --fm-empty-ink: #c2ad93; } }
.pr-tools .pr-device { max-width: 300px; min-width: 180px; height: 36px; }
.pr-body { display: grid; align-content: start; }
.pr-list-sec { display: grid; gap: 10px; }
/* one record per row on every screen size (like the reference), full width */
.pr-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.pr-card { cursor: default; gap: 10px; }
.pr-card:active { transform: none; }
.pr-card:hover { box-shadow: var(--card-shadow); }
.pr-ic { color: var(--heading); }
.pr-ic .ps-svg { width: 26px; height: 26px; }
.pr-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.pr-plate { color: var(--chip-ink); font-weight: 600; }
.pr-when { font-variant-numeric: tabular-nums; }
.fm-st.pr-st.st-printing { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.fm-st.pr-st.st-done { background: var(--pr-done-bg); color: var(--pr-done-ink); box-shadow: none; }
.fm-st.pr-st.st-failed { background: var(--pr-fail-bg); color: var(--pr-fail-ink); box-shadow: none; }
.fm-st.pr-st.st-cancelled, .fm-st.pr-st.st-unknown { background: var(--fm-empty-bg); color: var(--fm-empty-ink); box-shadow: none; }
.pr-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-stat { display: inline-flex; align-items: center; gap: 5px; }
.pr-i-sm { width: 15px; height: 15px; }
.pr-mats { background: var(--list); border-radius: var(--r-card); padding: 10px 12px 12px; display: grid; gap: 8px; }
.pr-mats-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 700; }
.pr-linked.all { color: var(--pr-done-ink); }
.pr-mat { display: grid; grid-template-columns: 12px auto auto minmax(0, 1fr); align-items: center; gap: 8px; background: var(--card); border-radius: var(--r-ctl); padding: 3px 3px 3px 12px; box-shadow: inset 0 0 0 1px var(--line); }
.pr-mat.linked { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, var(--line)); }
.pr-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.pr-dot.none { background: repeating-linear-gradient(45deg, var(--line) 0 2px, transparent 2px 4px); }
.pr-type { font-size: 13px; font-weight: 600; white-space: nowrap; }
.pr-w { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--heading); }
.pr-pick { appearance: none; border: 0; height: 34px; width: 100%; min-width: 0; border-radius: 10px; padding: 0 28px 0 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-align: left; display: flex; align-items: center; position: relative; background: var(--card); }
.pr-pick::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: translateY(-65%) rotate(-45deg); }
.pr-pick.on { color: var(--text); font-weight: 600; }
.pr-pick-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-pick:hover:not(:disabled) { background: var(--sel-soft); }
.pr-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.pr-pick:disabled { cursor: progress; }
.pr-cost { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.pr-c-k { font-size: 12px; color: var(--muted); }
.pr-c-v { font-weight: 800; color: var(--heading); font-variant-numeric: tabular-nums; }
.pr-c-v.pending { color: var(--chip-ink); }
.pr-c-elec { text-align: center; }
.pr-c-known { text-align: right; }
.pr-c-note { margin-top: -4px; }
.pr-more-w { display: flex; justify-content: center; padding: 8px 0 4px; }
.pr-more { min-width: 220px; height: 42px; }
.pr-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: pr-spin .8s linear infinite; flex: none; }
@keyframes pr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pr-spin { animation: none; } }
.pr-syncing { color: var(--chip-ink); font-weight: 600; }
.pr-err .link-btn, .pr-hint .link-btn { margin-left: auto; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pr-tools .pr-device { max-width: none; width: 100%; height: 44px; font-size: 16px; }
  .pr-grid { gap: 10px; }
  .pr-mat { grid-template-columns: 12px auto minmax(0, 1fr); padding: 6px 4px 4px 12px; row-gap: 4px; }
  .pr-mat .pr-w { justify-self: end; padding-right: 8px; }
  .pr-mat .pr-pick { grid-column: 1 / -1; height: 44px; font-size: 16px; background: var(--list); }
  .pr-more { width: 100%; height: 46px; font-size: 16px; }
}

/* ---------- 关联库存耗材 picker: dialog on desktop, bottom sheet on phones ---------- */
.pk-back { position: fixed; inset: 0; z-index: 60; background: rgba(60, 40, 20, .38); display: grid; place-items: center; padding: 16px; animation: pk-fade .15s ease-out; }
@keyframes pk-fade { from { opacity: 0; } }
.pk-sheet { --sp: var(--accent); --sp-bg: var(--sel-soft); width: min(640px, 100%); height: min(860px, 92vh); height: min(860px, 92dvh); background: var(--bg); border-radius: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; color: var(--text); }
.pk-grab { display: none; }
.pk-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 10px; }
.pk-title { margin: 0; font-size: 14px; font-weight: 800; color: var(--heading); }
.pk-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pk-x { width: 40px; height: 40px; font-size: 24px; }
.pk-usage { flex: none; margin: 0; display: flex; align-items: center; gap: 8px; background: var(--sel); color: var(--chip-ink); border-radius: var(--r-ctl); padding: 8px 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.pk-u-type { font-weight: 700; }
.pk-u-w { margin-left: auto; white-space: nowrap; }
.pk-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 12px; display: flex; flex-direction: column; gap: 10px; }
.pk-searchbar { flex: none; position: relative; display: flex; align-items: center; }
.pk-searchbar .pd-sicon { position: absolute; left: 12px; }
.pk-search { width: 100%; height: 42px; border-radius: var(--r-ctl); padding-left: 36px; background: var(--card); }
.pk-filters { flex: none; background: var(--list); border-radius: var(--r-panel); padding: 10px 12px 12px; display: grid; gap: 8px; }
.pk-frow { display: grid; gap: 6px; min-width: 0; }
.pk-fl { font-size: 12px; font-weight: 700; color: var(--muted); }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chip { border: 0; border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 600; background: var(--card); color: var(--text); cursor: pointer; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line); }
.pk-chip:hover { background: var(--sel-soft); }
.pk-chip.on { background: #5a4029; color: #fff8ec; box-shadow: none; }
@media (prefers-color-scheme: dark) { .pk-chip.on { background: #f0d3a8; color: #2b1d10; } }
.pk-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pk-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.pk-count { font-weight: 700; }
.pk-sort { font-size: 13px; padding: 4px 2px; }
.pk-list { display: grid; gap: 8px; }
.pk-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--card); border-radius: var(--r-card); padding: 10px 12px; box-shadow: var(--card-shadow); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pk-row:hover { box-shadow: var(--card-shadow-hover); }
.pk-row.on { box-shadow: inset 0 0 0 2px var(--accent), var(--card-shadow); }
.pk-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--sp-bg); display: grid; place-items: center; }
.pk-ic .fm-spool { width: 30px; height: 30px; }
.pk-row.st-sealed { --sp: #e9b06e; }
.pk-row.st-using { --sp: var(--accent); --sp-bg: var(--sel); }
.pk-row.st-empty { --sp: #b9a68f; --sp-bg: #efe7dc; }
.pk-row.st-returned { --sp: #a89cc4; --sp-bg: #ece7f3; }
.pk-main { display: grid; gap: 2px; min-width: 0; }
.pk-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-type { font-weight: 500; color: var(--muted); }
.pk-sub, .pk-st { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-row.cur .pk-st { color: var(--chip-ink); font-weight: 600; }
.pk-right { display: grid; justify-items: end; gap: 6px; }
.pk-radio { width: 20px; height: 20px; margin: 0; accent-color: var(--accent-ink); pointer-events: none; }
.pk-rem { font-weight: 800; color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk-empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.pk-foot { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); border-top: 1px solid var(--line); }
.pk-sum { flex: 1; min-width: 0; }
.pk-sum-t { font-weight: 800; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-sum-s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-ok { min-width: 112px; height: 42px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pk-back { padding: 0; place-items: end stretch; }
  .pk-sheet { width: 100%; height: 92vh; height: 92dvh; border-radius: 22px 22px 0 0; animation: pk-up .2s ease-out; }
  @keyframes pk-up { from { transform: translateY(40px); opacity: .6; } }
  .pk-grab { display: block; flex: none; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
  .pk-head { padding: 10px 16px 8px; }
  .pk-title { font-size: 14px; }
  .pk-x { width: 44px; height: 44px; }
  .pk-body { padding: 0 16px 12px; gap: 8px; }
  .pk-search { height: 44px; font-size: 16px; }
  /* filters wrap onto as many lines as they need (no inner scrolling); the sheet body scrolls as a whole */
  .pk-filters { padding: 10px 12px 12px; gap: 8px; }
  .pk-chip { padding: 9px 14px; font-size: 14px; }
  .pk-foot { padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .pk-ok { height: 46px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .pk-back, .pk-sheet { animation: none; } }

/* ---------- 打印统计 (/print/stats) ---------- */
.pst-tools { flex-wrap: wrap; row-gap: 8px; }
.pst-nav { display: flex; align-items: center; gap: 6px; }
.pst-nav .btn { width: 36px; height: 36px; padding: 0; font-size: 20px; line-height: 1; color: var(--accent-ink); display: grid; place-items: center; }
.pst-tools .ob-filter { height: 36px; font-size: 14px; }
.pst-tools .pst-device { margin-left: auto; min-width: 160px; max-width: 280px; }
.pst-note { padding: 8px 2px 0; line-height: 1.5; }
.pst-sum .st-tile[data-stat="time"] .st-val { color: var(--heading); }
.pst .st-val { overflow: visible; text-overflow: clip; }
.pst-body { display: grid; align-content: start; gap: 14px; transition: opacity .15s; }
.pst.busy .pst-body, .pst.busy .pst-sum { opacity: .55; }
.pst-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pst-metrics .seg { font-size: 13px; padding: 4px 10px; }
.pst-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; height: 200px; align-items: stretch; }
.pst-chart.pst-c-month { gap: 3px; }
.pst-col { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; display: grid; grid-template-rows: 1fr auto; gap: 6px; min-width: 0; border-radius: 8px; }
button.pst-col { cursor: pointer; }
button.pst-col:hover .pst-bar-w { background: var(--sel-soft); }
button.pst-col:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pst-bar-w { display: flex; align-items: flex-end; border-radius: 8px 8px 4px 4px; background: color-mix(in srgb, var(--sel-soft) 55%, transparent); min-height: 0; }
.pst-bar { width: 100%; background: var(--accent); border-radius: 8px 8px 4px 4px; transition: height .2s ease-out; }
.pst-c-month .pst-bar, .pst-c-month .pst-bar-w { border-radius: 4px 4px 2px 2px; }
.pst-lab { font-size: 12px; color: var(--muted); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; min-height: 15px; }
.pst-table { display: grid; }
.pst-row { font-size: 14px; display: grid; grid-template-columns: minmax(110px, 1.1fr) repeat(4, minmax(0, 1fr)); gap: 8px; align-items: baseline; padding: 9px 4px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pst-row.pst-head { border-top: 0; font-size: 12px; color: var(--muted); font-weight: 600; padding-top: 0; }
.pst-row.total { font-weight: 800; color: var(--heading); border-top: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line)); }
.pst-k { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.pst-n { font-size: 12px; color: var(--muted); font-weight: 400; }
.pst-v { text-align: right; white-space: nowrap; }
.pst-vk { display: none; }
.pst-empty { padding: 36px 16px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pst-tools { padding: 0 12px 8px; }
  .pst-segs { flex: 1 1 100%; }
  .pst-segs .seg { flex: 1; height: 40px; font-size: 16px; }
  .pst-nav { flex: 1 1 100%; }
  .pst-nav .btn { width: 44px; height: 44px; flex: none; }
  .pst-nav .ob-filter, .pst-tools .pst-device { flex: 1; height: 44px; font-size: 16px; min-width: 0; }
  .pst-tools .pst-device { flex: 1 1 100%; max-width: none; margin-left: 0; }
  .pst-sum .st-val { font-size: 14px; }
  .pst-metrics { width: 100%; }
  .pst-metrics .seg { flex: 1; height: 40px; font-size: 14px; padding: 0 4px; }
  .pst-chart { height: 170px; gap: 3px; }
  .pst-chart.pst-c-month { gap: 1px; }
  .pst-lab { font-size: 11px; }
  .pst-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 10px 2px; }
  .pst-row.pst-head, .pst-row.zero { display: none; }
  .pst-row:nth-child(2) { border-top: 0; }
  .pst-k { grid-column: 1 / -1; }
  .pst-v { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
  .pst-vk { display: inline; color: var(--muted); font-size: 12px; font-weight: 400; }
}
.st-tile.pst-mat { grid-template-areas: "name hint" "val val" "cov cov"; }
.pst-cov { grid-area: cov; font-size: 11px; color: var(--muted); line-height: 1.35; white-space: normal; }
.pst .segs .seg:not(.on) { color: color-mix(in srgb, var(--muted) 82%, var(--text)); }
.pst-sum .st-tile { align-content: start; }
.pst-row.zero { color: var(--muted); }
.pst-row.zero .pst-k { font-weight: 400; }

/* Titles stay at 14px everywhere (hierarchy comes from weight and colour). The order nickname title is an input:
   on phones it keeps 16px so iOS Safari doesn't zoom when it gets focus. */
@media (max-width: 720px), (pointer: coarse) {
  .d-name, .rcpt .d-name { font-size: 16px; }
}
/* 打印记录 card times: 开始 / 结束 / 实际时长 / 预估时长 */
.pr-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; background: var(--list); border-radius: var(--r-card); padding: 8px 12px; }
.pr-t { min-width: 0; }
.pr-t-k { font-size: 12px; color: var(--muted); }
.pr-t-v { font-size: 14px; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-t-est .pr-t-v { color: var(--text); font-weight: 600; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pr-times { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 6px; padding: 8px 10px; }
}
/* 打印记录 cloud thumbnail + lightbox */
.pr-card .fm-ctop { grid-template-columns: 68px minmax(0, 1fr) auto; }
.pr-thumb { width: 68px; height: 68px; border-radius: 14px; border: 0; padding: 0; background: #fff; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; display: grid; place-items: center; }
button.pr-thumb.ok { cursor: zoom-in; }
button.pr-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pr-thumb-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pr-thumb.none { background: none; box-shadow: none; }
.pr-thumb .pr-thumb-ph { width: 68px; height: 68px; border-radius: 14px; }
.pr-lb { position: fixed; inset: 0; z-index: 70; background: rgba(30, 20, 10, .82); display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); gap: 10px; animation: pk-fade .15s ease-out; cursor: zoom-out; }
.pr-lb-img { max-width: min(560px, 100%); max-height: 100%; object-fit: contain; background: #fff; border-radius: 16px; padding: 8px; box-sizing: border-box; }
.pr-lb-cap { color: #fff; font-size: 14px; font-weight: 600; text-align: center; max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-lb-x { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #3b2a1a; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .pr-card .fm-ctop { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; }
  .pr-thumb, .pr-thumb .pr-thumb-ph { width: 64px; height: 64px; }
}

/* 系统管理 (/admin): reuses the 打印设置 page parts; adds a switch and account rows with a type picker. */
.sys .sys-body { display: grid; gap: 14px; align-content: start; }
.sys-line { display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.sys-line-t { min-width: 0; display: grid; gap: 4px; }
.sys-line-t .ps-hint { margin: 0; }
.sys-lbl { font-size: 14px; font-weight: 600; color: var(--text); }
.sys-switch { flex: none; width: 52px; height: 30px; border-radius: 999px; border: 0; background: color-mix(in srgb, var(--muted) 40%, var(--card)); position: relative; cursor: pointer; transition: background .15s; padding: 0; }
.sys-switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.sys-switch.on { background: var(--accent); }
.sys-switch.on i { transform: translateX(22px); }
.sys-switch:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.sys-switch:disabled { opacity: .6; cursor: default; }
.sys-list { display: grid; gap: 8px; }
.sys-user { background: var(--list); border-radius: var(--r-card); padding: 10px 12px; }
.sys-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.sys-name .pill { font-size: 12px; padding: 1px 8px; }
.sys-admin { background: var(--sel); color: var(--chip-ink); }
.sys-email { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sys-act { flex: none; display: flex; align-items: center; }
.sys-role { min-width: 112px; font-size: 14px; }
.sys-denied { padding: 60px 16px; }
.auth-closed { background: var(--sel-soft); color: var(--muted); border-radius: var(--r-ctl); padding: 12px 14px; font-size: 14px; line-height: 1.55; }
.ps-ro { background: var(--sel-soft); color: var(--muted); border-radius: var(--r-ctl); padding: 8px 12px; font-size: 13px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .sys-user { flex-wrap: wrap; }
  .sys-act { flex-basis: 100%; }
  .sys-role { width: 100%; height: 44px; font-size: 16px; }
  .sys-switch { width: 56px; height: 32px; }
  .sys-switch i { width: 26px; height: 26px; }
  .sys-switch.on i { transform: translateX(24px); }
}
.sys-switch::after { content: ""; position: absolute; inset: -8px -4px; }
.ps-ro-v { font-size: 14px; color: var(--muted); }
.ps-ro-v strong { color: var(--text); font-size: 14px; }

/* 财务统计 (/finance): the 打印统计 chart + table with two value columns. */
.fin .pst-row { grid-template-columns: minmax(120px, 1.3fr) repeat(6, minmax(0, 1fr)); }
/* Eight tiles + the formula are tall: the whole page scrolls (not just the chart/table), so phones keep room to read. */
.fin { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.fin::-webkit-scrollbar { display: none; }
.fin .pd-body { flex: none; overflow: visible; min-height: auto; }
.fin-sum .st-tile[data-stat="profit"] .st-val { color: var(--heading); }
.fin-sum .st-tile.neg .st-val, .fin .pst-v.neg { color: var(--danger); }
.fin-formula { padding-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fin-fee-edit { font-size: 12px; padding: 0; }
.fin-fee { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fin-fee-l { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); }
.fin-fee-in { width: 84px; height: 32px; font-size: 14px; padding: 0 8px; }
.fin-fee .btn { height: 32px; font-size: 13px; padding: 0 12px; }
.pst-bar-w.split { display: grid; align-items: stretch; }
.pst-half { display: flex; min-height: 0; }
.pst-half.pos { align-items: flex-end; }
.pst-half.neg { align-items: flex-start; border-top: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); }
.pst-bar.neg { background: var(--danger); opacity: .8; border-radius: 2px 2px 6px 6px; }
.fin-sum .st-tile[data-stat="sales"] .st-val { color: var(--heading); }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .fin .pst-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-fee-in { height: 40px; font-size: 16px; width: 96px; }
  .fin-fee .btn { height: 40px; font-size: 14px; }
  .fin .pst-row.zero { display: none; }
}
