.summary-grid{grid-template-columns:minmax(0,1fr)}
.finance-card{min-width:0;overflow:visible;padding:20px}
.finance-card .card-title{font-size:18px}.finance-card .card-sub{color:#64748b;line-height:1.7}
.finance-controls{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:12px 0;border-top:1px solid #eef2f7;border-bottom:1px solid #eef2f7}
.finance-controls label{display:flex;align-items:center;gap:6px;font-size:14px;color:#64748b}
.finance-controls select,.finance-controls input{height:34px;padding:0 9px;border:1px solid #e2e8f0;background:white;color:#334155;border-radius:6px;font-family:inherit;max-width:100%}
.finance-controls input[type=number]{width:90px}.finance-controls input[type=date]{width:160px}
.finance-controls [hidden],.finance-card [hidden]{display:none!important}
.finance-tabs{display:flex;gap:2px;background:#f1f5f9;border-radius:6px;padding:0}
.finance-tabs button,.budget-view-tabs button,.budget-metric-tabs button{height:34px;min-height:34px;padding:0 12px;border:1px solid transparent;border-radius:6px;background:transparent;color:#64748b;font-size:14px;cursor:pointer;white-space:nowrap}
.finance-tabs button[aria-pressed=true]{background:white;color:#2563eb;box-shadow:0 1px 4px #0f172a12;border-color:#dbeafe}
.finance-period-label{display:flex;gap:12px;flex-wrap:wrap;margin:12px 0;color:#64748b;font-size:13px;line-height:1.7}.finance-period-label b{color:#334155;font-weight:500}
.finance-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:12px 0 20px}
.finance-metric{border:1px solid #e8eef7;border-radius:8px;padding:15px;background:#fbfdff;min-width:0}
.finance-metric span{display:block;color:#64748b;font-size:14px}.finance-metric strong{display:block;color:#1e293b;font-size:25px;margin:7px 0 6px;font-variant-numeric:tabular-nums}
.finance-metric:first-child strong{color:#2563eb}.finance-metric:nth-child(2) strong{color:#d97706}.finance-metric:nth-child(3){background:#f3faf8;border-color:#d9eee6}.finance-metric:nth-child(3) strong{color:#07805a}
.finance-metric small{display:block;color:#64748b;line-height:1.6;font-size:13px}.finance-metric .is-negative{color:#dc2626!important}
.finance-analysis{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);gap:24px;margin-bottom:20px}
.finance-analysis>section,.finance-breakdowns>div{min-width:0}
.finance-analysis>section{display:flex;flex-direction:column}
.finance-chart-body{display:flex;flex-direction:column;flex:1;min-height:330px}
.finance-panel-title{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:0 0 12px}.finance-panel-title h3{font-size:15px;margin:0;color:#334155}.finance-panel-title small{color:#94a3b8;font-size:13px}
.finance-chart-legend{display:flex;align-items:center;gap:12px;font-size:13px;color:#64748b;flex-wrap:wrap;min-height:30px;flex-shrink:0}.finance-chart-legend i{display:inline-block;width:8px;height:8px;background:#3b82f6;margin-right:4px;border-radius:2px}.finance-chart-legend .expense{background:#f59e0b}.finance-chart-legend .plan{background:white;border:1px dashed #64748b}
.finance-chart{position:relative;display:block;flex:1;overflow-x:auto;overflow-y:hidden;min-height:300px;padding:0;border-bottom:1px solid #e2e8f0;background:repeating-linear-gradient(to top,transparent 0,transparent 51px,#eef2f7 52px,#eef2f7 53px)}
.finance-bar-canvas{display:flex;align-items:stretch;gap:6px;width:max(100%,var(--finance-chart-width,600px));height:100%;min-height:300px}
.finance-chart button{flex:1;min-width:44px;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;padding:0 3px;cursor:pointer;color:#64748b;border-radius:5px;height:100%}
.finance-chart button:hover,.finance-chart button:focus-visible{background:#eff6ff;outline:1px solid #bfdbfe}.finance-chart .column-bars{display:flex;align-items:flex-end;gap:4px;flex:1;min-height:0;width:100%;justify-content:center}
.finance-chart .column-bars i{display:block;min-width:10px;width:26%;max-width:23px;background:#3b82f6;border-radius:3px 3px 0 0}.finance-chart .column-bars .expense{background:#f59e0b}
.finance-chart .column-bars .planned{background:#eff6ff;border:1px dashed #3b82f6}.finance-chart .column-bars .expense.planned{background:#fffbeb;border-color:#f59e0b}
.finance-chart .column-label{flex-shrink:0;font-size:12px;margin-top:8px;white-space:nowrap}.finance-chart .column-state{flex-shrink:0;white-space:nowrap;font-size:11px;margin:2px 0;color:#94a3b8}
.finance-chart-note{color:#94a3b8;font-size:12px;line-height:1.6;margin-top:8px}
.finance-breakdowns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;flex:1;min-height:330px;align-content:start}.finance-category-title{display:flex;justify-content:space-between;flex-wrap:wrap;gap:5px;font-size:14px;color:#334155;min-height:24px;margin-bottom:6px}
.finance-category{display:block;width:100%;border:0;background:transparent;padding:8px 0;text-align:left;cursor:pointer;min-height:53px;border-radius:4px}.finance-category:hover{background:#f8fafc}.finance-category>span{display:flex;justify-content:space-between;gap:6px;font-size:13px;color:#475569}.finance-category b{font-weight:600;color:#334155;white-space:nowrap}
.finance-category .category-track{display:block;height:4px;background:#f1f5f9;border-radius:3px;margin-top:7px;overflow:hidden}.finance-category .category-track i{display:block;height:100%;background:#60a5fa}.finance-category.expense .category-track i{background:#fbbf24}.finance-category small{font-size:12px;color:#94a3b8;font-weight:400;margin-left:5px}
.finance-table-wrap{overflow:auto;border:1px solid #e8eef7;border-radius:7px;max-height:360px}.finance-table{width:100%;min-width:900px;border-collapse:collapse;font-size:14px;font-variant-numeric:tabular-nums}
.finance-table th,.finance-table td{padding:10px 12px;text-align:right;white-space:nowrap;border-bottom:1px solid #eef2f7}.finance-table th:first-child,.finance-table td:first-child{text-align:left}.finance-table th{background:#f8fafc;color:#64748b;font-weight:500;position:sticky;top:0;z-index:1}.finance-table td{color:#334155}.finance-table tfoot td{background:#f3f7fd;font-weight:600;position:sticky;bottom:0;border-top:1px solid #dbeafe}.finance-table tbody tr:hover{background:#f8fbff}
.finance-table .finance-detail-link{padding:0 10px;color:#2563eb;background:#eff6ff;border-color:#dbeafe;font-size:13px}.finance-status{padding:3px 7px;font-size:12px;border-radius:10px;display:inline-block;background:#f1f5f9;color:#64748b}.finance-status.current{background:#eff6ff;color:#2563eb}.finance-status.history{background:#ecfdf5;color:#059669}
.finance-empty{padding:24px;text-align:center;color:#64748b;background:#f8fafc;border-radius:6px;margin:12px 0}
.finance-footnote{margin:10px 0 0;font-size:13px;color:#94a3b8;line-height:1.8}.finance-card .finance-button-link{color:#2563eb;border-color:#dbeafe}.finance-card button:focus-visible{outline:2px solid #93c5fd;outline-offset:2px}
@media(max-width:1000px){.finance-analysis{grid-template-columns:1fr}.finance-metrics{gap:8px}.finance-metric{padding:12px}.finance-metric strong{font-size:22px}}
@media(max-width:760px){.finance-card{padding:14px}.finance-metrics{grid-template-columns:1fr 1fr;margin-bottom:16px}.finance-metric strong{font-size:21px}.finance-card .card-actions{gap:6px}.finance-controls{gap:8px}.finance-controls label{flex-wrap:wrap}.finance-controls .finance-range-control{width:100%}.finance-range-control select{flex:1}.finance-breakdowns{gap:12px}.finance-category>span{flex-wrap:wrap}.finance-category{min-height:66px}.finance-period-label{gap:4px}.finance-table-wrap{max-height:330px}.finance-chart-legend{gap:9px}.finance-metric small{font-size:12px}}
/* 页面外层留白：桌面端四边一致，保持内容宽度与列结构不变 */
@media(min-width:761px){.shell{padding:20px}}

/* Keep category previews bounded while retaining every configured category. */
.finance-section-heading{flex-wrap:nowrap;min-height:36px;gap:8px}
.finance-section-heading h3{min-width:0;white-space:nowrap}
.finance-panel-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.finance-section-heading .btn{flex-shrink:0;padding-inline:10px}
.finance-category-list{max-height:300px;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-width:thin;scrollbar-color:var(--control-line,#cbd5e1) transparent;scrollbar-gutter:stable}
.finance-category-list:focus-visible{outline:2px solid var(--cyan,#2563eb);outline-offset:2px}
.finance-category-list .finance-category{height:60px;min-height:60px;box-sizing:border-box;padding:4px}
.finance-category-list .finance-category-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.finance-category-list .finance-category-value{display:flex;justify-content:space-between;align-items:baseline;gap:4px;flex-wrap:nowrap;min-width:0}
.finance-category-list .finance-category-value small{margin-left:0;white-space:nowrap}
.finance-category-list .category-track{margin-top:3px}
@media(max-width:760px){.finance-panel-actions{gap:6px}.finance-section-heading .finance-tabs button{padding-inline:8px}.finance-section-heading .btn{padding-inline:8px}}

.finance-chart .column-state{min-height:18px}

.finance-category-label{display:flex;align-items:baseline;gap:4px;min-width:0}
.finance-category-label .finance-category-name{flex:1;min-width:0}
.finance-category-label small{flex-shrink:0;margin-left:0}

/* Full finance details keep dates intact and amounts aligned within local scrolling. */
html.dashboard-v2 .modal-card[data-finance-view] .modal-table-wrap table{min-width:1000px}
html.dashboard-v2 .modal-card[data-finance-view="periods"] .modal-table-wrap table{min-width:1420px}
html.dashboard-v2 .modal-card[data-finance-view] :is(th,td){white-space:nowrap}
html.dashboard-v2 .modal-card[data-finance-view="periods"] :is(th,td):nth-child(n+5),
html.dashboard-v2 .modal-card[data-finance-view="categories"] :is(th,td):nth-child(n+3){text-align:right;font-variant-numeric:tabular-nums}
html.dashboard-v2 .modal-card[data-finance-view] tbody tr:last-child{font-weight:600;background:var(--selected)}

/* Both analyses share the same header and body height; the plot fills the body. */
.finance-trend-section .finance-section-heading,.finance-category-section .finance-section-heading{flex-shrink:0}
.finance-line-canvas{display:block;width:max(100%,var(--finance-chart-width,600px));height:100%;min-height:300px;overflow:visible}
html.dashboard-v2 .finance-chart[data-chart="line"]{background:none}
.finance-line-series{fill:none;stroke:var(--green,#3b82f6);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.finance-line-series.expense{stroke:var(--yellow,#f59e0b)}
.finance-line-series.planned{stroke-dasharray:6 5}
.finance-line-grid{stroke:var(--chart-grid,#e8edf4);stroke-width:1;vector-effect:non-scaling-stroke}
.finance-line-axis,.finance-line-state{fill:var(--muted,#64748b);stroke:none;font-family:inherit;font-size:12px;font-variant-numeric:tabular-nums}
.finance-line-label{fill:var(--muted,#64748b);font-family:inherit;font-size:12px;font-variant-numeric:tabular-nums}
.finance-line-point{cursor:pointer;outline:none}
.finance-line-marker{fill:var(--panel,#fff);stroke:var(--green,#3b82f6);stroke-width:2;vector-effect:non-scaling-stroke}
.finance-line-point.expense .finance-line-marker{stroke:var(--yellow,#f59e0b)}
.finance-line-point:hover .finance-line-marker,.finance-line-point:focus-visible .finance-line-marker{stroke-width:3;r:6}
@media(max-width:370px){.finance-trend-section .finance-tabs button{padding-inline:4px}.finance-trend-section .finance-panel-actions{gap:4px}}

.finance-line-hit{fill:transparent;stroke:none}
.finance-line-zero{stroke:var(--line,#cbd5e1)}
