:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --panel-2: #f8f9f6;
  --line: #e2e5df;
  --line-2: #cfd4cc;
  --text: #1d2420;
  --muted: #66706a;
  --accent: #2f6f5e;
  --accent-2: #e5efeb;
  --accent-ink: #ffffff;
  --danger: #c2412d;
  --danger-bg: #fbe9e5;
  --warn: #a86a00;
  --warn-bg: #fdf1d8;
  --ok: #2e7d4f;
  --ok-bg: #e3f3e8;
  --info: #2c5d8f;
  --info-bg: #e5eef8;
  --nav: #1f2b26;
  --nav-text: #c9d3ce;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 2px 8px rgba(20, 30, 25, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --panel: #1a201d; --panel-2: #1f2622; --line: #2b3430; --line-2: #3a4540;
    --text: #e3e8e5; --muted: #95a29b; --accent: #5fb39a; --accent-2: #20332c; --accent-ink: #0d1411;
    --danger: #ef8a76; --danger-bg: #3a201b; --warn: #e5b45a; --warn-bg: #352a16; --ok: #6fcf97; --ok-bg: #18302a;
    --info: #86b4e6; --info-bg: #1a2836; --nav: #0d110f; --nav-text: #aab6b0;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  display: grid; grid-template-columns: 220px 1fr; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
small { color: var(--muted); }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }

/* ---------- nav ---------- */
#nav { background: var(--nav); color: var(--nav-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 10px 24px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.brand b { color: #fff; display: block; font-size: 15px; }
.brand small { color: #8fa199; font-size: 11.5px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: #2f6f5e; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.group { margin-top: 10px; }
.gname { font-size: 11.5px; color: #75867e; padding: 4px 10px; letter-spacing: .05em; }
#menu a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--nav-text); }
#menu a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
#menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
#menu a.on { background: #2f6f5e; color: #fff; }

/* ---------- top ---------- */
main { min-width: 0; }
#top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 14px; padding: 14px 28px; border-bottom: 1px solid var(--line); }
#top h1 { font-size: 19px; flex: 1; }
#menuBtn { display: none; }
#productPick label { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
#productPick select { min-width: 200px; }
#page { padding: 22px 28px 60px; max-width: 1280px; }

/* ---------- building blocks ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card > h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card > h3 .right { margin-left: auto; font-weight: 400; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols.wide-left { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.cols > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.grid.g2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.lead { color: var(--muted); margin: 0 0 16px; max-width: 860px; }
.muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .lbl { font-size: 12.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.tip { font-style: normal; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--line); font-size: 10px; cursor: help; }
input, select, textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0; border-color: var(--accent); }
.affix { display: flex; align-items: stretch; }
.affix em { font-style: normal; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-2); padding: 0 8px; display: grid; place-items: center; font-size: 12.5px; }
.affix em:first-child { border-radius: 7px 0 0 7px; border-right: 0; }
.affix em:last-child { border-radius: 0 7px 7px 0; border-left: 0; }
.affix input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.affix input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; padding: 3px 0; }
.check input { width: auto; margin-top: 4px; }

button, .btn { font: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--danger); }
button.small, .btn.small { padding: 4px 10px; font-size: 12.5px; }
button.ghost { border-color: transparent; background: transparent; color: var(--accent); }
button:disabled { opacity: .6; cursor: progress; }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.danger, .lvl-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.warn, .lvl-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.ok, .lvl-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.info, .lvl-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.t-danger { color: var(--danger); } .t-warn { color: var(--warn); } .t-ok { color: var(--ok); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { color: var(--muted); font-size: 12.5px; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.hl { border-color: var(--accent); background: var(--accent-2); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--panel-2); font-weight: 600; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 14px; color: var(--muted); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty.big { padding: 70px 10px; }
.empty p { margin: 0 0 12px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 8px; margin-bottom: 8px; }
.alert .tag { font-size: 12px; font-weight: 600; white-space: nowrap; }
.alert.danger { background: var(--danger-bg); } .alert.danger .tag { color: var(--danger); }
.alert.warn { background: var(--warn-bg); } .alert.warn .tag { color: var(--warn); }
.alert.info { background: var(--info-bg); } .alert.info .tag { color: var(--info); }
.alert.ok { background: var(--ok-bg); } .alert.ok .tag { color: var(--ok); }
.todo a.text { color: inherit; }

.formula { font-size: 12px; color: var(--muted); }
.lines td:first-child { white-space: nowrap; }
.bigline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bigline b { font-size: 28px; font-variant-numeric: tabular-nums; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.dimrow { display: grid; grid-template-columns: 90px 1fr 42px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }

.out { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.out + .out { margin-top: 8px; }
.bilingual { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.copybtn { float: right; margin: -4px -6px 0 8px; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.stage { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.stage.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.stage.now { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-2); }
.stage header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.stage header .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12px; flex: none; }
.stage.done header .n { background: var(--ok); color: #fff; border-color: var(--ok); }

.swatches { display: flex; gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line-2); }
.pal { border: 2px solid var(--line); border-radius: 9px; padding: 10px; cursor: pointer; background: var(--panel); text-align: left; display: block; width: 100%; }
.pal.on { border-color: var(--accent); }
.shot { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: var(--panel); }
.shot h4 { font-size: 14px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.shot dl { display: grid; grid-template-columns: 64px 1fr; gap: 3px 8px; margin: 0; font-size: 13px; }
.shot dt { color: var(--muted); }
.shot dd { margin: 0; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; max-width: 420px; box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: opacity .4s, transform .4s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(6px); }

.modal { position: fixed; inset: 0; background: rgba(10, 15, 12, .45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.dialog { background: var(--panel); border-radius: 12px; width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dialog header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dialog header h3 { flex: 1; font-size: 16px; }
.dialog .x { border: 0; font-size: 20px; padding: 0 6px; background: transparent; }
.mbody { padding: 16px 18px; overflow-y: auto; }
.dialog footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.drop { border: 2px dashed var(--line-2); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-2); }

@media (max-width: 1000px) {
  .cols, .cols.c3, .cols.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  #nav { position: fixed; left: 0; top: 0; width: 240px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open #nav { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  #menuBtn { display: inline-flex; }
  #top { padding: 10px 16px; flex-wrap: wrap; }
  #productPick select { min-width: 0; }
  #page { padding: 16px 16px 50px; }
  .bilingual { grid-template-columns: 1fr; }
  /* Phones: the first column (usually the name) keeps a readable width; the table scrolls inside its box. */
  .tablewrap td:first-child, .tablewrap th:first-child { min-width: 130px; }
  .todo .btn { min-height: 40px; }
  /* Phones: the product picker takes its own line so the page title is not squeezed; to-do tags sit above the text. */
  #pageTitle { flex: 1 1 auto; min-width: 0; }
  #productPick { flex: 1 1 100%; }
  #productPick label { white-space: normal; }
  #productPick select { min-width: 0; flex: 1; }
  .todo .alert { flex-direction: column; gap: 4px; }
}
@media print {
  #nav, #top, button, .no-print { display: none !important; }
  body { display: block; background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- stores ---------- */
#storeBox { padding: 4px 2px 6px; }
.storebtn { width: 100%; display: grid; grid-template-columns: 12px 1fr; gap: 2px 8px; align-items: center; text-align: left; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #fff; padding: 9px 10px; border-radius: 9px; white-space: normal; }
.storebtn:hover { border-color: var(--store, #2f6f5e); background: rgba(255,255,255,.1); }
.storebtn .sname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storebtn small { grid-column: 2; color: #8fa199; font-size: 11.5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
#top { border-top: 3px solid var(--store, var(--accent)); }
body.global-page #top { border-top-color: transparent; }
body.global-page #storeTag { visibility: hidden; }
.storetag { border: 1.5px solid; border-radius: 99px; padding: 2px 12px; font-size: 13px; white-space: nowrap; background: var(--panel); }
.storelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 12px; max-height: 55vh; overflow-y: auto; }
.storeitem { display: grid; grid-template-columns: 12px 1fr; gap: 0 8px; text-align: left; white-space: normal; padding: 8px 10px; }
.storeitem small { grid-column: 2; }
.storeitem.on { border-color: var(--accent); background: var(--accent-2); }
@media (max-width: 760px) { #storeTag { order: 3; width: 100%; } }
.pf { font-style: normal; font-size: 10.5px; font-weight: 600; color: #fff; border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }

/* ---------- signed-in user ---------- */
#userBox { margin: 18px 4px 0; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); color: #c9d3ce; font-size: 13px; }
#userBox b { color: #fff; }
#userBox small { color: #8fa199; }
#userBox .btn, #userBox button { background: transparent; color: #c9d3ce; border-color: rgba(255,255,255,.18); }
#userBox .btn:hover, #userBox button:hover { color: #fff; border-color: #fff; }

/* ---------- module switcher (same as the selection header) ---------- */
#moduleBox { padding: 0 2px 10px; }
#moduleBox .modules { display: grid; grid-template-columns: 1fr; gap: 4px; }
#moduleBox .modules.one { grid-template-columns: 1fr; }
/* Each workbench tile carries its own colour (--mc): a coloured icon chip, then the name and a one-line hint. */
#moduleBox .modules a.mod { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 9px; color: #c9d4cf; text-decoration: none;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-left: 3px solid var(--mc); min-width: 0; transition: background .15s, transform .15s; }
#moduleBox .modules a.mod i { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--mc); }
#moduleBox .modules a.mod span { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; flex: 1; min-width: 0; line-height: 1.2; }
#moduleBox .modules a.mod b { flex: none; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
#moduleBox .modules a.mod small { font-size: 10.5px; color: #8fa39b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#moduleBox .modules a.mod:hover { background: rgba(255,255,255,.1); color: #fff; transform: translateY(-1px); }
#moduleBox .modules a.mod.on { background: var(--mc); border-color: var(--mc); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
#moduleBox .modules a.mod.on i { background: rgba(255,255,255,.22); }
#moduleBox .modules a.mod.on small { color: rgba(255,255,255,.85); }

/* ---------- navigation: scope + workflow ---------- */
#menu a { gap: 10px; padding: 7px 10px; font-size: 13.5px; }
#menu a i { display: grid; place-items: center; width: 18px; opacity: .85; }
#menu a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu a.on i { opacity: 1; }
#menu .gname { font-size: 11px; letter-spacing: .08em; color: #6f8279; padding: 10px 10px 4px; }
#menu .group { margin-top: 2px; }
/* Everything for the selected store sits inside one frame in the store's colour. */
.scope { margin: 14px 0 6px; padding: 8px 6px 6px; border-radius: 10px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07); border-left: 3px solid var(--store, #2f6f5e); }
.scopehead { font-size: 11px; letter-spacing: .08em; color: #8fa199; padding: 0 6px 6px; }
.scope #storeBox { padding: 0 0 4px; }
.scope .storebtn { background: rgba(255,255,255,.07); }
#menu a.on { background: color-mix(in srgb, var(--store, #2f6f5e) 75%, #000 0%); }
.count { font-style: normal; font-size: 11px; font-weight: 700; color: #fff; background: #d64545; border-radius: 99px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; }
#pageTitle { display: flex; flex-direction: column; gap: 1px; }
.crumb { font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: .04em; }
.crumb:not(:empty)::after { content: ' ›'; }

/* ---------- 视觉中心 ---------- */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.statusbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statusbar button.on { font-weight: 700; }
.statusbar button.on.plain { background: var(--panel-2); border-color: var(--text, #333); }
.statusbar button.on.info { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.statusbar button.on.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.statusbar button.on.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
/* 视觉中心 uses its own accent so it is obvious which workbench you are in. */
.brand .logo { background: var(--mod, #2f6f5e); transition: background .2s; }
button.kpi { display: block; width: 100%; text-align: left; font: inherit; color: inherit; }
button.kpi:hover { border-color: var(--accent); }

/* ---------- 我的团队: reporting-line tree ---------- */
ul.tree { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); }
ul.tree.top { padding-left: 0; border-left: 0; }
.tnode { margin: 6px 0; }
.trow { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2fr) auto auto; gap: 6px 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.tstores { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.tact { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
@media (max-width: 760px) { .trow { grid-template-columns: 1fr; } }
label.storeitem { grid-template-columns: auto 12px 1fr; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
label.storeitem small { grid-column: 3; }
[hidden] { display: none !important; }

/* ---------- 视觉中心: 出图检查 / AI 提示词 ---------- */
.vresult { align-items: flex-start; gap: 16px; }
.vthumbbox { width: 160px; display: flex; flex-direction: column; gap: 6px; }
.vthumb { width: 160px; height: 160px; object-fit: contain; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.vthumbbox small { word-break: break-all; }
.vitems { flex: 1; min-width: 260px; }
.vpage .shot h4 .spacer { flex: 1; }
@media (max-width: 760px) {
  .vthumbbox { width: 100%; align-items: center; text-align: center; }
  .vthumb { width: 100%; max-width: 240px; height: auto; aspect-ratio: 1; }
  .vitems { min-width: 0; width: 100%; }
  .vpage .card .row button, .vpage button.small, .vpage .statusbar button, .kbpage .card .row button, .kbpage button.small { min-height: 40px; }
}

/* ---------- 防关联: 体检卡片、SOP、品牌档案 ---------- */
.guard h4 { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; font-size: 14px; }
.guard .alert small.muted { word-break: break-all; }
dl.kv i.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-left: 3px; }
.sop summary { cursor: pointer; list-style-position: outside; }
.sop details[open] summary { margin-bottom: 10px; }
.manual h2 { margin: 0 0 2px; font-size: 18px; }
.sopbody .mh1 { margin: 22px 0 8px; font-size: 16px; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sopbody h4 { margin: 14px 0 6px; font-size: 14px; scroll-margin-top: 72px; }
.sopbody h3 { scroll-margin-top: 72px; }
.sopbody p { margin: 0 0 8px; }
.sopbody ul { margin: 0 0 8px; padding-left: 20px; }
.sopbody .tablewrap { margin-bottom: 8px; }
/* Manual notes: the title sits above the text and wraps (long titles, narrow screens). */
.manual .alert { flex-direction: column; gap: 4px; }
.manual .alert .tag { white-space: normal; font-size: 13px; }
.manual .alert.danger { border-left: 4px solid var(--danger); }
@media (max-width: 760px) {
  .guard .alert, .kbpage .alert { flex-direction: column; gap: 4px; }
  .sop summary small { display: block; margin: 4px 0 0 !important; }
}

/* ---------- 商品数据质量 ---------- */
.cdq-group { border-top: 1px solid var(--line); padding: 8px 0; }
.cdq-group summary { cursor: pointer; }
.cdq-group[open] summary { margin-bottom: 8px; }
.cdq-group .alert small { display: block; margin-top: 3px; color: var(--muted); }
.cdq-group > small.muted { display: block; }
@media (max-width: 760px) {
  .cdq-group .alert { flex-direction: column; gap: 4px; }
}

/* ---------- 知识与任务 ---------- */
.kbpage .sopbody p { white-space: pre-line; }
.kbtypes > button { text-align: left; line-height: 1.5; white-space: normal; min-width: 0; }
.kbtypes > button small { display: block; white-space: normal; }
@media (max-width: 760px) {
  .kbpage .kbfilter > button.primary { flex: 1 1 100%; }
}

/* ---------- 运营学习课程 · 测试题库 (admin) ---------- */
.quizpick { display: flex; flex-wrap: wrap; gap: 8px; }
.quizpick button { white-space: normal; text-align: left; max-width: 100%; }
.quizpick button.on { border-color: var(--accent); font-weight: 600; }
.bankq { padding: 8px 0; border-top: 1px solid var(--line); }
.bankopts { margin: 4px 0; padding-left: 1.2em; list-style: none; }
.bankopts li.right { color: var(--ok); font-weight: 600; }
.bankq small { display: block; color: var(--muted); }

/* 月报: 「下载 PDF / 打印」 prints only the month that is open. */
@media print {
  body.print-monthly * { visibility: hidden !important; }
  body.print-monthly .monthly-open, body.print-monthly .monthly-open * { visibility: visible !important; }
  body.print-monthly .monthly-open { position: absolute; left: 0; top: 0; width: 100%; }
  body.print-monthly .monthly-open .noprint { display: none !important; }
}

/* 「我确认仍要否定」 and other checkboxes that matter: big enough on a phone, the text ticks it too. */
.bigcheck { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; margin: 4px 0; }
.bigcheck input[type=checkbox] { width: 18px; height: 18px; min-width: 18px; margin-top: 1px; }
@media (max-width: 760px) { .bigcheck input[type=checkbox] { width: 22px; height: 22px; min-width: 22px; } }
/* 学习课程 · 知识搜索 */
.ksearch { margin: 0 0 14px; max-width: 860px; }
.ksearch input { width: 100%; font-size: 15px; padding: 9px 11px; }
.ksresults { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ksresults:empty { display: none; }
.ksitem { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; white-space: normal; width: 100%; padding: 9px 11px; }
.ksitem small { font-size: 12px; }
.kssnip { font-size: 13px; color: var(--muted); line-height: 1.5; }
.ksearch mark, .kssnip mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sopbody .flash { background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 4px; transition: background .4s; }
/* 可以阅读，不可复制 (操作手册, 学习课程, 知识搜索 results; not for the admin — lib/protect.js).
   --wm / --wm-dark: the faint name · account · date watermark, set on the element. Search boxes stay normal. */
.nocopy { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; position: relative; }
.nocopy img { -webkit-user-drag: none; }
/* The watermark lies over the text (also over coloured boxes and tables), clicks pass through it. */
.nocopy::after { content: ''; position: absolute; inset: 0; background-image: var(--wm); background-repeat: repeat; pointer-events: none; z-index: 5; }
@media (prefers-color-scheme: dark) {
  .nocopy::after { background-image: var(--wm-dark); }
}
@media print {
  .nocopy::after { display: none !important; }
  .nocopy > * { display: none !important; }
  .nocopy::before { content: '此内容不可打印'; display: block; padding: 40px 0; text-align: center; font-size: 18px; color: #000; }
  .ksresults.nocopy { display: none !important; }
}
