/* GPS387 transport economics 0.9.10A — coherent with existing light/dark brand palette */
#teModal{z-index:95;align-items:center;overflow:auto;padding:17px}
.te-dialog{width:min(990px,98vw);max-height:calc(100dvh - 34px);overflow:auto;scrollbar-width:thin;background:var(--paper);color:var(--ink);border:1px solid var(--border);border-radius:17px;box-shadow:0 25px 75px #08111d55}
.te-dialog>header{display:flex;justify-content:space-between;gap:15px;align-items:flex-start;padding:27px 31px 22px;border-bottom:1px solid var(--border)}
.te-dialog h2{font-size:25px;font-weight:750;margin:7px 0 10px;line-height:1.28}
.te-dialog header p{font-size:14px;line-height:1.65;color:var(--muted);margin:0}
.te-dialog>header button{min-height:39px;padding:8px 12px}
.te-body{padding:26px 31px 28px;display:grid;gap:22px}
.te-reference{font-size:14px;color:var(--ink2);font-weight:700;display:flex;align-items:center;gap:11px}
.te-reference svg{height:20px;width:20px;color:var(--primary)}
.te-section{border:1px solid var(--border);padding:21px 23px;border-radius:12px;background:var(--paper)}
.te-section h3{font-size:17px;color:var(--ink);font-weight:750;margin:0 0 18px}
.te-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.te-field{display:grid;gap:8px;min-width:0}
.te-field span{font-size:13px;font-weight:650;color:var(--ink2);line-height:1.55}
.te-field input{width:100%;min-width:0;min-height:45px;border:1px solid var(--border);border-radius:9px;padding:10px 13px;background:var(--paper-soft);color:var(--ink);font:inherit;font-size:14px}
.te-field input:focus-visible,.te-dialog button:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.te-summary{padding:23px;border:1px solid var(--border);background:var(--paper-soft);border-radius:12px}
.te-summary h4{font-size:17px;margin:0 0 16px}
.te-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.te-metrics>div{background:var(--paper);border-radius:10px;padding:17px 12px;border:1px solid var(--border);display:grid;gap:10px;min-width:0}
.te-metrics span{font-size:12px;color:var(--muted);line-height:1.55}
.te-metrics strong{font-size:17px;color:var(--ink);overflow-wrap:anywhere}
.te-state{display:flex;align-items:center;gap:9px;font-size:13px;margin:18px 0;line-height:1.6}
.te-state svg{width:18px;height:18px;color:var(--primary)}
.te-details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.te-details>div{font-size:13px;display:flex;justify-content:space-between;gap:15px;padding:9px 0;border-bottom:1px solid var(--border)}
.te-details strong{color:var(--ink)}
.te-notice,.te-rate-panel p{font-size:13px;line-height:1.75;color:var(--muted);margin:0}
.te-rate-panel{border:1px solid var(--border);border-radius:11px;padding:19px 22px}
.te-rate-panel summary{cursor:pointer;font-size:15px;font-weight:750;display:flex;align-items:center;gap:10px;margin:0}
.te-rate-panel summary svg{width:19px;height:19px;color:var(--primary)}
.te-rate-panel p{margin:15px 0}
.te-rate-panel .te-fields{margin:18px 0}
.te-rate-actions{display:flex;flex-wrap:wrap;gap:11px}
.te-rate-status,.te-error{font-size:13px;min-height:16px}
.te-error.error{color:#b44}
.te-body footer{display:flex;justify-content:flex-end;gap:13px;position:sticky;bottom:-28px;padding:17px 0;background:var(--paper);border-top:1px solid var(--border)}
.te-body footer button{min-height:44px;font-size:14px;padding:10px 16px}
@media(max-width:850px){.te-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.te-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:580px){#teModal{padding:5px}.te-dialog{max-height:calc(100dvh - 10px);border-radius:12px}.te-dialog>header{padding:18px}.te-dialog h2{font-size:21px}.te-body{padding:15px}.te-section{padding:14px}.te-fields{grid-template-columns:1fr}.te-metrics{grid-template-columns:1fr 1fr}.te-details{grid-template-columns:1fr}.te-body footer{bottom:-15px}}

/* GPS387 v0.9.12 — expandable full-cost inputs and separate operating contribution. */
.te-full-panel{border:1px solid var(--border);background:var(--paper);border-radius:12px;padding:21px 23px;min-width:0}
.te-full-panel summary{display:flex;align-items:center;gap:10px;cursor:pointer;font-size:17px;font-weight:750;color:var(--ink)}
.te-full-panel summary svg{width:20px;height:20px;color:var(--primary)}
.te-full-panel>p{font-size:13px;line-height:1.7;color:var(--muted);margin:14px 0 18px;max-width:750px}
.te-full-panel .te-fields{grid-template-columns:repeat(3,minmax(0,1fr))}
#teFullResult{background:var(--paper);border:1px solid var(--border);padding:22px}
#teFullResult .te-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}
#teFullResult .te-notice{margin-top:11px}
@media(max-width:850px){.te-full-panel .te-fields{grid-template-columns:repeat(2,minmax(0,1fr))}#teFullResult .te-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:580px){.te-full-panel{padding:14px}.te-full-panel .te-fields{grid-template-columns:1fr}#teFullResult{padding:15px}#teFullResult .te-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v0.9.13A — qualified source suggestions live inside Transport Economics dialog. */
.te-freight-section{border:1px solid var(--border);padding:21px 23px;border-radius:12px;background:var(--paper);display:grid;gap:14px}
.te-freight-section>header h3{font-size:17px;color:var(--ink);display:flex;align-items:center;gap:10px;font-weight:750;margin:0 0 7px}
.te-freight-section>header svg{width:19px;height:19px;color:var(--primary)}
.te-freight-section>header p{font-size:13px;line-height:1.7;color:var(--muted);margin:0}
.te-freight-metadata{display:flex;gap:13px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.te-freight-metadata strong{color:var(--ink)}
.te-freight-proposals{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.te-freight-item{border:1px solid var(--border);border-radius:10px;background:var(--paper-soft);padding:17px;display:grid;gap:6px;line-height:1.55}
.te-freight-item>span{font-size:12px;color:var(--muted)}
.te-freight-item>strong{font-size:19px;font-weight:750;color:var(--ink)}
.te-freight-item>small{font-size:12px;color:var(--muted)}
.te-freight-warnings{font-size:12px;color:var(--muted);line-height:1.7}
.te-freight-warnings>p{display:flex;gap:8px;margin:4px 0}
.te-freight-warnings svg{width:16px;height:16px;flex:none;color:var(--primary);margin-top:2px}
.te-freight-message{font-size:12px;line-height:1.7;color:var(--muted);margin:0}
.te-freight-section .fleet-button{justify-self:start;min-height:42px;padding:10px 15px;font-size:13px}
@media(max-width:650px){.te-freight-section{padding:15px}.te-freight-proposals{grid-template-columns:1fr}}

/* v0.9.19A: explicit reset/restore controls with safe wrapping */
.te-body footer{display:flex;flex-wrap:wrap;gap:9px}

/* v0.9.21E: financial estimate remains separate from GNSS-observed partial mileage */
.te-gps-comparison{margin:16px 0;padding:16px 18px;border:1px solid var(--border);border-radius:12px;background:var(--paper)}
.te-gps-comparison h3{display:flex;align-items:center;gap:8px;font-size:15px;margin:0 0 12px}
.te-gps-comparison .te-gps-row{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:9px 0;border-top:1px solid var(--border);font-size:13px}
.te-gps-comparison .te-gps-row>span{color:var(--muted)}
.te-gps-comparison .te-gps-row strong{color:var(--ink)}
.te-gps-comparison p,.te-gps-comparison small{display:block;font-size:12px;line-height:1.6;color:var(--muted);margin:12px 0 0}

/* GPS387 v0.9.22C: confirmed manual financial journal - collapsible and clearly
   separate from planning estimates and GNSS-observed kilometres. */
.te-finance-panel{margin:16px 0}
.te-finance-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0}
.te-finance-metrics>div{padding:12px;border:1px solid var(--border,#ddd);border-radius:10px}
.te-finance-metrics span,.te-finance-metrics strong{display:block}
.te-finance-metrics span{color:var(--muted,#64748b);font-size:12px}
.te-finance-metrics strong{font-size:16px;margin-top:5px}
.te-finance-form{border:1px solid var(--border,#ddd);padding:14px;border-radius:10px;margin:15px 0}
.te-finance-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:12px}
.te-finance-fields label{display:flex;flex-direction:column;gap:5px;font-size:12px}
.te-finance-fields input,.te-finance-fields select{width:100%;min-width:0;padding:9px;border:1px solid var(--border,#ddd);border-radius:7px;background:var(--paper,#fff);color:inherit}
.te-finance-actions{display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin-top:12px}
.te-finance-row{display:grid;grid-template-columns:2fr 1.5fr auto;gap:12px;padding:12px 0;border-top:1px solid var(--border,#ddd);align-items:center}
.te-finance-row>div{min-width:0}.te-finance-row strong,.te-finance-row small,.te-finance-row span{display:block;overflow-wrap:anywhere}
.te-finance-row small,.te-finance-row span{font-size:12px;color:var(--muted,#64748b);margin-top:4px}
.te-finance-status.error{color:#a32121}
@media(max-width:900px){.te-finance-metrics{grid-template-columns:1fr}.te-finance-row{grid-template-columns:1fr}}

/* When actuals are expanded the sticky estimate footer must never cover finance buttons. */
.te-body:has(#teActualFinance[open])>footer{position:static;bottom:auto}

/* GPS387 v0.9.22D - small settlement interface inside existing Finance/Dispatch. */
.te-settlement-panel{margin:14px 0}
.te-settlement-create{padding:13px;border:1px solid var(--border,#ddd);border-radius:9px;margin:13px 0}
.te-settlement-create h4{margin:0 0 10px}
.te-settlement-create .te-finance-fields,.te-settlement-pay .te-finance-fields{margin:12px 0}
.te-settlement-panel label,.dispatch-finance-summary label{display:flex;flex-direction:column;gap:5px;font-size:12px}
.te-settlement-panel input,.te-settlement-panel select{width:100%;min-width:0;padding:9px;border:1px solid var(--border,#ddd);border-radius:7px;background:var(--paper,#fff);color:var(--ink,#333)}
.te-settlement-item{display:grid;grid-template-columns:minmax(0,2fr) minmax(120px,1fr) auto;gap:12px;padding:13px 0;border-top:1px solid var(--border,#ddd)}
.te-settlement-item>div strong,.te-settlement-item>div span,.te-settlement-item>div small{display:block;overflow-wrap:anywhere}
.te-settlement-item small,.te-settlement-item span{font-size:12px;color:var(--muted,#64748b);margin-top:4px}
.te-settlement-detail{grid-column:1/-1;border-radius:9px;background:var(--paper-soft);padding:12px;margin-top:8px}
.te-settlement-payment{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-top:1px solid var(--border,#ddd);font-size:12px}
.te-settlement-feedback{min-height:16px;font-size:12px;color:var(--danger,#a32121)}
.dispatch-finance-summary{margin:14px 0}.dispatch-finance-summary>.fleet-button{margin-top:12px}
@media(max-width:850px){.te-settlement-item{grid-template-columns:1fr}}

/* 0.9.22D grouped partner receivables and payables */
.te-settlement-partners{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin:12px 0}
.te-settlement-partners>div{display:grid;gap:5px;border:1px solid var(--border,#ddd);padding:12px;border-radius:10px}
.te-settlement-partners strong,.te-settlement-partners span{font-size:14px}
.te-settlement-partners small{color:var(--muted,#64748b);font-size:11px}

.te-settlement-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:1100px){.te-settlement-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.te-settlement-metrics{grid-template-columns:1fr}}
