/* Scoped to the ledger; project and weekly-report styles remain independent. */
#expenses-view.ledger{padding:0;border:0;background:#f3f6f9;color:#19344c;border-radius:12px;overflow:hidden;font-family:Arial,"Noto Sans TC",sans-serif}
.ledger [hidden]{display:none!important}.ledger *{box-sizing:border-box}.ledger button{cursor:pointer;font-size:14px;border-radius:8px;min-height:40px}.ledger button:disabled{opacity:.45;cursor:not-allowed}.ledger button:focus-visible,.ledger input:focus-visible,.ledger select:focus-visible{outline:3px solid #6db8c7;outline-offset:2px}.ledger-brand{display:flex;justify-content:space-between;align-items:center;background:#fff;padding:22px 30px;border-bottom:1px solid #dce5ef}.ledger-brand strong{font-size:17px}.ledger-brand span{font-size:13px;color:#63829a}.ledger-content{padding:36px 24px;max-width:1440px;margin:auto}.ledger-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:28px;gap:16px}.ledger-heading h1{font-size:30px;margin:0 0 10px;font-weight:750}.ledger-heading p{color:#668098;margin:0}.ledger .ledger-primary{background:#207485;color:white;border:1px solid #207485;padding:11px 16px;font-weight:600}.ledger .ledger-secondary{background:#fff;color:#245669;border:1px solid #ccdae7;padding:8px 12px}.ledger-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-bottom:24px}.ledger-stat{padding:24px 26px;background:#fff;border:1px solid #d5e2ef;border-radius:14px;min-height:154px}.ledger-stat.main{background:#18354d;color:#fff;border-color:#18354d}.ledger-stat>div{margin:18px 0 12px}.ledger-stat strong{font-size:32px;letter-spacing:-1px}.ledger-stat small{font-size:13px}.ledger-stat>small{color:#7190a6}.ledger-stat.main>small{color:#bad0dd}.ledger-tabs{display:flex;gap:8px;margin:20px 0 12px}.ledger-tabs button{padding:10px 18px;background:transparent;border:1px solid transparent;color:#57748b}.ledger-tabs button.active{background:#fff;border-color:#cbdce8;color:#18354d;font-weight:700}.ledger-panel{padding:0;background:#fff;border:1px solid #d8e4ef;border-radius:14px;overflow:hidden}.ledger-panel-heading{display:flex;justify-content:space-between;gap:16px;padding:24px 26px 14px;align-items:center}.ledger-panel h2{font-size:19px;margin:0}.ledger-panel-heading>span{font-size:13px;color:#7190a6}.ledger-filters{display:flex;gap:12px;padding:8px 26px;flex-wrap:wrap;align-items:end}.ledger input:not([type=checkbox]),.ledger select{height:44px;background:#fff;border:1px solid #cbdcea;border-radius:8px;padding:8px 12px;color:#19344c;font-size:14px;min-width:0}.ledger input[type=checkbox]{accent-color:#207485;width:17px;height:17px;min-width:17px}.ledger #ledger-search{width:100%;max-width:none}.ledger-filters>label,.ledger-selection>label:has(input[type=date]){display:flex;flex-direction:column;gap:5px;font-size:12px;color:#608098}.ledger-filters select{min-width:180px}.ledger-selection{display:flex;align-items:center;flex-wrap:wrap;gap:14px;padding:18px 26px;margin-top:8px;background:#f8fbfd;border-top:1px solid #e3edf4;border-bottom:1px solid #e3edf4;font-size:13px}.ledger-selection>label:first-child{display:flex;align-items:center;gap:8px}.ledger-selection>span{margin-right:auto}.ledger-selection input[type=date]{height:36px}.ledger-group{border:0;border-radius:0;margin:0;border-bottom:1px solid #dce7ef;background:#fff}.ledger-group>summary{display:flex;gap:16px;align-items:center;padding:20px 26px;cursor:pointer;list-style:none;background:#fff;color:#19344c}.ledger-group>summary:after{content:'⌄';font-size:18px;margin-left:5px}.ledger-group:not([open])>summary:after{content:'›'}.ledger-group-name{display:flex;flex:1;flex-direction:column;gap:7px}.ledger-group-name small{font-weight:400;color:#718ca1}.ledger-folder{padding:10px;background:#eef5f9;border-radius:8px;font-size:22px}.ledger-entry{display:flex;align-items:center;gap:16px;padding:18px 26px;border-top:1px solid #edf2f6;background:#fff}.ledger-entry .ledger-date{white-space:nowrap;color:#748ca0;font-size:13px}.ledger-entry-body{display:flex;flex:1;flex-direction:column;gap:6px;min-width:120px;overflow-wrap:anywhere}.ledger-entry-body strong{font-size:15px}.ledger-entry-body small{font-size:13px;color:#71879b}.ledger-amount{white-space:nowrap;font-size:15px}.ledger-entry-status{display:flex;flex-direction:column;gap:6px;min-width:134px;font-size:11px;color:#6c879c}.ledger-badge{padding:5px 9px;border-radius:6px;font-size:12px;width:fit-content;background:#edf3f7;color:#557284}.ledger-badge.unclaimed{background:#fff2d5;color:#926918}.ledger-badge.claimed{background:#e3f1f5;color:#246b80}.ledger-badge.paid{background:#e8f3ea;color:#467654}.ledger-entry-actions{display:flex;flex-direction:column;gap:6px;min-width:88px}.ledger .ledger-text-button{background:transparent;border:0;color:#237485;padding:9px 12px}.ledger-empty{padding:64px 26px;text-align:center;color:#68869b;line-height:1.8}.ledger-empty h3{font-size:18px;color:#19344c}.ledger-empty-icon{font-size:42px}.ledger-empty button{margin-top:14px}.ledger-footer{display:flex;justify-content:space-between;gap:20px;align-items:center;color:#6c879c;font-size:13px;padding-top:20px}.ledger-footer button{font-size:12px;background:transparent;border:1px solid #d4e1ec;color:#4f7089;padding:6px 12px;margin-left:8px}.ledger-error:empty{display:none}.ledger-error{border-radius:8px;background:#fff0ec;color:#a74031;padding:14px}.ledger-claim-info{display:flex;justify-content:space-between;align-items:center;padding:0 26px 16px;color:#68879b;font-size:13px;gap:12px}.ledger-footnote,.ledger-claim-note{font-size:12px;color:#718ba1;padding:10px 26px;margin:0}.ledger-claim-card{margin-bottom:10px}
@media(max-width:900px){.ledger-entry{flex-wrap:wrap;gap:12px}.ledger-entry-body{min-width:45%}.ledger-entry-status{margin-left:auto}.ledger-content{padding:24px 16px}.ledger-footer{flex-direction:column;align-items:start}.ledger-entry-actions{flex-direction:row}.ledger-selection>span{width:100%}.ledger-brand{padding:18px}.ledger-brand span{font-size:11px}}
@media(max-width:560px){.ledger-summary{grid-template-columns:1fr;gap:10px}.ledger-stat{min-height:100px;padding:18px;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}.ledger-stat>div{margin:0}.ledger-stat>small{width:100%}.ledger-stat strong{font-size:28px}.ledger-heading h1{font-size:26px}.ledger-heading{align-items:start}.ledger-heading .ledger-primary{font-size:12px;padding:10px}.ledger-panel-heading,.ledger-filters,.ledger-selection{padding-left:16px;padding-right:16px}.ledger-filters>label{flex:1}.ledger-filters input{width:100%}.ledger-brand span{display:none}.ledger-entry{padding:16px}.ledger-entry-body{flex-basis:60%}.ledger-amount{margin-left:auto}.ledger-group>summary{padding:18px 16px}.ledger-tabs button{padding:10px 12px}.ledger-panel-heading>span{max-width:45%;text-align:right}.ledger-entry-status{margin-left:0}.ledger-entry-actions{margin-left:auto}}

.ledger-report{width:min(1000px,96vw);max-height:94vh;border:1px solid #ccdce8;border-radius:12px;padding:24px;color:#19344c;background:white}.ledger-report::backdrop{background:#19344c88}.ledger-report-controls{display:flex;gap:12px;align-items:center;margin-bottom:24px;flex-wrap:wrap}.ledger-report-sheet{font:14px/1.6 Arial,sans-serif}.ledger-report-sheet h1{font-size:24px}.ledger-report table{border-collapse:collapse;width:100%;margin:24px 0}.ledger-report th,.ledger-report td{padding:10px 8px;border-bottom:1px solid #dce4eb;text-align:left;overflow-wrap:anywhere}.ledger-report th{background:#edf3f7}.ledger-report th:last-child,.ledger-report td:last-child{text-align:right;white-space:nowrap}.ledger-report-subtotal{font-weight:bold;background:#f7fafc}.ledger-report-total{text-align:right;font-size:18px;font-weight:bold}.ledger-report-id{font-size:11px;color:#65778a}
@media print{@page{size:A4;margin:16mm}body:has(#ledger-report)>:not(#ledger-report){display:none!important}body:has(#ledger-report){background:white!important}#ledger-report{display:block!important;position:static!important;width:auto!important;max-height:none!important;overflow:visible!important;border:0!important;padding:0!important;margin:0!important}#ledger-report .ledger-report-controls{display:none!important}#ledger-report::backdrop{display:none}#ledger-report tr{break-inside:avoid}#ledger-report thead{display:table-header-group}#ledger-report .ledger-report-sheet{font-size:11px}#ledger-report .ledger-report-total{break-inside:avoid}}

/* Phone layout: readable expense cards and touch-sized controls. */
@media screen and (max-width:600px){
 body:has(#expenses-view:not([hidden])) main{padding:8px}
 .main-nav{gap:8px}.main-nav select{flex-basis:100%;width:100%;margin-right:0;min-height:44px}
 .main-nav button{min-height:44px;flex:1 0 auto}
 .ledger-content{padding:20px 12px}.ledger-heading{flex-wrap:wrap;gap:14px}.ledger-heading>.ledger-primary{width:100%;font-size:16px}
 .ledger button{min-height:44px}.ledger input:not([type=checkbox]),.ledger select{font-size:16px;max-width:100%}
 .ledger-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}.ledger-tabs button{padding:10px 4px;font-size:14px}
 .ledger-filters{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}
 .ledger-filters>input,.ledger-filters>select{grid-column:1/-1;width:100%;min-width:0}.ledger-filters>label{min-width:0}
 .ledger-selection{gap:10px}.ledger-selection>button{width:100%}.ledger-selection>label:has(input[type=date]){width:100%}
 .ledger-group>summary{gap:10px;flex-wrap:wrap}.ledger-group-name{min-width:0;overflow-wrap:anywhere}.ledger-folder{display:none}
 .ledger-entry{display:grid;grid-template-columns:24px minmax(0,1fr);gap:12px;padding:16px 12px}
 .ledger-entry>input[type=checkbox]{grid-column:1;grid-row:1;width:22px;height:22px;margin:0}
 .ledger-entry .ledger-date{grid-column:2;grid-row:1}.ledger-entry-body{grid-column:2;min-width:0}
 .ledger-entry>.ledger-amount{grid-column:2;margin:0;font-size:18px}
 .ledger-entry-status{grid-column:2;min-width:0;margin:0}.ledger-entry-actions{grid-column:2;display:flex;flex-wrap:wrap;min-width:0;margin:0}
 .ledger-entry-actions button{flex:1}.ledger-entry-actions .ledger-text-button{border:1px solid #ccdae7;background:#fff}
 .ledger-claim-info{flex-wrap:wrap;padding:12px}.ledger-footer{gap:12px}.ledger-footer>div{display:flex;flex-wrap:wrap;gap:8px}.ledger-footer button{margin:0;font-size:14px}
 #editor,.ledger-report{width:calc(100% - 16px);max-width:calc(100% - 16px);padding:16px;max-height:90dvh;overflow:auto}
 #editor input,#editor select,#editor textarea,.ledger-report input{font-size:16px;min-width:0;max-width:100%}
 #editor .row{position:sticky;bottom:-16px;background:#eef1f6;padding:12px 0;margin-top:12px}#editor .row button{flex:1;min-height:44px}
 .ledger-report-controls>*{max-width:100%}.ledger-report-controls button{min-height:44px;flex:1}.ledger-report-sheet{overflow-x:auto}.ledger-report table{min-width:500px}
}
@media screen and (max-width:600px){
 .ledger-entry:not(:has(.ledger-date)){display:flex;flex-direction:column;align-items:stretch}
 .ledger-entry:not(:has(.ledger-date)) .ledger-entry-body{flex-basis:auto}
 #ledger-template-controls{grid-template-columns:minmax(0,1fr)}
 .ledger-tabs button{word-break:keep-all}
}
