/* Finance uses the same direct navigation and compact controls as Monitoring. */
.finance-header{margin-bottom:12px;gap:8px}
.finance-header .monitoring-tabs{gap:2px;padding:3px}
.finance-header .monitoring-tabs a{padding:8px 10px;font-size:13px}
.ui-refined .finance-products .analysis-tools{display:flex;align-items:center;gap:6px;margin:0 0 8px}
.finance-products .analysis-tools .analysis-search{flex:1 1 210px;width:210px;max-width:320px;min-width:170px;margin:0;min-height:36px;padding:7px 10px;font-size:13px}
.ui-refined .finance-products .analysis-tools .analysis-coverage{order:10;flex-basis:100%;display:flex;gap:6px;margin:0;font-size:12px;min-height:20px}
.finance-products .analysis-tools .analysis-coverage strong{font-size:12px}
.ui-refined .finance-products .analysis-tools select{min-width:125px;max-width:190px;min-height:36px;padding:7px 28px 7px 10px;font-size:13px}
.finance-products .analysis-tools .button{min-height:36px;padding:7px 10px;font-size:13px}
@media(max-width:1100px){
 .finance-header .monitoring-navigation{min-width:0;max-width:100%}
 .finance-header .monitoring-tabs{display:flex;flex:1;flex-wrap:nowrap;min-width:0;overflow-x:auto;overscroll-behavior-x:contain}
 .finance-header .monitoring-tabs a{flex:0 0 auto;min-height:44px;box-sizing:border-box;display:flex;align-items:center;white-space:nowrap}
 .finance-header .monitoring-navigation>.section-picker{display:none}
}
@media(max-width:720px){
 .finance-header .monitoring-navigation{width:100%;flex:auto}
 .finance-header .monitoring-actions{flex:none;margin-left:0}
 .ui-refined .finance-products .analysis-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .finance-products .analysis-tools .analysis-search{grid-column:1/-1;width:100%;max-width:none;min-width:0;min-height:44px;font-size:16px}
 .ui-refined .finance-products .analysis-tools label{min-width:0;margin:0}
 .ui-refined .finance-products .analysis-tools select{width:100%;min-width:0;max-width:none;min-height:44px;font-size:14px}
 .finance-products .analysis-tools .button{min-height:44px}
 .ui-refined .finance-products .analysis-tools .analysis-info-button{grid-column:auto;grid-row:auto}
 .ui-refined .finance-products .analysis-tools .analysis-coverage{grid-column:1/-1;grid-row:auto;display:flex;order:10}
}

/* One report status in the shared header, matching Monitoring. */
.finance-header{align-items:center}
.finance-header [data-report-snapshot]{min-width:0}
.finance-header .report-snapshot{display:flex;align-items:center;gap:12px;min-height:40px;margin:0;font-size:12px}
.finance-header .report-snapshot>div{text-align:right;gap:2px}
.finance-header .report-snapshot small{color:var(--muted)}
.finance-header .report-snapshot[data-state=current]>div>span{color:var(--theme-good,#86d8b8)}
.finance-header .report-snapshot[data-state=stale]>div>span{color:var(--theme-warning,#efc780)}
.finance-header .report-snapshot[data-state=running]>div>span{color:var(--theme-accent,#cfb9fc)}
.finance-header .report-snapshot .button{min-height:40px}
.finance-report-filters{position:relative;z-index:10;overflow:visible}
.finance-report-filters .monitor-date-picker{flex:0 1 auto;min-width:0}
.finance-report-filters .monitor-date-picker>summary{padding:0 10px;display:flex;align-items:center;gap:8px;white-space:nowrap}
.finance-report-filters>select{flex:1 1 125px;min-width:105px;width:125px}
.finance-report-filters>.monitor-scope-reset{min-width:36px;padding:0;font-size:24px}
@media(max-width:720px){
 .finance-header .monitoring-actions:has([data-report-snapshot]){width:100%;margin:0;align-items:center}
 .finance-header [data-report-snapshot]{flex:1}
 .finance-header .report-snapshot{flex-wrap:nowrap;gap:8px;font-size:11px}
 .finance-header .report-snapshot>div{flex:1;text-align:left}
 .finance-header .report-snapshot .button{min-height:44px;font-size:13px}
 .finance-report-filters .monitor-date-picker{grid-column:1/-1;width:100%}
 .finance-report-filters .monitor-date-picker>summary{height:auto;min-height:44px;padding:10px;white-space:normal}
 .finance-report-filters>select{width:100%;min-width:0;min-height:44px;font-size:16px}
 .finance-report-filters>.monitor-scope-reset{justify-self:end;min-height:44px;width:44px;margin:0}
}

.report-load-error{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;min-width:0;padding:12px 0;color:var(--text)}
.report-load-error>div{min-width:0}.report-load-error p{margin:6px 0;color:var(--muted);overflow-wrap:anywhere}.report-load-error .button{flex:none}
@media(max-width:720px){.report-load-error{align-items:flex-start;flex-direction:column;gap:10px}.report-load-error .button{min-height:44px}}

.finance-report-filters .monitor-popover>label>select{width:100%;min-width:0;max-width:none;min-height:44px;height:44px;font-size:16px}

.finance-marketplace-jumps{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 16px}
.finance-monthly{min-width:0;scroll-margin-top:16px}
.finance-monthly+.finance-monthly{margin-top:36px;padding-top:24px;border-top:1px solid var(--border,#373740)}
[data-marketplace-result] svg text{fill:var(--muted);font-size:11px}
@media(max-width:720px){.finance-marketplace-jumps .button{min-height:44px}.finance-monthly .expense-section-head{flex-wrap:wrap}}

/* One compact financial table for all marketplaces. */
.finance-month-table{table-layout:fixed;min-width:0;font-variant-numeric:tabular-nums}
.finance-month-table .finance-col-month{width:92px}.finance-month-table .finance-col-units{width:64px}
.finance-month-table .finance-col-money{width:96px}.finance-month-table .finance-col-percent{width:72px}
.finance-month-table th,.finance-month-table td{padding:3px 6px!important;font-size:12px;line-height:1.35}
.finance-month-table thead th{min-width:0;padding:8px 6px!important;vertical-align:bottom;font-size:11px;font-weight:550;white-space:normal;overflow-wrap:normal}
.finance-month-table thead th small{display:block;margin-top:4px;color:var(--muted);font-size:11px;font-weight:400}
.finance-month-table thead th.number{white-space:normal;overflow-wrap:normal}
.finance-month-table tr>th:first-child{min-width:0;width:92px;white-space:nowrap;font-size:12px}
.finance-month-table .finance-heat-cell{background:var(--cell-heat,transparent)}
.finance-month-table .finance-cell-value{display:block;width:100%;min-height:34px;padding:6px 0;border:0;border-radius:3px;background:transparent;color:inherit;font:inherit;text-align:right;white-space:nowrap}
.finance-month-table .finance-cell-value:hover{background:var(--theme-neutral-tint,rgba(128,128,128,.12))}
.finance-month-table .finance-cell-value:focus-visible{outline-offset:0}
.finance-month-table .finance-cell-profit,.finance-month-table .finance-cell-credit{color:var(--theme-good,#8ccfb0)}
.finance-month-table .negative{color:var(--theme-bad,#f199a1)}
.finance-month-total th,.finance-month-total td{border-top:2px solid var(--border,#373740)}
.finance-table-key{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;margin-top:10px;color:var(--muted);font-size:11px}
.finance-table-key span{display:inline-flex;gap:5px;align-items:center}
.finance-table-key i{width:7px;height:7px;border-radius:2px}.finance-key-expense{background:var(--theme-warning-bg,#ef9c65)}.finance-key-profit{background:#75b996}.finance-key-loss{background:#f17878}
.finance-month-precision{min-height:20px;margin:5px 0 8px!important;font-size:12px}
@media(max-width:720px){.finance-month-table .finance-cell-value{min-height:38px}.finance-table-key{line-height:1.5}.finance-monthly .expense-section-head p{font-size:12px}}

.finance-monthly .expense-chart-panel{position:relative}
.finance-composition-tooltip{pointer-events:none;box-sizing:border-box;width:270px;color:var(--text,#f0eef5)}
.finance-composition-tooltip>small{color:var(--muted)}
.finance-single-trend{min-width:0;margin:18px 0}
.finance-single-trend svg text{fill:var(--muted);font-size:11px}
.finance-trend-controls{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.finance-trend-controls label,.finance-trend-selector{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--muted)}
.finance-single-trend select{max-width:260px;min-height:40px;font-size:13px}
.product-analysis .analysis-table{font-variant-numeric:tabular-nums}
.product-analysis .analysis-table th.number,.product-analysis .analysis-table td.number{min-width:102px;width:102px;max-width:102px;padding:6px 6px;font-size:12px}
.product-analysis .analysis-table thead th.number{vertical-align:bottom}
.product-analysis .analysis-table thead th button{font-size:12px;line-height:1.35}
.product-analysis .analysis-table .analysis-header-unit{display:block;margin-top:4px;color:var(--muted);font-size:10px}
.product-analysis .analysis-table .analysis-product{min-width:210px;width:210px;max-width:210px;padding:8px 10px;font-size:12px}
.product-analysis .analysis-table .analysis-product{white-space:normal;overflow-wrap:anywhere}
.product-analysis .analysis-table .analysis-product .product-name{min-width:0;max-width:100%;width:100%;padding:0;white-space:normal;gap:8px}
.product-analysis .analysis-table .analysis-product .product-name>span{min-width:0;max-width:100%}
.product-analysis .analysis-table .analysis-product .product-name strong{font-size:12px;white-space:normal;overflow-wrap:anywhere}
.product-analysis .analysis-table .analysis-product .product-name small{font-size:11px;overflow-wrap:anywhere}
.product-analysis .analysis-table .analysis-value,.product-analysis .analysis-table .analysis-missing{min-height:30px;padding:4px 0;font-size:12px}
.product-analysis .analysis-table .analysis-family-toggle{font-size:12px;gap:8px}
@media(max-width:720px){
 .finance-trend-controls{width:100%;gap:10px}
 .finance-trend-controls label,.finance-trend-selector{flex-wrap:wrap;width:100%}
 .finance-trend-controls select,.finance-single-trend select{min-height:44px;max-width:100%;font-size:16px}
 .finance-trend-controls label select{width:100%}
 .finance-trend-controls .segmented button{min-height:44px}
 .finance-composition-bar{height:44px}
}
.finance-calculation-dialog{width:min(840px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:calc(100dvh - 32px);box-sizing:border-box;padding:24px;border:1px solid var(--border,#474250);border-radius:16px;background:var(--panel,#202127);color:var(--text,#efedf5);overflow:auto}
.finance-calculation-dialog [hidden]{display:none!important}
.finance-calculation-dialog::backdrop{background:var(--theme-overlay,#0009)}.finance-calculation-dialog header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.finance-calculation-dialog header h2{margin:2px 0 16px;font-size:20px}.finance-calculation-dialog header button{min-height:44px;min-width:44px;font-size:24px}.finance-calculation-total{display:block;font-size:26px;margin-bottom:20px;font-variant-numeric:tabular-nums}
.finance-calculation-dialog section{padding:16px 0;border-top:1px solid var(--border,#39383f)}.finance-calculation-dialog h3{font-size:15px;margin:0 0 10px}.finance-calculation-dialog p{line-height:1.5;font-size:14px}.finance-calculation-inputs{margin:12px 0}.finance-calculation-inputs>div{display:flex;justify-content:space-between;gap:16px;padding:6px 0}.finance-calculation-inputs dt{color:var(--muted)}.finance-calculation-inputs dd{margin:0;white-space:nowrap}
.finance-calculation-scroll{overflow:auto;max-height:45vh;margin-bottom:12px}.finance-calculation-scroll small{display:block;color:var(--muted);font-weight:400;margin-top:4px}.finance-calculation-scroll th{text-align:left}.finance-calculation-dialog .analysis-receipt-line{display:flex;justify-content:space-between;gap:16px;padding:6px 0}.finance-calculation-dialog .analysis-receipt-line strong{white-space:nowrap}
@media(max-width:720px){.finance-calculation-dialog{padding:16px}.finance-calculation-total{font-size:22px}.finance-calculation-dialog .data-table td,.finance-calculation-dialog .data-table th{font-size:12px;padding:8px}.finance-calculation-inputs{font-size:13px}}
/* Dense finance workspace; the collapsed menu only reserves its header button. */
@media(min-width:721px){
 .app-shell[data-page^="finance"] .main-content{max-width:none;padding:12px 12px 24px}
 body.sidebar-hidden .app-shell[data-page^="finance"]{position:relative}
 body.sidebar-hidden .app-shell[data-page^="finance"] .main{padding-left:0}
 body.sidebar-hidden .app-shell[data-page^="finance"] .sidebar-restore{position:absolute;top:16px;left:12px;width:32px;height:32px}
 body.sidebar-hidden .app-shell[data-page^="finance"] .finance-header{padding-left:40px}
 .finance-month-table .finance-cell-value{min-height:25px;padding:3px 0}
 .finance-month-table th,.finance-month-table td{padding:1px 4px!important}
 .finance-month-table thead th{padding:6px 4px!important}
 .finance-month-table tbody th{height:auto}
 .finance-report-filters{margin-bottom:10px;padding:6px}
 .finance-header{margin-bottom:8px}
 .finance-marketplace-jumps .button{min-height:30px;padding:5px 12px;font-size:12px}
}
.finance-month-table .finance-col-month,.finance-month-table tr>th:first-child{width:80px;font-size:11px}
.finance-marketplace-jumps{gap:6px;margin-bottom:8px}
.finance-monthly .expense-section-head{margin-bottom:8px}
.finance-monthly .expense-section-head h2{font-size:17px}
.finance-monthly .expense-chart-panel{padding:12px}
.finance-monthly+.finance-monthly{margin-top:20px;padding-top:16px}
.finance-method-note{font-size:12px;color:var(--muted);margin:7px 0 10px;line-height:1.5}
.finance-method-note summary{cursor:pointer;width:fit-content}
.finance-method-note p{margin:6px 0}
.finance-monthly>.finance-table-key{margin-top:6px}
.finance-monthly>.finance-month-precision{display:none}
.finance-source-groups details{border-top:1px solid var(--border);padding:9px 0}
.finance-source-groups summary{display:flex;justify-content:space-between;align-items:baseline;gap:12px;cursor:pointer}
.finance-source-groups summary span{min-width:0;overflow-wrap:anywhere}
.finance-source-groups summary strong{white-space:nowrap;font-variant-numeric:tabular-nums}
.finance-source-groups small{display:block;color:var(--muted);line-height:1.5;margin-top:4px}
.finance-source-groups p{margin:6px 0;overflow-wrap:anywhere}
.finance-source-state{font-size:12px;color:var(--muted)}
.finance-source-state.is-error{color:var(--warning,#efc780)}

/* Keep overlay scrollbars clear of the total-row buttons. */
.finance-month-table-scroll{padding:0 0 12px}
.finance-month-inactive td{font-size:12px;color:var(--muted)}
