*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
:root{color-scheme:light;--ink:#172c34;--muted:#556b73;--rule:#d9e4e7;--deep:#123840;--teal:#076756;--soft:#eaf4f0;--paper:#f2f6f7;--red:#922f29;font-family:"Segoe UI",system-ui,sans-serif;font-size:16px}
body{margin:0;background:var(--paper);color:var(--ink)}
button,input,select{font:inherit}
button{border:1px solid transparent;background:var(--teal);color:white;border-radius:8px;min-height:42px;padding:.58rem .95rem;font-weight:650;cursor:pointer;white-space:nowrap}
button:hover{background:#034f45} button:disabled{opacity:.48;cursor:default}
button.secondary{color:var(--deep);border-color:#ccdcdf;background:#fff}
button.secondary:hover{background:#eaf4f0}
button.light{color:white;border-color:#7c9ca1;background:transparent}
button.light:hover{background:#ffffff17}
:focus-visible{outline:3px solid #187e69;outline-offset:3px}
.top{min-height:68px;background:var(--deep);color:white;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.65rem clamp(1rem,5vw,4rem)}
.brand,#session{display:flex;align-items:center;gap:.85rem;font-weight:650}
.mark{display:grid;place-items:center;background:#d6f3e7;color:var(--deep);width:39px;height:39px;border-radius:10px;font-weight:750;letter-spacing:-.03em}
main{max-width:1470px;margin:auto;padding:2.35rem clamp(1rem,4.7vw,4rem) 3rem}
h1,h2,p{margin:0} h1{font-size:clamp(1.95rem,4vw,3.1rem);line-height:1.12;letter-spacing:-.045em} h2{font-size:1.28rem;letter-spacing:-.025em}
.page-header p,.detail-header p,.dialog-header p,.content>p,.login>p{color:var(--muted);margin-top:.55rem}
.tabs{display:flex;gap:.25rem;border-bottom:1px solid #c8d7d9;margin:1.65rem 0 1.15rem}
.tabs button{background:transparent;color:var(--muted);border-radius:7px 7px 0 0;border-bottom:3px solid transparent}
.tabs button[aria-current]{color:var(--teal);border-bottom-color:var(--teal);background:#e6f2ed}
.panel{overflow:hidden;background:#fff;border:1px solid var(--rule);border-radius:14px;box-shadow:0 8px 26px #132d3407}
.content{padding:1.25rem;margin-top:1rem}
.filters{display:flex;flex-wrap:wrap;gap:.85rem;align-items:end;padding:1.15rem;border-bottom:1px solid var(--rule)}
label{display:grid;gap:.4rem;font-size:.9rem;font-weight:650}
input:not([type=checkbox]),select{min-height:42px;width:100%;border:1px solid #bdced2;border-radius:8px;background:white;color:var(--ink);padding:.5rem .7rem}
.search-field{flex:1 1 220px}.arrears-filter{max-width:142px}
.list-header,.pagination{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.15rem}
.list-header span,.pagination span{color:var(--muted)}
.pagination{justify-content:flex-end;border-top:1px solid var(--rule);flex-wrap:wrap}
.table-scroll{overflow:auto} table{width:100%;border-collapse:collapse;font-size:.95rem}
th,td{padding:.82rem 1rem;text-align:left;border-bottom:1px solid #ebf0f1;vertical-align:top}
th{background:#edf4f4;color:#375259;font-size:.86rem;font-weight:700;white-space:nowrap}
tr:last-child td{border-bottom:0}
tbody tr:hover{background:#f7fbf9}
.number{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.mono{font-variant-numeric:tabular-nums;white-space:nowrap}
.negative,.error{color:var(--red)}
.error{line-height:1.45;margin:.6rem 0}
.link{font:inherit;font-weight:700;padding:0;min-height:0;white-space:normal;text-align:left;color:var(--teal);background:transparent;border:0;border-radius:2px}
.link:hover{text-decoration:underline;background:transparent}
.login{max-width:430px;margin:6vh auto;padding:1.6rem}
.login h1{font-size:1.95rem}.login form{display:grid;gap:1rem;margin-top:1.25rem}
.detail-header,.dialog-header{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;flex-wrap:wrap}
.metrics,.facts,.import-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,205px),1fr));gap:.8rem;margin:1.15rem 0}
.metric,.import-card{background:#f1f7f5;border:1px solid var(--rule);border-radius:10px;padding:.82rem}
.metric span,dt{display:block;color:var(--muted);font-size:.86rem;margin-bottom:.35rem}
.metric strong{font-size:1.25rem;font-variant-numeric:tabular-nums}
dd{margin:0;overflow-wrap:anywhere}
#detail-view h2{margin-bottom:.6rem}.purpose{min-width:12rem;max-width:48rem;overflow-wrap:anywhere}
.import-card form{display:grid;gap:.65rem}.import-card p{color:var(--muted);margin:.6rem 0;min-height:2.6em}
dialog{width:min(680px,calc(100% - 2rem));max-height:calc(100% - 2rem);border:1px solid var(--rule);border-radius:16px;padding:1.3rem;color:var(--ink);box-shadow:0 25px 90px #112c3c56}
dialog::backdrop{background:#0b222b80}.hint,#template-status{background:var(--soft);border-radius:8px;padding:.75rem;margin:1rem 0;line-height:1.5}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:.85rem}.wide{grid-column:1/-1}
.checkbox{margin:1rem 0}.checkbox label{display:flex;align-items:baseline;font-weight:500;gap:.55rem}
@media(max-width:600px){.form-grid{grid-template-columns:1fr}.top #user{display:none}.filters>label{max-width:none;flex:1 1 100%}.tabs button{padding-inline:.55rem}}
