/* TOWI Admin 5.0 — enterprise control center, mobile/desktop responsive */
:root{
  --a5-navy:#07182b;--a5-navy2:#102943;--a5-green:#0b936b;--a5-green2:#08775a;
  --a5-bg:#f3f7fb;--a5-card:#fff;--a5-line:#d7e2ec;--a5-text:#0d1b2f;--a5-muted:#6d7d94;
  --a5-warn:#9a6a00;--a5-warn-bg:#fff8df;--a5-bad:#9a2424;--a5-bad-bg:#fff0f0;--a5-ok:#087657;--a5-ok-bg:#e8f7f1;
  --a5-info:#1768ac;--a5-info-bg:#edf6ff;--a5-r:18px;--a5-shadow:0 6px 22px rgba(12,33,58,.06)
}
body.admin{background:var(--a5-bg);color:var(--a5-text)}
body.admin .admin-content{padding-bottom:110px}
body.admin .admin-section{max-width:1500px;margin:0 auto}
body.admin .section-title{margin-bottom:16px;gap:14px;align-items:flex-end}
body.admin .section-title h1{font-size:clamp(30px,4vw,46px);line-height:1.02;letter-spacing:-.025em;margin:0 0 7px}
body.admin .section-title p{font-size:16px;line-height:1.45;margin:0;color:var(--a5-muted);max-width:760px}
body.admin .panel{border-radius:var(--a5-r);border:1px solid var(--a5-line);box-shadow:var(--a5-shadow);background:#fff}
body.admin .btn{border-radius:12px;min-height:44px;font-weight:850}
body.admin .btn.primary{background:var(--a5-green);border-color:var(--a5-green);color:#fff}
body.admin .btn.primary:hover{background:var(--a5-green2)}
body.admin input,body.admin select,body.admin textarea{font-size:16px}

/* Admin 5 shared */
.a5-root{display:grid;gap:14px;padding-bottom:8px}
.a5-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-end}
.a5-head h2{font-size:26px;margin:2px 0 5px;letter-spacing:-.02em}.a5-head p{margin:0;color:var(--a5-muted);line-height:1.45}
.a5-kicker{font-size:12px;font-weight:950;letter-spacing:1.7px;color:var(--a5-green)}
.a5-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.a5-toolbar input,.a5-toolbar select{min-height:44px;border:1px solid var(--a5-line);border-radius:12px;background:#fff;padding:9px 12px;color:var(--a5-text)}
.a5-toolbar .a5-search{min-width:min(360px,100%);flex:1}
.a5-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.a5-metric{border:1px solid var(--a5-line);background:#fff;border-radius:14px;padding:12px 14px;text-align:left;min-width:0;box-shadow:none}.a5-metric small{display:block;color:var(--a5-muted);font-weight:800;font-size:12px;margin-bottom:2px}.a5-metric b{display:block;font-size:22px;line-height:1.15;letter-spacing:-.02em;overflow-wrap:anywhere}.a5-metric span{display:block;color:var(--a5-info);font-size:12px;font-weight:850;margin-top:5px}.a5-metric.warn{background:var(--a5-warn-bg);border-color:#efd273}.a5-metric.bad{background:var(--a5-bad-bg);border-color:#efb2b2}.a5-metric.ok{background:var(--a5-ok-bg);border-color:#bfe1d4}.a5-metric.info{background:var(--a5-info-bg);border-color:#c4dff3}
.a5-note{padding:12px 14px;border:1px solid var(--a5-line);border-radius:14px;background:#f8fafc;line-height:1.45}.a5-note b{color:var(--a5-text)}.a5-note.warn{background:var(--a5-warn-bg);border-color:#efd273}.a5-note.bad{background:var(--a5-bad-bg);border-color:#efb2b2}.a5-note.ok{background:var(--a5-ok-bg);border-color:#bfe1d4}
.a5-list{display:grid;gap:8px}.a5-row{border:1px solid var(--a5-line);background:#fff;border-radius:15px;overflow:hidden;box-shadow:none}.a5-row.has-issue{border-color:#e9aaaa}.a5-row-main{display:grid;grid-template-columns:minmax(150px,1.5fr) minmax(120px,1fr) minmax(120px,.9fr) minmax(110px,.8fr) auto;gap:12px;align-items:center;padding:12px 14px;cursor:pointer}.a5-cell{min-width:0}.a5-cell small{display:block;color:var(--a5-muted);font-size:11px;font-weight:800;margin-bottom:2px}.a5-cell b,.a5-cell span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.a5-cell b{font-size:15px}.a5-cell.money{text-align:right}.a5-cell.money b{font-size:17px}.a5-chevron{width:34px;height:34px;border:1px solid var(--a5-line);border-radius:10px;display:grid;place-items:center;background:#fff;font-size:18px;color:#4c6078}.a5-row.open .a5-chevron{transform:rotate(180deg)}
.a5-row-details{display:none;border-top:1px solid var(--a5-line);padding:14px;background:#fbfcfe}.a5-row.open .a5-row-details{display:grid;gap:12px}.a5-detail-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.a5-detail{background:#fff;border:1px solid #e5ebf1;border-radius:12px;padding:10px}.a5-detail small{display:block;color:var(--a5-muted);font-weight:800;font-size:11px}.a5-detail b{display:block;margin-top:2px;overflow-wrap:anywhere}.a5-actions{display:flex;gap:8px;flex-wrap:wrap}.a5-actions .btn{min-height:42px}.a5-actions .btn.danger{background:#a52929;color:#fff;border-color:#a52929}.a5-actions .btn.success{background:var(--a5-green);color:#fff;border-color:var(--a5-green)}
.a5-status{display:inline-flex!important;width:max-content;max-width:100%;align-items:center;border-radius:999px;padding:5px 9px;font-size:11px!important;font-weight:950!important;line-height:1.2;white-space:normal!important}.a5-status.ok{background:var(--a5-ok-bg);color:var(--a5-ok)}.a5-status.warn{background:#fff0bd;color:#805900}.a5-status.bad{background:#ffe0e0;color:#962323}.a5-status.info{background:#e7f2ff;color:#1768ac}.a5-status.muted{background:#edf1f5;color:#5e6c7f}
.a5-empty{padding:30px 18px;text-align:center;color:var(--a5-muted);border:1px dashed #c9d6e3;border-radius:15px;background:#f9fbfd}.a5-toast{position:fixed;left:50%;bottom:96px;transform:translate(-50%,14px);opacity:0;z-index:100000;background:#083d31;color:#fff;border-radius:13px;padding:12px 16px;box-shadow:0 10px 30px rgba(0,0,0,.2);font-weight:850;max-width:min(620px,90vw);pointer-events:none;transition:.18s}.a5-toast.show{opacity:1;transform:translate(-50%,0)}.a5-toast.bad{background:#922929}
.a5-modal-backdrop{position:fixed;inset:0;z-index:99999;background:rgba(4,14,27,.58);display:grid;place-items:center;padding:18px}.a5-modal{width:min(820px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:22px;box-shadow:0 28px 90px rgba(0,0,0,.3)}.a5-modal-head{position:sticky;top:0;z-index:2;background:var(--a5-navy);color:#fff;padding:18px 20px;display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.a5-modal-head h2{margin:3px 0 0;font-size:24px}.a5-modal-head p{margin:4px 0 0;color:#b9c5d4}.a5-close{width:42px;height:42px;border:0;border-radius:12px;background:#18324f;color:#fff;font-size:25px}.a5-modal-body{padding:18px;display:grid;gap:14px}.a5-modal-body label{display:grid;gap:5px;font-weight:800;color:#3a4b62}.a5-modal-body input,.a5-modal-body select,.a5-modal-body textarea{width:100%;min-height:46px;border:1px solid #cad7e4;border-radius:12px;padding:10px 12px;background:#fff}.a5-modal-body textarea{min-height:96px;resize:vertical}.a5-modal-foot{display:flex;gap:8px;flex-wrap:wrap;padding:0 18px 18px}.a5-modal-foot .btn{flex:1 1 150px}
.a5-queue{display:grid;gap:8px}.a5-issue{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center;padding:12px 14px;border:1px solid #efb4b4;border-radius:14px;background:#fff5f5}.a5-issue h4{margin:0 0 3px}.a5-issue p{margin:0;color:#7f3838}.a5-issue-actions{display:flex;gap:7px}
.a5-tabs{display:flex;gap:7px;overflow:auto;padding-bottom:2px}.a5-tabs button{white-space:nowrap;border:1px solid var(--a5-line);background:#fff;border-radius:999px;min-height:40px;padding:8px 14px;font-weight:900}.a5-tabs button.active{background:var(--a5-navy);color:#fff;border-color:var(--a5-navy)}
.a5-two{display:grid;grid-template-columns:1fr 1fr;gap:12px}.a5-card{border:1px solid var(--a5-line);background:#fff;border-radius:16px;padding:14px;box-shadow:none}.a5-card h3{margin:2px 0 6px;font-size:18px}.a5-card p{margin:0;color:var(--a5-muted);line-height:1.45}.a5-card .a5-actions{margin-top:12px}
.a5-table-wrap{overflow:auto;border:1px solid var(--a5-line);border-radius:14px;background:#fff}.a5-table{width:100%;border-collapse:collapse;min-width:760px}.a5-table th,.a5-table td{padding:10px 12px;text-align:left;border-bottom:1px solid #e7edf3;font-size:13px}.a5-table th{position:sticky;top:0;background:#f3f7fa;color:#516278;font-size:11px;text-transform:uppercase;letter-spacing:.5px}.a5-table td.money{text-align:right;font-weight:850}.a5-table tr:last-child td{border-bottom:0}

/* Replace giant legacy finance/accounting presentation with compact controls */
#a-accounting .fp41-root{gap:12px;padding-bottom:20px}
#a-accounting .fp41-head{align-items:flex-end}
#a-accounting .fp41-head h1{font-size:clamp(29px,4vw,40px);margin-bottom:4px}
#a-accounting .fp41-head p{font-size:15px}
#a-accounting .fp41-period{border-radius:15px;padding:10px;gap:8px}
#a-accounting .fp41-period input{min-height:42px;border-radius:11px}
#a-accounting .fp41-period-presets button,#a-accounting .fp41-tabs button{padding:9px 13px;font-size:13px}
#a-accounting .fp41-tabs{gap:6px}
#a-accounting .fp41-intro{padding:14px!important;border-radius:16px}
#a-accounting .fp41-intro h2,#a-accounting .fp41-register-head h2,#a-accounting .fp41-section-head h2{font-size:24px}
#a-accounting .fp41-summary-row{grid-template-columns:repeat(4,minmax(0,1fr));min-width:0;flex:1}
#a-accounting .fp41-summary-row span{padding:9px 10px;border-radius:11px}
#a-accounting .fp41-summary-row b{font-size:17px}
#a-accounting .fp41-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
#a-accounting .fp41-stat{min-height:0;padding:11px 12px;border-radius:13px;gap:2px}
#a-accounting .fp41-stat b{font-size:23px}
#a-accounting .fp41-stat span{font-size:12px}
#a-accounting .fp41-policy{padding:14px!important}
#a-accounting .fp41-steps{gap:7px;margin:9px 0}
#a-accounting .fp41-steps span{padding:9px;border-radius:11px;font-size:13px}
#a-accounting .fp41-filter{padding:11px!important}
#a-accounting .fp41-filter-grid{gap:8px}
#a-accounting .fp41-filter input,#a-accounting .fp41-filter select{min-height:42px;border-radius:11px}
#a-accounting .fp41-register{gap:9px}
#a-accounting .fp41-mini-total span{padding:7px 9px;border-radius:10px;font-size:13px}
#a-accounting .fp41-bulk{position:relative;top:auto;padding:9px 10px;border-radius:13px;box-shadow:none}
#a-accounting .fp44-job{padding:0!important;border-radius:14px!important;overflow:hidden}
#a-accounting .fp44-job-row{padding:0!important}
#a-accounting .fp44-job-toggle{min-height:74px!important;padding:10px 12px!important;gap:10px!important}
#a-accounting .fp44-job-id b{font-size:16px!important}.fp44-job-id small,.fp44-job-party small,.fp44-job-money small{font-size:11px!important}
#a-accounting .fp44-job-party b{font-size:14px!important}#a-accounting .fp44-job-money b{font-size:18px!important}
#a-accounting .fp44-job-state .fp41-badge{font-size:10px!important;padding:4px 7px!important;min-height:24px!important}
#a-accounting .fp44-job-details{padding:12px!important;border-top:1px solid var(--a5-line);background:#fbfcfe}
#a-accounting .fp41-job-info{gap:7px}#a-accounting .fp41-job-info span{padding:7px 8px;background:#fff;border:1px solid #e5ebf1;border-radius:10px}
#a-accounting .fp41-money{gap:5px;padding:8px;border-radius:11px}#a-accounting .fp41-money b{font-size:16px}
#a-accounting .fp44-settlement-group,#a-accounting .fp44-batch,#a-accounting .fp41-invoice,#a-accounting .fp41-client{padding:12px!important;border-radius:14px!important}
#a-accounting .fp44-settlement-head strong{font-size:13px!important}#a-accounting .fp44-settlement-head strong b{font-size:21px!important}
#a-accounting .fp44-settlement-math{gap:6px!important}#a-accounting .fp44-settlement-math span{padding:8px!important;border-radius:10px!important}
#a-accounting .fp41-report-grid article{padding:13px;border-radius:14px}

/* Legacy sections are hidden once A5 renderer is active */
body.admin5-ready #a-ledger > :not(.a5-root),body.admin5-ready #a-feedback > :not(.a5-root),body.admin5-ready #a-claims > :not(.a5-root),body.admin5-ready #a-reports > :not(.a5-root),body.admin5-ready #a-audit > :not(.a5-root){display:none!important}

/* Settings: always obvious save result */
#settingsPanel .settings-savebar{position:sticky;bottom:86px;z-index:6;background:#fff;border:1px solid var(--a5-line);border-radius:14px;padding:10px;box-shadow:0 10px 26px rgba(10,31,55,.10)}
#settingsPanel .settings-savebar .btn{min-width:200px}
#settingsPanel .settings-save-state39{font-weight:850;color:var(--a5-ok)}

@media(max-width:1100px){.a5-strip{grid-template-columns:repeat(3,minmax(0,1fr))}.a5-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.a5-row-main{grid-template-columns:minmax(150px,1.4fr) minmax(120px,1fr) minmax(110px,.8fr) auto}.a5-row-main .hide-mid{display:none}#a-accounting .fp41-summary-row{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:720px){
  body.admin .admin-content{padding-left:14px!important;padding-right:14px!important}
  body.admin .section-title h1{font-size:31px}body.admin .section-title p{font-size:14px}
  .a5-root{gap:10px}.a5-head{display:grid;gap:8px}.a5-head h2{font-size:23px}.a5-toolbar{display:grid;grid-template-columns:1fr 1fr}.a5-toolbar .a5-search{grid-column:1/-1;min-width:0;width:100%}.a5-toolbar .btn{width:100%}
  .a5-strip{grid-template-columns:1fr 1fr;gap:6px}.a5-metric{padding:9px 10px;border-radius:12px}.a5-metric b{font-size:18px}.a5-metric span{font-size:11px}.a5-metric.wide-mobile{grid-column:1/-1}
  .a5-row-main{grid-template-columns:1fr auto;gap:8px;padding:10px 11px}.a5-row-main .a5-cell:nth-child(2),.a5-row-main .a5-cell:nth-child(3){grid-column:1}.a5-row-main .a5-cell.money{grid-column:2;grid-row:1;text-align:right}.a5-row-main .a5-chevron{grid-column:2;grid-row:2/4;align-self:center}.a5-cell b,.a5-cell span{white-space:normal}.a5-detail-grid{grid-template-columns:1fr 1fr;gap:6px}.a5-detail{padding:8px}.a5-actions{display:grid;grid-template-columns:1fr}.a5-actions .btn{width:100%}.a5-issue{grid-template-columns:1fr}.a5-issue-actions{display:grid;grid-template-columns:1fr 1fr}.a5-two{grid-template-columns:1fr}.a5-modal-backdrop{padding:0;place-items:end center}.a5-modal{border-radius:22px 22px 0 0;width:100%;max-height:94vh}.a5-modal-body{padding:14px}.a5-modal-foot{padding:0 14px 14px}.a5-tabs{margin-right:-14px;padding-right:14px}
  #a-accounting .fp41-head{display:grid;gap:8px}#a-accounting .fp41-head h1{font-size:30px}#a-accounting .fp41-period{grid-template-columns:1fr 1fr;padding:9px}#a-accounting .fp41-period .btn{grid-column:1/-1}#a-accounting .fp41-stats{grid-template-columns:1fr 1fr;gap:6px}#a-accounting .fp41-stat{padding:9px;min-height:94px}#a-accounting .fp41-stat b{font-size:20px}#a-accounting .fp41-stat span{font-size:11px}#a-accounting .fp41-summary-row{grid-template-columns:1fr 1fr}#a-accounting .fp41-steps{grid-template-columns:1fr 1fr}#a-accounting .fp41-bulk{display:grid;grid-template-columns:1fr 1fr}#a-accounting .fp41-bulk label,#a-accounting .fp41-bulk span{grid-column:span 1}#a-accounting .fp41-bulk #fp41CreateBatch{grid-column:1/-1}#a-accounting .fp44-job-toggle{grid-template-columns:1fr auto!important;min-height:86px!important}#a-accounting .fp44-job-party{grid-column:1!important}#a-accounting .fp44-job-money{grid-column:2!important;grid-row:1!important;text-align:right!important}#a-accounting .fp44-job-state{grid-column:2!important;grid-row:2!important}#a-accounting .fp41-job-info{grid-template-columns:1fr 1fr!important}#a-accounting .fp41-money{grid-template-columns:1fr 1fr!important}#a-accounting .fp41-job-actions{display:grid!important;grid-template-columns:1fr!important}#a-accounting .fp41-job-actions .btn{width:100%!important}
  #settingsPanel .settings-savebar{bottom:92px;display:grid;gap:7px}#settingsPanel .settings-savebar .btn{min-width:0;width:100%}
}
@media(max-width:420px){.a5-strip{grid-template-columns:1fr 1fr}.a5-detail-grid{grid-template-columns:1fr}.a5-issue-actions{grid-template-columns:1fr}#a-accounting .fp41-stats{grid-template-columns:1fr 1fr}#a-accounting .fp41-stat b{font-size:18px}}
@media(min-width:721px){body.admin .admin-content{padding-bottom:36px}.a5-toast{bottom:28px}#settingsPanel .settings-savebar{bottom:16px}}
