:root{--ink:#25343f;--muted:#667780;--border:#e0e5e8;--bg:#f6f8f9;--accent:#245568;--light:#eaf2f3;--danger:#b52f2e;--ok:#167353;--warn:#a86918;--radius:10px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:Inter,system-ui,-apple-system,'Segoe UI',Arial,sans-serif;font-size:14px}a{color:#205e70;text-decoration:none}a:hover{text-decoration:underline}button,input,select,textarea{font:inherit}button{cursor:pointer}.layout{display:flex;min-height:100vh}.side{width:247px;flex:none;background:#fff;border-right:1px solid var(--border);height:100vh;position:sticky;top:0;overflow-y:auto;padding:15px 11px 28px}.brandbox{display:flex;gap:10px;align-items:center;margin:8px 9px 24px}.brandmark{width:38px;height:38px;background:#1c3440;color:#fff;display:grid;place-items:center;font-weight:800;border-radius:9px;font-size:21px}.brandbox b{display:block;font-size:15px}.brandbox small{display:block;font-size:10px;letter-spacing:1px;color:var(--muted)}.roleinfo{border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:15px 12px;margin:0 -11px 24px;font-size:12px}.roleinfo strong{display:block;font-size:13px}.navtitle{color:#81909a;font-size:10px;text-transform:uppercase;letter-spacing:1.3px;padding:2px 15px 12px}.navgroup{margin-bottom:4px}.navgroup summary{list-style:none;display:flex;gap:10px;align-items:center;padding:12px 13px;border-radius:8px;font-weight:600;cursor:pointer;color:#435563}.navgroup summary::-webkit-details-marker{display:none}.navgroup summary:after{content:'⌄';margin-left:auto;color:#829097}.navgroup[open] summary{background:var(--light);color:var(--accent)}.navgroup a{display:block;padding:9px 10px 9px 35px;font-size:13px;border-radius:7px;color:#50616d}.navgroup a.active{background:#e6eff1;color:#17485a;font-weight:700}.workspace{flex:1;min-width:0}.topbar{height:66px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:20px;padding:0 30px;position:sticky;top:0;z-index:10}.topbar .global{margin-left:auto;min-width:220px;max-width:390px;width:34%}.search-results{position:absolute;top:61px;right:90px;width:390px;background:white;border:1px solid var(--border);box-shadow:0 15px 35px #0002;padding:8px;border-radius:9px;z-index:20;display:none}.search-results.show{display:block}.search-results a{display:block;padding:8px 12px;border-bottom:1px solid #edf1f3}.search-results span{display:block;color:var(--muted);font-size:11px}.page{padding:27px 30px 65px;max-width:1640px;margin:auto}.pagehead{display:flex;justify-content:space-between;align-items:flex-start;gap:15px;margin-bottom:22px}.eyebrow{font-size:10px;letter-spacing:1.2px;text-transform:uppercase;color:#607582}.pagehead h1{font-size:23px;margin:5px 0 4px;letter-spacing:-.4px}.pagehead p{margin:0;color:var(--muted);font-size:13px}.tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}h2{font-size:16px;margin:0 0 15px}h3{font-size:14px;margin:0 0 12px}.card{background:#fff;border:1px solid var(--border);border-radius:11px;padding:20px;margin-bottom:16px}.cardflat{background:#fff;border:1px solid var(--border);border-radius:9px;padding:14px;margin-bottom:12px}.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:13px;margin-bottom:19px}.metric{display:block;padding:18px 19px;background:#fff;border:1px solid var(--border);border-radius:10px;color:inherit;transition:background .15s,border-color .15s,transform .15s}.metric:hover{background:#fafdfd;border-color:#afc6cd;transform:translateY(-1px);text-decoration:none}.metric .label{font-size:12px;color:var(--muted);margin-bottom:8px}.metric .num{font-size:26px;font-weight:750;letter-spacing:-.7px}.metric .sub{font-size:11px;color:var(--muted);margin-top:6px}.tablewrap{width:100%;overflow-x:auto;border:1px solid var(--border);border-radius:9px;background:#fff}.tablewrap table{width:100%;border-collapse:collapse;min-width:690px}th{font-size:12px;color:#5b6a75;background:#f1f4f5;text-align:left;padding:12px;border-bottom:1px solid var(--border);white-space:nowrap}td{padding:12px;border-bottom:1px solid #ebeff1;vertical-align:middle;font-size:13px}tr:hover td{background:#fbfcfd}tr:last-child td{border-bottom:0}.muted{color:var(--muted)}.small{font-size:12px}.tag{display:inline-block;font-size:11px;padding:3px 8px;border-radius:5px;background:#edf0f2;color:#475863;border:1px solid #e0e4e7;white-space:nowrap}.tag.success{background:#ebf6ef;color:#216a47;border-color:#cde6d5}.tag.danger{background:#fff0ef;color:#a32e2b;border-color:#f1cbcb}.tag.warn{background:#fff7e8;color:#986019;border-color:#f3e2c0}.tag.info{background:#edf5f7;color:#205669;border-color:#d5e9ee}button.primary,.btn.primary{background:#233d4c;color:#fff;border-color:#233d4c}.btn,button{border:1px solid #d0dbe0;border-radius:7px;background:#fff;padding:9px 13px;color:#344c58}.btn{display:inline-block;text-decoration:none;font-size:13px}.btn:hover,button:hover{background:#f0f4f6;text-decoration:none}.primary:hover{background:#334e60}.btn.sm,button.sm{font-size:12px;padding:6px 9px}.btn.danger{color:#a02f2f}input,select,textarea{border:1px solid #cfd9df;border-radius:7px;padding:10px 11px;color:var(--ink);background:white;max-width:100%;width:100%}input:focus,select:focus,textarea:focus{outline:2px solid #91b4c1;outline-offset:1px}label{display:block;font-size:12px;font-weight:650;color:#3e535f;margin:13px 0 6px}textarea{min-height:94px;resize:vertical}.formgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 22px}.formgrid .full{grid-column:1/-1}.filters{display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin:0 0 14px}.filters label{margin:0 0 5px}.filters>div{min-width:140px;flex:1}.filters>div:first-child{flex:2;min-width:200px}.tabs{display:flex;gap:6px;border-bottom:1px solid var(--border);margin-bottom:19px;overflow:auto}.tabs a{padding:11px 14px;color:#526b78;border-bottom:2px solid transparent;white-space:nowrap}.tabs a.active{border-color:#315f71;color:#1b4659;font-weight:700}.kv{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.kv>div{border-bottom:1px solid #eef1f2;padding-bottom:11px}.kv label{margin:0 0 5px;color:#83909a}.kv strong{font-size:13px;font-weight:650}.timeline{border-left:2px solid #d5e2e6;padding-left:22px;margin:12px 0}.event{position:relative;padding:0 0 18px}.event:before{content:'';width:9px;height:9px;position:absolute;top:4px;left:-27px;border-radius:50%;background:#597b8c}.event small{color:var(--muted);display:block;margin-top:5px}.wizard-steps{display:flex;gap:4px;margin-bottom:24px}.wizard-steps>div{height:7px;flex:1;background:#e5ecef;border-radius:8px}.wizard-steps>div.done{background:#406b7a}.wizard-step{display:none}.wizard-step.active{display:block}.wizard-actions{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-top:20px;padding-top:15px;border-top:1px solid var(--border)}.wizard-step p{color:var(--muted)}.review-item{padding:12px;border-bottom:1px solid #edf1f3;display:flex;justify-content:space-between;gap:15px}.review-item b{font-size:13px}.review-item span{color:var(--muted)}.field-row{display:grid;grid-template-columns:1fr 1.2fr auto;align-items:end;gap:8px}.field-row button{height:40px}.two-col{display:grid;grid-template-columns:1.1fr .9fr;gap:16px}.flash{padding:12px 15px;background:#eaf6ef;color:#246849;border:1px solid #c9e6d4;border-radius:8px;margin-bottom:14px}.flash.bad{background:#fff0ef;color:#b52c2c;border-color:#ebcbc9}.help{color:var(--muted);font-size:12px;line-height:1.55}.empty{padding:28px;text-align:center;color:var(--muted)}.auth-page{display:grid;place-items:center;min-height:100vh}.auth-card{width:min(420px,calc(100vw - 36px));background:#fff;border:1px solid var(--border);border-radius:12px;padding:35px}.auth-card h1{margin:0 0 6px}.auth-card .primary{width:100%;margin-top:20px;padding:12px}.status-line{display:flex;gap:12px;flex-wrap:wrap;align-items:center}.progress{height:8px;background:#e7edef;border-radius:20px;overflow:hidden}.progress span{display:block;height:100%;background:#3a7182}.scroll-toggle{display:none}pre{white-space:pre-wrap;overflow-wrap:anywhere}@media(max-width:1000px){.side{width:208px}.page{padding:24px 18px}.two-col{grid-template-columns:1fr}}@media(max-width:760px){.side{display:none;position:fixed;z-index:20;box-shadow:20px 0 80px #0002}.side.open{display:block;width:245px}.scroll-toggle{display:inline-block}.topbar{padding:0 13px}.topbar .global{min-width:110px;max-width:260px;width:60%}.page{padding:20px 13px}.formgrid,.kv{grid-template-columns:1fr}.field-row{grid-template-columns:1fr}.pagehead{display:block}.tools{margin-top:14px}.search-results{right:10px;width:min(95vw,390px)}.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.metric{padding:14px}.metric .num{font-size:20px}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition:none!important}}

/* ========================================================================
   UGNA CAPITAL — ENTERPRISE UI POLISH V1 (RC28)
   Presentation only: no changes to API routes, forms, PHP, database or roles.
   Designed for desktop-first financial CRM, with responsive fallbacks.
   ======================================================================== */
:root {
  --ink:#263844;
  --muted:#657782;
  --border:#dce5e9;
  --bg:#f5f7f9;
  --accent:#265568;
  --light:#eaf1f4;
  --radius:9px;
  --ui-focus:#8ab3c3;
  --ui-white:#fff;
  --ui-elev:0 1px 3px rgba(20,47,60,.035);
}
html {scroll-behavior:smooth}
body {line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
button,a,input,select,textarea,summary {transition:background-color .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease}
:where(a,button,input,select,textarea,summary):focus-visible {outline:2px solid var(--ui-focus);outline-offset:2px}

/* Application frame / navigation */
.side {width:238px;padding:16px 10px 24px;scrollbar-width:thin;scrollbar-color:#cfdbe0 transparent}
.side::-webkit-scrollbar {width:5px}
.side::-webkit-scrollbar-thumb {border-radius:10px;background:#d3dde1}
.brandbox {margin:5px 10px 21px;gap:11px}
.brandmark {box-shadow:0 2px 5px rgba(26,52,66,.1)}
.roleinfo {margin:0 -10px 20px;padding:13px 20px}
.navtitle {padding:1px 12px 11px;font-weight:700}
.navgroup {margin-bottom:3px}
.navgroup summary {min-height:41px;padding:9px 11px;gap:10px;font-size:13px;line-height:1.35;border-radius:8px;color:#455965}
.navgroup summary:hover {background:#f2f6f7;color:#254e5f}
.navgroup[open] summary {background:#edf3f5;color:#244e60}
.navgroup summary::after {font-size:14px;line-height:1;transition:transform .17s ease}
.navgroup[open] summary::after {transform:rotate(180deg)}
.navgroup .ui-nav-icon {width:16px;height:16px;flex:0 0 16px;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;fill:none;opacity:.8}
.navgroup a {position:relative;margin:1px 1px 1px 11px;padding:8px 12px 8px 32px;font-size:12.5px;line-height:1.45;border-radius:7px}
.navgroup a:hover {background:#f3f7f9;color:#274f60;text-decoration:none}
.navgroup a.active {background:#e8f0f3;color:#1c4b5d;font-weight:700}
.navgroup a.active::before {content:"";position:absolute;left:0;top:6px;bottom:6px;width:3px;border-radius:3px;background:#356579}
.side>.help {border-top:1px solid #eff2f3;margin-top:18px}

/* Header, breadcrumb and search */
.topbar {height:62px;gap:14px;padding:0 25px;box-shadow:0 1px 0 rgba(16,41,54,.025)}
.topbar>.muted {white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:48%;color:#6c818c}
.topbar .global {width:clamp(240px,31%,370px);min-width:170px;position:relative}
#globalSearch {height:38px;border-color:#d6e1e6;background:#fbfcfd;padding-left:36px;font-size:12.5px}
.topbar .global::before {content:"";position:absolute;left:13px;top:12px;width:13px;height:13px;border:1.8px solid #8499a5;border-radius:50%;pointer-events:none;z-index:1}
.topbar .global::after {content:"";position:absolute;left:26px;top:25px;width:7px;height:1.7px;background:#8499a5;transform:rotate(45deg);transform-origin:left center;pointer-events:none;z-index:1}
.search-results {top:44px;right:0;width:max(100%,310px);max-width:min(390px,90vw);box-shadow:0 14px 38px rgba(15,45,60,.12)}
.topbar>.btn {white-space:nowrap}
.page {padding:25px 25px 60px}
.pagehead {align-items:center;margin-bottom:18px}
.eyebrow {font-size:10px;font-weight:650;letter-spacing:1.2px}
.pagehead h1 {font-size:23px;line-height:1.28;letter-spacing:-.55px;margin:5px 0 5px}
.pagehead p {font-size:12.5px;line-height:1.5;max-width:850px}
.tools {margin-left:auto;justify-content:flex-end}

/* Cards and dashboard: balance 7/2 orphan rows at desktop widths */
.card,.cardflat {border-color:#dfe7eb;box-shadow:var(--ui-elev)}
.card {padding:18px;margin-bottom:15px}
.cardflat {padding:13px}
h2 {font-size:15px;letter-spacing:-.12px;margin-bottom:14px}
h3 {font-size:13.5px}
.metrics {grid-template-columns:repeat(4,minmax(0,1fr));gap:11px;margin-bottom:17px}
.metric {min-width:0;min-height:102px;padding:15px 16px;box-shadow:var(--ui-elev)}
.metric:hover {background:#fafdfe;border-color:#b3cbd3;box-shadow:0 4px 14px rgba(20,60,75,.065);transform:translateY(-1px)}
.metric .label {font-size:12px;line-height:1.45;margin-bottom:7px}
.metric .num {font-size:25px;line-height:1.18;letter-spacing:-.6px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.metric .sub {font-size:11px;line-height:1.4;margin-top:10px}
.two-col {gap:14px}
.two-col>.card {min-width:0}

/* Tables and compact filters */
.tablewrap {border-color:#dce5e9;border-radius:8px}
.tablewrap table {font-variant-numeric:tabular-nums}
.tablewrap th {background:#f2f5f6;color:#526773;font-size:11.5px;letter-spacing:.05px;padding:11px 12px;font-weight:700}
.tablewrap td {padding:11px 12px;font-size:12.5px;line-height:1.45}
.tablewrap tbody tr:hover td {background:#f8fbfc}
.tablewrap td a:not(.btn) {font-weight:550}
.tablewrap .btn.sm,.tablewrap button.sm {white-space:nowrap}
.filters {align-items:flex-end;gap:9px;padding:12px 13px;background:#f8fafb;border:1px solid #e6ecef;border-radius:9px;margin:0 0 13px}
.filters>div {min-width:128px}
.filters>div:first-child {min-width:190px}
.filters label {font-size:11px;font-weight:650}
.filters input,.filters select {height:37px;padding:7px 10px;background:#fff;font-size:12.5px}
.filters>button {min-height:37px}
.empty {padding:34px 18px;color:#697f8a;line-height:1.6}
.empty::before {content:"";display:block;margin:0 auto 10px;width:24px;height:18px;border:1.7px solid #a2b4bd;border-radius:4px;box-shadow:inset 0 5px 0 #edf2f4}
.tag {font-weight:600;letter-spacing:.05px;border-radius:5px;padding:3px 8px}

/* Buttons and form controls */
.btn,button {min-height:36px;border-radius:7px;padding:8px 13px;font-size:12.5px;font-weight:550;line-height:1.35}
.btn.sm,button.sm {min-height:30px;padding:6px 9px;font-size:11.5px}
button.primary,.btn.primary {background:#233f4e;color:#fff;border-color:#233f4e}
button.primary:hover,.btn.primary:hover {background:#2d5265;border-color:#2d5265;color:#fff}
button:disabled {opacity:.48;cursor:not-allowed}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea {border-radius:7px;border-color:#cfdae0;font-size:13px}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select {min-height:39px}
input:focus,select:focus,textarea:focus {outline:2px solid rgba(110,166,188,.5);outline-offset:0;border-color:#80a8b8}
input[type=checkbox],input[type=radio] {width:16px!important;min-width:16px;height:16px!important;min-height:16px;accent-color:#325f71;margin:0 7px 0 0;padding:0;vertical-align:middle;flex:0 0 16px;cursor:pointer}
label {font-size:12px;margin:10px 0 5px;line-height:1.45}
label:has(> input[type=checkbox]),label:has(> input[type=radio]) {display:inline-flex;align-items:center;gap:6px;cursor:pointer;min-height:32px;margin:5px 0 8px;font-weight:550}
label:has(> input[type=checkbox]) input, label:has(> input[type=radio]) input {margin:0}
.formgrid {gap:2px 20px}
.formgrid>div:has(> label:first-child + input[type=checkbox]) {display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding-top:12px}
.formgrid>div:has(> label:first-child + input[type=checkbox])>label {margin:0}
.formgrid>div:has(> label:first-child + input[type=checkbox])>input {margin:0}
textarea {min-height:90px}
.help {line-height:1.65}

/* Stepper: inject step names from existing wizard H2s, no workflow changes */
.wizard-steps {gap:7px;margin:0 0 19px;align-items:stretch}
.wizard-steps>div {position:relative;flex:1 1 0;min-width:0;height:auto;min-height:45px;background:transparent;border-radius:0;border-top:4px solid #e2eaf0;padding:7px 2px 0;color:#8495a0;font-size:11px;font-weight:600;line-height:1.3}
.wizard-steps>div.done {background:transparent;border-top-color:#34677b;color:#375c6b}
.wizard-steps>div.is-current {border-top-color:#214b5d;color:#223e4b;font-weight:750}
.wizard-steps>div>span {display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wizard-steps>div>span::before {content:attr(data-number) ". ";font-weight:750}
.wizard-steps.is-six-step {gap:5px}
.wizard-steps.is-six-step>div {font-size:10.5px}
.wizard-step>h2 {font-size:14px;margin-bottom:16px;padding-bottom:9px;border-bottom:1px solid #edf1f3}
.wizard-actions {margin-top:17px;padding:14px 0 1px;gap:10px}
.wizard-actions>div {display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.wizard-actions button {min-height:37px}
.review-item {padding:11px 7px}

/* Misc structures */
.kv {gap:14px}
.progress {height:7px}
.tabs a {font-size:12.5px}
.flash {font-size:13px}

/* Responsive: preserve spreadsheet-style tables, don't crush form fields */
@media (max-width:1300px) {
  .metrics {grid-template-columns:repeat(3,minmax(0,1fr))}
  .page {padding-left:21px;padding-right:21px}
}
@media (max-width:1050px) {
  .side {width:214px}
  .metrics {grid-template-columns:repeat(2,minmax(0,1fr))}
  .wizard-steps.is-six-step>div>span {white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
}
@media (max-width:760px) {
  html {scroll-behavior:auto}
  .side {display:none;width:244px;box-shadow:12px 0 35px rgba(15,42,53,.17)}
  .side.open {display:block;width:244px}
  .topbar {height:58px;gap:9px;padding:0 12px}
  .topbar>.muted {max-width:120px;font-size:11px}
  .topbar .global {width:auto;min-width:95px;flex:1;max-width:none}
  #globalSearch {font-size:11px;padding:7px 8px 7px 31px}
  .topbar>.btn {padding:7px 9px;font-size:11px}
  .page {padding:18px 12px 50px}
  .pagehead {align-items:flex-start;margin-bottom:15px}
  .pagehead h1 {font-size:21px}
  .metrics {gap:9px}
  .metric {min-height:90px;padding:12px}
  .metric .num {font-size:22px}
  .card {padding:14px}
  .filters {padding:10px;gap:7px}
  .filters>div,.filters>div:first-child {min-width:calc(50% - 5px);flex:1 1 calc(50% - 5px)}
  .formgrid {grid-template-columns:1fr;gap:0}
  .wizard-steps>div {font-size:10px;min-height:42px}
  .wizard-steps.is-six-step>div {font-size:9.5px}
  .wizard-actions {position:static;background:transparent;margin:16px 0 0;padding:13px 0 0;box-shadow:none}
}
@media (max-width:430px) {
  .topbar>.muted {display:none}
  .metrics {grid-template-columns:repeat(2,minmax(0,1fr))}
  .filters>div,.filters>div:first-child {min-width:100%;flex:1 1 100%}
  .wizard-steps {gap:3px}
  .wizard-steps>div {font-size:9px;min-height:40px}
  .wizard-steps>div>span {display:none}
  .wizard-steps>div::after {content:attr(data-step);display:block;text-align:center;font-size:11px;font-weight:700}
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {scroll-behavior:auto!important;transition:none!important;animation:none!important}
}
/* Exactly nine dashboard KPIs: distribute 3 / 3 / 3 rather than 7 / 2. */
@media (min-width:1051px) {
  .metrics:has(> :nth-child(9)):not(:has(> :nth-child(10))) {grid-template-columns:repeat(3,minmax(0,1fr))}
}


/* UGNA RC28 UI V2 emergency hotfix: consistent CSS/JS pair, visual-only. */
:root { --ugna-ui-v2-ready:1; }
.navgroup>summary>.ui-nav-icon {
  display:inline-block!important;width:16px!important;height:16px!important;
  min-width:16px!important;max-width:16px!important;max-height:16px!important;
  flex:0 0 16px!important;fill:none!important;stroke:currentColor!important;
  stroke-width:1.7;vertical-align:middle;
}
/* Wizard caption occupies its own line below the step bar, never across it. */
.wizard-steps {align-items:stretch;gap:9px;margin-bottom:18px}
.wizard-steps>div {
  height:auto!important;min-height:52px;padding:9px 4px 1px;
  border-top:4px solid #e2eaf0;background:transparent!important;
  border-radius:0;color:#647985;line-height:1.35;
}
.wizard-steps>div.done {border-top-color:#47758a;background:transparent!important}
.wizard-steps>div.is-current {border-top-color:#244e62}
.wizard-steps>div>span {
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  white-space:normal;overflow:hidden;overflow-wrap:anywhere;text-overflow:clip;
  font-size:11px;line-height:1.35;
}
.wizard-steps.is-six-step>div>span {font-size:10px}
@media(max-width:600px) {
  .wizard-steps>div {min-height:40px;padding-top:6px;text-align:center}
  .wizard-steps>div>span {font-size:0;display:block;line-height:1}
  .wizard-steps>div::after {content:none!important;display:none!important}
  .wizard-steps>div>span::before {font-size:12px}
  .wizard-steps.is-six-step>div>span {font-size:0}
}
