.borrow-ledger-page{background:#f4f7fb;overflow:hidden}.ledger-shell{height:100dvh;display:flex;flex-direction:column;max-width:1600px;margin:auto;padding:24px 32px 0;gap:20px}.ledger-header{display:flex;align-items:center;gap:14px;flex-shrink:0}.ledger-header img{width:48px;height:48px;object-fit:contain}.ledger-header h1{font-size:27px;letter-spacing:0}.ledger-header p{color:var(--muted);font-size:13px;margin-top:4px}.ledger-header .mode{margin-left:auto}.ledger-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;flex-shrink:0}.ledger-toolbar .search{flex:1;min-width:220px;background:white;border:1px solid var(--line);border-radius:12px;min-height:48px}.ledger-toolbar select{min-height:48px;border:1px solid var(--line);border-radius:10px;padding:8px 12px;background:white}.ledger-table-wrap{flex:1;min-height:0;overflow:auto;border:1px solid var(--line);border-radius:16px;background:white;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}.ledger-table{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;font-size:14px}.ledger-table th{position:sticky;top:0;background:#f8faff;z-index:1;text-align:left;color:#5f718a;font-size:13px;padding:16px;border-bottom:1px solid var(--line)}.ledger-table td{padding:18px 16px;vertical-align:top;border-bottom:1px solid var(--line);overflow-wrap:anywhere;line-height:1.65}.ledger-table th:nth-child(1){width:13%}.ledger-table th:nth-child(2){width:34%}.ledger-table th:nth-child(3){width:15%}.ledger-table th:nth-child(4){width:18%}.ledger-table th:nth-child(5){width:20%}.ledger-table td small{display:block;font-size:12px;color:var(--muted);margin-top:3px}.ledger-item{display:block;min-height:44px;text-align:left;padding:0;justify-content:flex-start;font-weight:600;color:#20334e}.ledger-table .badge{margin-top:8px;font-size:11px}.ledger-table .secondary{margin-top:10px;padding:8px 12px;font-size:12px;min-height:44px}.ledger-count{font-size:12px;color:var(--muted);padding:2px 0;flex-shrink:0}.ledger-bottom{display:flex;justify-content:center;gap:12px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:#ffffffeb;border-top:1px solid var(--line);flex-shrink:0}.ledger-bottom button{flex:1;max-width:240px;flex-direction:column;gap:4px;color:#62738a;font-size:12px;min-height:56px}.ledger-bottom .selected{background:#eaf3ff;color:var(--blue)}.ledger-dialog{width:min(900px,calc(100vw - 24px));max-height:calc(100dvh - 24px)}.ledger-dialog[open]{display:flex;flex-direction:column;overflow:hidden}.ledger-dialog .sheet-header{flex-shrink:0}.ledger-dialog .sheet-body{overflow:auto;min-height:0;overscroll-behavior:contain}.loan-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px}.loan-form-grid section{min-width:0;display:flex;flex-direction:column;gap:14px}.loan-form-grid h3{font-size:16px;margin-bottom:2px}.loan-line{padding:14px;background:#f6f9fd;border:1px solid var(--line);border-radius:12px;display:flex;flex-direction:column;gap:12px}.loan-line .text-button{align-self:flex-end}.loan-line label,.loan-form-grid label{font-size:13px}.loan-line .line-availability{font-size:12px;color:var(--muted)}.loan-form-grid input,.loan-form-grid select,.loan-form-grid textarea{width:100%;min-width:0}.loan-form-tabs{display:none}.ledger-review-summary{margin:0 0 16px}.ledger-review-summary h3{margin-bottom:6px}.ledger-review-summary p{color:var(--muted);font-size:13px;line-height:1.7}.ledger-dialog .signature-pair{margin-top:18px}.ledger-dialog .sheet-footer{flex-shrink:0}.ledger-return-status{font-size:12px;color:var(--muted)}
@media(max-width:900px){.ledger-shell{padding:16px 18px 0;gap:14px}.ledger-header h1{font-size:23px}.ledger-table{font-size:13px}.ledger-table th,.ledger-table td{padding:13px 10px}.ledger-table th{font-size:12px}.ledger-table th:nth-child(1){width:12%}.ledger-table th:nth-child(2){width:29%}.ledger-table th:nth-child(3){width:16%}.ledger-table th:nth-child(4){width:20%}.ledger-table th:nth-child(5){width:23%}.ledger-table .badge{white-space:normal}.ledger-toolbar .secondary{padding:10px}.ledger-bottom{margin-inline:-18px}.ledger-header img{width:40px;height:40px}}
@media(max-width:620px){.ledger-shell{padding:12px 12px 0;gap:12px}.ledger-header{gap:10px}.ledger-header h1{font-size:20px}.ledger-header p{font-size:12px}.ledger-header img{width:36px;height:36px}.ledger-header .mode{font-size:10px;padding:5px}.ledger-toolbar{gap:8px}.ledger-toolbar .search{min-width:0;flex-basis:calc(100% - 52px)}.ledger-toolbar select{flex:1;font-size:13px}.ledger-toolbar .primary{flex:1;padding:10px}.ledger-toolbar [data-action="export"]{font-size:12px}.ledger-table thead{display:none}.ledger-table,.ledger-table tbody,.ledger-table tr{display:block}.ledger-table tr{padding:14px;border-bottom:1px solid var(--line);display:grid;grid-template-columns:1fr 1fr;gap:10px 12px}.ledger-table td{display:block;padding:0;border:0;font-size:14px}.ledger-table td::before{content:attr(data-label);display:block;font-size:12px;color:var(--muted);margin-bottom:3px}.ledger-table td:nth-child(1){grid-column:1/-1;display:flex;justify-content:space-between}.ledger-table td:nth-child(2),.ledger-table td:nth-child(5){grid-column:1/-1}.ledger-item{min-height:44px}.ledger-table td small{font-size:12px}.ledger-table td:nth-child(5){padding-top:8px;border-top:1px solid var(--line)}.ledger-table td:nth-child(5) .secondary{float:right;margin-top:0}.ledger-bottom{margin-inline:-12px;gap:8px}.loan-form-grid{display:block}.loan-form-grid section{display:none}.loan-form-grid section.active{display:flex}.loan-form-tabs{display:flex;gap:8px;margin-bottom:18px}.loan-form-tabs button{flex:1;font-size:13px;min-height:44px;background:#eef3f9}.loan-form-tabs .selected{color:var(--blue);background:#eaf3ff}.ledger-dialog{max-height:calc(100dvh - 16px);width:calc(100vw - 16px)}.ledger-dialog .sheet-body{padding:16px}.ledger-review-summary{font-size:13px}}

.ledger-admin{height:100%;max-width:none;padding:0;gap:12px;min-height:0}.ledger-admin .ledger-header .mode{display:none}.ledger-admin .ledger-header h1{font-size:25px}.ledger-admin .ledger-table-wrap{min-height:0}.ledger-dialog .signature-pair:has(>section:only-child){grid-template-columns:1fr}.ledger-dialog .signature-wrap{max-width:600px}.ledger-dialog .signed-evidence>img{height:160px}.ledger-admin .ledger-table th{padding-top:12px;padding-bottom:12px}
.ledger-admin-page{overflow:hidden}.ledger-admin-page .app-shell{height:100dvh;overflow:hidden}.ledger-admin-page .main{height:100%;display:flex;flex-direction:column;overflow:hidden}.ledger-admin-page .topbar{flex-shrink:0}.ledger-admin-page .page-content{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;width:100%}
.status-pending{--status-ink:#8a5000;--status-fill:#fff0cc;--status-edge:#e4a315;--status-row:#fffcf4}.status-loaned{--status-ink:#a5232b;--status-fill:#ffe3e5;--status-edge:#d64750;--status-row:#fff7f8}.status-return-signed{--status-ink:#963c0c;--status-fill:#ffe4ce;--status-edge:#d67528;--status-row:#fff8f0}.status-returned{--status-ink:#176441;--status-fill:#d9f2e5;--status-edge:#32946c;--status-row:#f5fcf8}.status-consumed{--status-ink:#4e5c70;--status-fill:#e8edf3;--status-edge:#8190a5;--status-row:#fbfcfe}.ledger-status{background:var(--status-fill)!important;color:var(--status-ink)!important;border:1px solid var(--status-edge);font-weight:600;font-size:12px!important;line-height:1.6}.ledger-status-legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:12px;color:#52657d;flex-shrink:0}.ledger-status-legend span{display:inline-flex;align-items:center;gap:6px}.ledger-status-legend i{width:9px;height:9px;background:var(--status-edge);border-radius:3px;flex-shrink:0}
@media(max-width:620px){.ledger-status-legend{font-size:11px;gap:5px 12px}}
.ledger-table th:nth-child(1),.ledger-table th:nth-child(3),.ledger-table td:nth-child(1),.ledger-table td:nth-child(3){white-space:nowrap}.ledger-table td:nth-child(3){overflow:hidden;text-overflow:ellipsis}
@media(min-width:621px){.ledger-table th:nth-child(1){width:100px}.ledger-table th:nth-child(2){width:auto}.ledger-table td:nth-child(1){padding-inline:10px}}

.ledger-card-wrap{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:2px 2px 14px}.ledger-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}.ledger-card{min-width:0;background:white;border:1px solid var(--line);border-radius:16px;box-shadow:0 3px 12px #20334e06;padding:18px;display:flex;flex-direction:column;gap:14px}.ledger-card-top{display:flex;align-items:center;justify-content:space-between;gap:12px}.ledger-card-top .ledger-status{margin:0;font-size:12px;white-space:normal}.ledger-card-date{white-space:nowrap;color:var(--muted);font-size:12px;flex-shrink:0}.ledger-card-item h2{font-size:18px;line-height:1.5;margin:0 0 4px;overflow-wrap:anywhere}.ledger-card-item p{font-size:12px;color:var(--muted);line-height:1.6;margin-top:3px;overflow-wrap:anywhere}.ledger-card-item .ledger-card-due{color:#52657d}.ledger-card-people{display:grid;grid-template-columns:1fr 1fr;gap:12px 16px;border-top:1px solid var(--line);padding-top:14px;margin:0}.ledger-card-people>div{min-width:0}.ledger-card-people dt{font-size:12px;color:var(--muted);margin-bottom:3px}.ledger-card-people dd{font-size:14px;line-height:1.6;margin:0;overflow-wrap:anywhere}.ledger-card-people small{display:block;font-size:12px;color:var(--muted)}.ledger-card-department{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ledger-card-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--line);padding-top:12px;margin-top:auto}.ledger-card-footer button{min-height:44px;padding:8px 12px;font-size:13px}.ledger-card-footer .text-button{padding-inline:0}.ledger-card-footer small{font-size:12px;color:var(--status-ink);max-width:60%;text-align:right}
@media(min-width:1300px){.ledger-cards{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:759px){.ledger-cards{grid-template-columns:1fr;gap:12px}.ledger-card{padding:16px;gap:12px}.ledger-card-item h2{font-size:17px}}
@media(max-width:360px){.ledger-card-top{gap:8px}.ledger-card{padding:12px}.ledger-card-people{gap:10px}.ledger-card-footer{gap:8px}.ledger-card-footer button{font-size:12px}}

.ledger-name-confirm{display:flex;flex-direction:column;gap:8px;margin-top:20px;font-weight:600}.ledger-name-confirm input{width:100%;min-height:48px;font-size:16px}.typed-evidence strong{display:block;font-size:18px;margin:14px 0 8px}.typed-evidence p,.typed-evidence time{display:block;color:var(--muted);font-size:13px;line-height:1.7}

/* การ์ดแนวนอนหนึ่งคอลัมน์ พร้อมแถบสีสถานะทุกขนาดจอ */
.ledger-cards{grid-template-columns:minmax(0,1fr)}.ledger-card{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:14px 20px;border-left:5px solid var(--status-edge)}.ledger-card-top,.ledger-card-footer{grid-column:1/-1}.ledger-card-item{grid-column:1;align-self:start}.ledger-card-people{grid-column:2;border-top:0;border-left:1px solid var(--line);padding:0 0 0 20px;align-self:start}.ledger-card-footer{margin-top:0}
@media(max-width:620px){.ledger-card{gap:12px;padding:14px}.ledger-card-people{grid-template-columns:minmax(0,1fr);gap:10px;padding-left:12px}.ledger-card-item h2{font-size:15px}.ledger-card-people dd{font-size:13px}.ledger-card-item p{font-size:12px}}
@media(max-width:360px){.ledger-card{padding:12px;gap:12px 10px}.ledger-card-people{padding-left:10px}.ledger-card-top .ledger-status{font-size:11px!important}.ledger-card-date{font-size:11px}}

.ledger-return-evidence{border-top:1px solid var(--line);margin-top:20px;padding-top:16px}.ledger-return-evidence>h3{font-size:15px;margin-bottom:12px}

.tracking-admin-page{overflow:hidden}.tracking-admin-page .app-shell{height:100dvh;overflow:hidden}.tracking-admin-page .main{height:100%;display:flex;flex-direction:column;overflow:hidden}.tracking-admin-page .topbar,.tracking-admin-page .page-heading{flex-shrink:0}.tracking-admin-page .page-content{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;width:100%}
.tracking-surface{display:flex;flex-direction:column;gap:16px;flex:1;min-height:0;overflow:hidden}.tracking-surface>.search{flex:none;min-height:48px}.tracking-surface .ledger-card-wrap{padding-bottom:2px}
.ledger-admin{width:100%;margin:0}
/* แต่ละหมวดเต็มแถว และช่องกรอกสองฝั่งกว้างเท่ากัน */
@media(min-width:621px){
 .loan-form-grid{grid-template-columns:minmax(0,1fr);gap:24px}
 .loan-form-grid section{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 20px;align-content:start}
 .loan-form-grid section>:is(h3,p,#loan-lines,button){grid-column:1/-1}
 .loan-form-grid :is(label,.choice-control){min-width:0;margin-bottom:0}
 .loan-line{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 20px}
 .loan-line .line-fields{display:contents}
 .loan-line :is(.line-availability,.setup-note,button[data-action="record-configure-item"]){grid-column:1/-1}
 .loan-line>button{grid-column:1/-1;justify-self:end}
 #loan-lines{display:grid;gap:14px}
}
@media(max-width:620px){.loan-form-grid .line-fields{display:flex;flex-direction:column;gap:14px}.loan-form-grid :is(label,.choice-control){margin-bottom:0}#loan-lines{display:grid;gap:14px}}
@media(min-width:621px){.loan-line{padding:16px 0;border-width:1px 0;border-radius:0;background:transparent}}
@media(max-width:620px){.loan-line{padding:16px 0;border-width:1px 0;border-radius:0;background:transparent}}
/* ฟอร์มต่อเนื่องตามลำดับการกรอก ไม่สลับซ่อนช่องบนมือถือ */
#ledger-loan-form .loan-form-tabs{display:none}
#ledger-loan-form .loan-form-grid{gap:16px}
#ledger-loan-form .loan-form-grid section{gap:16px}
#ledger-loan-form .loan-form-grid h3{margin:0;font-size:15px}
#ledger-loan-form .loan-line{gap:12px;padding-block:12px}
#ledger-loan-form .line-availability{align-self:center;margin:0}
#ledger-loan-form .sheet-footer{position:sticky;bottom:-24px;background:white;padding:12px 0 calc(12px + env(safe-area-inset-bottom));margin-top:16px;z-index:2}
#ledger-loan-form :is(input,select,textarea){font-size:16px;min-height:48px}
#ledger-loan-form button{min-height:44px}
#ledger-loan-form button:active{filter:brightness(.94)}
@media(min-width:621px){#ledger-loan-form .line-availability{grid-column:1}#ledger-loan-form .loan-line>button{grid-column:2;align-self:center}#ledger-loan-form .loan-line>label:has(.item-search){align-self:start}}
@media(max-width:620px){
 #ledger-loan-form .loan-form-grid section,#ledger-loan-form .loan-form-grid section.active{display:flex;flex-direction:column}
 #sheet:has(#ledger-loan-form){width:100%;height:100dvh;max-height:100dvh;margin:0;border-radius:0}
 #sheet:has(#ledger-loan-form) .sheet-header{padding-top:max(12px,env(safe-area-inset-top))}
 #ledger-loan-form .sheet-footer{bottom:-18px}
}
@media(min-width:621px){#ledger-loan-form .loan-line{column-gap:16px}}

/* ปุ่มและเนื้อหามีระยะจากขอบสม่ำเสมอ ไม่เบียดขอบซ้ายหรือขวา */
.ledger-card{padding:16px;gap:16px}.ledger-card-footer{gap:12px;padding-top:16px}.ledger-toolbar{gap:12px}.ledger-dialog .sheet-footer{bottom:0;padding:16px 0 calc(16px + env(safe-area-inset-bottom));gap:8px}.ledger-dialog .sheet-body{padding:24px}.ledger-dialog .sheet-header{padding:16px 24px}.ledger-dialog .sheet-header .icon-button{min-width:44px;min-height:44px}
@media(max-width:900px){.ledger-shell{padding-inline:max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right))}.ledger-bottom{margin-inline:-16px}}
@media(max-width:620px){.ledger-card{padding:16px;gap:12px}.ledger-card-footer{gap:8px;padding-top:12px}.ledger-toolbar{gap:8px}.ledger-dialog .sheet-body{padding:16px}.ledger-dialog .sheet-header{padding:12px 16px}.ledger-dialog .sheet-footer{padding-block:16px calc(16px + env(safe-area-inset-bottom))}.ledger-bottom{gap:8px}}
@media(max-width:360px){.ledger-card{padding:12px;gap:12px}}
#ledger-loan-form .sheet-footer{bottom:0;padding:16px 0 calc(16px + env(safe-area-inset-bottom))}.ledger-dialog{margin-inline:auto;max-width:calc(100vw - 32px)}
.borrow-ledger-page .ledger-shell{height:calc(100dvh - var(--write-status-height,0px))}
