:root {
  color-scheme: light;
  --navy: #092c4c;
  --navy-2: #0d3b64;
  --gold: #c6943b;
  --cream: #f6f1e7;
  --ink: #152536;
  --muted: #718096;
  --line: #dfe6ec;
  --surface: #ffffff;
  --bg: #f3f6f8;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 230px; padding: 30px 20px; background: var(--navy); color: white; display: flex; flex-direction: column; transition: width .22s ease; z-index: 20; }
.sidebar-top { display: flex; justify-content: flex-end; padding: 0 8px 6px; }
.sidebar-toggle { width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.28); border-radius: 6px; background: rgba(255,255,255,.06); color: white; cursor: pointer; font-size: 16px; line-height: 1; }
.sidebar-toggle:hover { background: rgba(255,255,255,.16); }
main { margin-left: 230px; transition: margin-left .22s ease; }
body.sidebar-collapsed .sidebar { width: 64px; padding: 24px 12px; }
body.sidebar-collapsed .sidebar-top { justify-content: center; padding: 0 0 14px; }
body.sidebar-collapsed .brand { justify-content: center; padding: 0 0 24px; }
body.sidebar-collapsed .brand > div { display: none; }
body.sidebar-collapsed nav { display: none; }
body.sidebar-collapsed .sidebar-note { display: none; }
body.sidebar-collapsed main { margin-left: 64px; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 30px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--gold); color: var(--gold); font: 700 22px Georgia, serif; }
.brand strong, .brand small { display: block; letter-spacing: .16em; }
.brand small { margin-top: 4px; font-size: 9px; opacity: .58; }
nav { margin-top: 28px; display: grid; gap: 8px; }
.sidebar nav { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; padding-right: 6px; margin-right: -6px; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
.sidebar nav::-webkit-scrollbar { width: 7px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 999px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.46); }
.sidebar nav.is-dragging, .sidebar nav.is-dragging * { cursor: grabbing !important; user-select: none; }
.nav-item { border: 0; padding: 13px 14px; color: rgba(255,255,255,.7); background: transparent; text-align: left; border-radius: 6px; cursor: pointer; }
.nav-item.active, .nav-item:hover { color: white; background: rgba(255,255,255,.1); }

/* ---------- 侧边栏二级分组（2026-09-25） ---------- */
.nav-group { margin: 6px 0 2px; }
.nav-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 9px 14px 5px; border: 0; background: transparent; cursor: pointer;
  color: rgba(255,255,255,.42); font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-align: left;
}
.nav-group-head:hover { color: rgba(255,255,255,.75); }
.nav-group-head::after { content: "▾"; font-size: 10px; opacity: .8; transition: transform .18s ease; }
.nav-group.collapsed .nav-group-head::after { transform: rotate(-90deg); }
.nav-group-items { display: grid; gap: 2px; }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group-items .nav-item { padding: 11px 14px 11px 22px; font-size: 13.5px; }
.sidebar-note { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.4); font-size: 9px; line-height: 1.7; letter-spacing: .12em; }
main { margin-left: 230px; min-height: 100vh; }
.topbar { min-height: 112px; padding: 28px 42px; display: flex; justify-content: space-between; align-items: center; background: white; border-bottom: 1px solid var(--line); }
.eyebrow, .panel-kicker { margin: 0 0 7px; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 700 28px Georgia, "Microsoft YaHei", serif; color: var(--navy); }
h2 { margin-bottom: 8px; color: var(--navy); font-size: 18px; }
.system-status { color: var(--muted); font-size: 13px; }
.system-status span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #2fa56f; }
.view { padding: 30px 42px 54px; }
.hidden { display: none !important; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { position: relative; min-height: 128px; padding: 22px; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 9px; }
.stat-card span { position: absolute; top: 14px; right: 18px; color: #d9e1e7; font: 700 30px Georgia, serif; }
.stat-card strong { display: block; margin-top: 14px; color: var(--navy); font-size: 30px; }
.stat-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 18px rgba(30,55,75,.04); }
.upload-card { min-height: 235px; padding: 26px; display: flex; flex-direction: column; align-items: flex-start; }
.upload-card.accent { border-top: 3px solid var(--gold); }
.upload-card p:not(.panel-kicker):not(.upload-result) { max-width: 560px; color: var(--muted); line-height: 1.7; font-size: 13px; }
.file-button, .quiet-button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; cursor: pointer; }
.file-button { margin-top: auto; padding: 11px 17px; background: var(--navy); color: white; font-size: 13px; }
.file-button:hover { background: var(--navy-2); }
.file-button input { display: none; }
.template-link { margin-top: 9px; color: var(--gold); font-size: 12px; font-weight: 700; text-decoration: none; }
.template-link:hover { text-decoration: underline; }
.text-input { width: 100%; margin: 8px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; outline: none; }
.text-input:focus { border-color: var(--gold); }
.search-panel { overflow: hidden; margin: 0 0 22px; }
.search-controls { display: flex; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.search-select { min-width: 132px; padding: 9px 34px 9px 11px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: white; outline: none; }
.search-select:focus { border-color: var(--gold); }
.search-controls .text-input:disabled { color: #9aa6b2; background: #f2f4f6; }
.search-hint { margin: 0; padding: 8px 24px 10px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; }

.search-controls .text-input { margin: 0; }
.search-controls .quiet-button { min-width: 82px; }
.pagination-controls { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 13px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination-controls label { display: flex; gap: 7px; align-items: center; }
.pagination-controls .search-select { min-width: 78px; padding-top: 7px; padding-bottom: 7px; }
.quiet-button:disabled { cursor: not-allowed; opacity: .48; }
.supplier-price-cell { min-width: 180px; white-space: nowrap; }

.supplier-price-cell small { display: block; margin-bottom: 3px; color: var(--muted); }
.material-name-cell { min-width: 220px; max-width: 360px; white-space: normal; }
.material-name-cell small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.match-actions { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }

.match-reason { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; white-space: normal; }
body.modal-open { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(9, 44, 76, 0.45); padding: 24px; }
.modal-overlay.hidden { display: none; }
.modal-dialog { display: flex; flex-direction: column; width: min(1800px, 98vw); max-height: 82vh; overflow: hidden; background: #fff; border-radius: 10px; box-shadow: 0 18px 50px rgba(20, 35, 54, 0.28); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; }
.modal-header p:not(.panel-kicker) { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.modal-search { display: flex; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.modal-search .text-input { margin: 0; flex: 1; }
.modal-dialog .table-wrap { overflow: auto; }
#match-material-modal .modal-dialog {
  width: fit-content;
  min-width: min(680px, calc(100vw - 48px));
  max-width: min(1800px, calc(100vw - 48px));
  max-height: 90vh;
}
#match-material-modal .table-wrap {
  max-height: calc(90vh - 230px);
  overflow-x: hidden;
}
#match-material-modal table {
  width: 100%;
}
#match-material-modal table th,
#match-material-modal table td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.modal-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.modal-pagination span { color: var(--muted); font-size: 12px; font-weight: 700; }
.modal-body { padding: 16px 24px 20px; max-height: 70vh; overflow: auto; }
.table-wrap.wide table { min-width: 1680px; }
.rfq-line-note, .quotation-line-input { margin: 0; min-width: 110px; }
.quote-line-input { margin: 0; min-width: 90px; }
#quotation-price-history-hint { color: var(--muted); font-size: 11px; }

.rfq-total-amount { margin: 6px 0 0; font-size: 14px; font-weight: 700; color: #176b4b; }
.po-tracking-cell { min-width: 280px; white-space: nowrap; }
.po-tracking-cell .text-input { margin: 0 4px 0 0; width: 100px; padding: 5px 8px; display: inline-block; box-sizing: border-box; }
.engine-status { margin: 4px 0 0; font-size: 11px; font-weight: 600; }
.engine-status.llm { color: #176b4b; }
.engine-status.fallback { color: #996b14; }
.engine-status.local { color: #5e6a76; }
.ai-import-toggle { display: flex; gap: 7px; align-items: center; margin: 0 0 12px; color: var(--muted); font-size: 12px; cursor: pointer; }
.edit-form { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; padding: 18px 24px; }
.edit-form .text-input { margin: 0; }
.edit-form .quiet-button { justify-self: start; }
@media (max-width: 980px) { .edit-form { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .edit-form { grid-template-columns: 1fr; } }
.upload-result { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.table-panel { overflow: hidden; margin-top: 22px; }
.panel-heading { padding: 22px 24px 17px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin-bottom: 0; }
.panel-heading p:not(.panel-kicker) { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.quiet-button { padding: 8px 13px; background: #eef3f6; color: var(--navy); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 16px; color: #617487; background: #f7f9fa; text-align: left; white-space: nowrap; }
td { padding: 13px 16px; border-top: 1px solid #edf0f2; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fbf8f2; }
.description-cell { min-width: 280px; max-width: 520px; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; white-space: nowrap; font-size: 11px; background: #edf1f4; color: #5e6a76; }
.badge.exact { color: #176b4b; background: #e6f4ed; }
.badge.warning, .badge.needs_ai, .badge.unmatched { color: #996b14; background: #fbf1d8; }
.badge.mapping_conflict { color: #a23a3a; background: #fbe7e7; }
.badge.pending, .badge.processing { color: #996b14; background: #fbf1d8; }
.badge.approved { color: #176b4b; background: #e6f4ed; }
.badge.rejected, .badge.cancelled { color: #a23a3a; background: #fbe7e7; }
.approval-counts { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 14px; margin-bottom: 18px; }
.approval-count-card { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.approval-count-card strong { display: block; color: var(--navy); font-size: 24px; }
.approval-count-card span { color: var(--muted); font-size: 12px; }
.table-wrap.wide .approval-table { min-width: 1200px; }
.approval-summary { min-width: 280px; max-width: 460px; }
.approval-summary strong { display: block; margin-bottom: 4px; color: var(--navy); }
.approval-summary small { color: var(--muted); line-height: 1.5; }
.approval-summary .error-text { display: block; margin-top: 5px; color: #a23a3a; }
.approval-actions { display: flex; gap: 6px; white-space: nowrap; }
/* 询价单明细字体放大（保持单元格不溢出） */
#rfq-detail { font-size: 14px; }
#rfq-detail .text-input { font-size: 14px; padding: 7px 10px; }
#rfq-detail .badge { font-size: 12px; }
#rfq-detail .material-name-cell small,
#rfq-detail .match-reason { font-size: 12px; }
#rfq-detail td.rfq-price-cell { min-width: 150px; }
#rfq-detail .rfq-line-purchase-price { font-size: 15px; min-width: 120px; padding: 7px 8px; }
#rfq-detail .rfq-line-material-code { margin: 0; width: 135px; box-sizing: border-box; }
.rfq-checkbox-cell { position: relative; min-width: 36px; vertical-align: top; }
.rfq-checkbox-cell .line-selector { margin-top: 20px; }
.rfq-line-corner { position: absolute; top: 1px; left: 1px; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 3px; background: #e8eef3; color: var(--navy); cursor: pointer; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.rfq-line-corner:hover { background: #d7e1ea; }
.rfq-checkbox-cell { min-width: 40px; }
.rfq-checkbox-cell .rfq-line-delete { left: 19px; color: #c62828; }
.empty { height: 90px; color: var(--muted); text-align: center; vertical-align: middle; }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 10; padding: 12px 18px; color: white; background: #26694f; border-radius: 6px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.error { background: #9e3d3d; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .sidebar { position: static; width: auto; min-height: auto; flex-direction: row; align-items: center; }
  /* 窄屏（≤980px）侧边栏变成横向条：把分组拍平，只显示二级项，不显示组名与折叠 */
  .nav-group { display: contents; }
  .nav-group-head { display: none; }
  .nav-group-items { display: contents; }
  .nav-group-items .nav-item { padding: 13px 14px; font-size: 14px; }
  body.sidebar-collapsed .sidebar { width: auto; padding: 18px 20px; }
  body.sidebar-collapsed .sidebar-top { justify-content: flex-end; padding: 0 8px 6px; }
  body.sidebar-collapsed nav { display: flex; margin: 0 0 0 auto; }
  body.sidebar-collapsed .brand > div { display: block; }
  body.sidebar-collapsed main { margin-left: 0; }
  .sidebar nav { flex: 1 1 auto; min-width: 0; min-height: auto; margin: 0 0 0 auto; padding-right: 0; display: flex; overflow-x: auto; overflow-y: hidden; scrollbar-gutter: auto; }
  .sidebar-note { display: none; }
  main { margin-left: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .sidebar { padding: 18px; }
  .brand { padding: 0; border: 0; }
  .brand small, .nav-item:not(.active) { display: none; }
  .topbar, .view { padding-left: 18px; padding-right: 18px; }
  .system-status { display: none; }
  .stats { grid-template-columns: 1fr; }
  .approval-counts { grid-template-columns: repeat(2, 1fr); }
  .search-controls, .pagination-controls { flex-wrap: wrap; }
  .search-controls .text-input { min-width: 240px; }
}

.quote-price-controls, .batch-toolbar { display: flex; gap: 10px; align-items: center; }
.quote-price-controls { flex-wrap: wrap; justify-content: flex-end; }
.margin-summary { padding: 10px 24px; border-bottom: 1px solid var(--line); background: #f4f8f5; font-size: 13px; font-weight: 700; color: var(--navy); }
.margin-summary span { color: #176b4b; }
.quote-edit-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fbfcfd; align-items: flex-end; }
.quote-edit-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.quote-edit-bar .text-input, .quote-edit-bar .search-select { margin: 0; width: 180px; }
.quote-edit-bar .search-select { width: 120px; }
.quote-line-input { margin: 0; min-width: 90px; }

.batch-toolbar { padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fbfcfd; flex-wrap: wrap; }
.batch-toolbar strong { color: var(--navy); font-size: 12px; white-space: nowrap; }
.batch-toolbar span { color: var(--muted); font-size: 11px; }
.batch-toolbar .search-select { min-width: 250px; }
.line-selector { width: 16px; height: 16px; cursor: pointer; }
@media (max-width: 640px) { .quote-price-controls, .batch-toolbar { flex-wrap: wrap; } }
.autocomplete-wrap { position: relative; }
.autocomplete-list { position: fixed; left: 0; top: 0; z-index: 1000; background: #fff; border: 1px solid var(--line); border-radius: 6px; max-height: 280px; overflow-y: auto; box-shadow: 0 10px 28px rgba(20,35,54,.14); }
.autocomplete-item { padding: 9px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item:hover, .autocomplete-item.selected { background: #eef3f6; }
.autocomplete-item { white-space: normal; }
.autocomplete-item .match-suggest-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item .match-suggest-desc { display: block; margin-top: 2px; color: #667085; line-height: 1.35; white-space: normal; }

/* 全局字号放大（护眼）：表格14px，辅助文字12-13px，输入框随所在单元格同步 */
table { font-size: 14px; }
.badge { font-size: 12.5px; }
.material-name-cell small, .match-reason, .engine-status, #quotation-price-history-hint { font-size: 12px; }
.search-hint, .pagination-controls, .panel-heading p:not(.panel-kicker), .ai-import-toggle,
.upload-result, .batch-toolbar strong, .quote-edit-bar label, .autocomplete-item,
.stat-card p, .template-link { font-size: 13px; }
.upload-card p:not(.panel-kicker):not(.upload-result), .file-button, .margin-summary { font-size: 14px; }
.batch-toolbar span { font-size: 12px; }
.eyebrow, .panel-kicker { font-size: 11px; }

/* 询价单明细护眼增强：15px、行距加大、斑马纹、表头固定 */
#rfq-detail { font-size: 15px; }
#rfq-detail .text-input { font-size: 15px; padding: 8px 10px; }
#rfq-detail td { padding: 10px 10px; }
#rfq-detail tbody tr:nth-child(even) { background: #f8fafc; }
#rfq-detail thead th { position: sticky; top: 0; z-index: 5; background: #eef3f6; }
#rfq-detail .badge { font-size: 12.5px; }
#rfq-detail .material-name-cell small,
#rfq-detail .match-reason { font-size: 12.5px; }


/* ===== 全局排版与间距优化（护眼） ===== */
body { line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { line-height: 1.5; }
.nav-item { font-size: 14px; letter-spacing: .02em; }
h2 { font-size: 19px; }
.eyebrow, .panel-kicker { letter-spacing: .13em; }
.text-input { padding: 11px 13px; line-height: 1.5; }
.search-select { padding-top: 10px; padding-bottom: 10px; line-height: 1.5; }
.quiet-button { padding: 9px 15px; line-height: 1.4; }
th { padding: 13px 16px; line-height: 1.45; }
td { padding: 14px 16px; line-height: 1.55; vertical-align: middle; }
tbody tr:nth-child(even) td { background: #fafbfc; }
tr.clickable:hover td { background: #fbf8f2; }
.description-cell { min-width: 300px; max-width: 560px; }
.view { padding: 32px 42px 56px; }
.panel-heading { padding: 24px 24px 18px; }
.search-controls { padding: 18px 24px; }
.pagination-controls { padding: 15px 24px; }
.batch-toolbar { padding: 14px 24px; }
.quote-edit-bar { padding: 14px 24px; }
.upload-card { padding: 28px; }
.stat-card { padding: 24px; }
.autocomplete-item { padding: 11px 13px; font-size: 13.5px; line-height: 1.45; }
.modal-header { padding: 22px 26px 16px; }
.modal-search { padding: 16px 26px; }
.toast { font-size: 14px; padding: 13px 20px; }
#quotation-price-history-hint { font-size: 12.5px; }

.rfq-images { display: flex; gap: 8px; padding: 0 24px 12px; flex-wrap: wrap; }
.rfq-thumb { max-height: 90px; border-radius: 6px; border: 1px solid var(--line); }

.quotation-po-hint { color: var(--muted); font-size: 12px; margin-right: 8px; }

.todo-content { padding: 4px 24px 20px; }
.todo-content h3 { margin: 14px 0 6px; }
.todo-content h4 { margin: 10px 0 4px; color: var(--muted); }
.todo-content p { margin: 4px 0; }
.todo-content hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.todo-item.todo-done { color: var(--muted); text-decoration: line-through; }
.todo-meta { color: var(--muted); font-size: 12px; padding: 0 24px; }

/* ---------- 订单台账 ---------- */
.ledger-stats { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 24px 12px; }
.ledger-stat {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd;
}
.ledger-stat em { font-style: normal; font-size: 12px; color: var(--muted); }
.ledger-stat strong { font-size: 16px; color: var(--navy); }
.ledger-stat.clickable { cursor: pointer; }
.ledger-stat.clickable:hover { border-color: var(--navy); background: #f2f7fc; }
.ledger-stats .ledger-reset { margin-left: auto; align-self: center; }
/* 检索结果里的「命中：…」小字（解释为什么这条会被搜出来） */
.match-hit { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* 主数据表头排序：可点的列表头 + 升/降指示 */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--navy); }
th.sortable::after { content: ""; display: inline-block; width: 10px; margin-left: 3px; opacity: .45; }
th.sortable[data-dir="asc"]::after { content: "▲"; opacity: 1; }
th.sortable[data-dir="desc"]::after { content: "▼"; opacity: 1; }
.ledger-filters {
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fbfcfd;
}
.ledger-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.ledger-filters .text-input { width: 220px; margin: 0; }
.ledger-filters .search-select { width: 130px; }
.ledger-check { flex-direction: row !important; align-items: center; gap: 6px !important; padding-bottom: 6px; }
.ledger-check input { width: 16px; height: 16px; }
.ledger-form .text-input, .ledger-form .search-select { width: 190px; }
.ledger-form .ledger-wide { flex: 1 1 320px; }
.ledger-form .ledger-wide .text-input { width: 100%; }
.ledger-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.ledger-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.ledger-badge.info { border-color: #b9cfe4; color: #245b8f; background: #f2f7fc; }
.ledger-badge.warn { border-color: #e8d5a8; color: #8a6a1f; background: #fdf8ec; }
.ledger-badge.danger { border-color: #e7b4b4; color: #a03a3a; background: #fdf3f3; }
.ledger-sub { margin-left: 6px; font-size: 11px; color: var(--muted); }
.ledger-overdue { color: #a03a3a; font-weight: 700; }
.ledger-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ledger-actions .quiet-button { padding: 4px 10px; font-size: 12px; }
.ledger-status-select { width: 110px; margin: 0; }
.ledger-table th, .ledger-table td { padding: 9px 10px; font-size: 13px; }
.ledger-table { table-layout: fixed; width: 100%; }
.ledger-table td:nth-child(3) { max-width: 330px; }
.ledger-table td:nth-child(1) { white-space: nowrap; }
.ledger-table th:nth-child(1) { width: 130px; }
.ledger-table th:nth-child(2) { width: 62px; }
.ledger-table th:nth-child(3) { width: 130px; }
.ledger-table th:nth-child(4) { width: 280px; }
.ledger-table th:nth-child(5) { width: 105px; }
.ledger-table th:nth-child(6) { width: 105px; }
.ledger-table th:nth-child(7) { width: 150px; }
.ledger-table th:nth-child(8) { width: 120px; }
.ledger-table th:nth-child(9) { width: 70px; }
.ledger-table td:nth-child(4), .ledger-table td:nth-child(7) { overflow-wrap: anywhere; }
#ledger-detail-body { padding: 4px 24px 20px; }
.ledger-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; margin-top: 12px; }
.ledger-info > div { display: flex; gap: 10px; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ledger-info em { flex: 0 0 100px; font-style: normal; color: var(--muted); }
.ledger-rollup { margin-top: 12px; padding: 10px 14px; border: 1px solid #b9cfe4; background: #f2f7fc; border-radius: 8px; font-size: 13px; color: #245b8f; }
.ledger-section { margin-top: 20px; }
.ledger-section-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px solid var(--navy); }
.ledger-section-head h3 { margin: 0; font-size: 16px; }
.ledger-hint { font-size: 12px; color: var(--muted); }
.ledger-inline-form {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd;
}
.ledger-inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.ledger-inline-form .text-input { width: 170px; margin: 0; }

.match-group-row td { padding: 6px 12px !important; background: rgba(20,35,54,0.05); }
.match-hint { margin-left: 6px; font-size: 11px; }
.match-hint.warn { color: #b26a00; }
.match-hint.special { color: var(--muted); }

.sort-mark { color: var(--muted); font-size: 10px; }
th[data-field] { cursor: pointer; user-select: none; }
.lex-chip { display: inline-block; background: rgba(20,35,54,0.06); border-radius: 12px; padding: 2px 8px; margin: 2px 4px 2px 0; font-size: 12px; }
.lex-chip-del { border: none; background: none; color: #c62828; cursor: pointer; margin-left: 4px; font-size: 12px; }

/* 账号登录与权限管理 */
.auth-overlay { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #174d72 0, #092c4c 42%, #061d32 100%); }
.auth-overlay.hidden { display: none; }
.auth-card { width: min(420px, 100%); display: grid; gap: 16px; padding: 34px; border-radius: 14px; background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { font-size: 22px; color: var(--ink); letter-spacing: .04em; }
.auth-brand small { color: var(--muted); letter-spacing: .12em; }
.auth-card label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 600; }
.auth-message { margin: 0; color: var(--muted); line-height: 1.55; }
.auth-error { min-height: 20px; margin: 0; color: #b42318; font-size: 13px; }
.primary-button { border: 0; border-radius: 7px; padding: 11px 18px; background: #0d4770; color: #fff; font-weight: 700; cursor: pointer; }
.primary-button:hover { background: #0a3b5e; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.current-user-label { margin-left: auto; padding: 7px 12px; border-radius: 999px; background: #eef3f6; color: #31516a; font-size: 13px; white-space: nowrap; }
.admin-grid { display: grid; grid-template-columns: minmax(360px, .8fr) minmax(560px, 1.4fr); gap: 20px; margin-bottom: 20px; }
.admin-form { display: grid; gap: 14px; padding: 0 24px 24px; }
.admin-form > label:not(.check-label) { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.check-label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.permission-matrix { display: grid; gap: 10px; max-height: 390px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.permission-group { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid #e7ecf0; }
.permission-group:last-child { border-bottom: 0; }
.permission-group strong { color: #27465f; font-size: 13px; }
.permission-options { display: grid; gap: 6px; }
.permission-options label { display: flex; align-items: flex-start; gap: 7px; color: #435466; font-size: 12.5px; }
.permission-options input { margin-top: 3px; }
.permission-matrix.disabled { opacity: .5; pointer-events: none; }
.admin-scope-panel { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f7fafc; }
.admin-scope-panel > label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.admin-scope-panel.disabled { opacity: .5; pointer-events: none; }
.scope-option-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; max-height: 150px; overflow: auto; padding: 9px; border: 1px solid #dce5eb; border-radius: 7px; background: #fff; }
.scope-option-list label { display: flex; align-items: flex-start; gap: 7px; color: #435466; font-size: 12px; font-weight: 500; }
.scope-option-list input { margin-top: 2px; }
.scope-help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.admin-form-actions { display: flex; gap: 10px; }
.search-controls.compact { padding: 0; }
.hidden-by-permission { display: none !important; }
@media (max-width: 1100px) { .admin-grid { grid-template-columns: 1fr; } }

.po-finance-cell{min-width:120px}
.po-finance-cell .po-fin{font-size:12px;line-height:1.45;color:#37474f;white-space:nowrap}
.po-finance-grid{display:grid;grid-template-columns:repeat(6,minmax(110px,1fr));gap:8px;margin:12px 0;padding:12px;background:#f4f7fa;border-radius:8px}
.po-finance-grid .fin-item{background:#fff;border:1px solid #e2e8f0;border-radius:6px;padding:8px 10px;text-align:center}
.po-finance-grid .fin-item span{display:block;font-size:12px;color:#64748b}
.po-finance-grid .fin-item strong{display:block;font-size:15px;color:#0f172a;margin-top:2px}
.po-finance-grid .fin-alert{grid-column:1/-1;border-radius:6px;padding:8px 10px;font-size:13px}
.po-finance-grid .fin-warn{background:#fff8e1;color:#8d6e00;border:1px solid #f0d98a}
.po-finance-grid .fin-error{background:#fdecea;color:#b3261e;border:1px solid #f0b3ad}
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 8px; border-radius: 999px; background: #c62828; color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }

.search-controls.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: center; }
.search-controls.filter-grid .text-input { width: 100%; min-width: 0; }
.search-controls.filter-grid .quiet-button { width: auto; min-width: 76px; justify-self: start; }

.approval-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid #e6e6e6;
  border-bottom: 1px solid #e6e6e6;
  background: #fafafa;
}

.approval-table .approval-check {
  width: 40px;
  text-align: center;
}
