/* Accounting uses the management screen's shared Material tokens and controls. */
.accounting-app{width:100%;min-width:0;color:var(--md-ink);font:inherit}
.accounting-app *{box-sizing:border-box}
.accounting-top{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}
.accounting-top p{margin:8px 0 0;color:var(--md-secondary);font-size:14px}
.accounting-top label{flex:0 0 210px}
.accounting-app label input,.accounting-app label select,.accounting-app label textarea{display:block;margin-top:6px;width:100%}
.accounting-app #nav{display:flex;flex-wrap:wrap;gap:4px;margin:24px 0}
.accounting-app #nav button{white-space:nowrap;flex:0 0 auto;border-radius:0;box-shadow:none}
.accounting-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}
.accounting-app h2{font-size:20px;font-weight:600;margin:0 0 16px}
.accounting-heading h2{margin:0}
.accounting-app h3{font-size:16px;margin:24px 0 12px}
.accounting-app .badge{background:var(--md-container);color:var(--md-secondary);border-radius:8px;padding:6px 12px;font-size:13px;white-space:nowrap}
.accounting-app .summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:24px}
.accounting-app .card{background:var(--md-card);border:1px solid var(--md-divider);border-radius:var(--md-radius);padding:20px;min-width:0}
.accounting-app .card small{display:block;color:var(--md-secondary);font-size:13px;opacity:1}
.accounting-app .amount{font-size:clamp(18px,2vw,26px);font-weight:500;margin-top:8px;font-variant-numeric:tabular-nums;white-space:nowrap}
.accounting-app .card.balance{background:var(--md-primary-container);border-color:transparent;color:var(--md-on-primary-container)}
.accounting-app .card.balance small{color:var(--md-on-primary-container)}
.accounting-app .panel{margin-bottom:24px;min-width:0}
.accounting-app .toolbar,.accounting-app .actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-bottom:20px}
.accounting-app .toolbar>label{flex:1 1 180px;min-width:0}
.accounting-app .actions{justify-content:flex-end;margin:24px 0 0}
.accounting-app button,.accounting-app .button{font-family:inherit;min-height:44px;font-size:14px;line-height:1.5;border-radius:24px;padding:10px 22px;cursor:pointer}
.accounting-app button:not(#nav button),.accounting-app .button{background:var(--md-primary);color:var(--md-on-primary);border:1px solid transparent}
.accounting-app button.secondary,.accounting-app .button.secondary{background:transparent;color:var(--md-primary);border-color:var(--md-outline)}
.accounting-app .button{display:inline-flex;align-items:center;justify-content:center;font-weight:600;text-decoration:none}
.accounting-app button:disabled{opacity:.45;cursor:not-allowed}
.accounting-app input,.accounting-app select,.accounting-app textarea{max-width:100%;font-family:inherit}
.accounting-app input[type=number]{width:145px;text-align:right;font-variant-numeric:tabular-nums}
.accounting-app input[type=search]{flex:1 1 240px;min-width:0}
.accounting-app textarea{width:100%;min-height:96px}
.accounting-app .tablewrap{overflow-x:auto;max-height:none;border:0;border-radius:0}
.accounting-app table{width:100%;border-collapse:collapse;font-size:14px}
.accounting-app th{position:sticky;top:0;z-index:1;background:var(--md-surface);color:var(--md-secondary);font-size:13px;text-align:left}
.accounting-app td,.accounting-app th{padding:14px 12px;border-bottom:1px solid var(--md-divider);vertical-align:top}
.accounting-app td.num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.accounting-app td.note{min-width:200px;max-width:480px;overflow-wrap:anywhere}
.accounting-app td button{padding:8px 14px}
.accounting-app td input{min-width:110px;width:100%}
.accounting-app .tablewrap td:first-child{white-space:nowrap}
.accounting-app #reportTable table{min-width:900px}
.accounting-app #message:not(:empty){padding:14px 16px;border-radius:12px;background:var(--md-primary-container);color:var(--md-on-primary-container);margin-bottom:20px}
.accounting-app #message.error{background:#fce8e6;color:#a50e0e}
.accounting-app .notice{padding:16px;border:1px solid var(--md-divider);border-radius:12px;background:var(--md-container);color:var(--md-secondary);font-size:14px;line-height:1.7;margin-bottom:20px}
.accounting-app .grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.accounting-app dialog{border:1px solid var(--md-divider);border-radius:24px;width:650px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;padding:28px;color:var(--md-ink);background:var(--md-card);box-shadow:0 8px 32px #0003}
.accounting-app dialog::backdrop{background:#20212466}
.accounting-app #fields{display:grid;gap:16px}
.accounting-app .wide{grid-column:1/-1}
.accounting-app a:not(.button){color:var(--md-primary)}
.accounting-app .details{font-size:13px;color:var(--md-secondary);line-height:1.6}
.accounting-app code{overflow-wrap:anywhere}
@media(max-width:1100px){.accounting-app .summary{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){
 .accounting-top{display:block}.accounting-top label{display:block;margin-top:20px}
 .accounting-app #nav{gap:0;margin:20px 0}.accounting-app #nav button{flex:1 1 auto;padding:10px 12px}
 .accounting-heading{align-items:flex-start;flex-wrap:wrap;gap:10px}
 .accounting-app .summary{gap:10px}.accounting-app .card{padding:14px 10px}.accounting-app .amount{font-size:18px}
 .accounting-app .grid{grid-template-columns:minmax(0,1fr)}.accounting-app .panel{padding:16px}
 .accounting-app .toolbar>label{flex-basis:100%}.accounting-app .toolbar>input[type=search]{flex-basis:100%}
 .accounting-app td.note{min-width:0}.accounting-app dialog{padding:20px}.accounting-app .tablewrap{max-height:none}
}

/* Tables participate in page scrolling; no nested scroll containers. */
.accounting-app .tablewrap{overflow:visible;max-height:none;height:auto}
.accounting-app table,.accounting-app #reportTable table{min-width:0;max-width:100%;table-layout:fixed}
.accounting-app th{position:static}
.accounting-app td,.accounting-app th,.accounting-app td.num,.accounting-app .tablewrap td:first-child{min-width:0;max-width:none;white-space:normal;overflow-wrap:anywhere}
.accounting-app td input,.accounting-app td input[type=number]{min-width:0;width:100%;max-width:100%}
.accounting-app td button{max-width:100%;white-space:normal;padding:8px 10px}
.accounting-app td.note{min-width:0;max-width:none}

/* Give transaction descriptions the largest share of the table. */
@media(min-width:601px){
 .accounting-app table:has(td.note) th:nth-child(1){width:11%}
 .accounting-app table:has(td.note) th:nth-child(2){width:19%}
 .accounting-app table:has(td.note) th:nth-child(3){width:40%}
 .accounting-app table:has(td.note) th:nth-child(4){width:18%}
 .accounting-app table:has(td.note) th:nth-child(5){width:12%}
}
@media(max-width:600px){
 .accounting-app td.note{display:block;text-align:left}
 .accounting-app td.note::before{display:block;margin-bottom:6px}
}

/* Report selection, relevant filters and export share one page flow. */
.accounting-app .summary[hidden]{display:none}
.accounting-app .report-choices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:20px}
.accounting-app #content button.report-choice{display:flex;flex-direction:column;gap:6px;text-align:left;border-radius:12px;padding:18px;background:var(--md-card);border:1px solid var(--md-divider);color:var(--md-ink);box-shadow:none}
.accounting-app #content button.report-choice.selected{background:var(--md-primary-container);border-color:var(--md-primary);color:var(--md-on-primary-container)}
.accounting-app .report-choice strong{font-size:16px}.accounting-app .report-choice span{font-size:12px;line-height:1.6}
.accounting-app .report-filters{display:flex;flex-wrap:wrap;gap:16px;align-items:end}
.accounting-app .report-filters>label{flex:1 1 200px;min-width:0;max-width:350px;font-size:13px;font-weight:600}
.accounting-app .report-filters>label.report-filter-wide{flex:2 1 300px;max-width:none}
.accounting-app .report-help{margin:14px 0 0}
.accounting-app .report-output-bar{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px;margin-bottom:16px}
.accounting-app .report-output-bar h3{font-size:20px;margin:0 0 6px}.accounting-app .report-output-bar p{margin:0}
.accounting-app .report-downloads{display:flex;gap:10px;flex-wrap:wrap}
.accounting-app a[aria-disabled=true]{opacity:.45;pointer-events:none}
.accounting-app #reportProgress{font-size:13px;color:var(--md-secondary);margin:8px 0 16px}
.accounting-app .report-section h4{display:flex;justify-content:space-between;margin:24px 0 8px;font-size:16px}
.accounting-app .report-section h4 span{font-size:12px;font-weight:400;color:var(--md-secondary)}
.accounting-app .report-row-group{background:var(--md-container);font-weight:600}
.accounting-app .report-row-total{background:var(--md-primary-container);font-weight:600}
.accounting-app .report-row-subtotal,.accounting-app .report-row-carry{font-weight:600}
.accounting-app .report-pager{display:flex;align-items:center;justify-content:center;gap:16px;margin-top:24px;flex-wrap:wrap}
.accounting-app .report-pager label{max-width:360px;min-width:0;flex:1}
.accounting-app #reportTable[data-layout=statement] th:nth-child(1),.accounting-app #reportTable[data-layout=statement] th:nth-child(2){width:17%}
.accounting-app #reportTable[data-layout=statement] th:nth-child(3){width:27%}
.accounting-app #reportTable[data-layout=statement] th:nth-child(n+4){width:13%}
.accounting-app #reportTable[data-layout=journal] th:has(+th){width:auto}
.accounting-app #reportTable[data-layout=journal] table:not(:has(th:nth-child(5))) th:nth-child(2){width:50%}
.accounting-app #reportTable[data-layout=journal] table:has(th:nth-child(6)) th:nth-child(3){width:34%}
.accounting-app #reportTable[data-layout=account_sections] th:nth-child(2){width:50%}
@media(max-width:850px){.accounting-app .report-choices{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.accounting-app #content button.report-choice{padding:14px 12px}.accounting-app .report-filters>label{flex-basis:100%;max-width:none}.accounting-app .report-downloads{width:100%}.accounting-app .report-downloads a{flex:1;padding:10px 12px}.accounting-app #reportTable td{overflow-wrap:anywhere}.accounting-app .report-pager{gap:10px}}
@media(max-width:600px){.accounting-app #reportTable td:empty{display:none}.accounting-app #reportTable td{padding:10px 8px}}

/* Income and expense occupy separate frames inside one amount column. */
.accounting-app .amount-box{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 9px;border:1px solid var(--md-divider);border-radius:6px;background:var(--md-surface);color:var(--md-secondary);font-size:13px}
.accounting-app .amount-box+.amount-box{margin-top:5px}
.accounting-app .amount-box span{flex:none;font-size:12px}
.accounting-app .amount-box strong{font-weight:500;font-variant-numeric:tabular-nums;text-align:right;overflow-wrap:anywhere}
.accounting-app .amount-box.income.has-amount{color:#174ea6;background:#edf3ff;border-color:#b6cdf5}
.accounting-app .amount-box.expense.has-amount{color:#9c3620;background:#fff3ef;border-color:#ecc4b9}
.accounting-app .amount-box.has-amount strong{font-weight:700}
@media(max-width:600px){.accounting-app td.transaction-amount{display:block}.accounting-app td.transaction-amount::before{display:block;margin-bottom:8px}.accounting-app .amount-box{padding:9px 12px}}

.accounting-app #management[hidden]{display:none}
.accounting-app #management>p{margin:0 0 14px}
.accounting-app #managementNav{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}
.accounting-app #management #managementNav button{background:var(--md-card);color:var(--md-secondary);border:1px solid var(--md-divider);border-radius:8px;box-shadow:none}
.accounting-app #management #managementNav button.active{background:var(--md-primary-container);color:var(--md-on-primary-container);border-color:var(--md-primary)}
.accounting-app #managementHeading{margin:0 0 16px;font-size:18px}
@media(max-width:600px){.accounting-app #management #managementNav button{flex:1 1 auto;padding:10px 12px}}
.accounting-app .account-editor-head{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:20px}
.accounting-app .account-editor-head p{margin:0 0 6px}
.accounting-app .account-filters{display:flex;align-items:end;gap:16px;flex-wrap:wrap;margin-bottom:20px}
.accounting-app .account-filters label{flex:1 1 200px;min-width:0;font-size:13px}
.accounting-app .account-kind{display:flex;gap:8px;align-self:end}
.accounting-app #content .account-kind button{background:var(--md-card);color:var(--md-secondary);border:1px solid var(--md-outline);border-radius:8px}
.accounting-app #content .account-kind button.active{background:var(--md-primary-container);color:var(--md-on-primary-container);border-color:var(--md-primary)}
.accounting-app .account-kind span{font-size:12px;margin-left:6px}
.accounting-app .account-savebar{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:14px 0;border-top:1px solid var(--md-divider);border-bottom:1px solid var(--md-divider);margin-bottom:16px}
.accounting-app #accountSaveStatus{font-size:14px;margin-right:auto}
.accounting-app .account-name{font-weight:600}
.accounting-app .account-move{display:inline-flex;gap:4px;margin-left:8px}
.accounting-app .account-move button{min-width:40px;padding:7px!important}
.accounting-app .account-empty{padding:24px 0;color:var(--md-secondary)}
@media(min-width:601px){.accounting-app .account-editor th:nth-child(1){width:19%}.accounting-app .account-editor th:nth-child(2){width:39%}.accounting-app .account-editor th:nth-child(3){width:30%}.accounting-app .account-editor th:nth-child(4){width:12%}}
@media(max-width:600px){.accounting-app .account-filters label{flex-basis:100%}.accounting-app .account-kind{width:100%}.accounting-app .account-kind button{flex:1}.accounting-app .account-savebar button{flex:1}.accounting-app #accountSaveStatus{flex-basis:65%}}
.accounting-app #content .account-editor button.secondary{background:transparent;color:var(--md-primary);border-color:var(--md-outline)}
@media(max-width:600px){.accounting-app .account-savebar button{flex:1 1 calc(50% - 6px);min-width:140px;white-space:nowrap}.accounting-app #accountSaveStatus{flex:1 1 60%}}
.accounting-app .category-editor .account-savebar>span{margin-right:auto}
.accounting-app .category-editor td small{display:block;margin-top:6px;color:var(--md-secondary)}
@media(min-width:601px){.accounting-app .category-editor th:nth-child(1){width:17%}.accounting-app .category-editor th:nth-child(2){width:40%}.accounting-app .category-editor th:nth-child(3){width:13%}.accounting-app .category-editor th:nth-child(4){width:30%}}
.accounting-app .accounting-edit-lock{display:flex;align-items:center;justify-content:space-between;gap:20px;flex-wrap:wrap;padding:16px 20px;margin-bottom:20px;background:var(--md-surface);border:1px solid var(--md-divider);border-radius:12px}
.accounting-app .accounting-edit-lock p{margin:6px 0 0;max-width:650px}
.accounting-app .accounting-switch{display:flex;align-items:center;gap:10px;position:relative;cursor:pointer;white-space:nowrap}
.accounting-app .accounting-switch input{position:absolute;opacity:0;width:44px;height:28px;margin:0}
.accounting-app .switch-track{width:44px;height:26px;background:#747775;border-radius:20px;position:relative;flex:none}
.accounting-app .switch-track::after{content:'';position:absolute;left:3px;top:3px;width:20px;height:20px;border-radius:50%;background:white;transition:transform .15s}
.accounting-app .accounting-switch input:checked+.switch-track{background:var(--md-primary)}
.accounting-app .accounting-switch input:checked+.switch-track::after{transform:translateX(18px)}
.accounting-app .accounting-switch input:focus-visible+.switch-track{outline:3px solid var(--md-primary);outline-offset:3px}
.accounting-app .accounting-switch input:disabled~span{opacity:.5;cursor:not-allowed}
.accounting-app .editing-enabled .accounting-edit-lock{border-color:var(--md-primary)}
.accounting-app #content input:disabled,.accounting-app #content textarea:disabled{background:#f1f3f4;color:#5f6368;cursor:not-allowed}
.accounting-app .transaction-actions button{margin:2px 4px 2px 0}
.accounting-app .voucher-workspace{max-width:1000px;margin:0 auto}
.accounting-app .voucher-toolbar,.accounting-app .voucher-downloads,.accounting-app .voucher-editbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.accounting-app .voucher-toolbar{margin-bottom:20px}
.accounting-app .voucher-editbar{margin-bottom:24px}
.accounting-app .voucher-editbar p{margin:6px 0 0}
.accounting-app .voucher-paper{background:white;color:#202124;border:1px solid var(--md-divider);border-radius:12px;padding:40px;box-shadow:0 3px 14px #00000008}
.accounting-app .voucher-paper header{position:relative;text-align:center;border-bottom:2px solid #dadce0;padding-bottom:24px;margin-bottom:28px}
.accounting-app .voucher-paper h3{font-size:28px;letter-spacing:.15em;margin:0 0 12px}
.accounting-app .voucher-paper header p{margin:0;font-size:13px;color:#5f6368}
.accounting-app .voucher-kind{display:inline-block;padding:5px 16px;background:#edf3ff;color:#174ea6;border-radius:20px;font-size:13px;margin-bottom:12px}
.accounting-app .voucher-kind.expense{background:#fff3ef;color:#9c3620}
.accounting-app .voucher-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;margin-bottom:24px}
.accounting-app .voucher-meta label,.accounting-app .voucher-field{font-size:13px;color:#5f6368}
.accounting-app .voucher-label{display:block;font-size:13px;color:#5f6368;margin-bottom:8px}
.accounting-app .voucher-meta strong{display:block;font-size:16px;padding:10px 0;font-weight:500}
.accounting-app .voucher-field{display:block;margin:24px 0}
.accounting-app .voucher-field p{padding:14px 16px;margin:0;border:1px solid #dadce0;border-radius:8px;line-height:1.8;font-size:15px;color:#202124;overflow-wrap:anywhere;white-space:pre-wrap}
.accounting-app .voucher-paper input,.accounting-app .voucher-paper textarea{width:100%;box-sizing:border-box;margin-top:8px}
.accounting-app #content .voucher-paper input:disabled,.accounting-app #content .voucher-paper textarea:disabled{background:#f8f9fa;color:#202124;opacity:1}
.accounting-app .voucher-total{display:flex;align-items:center;justify-content:space-between;gap:16px;border-top:1px solid #dadce0;border-bottom:2px solid #5f6368;padding:20px 0;margin:28px 0}
.accounting-app .voucher-total strong{font-size:32px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.accounting-app .voucher-total small{font-size:16px;margin-left:12px}
.accounting-app .voucher-seal{width:120px;margin:32px 0 0 auto;border:1px solid #9aa0a6;text-align:center}
.accounting-app .voucher-seal strong{display:block;font-size:13px;padding:10px;border-bottom:1px solid #9aa0a6}
.accounting-app .voucher-seal div{height:90px;display:grid;place-items:center;color:#9aa0a6}
.accounting-app .voucher-downloads a[aria-disabled=true]{opacity:.5;pointer-events:none}
@media(max-width:700px){.accounting-app .voucher-paper{padding:20px 16px}.accounting-app .voucher-meta{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.accounting-app .voucher-paper h3{font-size:24px}.accounting-app .voucher-downloads{width:100%}.accounting-app .voucher-downloads a{flex:1;text-align:center}.accounting-app .voucher-total strong{font-size:28px}}
.accounting-app .voucher-paper>header{display:block;min-height:0;padding:0 0 24px;background:transparent;box-shadow:none}
.accounting-app .voucher-paper>footer.voucher-seal{display:block;padding:0;box-sizing:border-box;background:transparent;color:#202124}
.accounting-app #content .voucher-toolbar button.secondary{background:transparent;color:var(--md-primary);border-color:var(--md-outline)}
.accounting-app .accounting-edit-lock[hidden]{display:none}
.accounting-app .report-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
.accounting-app .voucher-list .toolbar label{flex:1;min-width:180px}
.accounting-app .voucher-list td p{margin:6px 0 0;overflow-wrap:anywhere}
@media(min-width:601px){.accounting-app .voucher-list th:nth-child(1){width:12%}.accounting-app .voucher-list th:nth-child(2){width:7%}.accounting-app .voucher-list th:nth-child(3){width:36%}.accounting-app .voucher-list th:nth-child(4){width:13%}.accounting-app .voucher-list th:nth-child(5){width:20%}.accounting-app .voucher-list th:nth-child(6){width:12%}}

/* Shared accounting task hierarchy and responsive controls. */
.accounting-app :is(button,a,input,select,textarea,summary):focus-visible{outline:3px solid var(--md-primary);outline-offset:3px}
.accounting-app .accounting-heading{scroll-margin-top:90px}
.accounting-app #nav{border-bottom:1px solid var(--md-divider);gap:8px}
.accounting-app #nav button{padding:12px 20px;border-bottom:3px solid transparent}
.accounting-app #nav button.active{border-bottom-color:var(--md-primary);font-weight:700}
.accounting-app .transaction-toolbar{align-items:end;margin-bottom:16px}
.accounting-app .transaction-toolbar>label{flex:0 1 180px;font-size:13px;font-weight:600}
.accounting-app .transaction-toolbar>label.transaction-search{flex:1 1 320px}
.accounting-app .transaction-results{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 0;color:var(--md-secondary);font-size:13px}
.accounting-app .transaction-results strong{color:var(--md-ink)}
.accounting-app #voucherBatch{margin:4px 0 20px;border:1px solid var(--md-divider);border-radius:12px;background:var(--md-surface)}
.accounting-app #voucherBatch summary{cursor:pointer;padding:14px 16px;font-size:14px;font-weight:600;min-height:48px}
.accounting-app #voucherBatch details>p,.accounting-app #voucherBatch details>.toolbar{margin:0 16px 16px}
.accounting-app #voucherBatch .toolbar{align-items:end}
.accounting-app .transaction-actions{white-space:normal}
.accounting-app .account-empty{padding:28px 16px;background:var(--md-surface);border-radius:12px;text-align:center;line-height:1.7}
.accounting-app .account-empty p{margin-bottom:0}
.accounting-app .transaction-panel tbody tr:hover{background:var(--md-surface)}
.accounting-app .voucher-downloads>label{display:flex;align-items:center;gap:10px;min-width:0;margin:0;font-size:13px;font-weight:600;white-space:nowrap}
.accounting-app .voucher-downloads>label select{box-sizing:border-box;width:160px;min-height:44px;height:44px;margin:0;padding:8px 12px;font-size:14px;font-weight:400}
.accounting-app .voucher-downloads>a{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-height:44px;white-space:nowrap}
.accounting-app .report-preview{padding-top:24px}
.accounting-app #managementNav{padding-bottom:16px;border-bottom:1px solid var(--md-divider)}
.accounting-app .report-help{line-height:1.7}
@media(max-width:700px){
 .accounting-app .transaction-toolbar>label,.accounting-app .transaction-toolbar>label.transaction-search{flex:1 1 100%}
 .accounting-app .transaction-toolbar>button{flex:1 1 calc(50% - 12px)}
 .accounting-app #voucherBatch .toolbar>.button{flex:1 1 100%}
 .accounting-app .voucher-downloads>label{flex:1 1 100%;justify-content:space-between}
 .accounting-app .voucher-downloads>label select{flex:1;max-width:240px}
 .accounting-app #nav{gap:0}.accounting-app #nav button{padding:12px 8px;font-size:13px;flex:1}
 .accounting-app .accounting-edit-lock{padding:16px;gap:12px}
}
.accounting-app #content button.secondary{background:transparent;color:var(--md-primary);border:1px solid var(--md-outline);box-shadow:none}
.accounting-app #content button.delete{color:#a50e0e;border-color:#d6aaa5}
.accounting-app #content .transaction-actions button.voucher{background:var(--md-primary-container);color:var(--md-on-primary-container);border-color:transparent}
.accounting-app .actions[hidden]{display:none}

/* Explicit document/edit/cancel actions, stable sizing on every transaction. */
.accounting-app .transaction-action-group{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;width:100%}
.accounting-app #content .transaction-action-group button{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;margin:0;padding:8px 10px;min-height:44px;border-radius:8px;white-space:nowrap;font-size:13px;line-height:1.4}
.accounting-app .transaction-action-group svg{width:17px;height:17px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.accounting-app #content .transaction-action-group button.edit{background:var(--md-card);border-color:var(--md-divider);color:var(--md-ink)}
.accounting-app #content .transaction-action-group button.delete{background:transparent;border-color:transparent;color:#a50e0e}
.accounting-app #content .transaction-action-group button:not(:disabled):hover{filter:brightness(.96)}
.accounting-app #content .transaction-action-group button.delete:not(:disabled):hover{background:#fce8e6}
@media(max-width:600px){
 .accounting-app td.transaction-actions{display:block}
 .accounting-app td.transaction-actions::before{display:block;margin-bottom:10px}
 .accounting-app .transaction-action-group{grid-template-columns:repeat(3,minmax(0,1fr))}
}

.accounting-app .transaction-action-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.accounting-app #content .transaction-action-group button.voucher{grid-column:1/-1;min-height:44px;background:var(--md-primary-container);font-weight:600}
.accounting-app #content .transaction-action-group button{padding:8px 5px;gap:5px}
@media(min-width:601px){
 .accounting-app table:has(td.note) th:nth-child(2){width:16%}
 .accounting-app table:has(td.note) th:nth-child(3){width:37%}
 .accounting-app table:has(td.note) th:nth-child(5){width:18%}
}
@media(min-width:601px) and (max-width:850px){.accounting-app .transaction-action-group{grid-template-columns:minmax(0,1fr)}}
@media(max-width:600px){.accounting-app .transaction-action-group{grid-template-columns:repeat(2,minmax(0,1fr))}}
.accounting-app .cancel-transaction-summary{padding:18px;border:1px solid var(--md-divider);border-radius:12px;background:var(--md-surface)}
.accounting-app .cancel-transaction-summary dl{margin:0}
.accounting-app .cancel-transaction-summary dl>div{display:flex;gap:16px;justify-content:space-between;padding:7px 0}
.accounting-app .cancel-transaction-summary dt{flex:none;color:var(--md-secondary);font-size:13px}
.accounting-app .cancel-transaction-summary dd{margin:0;text-align:right;overflow-wrap:anywhere}
.accounting-app .cancel-transaction-summary .cancel-amount{font-size:20px;font-weight:600;font-variant-numeric:tabular-nums}
.accounting-app .cancel-transaction-summary p{margin:14px 0 0;padding-top:14px;border-top:1px solid var(--md-divider);overflow-wrap:anywhere;white-space:pre-wrap}
.accounting-app #editForm button.danger-action{background:#a50e0e;color:white;border-color:#a50e0e}
.accounting-app #cancelError{color:#a50e0e;margin:0}

.accounting-app .voucher-number-tag{display:block;width:fit-content;padding:3px 8px;margin-bottom:8px;border-radius:6px;background:var(--md-container);font-weight:600;font-variant-numeric:tabular-nums;font-size:13px}
.accounting-app .transaction-date{display:block;font-size:13px;color:var(--md-secondary)}

.accounting-app .voucher-navigation{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 20px;flex-wrap:wrap}
.accounting-app .voucher-navigation span{color:var(--md-secondary);font-size:13px}
.accounting-app .voucher-missing{display:flex;flex-direction:column;gap:6px;padding:16px 20px;margin:0 0 20px;border:1px solid #e4c787;border-radius:12px;background:#fff9ec;color:#614600;font-size:13px;line-height:1.6}
.accounting-app .voucher-paper{border-color:#b8bdc4}
.accounting-app .voucher-paper .voucher-label,.accounting-app .voucher-meta label,.accounting-app .voucher-field{color:#3c4043}
.accounting-app .voucher-paper .voucher-field p{border-color:#b8bdc4}
@media(max-width:600px){.accounting-app .voucher-navigation span{order:-1;flex-basis:100%;text-align:center}.accounting-app .voucher-navigation button{flex:1;padding:10px 12px}.accounting-app .voucher-editbar .actions{width:100%;margin-top:12px}.accounting-app .voucher-editbar .actions button{flex:1}.accounting-app .voucher-missing{padding:14px}}

.accounting-app .voucher-print-stamp{clear:both;text-align:left;font-size:12px;color:#3c4043;margin:24px 0 0}.accounting-app .voucher-print-stamp:empty{display:none}

/* Backups are downloads; restoration stays a separate explicit operation. */
.accounting-app .history-summary,.accounting-app .history-date,.accounting-app .history-pagination{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.accounting-app .history-summary{justify-content:space-between;margin:20px 0 8px;font-size:13px}
.accounting-app .history-list{list-style:none;margin:0;padding:0}
.accounting-app .history-list li{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 0;border-top:1px solid var(--md-divider)}
.accounting-app .history-list p{margin:6px 0;font-size:14px}.accounting-app .history-list small,.accounting-app .history-summary span{color:var(--md-secondary)}
.accounting-app .history-list .button{flex-shrink:0;white-space:nowrap}
.accounting-app .history-pagination{justify-content:center;margin-top:16px}
.accounting-app .restore-steps{padding-left:24px;line-height:1.9}
@media(max-width:600px){.accounting-app .history-list li{align-items:stretch;flex-direction:column;gap:12px}.accounting-app .history-list .button{text-align:center}.accounting-app .history-date{gap:8px;font-size:14px}}

.accounting-app .restore-preview:not(:empty){margin-top:24px}
.accounting-app .restore-actions{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:24px;padding-top:20px;border-top:1px solid var(--md-divider)}
.accounting-app .restore-actions p{margin:0;line-height:1.6}.accounting-app .restore-actions button{flex-shrink:0}
@media(max-width:600px){.accounting-app .restore-actions{align-items:stretch;flex-direction:column;gap:12px}.accounting-app .restore-actions button{width:100%;white-space:normal}}

.accounting-app .history-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px}.accounting-app .history-actions button{white-space:nowrap}
@media(max-width:600px){.accounting-app .history-actions{flex-direction:column}.accounting-app .history-actions>*{width:100%;box-sizing:border-box}}

/* Sort controls keep the existing compact five-column ledger layout. */
.accounting-app #content button.transaction-sort{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:6px 4px;margin:0;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;font-weight:600;text-align:left;white-space:normal}
.accounting-app #content button.transaction-sort span{flex:none;color:var(--md-secondary)}
.accounting-app #content button.transaction-sort.active,.accounting-app #content button.transaction-sort.active span{color:var(--md-primary)}
.accounting-app #content button.transaction-sort:hover{background:var(--md-primary-container)}
.accounting-app #content button.transaction-sort:focus-visible{outline:2px solid var(--md-primary);outline-offset:2px}
