:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e4e8f0;
  --txt: #1f2733;
  --muted: #6b7686;
  --brand: #1653c4;
  --brand-weak: #e8f0fe;
  --danger: #c0392b;
  --ok: #1e8e4e;
  --warn: #b97509;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 14px;
}
#app { display: flex; min-height: 100vh; }
/* 小字辅助信息：始终弱化但不小于 11.5px，保证可读 */
.sub, .stat .sub { font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 1px; }

/* ---------- 侧边栏 ---------- */
#sidebar {
  width: 208px; background: #14213a; color: #cbd5e4; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 6px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; /* 恒为视口高：展开子菜单不撑高整页 */
}
/* 顶部：企业 logo（深色底透明版：白底已抠除，深灰波浪转浅灰保证可读）+ 公司全称
   2026-10-03 v=133：整条侧栏压缩，目标 = 全部子菜单展开时在 800px 视口内一屏放下（原先 1113px 需滚动） */
#sidebar .logo { padding: 4px 16px 6px; }
#sidebar .logo .logo-mark {
  display: block; width: 100%; max-width: 72px; height: auto;
  margin: 0 auto 4px;
}
#sidebar .logo .logo-name {
  color: #fff; font-size: 12px; font-weight: 700; text-align: center;
  letter-spacing: .4px; line-height: 1.3;
}
.nav-item {
  padding: 5px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  border-left: 3px solid transparent; user-select: none; font-size: 13px; line-height: 1.35;
}
.nav-item:hover { background: #1d2f50; color: #fff; }
.nav-item.active { background: #1d2f50; color: #fff; border-left-color: #4d8bff; }
.nav-item .ico { width: 18px; text-align: center; font-size: 13.5px; line-height: 1; }
.nav-item .caret { margin-left: auto; font-size: 10px; color: #7c8ba5; transition: transform .15s; }
.nav-item.nav-group.open .caret { transform: rotate(180deg); }
.nav-subgroup { display: none; }
.nav-subgroup.open { display: block; }
.nav-sub { padding-left: 28px !important; font-size: 12.5px; }
#sidebar .spacer { flex: 1; }
/* 底部左下角：SoloPort 横版 lockup（反白，副标题放大提亮） */
#sidebar .foot { padding: 4px 16px 6px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.09); }
#sidebar .brand .brand-lockup { display: block; width: 100%; max-width: 108px; height: auto; }
#sidebar .foot .meta { margin-top: 4px; font-size: 10px; color: #9fb1d3; line-height: 1.4; }
#sidebar .foot #app-version { color: #9fb1d3; font-weight: 600; letter-spacing: 0.5px; }

/* License banner */
.license-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.license-banner.trial {
  background: linear-gradient(90deg, #3a5a8c 0%, #2c4470 100%);
  color: #d8e7ff;
}
.license-banner.expiring {
  background: linear-gradient(90deg, #b97a1c 0%, #94600f 100%);
  color: #ffe7c2;
}
.license-banner.expired {
  background: linear-gradient(90deg, #b03030 0%, #8b1f1f 100%);
  color: #ffd6d6;
}
.license-banner.activated {
  background: linear-gradient(90deg, #2d6b3d 0%, #1f4a2a 100%);
  color: #c8edcf;
}
.btn-mini {
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: inherit;
  cursor: pointer;
  font-size: 11px;
}
.btn-mini:hover { background: rgba(255,255,255,0.25); }

/* 激活弹窗 */
.activate-form { padding: 12px 0; }
.activate-form input { width: 100%; padding: 7px; border: 1px solid #ccc; border-radius: 4px; font-family: monospace; font-size: 12.5px; margin: 6px 0; box-sizing: border-box; }
.activate-form .hint { font-size: 11.5px; color: #888; margin-top: 5px; }
.activate-form .err { color: #c0392b; margin-top: 6px; font-size: 12.5px; }
.activate-form .ok { color: #2d6b3d; margin-top: 6px; font-size: 12.5px; }
.activate-form .mid { font-size: 10.5px; color: #aaa; margin-top: 3px; font-family: monospace; }

/* ---------- 主区 ---------- */
/* min-width:0：flex 子项默认 min-width:auto（= 内容最小宽度），长表格会把整个页面撑出横向滚动条；
   置 0 后由卡片自己的 overflow-x:auto 承担横向滚动 */
#main { flex: 1; min-width: 0; padding: 14px 20px 24px; max-width: 1400px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 5px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; line-height: 1.4; }
.toolbar { display: flex; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; align-items: center; }
/* 分区小标题（发货管理等一页多区块时用） */
.sect-t { font-size: 14.5px; font-weight: 700; margin: 14px 0 7px; }
.sect-t:first-of-type { margin-top: 4px; }

/* ---------- 卡片/表格 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 9px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 8px; margin-bottom: 11px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 3px; line-height: 1.35; }
/* 统计卡数值统一字号：单币种与多币种一致（多币种靠换行，不再缩字） */
.stat .v { font-size: 17px; font-weight: 700; line-height: 1.3; word-break: keep-all; overflow-wrap: normal; }
.stat .v.red { color: var(--danger); } .stat .v.green { color: var(--ok); } .stat .v.blue { color: var(--brand); }

table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); }
.tbl th, .tbl td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13.5px; line-height: 1.5; }
.tbl th { background: #f0f3f9; font-weight: 600; white-space: nowrap; font-size: 13px; }
.tbl tr:hover td { background: #f8fafd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .ops { white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.empty { padding: 10px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 仪表盘：不分组、字号醒目，一眼看清未发货合同 ---------- */
.dash-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 9px; }
.dash-head { padding: 9px 13px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: #f8fafd; }
.dash-head b { font-size: 15px; }
.dash-head span { font-size: 12px; color: var(--muted); }
table.dash-tbl th, table.dash-tbl td { font-size: 15px; padding: 10px 13px; }
table.dash-tbl th { font-size: 13.5px; }
.dash-panel .empty { font-size: 13.5px; padding: 14px; }

/* ---------- 控件 ---------- */
button, .btn {
  border: 1px solid var(--line); background: #fff; color: var(--txt);
  padding: 6px 13px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
}
button:hover { border-color: var(--brand); color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: #0f40a3; color: #fff; }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); }
button.mini { padding: 3px 9px; font-size: 12.5px; border-radius: 5px; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font-size: 13.5px;
  background: #fff; color: var(--txt); font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input[type="number"] { text-align: right; }
.search { min-width: 220px; }

/* ---------- 核价单：手动报价标记（报价列可直接改） ---------- */
.qc-quote-in.is-manual { border-color: #f59e0b; background: #fffbf0; }
.qc-manual-tag { font-size: 11px; color: #c2410c; background: #fff1e6; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.qc-quote-reset { padding: 0 5px; font-size: 11px; line-height: 15px; background: #f3f4f6; border: 1px solid #d1d5db; color: #374151; border-radius: 4px; cursor: pointer; }
.qc-quote-reset:hover { border-color: #9ca3af; color: #111827; }
#qc-reset-quotes:disabled { opacity: .5; cursor: default; }
#qc-reset-quotes:disabled:hover { border-color: var(--line); color: var(--txt); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
textarea { resize: vertical; min-height: 60px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------- 弹窗 ---------- */
#modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: none; align-items: flex-start; justify-content: center; z-index: 100; overflow-y: auto; padding: 24px 16px;
}
#modal-mask.show { display: flex; }
#modal {
  background: #fff; border-radius: 10px; width: 760px; max-width: 100%;
  padding: 16px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
#modal.wide { width: 980px; }
#modal h3 { margin-bottom: 12px; font-size: 17px; }

/* ---------- 徽标 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.tag.draft { background: #eef1f6; color: var(--muted); }
.tag.sent { background: #e8f0fe; color: var(--brand); }
.tag.confirmed { background: #e5f6ec; color: var(--ok); }
.tag.preparing { background: #fdf3e2; color: #b45309; }
.tag.shipped { background: #ecebfa; color: #5b4fc4; }
.tag.closed { background: #d9f2e6; color: #0b6b56; }
.tag.warn { background: #fdf3e2; color: var(--warn); }
.tag.ok { background: #e5f6ec; color: var(--ok); }
.tag.out { background: #fdeceb; color: var(--danger); }

/* 分组表头（销售合同三组） */
.group-head { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.group-head b { font-size: 14px; }
.group-head span { font-size: 12px; color: var(--muted); }

/* ---------- 合同归档附件（单据归集 → ⑦ 合同归档） ---------- */
.arch-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.arch-bar select { padding: 4px 8px; font-size: 12.5px; }
.arch-status { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.arch-hint { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin-top: 2px; }
.arch-none { color: var(--muted); font-size: 12.5px; }
.arch-item {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  background: #f3f6fb; border: 1px solid var(--line); border-radius: 14px;
  padding: 2px 10px; margin: 2px 5px 2px 0; font-size: 12.5px;
}
.arch-item a { color: var(--brand); text-decoration: none; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-item a:hover { text-decoration: underline; }
.arch-item em { color: var(--muted); font-style: normal; font-size: 11.5px; white-space: nowrap; }
.arch-item .arch-op { color: var(--muted); background: none; border: none; cursor: pointer; font-size: 12px; padding: 0 1px; line-height: 1; }
.arch-item .arch-op:hover { color: var(--brand); }
button.mini:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- PI 毛利估算（销售合同编辑器：只算毛利、不算毛利率、不扣操作费） ---------- */
.est-box { margin-top: 8px; background: #fffdf3; border: 1px solid #f0e2b8; border-radius: var(--radius); padding: 9px 11px; }
.est-inputs { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 7px; }
.est-inputs label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.est-inputs input { width: 118px; padding: 4px 7px; font-size: 13px; }
.est-out { font-size: 13px; color: var(--txt); line-height: 1.7; }
.est-out .est-gross { font-weight: 700; color: var(--danger); font-size: 14.5px; }
.est-note { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
/* 退税金额自动算出时的淡绿底 + 手工改后的「↻ 自动」复位小按钮 */
.est-inputs input.est-auto-on { background: #f4fbf6; border-color: #bfe6cd; }
.est-inputs button.est-mini { font-size: 11px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--brand); cursor: pointer; line-height: 1.5; }
.est-inputs button.est-mini:hover { background: #f2f6ff; }

/* ---------- 单据编辑器 ---------- */
.doc-items { margin: 10px 0; }
.doc-items table.tbl input { width: 100%; min-width: 62px; padding: 4px 7px; }
.doc-item-row select { width: 100%; }
/* 装箱单：Qty / G.W / N.W / CBM 可直接手填（黄底 = 手填值，打印以此为准） */
.doc-items table.tbl input.pk-in { width: 100%; min-width: 52px; padding: 4px 5px; }
.doc-items table.tbl input.pk-in.pack-manual { border-color: #e6b800; background: #fffbf0; font-weight: 600; }
.doc-item-row button.pack-reset { padding: 2px 6px; margin-right: 3px; }
.doc-totals { text-align: right; margin-top: 8px; font-size: 14px; line-height: 1.75; }
.doc-totals .grand { font-size: 18px; font-weight: 700; color: var(--brand); }

/* ---------- 产品搜索选品（代替下拉框） ---------- */
.prod-pick { position: relative; }
.prod-pick .i-prod-search { width: 100%; min-width: 120px; }
.prod-pick .cur { font-size: 11.5px; color: var(--ok); margin-top: 1px; white-space: nowrap; }
.prod-drop {
  position: absolute; z-index: 60; top: calc(100% + 2px); left: 0;
  width: 480px; min-width: 480px; max-width: 64vw;
  max-height: 300px; overflow-y: auto; overflow-x: hidden; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(20,33,58,.18);
  display: none;
}
.prod-drop.open { display: block; }
.prod-drop .pd-item {
  padding: 7px 11px; cursor: pointer; border-bottom: 1px solid #f0f2f7;
  font-size: 13px; line-height: 1.5; white-space: nowrap; overflow: hidden;
}
.prod-drop .pd-item:last-child { border-bottom: none; }
.prod-drop .pd-item:hover, .prod-drop .pd-item.active { background: var(--brand-weak); }
.prod-drop .pd-item .t1 { display: block; overflow: hidden; text-overflow: ellipsis; }
.prod-drop .pd-item .no { color: var(--brand); font-weight: 600; margin-right: 6px; }
.prod-drop .pd-item .alt { color: var(--muted); }
.prod-drop .pd-item .meta { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.prod-drop .pd-item .fav { float: right; font-size: 11px; color: #fff; background: var(--brand); border-radius: 4px; padding: 1px 6px; margin-left: 8px; }
.prod-drop .pd-empty { padding: 10px; color: var(--muted); font-size: 13px; }

.paidbar { height: 5px; background: #eef1f6; border-radius: 4px; overflow: hidden; min-width: 80px; margin-top: 3px; }
.paidbar i { display: block; height: 100%; background: var(--ok); }

/* ---------- 打印窗口 ---------- */
@media print {
  body { background: #fff; }
}

/* ---------- 折叠区块（内容确实很多时才默认收起；不得为了小而小） ---------- */
details.fold { border-top: 1px solid var(--line); }
details.fold > summary {
  cursor: pointer; list-style: none; padding: 8px 12px; font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  color: var(--txt); user-select: none;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); margin-right: 6px; font-size: 11px; }
details.fold[open] > summary::before { content: "▾"; }
details.fold > summary:hover { background: #f8fafd; }
details.fold > summary .hint { font-weight: 400; color: var(--muted); font-size: 12px; }

/* 设置页三栏布局：把长表单摊平，避免下拉 */
.cols-3 { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 10px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.cols-3 .card, .cols-2 .card { margin-bottom: 0; }
@media (max-width: 1180px) { .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) { .cols-3, .cols-2 { grid-template-columns: 1fr; } }
.form-grid.dense { gap: 8px 12px; }
.form-grid.dense .field label { font-size: 12px; margin-bottom: 3px; }
.form-grid.dense textarea { min-height: 56px; }

/* ---------- 长列表：卡片高度封顶 + 表头吸顶（只在列表确实很长时启用） ---------- */
.card.scroll-y { max-height: calc(100vh - 200px); overflow: auto; }
.card.scroll-y .tbl th { position: sticky; top: 0; z-index: 3; background: #f0f3f9; box-shadow: inset 0 -1px 0 var(--line); }

/* ==================== 日历提醒 ====================
   一屏布局：上排「今日 / 天气 / 格言」，下排「月历 + 待办提醒列表」 */
.cal-top { display: grid; grid-template-columns: 232px 1.1fr .72fr 1.1fr; gap: 9px; margin-bottom: 9px; }

/* 今日卡片 */
.cal-today {
  background: linear-gradient(135deg, #1653c4 0%, #0d3c93 100%);
  color: #fff; border-radius: var(--radius); padding: 9px 14px;
  display: flex; align-items: center; gap: 13px;
}
.cal-today .num { font-size: 46px; font-weight: 800; line-height: .9; letter-spacing: -2px; }
.cal-today .meta { line-height: 1.4; min-width: 0; }
.cal-today .meta .wd { font-size: 16px; font-weight: 700; }
.cal-today .meta .ym { font-size: 12.5px; opacity: .88; }
.cal-today .badge {
  display: inline-block; margin-top: 4px; background: rgba(255,255,255,.22);
  border-radius: 20px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}

/* 天气卡片 */
.cal-weather { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 14px; }
.cal-weather .now { display: flex; align-items: baseline; gap: 9px; }
.cal-weather .now .t { font-size: 30px; font-weight: 800; line-height: 1; }
.cal-weather .now .txt { font-size: 15px; font-weight: 700; }
.cal-weather .now .city { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.cal-weather .sub2 { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cal-weather .fc { display: flex; gap: 14px; margin-top: 7px; }
.cal-weather .fc .d { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.35; }
.cal-weather .fc .d b { display: block; color: var(--txt); font-size: 12.5px; white-space: nowrap; }

/* 每日格言 */
.cal-quote {
  background: linear-gradient(135deg, #fffaf0 0%, #fdf3e2 100%);
  border: 1px solid #f0dfc0; border-radius: var(--radius); padding: 10px 15px;
  display: flex; flex-direction: column; justify-content: center;
}
.cal-quote .q { font-size: 15.5px; font-weight: 700; line-height: 1.5; color: #8a5a06; }
.cal-quote .by { font-size: 11.5px; color: #b09468; margin-top: 5px; }

/* 汇率卡片（美元 / 欧元 兑人民币） */
.cal-fx { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 13px; }
.cal-fx .fx-h { display: flex; align-items: center; gap: 6px; }
.cal-fx .fx-h b { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .5px; }
.cal-fx .fx-h button { padding: 0 6px; font-size: 12px; line-height: 18px; }
.cal-fx .fx-h button#cal-fx-set { margin-left: auto; }
.cal-fx .fx-h button + button { margin-left: 3px; }
.cal-fx .fx-row { display: flex; align-items: baseline; gap: 7px; margin-top: 1px; }
.cal-fx .fx-row .c { font-size: 12px; color: var(--muted); min-width: 60px; }
.cal-fx .fx-row .v { font-size: 21px; font-weight: 800; letter-spacing: -.6px; }
.cal-fx .sub2 { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* 仪表盘上的实时汇率卡（占原「产品数量」格子，窄卡按小字号适配） */
.fx-stat .fx-h { display: flex; align-items: center; gap: 4px; }
.fx-stat .fx-h b { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .5px; white-space: nowrap; }
.fx-stat .fx-h button { padding: 0 4px; font-size: 12px; line-height: 17px; }
.fx-stat .fx-h button#dash-fx-set { margin-left: auto; }
.fx-stat .fx-h button + button { margin-left: 2px; }
.fx-stat .fx-row { display: flex; align-items: baseline; gap: 6px; margin-top: 1px; }
.fx-stat .fx-row .c { font-size: 11.5px; color: var(--muted); min-width: 56px; }
.fx-stat .fx-row .v { font-size: 17px; font-weight: 800; letter-spacing: -.4px; }
.fx-stat .sub2 { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 月历 + 列表 */
.cal-wrap { display: grid; grid-template-columns: 420px 1fr; gap: 9px; align-items: start; }
.cal-side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.cal-head b { font-size: 15px; }
.cal-head .nav { display: flex; align-items: center; gap: 4px; }
.cal-head .nav button { padding: 2px 9px; font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid .h { text-align: center; font-size: 11.5px; color: var(--muted); padding: 2px 0; font-weight: 600; }
.cal-day {
  min-height: 46px; border-radius: 6px; padding: 3px 4px; cursor: pointer;
  border: 1px solid transparent; background: #fbfcfe; position: relative;
}
.cal-day:hover { background: #f1f6fd; }
.cal-day.out { opacity: .34; }
.cal-day.wk .dn { color: var(--danger); }
.cal-day.today { background: var(--brand-weak); border-color: #b9cdf7; }
.cal-day.pick { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.cal-day .dn { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.cal-day .dn em { font-style: normal; font-size: 10px; color: var(--muted); margin-left: 2px; }
.cal-day .dt { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.cal-day .dt i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.cal-day .dt .more { font-size: 9.5px; color: var(--muted); line-height: 1; }
.cal-day.hol { background: #fdf3e2; }
.cal-day.hol .dn { color: var(--warn); }
.cal-day .htag {
  position: absolute; right: 3px; top: 2px; font-size: 9px; line-height: 1.3;
  background: #f3c98b; color: #7a4a00; border-radius: 3px; padding: 0 3px; font-weight: 700;
}

/* 提醒列表 */
.cal-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 220px); overflow: auto; }
.cal-group { border-bottom: 1px solid var(--line); }
.cal-group:last-child { border-bottom: none; }
.cal-gh {
  padding: 7px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #f8fafd; position: sticky; top: 0; z-index: 2;
}
.cal-gh b { font-size: 13.5px; }
.cal-gh span { font-size: 12px; color: var(--muted); }
.cal-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f2f5fa; }
.cal-item:last-child { border-bottom: none; }
.cal-item .ic { font-size: 17px; line-height: 1.25; flex-shrink: 0; }
.cal-item .bd { flex: 1; min-width: 0; }
.cal-item .t1 { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.cal-item .t2 { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 1px; }
.cal-item .ops { display: flex; gap: 5px; flex-shrink: 0; align-items: center; }
.cal-item.done .t1 { text-decoration: line-through; color: var(--muted); }
.cal-item .when { font-size: 12px; font-weight: 700; white-space: nowrap; flex-shrink: 0; width: 62px; text-align: right; }
.cal-item .when.late { color: var(--danger); }
.cal-item .when.now { color: var(--brand); }
.cal-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.cal-pill { display: inline-block; border-radius: 4px; padding: 0 5px; font-size: 11px; font-weight: 600; line-height: 1.6; }
.cal-pill.auto { background: #eef3fd; color: var(--brand); }
.cal-pill.manual { background: #fdf3e2; color: var(--warn); }
@media (max-width: 1180px) {
  .cal-top { grid-template-columns: 232px 1fr 1fr; }
  .cal-quote { grid-column: 1 / -1; }
  .cal-wrap { grid-template-columns: 1fr; }
}

/* 矮屏（笔记本小窗）：内容确实装不下时整体微缩一档，仍尽量一屏 */
@media (max-height: 760px) {
  body { font-size: 13px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 13px; }
  .tbl th, .tbl td { padding: 4px 9px; font-size: 13px; }
  .stat { padding: 7px 11px; }
  .stat .v { font-size: 16px; }
  .card { padding: 9px 11px; margin-bottom: 7px; }
  table.dash-tbl th, table.dash-tbl td { font-size: 13.5px; padding: 7px 11px; }
  .dash-head { padding: 7px 11px; }
  .form-grid { gap: 8px 12px; }
}

/* ==================== 单据体检 ====================
   把一票订单的各份单据放在一起核对，问题按「必须修正 / 建议核对 / 进度提示」分级列出 */
.h-sum { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.h-sum-item { text-align: center; min-width: 64px; }
.h-sum-item .h-sum-n { font-size: 22px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }

.h-order { padding: 0; overflow: hidden; }
.h-head { display: flex; align-items: center; gap: 8px; padding: 9px 13px; cursor: pointer; flex-wrap: wrap; }
.h-head:hover { background: #f8fafd; }
.h-docno { font-weight: 700; font-size: 14px; }
.h-caret { color: var(--muted); font-size: 12px; transition: transform .15s; }
.h-order.open > .h-head .h-caret { transform: rotate(180deg); }
.h-issues { display: none; border-top: 1px solid var(--line); }
.h-order.open > .h-issues { display: block; }

.h-issue { display: flex; gap: 9px; padding: 7px 13px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.h-issue:last-child { border-bottom: none; }
.h-lv {
  flex: none; font-size: 11.5px; font-weight: 700; border-radius: 4px; padding: 2px 7px;
  margin-top: 1px; white-space: nowrap;
}
.h-lv.error { background: #fdeceb; color: var(--danger); }
.h-lv.warn { background: #fdf3e2; color: var(--warn); }
.h-lv.info { background: #eef1f6; color: var(--muted); }
.h-ibody { min-width: 0; }
.h-msg { font-size: 13.5px; line-height: 1.5; }
.h-doc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.h-doc a { color: var(--brand); text-decoration: none; }
.h-doc a:hover { text-decoration: underline; }
.h-chain { font-size: 12px; color: var(--muted); line-height: 1.7; }
.h-chain code {
  background: #f0f3f9; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; margin-right: 3px; font-size: 11.5px;
}

/* ---------- 登录页（v141 权限体系，仅「要求登录」开启时出现） ---------- */
#login-screen {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #14213a 0%, #1d2f50 62%, #1653c4 145%);
}
.login-card {
  width: 100%; max-width: 360px; background: var(--panel);
  border-radius: 14px; padding: 26px 24px 22px;
  box-shadow: 0 18px 48px rgba(8, 16, 32, .38);
}
.login-logo { display: block; width: 132px; margin: 0 auto 10px; }
.login-title { text-align: center; font-size: 14px; font-weight: 700; letter-spacing: .3px; }
.login-sub { text-align: center; font-size: 12px; color: var(--muted); margin: 4px 0 18px; }
.login-card .field { margin-bottom: 12px; }
.login-card .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.login-card .field input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 14px; background: #fbfcfe; color: var(--txt);
}
.login-card .field input:focus { outline: none; border-color: var(--brand); background: #fff; }
.login-msg { min-height: 18px; font-size: 12.5px; color: var(--danger); margin-bottom: 6px; }
.login-btn { width: 100%; padding: 10px; font-size: 14.5px; letter-spacing: 2px; }
.login-btn:disabled { opacity: .6; cursor: default; }

/* ---------- 侧栏底部：当前用户 ---------- */
.me-box { padding: 6px 16px 2px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.09); }
.me-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #dbe4f2; }
.me-dot { width: 6px; height: 6px; border-radius: 50%; background: #4d8bff; flex-shrink: 0; }
.me-links { display: flex; gap: 12px; margin-top: 4px; padding-left: 12px; }
.me-links a { color: #8ba3c7; font-size: 11.5px; text-decoration: none; }
.me-links a:hover { color: #cbd5e4; text-decoration: underline; }
