:root{--bg:#f4f7fb;--panel:#fff;--line:#e1e8f0;--ink:#112036;--muted:#66768b;--brand:#1769e0;--brand2:#0d57bf;--nav:#101d31;--danger:#d92d20;--ok:#16803b;--warn:#b76e00}*{box-sizing:border-box}html{background:var(--bg)}body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;background:var(--bg);color:var(--ink)}a{color:var(--brand);text-decoration:none}.top{height:68px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 22px;position:sticky;top:0;z-index:50;gap:18px}.brand{font-weight:950;font-size:21px;white-space:nowrap}.brand small{font-size:11px;color:var(--muted);letter-spacing:.12em}.global-search{width:min(520px,40vw);display:flex;margin-left:12px}.global-search input{width:100%;height:38px;border:1px solid #cad5e3;border-radius:9px 0 0 9px;padding:0 12px;font:inherit;background:#f8fafc}.global-search button{width:44px;border:1px solid #cad5e3;border-left:0;border-radius:0 9px 9px 0;background:#fff;font-size:20px;cursor:pointer}.top-user{margin-left:auto;display:flex;gap:12px;align-items:center;font-size:13px;white-space:nowrap}.top-user span{color:var(--muted)}.logout{color:#c62828}.layout{display:grid;grid-template-columns:238px 1fr;min-height:calc(100vh - 68px)}.side{background:var(--nav);padding:18px 11px;position:relative}.side-title{font-size:11px;color:#7f91aa;padding:6px 12px 10px;font-weight:800;letter-spacing:.08em}.side a{display:flex;gap:11px;align-items:center;padding:12px 13px;border-radius:9px;color:#dce7f7;margin:4px 0;font-size:14px}.side a b{width:20px;text-align:center}.side a:hover,.side a.active{background:#1b69d2;color:#fff}.side-foot{position:sticky;top:calc(100vh - 90px);margin-top:28px;color:#6f829d;font-size:11px;padding:12px}.content{padding:26px;min-width:0;max-width:1800px;width:100%;margin:0 auto}.page-head{display:flex;justify-content:space-between;gap:18px;align-items:center;margin-bottom:18px}.page-head h1{margin:0 0 4px;font-size:27px;letter-spacing:-.02em}.page-head p{margin:0;color:var(--muted)}.actions{display:flex;gap:8px;flex-wrap:wrap}.stats{display:grid;grid-template-columns:repeat(5,minmax(155px,1fr));gap:13px;margin-bottom:18px}.stats>div,.stats>a{display:block;background:#fff;border:1px solid var(--line);border-radius:14px;padding:17px;color:var(--ink);box-shadow:0 3px 14px rgba(25,44,74,.035)}.stats span{display:block;color:var(--muted);font-size:12px;margin-bottom:8px}.stats b{display:block;font-size:23px}.stats small{display:block;margin-top:9px;color:var(--brand);font-size:11px}.report-stats b{font-size:19px}.dashboard-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.panel{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px;margin-bottom:17px;box-shadow:0 4px 18px rgba(25,44,74,.035)}.panel h2{margin:0 0 14px;font-size:17px}.panel-head{display:flex;justify-content:space-between;gap:15px;align-items:center;margin-bottom:12px}.panel-head h2{margin:0}.panel-head>span,.panel-head>a{font-size:12px;color:var(--muted)}.notice{display:grid;grid-template-columns:minmax(130px,1fr) 2fr auto;gap:12px;padding:11px 0;border-bottom:1px solid var(--line);color:var(--ink);align-items:center}.notice.compact{grid-template-columns:1fr 1fr auto}.notice em{color:var(--warn);font-style:normal;font-size:12px}.notice span{color:var(--muted);overflow:hidden;text-overflow:ellipsis}.empty{color:var(--muted)}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;font-size:13px}th,td{padding:10px 9px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap;vertical-align:middle}th{background:#f8fafc;color:#607086;font-size:11px;text-transform:uppercase;letter-spacing:.02em}tbody tr:hover{background:#fbfdff}.badge{display:inline-block;border-radius:999px;padding:4px 8px;background:#eef3fb;color:#45566e;font-size:11px}.badge.ok{background:#e8f8ee;color:var(--ok)}.badge.warn{background:#fff2d5;color:var(--warn)}.btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid #ccd6e2;background:#fff;padding:9px 13px;border-radius:8px;cursor:pointer;font-weight:700;color:var(--ink);font:inherit}.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}.btn.primary:hover{background:var(--brand2)}.btn.danger{background:#fff0ef;border-color:#fac7c3;color:#b42318}.btn.ghost{background:transparent}.btn.small{padding:6px 9px;font-size:11px}.filters,.inline-form{display:flex;flex-wrap:wrap;gap:9px;margin-bottom:15px;align-items:center}.filters label{font-size:12px;color:var(--muted);display:flex;gap:6px;align-items:center}.filters input,.filters select,.inline-form input,.inline-form select,.grid-form input,.grid-form select,.grid-form textarea,.dnm-login-card input{border:1px solid #c8d3e0;border-radius:8px;padding:9px 11px;font:inherit;background:#fff;min-height:39px}.filters input{min-width:260px}.inline-form select{max-width:330px}.grid-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.grid-form label{display:flex;flex-direction:column;gap:6px;font-weight:700;font-size:12px}.grid-form textarea{min-height:100px}.grid-form .wide{grid-column:1/-1}.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin:0 0 16px;overflow:auto}.tabs a{padding:10px 14px;color:var(--muted);font-weight:700;font-size:13px;border-bottom:2px solid transparent;white-space:nowrap}.tabs a.active{color:var(--brand);border-bottom-color:var(--brand)}.editor{background:#f8fbff;border:1px solid #dce8f7;border-radius:10px;padding:10px 12px;margin-bottom:13px}.editor summary{cursor:pointer;font-weight:800;color:var(--brand);margin-bottom:8px}.editor-panel{border-left:4px solid var(--brand)}.row-buttons{display:flex;gap:5px;align-items:center}.row-buttons form{display:inline}.progress{width:75px;height:6px;background:#e7edf5;border-radius:999px;overflow:hidden;display:inline-block;margin-right:6px}.progress i{display:block;height:100%;background:#20a05a}.overdue{background:#fff9f2}.flash{padding:10px 13px;border-radius:9px;margin-bottom:15px}.flash.ok{background:#eaf8ef;color:#156c35;border:1px solid #bfe5cc}.permission-box{border:1px solid var(--line);border-radius:10px;padding:12px;background:#fbfcfe}.perm-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-top:9px}.check{display:flex!important;flex-direction:row!important;align-items:center;gap:7px;font-weight:500!important}.check input{min-height:auto!important}.check.strong{font-weight:800!important;color:var(--brand)}.search-result{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--line);color:var(--ink)}.search-result span{color:var(--muted)}.payment-box{border-left:4px solid #1b9b55}.dnm-login-body{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#eef4ff,#f8fafc)}.dnm-login-card{width:min(410px,calc(100% - 30px));background:#fff;border:1px solid var(--line);border-radius:20px;padding:32px;box-shadow:0 24px 60px rgba(15,23,42,.12)}.dnm-logo{font-size:32px;font-weight:1000;color:var(--brand)}.dnm-login-card h1{margin:8px 0}.dnm-login-card p{color:var(--muted);margin-bottom:24px}.dnm-login-card label{display:block;font-weight:700;font-size:13px;margin:14px 0 7px}.dnm-login-card input{width:100%}.pw-wrap{display:flex}.pw-wrap input{border-radius:8px 0 0 8px}.eye{width:48px;border:1px solid #cbd5e1;border-left:0;background:#fff;border-radius:0 8px 8px 0;cursor:pointer}.dnm-alert{padding:10px 12px;border-radius:8px;margin:10px 0}.dnm-alert.danger{background:#feeceb;color:#9f2019}.mobile-menu{display:none;border:0;background:none;font-size:22px;margin-right:4px}@media(max-width:1150px){.stats{grid-template-columns:repeat(2,1fr)}.perm-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:980px){.layout{grid-template-columns:1fr}.side{display:none;position:fixed;top:68px;bottom:0;width:248px;z-index:40;overflow:auto}.menu-open .side{display:block}.mobile-menu{display:block}.content{padding:18px}.global-search{width:min(440px,45vw)}.top-user span{display:none}.dashboard-grid{grid-template-columns:1fr}}@media(max-width:700px){.global-search{display:none}.top-user strong{max-width:120px;overflow:hidden;text-overflow:ellipsis}.content{padding:12px}.panel{padding:12px}.stats{grid-template-columns:1fr 1fr}.grid-form{grid-template-columns:1fr}.grid-form .wide{grid-column:auto}.perm-grid{grid-template-columns:1fr}.page-head{align-items:flex-start;flex-direction:column}.filters input{min-width:100%;width:100%}.notice{grid-template-columns:1fr}.notice.compact{grid-template-columns:1fr}.stats b{font-size:19px}}@media(max-width:430px){.stats{grid-template-columns:1fr}.brand small{display:none}}

.panel-note{margin:-4px 0 12px;color:#64748b;font-size:13px}.year-cards{display:flex;gap:10px;flex-wrap:wrap}.year-card{min-width:120px;padding:14px 18px;border:1px solid #dbe3ef;border-radius:12px;text-decoration:none;background:#fff;display:flex;flex-direction:column;gap:4px}.year-card strong{font-size:22px;color:#0f172a}.year-card span{font-size:13px;color:#64748b}.year-card:hover{border-color:#2563eb;box-shadow:0 3px 12px #0f172a12}

/* V1.1.2: dashboard compact + management numbering */
.management-no{display:inline-flex;min-width:34px;height:28px;padding:0 8px;align-items:center;justify-content:center;border-radius:8px;background:#eef4ff;color:#155dcc;font-size:13px}.field-help{display:block;margin-top:2px;color:var(--muted);font-weight:500;line-height:1.35}.reconcile{font-size:12px;color:var(--muted);font-weight:600;margin-left:8px}.warn-card{background:#fffaf0}.warn-card strong{font-size:14px;color:#a15c00}.year-panel{padding-top:14px;padding-bottom:14px}.year-panel .panel-head{margin-bottom:8px}.year-cards{gap:8px}.year-card{min-width:104px;padding:9px 13px;border-radius:9px}.year-card strong{font-size:18px}.year-card span{font-size:12px}.recent-panel{margin-bottom:0}
@media(min-width:981px){.top{height:58px;padding:0 18px}.layout{grid-template-columns:205px 1fr;min-height:calc(100vh - 58px)}.side{padding:12px 9px}.side a{padding:9px 11px;margin:2px 0;font-size:13px}.side-title{padding:4px 10px 7px}.side-foot{font-size:10px;padding:8px}.content{padding:16px 20px}.page-head{margin-bottom:12px}.page-head h1{font-size:24px}.page-head p{font-size:13px}.stats{gap:9px;margin-bottom:11px}.stats>div,.stats>a{padding:11px 13px;border-radius:11px}.stats span{margin-bottom:4px}.stats b{font-size:20px}.stats small{margin-top:5px}.dashboard-grid{gap:11px}.panel{padding:13px;margin-bottom:11px;border-radius:11px}.panel h2{font-size:15px;margin-bottom:9px}.panel-head{margin-bottom:8px}.panel-note{margin:-2px 0 7px;font-size:11px}.notice{padding:7px 0;gap:8px;font-size:12px}.notice.compact{grid-template-columns:1.05fr 1.35fr auto}.recent-panel th,.recent-panel td{padding:7px 8px}.top-user{font-size:12px}.global-search{height:34px}.global-search input{height:34px}.global-search button{height:34px}.brand{font-size:19px}}
@media(min-width:981px) and (max-height:800px){.recent-panel tbody tr:nth-child(n+5){display:none}.dashboard-grid .panel{max-height:205px;overflow:auto}.year-panel{margin-bottom:10px}.stats>div,.stats>a{padding-top:9px;padding-bottom:9px}}

/* Smart customer search - Documents */
.document-filters{overflow:visible;position:relative;z-index:20}.smart-search{position:relative;min-width:360px;max-width:520px;flex:1}.smart-search>input{width:100%!important;min-width:0!important;padding-right:38px}.smart-clear{display:none;position:absolute;right:9px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:#7b8797;font-size:20px;cursor:pointer}.smart-clear.show{display:block}.smart-results{display:none;position:absolute;left:0;right:0;top:calc(100% + 5px);background:#fff;border:1px solid #cbd6e3;border-radius:10px;box-shadow:0 14px 34px rgba(15,35,65,.16);max-height:330px;overflow:auto;z-index:200;padding:5px}.smart-results.open{display:block}.smart-option{width:100%;text-align:left;border:0;background:#fff;border-radius:7px;padding:10px 11px;cursor:pointer;color:var(--ink);font:inherit;font-size:13px}.smart-option:hover,.smart-option:focus{background:#eef5ff;color:var(--brand)}@media(max-width:700px){.smart-search{min-width:100%;max-width:none;width:100%}}

/* V1.1.4 smart customer result details */
.smart-option strong{display:block;font-size:13px;line-height:1.35}.smart-option small{display:block;margin-top:3px;color:#7a8798;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.smart-empty{display:none;padding:12px;color:#7a8798;font-size:13px;text-align:center}

/* V1.1.5 smart customer search on Contracts */
.contract-filters{overflow:visible;position:relative;z-index:30}.contract-filters .smart-search{min-width:330px;max-width:470px}.contract-filters>input[name=q]{min-width:210px}

/* V1.1.6 - Smart search cho o tim kiem tren thanh dau portal */
.global-smart-search{position:relative;overflow:visible}.global-smart-wrap{position:relative;flex:1;min-width:0}.global-smart-wrap>input{border-radius:9px 0 0 9px}.global-smart-results{display:none;position:absolute;left:0;right:0;top:calc(100% + 6px);background:#fff;border:1px solid #cbd6e3;border-radius:10px;box-shadow:0 16px 38px rgba(15,35,65,.18);max-height:360px;overflow:auto;z-index:1000;padding:5px}.global-smart-results.open{display:block}.global-smart-option{display:none;width:100%;text-align:left;border:0;background:#fff;border-radius:7px;padding:10px 11px;cursor:pointer;color:var(--ink);font:inherit}.global-smart-option:hover,.global-smart-option:focus{background:#eef5ff;color:var(--brand)}.global-smart-option strong{display:block;font-size:13px;line-height:1.35}.global-smart-option small{display:block;margin-top:3px;color:#7a8798;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.global-smart-empty{display:none;padding:12px;color:#7a8798;font-size:13px;text-align:center}


/* V1.1.8 - Global Smart Search dropdown + filter submit fix */
.global-search .global-smart-results{left:0;right:auto;width:min(620px,calc(100vw - 40px));min-width:100%;overflow-x:hidden}
.global-search .global-smart-option{display:none!important;width:100%!important;height:auto!important;min-height:54px!important;padding:9px 12px!important;border:0!important;border-radius:7px!important;text-align:left!important;white-space:normal!important;line-height:1.35!important}
.global-search .global-smart-option[style*="display: block"]{display:block!important}
.global-search .global-smart-option strong{display:block!important;white-space:normal!important;overflow-wrap:anywhere}
.global-search .global-smart-option small{display:block!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}

/* V1.1.10 filtered contract summary */
.filter-summary{padding:12px 16px;margin:0 0 12px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}.filter-year-breakdown{display:flex;gap:8px;flex-wrap:wrap;margin-left:8px}.filter-year-breakdown b{font-size:12px;background:#f3f6fb;border:1px solid #dce4ef;border-radius:999px;padding:4px 9px}


/* V1.1.13 - Contract workspace: compact, professional and fits one desktop viewport */
.contracts-view .page-head{flex:0 0 auto}
.contracts-view .contract-filters{flex:0 0 auto}
.contracts-view .filter-summary{flex:0 0 auto}
.contract-table-panel{min-height:0}
.contract-table .delivery-progress{display:flex;align-items:center;gap:5px;min-width:0}
.contract-table .delivery-progress .progress{margin-right:0}

@media(min-width:1200px){
  .layout{grid-template-columns:188px minmax(0,1fr)}
  .side{padding-left:8px;padding-right:8px}
  .side a{padding-left:9px;padding-right:9px}
  .content{max-width:none;padding:13px 14px}
  .contracts-view{height:calc(100vh - 58px);overflow:hidden;display:flex;flex-direction:column}
  .contracts-view .page-head{margin-bottom:8px;min-height:43px}
  .contracts-view .page-head h1{font-size:23px;margin-bottom:2px}
  .contracts-view .page-head p{font-size:12px}
  .contracts-view .contract-filters{display:grid;grid-template-columns:minmax(285px,2fr) minmax(205px,1.25fr) 118px 158px 62px 72px;gap:7px;margin-bottom:8px;align-items:stretch}
  .contracts-view .contract-filters .smart-search{min-width:0;max-width:none;width:100%}
  .contracts-view .contract-filters>input[name=q]{min-width:0;width:100%}
  .contracts-view .contract-filters>select{min-width:0;width:100%}
  .contracts-view .contract-filters input,.contracts-view .contract-filters select{height:37px;min-height:37px;padding:7px 9px;font-size:13px}
  .contracts-view .contract-filters .btn{height:37px;min-height:37px;padding:7px 9px;font-size:12px}
  .contracts-view .filter-summary{padding:8px 12px;margin-bottom:8px;min-height:38px;font-size:13px;border-radius:10px}
  .contracts-view .filter-year-breakdown{gap:5px;margin-left:5px}
  .contracts-view .filter-year-breakdown b{padding:3px 8px;font-size:11px}
  .contract-table-panel{flex:1 1 auto;margin:0;padding:0 8px 6px;border-radius:11px;overflow:auto;overscroll-behavior:contain}
  .contract-table{table-layout:fixed;width:100%;min-width:0;font-size:12px}
  .contract-table th{position:sticky;top:0;z-index:3;background:#f5f8fc;height:38px;padding:7px 5px;font-size:10px;letter-spacing:.01em}
  .contract-table td{padding:7px 5px;height:47px;line-height:1.25;overflow:hidden}
  .contract-table .col-stt{width:5%;text-align:center}
  .contract-table .col-no{width:12%;white-space:normal;overflow-wrap:anywhere}
  .contract-table .col-customer{width:23%;white-space:normal;overflow-wrap:anywhere}
  .contract-table .col-date{width:9%;white-space:nowrap}
  .contract-table .col-value{width:11%;white-space:nowrap}
  .contract-table .col-items{width:8%;white-space:normal}
  .contract-table .col-delivery{width:10%;white-space:nowrap}
  .contract-table .col-docs{width:6%;text-align:center;white-space:nowrap}
  .contract-table .col-status{width:9%;white-space:normal}
  .contract-table .col-actions{width:7%;white-space:nowrap}
  .contract-table .management-no{min-width:30px;height:25px;padding:0 6px;font-size:12px;border-radius:7px}
  .contract-table .progress{width:48px;height:5px;flex:0 1 48px}
  .contract-table .delivery-progress small{font-size:10px;min-width:25px}
  .contract-table .badge{padding:4px 7px;font-size:10px;max-width:100%;white-space:normal;text-align:center;line-height:1.15}
  .contract-table .row-buttons{gap:3px;justify-content:flex-end;flex-wrap:nowrap}
  .contract-table .btn.small{padding:5px 6px;font-size:10px;border-radius:7px;line-height:1.1}
}

@media(min-width:1200px) and (max-height:720px){
  .content{padding-top:9px;padding-bottom:9px}
  .contracts-view .page-head{min-height:38px;margin-bottom:6px}
  .contracts-view .page-head h1{font-size:21px}
  .contracts-view .page-head p{font-size:11px}
  .contracts-view .contract-filters{margin-bottom:6px}
  .contracts-view .filter-summary{min-height:34px;padding:6px 10px;margin-bottom:6px}
  .contract-table th{height:34px;padding-top:5px;padding-bottom:5px}
  .contract-table td{height:43px;padding-top:5px;padding-bottom:5px}
}

@media(max-width:1199px){
  .contract-table-panel{overflow:auto}
  .contract-table{min-width:980px}
}

/* V1.1.14 - Fix contract table clipping on 1366px desktop */
@media(min-width:1200px){
  .contracts-view{width:100%;max-width:100%;min-width:0}
  .contract-table-panel{width:100%;max-width:100%;overflow-y:auto;overflow-x:hidden;padding:0 6px 6px}
  .contract-table{width:100%;max-width:100%;table-layout:fixed}
  .contract-table th,.contract-table td{box-sizing:border-box}
  .contract-table .col-stt{width:5%}
  .contract-table .col-no{width:11%}
  .contract-table .col-customer{width:20%}
  .contract-table .col-date{width:9%}
  .contract-table .col-value{width:11%}
  .contract-table .col-items{width:8%}
  .contract-table .col-delivery{width:10%}
  .contract-table .col-docs{width:6%}
  .contract-table .col-status{width:9%}
  .contract-table .col-actions{width:11%;overflow:visible;text-align:right}
  .contract-table .col-actions.row-buttons{display:table-cell;white-space:nowrap}
  .contract-table .col-actions .btn.small{display:inline-flex;padding:5px 7px;margin-left:2px}
  .contract-table .col-actions form{display:inline-block;margin:0}
  .contract-table .col-no strong,.contract-table .col-customer{line-height:1.18}
}
@media(min-width:1200px) and (max-width:1400px){
  .layout{grid-template-columns:188px minmax(0,1fr)}
  .content{padding-left:13px;padding-right:13px}
  .contract-table th{font-size:9.5px;padding-left:4px;padding-right:4px}
  .contract-table td{font-size:11.5px;padding-left:4px;padding-right:4px}
  .contract-table .progress{width:42px;flex-basis:42px}
  .contract-table .col-actions .btn.small{font-size:9.5px;padding:5px 5px}
}

/* V1.2.0 - Hàng hóa: số lượng hợp đồng / đã giao / chưa giao */
.items-progress-table{table-layout:fixed;min-width:1020px}
.items-progress-table th,.items-progress-table td{padding:9px 7px}
.items-progress-table th:nth-child(1){width:7%}.items-progress-table th:nth-child(2){width:22%}.items-progress-table th:nth-child(3){width:6%}.items-progress-table th:nth-child(4),.items-progress-table th:nth-child(5),.items-progress-table th:nth-child(6){width:8%}.items-progress-table th:nth-child(7){width:10%}.items-progress-table th:nth-child(8){width:10%}.items-progress-table th:nth-child(9){width:12%}.items-progress-table th:nth-child(10){width:9%}
.items-progress-table td:nth-child(2){white-space:normal;overflow-wrap:anywhere}
.items-progress-table td.row-buttons{display:table-cell;white-space:nowrap;text-align:right}
.items-progress-table td.row-buttons form{display:inline-block}
.qty-delivered,.qty-done{color:var(--ok)}.qty-remaining{color:var(--warn)}
.item-progress{display:flex;align-items:center;gap:5px}.item-progress .progress{margin:0;width:52px;flex:0 0 52px}.item-progress small{font-size:10px;color:var(--muted)}

/* V1.2.0 - Giao hàng vừa khung desktop + lọc theo đối tượng khách hàng */
.delivery-filters{overflow:visible;position:relative;z-index:25}
.delivery-filters .smart-search{min-width:300px;max-width:430px}
.delivery-filters>input[name=q]{min-width:230px}
.delivery-table-panel{padding:10px 12px;overflow:hidden}
.delivery-table-wrap{width:100%;max-width:100%;overflow-y:auto;overflow-x:auto}
.delivery-table{width:100%;table-layout:fixed;min-width:980px;font-size:12px}
.delivery-table th,.delivery-table td{padding:8px 6px;box-sizing:border-box}
.delivery-table .d-col-no{width:7%}.delivery-table .d-col-contract{width:12%}.delivery-table .d-col-customer{width:20%}.delivery-table .d-col-item{width:18%}.delivery-table .d-col-date{width:9%}.delivery-table .d-col-qty{width:5%;text-align:right}.delivery-table .d-col-status{width:8%}.delivery-table .d-col-person{width:9%}.delivery-table .d-col-actions{width:12%;text-align:right}
.delivery-table .d-col-contract,.delivery-table .d-col-customer,.delivery-table .d-col-item{white-space:normal;overflow-wrap:anywhere;line-height:1.25}
.delivery-table td.d-col-actions.row-buttons{display:table-cell;white-space:nowrap}
.delivery-table td.d-col-actions form{display:inline-block;margin-left:3px}
.delivery-table .btn.small{padding:5px 7px;font-size:10px}
@media(min-width:1200px){
  .delivery-table{min-width:0}
  .delivery-table-wrap{overflow-x:hidden}
  .delivery-filters{display:grid;grid-template-columns:minmax(280px,1.4fr) minmax(220px,1fr) 150px 62px 75px;gap:8px;align-items:stretch}
  .delivery-filters .smart-search{min-width:0;max-width:none;width:100%}
  .delivery-filters>input[name=q],.delivery-filters>select{min-width:0;width:100%}
}
@media(min-width:1200px) and (max-width:1400px){
  .delivery-table th,.delivery-table td{padding-left:4px;padding-right:4px;font-size:11px}
  .delivery-table .btn.small{padding:5px 5px;font-size:9.5px}
}

/* V1.2.0 - Danh mục 3 nhóm đối tượng */
.entity-tabs{margin-bottom:10px}.entity-filter{margin-bottom:12px}.entity-editor{padding-top:14px}.entity-grid{grid-template-columns:1.2fr .7fr .7fr}.entity-grid label.wide{grid-column:1/-1}
.entity-table{table-layout:fixed}.entity-table .wrap-cell{white-space:normal;overflow-wrap:anywhere;min-width:220px}.entity-table td.row-buttons{display:table-cell;white-space:nowrap;text-align:right}.entity-table td.row-buttons form{display:inline-block;margin-left:3px}
.entity-staff-form select{min-width:330px;max-width:460px}.entity-staff-form input{min-width:210px}.entity-meta{margin:3px 0 0;color:var(--muted);font-size:12px;line-height:1.4}.entity-profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.entity-profile-grid h3{margin:0 0 8px;font-size:14px}.customer-profile{border-left:4px solid var(--brand)}
.permission-box .check.strong small{color:var(--muted);font-weight:600;margin-left:4px}
@media(max-width:980px){.entity-profile-grid{grid-template-columns:1fr}.entity-grid{grid-template-columns:1fr}.entity-grid label.wide{grid-column:auto}.entity-staff-form select,.entity-staff-form input{min-width:100%;width:100%}}


/* V1.2.1 - Visible edit/save controls inside contract detail */
.btn.success{background:#eaf8ef;border-color:#b9e1c7;color:#126b35}
.contract-edit-head{padding-bottom:10px;border-bottom:1px solid var(--line);margin-bottom:14px}
.contract-edit-head h2{margin:0;font-size:16px}.contract-save-bottom{padding-top:4px}
.contract-doc-actions{min-width:160px}
@media(min-width:981px){
  .contract-overview-panel .contract-edit-head{position:sticky;top:58px;z-index:8;background:#fff;margin:-6px 0 14px;padding:8px 0 10px}
}

/* V1.2.2 - Đồng bộ STT + giao hàng theo từng đợt */
.items-progress-v122{min-width:1120px}
.items-progress-v122 th:nth-child(1){width:6%}.items-progress-v122 th:nth-child(2){width:20%}.items-progress-v122 th:nth-child(3){width:5%}.items-progress-v122 th:nth-child(4){width:7%}.items-progress-v122 th:nth-child(5){width:7%}.items-progress-v122 th:nth-child(6){width:8%}.items-progress-v122 th:nth-child(7){width:7%}.items-progress-v122 th:nth-child(8){width:9%}.items-progress-v122 th:nth-child(9){width:9%}.items-progress-v122 th:nth-child(10){width:12%}.items-progress-v122 th:nth-child(11){width:10%}
.qty-pending{color:#a15c00}.delivery-rule-note{margin:10px 0 0;color:var(--muted)}
.contract-delivery-table th,.contract-delivery-table td{padding:9px 7px}.contract-delivery-table td:nth-child(2){white-space:normal;min-width:190px}.contract-delivery-table td:last-child{min-width:190px}
.delivery-editor-v122{overflow:visible}.delivery-entry-form{display:grid;grid-template-columns:minmax(220px,1.25fr) minmax(230px,1.25fr) minmax(150px,.7fr) 145px 145px 120px;gap:10px;align-items:end}.delivery-entry-form label{display:flex;flex-direction:column;gap:5px;font-size:11px;font-weight:800;min-width:0}.delivery-entry-form input,.delivery-entry-form select{width:100%;min-width:0;border:1px solid #c8d3e0;border-radius:8px;padding:9px 10px;min-height:39px;background:#fff;font:inherit}.delivery-entry-form label:nth-of-type(7),.delivery-entry-form label:nth-of-type(8){grid-column:span 2}.delivery-form-actions{display:flex;gap:7px;align-items:center}.delivery-unlinked{background:#fffaf0}.quick-link-item{margin-top:5px}.quick-link-item .btn{max-width:100%;white-space:normal;text-align:left}
.delivery-table-v122 .d-col-item{width:20%}.delivery-table-v122 .d-col-customer{width:18%}.delivery-table-v122 .d-col-actions{width:16%}.delivery-table-v122 td.d-col-actions{white-space:normal}.delivery-table-v122 td.d-col-actions form{margin:2px 2px 2px 0}
@media(max-width:1450px){.delivery-entry-form{grid-template-columns:1.2fr 1.2fr .7fr 135px 135px 110px}.delivery-entry-form label:nth-of-type(7),.delivery-entry-form label:nth-of-type(8){grid-column:span 2}.delivery-table-v122 .d-col-actions{width:18%}}
@media(max-width:1100px){.delivery-entry-form{grid-template-columns:repeat(2,minmax(0,1fr))}.delivery-entry-form label:nth-of-type(7),.delivery-entry-form label:nth-of-type(8){grid-column:auto}.delivery-form-actions{grid-column:1/-1}.delivery-table-wrap{overflow-x:auto}.delivery-table-v122{min-width:1080px}}
.delivery-table-v122 .d-col-no{width:7%}.delivery-table-v122 .d-col-contract{width:11%}.delivery-table-v122 .d-col-customer{width:17%}.delivery-table-v122 .d-col-item{width:18%}.delivery-table-v122 .d-col-date{width:8%}.delivery-table-v122 .d-col-qty{width:6%}.delivery-table-v122 .d-col-status{width:8%}.delivery-table-v122 .d-col-person{width:8%}.delivery-table-v122 .d-col-actions{width:17%}


/* V1.2.3 - Smart picker khách hàng khi tạo/sửa hợp đồng */
.contract-customer-field{position:relative;z-index:35}
.contract-customer-picker{position:relative;font-weight:400;min-width:0}
.contract-customer-input-row{position:relative;display:flex;min-width:0}
.grid-form .contract-customer-input-row>input[name=customer_name]{width:100%;min-width:0;padding-right:44px}
.grid-form .contract-customer-input-row>input[type=hidden]{display:none}
.contract-customer-toggle{position:absolute;right:1px;top:1px;bottom:1px;width:40px;border:0;border-left:1px solid #d8e0ea;border-radius:0 7px 7px 0;background:#f8fafc;color:#52647a;font-size:18px;cursor:pointer}
.contract-customer-toggle:hover{background:#eef5ff;color:var(--brand)}
.contract-customer-results{display:none;position:absolute;left:0;right:0;top:calc(100% + 6px);max-height:390px;overflow:auto;background:#fff;border:1px solid #cbd6e3;border-radius:11px;box-shadow:0 18px 42px rgba(15,35,65,.18);padding:6px;z-index:1200}
.contract-customer-results.open{display:block}
.contract-customer-menu-title{padding:7px 9px 6px;color:#6b7b90;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.06em}
.contract-customer-count{margin-left:5px;color:#2563eb;font-weight:900;text-transform:none;letter-spacing:0}
.contract-customer-option{display:block;width:100%;border:0;background:#fff;border-radius:8px;padding:9px 10px;text-align:left;cursor:pointer;color:var(--ink);font:inherit}
.contract-customer-option:hover,.contract-customer-option.is-active{background:#eef5ff;color:var(--brand)}
.contract-customer-option strong{display:block;font-size:13px;line-height:1.3}
.contract-customer-option small{display:block;margin-top:3px;color:#718096;font-size:11px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
.contract-customer-empty{display:none;padding:12px 10px;color:#8a5a00;background:#fffaf0;border-radius:8px;font-size:12px;line-height:1.4}
.contract-customer-manage{display:block;margin-top:5px;padding:9px 10px;border-top:1px solid #edf1f5;font-size:12px;font-weight:800;color:var(--brand)}
.contract-customer-field>.field-help{margin-top:0}
@media(max-width:700px){.contract-customer-results{position:fixed;left:12px;right:12px;top:138px;max-height:55vh}}

/* V1.2.4 - mẫu chứng từ mặc định theo đối tượng khách hàng */
.customer-doc-template{border:1px solid #cfe0f7;border-radius:12px;background:#f8fbff;padding:14px 14px 10px;margin-top:2px}
.doc-template-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:10px}
.doc-template-head>div:first-child{display:flex;flex-direction:column;gap:4px}
.doc-template-head strong{font-size:14px;color:#0d3265}
.doc-template-head small{font-size:12px;color:#5a6f8d;line-height:1.45;max-width:760px}
.doc-template-head em{font-size:12px;color:#a66000;font-style:normal;font-weight:600}
.doc-template-actions{display:flex;gap:8px;flex:0 0 auto}
.doc-template-table{min-width:0!important;width:100%;table-layout:fixed}
.doc-template-table th:first-child,.doc-template-table td:first-child{width:auto}
.doc-template-table th:nth-child(2),.doc-template-table td:nth-child(2){width:130px;text-align:center}
.doc-template-table th:nth-child(3),.doc-template-table td:nth-child(3){width:130px;text-align:center}
.doc-template-table td{padding-top:9px;padding-bottom:9px}
.compact-check{justify-content:center;margin:0!important;white-space:nowrap}
.doc-template-help{margin:9px 2px 0;line-height:1.45}
.customer-template-summary{display:flex;flex-wrap:wrap;align-items:center;gap:7px;padding:10px 12px;margin:0 0 14px;border:1px solid #dbe6f3;border-radius:10px;background:#fbfdff}
.customer-template-summary>strong{margin-right:4px}
.customer-template-summary.empty-template{color:#7a8798}
.entity-table th:nth-last-child(2),.entity-table td:nth-last-child(2){white-space:nowrap}
@media(max-width:900px){.doc-template-head{flex-direction:column}.doc-template-actions{width:100%;flex-wrap:wrap}.doc-template-table th:nth-child(2),.doc-template-table td:nth-child(2),.doc-template-table th:nth-child(3),.doc-template-table td:nth-child(3){width:100px}.customer-doc-template{padding:10px}}

/* V1.2.5 - Chứng từ khác + ghi chú phát sinh */
.doc-template-table .doc-template-note{min-width:220px;width:100%;}
.doc-template-table td:first-child small{display:block;margin-top:3px;font-weight:400;}
.contract-doc-actions{white-space:nowrap;}


/* V1.2.6 - Smart picker công ty tại tab NV khách hàng */
.entity-staff-form{overflow:visible}
.staff-customer-picker{position:relative;min-width:360px;max-width:500px;flex:1 1 390px;z-index:60}
.staff-customer-input-row{position:relative;display:flex;min-width:0}
.entity-staff-form .staff-customer-input-row>input[name=customer_lookup]{width:100%;min-width:0;padding-right:44px}
.staff-customer-input-row>input[type=hidden]{display:none}
.staff-customer-toggle{position:absolute;right:1px;top:1px;bottom:1px;width:40px;border:0;border-left:1px solid #d8e0ea;border-radius:0 7px 7px 0;background:#f8fafc;color:#52647a;font-size:18px;cursor:pointer}
.staff-customer-toggle:hover{background:#eef5ff;color:var(--brand)}
.staff-customer-results{display:none;position:absolute;left:0;right:0;top:calc(100% + 6px);max-height:390px;overflow:auto;background:#fff;border:1px solid #cbd6e3;border-radius:11px;box-shadow:0 18px 42px rgba(15,35,65,.18);padding:6px;z-index:1400}
.staff-customer-results.open{display:block}
.staff-customer-menu-title{padding:7px 9px 6px;color:#6b7b90;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.06em}
.staff-customer-option{display:block;width:100%;border:0;background:#fff;border-radius:8px;padding:9px 10px;text-align:left;cursor:pointer;color:var(--ink);font:inherit}
.staff-customer-option:hover,.staff-customer-option.is-active{background:#eef5ff;color:var(--brand)}
.staff-customer-option strong{display:block;font-size:13px;line-height:1.3}
.staff-customer-option small{display:block;margin-top:3px;color:#718096;font-size:11px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
.staff-customer-empty{display:none;padding:12px 10px;color:#8a5a00;background:#fffaf0;border-radius:8px;font-size:12px;line-height:1.4}
.staff-customer-manage{display:block;margin-top:5px;padding:9px 10px;border-top:1px solid #edf1f5;font-size:12px;font-weight:800;color:var(--brand)}
@media(max-width:980px){.staff-customer-picker{min-width:100%;max-width:none;width:100%}.staff-customer-results{position:absolute}}
