.f-popup{position:fixed;z-index:150;background:#fff;border:1px solid #dce3ed;border-radius:12px;padding:16px;box-shadow:0 12px 42px #1f36502b;color:var(--tx);font:14px/1.5 Inter,system-ui,sans-serif;max-height:calc(100vh - 24px);overflow:auto}.f-popup-title{font-weight:600;font-size:13px;margin-bottom:13px}.f-calendar-head{display:flex;gap:7px;align-items:center;margin-bottom:16px}.f-calendar-head>button{border:1px solid var(--bd);background:white;border-radius:6px;font-size:22px;width:30px;flex:none;height:34px;cursor:pointer;color:var(--tx)}.f-calendar-head select{font-size:12px;min-height:34px!important;padding:6px 25px 6px 8px!important;background-position:right 7px center!important;min-width:0!important;width:auto;flex:1}.f-calendar-head select[aria-label="Chọn năm"]{max-width:92px}.f-weekdays,.f-calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}.f-weekdays{font-size:11px;color:var(--mu);text-align:center;margin-bottom:8px}.f-day{border:0;border-radius:7px;background:#fff;font:500 13px Inter,system-ui;color:var(--tx);height:35px;cursor:pointer;min-width:0}.f-day:hover:not(:disabled){background:#edf3ff;color:var(--pr)}.f-day.selected{background:var(--pr);color:#fff}.f-day.today:not(.selected){box-shadow:inset 0 0 0 1px #9fb7e1}.f-day:disabled{opacity:.3;cursor:not-allowed}.f-day:focus-visible{outline:2px solid var(--pr);outline-offset:1px}.f-calendar-foot{display:flex;gap:12px;justify-content:space-between;padding-top:12px;margin-top:12px;border-top:1px solid var(--bd)}.f-calendar-foot button{border:0;background:none;font:600 12px Inter;color:var(--pr);padding:5px 0;cursor:pointer}.f-calendar-foot button:disabled{opacity:.35;cursor:not-allowed}.f-date-limit{font-size:11px;color:var(--mu);margin:9px 0 0}.f-date-trigger,.f-combo-trigger{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:42px;padding:10px 12px;border:1px solid var(--bd);border-radius:7px;background:#fff;color:var(--tx);font:400 14px Inter,system-ui;text-align:left;cursor:pointer;min-width:0}.f-date-trigger svg{color:#677c97;flex:none}.f-combo-value{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.f-chevron{color:#677c97;flex:none;line-height:1;width:12px}.f-date-trigger.empty,.f-combo-trigger.empty{color:#748398}.f-date-trigger:hover:not(:disabled),.f-combo-trigger:hover:not(:disabled){border-color:#a5b8d4}.f-date-trigger[aria-expanded=true],.f-combo-trigger[aria-expanded=true]{border-color:var(--pr);box-shadow:0 0 0 3px #285dc513}.f-date-trigger:disabled,.f-combo-trigger:disabled{background:#f7f9fc;opacity:.65;cursor:not-allowed}.f-combo-trigger[aria-invalid=true]{border-color:var(--rd)}select[data-f-combo][hidden]{display:none!important}.f-popup-search{margin:-3px -3px 10px}.f-popup-search input{width:100%;min-height:40px;font-size:14px;border-radius:7px}.f-option-list{max-height:260px;overflow:auto;margin:0 -7px;padding:0 4px}.f-option-list button{display:block;text-align:left;width:100%;border:0;background:white;font:400 13px/1.6 Inter;color:var(--tx);border-radius:6px;padding:10px;cursor:pointer}.f-option-list button:hover,.f-option-list button:focus-visible{background:#edf3ff;outline:none;color:var(--pr)}.f-option-list button[aria-selected=true]{background:#edf3ff;color:var(--pr);font-weight:600}.f-no-options{font-size:13px;padding:10px;text-align:center;color:var(--mu)}.f-combo-footer{display:flex;justify-content:space-between;margin-top:10px;padding-top:10px;border-top:1px solid var(--bd)}.f-combo-footer:empty{display:none}.f-combo-footer button{border:0;background:none;font:600 12px Inter;color:var(--pr);padding:3px 0;cursor:pointer}.f-money-input{text-align:right;font-variant-numeric:tabular-nums}.uref-row>div{text-align:right}.f-pending{display:block;font-size:11px!important;color:var(--am)!important;background:var(--amb);padding:1px 6px;border-radius:4px;margin-top:5px}.f-ref-note{font-size:12px;line-height:1.7;color:var(--mu);margin:0 0 17px}.uorder-mode .uorder-table td{font-size:13px}.uorder-mode .uorder-table td small,.uorder-mode .uform-meta span,.uorder-mode .uref-product small,.uorder-mode .xmuted,.uorder-mode .ufilters select,.uorder-mode .xf>span,.uorder-mode .uallocation-total,.uorder-mode .uproduct>summary small{font-size:12px;color:var(--mu)}.uorder-mode .uref-row,.uorder-mode .uform-meta b,.uorder-mode .uallocation-fields input,.uorder-mode .uallocation-fields select,.uorder-mode .uorder-table th{font-size:12px}.uorder-mode .uorder-link,.uorder-mode .ucustomer,.uorder-mode .unext-label,.uorder-mode .upartner-label,.uorder-mode .uallocation-total b{font-size:13px}.uorder-mode .ustage-actions>div:first-child>span,.uorder-mode .ustage-actions small,.uorder-mode .uproduct>summary small,.uorder-mode .ueffect summary{font-size:12px}.uorder-mode .f-money-input{font-size:14px!important;min-height:40px;width:100%}.uorder-mode .upartner-select{grid-template-columns:110px minmax(0,1fr)}.uorder-mode .upartner-select>.f-combo-trigger{grid-column:2}.uorder-mode .xitems td:first-child>.f-combo-trigger{font-size:13px;min-height:40px}.uorder-mode .uallocation-fields{grid-template-columns:minmax(85px,1fr) minmax(145px,1.5fr) 100px}.uorder-mode .uallocations{grid-template-columns:repeat(auto-fit,minmax(min(370px,100%),1fr))}.uorder-mode .f-date-trigger{font-size:14px}.uorder-mode .ureference h2{margin-bottom:10px}.uorder-mode .uref-row{align-items:flex-start}.uorder-mode .xitems td{vertical-align:top}.uorder-mode .uallocation-fields .xf{line-height:1.6}.uorder-mode .uproduct>summary{flex-wrap:wrap}.uorder-mode .uallocation-fields .xf>span{min-height:38px;display:flex;align-items:flex-end}
@media(max-width:600px){.f-popup{max-width:calc(100vw - 24px)}.uorder-mode .upartner-select{grid-template-columns:95px minmax(0,1fr)}.uorder-mode .uallocation-fields{grid-template-columns:minmax(0,1fr) 100px}.uorder-mode .uallocation-fields>.xf:nth-child(2){grid-column:1;grid-row:2}.uorder-mode .uallocation-fields>.xf:nth-child(3){grid-column:2;grid-row:2}.uorder-mode .uallocation-fields>.xf:first-child{grid-column:1/-1}.uorder-mode .uallocation-fields .xf>span{min-height:0}.uorder-mode .ustage-actions small{font-size:11px}.uorder-mode .uform-meta{gap:18px}.uorder-mode .f-combo-trigger{font-size:13px}}

.f-date-trigger svg{position:static;display:block}.f-ref-note[hidden]{display:none}

/* Nút chính bị khóa khi chưa điền đủ trường bắt buộc */
.btn:disabled,.btn.req-locked{opacity:.45;cursor:not-allowed;box-shadow:none}
.nova-required{color:var(--rd,#b42318);font-weight:700}

/* Hộp thoại chỉ xem: không còn nút ở cuối thì ẩn luôn thanh footer (đóng bằng nút ×) */
.xmodalfoot:not(:has(button:not([hidden]))),.om-dialog-foot:not(:has(button:not([hidden]))),.nn-dialog-foot:not(:has(button:not([hidden]),a)){display:none}

/* Khung nội dung trải hết bề rộng: lề trái = lề phải ở mọi độ rộng màn hình
   (trước đây bị giới hạn 1540px và dính trái → màn hình rộng dư khoảng trống bên phải) */
main > .pg,.uorder-mode main > .pg{max-width:none}

/* Toast: góc trên bên phải, dưới header; màu theo loại; rõ ở cả chế độ sáng / tối */
.mk-toasts{position:fixed;top:calc(84px + env(safe-area-inset-top,0px));right:24px;z-index:1000;display:flex;flex-direction:column;align-items:flex-end;gap:8px;pointer-events:none}
.mk-toast{--accent:var(--bl,#245bc4);pointer-events:auto;cursor:pointer;display:flex;align-items:flex-start;gap:10px;max-width:min(420px,calc(100vw - 48px));padding:12px 16px 12px 12px;border:1px solid var(--bd);border-left:4px solid var(--accent);border-radius:10px;background:var(--sf);color:var(--tx);font-size:13px;line-height:1.45;box-shadow:0 8px 24px rgba(15,23,42,.14);animation:mk-toast-in .22s ease-out}
.mk-toast.success{--accent:var(--gr,#187452)}
.mk-toast.error{--accent:var(--rd,#b42318)}
.mk-toast-icon{flex:none;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--accent);color:#fff;font-size:12px;font-weight:700;line-height:1}
:root[data-theme="dark"] .mk-toast-icon{color:var(--bg)}
.mk-toast-text{padding-top:1px}
.mk-toast.out{animation:mk-toast-out .2s ease-in forwards}
@keyframes mk-toast-in{from{opacity:0;transform:translateX(16px)}to{opacity:1;transform:none}}
@keyframes mk-toast-out{to{opacity:0;transform:translateX(16px)}}
@media(max-width:600px){.mk-toasts{top:calc(72px + env(safe-area-inset-top,0px));left:16px;right:16px;align-items:stretch}.mk-toast{max-width:none}}
@media(prefers-reduced-motion:reduce){.mk-toast,.mk-toast.out{animation:none}}

/* Trường chỉ đọc (do hệ thống quyết định): nền xám, chữ nhạt, biểu tượng khóa, không cho gõ */
:is(input,textarea)[readonly]:not([type=checkbox]):not([type=radio]):not([type=hidden]){background:var(--sf2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") no-repeat right 10px center/14px;color:var(--mu);cursor:default;padding-right:32px;box-shadow:none}
:is(input,textarea)[readonly]:focus{outline:none;border-color:var(--bd)}
.xc-fixed-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 12px}
.xc-fixed-fields small{font-size:11px;color:var(--mu)}
.sa-field-wide{grid-column:1/-1}
@media(max-width:600px){.xc-fixed-fields{grid-template-columns:1fr}}
/* Bước 14: thông tin xác nhận đã tính PAKD */
.xacc-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 24px;margin:16px 0 0}
.xacc-meta div{min-width:0}.xacc-meta .wide{grid-column:1/-1}
.xacc-meta dt{font-size:12px;color:var(--mu);margin-bottom:2px}.xacc-meta dd{margin:0;font-weight:600;overflow-wrap:anywhere}
@media (max-width:640px){.xacc-meta{grid-template-columns:1fr}}
