:root {
  --ink: #15253a;
  --ink-soft: #34465a;
  --muted: #5f6f82;
  --muted-strong: #4b5d70;
  --line: #dce3ea;
  --line-strong: #c7d1dc;
  --paper: #ffffff;
  --paper-soft: #f8fafb;
  --canvas: #f1f4f7;
  --nav: #102a3d;
  --nav-soft: #1b3a50;
  --nav-line: rgba(255,255,255,.1);
  --brand: #087c75;
  --brand-dark: #05635e;
  --brand-soft: #e4f3f1;
  --danger: #b82f45;
  --danger-dark: #922438;
  --danger-soft: #fff0f2;
  --warning: #9d5b05;
  --warning-soft: #fff4dd;
  --positive: #117653;
  --positive-soft: #e7f7ef;
  --info: #276b9c;
  --info-soft: #eaf3fa;
  --focus: #168fca;
  --shadow-sm: 0 2px 8px rgba(23, 42, 62, .05);
  --shadow: 0 8px 24px rgba(23, 42, 62, .07);
  --shadow-lg: 0 18px 50px rgba(8, 29, 45, .18);
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
}
* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: clip; font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; color: var(--ink); background: var(--canvas); line-height: 1.5; }
body { margin: 0; min-width: 320px; max-width: 100%; overflow-x: clip; font-size: 14px; }
a { color: #08746f; text-decoration: none; }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, svg, canvas, video { max-width: 100%; }
h1, h2, h3, p, a, dd, td, th, .cell-note { overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid rgba(22,143,202,.38); outline-offset: 2px; }
::selection { color: var(--ink); background: #cceae7; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: 10px; z-index: 100; transform: translateY(-150%); padding: 9px 13px; border-radius: var(--radius-sm); color: white; background: var(--ink); transition: transform .16s ease; }
.skip-link:focus { transform: translateY(0); color: white; }
.app-shell { width: 100%; max-width: 100%; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 256px minmax(0, 1fr); overflow-x: clip; }
.sidebar { background: var(--nav); color: #dbe6ec; position: fixed; inset: 0 auto 0 0; width: 256px; padding: 20px 14px 16px; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; min-width: 0; align-items: center; gap: 11px; color: white; }
.brand:hover { color: white; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: white; font-weight: 800; background: linear-gradient(145deg, #13a198, #087069); box-shadow: inset 0 1px rgba(255,255,255,.35); }
.brand > span:last-child { min-width: 0; }
.brand b, .brand small { display: block; min-width: 0; overflow-wrap: anywhere; }
.brand b { font-size: 15px; }
.brand small { font-size: 11px; color: #9cb0bd; margin-top: 2px; }
.sidebar-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 0 6px 26px; }
.sidebar-head .brand { flex: 1 1 auto; }
.sidebar .menu-close { display: none; position: static; width: 38px; min-width: 38px; max-width: 38px; height: 38px; min-height: 38px; flex: 0 0 38px; place-items: center; align-self: flex-start; padding: 0; appearance: none; border: 1px solid var(--nav-line); border-radius: var(--radius); color: white; background: transparent; font-size: 23px; line-height: 1; cursor: pointer; }
.sidebar .menu-close:hover { background: rgba(255,255,255,.08); }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sidebar nav a { min-height: 42px; color: #c8d5dd; padding: 9px 12px; border-radius: var(--radius); display: flex; gap: 11px; align-items: center; font-size: 13px; }
.sidebar nav a span, .sidebar nav a svg { width: 18px; flex: 0 0 18px; color: #9bb0bd; text-align: center; }
.sidebar nav a:hover, .sidebar nav a.active { color: white; background: var(--nav-soft); }
.sidebar nav a.active { box-shadow: inset 3px 0 #27b7ac; }
.sidebar nav a.active span, .sidebar nav a.active svg { color: #71d7cf; }
.nav-label { padding: 18px 12px 6px; color: #9aafbb; font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.nav-label:first-child { padding-top: 2px; }
.sidebar-footer { margin-top: auto; padding: 12px 10px 0; color: #8fa5b2; font-size: 11px; border-top: 1px solid rgba(255,255,255,.08); }
.status-dot { display: inline-block; width: 7px; height: 7px; background: #35c58e; border-radius: 50%; margin-right: 4px; }
.menu-overlay { position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(7, 24, 37, .52); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
main { grid-column: 2; width: 100%; max-width: 100%; min-width: 0; overflow-x: clip; }
.topbar { height: 64px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px); }
.topbar-title { font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.topbar-user form { margin: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #dbeae9; color: var(--brand-dark); font-weight: 800; display: grid; place-items: center; }
.link-button { min-height: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.menu-toggle { display: none; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); font-size: 20px; cursor: pointer; }
.content { width: 100%; max-width: 1680px; min-width: 0; padding: 26px 30px 50px; margin: auto; }
.page-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin-bottom: 22px; }
.page-heading > * { min-width: 0; }
.page-heading h1 { margin: 0; font-size: clamp(23px, 2.2vw, 28px); line-height: 1.25; letter-spacing: -.03em; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .06em; margin-bottom: 6px; }
.actions { display: flex; min-width: 0; align-items: center; gap: 9px; flex-wrap: wrap; }
.actions > * { min-width: 0; }
.actions form { margin: 0; }
.btn { min-height: 40px; border: 1px solid transparent; border-radius: var(--radius); padding: 8px 14px; gap: 7px; font-weight: 700; font-size: 13px; line-height: 1.2; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: wait; opacity: .7; transform: none; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); color: white; }
.btn-secondary { background: white; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: #91a2b3; color: var(--ink); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); color: white; }
.btn-quiet { background: var(--paper-soft); color: var(--ink-soft); border-color: var(--line); }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.is-loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-block { width: 100%; }
.text-link { font-size: 13px; }
.filter-bar { display: flex; min-width: 0; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px; background: white; border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.filter-bar > * { min-width: 0; }
.filter-bar .form-control { width: auto; min-width: 160px; }
.filter-bar .search-input { min-width: 320px; }
.filter-field { display: flex; min-width: 150px; flex-direction: column; gap: 5px; }
.filter-field.grow { flex: 1 1 260px; }
.filter-field label { color: var(--muted-strong); font-size: 11px; font-weight: 700; }
.filter-field .form-control { width: 100%; min-width: 0; }
.compact-field { min-width: 150px; flex: 0 1 190px; }
.compact-field.grow { flex: 1 1 270px; }
.compact-field label { color: var(--muted-strong); font-size: 11px; font-weight: 700; }
.filter-bar .compact-field .form-control { width: 100%; min-width: 0; }
.filter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.query-form { width: 100%; min-width: 0; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
.filter-grid { display: grid; min-width: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 12px; }
.filter-grid > * { min-width: 0; }
.filter-grid .field { min-width: 0; }
.filter-grid .form-control, .filter-grid .search-input { width: 100%; min-width: 0; }
.dashboard-filter-grid, .forecast-filter-grid, .payment-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-span-2 { grid-column: span 2; }
.filter-collapse { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #f8fafb; }
.filter-collapse > summary { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; color: var(--ink); font-weight: 700; list-style: none; }
.filter-collapse > summary::-webkit-details-marker { display: none; }
.filter-collapse > summary::after { content: "展开"; flex: 0 0 auto; color: var(--brand); font-size: 11px; font-weight: 700; }
.filter-collapse[open] > summary { border-bottom: 1px solid var(--line); }
.filter-collapse[open] > summary::after { content: "收起"; }
.filter-collapse > summary small { color: var(--muted); font-size: 11px; font-weight: 400; }
.filter-collapse > .filter-grid { padding: 14px; }
.dashboard-filters .query-actions { margin-top: 12px; }
.receivable-summary-layout { min-width: 0; }
.receivable-filter-panel .query-form { margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.receivable-filter-panel .message { margin-top: 0; }
.date-range-fields { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.date-range-fields > * { min-width: 0; }
.date-range-fields > span { color: var(--muted); font-size: 11px; }
.panel-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.panel-heading > * { min-width: 0; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.receivable-totals-panel .summary-strip { margin: 0; box-shadow: none; }
.receivable-detail-panel { padding: 0; overflow: hidden; }
.receivable-detail-panel .panel-heading { margin: 0; padding: 18px 19px 14px; }
.payment-table-heading { margin: 0; padding: 18px 19px 14px; border-bottom: 1px solid var(--line); }
.result-count { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.receivable-detail-table { min-width: 1260px; }
.query-actions { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.query-actions > * { min-width: 0; }
.query-actions > p { flex: 1 1 320px; margin: 0; color: var(--muted); font-size: 11px; }
.query-actions > .actions { flex: 0 1 auto; justify-content: flex-end; }
.metric-grid { display: grid; min-width: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.metric-grid.compact { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.metric-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); color: var(--ink); min-width: 0; }
.metric-card > span, .metric-card small { display: block; }
.metric-card > span { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.metric-card strong { display: block; font-size: clamp(20px, 2vw, 24px); letter-spacing: -.03em; white-space: nowrap; }
.metric-card small { color: var(--muted); margin-top: 7px; font-size: 11px; }
.metric-card[href] { position: relative; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.metric-card[href]:hover { color: var(--ink); border-color: #aac7c5; box-shadow: var(--shadow); transform: translateY(-2px); }
.metric-card.danger { border-top: 3px solid var(--danger); }
.metric-card.warning { border-top: 3px solid #dfa031; }
.metric-card.positive { border-top: 3px solid var(--positive); }
.metric-card.severe { background: #26394d; color: white; border-color: #26394d; }
.metric-card.severe > span, .metric-card.severe small { color: #c4d0db; }
.card { width: 100%; max-width: 100%; min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 19px; margin-bottom: 16px; }
.card-header { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 15px; margin-bottom: 14px; }
.card-header > * { min-width: 0; }
.card-header h2 { margin: 0; font-size: 16px; }
.card-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.span-2 { grid-column: span 2; }
.two-columns { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dashboard-grid > *, .two-columns > *, .metric-grid > *, .form-grid > * { min-width: 0; }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; contain: inline-size layout paint; -webkit-overflow-scrolling: touch; }
.table-wrap > table { min-width: 100%; }
.table-wrap > table:not(.responsive-cards) { width: max-content; }
.table-wrap:focus-visible { outline-offset: -3px; }
.table-wrap.tall { max-height: 610px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: var(--muted-strong); font-weight: 700; background: #f6f8fa; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #e8edf1; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }
.row-muted { color: var(--muted); background: #fafbfc; }
.row-error { background: var(--danger-soft) !important; }
.row-selected { background: #eef8f7; box-shadow: inset 3px 0 var(--brand); }
.row-selected:hover { background: #e5f4f2; }
.cell-note { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 3px; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 650; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 4px 8px; font-size: 11px; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.badge.positive { color: var(--positive); background: var(--positive-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.neutral { color: #5d6a78; background: #eef2f5; }
.badge.info { color: var(--info); background: var(--info-soft); }
.danger-text { color: var(--danger) !important; }
.warning-text { color: var(--warning); }
.empty { text-align: center; color: var(--muted); padding: 32px 20px !important; }
.stack-list { display: flex; flex-direction: column; }
.stack-item { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 11px 2px; border-bottom: 1px solid #edf0f3; color: var(--ink); }
.stack-item:last-child { border: 0; }
.stack-item b, .stack-item span { display: block; }
.stack-item span { color: var(--muted); font-size: 10px; margin-top: 4px; }
.stack-item strong { font-size: 12px; white-space: nowrap; }
.summary-strip { display: flex; width: 100%; max-width: 100%; min-width: 0; background: #1c3549; color: white; border-radius: var(--radius-lg); margin-bottom: 17px; overflow-x: auto; box-shadow: var(--shadow); }
.summary-strip > div { flex: 1; min-width: 150px; padding: 16px 18px; border-right: 1px solid rgba(255,255,255,.1); }
.summary-strip span, .summary-strip b { display: block; }
.summary-strip span { color: #aebdca; font-size: 10px; margin-bottom: 6px; }
.summary-strip b { font-size: 15px; }
.detail-grid { display: grid; min-width: 0; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 12px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; }
.form-card { max-width: 1020px; }
.form-grid { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 20px; }
.field-wide { grid-column: 1 / -1; }
.field label, .compact-form label { display: block; font-size: 12px; font-weight: 650; margin-bottom: 6px; }
.field label em { color: var(--danger); font-style: normal; margin-left: 3px; }
.field small { display: block; color: var(--muted); margin-top: 5px; }
.field.has-error .form-control { border-color: var(--danger); }
.field-checkbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.field-checkbox label { margin: 0; }
.field-checkbox .field-error { width: 100%; }
.form-control { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; color: var(--ink); background: white; outline: none; }
.form-control:hover { border-color: #aab7c4; }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,122,117,.12); }
.form-control[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(184,47,69,.1); }
textarea.form-control { resize: vertical; }
.checkbox { accent-color: var(--brand); width: 17px; height: 17px; }
.field-error { color: var(--danger-dark); font-size: 12px; margin-top: 5px; }
.form-actions { display: flex; min-width: 0; flex-wrap: wrap; gap: 9px; margin-top: 23px; }
.form-actions > * { min-width: 0; }
.contract-wizard { max-width: 1120px; }
.form-section { display: grid; grid-template-columns: 42px 1fr; gap: 14px; }
.section-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e3f1f0; color: var(--brand-dark); font-weight: 800; }
.section-content h2 { margin: 5px 0; font-size: 16px; }
.section-content > p { color: var(--muted); margin: 0 0 17px; font-size: 11px; }
.sticky-actions { position: sticky; bottom: 12px; display: flex; min-width: 0; flex-wrap: wrap; gap: 9px; padding: 12px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 8px 30px rgba(20,40,60,.12); z-index: 5; }
.compact-form p { margin: 0 0 13px; }
.compact-form .form-control { margin-bottom: 11px; }
.danger-zone { border-color: #efcdd2; background: #fffafb; }
.narrow-card { max-width: 650px; }
.message { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 12px; }
.message.success { background: var(--positive-soft); color: #116c4a; border: 1px solid #bde7d3; }
.message.error { background: var(--danger-soft); color: #9d2738; border: 1px solid #f1c7ce; }
.message.warning { background: var(--warning-soft); color: #8d570a; border: 1px solid #f2dbad; }
.message.info { background: var(--info-soft); color: #245d85; border: 1px solid #c5ddeb; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 16px; font-size: 12px; color: var(--muted); }
.rule-list, .error-list { margin: 0; padding-left: 22px; font-size: 12px; line-height: 2; }
.error-list { color: var(--danger); }
.notice-banner { display: flex; min-width: 0; flex-wrap: wrap; gap: 16px; padding: 14px 17px; background: #e9f2f5; border: 1px solid #c9dce3; border-radius: 10px; margin-bottom: 16px; font-size: 12px; }
.notice-banner span { color: #536678; }
.checksum { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
details summary { cursor: pointer; color: var(--brand); }
details pre { max-width: 400px; white-space: pre-wrap; font-size: 10px; color: var(--muted); }
.section-nav { display: flex; gap: 4px; margin: -5px 0 20px; padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #e9eef2; }
.section-nav a { min-height: 36px; padding: 8px 13px; border-radius: 8px; color: var(--muted-strong); font-size: 12px; font-weight: 700; white-space: nowrap; }
.section-nav a:hover, .section-nav a.active, .section-nav a[aria-current="page"] { color: var(--ink); background: white; box-shadow: var(--shadow-sm); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 12px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.work-queue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.work-card { display: flex; min-width: 0; min-height: 112px; flex-direction: column; justify-content: space-between; gap: 10px; padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); background: white; box-shadow: var(--shadow-sm); }
.work-card:hover { color: var(--ink); border-color: #abc2c1; box-shadow: var(--shadow); }
.work-card-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted-strong); font-size: 12px; font-weight: 700; }
.work-card strong { display: block; overflow: hidden; font-size: 21px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.work-card small { color: var(--muted); font-size: 11px; }
.work-card.danger { border-left: 4px solid var(--danger); }
.work-card.warning { border-left: 4px solid #cf850f; }
.work-card.info { border-left: 4px solid var(--info); }
.work-card.positive { border-left: 4px solid var(--positive); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.customer-groups { display: flex; flex-direction: column; gap: 14px; }
.customer-group, .customer-receivable-group { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
#receivable-summary, #receivable-forecast, .customer-receivable-group { scroll-margin-top: 80px; }
.customer-group-header { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #f8fafb; }
.customer-group-header > * { min-width: 0; }
.customer-group-header h3 { margin: 0; font-size: 15px; }
.customer-group-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.customer-group-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.customer-group-actions small { color: var(--muted); font-size: 11px; }
.customer-heading { min-width: 0; }
.customer-heading h3 { margin: 0; font-size: 15px; }
.customer-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.customer-totals { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin-left: auto; }
.customer-total { min-width: 90px; text-align: right; }
.customer-total span, .customer-total strong { display: block; }
.customer-total span { color: var(--muted); font-size: 10px; }
.customer-total strong { margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.customer-group .table-wrap, .customer-receivable-group .table-wrap { border-radius: 0; }
.customer-group table, .customer-receivable-group table { margin: 0; }
.group-more { border-top: 1px solid var(--line); }
.group-more > summary { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; color: var(--brand-dark); background: #f8fafb; font-size: 12px; font-weight: 700; text-align: center; cursor: pointer; list-style: none; }
.group-more > summary::-webkit-details-marker { display: none; }
.group-more > summary::after { content: "⌄"; font-size: 15px; line-height: 1; transition: transform .15s ease; }
.group-more[open] > summary::after { transform: rotate(180deg); }
.group-more > summary:hover { background: #f1f6f6; }
.row-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; white-space: normal; }
.table-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; white-space: normal; }
.btn-small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.row-overdue { background: #fffafb; }
.row-overdue:hover { background: #fff5f6; }
.empty-state h3 { margin: 0 0 5px; color: var(--ink); font-size: 15px; }
.empty-state p { margin: 0 0 14px; }
.status-stack { display: flex; align-items: flex-start; flex-direction: column; gap: 4px; }
.result-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: -4px 0 10px; color: var(--muted); font-size: 12px; }
.forecast-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; overflow-x: auto; padding: 2px 1px 10px; }
.forecast-month { min-width: 130px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: white; }
.forecast-month:hover { color: var(--ink); border-color: #9ebdbb; }
.forecast-month time { display: block; color: var(--muted-strong); font-size: 11px; font-weight: 700; }
.forecast-month strong { display: block; margin: 8px 0 2px; font-size: 17px; font-variant-numeric: tabular-nums; }
.forecast-month span { display: block; color: var(--muted); font-size: 10px; }
.forecast-bar { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: #e8edf1; }
.forecast-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.flow-steps { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.flow-steps li { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.flow-steps li:not(:last-child)::after { content: ""; width: clamp(18px, 4vw, 52px); height: 1px; margin-left: 2px; background: var(--line-strong); }
.flow-steps span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: var(--muted-strong); background: #e8edf1; }
.flow-steps .active { color: var(--ink); }
.flow-steps .active span, .flow-steps .complete span { color: white; background: var(--brand); }
.payment-total { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; padding: 14px 2px 0; color: var(--muted-strong); font-size: 12px; }
.payment-total strong { min-width: 140px; color: var(--ink); font-size: 20px; text-align: right; font-variant-numeric: tabular-nums; }
.context-banner { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; padding: 13px 15px; border: 1px solid #bddbd8; border-radius: var(--radius); background: var(--brand-soft); }
.context-banner > * { min-width: 0; }
.context-banner strong, .context-banner span { display: block; }
.context-banner span { margin-top: 2px; color: var(--muted-strong); font-size: 11px; }
.selected-context { border-color: #b8d8d5; background: linear-gradient(180deg, #f7fcfb, white); }
.error-summary { margin-bottom: 16px; padding: 14px 16px; border: 1px solid #e8b9c1; border-radius: var(--radius); color: var(--danger-dark); background: var(--danger-soft); }
.error-summary h2 { margin: 0 0 6px; font-size: 14px; }
.error-summary ul { margin: 0; padding-left: 20px; font-size: 12px; }
.message ul { margin: 7px 0 0; padding-left: 20px; }
.refresh-controls { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.refresh-controls button { border: 0; color: var(--brand-dark); background: none; cursor: pointer; }
.notice-paper { width: 210mm; max-width: 100%; min-height: 280mm; margin: 0 auto; padding: 18mm; background: white; box-shadow: var(--shadow); font-family: "SimSun", "Microsoft YaHei", sans-serif; font-size: 12px; }
.notice-paper header { text-align: center; }
.notice-paper header h2 { margin: 0 0 8px; }
.notice-paper header h1 { margin: 0 0 8px; font-size: 22px; }
.notice-code { text-align: right; margin: 15px 0; }
.notice-paper table { margin: 18px 0; }
.notice-total { text-align: right; font-size: 14px; }
.notice-payment { margin-top: 20px; line-height: 1.4; }
.notice-seal { text-align: right; margin-top: 45px; line-height: 2.2; }
.login-body { background: #0e2638; min-height: 100vh; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-intro { padding: 10vh 8vw; color: white; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 20% 20%, rgba(26,158,146,.35), transparent 40%), linear-gradient(145deg, #102c3f, #0b1d2c); }
.login-badge { display: inline-flex; align-self: flex-start; border: 1px solid rgba(255,255,255,.25); border-radius: 99px; padding: 6px 10px; font-size: 11px; }
.login-intro h1 { font-size: clamp(42px, 5vw, 72px); line-height: 1.1; letter-spacing: -.06em; margin: 30px 0 20px; }
.login-intro > p { color: #b3c5d2; max-width: 520px; font-size: 16px; line-height: 1.8; }
.login-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 45px; }
.login-feature-grid div { border-top: 1px solid rgba(255,255,255,.2); padding-top: 14px; }
.login-feature-grid b, .login-feature-grid span { display: block; }
.login-feature-grid span { color: #8fa7b6; font-size: 10px; margin-top: 5px; }
.login-panel { background: #f5f7f8; display: grid; place-items: center; padding: 30px; }
.login-card { width: min(390px, 100%); background: white; border: 1px solid var(--line); border-radius: 16px; padding: 34px; box-shadow: 0 24px 60px rgba(0,0,0,.14); }
.brand-dark { color: var(--ink); margin: 0 0 34px; }
.brand-dark:hover { color: var(--ink); }
.brand-dark small { color: var(--muted); }
.login-card h2 { margin: 0; font-size: 25px; }
.login-card .muted { color: var(--muted); font-size: 12px; margin: 7px 0 25px; }
.login-card > label { display: block; font-size: 12px; font-weight: 650; margin: 14px 0 6px; }
.login-card .btn { margin-top: 21px; padding: 11px; }
.login-note { display: block; text-align: center; color: #8a96a3; margin-top: 16px; font-size: 10px; }
code { background: #eef2f5; padding: 2px 5px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
  .work-queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-layout { grid-template-columns: 1fr 1fr; }
  .login-feature-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { width: min(86vw, 300px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .menu-open .sidebar { transform: translateX(0); }
  .menu-open { overflow: hidden; }
  .menu-open .menu-overlay { opacity: 1; pointer-events: auto; }
  .sidebar .menu-close { display: grid; place-items: center; }
  main { display: block; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 15px; }
  .topbar-title { margin-right: auto; margin-left: 10px; }
  .content { padding: 20px 14px 40px; }
  .page-heading { gap: 14px; }
  .metric-grid, .metric-grid.compact, .dashboard-grid, .two-columns, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .filter-span-2 { grid-column: span 2; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .form-control, .filter-bar .search-input { width: 100%; min-width: 0; }
  .filter-field { flex: 1 1 190px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .notice-paper { padding: 8mm; min-height: 0; }
}
@media (max-width: 640px) {
  .topbar-user > span:not(.avatar) { display: none; }
  .page-heading { flex-direction: column; }
  .page-heading .actions { width: 100%; }
  .page-heading .actions .btn { flex: 1 1 auto; }
  .card-header { align-items: flex-start; }
  .query-form { padding: 14px; }
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; }
  .filter-span-2 { grid-column: auto; }
  .query-actions { align-items: stretch; flex-direction: column; }
  .query-actions > p { flex-basis: auto; }
  .query-actions > .actions { width: 100%; justify-content: stretch; }
  .query-actions > .actions .btn { flex: 1 1 100%; width: 100%; }
  .work-queue { grid-template-columns: 1fr 1fr; gap: 9px; }
  .work-card { min-height: 104px; padding: 13px; }
  .work-card strong { font-size: 18px; }
  .customer-group-header { align-items: flex-start; flex-direction: column; }
  .customer-totals { width: 100%; justify-content: flex-start; margin-left: 0; }
  .customer-total { min-width: 0; text-align: left; }
  .customer-group-header > .actions, .customer-group-header > .btn { width: 100%; }
  .customer-group-header > .actions .btn, .customer-group-header > .btn { flex: 1; }
  .result-summary { align-items: flex-start; flex-direction: column; }
  .receivable-totals-panel .panel-heading { flex-direction: column; gap: 4px; }
  .summary-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; }
  .summary-strip > div { min-width: 0; padding: 13px 15px; border-right: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
  .summary-strip > div:nth-child(even) { border-right: 0; }
  .summary-strip > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .receivable-totals { grid-template-columns: 1fr; }
  .receivable-totals > div { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .receivable-totals > div:last-child { border-bottom: 0; }
  .summary-strip b, .receivable-totals b { min-width: 0; font-size: clamp(13px, 4.2vw, 15px); white-space: normal; overflow-wrap: anywhere; }
  .receivable-totals > div:nth-child(2) { border-bottom: 1px solid rgba(255,255,255,.1); }
  .receivable-totals > div:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .receivable-detail-table { min-width: 0; }
  .flow-steps { align-items: flex-start; }
  .flow-steps li { min-width: 0; flex: 1; align-items: flex-start; flex-direction: column; line-height: 1.3; }
  .flow-steps li:not(:last-child)::after { display: none; }
  .card-header > .payment-total { width: 100%; flex: 1 1 100%; justify-content: space-between; flex-wrap: nowrap; padding-top: 0; white-space: nowrap; }
  .payment-total strong { min-width: 0; }
  .context-banner { align-items: flex-start; flex-direction: column; }
  .responsive-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .responsive-cards, .responsive-cards tbody, .responsive-cards tr, .responsive-cards td { display: block; width: 100%; }
  .responsive-cards tr { padding: 11px 13px; border-bottom: 1px solid var(--line); }
  .responsive-cards tr:last-child { border-bottom: 0; }
  .responsive-cards td { display: grid; min-width: 0; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr); gap: 10px; padding: 5px 0; border: 0; text-align: left; white-space: normal; }
  .responsive-cards td > * { min-width: 0; max-width: 100%; }
  .responsive-cards td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; }
  .responsive-cards td[colspan] { display: block; }
  .responsive-cards td[colspan]::before { display: none; }
  .responsive-cards .row-actions, .responsive-cards .table-actions { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
}
@media (max-width: 420px) {
  .work-queue { grid-template-columns: 1fr; }
  .filter-field, .filter-actions, .filter-actions .btn { width: 100%; flex-basis: 100%; }
  .form-actions > .btn, .form-actions > button { flex: 1 1 100%; width: 100%; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .date-range-fields { grid-template-columns: minmax(0, 1fr); }
  .date-range-fields > span { display: none; }
  .filter-collapse > summary small { display: none; }
  .detail-heading { flex-direction: column; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media print {
  body { background: white; }
  .sidebar, .topbar, .menu-overlay, .no-print, .messages { display: none !important; }
  .app-shell { display: block; }
  main { display: block; }
  .content { padding: 0; }
  .notice-paper { width: auto; min-height: auto; box-shadow: none; padding: 10mm; }
}
