
:root{--navy:#101c2e;--navy2:#172940;--blue:#2676e8;--bg:#f2f5f9;--ink:#182338;--muted:#718096;--line:#e2e8f0;--green:#0b9b6b;--orange:#e88927;--red:#e34d59;--purple:#8255d9;--white:#fff}*{box-sizing:border-box}body{margin:0;background:var(--bg);font:13px/1.5 "Segoe UI",Inter,system-ui,-apple-system,BlinkMacSystemFont,sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}button,input,select,textarea{font:inherit}button{cursor:pointer}.app{min-height:100vh;display:grid;grid-template-columns:212px minmax(0,1fr)}.sidebar{background:linear-gradient(180deg,var(--navy),#0d1726);color:#dce7f7;padding:12px 8px;display:flex;flex-direction:column;gap:10px;overflow:auto;max-height:100vh;position:sticky;top:0}.brand{display:flex;align-items:center;gap:9px;font-size:15px;font-weight:800;padding:0 8px 12px;border-bottom:1px solid #29384d;white-space:nowrap}.brandmark{color:#56a0ff;font-size:23px}.navlabel{font-size:10px;color:#8fa2bb;padding:5px 12px}.nav{display:flex;flex-direction:column;gap:2px;padding-bottom:12px}.nav button{border:0;background:transparent;color:#c9d5e5;text-align:left;padding:8px 10px;border-radius:6px;display:flex;align-items:center;gap:9px;min-height:31px}.nav button:hover,.nav button.active{background:#2676e8;color:white}.nav .ico{width:18px;text-align:center;font-size:15px}.nav .subnav{display:none}.nav .subnav.group-open{display:flex}.nav button[data-group]::after{content:"⌄";margin-left:auto;color:#9eb0c7;font-size:11px}.nav button[data-group].expanded::after{content:"⌃"}.subnav{padding-left:38px!important;min-height:24px!important;font-size:11px;color:#b8c7db!important}.subnav:hover,.subnav.active{color:#fff!important}.sidefoot{margin-top:auto;padding:10px 5px;color:#91a4bc;font-size:10px;border-top:1px solid #29384d}.main{min-width:0}.topbar{height:50px;background:white;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 16px;gap:12px;position:sticky;top:0;z-index:4}.topleft,.topright{display:flex;align-items:center;gap:10px}.projectpick{border:1px solid var(--line);border-radius:7px;padding:7px 9px;background:white;font-weight:700}.pill{border-radius:18px;background:#e4f8ef;color:#087b55;padding:4px 9px;font-size:10px;font-weight:700}.search{border:1px solid var(--line);padding:7px 10px;border-radius:7px;width:205px}.avatar{width:29px;height:29px;border-radius:50%;background:#dbeafe;color:#1d4ed8;display:grid;place-items:center;font-weight:800}.content{padding:10px 12px 16px;max-width:1800px;margin:auto}.pagehead{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:10px}.pagehead h1{font-size:20px;margin:0 0 3px}.sub{color:var(--muted);font-size:11px}.actions{display:flex;gap:7px;flex-wrap:wrap}.btn{border:1px solid var(--line);background:white;color:var(--ink);padding:7px 10px;border-radius:7px;font-weight:650}.btn.primary{background:var(--blue);color:white;border-color:var(--blue)}.grid{display:grid;gap:10px}.panel{background:white;border:1px solid var(--line);border-radius:8px;padding:11px;min-width:0}.panelhead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}.panel h3{font-size:12px;margin:0}.ref-toprow{display:grid;grid-template-columns:minmax(0,1fr) 175px;gap:10px;margin-bottom:10px}.ref-project-banner{background:white;border:1px solid var(--line);border-radius:8px;padding:10px;display:grid;grid-template-columns:100px minmax(150px,1.3fr) repeat(2,minmax(80px,.7fr)) minmax(180px,1.25fr);gap:10px;align-items:center;min-height:100px}.ref-project-photo img{width:100%;height:78px;object-fit:cover;border-radius:5px}.ref-project-name h2{font-size:16px;margin:0 0 3px}.ref-project-name>b{font-size:11px}.ref-date{border-left:1px solid #edf0f5;padding-left:10px}.ref-date span,.ref-days span,.ref-overall>span{font-size:10px;color:var(--muted);display:block}.ref-date b{font-size:12px;display:block;margin-top:4px}.ref-timeprogress{display:grid;grid-template-columns:.8fr 1.2fr;gap:9px;align-items:center}.ref-days b{font-size:18px;display:block}.ref-overall>div{height:9px;background:#e7edf4;border-radius:9px;margin-top:6px;overflow:hidden}.ref-overall i{height:100%;display:block;background:#2780f5;border-radius:9px}.ref-overall b{font-size:12px}.ref-weather{background:white;border:1px solid var(--line);border-radius:8px;padding:10px}.ref-weather-title{font-weight:700}.ref-weather-main{display:flex;align-items:center;gap:8px;margin-top:12px}.ref-weather-icon{font-size:27px}.ref-weather-main b{font-size:18px}.ref-weather-main small{display:block;font-size:10px;color:var(--muted)}.ref-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin-bottom:10px}.ref-kpi{display:flex;align-items:stretch;min-width:0;border-radius:7px;overflow:hidden;border:1px solid #e7ebf2;background:white}.ref-kpi .ref-ico{width:38px;flex:0 0 38px;display:grid;place-items:center;color:white;font-size:18px}.ref-kpi>div{flex:1;padding:7px 8px;min-width:0}.ref-kpi small{font-size:9px;line-height:1.25;display:block}.ref-kpi b{font-size:clamp(11px,1.1vw,16px);line-height:1.2;display:block;margin:4px 0;white-space:nowrap;letter-spacing:-.2px}.ref-kpi.blue{background:#edf5ff}.ref-kpi.blue .ref-ico{background:#2780f5}.ref-kpi.green{background:#e5f8ef}.ref-kpi.green .ref-ico{background:#10b981}.ref-kpi.orange{background:#fff0e6}.ref-kpi.orange .ref-ico{background:#fb923c}.ref-kpi.red{background:#fff0f1}.ref-kpi.red .ref-ico{background:#f43f5e}.ref-kpi.purple{background:#f4edff}.ref-kpi.purple .ref-ico{background:#8b5cf6}.kpi-progressline{display:grid;grid-template-columns:22px minmax(20px,1fr) 23px;align-items:center;gap:4px;margin-top:1px;font-size:8px;white-space:nowrap}.kpi-progressline i{height:5px;background:#fff;border-radius:8px;overflow:hidden}.kpi-progressline em{display:block;height:100%;background:var(--tone);border-radius:8px}.kpi-progressline strong{font-size:8px;text-align:right;font-weight:500}.ref-charts{display:grid;grid-template-columns:1fr 1.2fr 1.2fr 1fr;gap:8px;margin-bottom:10px}.ref-charts .panel{height:180px;overflow:hidden}.ref-donutrow{display:flex;align-items:center;justify-content:center;gap:15px;min-height:135px}.ref-donut{width:98px;height:98px;border-radius:50%;background:conic-gradient(#10b981 0 var(--pct),#2780f5 var(--pct) 84%,#e5eaf1 84%);display:grid;place-items:center;position:relative;flex-shrink:0}.ref-donut:after{content:"";position:absolute;width:66px;height:66px;background:white;border-radius:50%}.ref-donut>b{position:relative;z-index:1;font-size:15px}.ref-donut.docs{background:conic-gradient(#10b981 0 56%,#f79009 56% 84%,#cbd5e1 84%)}.ref-donut.docs small{display:block;font-size:9px;font-weight:400;text-align:center}.ref-legend{font-size:9px;display:grid;gap:8px;min-width:78px}.ref-legend span{display:flex;align-items:center;gap:5px}.ref-legend i{width:7px;height:7px;display:inline-block;border-radius:2px;flex-shrink:0}.ref-legend b{margin-left:auto}.ref-chartlegend{display:flex;justify-content:center;gap:9px;font-size:9px;color:#536176;margin:6px 0 0}.ref-chart{width:100%;height:132px;display:block}.ref-workrow{display:grid;grid-template-columns:minmax(0,1.9fr) minmax(260px,1fr);gap:8px;margin-bottom:10px}.ref-workrow .panel{height:310px;overflow:hidden}.ref-site-photo-panel .ref-photo img{height:74px}.ref-filters{display:flex;gap:5px}.ref-filters select{max-width:115px;border:1px solid var(--line);padding:5px;border-radius:5px;font-size:9px}.gantt-scroll{overflow:auto}.gantt{position:relative;min-width:680px;font-size:9px}.gantt-head,.gantt-row{display:grid;grid-template-columns:28px minmax(150px,1.5fr) 48px 48px 35px repeat(8,minmax(35px,1fr));align-items:center}.gantt-head{background:#f7f9fc;color:#536176;text-align:center;font-weight:700;border:1px solid #edf0f5}.gantt-head span{padding:5px 2px;border-right:1px solid #edf0f5}.gantt-row{height:27px;border-bottom:1px solid #edf0f5}.gantt-row>span{padding:4px 3px;overflow:hidden;text-overflow:ellipsis}.gantt-row>span:nth-child(n+6){height:100%;border-left:1px solid #f1f3f7}.gantt-task{white-space:nowrap}.g-blue{color:#2780f5}.g-green{color:#10b981}.gantt-track{grid-column:6/14;grid-row:auto;position:relative;height:100%;background:repeating-linear-gradient(90deg,transparent 0 calc(12.5% - 1px),#edf0f5 calc(12.5% - 1px) 12.5%)}.gantt-track i{position:absolute;top:7px;height:12px;border-radius:3px;background:#cbd5e1}.gantt-track i.done{background:#10b981}.gantt-track i.active{background:#60a5fa}.gantt-track i.future{background:#fb923c}.gantt-track i.sub{background:#cbd5e1}.gantt-today{position:absolute;left:64%;top:32px;bottom:0;border-left:1px dashed #f43f5e;pointer-events:none}.gantt-today:before{content:'Hôm nay';position:absolute;top:0;left:-20px;background:#f43f5e;color:white;padding:2px 4px;border-radius:3px}.ref-photos .ref-photogrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.ref-photo img{width:100%;height:67px;object-fit:cover;border-radius:4px;display:block}.ref-photo b{font-size:9px;display:block;margin-top:3px;line-height:1.25}.ref-photo small{font-size:8px;color:var(--muted)}.ref-bottom{display:grid;grid-template-columns:1.15fr .9fr .95fr;gap:8px}.tablewrap{overflow:auto;border:1px solid var(--line);border-radius:6px}table{width:100%;border-collapse:collapse;white-space:nowrap;font-size:10px}th{background:#f7f9fc;text-align:left;color:#5d6b7f;font-weight:700}th,td{padding:7px 8px;border-bottom:1px solid #edf0f5}tr:last-child td{border-bottom:0}tbody tr:hover{background:#f8fbff}.status{display:inline-block;padding:3px 7px;border-radius:16px;font-size:9px;font-weight:700;background:#eef2f7;color:#59677b}.status.green{background:#def7ec;color:#087b55}.status.blue{background:#e3efff;color:#1f60bd}.status.orange{background:#fff0db;color:#9a5a08}.status.red{background:#ffe5e7;color:#b42332}.status.gray{background:#edf0f4;color:#687589}.ref-alert{display:flex;gap:7px;padding:8px 0;border-bottom:1px solid #edf0f5}.ref-alert i{width:17px;height:17px;border-radius:50%;display:grid;place-items:center;font-style:normal;color:white;font-size:10px;flex-shrink:0}.ref-alert i.red{background:#f43f5e}.ref-alert i.orange{background:#f79009}.ref-alert i.blue{background:#2780f5}.ref-alert b{font-size:10px;display:block}.ref-alert small{font-size:9px;color:var(--muted)}.ref-file{display:grid;grid-template-columns:20px minmax(0,1fr) 65px;gap:6px;align-items:center;padding:7px 0;border-bottom:1px solid #edf0f5}.ref-file i{font-style:normal;background:#fee2e2;color:#b91c1c;padding:3px;border-radius:3px;font-size:8px}.ref-file b{font-size:9px;overflow:hidden;text-overflow:ellipsis}.ref-file span{display:none}.ref-file small{font-size:8px;color:var(--muted);text-align:right}.hidden{display:none!important}.toolbar{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:10px}.toolbar input,.toolbar select,.field input,.field select,.field textarea{border:1px solid #d9e1eb;border-radius:7px;padding:8px 9px;background:white;min-width:0}.toolbar input{width:220px}.modalback{position:fixed;inset:0;background:#0c172b80;display:grid;place-items:center;z-index:99990!important;padding:18px;isolation:isolate}.modal{background:white;border-radius:12px;width:min(620px,100%);max-height:90vh;overflow:auto;padding:20px}.modalhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.modalhead h2{margin:0;font-size:18px}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field{display:flex;flex-direction:column;gap:5px}.field label{font-size:11px;font-weight:700;color:#536176}.field.full{grid-column:1/-1}.modalfoot{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.toast{position:fixed;bottom:20px;right:20px;background:#15263d;color:white;padding:12px 16px;border-radius:9px;z-index:20}.empty{padding:20px;text-align:center;color:var(--muted)}.tabletitle{font-weight:750;margin:0 0 10px}.kpirow{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin-bottom:10px}.statcard{background:#fff;border:1px solid var(--line);border-radius:8px;padding:13px}.statcard small{color:var(--muted)}.statcard b{display:block;font-size:20px;margin:5px 0}.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.projectcard{background:#fff;border:1px solid var(--line);border-radius:9px;padding:13px;cursor:pointer}.projectcard:hover{border-color:#8bb8f8;box-shadow:0 3px 12px #1d4ed80c}.projectcard h3{margin:0 0 4px;font-size:14px}.projectcard .pcmeta{color:var(--muted);font-size:10px}.pcbar{height:7px;background:#e8edf4;border-radius:9px;overflow:hidden;margin:9px 0}.pcbar span{height:100%;display:block;background:#2780f5}.pcfoot{display:flex;justify-content:space-between;font-size:10px}.footnote{font-size:10px;color:var(--muted);margin-top:10px}.mobilemenu{display:none}
@media(max-width:1200px){.app{grid-template-columns:185px minmax(0,1fr)}.ref-project-banner{grid-template-columns:80px minmax(110px,1fr) repeat(2,minmax(65px,.7fr)) minmax(140px,1fr);gap:6px;padding:8px}.ref-project-photo img{height:68px}.ref-project-name h2{font-size:13px}.ref-date{padding-left:6px}.ref-timeprogress{grid-template-columns:1fr}.ref-days b{font-size:15px}.ref-kpi .ref-ico{width:29px;flex-basis:29px}.ref-kpi>div{padding:6px 5px}.ref-kpi b{font-size:10px}.kpi-progressline{grid-template-columns:17px minmax(12px,1fr) 18px;gap:2px}.ref-charts{grid-template-columns:1fr 1.15fr 1.15fr 1fr}.ref-charts .panel{padding:8px}.ref-workrow{grid-template-columns:minmax(0,1.6fr) minmax(230px,1fr)}}
@media(max-width:850px){.app{grid-template-columns:1fr}.sidebar{position:fixed;z-index:8;inset:0 auto 0 0;width:230px;transform:translateX(-105%);transition:.2s}.sidebar.open{transform:translateX(0)}.mobilemenu{display:inline-block}.topbar{padding:0 9px}.search{display:none}.content{padding:9px}.ref-toprow{grid-template-columns:1fr}.ref-weather{display:none}.ref-project-banner{grid-template-columns:75px 1fr 1fr}.ref-project-name{grid-column:span 2}.ref-date{display:none}.ref-timeprogress{grid-column:span 3;grid-template-columns:1fr 1.4fr}.ref-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.ref-charts{grid-template-columns:1fr 1fr}.ref-charts .panel{height:170px}.ref-workrow,.ref-bottom{grid-template-columns:1fr}.ref-workrow .panel{height:auto;min-height:260px}.cards{grid-template-columns:1fr 1fr}.kpirow{grid-template-columns:1fr 1fr}.topright .userlabel{display:none}}
textarea{min-height:70px;line-height:1.4}.panel h4{margin:12px 0 6px;color:#29466d;font-size:13px}
/* V55: compact professional account menu in the top-right header */
.sidebar-profile{display:none!important}
.topbar{min-height:62px;height:auto!important;padding:8px 18px!important;gap:14px;box-sizing:border-box}
.topbar .topleft{flex:0 1 auto;min-width:220px}
.topbar .topright{margin-left:auto;display:flex;align-items:center;gap:12px;min-width:0}
.topbar .search{width:clamp(170px,20vw,260px)}
.top-notify{color:#64748b;font-size:16px;padding:4px}
.account-wrap{position:relative;flex:0 0 auto}
.account-trigger{display:flex;align-items:center;gap:9px;border:1px solid transparent;background:transparent;border-radius:9px;padding:5px 8px;cursor:pointer;text-align:left;color:#172b4d;min-width:178px;max-width:260px}
.account-trigger:hover,.account-trigger[aria-expanded="true"]{background:#f5f8fc;border-color:#e1e8f1}
.account-avatar{width:36px;height:36px;min-width:36px;border-radius:50%;display:grid;place-items:center;background:#e5efff;color:#2563eb;font-size:12px;font-weight:800;box-shadow:0 0 0 2px #f1f6ff}
.account-trigger-text{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.account-trigger-text b{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.account-trigger-text small{font-size:10px;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.account-chevron{font-size:13px;color:#718096}
.account-menu{position:absolute;right:0;top:calc(100% + 9px);z-index:30;width:260px;background:#fff;border:1px solid #e1e8f0;border-radius:11px;box-shadow:0 14px 38px rgba(15,35,65,.16);padding:14px;display:flex;flex-direction:column;gap:5px}
.account-menu[hidden]{display:none!important}
.account-menu-heading{font-size:9px;letter-spacing:.09em;color:#8291a5;font-weight:800;margin-bottom:5px}
.account-menu>b{font-size:13px;color:#172b4d}
.account-menu>span{font-size:11px;color:#64748b}
.account-menu .account-menu-project{color:#315b91;font-weight:600;padding:7px 0 9px;border-bottom:1px solid #edf1f6;margin-bottom:5px}
.account-menu-actions{display:flex;gap:8px}
.account-menu-actions button{flex:1;border:1px solid #dbe4ef;background:#fff;color:#23436b;border-radius:7px;padding:7px 9px;font-size:11px;font-weight:600;cursor:pointer}
.account-menu-actions button:hover{background:#f4f7fb}
.account-menu-actions .logout-action{color:#c2414b;border-color:#f0d5d8}
.account-menu-actions .logout-action:hover{background:#fff6f6}
@media(max-width:760px){.topbar{padding:7px 9px!important;flex-wrap:wrap}.topbar .topright{width:100%;justify-content:flex-end}.topbar .search{width:min(48vw,220px)}.account-trigger{min-width:145px;padding:4px}.account-avatar{width:32px;height:32px;min-width:32px}}

/* V62: scrollbars are limited to the three contract-party inner boxes and the all-files table */
.contract-party-card{height:270px;min-height:270px;display:flex;flex-direction:column;overflow:hidden}
.contract-party-card .panelhead{flex:0 0 auto}
.contract-party-card .contract-file-list,.contract-party-card>.empty{flex:1 1 auto;min-height:0;max-height:205px;overflow-y:auto;overflow-x:hidden;padding-right:5px;scrollbar-width:thin;scrollbar-color:#9aaec5 #edf2f7;overscroll-behavior:contain}
.contract-party-card .contract-file-list::-webkit-scrollbar,.contract-party-card>.empty::-webkit-scrollbar,.contract-all-files-scroll .tablewrap::-webkit-scrollbar{width:8px;height:8px}
.contract-party-card .contract-file-list::-webkit-scrollbar-track,.contract-party-card>.empty::-webkit-scrollbar-track,.contract-all-files-scroll .tablewrap::-webkit-scrollbar-track{background:#edf2f7;border-radius:8px}
.contract-party-card .contract-file-list::-webkit-scrollbar-thumb,.contract-party-card>.empty::-webkit-scrollbar-thumb,.contract-all-files-scroll .tablewrap::-webkit-scrollbar-thumb{background:#9aaec5;border:1px solid #edf2f7;border-radius:8px}
.contract-party-card .contract-file-list::-webkit-scrollbar-thumb:hover,.contract-party-card>.empty::-webkit-scrollbar-thumb:hover,.contract-all-files-scroll .tablewrap::-webkit-scrollbar-thumb:hover{background:#6f89a8}
.contract-all-files-scroll .tablewrap{max-height:300px;max-width:100%;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#9aaec5 #edf2f7}
.settlement-all-files-scroll .tablewrap table{width:100%;min-width:0;table-layout:fixed;white-space:normal}
.settlement-all-files-scroll .tablewrap th,.settlement-all-files-scroll .tablewrap td{white-space:normal;overflow-wrap:anywhere;word-break:normal;line-height:1.3}
.settlement-all-files-scroll .tablewrap th:nth-child(1){width:7%}.settlement-all-files-scroll .tablewrap th:nth-child(2){width:14%}.settlement-all-files-scroll .tablewrap th:nth-child(3){width:24%}.settlement-all-files-scroll .tablewrap th:nth-child(4){width:5%}.settlement-all-files-scroll .tablewrap th:nth-child(5){width:8%}.settlement-all-files-scroll .tablewrap th:nth-child(6){width:10%}.settlement-all-files-scroll .tablewrap th:nth-child(7){width:20%}.settlement-all-files-scroll .tablewrap th:nth-child(8){width:12%}
.contract-all-files-scroll .tablewrap thead th{position:sticky;top:0;z-index:2;background:#f5f7fb}
.contract-register-table .tablewrap{max-width:100%;overflow-x:hidden}
.contract-register-table .tablewrap table{width:100%;min-width:0;table-layout:fixed;white-space:normal}
.contract-register-table .tablewrap th,.contract-register-table .tablewrap td{white-space:normal;overflow-wrap:anywhere;word-break:normal;line-height:1.3;vertical-align:top}
.subcontract-register .tablewrap th:nth-child(1),.supplier-register .tablewrap th:nth-child(1){width:6%}
.subcontract-register .tablewrap th:nth-child(2),.supplier-register .tablewrap th:nth-child(2){width:15%}
.subcontract-register .tablewrap th:nth-child(3),.supplier-register .tablewrap th:nth-child(3){width:18%}
.subcontract-register .tablewrap th:nth-child(4),.supplier-register .tablewrap th:nth-child(4){width:20%}
.subcontract-register .tablewrap th:nth-child(5),.supplier-register .tablewrap th:nth-child(5){width:8%}
.subcontract-register .tablewrap th:nth-child(6),.supplier-register .tablewrap th:nth-child(6){width:8%}
.subcontract-register .tablewrap th:nth-child(7),.supplier-register .tablewrap th:nth-child(7){width:9%}
.subcontract-register .tablewrap th:nth-child(8),.supplier-register .tablewrap th:nth-child(8){width:9%}
.subcontract-register .tablewrap th:nth-child(9),.supplier-register .tablewrap th:nth-child(9){width:7%}
.owner-register .tablewrap th:nth-child(1){width:6%}
.owner-register .tablewrap th:nth-child(2){width:8%}
.owner-register .tablewrap th:nth-child(3){width:13%}
.owner-register .tablewrap th:nth-child(4){width:12%}
.owner-register .tablewrap th:nth-child(5){width:17%}
.owner-register .tablewrap th:nth-child(6){width:8%}
.owner-register .tablewrap th:nth-child(7){width:8%}
.owner-register .tablewrap th:nth-child(8){width:10%}
.owner-register .tablewrap th:nth-child(9){width:10%}
.owner-register .tablewrap th:nth-child(10){width:8%}
@media(max-width:1100px){.contract-register-table .tablewrap{overflow-x:auto}.contract-register-table .tablewrap table{min-width:1050px}}

.contract-all-files-scroll .tablewrap table{width:100%;min-width:0;table-layout:fixed;white-space:normal}
.contract-all-files-scroll .tablewrap th,.contract-all-files-scroll .tablewrap td{white-space:normal;overflow-wrap:anywhere;word-break:normal;line-height:1.35;vertical-align:top}
.contract-all-files-scroll .tablewrap th:nth-child(1){width:7%}
.contract-all-files-scroll .tablewrap th:nth-child(2){width:10%}
.contract-all-files-scroll .tablewrap th:nth-child(3){width:22%}
.contract-all-files-scroll .tablewrap th:nth-child(4){width:5%}
.contract-all-files-scroll .tablewrap th:nth-child(5){width:7%}
.contract-all-files-scroll .tablewrap th:nth-child(6){width:10%}
.contract-all-files-scroll .tablewrap th:nth-child(7){width:39%}


.settlement-system-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:10px;align-items:stretch}
.settlement-system-card{min-width:0;min-height:250px;display:flex;flex-direction:column}
.settlement-system-card .contract-file-list{max-height:245px;overflow:auto;min-height:105px}
.settlement-system-card .contract-file-row{min-width:0}
.settlement-system-card .contract-file-row>div{min-width:0;overflow:hidden}
.settlement-system-card .contract-file-row b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.settlement-system-card .contract-file-row small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:1100px){.settlement-system-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.settlement-system-grid{grid-template-columns:1fr}}

.addendum-register-card{grid-column:1/-1;min-height:250px}
.addendum-register-card .addendum-table-scroll{max-height:360px;overflow:auto;width:100%;max-width:100%}
.addendum-register-card table{min-width:0;width:100%;table-layout:fixed;white-space:normal}
.addendum-register-card .empty{min-height:140px}

.addendum-register-card{grid-column:1/-1}
.addendum-register-card .addendum-table-scroll{width:100%;max-width:100%;overflow-x:hidden;overflow-y:auto}
.addendum-register-card table{min-width:0!important;width:100%;table-layout:fixed;white-space:normal}
.addendum-register-card th,.addendum-register-card td{vertical-align:middle;white-space:normal;overflow-wrap:anywhere;line-height:1.25;padding:6px 5px}
.addendum-register-card th{font-size:9px}
.addendum-register-card td{font-size:9px}
.addendum-register-card .addendum-upload-cell{min-width:112px}.addendum-cell-upload{display:block;margin-top:6px;padding:4px 7px!important;font-size:11px!important;white-space:nowrap}
.addendum-count{white-space:nowrap}
.addendum-register-card:not(.system-register-card) th:nth-child(1),.addendum-register-card:not(.system-register-card) td:nth-child(1){width:8%}
.addendum-register-card:not(.system-register-card) th:nth-child(2),.addendum-register-card:not(.system-register-card) td:nth-child(2){width:20%}
.addendum-register-card:not(.system-register-card) th:nth-child(n+3):nth-child(-n+7),.addendum-register-card:not(.system-register-card) td:nth-child(n+3):nth-child(-n+7){width:9.5%}
.addendum-register-card:not(.system-register-card) th:nth-child(8),.addendum-register-card:not(.system-register-card) td:nth-child(8){width:9%}
.addendum-register-card:not(.system-register-card) th:nth-child(9),.addendum-register-card:not(.system-register-card) td:nth-child(9){width:15.5%}
.addendum-count{display:inline-block;font-weight:700;padding:3px 8px;border-radius:12px}
.addendum-count.has-files{background:#e8f7ef;color:#13804a}
.addendum-count.no-files{background:#fff1f0;color:#c43b36}
.addendum-register-card td small{display:block;margin-top:3px}

.addendum-register-card{grid-column:1/-1}
.addendum-view-modal{max-width:900px;width:min(900px,94vw)}
.addendum-view-body{max-height:65vh;overflow:auto;padding:12px 16px}
.addendum-detail-group{border:1px solid var(--line,#dce3ed);border-radius:9px;padding:10px;margin-bottom:12px}
.addendum-detail-group h4{margin:0 0 8px}
.addendum-detail-group .contract-file-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid #edf0f5}

.addendum-file-info{min-width:0;flex:1;overflow-wrap:anywhere}
.addendum-file-info small{display:block;color:#64748b;font-size:11px;margin-top:3px}
.addendum-view-modal{position:relative;z-index:99991!important;max-width:980px;width:min(980px,94vw);max-height:92vh;overflow:hidden;display:flex;flex-direction:column}
.addendum-view-body{min-height:0;max-height:calc(92vh - 150px);overflow:auto;padding:12px 16px;position:relative;z-index:1}
.addendum-detail-group{border:1px solid var(--line,#dce3ed);border-radius:9px;padding:10px;margin-bottom:12px}
.addendum-detail-group h4{margin:0 0 8px}
.addendum-detail-group .contract-file-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid #edf0f5}

/* V86: fit the I-V system register tables to the available viewport width. */
/* V88: map Fire Protection files to the exact eight Windows folder names. */
/* V92: fit register and all-files tables to viewport; use sentence-case headings. */
.system-register-card{min-width:0;overflow:hidden}
.system-register-card .addendum-table-scroll{width:100%;max-width:100%;overflow-x:hidden;overflow-y:visible}
.system-register-card table{width:100%;min-width:0!important;table-layout:fixed;white-space:normal;font-size:9px}
.system-register-card th,.system-register-card td{padding:6px 5px;white-space:normal;overflow-wrap:anywhere;vertical-align:middle;line-height:1.25}
.system-register-card th{font-size:8.5px;line-height:1.2;word-break:normal}
.system-register-card th:nth-child(1),.system-register-card td:nth-child(1){width:4%}
.system-register-card th:nth-child(2),.system-register-card td:nth-child(2){width:11%}
.system-register-card th:nth-child(n+3):nth-child(-n+11),.system-register-card td:nth-child(n+3):nth-child(-n+11){width:7.1%}
.system-register-card th:nth-child(12),.system-register-card td:nth-child(12){width:7%}
.system-register-card th:nth-child(13),.system-register-card td:nth-child(13){width:8.1%}
.system-register-card .addendum-count{font-size:9px;padding:3px 6px;white-space:nowrap}
.system-register-card td small{font-size:8.5px;line-height:1.2}
.system-register-card td .btn{font-size:8.5px;padding:5px 6px;white-space:nowrap}
@media(max-width:1250px){.system-register-card th,.system-register-card td{padding:5px 3px}.system-register-card th{font-size:7.8px}.system-register-card td .btn{font-size:8px;padding:4px 5px}}
@media(max-width:900px){.system-register-card .addendum-table-scroll,.addendum-register-card .addendum-table-scroll{overflow-x:auto}.system-register-card table{min-width:1100px!important}.addendum-register-card:not(.system-register-card) table{min-width:980px!important}.settlement-all-files-scroll .tablewrap table{min-width:980px}}


/* V92: keep column headings visible in every register/table while scrolling. */
.tablewrap,
.addendum-register-card .addendum-table-scroll{
  position:relative;
  scrollbar-gutter:stable;
}
/* Tables with their own scroll area: pin headings to the top of that area. */
.tablewrap thead th,
.addendum-register-card .addendum-table-scroll thead th{
  position:sticky;
  top:0;
  z-index:6;
  background:#f5f7fb;
  box-shadow:0 1px 0 #dce3ed;
}
/* I–V register cards scroll with the page, so keep their headings below the sticky app bar. */
.system-register-card .addendum-table-scroll{
  overflow:visible;
}
.system-register-card .addendum-table-scroll thead th{
  position:sticky;
  top:50px;
  z-index:5;
  background:#f5f7fb;
  box-shadow:0 1px 0 #dce3ed;
}
/* PLHD list has an independent vertical scroll area. */
.addendum-register-card:not(.system-register-card) .addendum-table-scroll{
  max-height:360px;
  overflow-x:auto;
  overflow-y:auto;
}

/* V93 FIX: keep data visible and pin headings inside each table's own scroll area. */
.system-register-card{
  min-width:0!important;
  min-height:0!important;
  height:auto!important;
  overflow:hidden;
}
.system-register-card .addendum-table-scroll{
  width:100%;
  max-width:100%;
  max-height:320px;
  overflow:auto!important;
  scrollbar-gutter:stable;
}
.system-register-card table{
  width:100%;
  min-width:0!important;
  table-layout:fixed;
  white-space:normal;
}
.system-register-card .addendum-table-scroll thead th{
  position:sticky!important;
  top:0!important;
  z-index:8!important;
  background:#f5f7fb!important;
  box-shadow:0 1px 0 #dce3ed;
}
.addendum-register-card:not(.system-register-card) .addendum-table-scroll{
  max-height:360px;
  overflow:auto!important;
  scrollbar-gutter:stable;
}
.addendum-register-card .addendum-table-scroll thead th{
  position:sticky!important;
  top:0!important;
  z-index:8!important;
  background:#f5f7fb!important;
  box-shadow:0 1px 0 #dce3ed;
}
.tablewrap{
  max-height:65vh;
  overflow:auto;
  scrollbar-gutter:stable;
}
.tablewrap thead th{
  position:sticky!important;
  top:0!important;
  z-index:7!important;
  background:#f5f7fb!important;
  box-shadow:0 1px 0 #dce3ed;
}


/* V94: remove nested scrollbars. Each register table has exactly one scroll container. */
.system-register-card,
.addendum-register-card{min-width:0!important;overflow:visible!important}
.system-register-card .addendum-table-scroll,
.addendum-register-card .addendum-table-scroll{
  width:100%!important;max-width:100%!important;
  max-height:none!important;overflow:visible!important;
}
.system-register-card .addendum-table-scroll > .tablewrap,
.addendum-register-card .addendum-table-scroll > .tablewrap{
  width:100%!important;max-width:100%!important;
  max-height:320px!important;overflow:auto!important;
  scrollbar-gutter:stable;position:relative;
}
.system-register-card .addendum-table-scroll > .tablewrap table,
.addendum-register-card .addendum-table-scroll > .tablewrap table{
  width:100%;min-width:1100px!important;
}
.system-register-card .addendum-table-scroll > .tablewrap thead th,
.addendum-register-card .addendum-table-scroll > .tablewrap thead th{
  position:sticky!important;top:0!important;z-index:12!important;
  background:#f5f7fb!important;box-shadow:0 1px 0 #dce3ed;
}
/* Prevent an extra vertical scrollbar on the all-files register. */
.settlement-all-files-scroll{max-height:420px;overflow:auto!important;scrollbar-gutter:stable}
.settlement-all-files-scroll > .tablewrap{overflow:visible!important;max-height:none!important}
.settlement-all-files-scroll thead th{position:sticky!important;top:0!important;z-index:10!important;background:#f5f7fb!important}


/* V99: one vertical scrollbar per register. The outer register viewport owns scrolling;
   the generic .tablewrap inside it must never create a second scroll area. */
.addendum-register-card .addendum-table-scroll{
  display:block!important;
  width:100%!important;max-width:100%!important;
  max-height:360px!important;
  overflow-x:auto!important;overflow-y:auto!important;
  overscroll-behavior:contain!important;
  scrollbar-gutter:stable;
}
.addendum-register-card .addendum-table-scroll .tablewrap{
  display:block!important;
  width:100%!important;max-width:100%!important;
  max-height:none!important;height:auto!important;
  overflow:visible!important;
  scrollbar-width:none!important;
}
.addendum-register-card .addendum-table-scroll .tablewrap::-webkit-scrollbar{
  display:none!important;width:0!important;height:0!important;
}
.addendum-register-card .addendum-table-scroll table{
  width:100%!important;min-width:1100px!important;
}
.addendum-register-card:not(.system-register-card) .addendum-table-scroll table{
  min-width:980px!important;
}
.addendum-register-card .addendum-table-scroll thead th{
  position:sticky!important;top:0!important;z-index:30!important;
  background:#f5f7fb!important;
}
/* System register cards must not clip the viewport scrollbar. */
.system-register-card{overflow:visible!important}
.system-register-card .addendum-table-scroll{flex:0 1 auto!important}
/* All-files list: outer container is the only scroller; inner generic table wrapper is static. */
.settlement-all-files-scroll{
  max-height:420px!important;height:auto!important;
  overflow:auto!important;overscroll-behavior:contain!important;
  scrollbar-gutter:stable;
}
.settlement-all-files-scroll .tablewrap{
  max-height:none!important;height:auto!important;
  overflow:visible!important;scrollbar-width:none!important;
}
.settlement-all-files-scroll .tablewrap::-webkit-scrollbar{
  display:none!important;width:0!important;height:0!important;
}
.settlement-all-files-scroll thead th{
  position:sticky!important;top:0!important;z-index:30!important;
  background:#f5f7fb!important;
}


/* V124 typography refinement */
h1,h2,h3,h4,.pagehead h1,.action-panel-title{font-family:"Segoe UI",Inter,system-ui,sans-serif;letter-spacing:-.01em}
button,input,select,textarea{font-family:inherit}
.btn{font-weight:600}


/* V129 – compact repository selector positioned below contract upload cards */
.contract-repository-wrap{margin:10px 0 12px;padding:10px 12px;border:1px solid #dbe4f0;border-radius:10px;background:#fff}
.contract-repository-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.contract-repository-heading h3{margin:0;font-size:12px;font-weight:700;color:#334155}
.contract-repository-heading span{font-size:10px;color:#8492a6}
.contract-repository-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.contract-repository-card{display:grid;grid-template-columns:minmax(130px, .8fr) minmax(0,2fr) auto;align-items:center;gap:9px;border:1px solid #e5ebf3;border-radius:8px;background:#f9fbfe;padding:8px 9px;min-width:0}
.contract-repository-card .repo-top{display:flex;align-items:center;gap:7px;min-width:0}
.contract-repository-card .repo-icon{width:28px;height:28px;border-radius:7px;background:#eaf2ff;color:#2463b4;display:grid;place-items:center;font-size:14px;flex:0 0 auto}
.contract-repository-card h3{margin:0;font-size:11px;line-height:1.3;color:#172b4d}
.contract-repository-card .repo-sub{display:none}
.contract-repository-path{background:#fff;border:1px solid #e2e8f0;border-radius:6px;padding:6px 8px;font:10px/1.35 Consolas,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#475569;min-width:0;margin:0}
.contract-repository-actions{display:flex;gap:6px;align-items:center;white-space:nowrap}
.contract-repository-actions .btn{padding:6px 9px;font-size:10px}
.contract-repository-status{display:none}
@media(max-width:850px){.contract-repository-grid{grid-template-columns:1fr}.contract-repository-card{grid-template-columns:minmax(120px,.8fr) minmax(0,2fr);}.contract-repository-actions{grid-column:1/-1;justify-content:flex-end}}

/* V151 - detailed contingency budget source ledger */
.reserve-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:10px 0}
.reserve-kpis .reserve-kpi{background:#fff;border:1px solid var(--line);border-radius:9px;padding:12px;min-width:0}
.reserve-kpis .reserve-kpi .sub{font-size:10px;color:var(--muted);margin-bottom:6px}
.reserve-kpis .reserve-kpi strong{font-size:16px;color:#173b66;overflow-wrap:anywhere}
@media(max-width:1100px){.reserve-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
.btn.danger{color:#b42332;border-color:#f2c5ca;background:#fff7f7}.btn.danger:hover{background:#feecee}

.payment-workspace{margin-bottom:12px}
.payment-table-scroll{max-width:100%;max-height:430px;overflow:auto;overscroll-behavior:contain}
.payment-table-scroll table{min-width:1280px}
.payment-workspace .panelhead{align-items:flex-start}
.payment-workspace .panelhead h3{margin-bottom:4px}
@media(max-width:900px){.payment-workspace .panelhead{flex-direction:column;gap:6px}.payment-table-scroll{max-height:360px}}
