.lb-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:14px 0}.lb-summary>button{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px 16px;background:#f6f8fb;border:1px solid #dde5ef;text-align:left}.lb-summary strong{font-size:23px;line-height:1.3;font-variant-numeric:tabular-nums;color:#193c64}.lb-summary small{font-size:12px;font-weight:400;margin-left:5px}.lb-summary span{font-size:12px;color:#5a708d}.lb-tabs{display:flex;gap:8px;border-bottom:1px solid #dae3ef;padding:0 0 10px;margin-bottom:12px}.lb-tabs [aria-selected=true]{background:#eaf1ff;border-color:#7199ee;color:#1d54b3;font-weight:700}.lb-panel-head{margin:12px 0}.lb-panel-head h2{font-size:18px;margin:0 0 6px}.lb-row-tools{display:flex;gap:5px;margin-top:7px}.lb-row-tools button{font-size:12px;padding:4px 8px}.lb-compare{white-space:nowrap;font-size:12px;margin-top:6px}.lb-warning{color:#926000}.lb-note{white-space:pre-wrap;overflow-wrap:anywhere;max-width:450px}.lb-note-history{max-height:40vh;overflow:auto}.lb-note-history article{padding:12px 0;border-bottom:1px solid #e3e9f1}.lb-sort-button{font:inherit;padding:0;border:0;background:transparent;color:inherit}.ledger-beta-workspace+div[hidden]{display:none!important}@media(max-width:1000px){.lb-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:550px){.lb-summary{grid-template-columns:1fr}.lb-tabs{flex-wrap:wrap}}

.lb-manage{position:relative}.lb-manage>summary{cursor:pointer;border:1px solid #d5dfec;border-radius:5px;padding:4px 8px;font-size:12px;list-style:none}.lb-manage[open]>div{position:absolute;top:100%;left:0;z-index:4;display:flex;gap:4px;padding:8px;background:white;border:1px solid #d5dfec;border-radius:6px;box-shadow:0 5px 16px #152a4320;min-width:250px}.lb-row-tools{flex-wrap:wrap}

.accounting-ledger-card [hidden]{display:none!important}
/* Compact TEST ledger header; preserve existing text and amount sizes. */
.accounting-ledger-card:has(#beta-nonzero){padding:10px 14px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters{gap:8px 12px;margin-bottom:8px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters>label{gap:6px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters input{max-width:170px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters select{width:205px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters #accounting-month{width:135px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-balance-summary{display:grid;grid-template-columns:auto auto;align-items:center;gap:2px 12px;padding:7px 12px;min-width:0}
.accounting-ledger-card:has(#beta-nonzero) .accounting-balance-summary>.tiny{grid-column:1/-1}
.accounting-ledger-card:has(#beta-nonzero) .accounting-balance-summary>button{justify-self:end;padding:2px 0;min-height:0;border:0;background:transparent;text-decoration:underline;text-underline-offset:3px}
.accounting-ledger-card:has(#beta-nonzero)>div.row{gap:8px;margin-bottom:5px!important}
.accounting-ledger-card:has(#beta-nonzero)>div.row button,.accounting-ledger-card:has(#beta-nonzero)>div.row select{padding:6px 10px}
.accounting-ledger-card:has(#beta-nonzero)>.notice{padding:3px 0;margin:0 0 7px;border:0;background:transparent}
.accounting-ledger-card:has(#beta-nonzero) .lb-summary{gap:0;margin:6px 0 9px;border:1px solid #dde5ef;border-radius:7px;background:#f6f8fb;overflow:hidden}
.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button{display:grid;grid-template-columns:1fr auto;align-content:center;align-items:center;gap:1px 8px;padding:8px 14px;border:0;border-right:1px solid #dde5ef;border-radius:0;background:transparent;min-height:64px}
.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button:last-child{border-right:0}
.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button>span:last-child:not(:first-child){grid-column:1/-1}
.accounting-ledger-card:has(#beta-nonzero) .lb-tabs{gap:6px;padding-bottom:7px;margin-bottom:7px}
.accounting-ledger-card:has(#beta-nonzero) .lb-tabs>button{padding:7px 12px}
@media(max-width:1000px){.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button:nth-child(2){border-right:0}.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button:nth-child(-n+2){border-bottom:1px solid #dde5ef}}
@media(max-width:550px){.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button{border-right:0;border-bottom:1px solid #dde5ef}.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button:last-child{border-bottom:0}.accounting-ledger-card:has(#beta-nonzero) .accounting-balance-summary{width:100%}}
/* Keep the amount centered like the adjacent cards; reserve a left date row. */
.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button:has(>span:nth-child(3)){grid-template-columns:minmax(0,1fr) auto}
.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button:has(>span:nth-child(3))>strong{grid-column:2;grid-row:1/3;align-self:center}
.accounting-ledger-card:has(#beta-nonzero) .lb-summary>button>span:nth-child(3){grid-column:1!important;grid-row:2;overflow-wrap:anywhere}
.lb-import-table select{min-width:210px;max-width:260px}.lb-import-table input[type=date]{min-width:140px}.lb-import-table input[type=month]{min-width:125px}.lb-import-table input[type=number]{min-width:125px;width:145px}.lb-import-table input[data-field=note]{min-width:120px}.lb-import-table th{white-space:nowrap}
#modal.wide:has(#lb-plan-import-confirm):not(.popup-maximized):not(.popup-minimized){width:min(1500px,calc(100vw - 48px));max-width:calc(100vw - 48px)}
.lb-import-table th,.lb-import-table td{padding:9px 8px}.lb-import-table td:last-child{min-width:115px;max-width:170px;overflow-wrap:break-word}.lb-import-table input[data-field=note]{width:160px}
/* Keep action names intact and wrap at button boundaries. */
.lb-row-tools>button,.lb-manage>summary{white-space:nowrap;word-break:keep-all;flex-shrink:0}
.lb-manage[open]>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:240px;min-width:0;gap:6px}
.lb-manage[open]>div>button{white-space:nowrap;word-break:keep-all;min-width:0;margin:0;padding:7px 10px;line-height:1.4;text-align:center}
.lb-manage[open]>div>button:nth-child(3):last-child{grid-column:1/-1}

/* Put source amounts first; comparison text opens on demand. */
.lb-amount-cell{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.lb-original-amount{font-size:inherit;font-weight:700;color:#173450}
.accounting-ledger-card:has(#beta-nonzero)> .table-wrap>table>thead>tr>th:nth-child(n+3):nth-child(-n+8){text-align:right}
.lb-compare-open{display:block;margin:6px 0 0 auto;padding:2px 6px;font-size:12px;line-height:1.5;font-weight:400;color:#617185;background:#fff;border:1px solid #e2e7ee;border-radius:4px;white-space:nowrap}
.lb-compare-open:hover{background:#f3f6fa;color:#235ed0}
.lb-comparison-detail{padding:10px 14px;background:#f6f8fb;border-radius:6px;margin-bottom:14px}.lb-comparison-detail p{margin:6px 0}
.accounting-ledger-card table td.lb-amount-cell{text-align:right}

/* Shared purchase/sales ledger spacing; keep values and comparison text intact. */
.accounting-ledger-card>.table-wrap>table>tbody>tr[data-beta-key]{height:120px}
.accounting-ledger-card>.table-wrap>table>tbody>tr[data-beta-key]>td{box-sizing:border-box;height:120px;padding-top:10px;padding-bottom:10px;vertical-align:top}
.accounting-ledger-card>.table-wrap>table>tbody>tr[data-beta-key]>.accounting-delete-cell{vertical-align:middle}
.accounting-ledger-card .lb-row-tools{align-items:center;gap:6px;margin-top:7px}
.accounting-ledger-card .lb-row-tools>button,
.accounting-ledger-card .lb-manage>summary,
.accounting-ledger-card .vendor-danger-delete{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-width:86px;height:32px;min-height:32px;padding:0 10px;margin:0;font-size:12px;line-height:18px;white-space:nowrap;vertical-align:middle}
.accounting-ledger-card .lb-manage{margin:0;padding:0}
.accounting-ledger-card .lb-manage[open]>div>button{box-sizing:border-box;height:32px;min-height:32px;padding:0 10px;font-size:12px;line-height:18px}

/* Compact purchase/sales search header; preserve ledger values and body rows. */
#main:has(.accounting-page-head){padding-top:12px}
.accounting-page-head{margin-bottom:8px;gap:8px}
.accounting-page-head>.row{gap:6px;flex-wrap:wrap}
.accounting-page-head button{height:34px;min-height:34px;padding:0 12px;font-size:13px;line-height:18px;white-space:nowrap}
.accounting-ledger-card:has(#beta-nonzero){padding:10px 12px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters{gap:6px 8px;margin:0 0 6px;align-items:center}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters>label{margin:0;gap:6px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters input,
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters select,
.accounting-ledger-card:has(#beta-nonzero) .accounting-ledger-filters>button{box-sizing:border-box;height:32px;min-height:32px;margin:0;padding:5px 9px;font-size:13px;line-height:20px}
.accounting-ledger-card:has(#beta-nonzero) .accounting-balance-summary{gap:1px 10px;padding:5px 10px;line-height:1.4}
.accounting-ledger-card:has(#beta-nonzero) .accounting-balance-summary>.tiny{margin:0;line-height:1.4}
.accounting-ledger-card:has(#beta-nonzero)>div.row{align-items:center;gap:6px 8px;margin-top:0}
.accounting-ledger-card:has(#beta-nonzero)>div.row label{margin:0;gap:6px}
.accounting-ledger-card:has(#beta-nonzero)>div.row button,
.accounting-ledger-card:has(#beta-nonzero)>div.row select{box-sizing:border-box;height:32px;min-height:32px;margin:0;padding:5px 9px;font-size:13px;line-height:20px}
.accounting-ledger-card:has(#beta-nonzero)>.notice{margin:3px 0 6px;padding:4px 8px;line-height:1.5}
