:root{--primary:#2456d6;--primary-dark:#173f9f;--ink:#172033;--muted:#6b7486;--line:#e5e9f1;--bg:#f4f6fa;--card:#fff;--success:#16865b;--danger:#c43c49;--warning:#b7791f;--sidebar:#111a2e}*{box-sizing:border-box}body{margin:0;font-family:"Microsoft YaHei","PingFang SC",Arial,sans-serif;color:var(--ink);background:var(--bg);font-size:14px}a{color:var(--primary);text-decoration:none}button,input,select,textarea{font:inherit}.login-body{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at 20% 10%,#dfe9ff 0,transparent 32%),linear-gradient(135deg,#f8faff,#e8eefb)}.login-card{width:min(420px,calc(100% - 32px));background:#fff;border:1px solid #dfe5f0;border-radius:18px;padding:36px;box-shadow:0 18px 50px rgba(31,54,105,.12)}.install-card{width:min(520px,calc(100% - 32px))}.brand-mark{width:54px;height:54px;display:grid;place-items:center;margin-bottom:20px;border-radius:15px;background:linear-gradient(135deg,var(--primary),#5e82eb);color:#fff;font-size:26px;font-weight:700}.login-card h1{margin:0 0 8px}.muted,.hint{color:var(--muted)}.hint{font-size:12px}.login-card label,.form-grid label{display:block;color:#3b465b;font-weight:600}.login-card input,.form-grid input,.form-grid select,.form-grid textarea,.filters input,.filters select{width:100%;margin-top:8px;padding:10px 12px;border:1px solid #ccd3df;border-radius:8px;background:#fff;color:var(--ink)}.login-card label{margin-top:18px}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:38px;padding:8px 14px;border:1px solid #cbd3e0;border-radius:8px;background:#fff;color:#26334a;cursor:pointer}.btn:hover{border-color:#9eabc0}.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}.btn.primary:hover{background:var(--primary-dark)}.btn.danger{color:var(--danger);border-color:#efc1c6}.btn.small{min-height:30px;padding:4px 9px;font-size:12px}.btn.block{width:100%;margin-top:24px}.app{min-height:100vh}.sidebar{position:fixed;inset:0 auto 0 0;width:224px;background:var(--sidebar);color:#dce4f5;padding:22px 14px}.sidebar-brand{display:flex;align-items:center;gap:10px;padding:0 10px 22px;font-size:17px;font-weight:700}.sidebar-brand .brand-mark{width:34px;height:34px;margin:0;border-radius:10px;font-size:17px}.nav-group{margin-top:12px}.nav-title{padding:8px 12px;color:#7f8aa1;font-size:12px}.nav a{display:flex;align-items:center;padding:10px 12px;margin:3px 0;color:#bac5da;border-radius:8px}.nav a:hover,.nav a.active{background:#22304e;color:#fff}.main{margin-left:224px;min-height:100vh}.topbar{height:64px;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 28px;position:sticky;top:0;z-index:5}.user-box{display:flex;align-items:center;gap:12px}.content{padding:26px}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:20px}.page-head h1{font-size:24px;margin:0 0 5px}.page-head p{margin:0;color:var(--muted)}.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:20px;box-shadow:0 2px 8px rgba(27,39,68,.03);margin-bottom:18px}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:18px}.stat{background:#fff;border:1px solid var(--line);border-radius:12px;padding:20px}.stat .label{color:var(--muted);margin-bottom:10px}.stat .value{font-size:25px;font-weight:700}.stat .sub{font-size:12px;color:var(--muted);margin-top:7px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;white-space:nowrap}th,td{text-align:left;padding:12px 10px;border-bottom:1px solid var(--line)}th{background:#f8f9fc;color:#536077;font-size:12px;font-weight:600}tr:last-child td{border-bottom:0}.actions{display:flex;gap:7px}.filters{display:grid;grid-template-columns:repeat(5,minmax(140px,1fr));gap:12px;align-items:end}.filter-actions{display:flex;gap:8px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.form-grid .full{grid-column:1/-1}.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px;padding-top:18px;border-top:1px solid var(--line)}.required:after{content:" *";color:var(--danger)}.alert{padding:12px 14px;border-radius:8px;margin-bottom:16px}.alert.success{background:#e8f7f0;color:#0d6845;border:1px solid #b8e3d0}.alert.danger{background:#fff0f1;color:#9f2532;border:1px solid #f1c4c8}.alert.warning{background:#fff8e8;color:#8b5e14;border:1px solid #f0dcad}.badge{display:inline-block;padding:4px 8px;border-radius:99px;font-size:12px;background:#eef1f6;color:#566177}.badge-enabled,.badge-paid,.badge-normal{background:#e6f6ef;color:#0d7250}.badge-disabled,.badge-void{background:#f2f3f6;color:#737b89}.badge-unpaid,.badge-red{background:#fff0f1;color:#b22e3d}.badge-partial{background:#fff7df;color:#916313}.money{font-variant-numeric:tabular-nums;text-align:right}.empty{text-align:center;color:var(--muted);padding:38px!important}.pagination{display:flex;gap:6px;justify-content:flex-end;margin-top:16px}.pagination a,.pagination span{padding:7px 10px;border:1px solid var(--line);border-radius:7px;background:#fff}.pagination .current{background:var(--primary);color:#fff;border-color:var(--primary)}@media(max-width:1000px){.stats{grid-template-columns:repeat(2,1fr)}.filters{grid-template-columns:repeat(2,1fr)}}@media(max-width:720px){.sidebar{position:static;width:auto}.main{margin-left:0}.topbar{padding:0 16px}.content{padding:16px}.form-grid,.filters,.stats{grid-template-columns:1fr}.page-head{flex-direction:column}}
:where([hidden]){display:none!important}

/* 2026-07-20 product and layout refinement */
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex="0"]:focus-visible{outline:3px solid rgba(36,86,214,.28);outline-offset:2px}
input:read-only{background:#f7f8fb;color:#344057}
button:disabled{cursor:wait;opacity:.72}
.btn{min-height:40px;font-weight:500;transition:border-color .15s,background-color .15s,box-shadow .15s}
.btn.primary{box-shadow:0 3px 8px rgba(36,86,214,.16)}
.topbar{box-shadow:0 1px 0 rgba(19,30,53,.02)}
.filters label{display:block;color:#3b465b;font-weight:600}
.filters input,.filters select{min-height:42px}
tbody tr{transition:background-color .12s}
tbody tr:hover{background:#f8faff}
.cell-main{font-weight:500;color:#243149;white-space:normal;min-width:150px}
.outstanding,.warning-value{color:var(--warning)!important}
.table-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;color:var(--muted);font-size:12px}
.pagination{align-items:center;flex-wrap:wrap}
.pagination-summary{margin-right:4px;color:var(--muted);border:0!important;background:transparent!important;padding-left:0!important}
.pagination-jump{display:inline-flex;align-items:center;gap:6px;margin-left:6px;color:var(--muted)}
.pagination-jump label{display:inline-flex;align-items:center;gap:6px}
.pagination-jump input[type=number]{width:68px;height:34px;padding:5px 7px;border:1px solid var(--line);border-radius:7px;text-align:center;color:var(--ink);background:#fff}
.pagination-jump button{height:34px;padding:5px 10px;border:1px solid #cbd3e0;border-radius:7px;background:#fff;color:#26334a;cursor:pointer}
.pagination-jump button:hover{border-color:#9eabc0;background:#f8faff}
.pagination a:hover{border-color:#9eabc0;background:#f8faff}
.section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}
.section-head h2{margin:0 0 4px;font-size:18px}.section-head p{margin:0;color:var(--muted);font-size:13px}
.dashboard-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(280px,1fr);gap:18px}
.dashboard-todos,.dashboard-month{margin-bottom:18px}
.todo-row{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 0;border-top:1px solid var(--line);color:var(--ink)}
.todo-row:first-of-type{border-top:0}.todo-row:hover strong{color:var(--primary)}
.todo-row span:first-child{display:flex;flex-direction:column;gap:4px}.todo-row small{color:var(--muted)}.todo-value{font-weight:600;text-align:right;white-space:nowrap}
.month-metric{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 0;border-top:1px solid var(--line)}.month-metric:first-of-type{border-top:0}.month-metric span{color:var(--muted)}.month-metric strong{font-size:17px;font-variant-numeric:tabular-nums}
.invoice-summary{grid-template-columns:repeat(3,minmax(0,1fr))}
.form-section-title{display:flex;align-items:center;gap:12px;margin-top:4px;padding:14px 0 4px;border-top:1px solid var(--line)}
.form-section-title:first-child{margin-top:-4px;border-top:0;padding-top:0}
.form-section-title>span{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#e9efff;color:var(--primary);font-weight:700}
.form-section-title>div{display:flex;flex-direction:column;gap:3px}.form-section-title strong{font-size:16px}.form-section-title small{color:var(--muted);font-weight:400}
.invoice-form-card .form-grid label{padding:2px 0}.invoice-form-card input[readonly]{border-style:dashed}.invoice-form-card .form-actions{position:sticky;bottom:0;z-index:4;margin:24px -20px -20px;padding:16px 20px;background:rgba(255,255,255,.96);box-shadow:0 -8px 22px rgba(17,26,46,.07);backdrop-filter:blur(7px)}
.switch-line{display:flex;align-items:center;gap:9px;font-weight:600}.switch-line input{width:auto!important;margin:0!important}.fee-scheme-form{padding:16px 0;border-top:1px solid var(--line)}.fee-scheme-form .form-grid{grid-template-columns:2fr 1fr 1.35fr 1fr auto;align-items:end}.fee-scheme-form .form-actions{margin:0;padding:0;border:0}.fee-scheme-new{background:#f8faff;margin:10px -8px -8px;padding:16px;border-radius:10px}.fee-scheme-new .form-grid{grid-template-columns:2fr 1fr 1.35fr auto}@media(max-width:1000px){.fee-scheme-form .form-grid,.fee-scheme-new .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:720px){.fee-scheme-form .form-grid,.fee-scheme-new .form-grid{grid-template-columns:1fr}}
.stat .value{font-variant-numeric:tabular-nums}.stat{transition:transform .15s,box-shadow .15s}.stat:hover{transform:translateY(-1px);box-shadow:0 7px 20px rgba(27,39,68,.07)}
.context-link{color:inherit;text-decoration-line:underline;text-decoration-style:dotted;text-decoration-color:#aab5c9;text-underline-offset:3px;cursor:pointer}
.context-link:hover{color:var(--primary);text-decoration-color:var(--primary)}
.stat-link{display:block;color:var(--ink)}.stat-link:hover{border-color:#c9d5f3}.stat-link:hover .label,.stat-link:hover .sub{color:var(--primary)}
#receipt_form,#receipt_history,[id^="ledger-entry-"]{scroll-margin-top:84px}
.mobile-menu-toggle{display:none;margin-left:auto;width:42px;height:38px;padding:9px;border:1px solid rgba(255,255,255,.24);border-radius:8px;background:transparent;cursor:pointer}
.mobile-menu-toggle span{display:block;height:2px;margin:4px 0;border-radius:2px;background:#fff;transition:transform .18s,opacity .18s}
.scoped-viewer.page-invoice-receipts table td:nth-child(3){white-space:normal;min-width:220px}
@media(max-width:1100px){.dashboard-grid{grid-template-columns:1fr}.invoice-summary{grid-template-columns:repeat(3,1fr)}}
@media(max-width:720px){.sidebar{padding:12px 14px}.sidebar-brand{padding:0 2px}.sidebar-brand .brand-mark{width:32px;height:32px}.mobile-menu-toggle{display:block}.sidebar .nav{display:none;margin-top:12px;padding-top:10px;border-top:1px solid rgba(255,255,255,.12);grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}.sidebar.is-mobile-open .nav{display:grid}.sidebar.is-mobile-open .mobile-menu-toggle span:nth-child(1){transform:translateY(6px) rotate(45deg)}.sidebar.is-mobile-open .mobile-menu-toggle span:nth-child(2){opacity:0}.sidebar.is-mobile-open .mobile-menu-toggle span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}.nav-group{display:contents}.nav-title{grid-column:1/-1;padding-top:12px}.nav a{margin:0}.topbar{height:auto;min-height:58px}.user-box span{display:none}.page-head .actions{width:100%;flex-wrap:wrap}.page-head .actions .btn{flex:1}.invoice-summary{grid-template-columns:1fr}.dashboard-grid{grid-template-columns:1fr}.todo-row{align-items:flex-start}.invoice-form-card .form-actions{margin-left:-16px;margin-right:-16px}.table-meta{align-items:flex-start}}

/* 分组折叠侧边栏 */
.sidebar{overflow-y:auto;overflow-x:hidden}.nav-section{margin:8px 0}.nav-section summary{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 12px;border-radius:8px;color:#7f8aa1;font-size:12px;font-weight:600;letter-spacing:.04em;cursor:pointer;list-style:none;user-select:none}.nav-section summary::-webkit-details-marker{display:none}.nav-section summary:hover,.nav-section.contains-active>summary{color:#dce4f5;background:rgba(255,255,255,.045)}.nav-chevron{width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);transition:transform .18s ease}.nav-section[open] .nav-chevron{transform:rotate(45deg) translate(-1px,-1px)}.nav-section .nav-group{margin:3px 0 6px;padding-left:6px;border-left:1px solid rgba(255,255,255,.1)}.nav-section .nav-group a{position:relative;padding-left:14px}.nav-section .nav-group a.active:before{content:"";position:absolute;left:0;top:10px;bottom:10px;width:3px;border-radius:3px;background:#6f94ff}
.nav>.nav-home{margin:4px 0 12px}
.menu-permission-field{margin:0;padding:16px;border:1px solid #dbe3ef;border-radius:10px}.menu-permission-field legend{padding:0 7px;color:#3b465b;font-weight:700}.menu-permission-field .hint{margin:0 0 12px;font-weight:400}.menu-permission-grid,.operation-permission-grid{display:grid;grid-template-columns:repeat(4,minmax(140px,1fr));gap:10px}.menu-permission-grid label,.operation-permission-grid label{display:flex;align-items:center;gap:8px;padding:11px 12px;border:1px solid #dbe3ef;border-radius:8px;background:#f8fafc;font-weight:500;cursor:pointer}.menu-permission-grid label:has(input:checked),.operation-permission-grid label:has(input:checked){border-color:#88a7f2;background:#eef3ff;color:#173f9f}.menu-permission-grid label:has(input:disabled){opacity:.45;cursor:not-allowed}.menu-permission-grid input,.operation-permission-grid input{width:auto!important;margin:0!important}.menu-permission-summary{display:block;max-width:320px;white-space:normal;line-height:1.6}.readonly-permission-note{display:flex;align-items:flex-start;gap:14px;padding:14px 16px;border:1px solid #b8e3d0;border-radius:10px;background:#eefaf5;color:#245d49}.readonly-permission-note strong{white-space:nowrap}.readonly-permission-note span{line-height:1.6}
@media(max-width:900px){.menu-permission-grid,.operation-permission-grid{grid-template-columns:repeat(2,minmax(130px,1fr))}}
@media(max-width:720px){.sidebar .nav{grid-template-columns:1fr}.nav>.nav-home{grid-column:1/-1;margin-bottom:6px}.nav-section{grid-column:1/-1;margin:2px 0}.nav-section summary{padding:10px 8px}.nav-section .nav-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin:2px 0 8px;padding-left:6px}.nav-section .nav-group a{min-width:0}}
.project-overview-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.project-overview-grid>div{display:flex;flex-direction:column;gap:7px;padding:14px 16px;border:1px solid var(--line);border-radius:10px;background:#fafbfe}.project-terms{margin-top:18px;padding-top:18px;border-top:1px solid var(--line)}.project-terms p{margin:8px 0 0;line-height:1.8;white-space:normal}.table-cell-sub{display:block;margin-top:5px;color:var(--muted);font-size:12px}.badge-planned,.badge-pending{background:#eef3ff;color:#2456d6}.badge-in_progress{background:#e8f7f0;color:#0d6845}.badge-completed{background:#e6f6ef;color:#0d7250}.badge-suspended{background:#fff7df;color:#916313}@media(max-width:900px){.project-overview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:720px){.project-overview-grid{grid-template-columns:1fr}}
.badge-success{background:#dff5e9;color:#087347;font-weight:600}.badge-failed,.badge-error{background:#ffe7e9;color:#b42335;font-weight:600}.badge-cancelled{background:#eef0f4;color:#687184}
.payment-schedule-builder{border:1px solid #dbe3ef;border-radius:12px;background:#fbfcff;padding:16px}.payment-schedule-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:12px}.payment-schedule-head>div:first-child{display:flex;flex-direction:column;gap:4px}.payment-schedule-table{min-width:1120px}.payment-schedule-table th:first-child,.payment-schedule-table td:first-child{width:76px;text-align:center}.payment-schedule-table th:nth-child(2),.payment-schedule-table td:nth-child(2){width:140px}.payment-schedule-table th:nth-child(3),.payment-schedule-table td:nth-child(3){min-width:300px}.payment-schedule-table input{min-width:0;width:100%;padding:9px 10px}.percent-input{display:flex;align-items:center;gap:6px}.percent-input input{text-align:right}.payment-schedule-summary{display:flex;justify-content:flex-end;gap:28px;padding:12px 4px 0;color:#526079}.payment-schedule-summary strong{color:#10203d;font-size:16px}.payment-schedule-summary strong.is-incomplete{color:#b7791f}.payment-schedule-summary strong.is-over{color:#d93025}.payment-schedule-view th,.payment-schedule-view td{vertical-align:middle}@media(max-width:900px){.payment-schedule-head{flex-direction:column}.payment-schedule-summary{justify-content:flex-start;flex-wrap:wrap}}
/* 批量处理中心 */
.batch-entry-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-bottom:22px}
.batch-entry-card{display:flex;gap:18px;min-height:170px;padding:24px;border:1px solid #dbe3ef;border-radius:16px;background:#fff;color:#0f1f3a;text-decoration:none;box-shadow:0 4px 14px rgba(23,43,77,.04);transition:.18s ease}
.batch-entry-card:hover{border-color:#8eacf7;transform:translateY(-2px);box-shadow:0 10px 24px rgba(39,84,196,.10)}
.batch-entry-card h2{font-size:19px;margin:0 0 8px}.batch-entry-card p{margin:0 0 14px;color:#64748b;line-height:1.7}.batch-entry-card strong{color:#2858d9;font-size:14px}
.batch-entry-icon{display:flex;align-items:center;justify-content:center;flex:0 0 46px;height:46px;border-radius:13px;background:#eaf0ff;color:#2858d9;font-weight:700;font-size:20px}
.batch-summary{max-width:360px;color:#64748b}.mono{font-family:Consolas,monospace}.batch-guide{display:flex;flex-wrap:wrap;gap:10px 24px;padding:14px 16px;margin-bottom:20px;border-radius:10px;background:#f3f6fb;color:#52627a}.batch-guide strong{color:#132746}.batch-guide span{position:relative}.batch-guide span:before{content:'•';color:#2858d9;margin-right:8px}
.batch-paste{min-height:230px;font-family:Consolas,'Microsoft YaHei',sans-serif;line-height:1.8;resize:vertical}
.batch-preview{max-height:62vh}.batch-preview table{min-width:1320px}.batch-project-preview table{min-width:2050px}.batch-preview th{position:sticky;top:0;z-index:2;background:#f6f8fc}.batch-preview input,.batch-preview select{min-width:120px;padding:9px 10px}.batch-preview input[name^="description"],.batch-preview input[name^="project_name"],.batch-preview input[name^="buyer_name"]{min-width:180px}.batch-row-warning{background:#fff9ed}.batch-error{display:block;min-width:145px;color:#c2413b;font-size:13px;line-height:1.45}.batch-ok{color:#07856b;font-size:13px;white-space:nowrap}
@media(max-width:1000px){.batch-entry-grid{grid-template-columns:1fr}.batch-entry-card{min-height:auto}.batch-preview{max-height:none}}
/* AI 设置 */
.ai-power-card{position:relative;display:flex!important;align-items:center;justify-content:space-between;gap:24px;padding:22px 24px;border:2px solid #cbd5e1;border-radius:16px;background:linear-gradient(135deg,#f8fafc,#eef2f7);cursor:pointer;transition:border-color .2s,background .2s,box-shadow .2s}.ai-power-card:hover{border-color:#94a3b8;box-shadow:0 8px 24px rgba(15,23,42,.08)}.ai-power-card:focus-within{outline:3px solid rgba(37,99,235,.2);outline-offset:2px}.ai-power-card.is-on{border-color:#22c55e;background:linear-gradient(135deg,#f0fdf4,#dcfce7);box-shadow:0 8px 24px rgba(34,197,94,.12)}.ai-power-input{position:absolute;width:1px!important;height:1px!important;min-height:0!important;opacity:0;pointer-events:none}.ai-power-copy{display:flex;min-width:0;flex-direction:column;align-items:flex-start;gap:6px}.ai-power-copy strong{font-size:20px;color:#0f172a}.ai-power-copy small{color:#64748b;font-weight:400;line-height:1.6}.ai-power-status{display:inline-flex;padding:5px 10px;border-radius:999px;background:#64748b;color:#fff;font-size:12px;font-weight:700}.ai-power-card.is-on .ai-power-status{background:#16a34a}.ai-switch{position:relative;display:block;flex:0 0 68px;width:68px;height:38px;border-radius:999px;background:#94a3b8;box-shadow:inset 0 2px 4px rgba(15,23,42,.18);transition:background .2s}.ai-switch i{position:absolute;top:4px;left:4px;width:30px;height:30px;border-radius:50%;background:#fff;box-shadow:0 2px 7px rgba(15,23,42,.3);transition:transform .2s}.ai-power-card.is-on .ai-switch{background:#16a34a}.ai-power-card.is-on .ai-switch i{transform:translateX(30px)}
.ai-model-strength{padding:14px 16px;border-left:4px solid #2858d9;border-radius:8px;background:#f3f6ff;color:#465a78}.ai-model-strength strong{color:#132746;margin-right:8px}
.ai-privacy-note{margin:14px 0;color:#64748b;font-size:13px;line-height:1.6}
.ai-model-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.ai-model-card{display:flex;flex-direction:column;gap:8px;padding:17px;border:1px solid #dbe3ef;border-radius:12px;background:#fff}.ai-model-card.active{border-color:#5f85ed;background:#f5f8ff}.ai-model-card code{overflow-wrap:anywhere;color:#2858d9}.ai-model-card p{margin:0;color:#64748b;line-height:1.65}
.ai-working{overflow:hidden}.ai-working-overlay{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px;background:rgba(15,23,42,.38);backdrop-filter:blur(2px)}.ai-working-card{display:flex;align-items:center;gap:18px;width:min(430px,calc(100vw - 40px));padding:24px 26px;border:1px solid #dbe4f2;border-radius:16px;background:#fff;box-shadow:0 24px 70px rgba(15,23,42,.28)}.ai-working-card strong{display:block;color:#10203d;font-size:19px}.ai-working-card p{margin:7px 0 4px;color:#40536f;line-height:1.55}.ai-working-card small{color:#7a879b}.ai-working-spinner{flex:0 0 42px;width:42px;height:42px;border:4px solid #dbe6ff;border-top-color:#2858d9;border-radius:50%;animation:ai-working-spin .8s linear infinite}@keyframes ai-working-spin{to{transform:rotate(360deg)}}
@media(max-width:760px){.ai-model-grid{grid-template-columns:1fr}.ai-power-card{padding:18px;align-items:center}.ai-power-copy strong{font-size:18px}.ai-switch{flex-basis:58px;width:58px;height:34px}.ai-switch i{width:26px;height:26px}.ai-power-card.is-on .ai-switch i{transform:translateX(24px)}}

/* AI 智能对账与账号额度 */
.ai-user-enabled{display:flex!important;align-items:center;gap:10px;padding:14px 16px;border:1px solid #dbe3ef;border-radius:10px;background:#f8fafc}.ai-user-enabled input{width:auto!important;margin:0!important}.ai-user-enabled .hint{display:block;margin-left:auto;font-weight:400}
.dashboard-ai-card{display:flex;align-items:stretch;justify-content:space-between;gap:24px;padding:24px;border-color:#cbdafc;background:linear-gradient(135deg,#f8fbff,#eef4ff)}.dashboard-ai-main{min-width:0;flex:1}.dashboard-ai-heading{display:flex;align-items:center;gap:14px}.dashboard-ai-heading h2{margin:0 0 5px;font-size:20px}.dashboard-ai-heading p,.dashboard-ai-summary p{margin:0;color:#60708a;line-height:1.65}.dashboard-ai-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:14px;background:linear-gradient(135deg,#2456d6,#6f8ff0);color:#fff;font-weight:800}.dashboard-ai-summary{margin:18px 0 0 60px}.dashboard-ai-summary strong{margin-left:8px}.dashboard-ai-summary small{display:block;margin-top:7px;color:#77849a}.dashboard-ai-side{display:flex;min-width:190px;flex-direction:column;align-items:flex-end;justify-content:center;gap:14px}.ai-quota{color:#53627a}.ai-quota strong{font-size:22px;color:#153b9f}
.reconciliation-action-card{display:flex;align-items:center;justify-content:space-between;gap:24px}.reconciliation-action-card h2{margin:0 0 8px}.reconciliation-action-side{display:flex;min-width:210px;flex-direction:column;align-items:flex-end;gap:12px}.reconciliation-stats{grid-template-columns:repeat(4,minmax(0,1fr))}.reconciliation-summary .section-head{margin-bottom:8px}.reconciliation-meta{color:#78859a;font-size:12px}.reconciliation-table{min-width:980px}.reconciliation-table th:nth-child(3){min-width:360px}.reconciliation-table th:nth-child(4){min-width:280px}.reconciliation-finding,.reconciliation-action-text{white-space:normal;line-height:1.6}.reconciliation-finding strong,.reconciliation-finding small{display:block}.reconciliation-finding small{margin-top:5px;color:#66758c}.empty-state{text-align:center;padding:42px}.empty-state h2{margin-top:0}
@media(max-width:900px){.dashboard-ai-card,.reconciliation-action-card{flex-direction:column;align-items:stretch}.dashboard-ai-side,.reconciliation-action-side{align-items:flex-start}.dashboard-ai-summary{margin-left:0}.reconciliation-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:720px){.reconciliation-stats{grid-template-columns:1fr}.ai-user-enabled{align-items:flex-start;flex-wrap:wrap}.ai-user-enabled .hint{width:100%;margin-left:28px}}
.tabs{display:flex;gap:6px;margin:-4px 0 18px;border-bottom:1px solid var(--line)}.tab{display:inline-flex;padding:10px 14px;color:#66758c;border-bottom:2px solid transparent}.tab:hover{color:var(--primary)}.tab.active{color:var(--primary);font-weight:700;border-bottom-color:var(--primary)}
.xml-preview-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}.xml-preview-spacer{flex:1}.xml-preview-checkall{display:flex;align-items:center;gap:7px;font-weight:600}.xml-preview-checkall input{width:auto;margin:0}.xml-invoice-preview{max-height:65vh}.xml-invoice-preview table{min-width:1900px}.xml-invoice-preview th:first-child,.xml-invoice-preview td:first-child{width:48px;text-align:center}.xml-invoice-preview select{min-width:180px}.xml-invoice-preview .input-error{border-color:#dc6871;background:#fff7f7}.xml-seller-name{display:block;max-width:260px;white-space:normal;line-height:1.5}.success-text{color:#07856b}
.xml-affiliate-cell{min-width:250px}.xml-affiliate-cell .affiliate-picker-input{width:100%;min-width:220px}
.invoice-row-red{background:#fff5f5}.invoice-row-replacement{background:#f3f8ff}.relation-link{display:block;margin-top:4px;font-size:12px}.row-highlight{outline:2px solid #2f64d6;outline-offset:-2px;animation:rowFocus 2.2s ease-out}@keyframes rowFocus{0%,45%{background:#fff2a8}100%{}}
.history-book-card{display:flex;align-items:center;justify-content:space-between;gap:20px;border-left:4px solid #5b7cfa;background:linear-gradient(90deg,#f4f7ff 0,#fff 58%)}
.history-book-card h2{margin:0 0 6px;font-size:18px}.history-book-card p{margin:0 0 6px;color:#52627a}
.record-scope-tabs{display:flex;align-items:center;gap:8px;margin:0 0 14px}.record-scope-tabs .hint{margin-left:6px}
@media(max-width:700px){.history-book-card{align-items:flex-start;flex-direction:column}.history-book-card .btn{width:100%;text-align:center}}

/* 发票列表：把同一业务信息归组，减少横向滚动 */
.invoice-list-card{padding:16px 18px 18px}
.invoice-list-table{width:100%;min-width:850px;table-layout:fixed;white-space:normal}
.invoice-list-table .invoice-col-date{width:112px}
.invoice-list-table .invoice-col-meta{width:92px}
.invoice-list-table .invoice-col-business{width:auto}
.invoice-list-table .invoice-col-owner{width:112px}
.invoice-list-table .invoice-col-money{width:176px}
.invoice-list-table .invoice-col-status{width:150px}
.invoice-list-table .invoice-col-actions{width:86px}
.invoice-list-table th,.invoice-list-table td{padding:14px 10px;vertical-align:top}
.invoice-list-table th{white-space:nowrap}
.invoice-date-cell{white-space:nowrap;color:#344057;font-variant-numeric:tabular-nums}
.invoice-meta-cell strong{display:block;color:#1e2b42;white-space:nowrap}
.invoice-meta-cell .badge-history{margin-top:7px}
.badge-history{background:#eef1f6;color:#596477}
.table-cell-badge{display:block;width:max-content;margin-top:6px}
.invoice-business-cell{min-width:0;white-space:normal}
.invoice-buyer-name{display:block;overflow:hidden;color:#1d2b43;line-height:1.55;text-overflow:ellipsis;white-space:nowrap}
.invoice-project-name{display:-webkit-box!important;overflow:hidden;max-width:100%;margin-top:5px;padding:0!important;color:#506078!important;line-height:1.45;text-align:left;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2}
.invoice-remark{display:block;overflow:hidden;margin-top:6px;color:#7a8699;font-size:12px;line-height:1.45;text-overflow:ellipsis;white-space:nowrap}
.invoice-source{display:block;overflow:hidden;margin-top:4px;color:#8a94a5;font-size:11px;line-height:1.4;text-overflow:ellipsis;white-space:nowrap}
.invoice-owner-cell{white-space:normal}.invoice-owner-name{display:block;overflow-wrap:anywhere;line-height:1.5}
.invoice-money-cell{font-variant-numeric:tabular-nums}
.invoice-money-row{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-top:6px;color:#6f7a8e;font-size:12px}
.invoice-money-row:first-child{margin-top:0}.invoice-money-row strong,.invoice-money-row a{color:#29364c;font-size:13px;font-weight:600;white-space:nowrap}
.invoice-money-row.invoice-money-total{padding-bottom:6px;border-bottom:1px dashed #e2e7ef}.invoice-money-row.invoice-money-total a{font-size:14px}
.invoice-money-row .received-value{color:#16865b}
.invoice-status-cell{white-space:normal}.invoice-status-line{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:7px}.invoice-status-line:first-child{margin-top:0}.invoice-status-line small{color:#7a8699;white-space:nowrap}.invoice-status-line .badge{white-space:nowrap}
.invoice-row-actions{display:flex;flex-direction:column;gap:7px}.invoice-row-actions .btn{width:100%;white-space:nowrap}
.invoice-row-history{background:#fafbfc}.invoice-row-history:hover{background:#f5f7fa}
.invoice-row-red.invoice-row-history{background:#fff7f7}.invoice-row-replacement.invoice-row-history{background:#f5f8fd}
.invoice-list-table .invoice-date-cell{position:sticky;left:0;z-index:1;background:#fff}.invoice-list-table th:first-child{position:sticky;left:0;z-index:3}
.invoice-list-table .invoice-row-history .invoice-date-cell{background:#fafbfc}.invoice-list-table .invoice-row-red .invoice-date-cell{background:#fff5f5}.invoice-list-table .invoice-row-replacement .invoice-date-cell{background:#f3f8ff}
.invoice-list-table .invoice-actions-cell{position:sticky;right:0;z-index:1;background:#fff;box-shadow:-7px 0 12px -12px rgba(25,39,67,.55)}.invoice-list-table .invoice-actions-head{position:sticky;right:0;z-index:3;box-shadow:-7px 0 12px -12px rgba(25,39,67,.55)}
.invoice-list-table .invoice-row-history .invoice-actions-cell{background:#fafbfc}.invoice-list-table .invoice-row-red .invoice-actions-cell{background:#fff5f5}.invoice-list-table .invoice-row-replacement .invoice-actions-cell{background:#f3f8ff}
.invoice-empty-row td{position:static!important;background:#fff!important}
.scope-notice{padding:8px 11px;border-radius:8px;background:#eef3ff;color:#40577e;font-size:12px;line-height:1.5}
.trace-overview{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.trace-overview>div{display:flex;flex-direction:column;gap:7px;padding:12px;border-radius:9px;background:#f7f9fc}.trace-overview span{color:var(--muted);font-size:12px}.trace-list{display:flex;flex-direction:column}.trace-item{display:grid;grid-template-columns:130px 18px minmax(0,1fr) 130px 90px;align-items:center;gap:12px;padding:14px 8px;border-bottom:1px solid var(--line);color:var(--ink)}.trace-item:hover{background:#f8faff}.trace-date{color:#66758b}.trace-dot{width:10px;height:10px;border:3px solid #8aa6eb;border-radius:50%;background:#fff}.trace-content{display:flex;min-width:0;flex-direction:column;gap:5px}.trace-content strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.trace-content small{color:var(--muted);white-space:normal}.trace-amount{text-align:right;font-weight:700;font-variant-numeric:tabular-nums}.trace-amount.negative{color:var(--danger)}
.batch-data-cell{max-width:520px;white-space:normal;word-break:break-word}.small-value{font-size:18px!important}.danger-zone{border-color:#efc4c8;background:#fffafa}.danger-zone h2{margin-top:0}.inline-password-form{display:flex;align-items:flex-end;gap:10px}.inline-password-form label{font-weight:600}.inline-password-form input,.restore-inline-form input{display:block;margin-top:7px;padding:8px 10px;border:1px solid #ccd3df;border-radius:8px}.restore-inline-form{display:flex;align-items:center;gap:7px}.restore-inline-form[hidden]{display:none}.mobile-filter-toggle{display:none}

@media(max-width:980px){
  .record-scope-tabs{align-items:flex-start;flex-wrap:wrap}.record-scope-tabs .hint{width:100%;margin:2px 0 0}
  .invoice-list-table{min-width:800px}.invoice-list-table .invoice-col-owner{width:100px}.invoice-list-table .invoice-col-money{width:166px}.invoice-list-table .invoice-col-status{width:140px}
}
@media(max-width:720px){
  html,body{max-width:100%;overflow-x:hidden}
  .content,.card,.page-head,.table-wrap{max-width:100%}
  .page-head .actions{display:grid;width:100%;grid-template-columns:repeat(2,minmax(0,1fr))}.page-head .actions .btn{width:100%;min-width:0;white-space:normal}
  .mobile-filter-toggle{display:flex;width:100%;margin-bottom:10px;background:#eef3ff;border-color:#bfd0fa;color:#173f9f;font-weight:700}
  form.filters.mobile-filter-collapsed{display:none}
  .invoice-list-card{padding:12px;background:transparent;border:0;box-shadow:none}
  .invoice-list-wrap{overflow:visible}
  .invoice-list-table,.invoice-list-table tbody{display:block;min-width:0}
  .invoice-list-table colgroup,.invoice-list-table thead{display:none}
  .invoice-list-table tr{display:grid;grid-template-columns:1fr 1fr;margin-bottom:12px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#fff;box-shadow:0 2px 7px rgba(27,39,68,.04)}
  .invoice-list-table td{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;min-width:0;padding:9px 0;border-bottom:1px dashed #e5e9f1;white-space:normal}
  .invoice-list-table td:before{content:attr(data-label);flex:0 0 72px;color:#7a8699;font-size:12px;font-weight:600}
  .invoice-list-table .invoice-date-cell,.invoice-list-table .invoice-actions-cell{position:static;background:transparent!important;box-shadow:none}
  .invoice-list-table .invoice-date-cell{grid-column:1/2}.invoice-list-table .invoice-meta-cell{grid-column:2/3}
  .invoice-list-table .invoice-business-cell,.invoice-list-table .invoice-owner-cell,.invoice-list-table .invoice-money-cell,.invoice-list-table .invoice-status-cell,.invoice-list-table .invoice-actions-cell{grid-column:1/-1}
  .invoice-list-table .invoice-business-cell{display:block}.invoice-list-table .invoice-business-cell:before{display:block;margin-bottom:6px}
  .invoice-list-table .invoice-business-cell>*{margin-left:0}
  .invoice-list-table .invoice-money-cell,.invoice-list-table .invoice-status-cell{display:block;padding-left:86px;position:relative}.invoice-list-table .invoice-money-cell:before,.invoice-list-table .invoice-status-cell:before{position:absolute;left:0;top:10px}
  .invoice-row-actions{flex-direction:row;justify-content:flex-end;width:100%}.invoice-row-actions .btn{width:auto;min-width:74px}
  .invoice-list-table td:last-child{border-bottom:0}
  .invoice-list-table .invoice-empty-row{display:block}.invoice-list-table .invoice-empty-row td{display:block;padding:28px 12px}.invoice-list-table .invoice-empty-row td:before{display:none}
  .trace-overview{grid-template-columns:1fr 1fr}.trace-item{grid-template-columns:92px 12px minmax(0,1fr);align-items:start}.trace-amount{grid-column:3;text-align:left}.trace-item>span:last-child{grid-column:3}.inline-password-form,.restore-inline-form{align-items:stretch;flex-direction:column}.inline-password-form .btn,.restore-inline-form .btn{width:100%}
}

/* 新旧账统一查询：历史记录展示但不参与当前余额 */
.ledger-scope-tabs{margin-top:-2px}
.history-book-inline{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:-2px 0 14px;padding:11px 14px;border:1px solid #dfe5ee;border-radius:10px;background:#fafbfc;color:#526079}
.history-book-inline>div{display:flex;align-items:center;gap:12px;min-width:0}.history-book-inline strong{color:#26354d;white-space:nowrap}.history-book-inline span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-book-inline .history-book-actions{justify-content:flex-end;flex-wrap:wrap;flex:0 0 auto}.history-source-jump{display:block;margin-top:5px;color:var(--primary);font-size:12px;text-decoration:none}.history-source-jump:hover{text-decoration:underline}
.ledger-period-divider td{padding:11px 14px!important;border-top:2px solid #9cabc1;border-bottom:1px solid #dfe5ee!important;background:#edf1f6!important;color:#40506a;white-space:normal!important}
.ledger-period-divider strong{margin-right:12px}.ledger-period-divider span{color:#6f7b90;font-size:12px}
.ledger-row-history{background:#fafbfc}.ledger-row-history:hover{background:#f5f7fa}.ledger-row-history td{color:#536078}.ledger-row-history .ledger-name{color:#33425a}
@media(max-width:720px){.history-book-inline{align-items:flex-start;flex-direction:column}.history-book-inline>div{align-items:flex-start;flex-direction:column;gap:4px}.history-book-inline span{white-space:normal}.history-book-inline .btn{width:100%}.ledger-period-divider strong,.ledger-period-divider span{display:block;margin:0}.ledger-period-divider span{margin-top:4px}}

/* 历史 Excel 原表安全只读预览 */
.xlsx-preview-card{padding-bottom:16px}.xlsx-preview-search{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}.xlsx-preview-search input{width:260px}.xlsx-preview-search [data-xlsx-search-status]{min-width:90px;color:var(--muted);font-size:12px}.xlsx-sheet-tabs{display:flex;gap:8px;overflow-x:auto;padding:2px 0 12px}.xlsx-sheet-tabs .btn{flex:0 0 auto}.xlsx-preview-meta{display:flex;justify-content:space-between;gap:12px;margin:0 0 8px;color:var(--muted);font-size:12px}.xlsx-preview-wrap{position:relative;max-height:68vh;overflow:auto;border:1px solid #cbd3df;border-radius:8px;background:#fff}.xlsx-preview-table{border-collapse:separate;border-spacing:0;table-layout:fixed;min-width:max-content;font-family:"Microsoft YaHei",Arial,sans-serif;font-size:13px}.xlsx-preview-table th,.xlsx-preview-table td{height:28px;padding:4px 7px;border-right:1px solid #d7dde6;border-bottom:1px solid #d7dde6;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xlsx-preview-table thead th{position:sticky;top:0;z-index:4;background:#edf1f6;color:#445168;text-align:center;font-weight:500}.xlsx-preview-table .xlsx-corner{left:0;z-index:6}.xlsx-row-header-col{width:48px;min-width:48px}.xlsx-preview-table .xlsx-row-number{position:sticky;left:0;z-index:3;width:48px;min-width:48px;background:#f3f5f8;color:#68758a;text-align:center;font-weight:400}.xlsx-cell.xlsx-negative{color:#d93025}.xlsx-preview-table tr.xlsx-target-row>td{background:#fff0b8!important;box-shadow:inset 0 1px #e7a900,inset 0 -1px #e7a900}.xlsx-preview-table .xlsx-search-match{background:#ffe37a!important;box-shadow:inset 0 0 0 2px #d79500}.xlsx-preview-note{margin-top:10px;color:var(--muted);font-size:12px}.xlsx-preview-table td[title]{cursor:help}
@media(max-width:720px){.xlsx-preview-card .section-head{flex-direction:column}.xlsx-preview-search{align-items:stretch;justify-content:flex-start;width:100%}.xlsx-preview-search input{width:100%}.xlsx-preview-search .btn{flex:1}.xlsx-preview-meta{align-items:flex-start;flex-direction:column}.xlsx-preview-wrap{max-height:62vh}.history-book-inline .history-book-actions{display:grid;width:100%;grid-template-columns:1fr 1fr}.history-book-inline .history-book-actions .btn:last-child{grid-column:1/-1}}

/* 单笔实际到账分配多张发票 */
.receipt-group-card .section-head{margin-bottom:18px}.receipt-allocation-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin:22px 0 10px}.receipt-allocation-head>div{display:flex;flex-direction:column;gap:4px}.receipt-allocation-head input{width:min(420px,100%)}.receipt-allocation-table{max-height:480px;border:1px solid var(--line);border-radius:10px}.receipt-allocation-table table{min-width:980px}.receipt-allocation-table tr.is-selected{background:#f2f7ff}.receipt-allocation-table input[type="number"]{min-width:130px;text-align:right}.receipt-allocation-summary{display:flex;justify-content:flex-end;gap:28px;margin-top:14px;padding:12px 14px;border-radius:9px;background:#f7f9fc}.receipt-allocation-summary strong{margin-left:5px;font-variant-numeric:tabular-nums}.receipt-allocation-summary .is-over{color:var(--danger)}
@media(max-width:720px){.receipt-allocation-head{align-items:stretch;flex-direction:column}.receipt-allocation-head input{width:100%}.receipt-allocation-summary{align-items:flex-end;flex-direction:column;gap:6px}}
