/* egx-demo.css — trich NGUYEN VAN khoi <style> cua employee-green/mau.html
 * (khung demo .demo-* + component .egx-* phuc vu gallery /home/template).
 * - Da BO: .demo-wrap (padding chuyen sang .egx-page), .demo-top* (h1/p), .demo-back*
 *   (markup tuong ung da xoa; nut back thay bang data-route, tieu de do app render).
 * - GiU NGUYEN moi thu con lai ke ca html.dark / @media / @keyframes / @font-face.
 * Nap TOAN CUC trong index.html (cung employee-green/style.css).
 */
/* Khung rieng cua trang mau (chi dung o mau.html) */
.demo-sec { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin-bottom: 14px; }
.demo-sec > h2 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.demo-sec > p { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.demo-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.demo-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.demo-note { font-size: 11px; color: var(--muted); background: var(--soft); border: 1px dashed var(--line);
    border-radius: 6px; padding: 8px 12px; margin-bottom: 14px; }
.demo-note code { font-family: ui-monospace, monospace; font-size: 11px; }
/* Nhan cot kem icon cho bang demo (mobile): desktop an vi da co thead */
.c-lbl { display: none; }
/* Dai so lieu (4 · The & so lieu): 3 chi so cung 1 hang ngang, chi ngan
   cach bang 1 vach DOC NGAN (cao ~26px, can giua) giua cac o — khong
   khung, khong vien bao ngoai, khong vach full-height. */
.demo-statrow {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    background: none; border: 0; border-radius: 0; overflow: visible;
}
/* border:0 phủ luôn rule gốc .egl-stat:nth-child(n+3){border-top} của
   employee-green (mobile <=640) — nếu không, ô thứ 3 bị kẻ vạch trên. */
.demo-statrow .egl-stat { position: relative; padding: 10px 16px; border: 0; }
/* Nhan chiem chieu cao CO DINH (2 dong) de gia tri cua 3 chi so luon bang
   ngang nhau, du nhan dai/ngan khac nhau. */
.demo-statrow .egl-stat .sl {
    min-height: 22px; display: flex; align-items: center; justify-content: center;
}
.demo-statrow .egl-stat + .egl-stat { border-left: 0; }
.demo-statrow .egl-stat + .egl-stat::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 1px; height: 26px; background: var(--line);
}
@media (max-width: 640px) {
    .demo-statrow .egl-stat { padding: 9px 14px; }
    /* Nhan duoc xuong dong + nho hon tren mobile -> khong con tran sat
       vach doc hai ben (lab 9px, khong dung so thap phan theo FontSize.md) */
    .demo-statrow .egl-stat .sl { white-space: normal; line-height: 1.25; text-align: center; font-size: 9px; }
    .demo-statrow .egl-stat + .egl-stat::before { height: 22px; }
}
/* The kieu fieldset: tieu de nam de len vien net dut (goc trai ben tren), GIA TRI canh giua 2 chieu */
.elb-vcard.egx-legend,
.elb-vcard.egx-legend-m { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; }
.elb-vcard .egx-vlegend { position: absolute; top: -7px; left: 10px; display: inline-flex; align-items: center; gap: 6px;
    font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em;
    background: var(--card); padding: 0 6px; white-space: nowrap; max-width: calc(100% - 20px);
    overflow: hidden; text-overflow: ellipsis; border-radius: 6px; }
.elb-vcard .egx-vlegend i { font-size: 11px; flex: none; }
/* Tooltip PC cho nut icon thang (chi hien tren thiet bi co hover + con tro chinh xac) */
@media (hover: hover) and (pointer: fine) {
    #buttons .egl-mbtn[data-tip] { position: relative; }
    #buttons .egl-mbtn[data-tip]:hover::after {
        content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
        background: var(--card); color: var(--text); border: 1px solid var(--line);
        font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px; white-space: nowrap;
        box-shadow: 0 8px 20px rgba(0, 0, 0, .18); z-index: 50; pointer-events: none; }
}
/* Toast mau dung bo cuc + hieu ung lunasoft (app.css .toast + toast.js),
   doi token sang xanh la cua lab */
.egx-toast { position: fixed; top: 72px; right: 16px; z-index: 14000;
    transform: translateX(120%); display: flex; align-items: flex-start; gap: 10px;
    width: max-content; min-width: 280px; max-width: min(420px, calc(100vw - 32px));
    padding: 12px 14px 14px; overflow: hidden; border-radius: 6px; isolation: isolate;
    background: var(--card); border: 1px solid var(--acc); color: var(--text); font-size: 13px; text-align: left;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .35), 0 0 18px -6px rgba(16, 185, 129, .45);
    opacity: 0; pointer-events: none; will-change: transform, opacity;
    transition: opacity .28s var(--ease), transform .28s var(--ease); }
.egx-toast.is-show { opacity: 1; transform: translateX(0); pointer-events: auto; animation: egx-in .32s var(--ease) both; }
@keyframes egx-in { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.egx-toast.is-error { border-color: var(--bad); box-shadow: 0 18px 44px rgba(0,0,0,.35), 0 0 18px -6px rgba(185,28,28,.5); }
.egx-toast.is-info { border-color: #2b8cff; box-shadow: 0 18px 44px rgba(0,0,0,.35), 0 0 18px -6px rgba(43,140,255,.45); }
.egx-toast.is-warning { border-color: var(--warn); box-shadow: 0 18px 44px rgba(0,0,0,.35), 0 0 18px -6px rgba(180,83,9,.5); }
.egx-ticon { flex: none; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 14px; color: var(--acc); background: rgba(16, 185, 129, .12); }
.egx-toast.is-error .egx-ticon { color: var(--bad); background: rgba(185, 28, 28, .12); }
.egx-toast.is-info .egx-ticon { color: #2b8cff; background: rgba(43, 140, 255, .14); }
.egx-toast.is-warning .egx-ticon { color: var(--warn); background: rgba(180, 83, 9, .14); }
.egx-tbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.egx-ttitle { font-size: 13px; font-weight: 700; letter-spacing: .2px; }
.egx-tmsg { line-height: 1.5; overflow-wrap: break-word; word-break: normal; }
.egx-tcode { display: none; align-self: flex-start; margin-top: 4px; padding: 2px 8px; border-radius: 999px;
    border: 1px solid var(--line); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: .4px; color: var(--muted); }
.egx-tcode.is-show { display: inline-block; }
/* Vien + chu chip ma loi an theo trang thai (giong icon + thanh bar) */
.egx-toast.is-ok .egx-tcode { border-color: rgba(16, 185, 129, .45); color: var(--acc); }
.egx-toast.is-error .egx-tcode { border-color: rgba(185, 28, 28, .55); color: var(--bad); }
.egx-toast.is-info .egx-tcode { border-color: rgba(43, 140, 255, .55); color: #2b8cff; }
.egx-toast.is-warning .egx-tcode { border-color: rgba(180, 83, 9, .6); color: var(--warn); }
.egx-tclose { flex: none; background: none; border: 0; padding: 2px 4px; font-size: 13px;
    color: var(--muted); cursor: pointer; border-radius: 6px; }
.egx-tclose:hover { color: var(--text); }
/* Thanh tien trinh tach layer GPU rieng: khong keo ca toast (ke ca bong glow)
   ve lai moi frame -> het vet nhoe khi dem lui */
.egx-tbar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
    transform-origin: left center; background: var(--acc);
    will-change: transform; backface-visibility: hidden; contain: paint; }
.egx-toast.is-error .egx-tbar { background: var(--bad); }
.egx-toast.is-info .egx-tbar { background: #2b8cff; }
.egx-toast.is-warning .egx-tbar { background: var(--warn); }
@media (max-width: 768px) { .egx-toast { top: 68px; right: 12px; } }
/* Pipeline port tu lunasoft .tpl-pipe: token xanh la lab, radius 6px */
.egx-pipe { display: flex; flex-direction: column; gap: 12px; margin-top: 12px;
    background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.egx-pipe-head { display: flex; align-items: center; gap: 12px; }
.egx-pipe-id { flex: none; width: 40px; height: 40px; border-radius: 6px; background: var(--card);
    border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--acc); }
.egx-pipe-id.is-spinning i { animation: egx-spin .8s linear infinite; }
@keyframes egx-spin { to { transform: rotate(360deg); } }
.egx-pipe-titles { flex: 1; min-width: 0; }
.egx-pipe-title { font-size: 13px; font-weight: 700; }
.egx-pipe-sub { font-size: 11px; color: var(--muted); }
.egx-pipe-count { font-weight: 800; color: var(--acc); }
.egx-pipe-pct { flex: none; padding: 4px 10px; border-radius: 6px; background: var(--card);
    border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--acc); }
.egx-pipe-trough { width: 100%; height: 14px; border-radius: 6px; background: var(--card);
    border: 1px solid var(--line); padding: 2px; overflow: hidden; }
.egx-pipe-bar { height: 100%; width: 0; border-radius: 6px;
    background: linear-gradient(to right, var(--acc2), var(--acc), var(--brandA));
    transition: width .3s ease; will-change: width; }
.egx-pipe-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.egx-pipe-step { padding: 8px 4px; border-radius: 6px; background: var(--card); border: 1px solid var(--line);
    font-size: 10px; font-weight: 700; color: var(--muted); transition: all .2s ease; }
.egx-pipe-step.is-active { color: var(--acc); border-color: var(--acc); background: var(--soft); }
.egx-pipe-step.is-done { color: var(--ok); }
.egx-pipe-step.is-error { color: var(--bad); border-color: var(--bad); }
.egx-pipe-bar.is-error { background: linear-gradient(to right, color-mix(in srgb, var(--bad) 70%, var(--card)), var(--bad)); }
.egx-pipe-done.is-fail { border-color: var(--bad); }
.egx-pipe-done.is-fail .egx-pipe-id { color: var(--bad); }
.egx-pipe-retry { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; color: var(--bad); border: 1px solid var(--bad);
    background: none; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-family: inherit; }
.egx-pipe-retry:hover { background: rgba(185, 28, 28, .1); }
.egx-pipe-run.is-busy { opacity: .6; pointer-events: none; }
.egx-pipe-done { display: flex; align-items: center; gap: 12px; background: var(--card);
    border: 1px solid var(--acc); border-radius: 6px; padding: 12px 14px; animation: pop .25s var(--ease); }
.egx-pipe-ready { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--acc);
    border: 1px solid var(--acc); border-radius: 999px; padding: 4px 12px; }
/* Preloader port tu lunasoft .preloader: overlay + card + fan xoay + thanh sweep */
.egx-pre[hidden] { display: none !important; }
.egx-pre { position: fixed; inset: 0; z-index: 13000; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .18s ease-out; }
.egx-pre.is-show { opacity: 1; pointer-events: auto; }
/* Hieu ung vao DONG BO pipeline: card troi tu duoi len + scale (pop .3s) + cac khoi noi tiep */
.egx-pre.is-show .egx-pre-card { animation: egx-pre-in .3s var(--ease) both; }
@keyframes egx-pre-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.egx-pre.is-show .egx-pre-logo { animation: elb-av .4s var(--ease) .05s both; }
.egx-pre.is-show .egx-pre-text { animation: elb-sec .3s var(--ease) .1s both; }
.egx-pre.is-show .egx-pre-trough { animation: elb-sec .3s var(--ease) .16s both; }
.egx-pre-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
    border-radius: 6px; box-shadow: 0 18px 44px rgba(0, 0, 0, .35); padding: 28px;
    display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.egx-pre-logo { width: 76px; height: 76px; border-radius: 50%; background: var(--soft);
    border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.egx-pre .egl-fan .canvas { width: 72px; height: 72px; }
.egx-pre .egl-fan .icon-wrapper { transform: translate(-50%, -50%) scale(.35); }
.egx-pre-text { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.egx-pre-text h3, .egx-pre-text p { margin: 0; }
.egx-pre-title { font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.egx-pre-status { font-size: 12px; color: var(--muted); }
.egx-pre-trough { position: relative; width: 100%; height: 14px; border-radius: 6px; background: var(--soft);
    border: 1px solid var(--line); padding: 2px; overflow: hidden; }
.egx-pre-bar.is-indeterminate { position: absolute; top: 0px; bottom: 0px; background: linear-gradient(90deg, var(--acc2), var(--acc), var(--acc2));
    border-radius: 6px; animation: egx-sweep 1.8s ease-in-out infinite; }
@keyframes egx-sweep { 0% { left: -35%; right: 100%; } 60% { left: 100%; right: -90%; } 100% { left: 100%; right: -90%; } }
@media (max-width: 640px) { .egx-pipe-steps { grid-template-columns: repeat(2, 1fr); } }
/* Tat ca popup mau: om sat noi dung + gioi han theo thiet bi (kieu lunasoft .tpl-pdf-card) */
[data-demomodalbox] .egl-panel,
[data-pipemodalbox] .egl-panel,
[data-pipeerrmodalbox] .egl-panel,
[data-pdfmodalbox] .egl-panel {
    height: auto; max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden;
}
[data-demomodalbox] .egl-pbody,
[data-pipemodalbox] .egl-pbody,
[data-pipeerrmodalbox] .egl-pbody,
[data-pdfmodalbox] .egl-pbody { min-height: 0; overflow-y: auto; }
/* Tat ca popup: can giua doc + ngang, om noi dung + cap theo thiet bi */
[data-demomodalbox] .egl-panel,
[data-pipemodalbox] .egl-panel,
[data-pipeerrmodalbox] .egl-panel,
[data-pdfmodalbox] .egl-panel { top: 50%; bottom: auto; transform: translate(-50%, -50%); }
@media (max-width: 1024px) {
    [data-demomodalbox] .egl-panel,
    [data-pipemodalbox] .egl-panel,
    [data-pipeerrmodalbox] .egl-panel,
    [data-pdfmodalbox] .egl-panel { max-height: 86vh; max-height: 86dvh; }
}
@media (max-width: 640px) {
    [data-demomodalbox] .egl-panel,
    [data-pipemodalbox] .egl-panel,
    [data-pipeerrmodalbox] .egl-panel,
    [data-pdfmodalbox] .egl-panel { max-height: 80vh; max-height: 80dvh; width: min(560px, calc(100% - 24px)); bottom: auto; }
}
/* Bo o nhap du lieu lab: nhan + hop vien + badge icon + focus accent */
.egx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.egx-flabel { font-size: 12px; font-weight: 600; color: var(--text); }
.egx-flabel em { font-style: normal; color: var(--bad); }
/* Ghi chu trong form (note box): ngoai hinh copy y .demo-note cua gallery
   (nen soft + vien dashed + chu muted), tach thanh class lab .egx-note
   de trang app dung duoc (demo-* cam trong app). Khong margin ngoai vi
   nam trong .egx-field (gap dam nhan). */
.egx-note { font-size: 11px; color: var(--muted); background: var(--soft); border: 1px dashed var(--line);
    border-radius: 6px; padding: 8px 12px; }
.egx-fbox { display: flex; align-items: stretch; background: var(--card); border: 1px solid var(--line);
    border-radius: 6px; transition: border-color .2s, box-shadow .2s; position: relative; }
.egx-fbox:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
/* Icon doi theo vien: focus hoac co du lieu -> accent */
.egx-fbox:focus-within .egx-fbadge, .egx-fbox.is-filled .egx-fbadge { color: var(--acc); border-right-color: var(--acc); }
.egx-fbox.is-filled { border-color: var(--acc); }
/* O da sua so voi ban goc (dirty): vien warning + chu nhuom warning.
   Dung chung cho .egx-fbox va .egx-udrop (bo chon pill) — xem
   rules/UI-Components.md muc "UI moi them vao lab CSS".
   Selector input phai kem :not(...) giong het rule goc cua lab
   (.egx-fbox input:not(...):not(...):not(...):not(...)) thi moi
   THANG do — neu thieu, mau chu van bi rule goc ghi de. */
.egx-fbox.is-dirty, .egx-udrop.is-dirty { border-color: var(--warn); }
.egx-fbox.is-dirty input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
.egx-fbox.is-dirty textarea,
.egx-fbox.is-dirty .egx-ftrigger,
.egx-udrop.is-dirty input,
.egx-udrop.is-dirty .egx-ftrigger { color: var(--warn); font-weight: 600; }
.egx-udrop.is-filled { border-color: var(--acc); }
/* Nhan + icon trang thai sat me phai (success/warning/error) kieu lunasoft tpl-ipill-state */
.egx-flabel { display: flex; align-items: center; gap: 6px; }
.egx-state { display: inline-flex; align-items: center; font-size: 12px; flex: none; margin-left: auto; }
.egx-state[data-egx-state="success"] { color: var(--ok); }
.egx-state[data-egx-state="warning"] { color: var(--warn); }
.egx-state[data-egx-state="error"] { color: var(--bad); }
.egx-state[data-egx-state="none"] { display: none; }
.egx-state[data-tip] { position: relative; cursor: help; outline: none; }
@media (hover: hover) and (pointer: fine) {
    .egx-state[data-tip]:hover::after, .egx-state[data-tip]:focus-visible::after {
        content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0;
        width: max-content; max-width: 220px; white-space: normal;
        background: var(--card); color: var(--text); border: 1px solid var(--line);
        font-size: 11px; font-weight: 600; padding: 6px 10px; border-radius: 6px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, .25); z-index: 60; }
    /* JS da mo tooltip body (.is-tip-open) -> tat tooltip CSS tranh hien doi. */
    .egx-state.is-tip-open[data-tip]:hover::after,
    .egx-state.is-tip-open[data-tip]:focus-visible::after { display: none; }
}
.egx-state[data-tip]:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 50%; }
/* Tooltip loi validate body-level (JS render, DesignUI §12): Windows hien
   khi hover icon, tablet/mobile hien khi cham. Ngoai hinh giong tooltip
   CSS ::after de nhat quan moi nen tang; vien doi mau theo muc do loi. */
.egx-utip { position: fixed; z-index: 13500; max-width: min(280px, calc(100vw - 24px));
    background: var(--card); color: var(--text); border: 1px solid var(--line);
    font-size: 11px; font-weight: 600; padding: 6px 10px; border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25); pointer-events: none;
    overflow-wrap: break-word; word-break: normal; }
.egx-utip.is-error { border-color: var(--bad); }
.egx-utip.is-warning { border-color: var(--warn); }
.egx-utip.is-success { border-color: var(--acc); }
/* Vien hop input doi mau theo trang thai validate */
.egx-field.is-invalid .egx-fbox, .egx-field.is-invalid .egx-udrop { border-color: var(--bad); }
.egx-field.is-valid .egx-fbox, .egx-field.is-valid .egx-udrop { border-color: var(--ok); }
.egx-field.is-warn .egx-fbox, .egx-field.is-warn .egx-udrop { border-color: var(--warn); }
.egx-fbadge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px;
    color: var(--muted); font-size: 14px; border-right: 1px solid var(--line); background: var(--soft);
    border-radius: 6px 0 0 6px; }
.egx-fbox input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]), .egx-fbox textarea { flex: 1; min-width: 0; border: 0; background: none; outline: none;
    padding: 10px 12px; font-size: 13px; font-family: inherit; color: var(--text); color-scheme: light; }
html.dark .egx-fbox input { color-scheme: dark; }
.egx-fbox textarea { resize: vertical; }
.egx-fbox input::placeholder, .egx-fbox textarea::placeholder { color: var(--muted); }
/* Gallery demo (/home/template): nhan trigger dropdown khi CHUA chon hien
   mau placeholder (var(--muted)) nhu ::placeholder cua o text "Ho va ten"
   (tren); co gia tri (fbox.is-filled do JS gallery toggle khi pick/done/
   check) thi ve mau var(--text) cua .egx-ftrigger. Scope rieng hook demo
   data-egx-* de khong anh huong dropdown cac trang app. */
[data-egx-select].egx-fbox:not(.is-filled) [data-egx-value],
[data-egx-date].egx-fbox:not(.is-filled) [data-egx-dvalue],
[data-egx-time].egx-fbox:not(.is-filled) [data-egx-tvalue],
[data-egx-dt].egx-fbox:not(.is-filled) [data-egx-dtvalue],
[data-egx-select2].egx-fbox:not(.is-filled) [data-egx-value2],
[data-egx-multi].egx-fbox:not(.is-filled) [data-egx-mvalue] { color: var(--muted); }
/* Dispatch_out/in + company/shift: nhan trigger dropdown khi CHUA chon
   (pick text) mau placeholder (var(--muted)) nhu template tren; co gia
   tri (fbox.is-filled do setSel/syncStates toggle, hoac .selected tren
   nhan nhu employee/shift) thi mau var(--text). Scope rieng
   [data-do-sel]/[data-di-sel]/[data-co-type]/[data-sh-sel]/
   [data-sh-timebox]/[data-ho-datebox] trong modal — cung cong thuc template (DesignUI
   §12), khong che rieng.
   Employee dung co che rieng (JS gan .selected TRUC TIEP len nhan thay
   vi is-filled tren fbox — xem setSel/setDate) nen rule scope
   [data-em-sel]/[data-em-date] bat theo :not(.selected). */
[data-do-modal] [data-do-sel].egx-fbox:not(.is-filled) [data-ipill-value],
[data-do-import] [data-do-sel].egx-fbox:not(.is-filled) [data-ipill-value],
[data-do-exportov] [data-do-sel].egx-fbox:not(.is-filled) [data-ipill-value],
[data-di-modal] [data-di-sel].egx-fbox:not(.is-filled) [data-ipill-value],
[data-di-import] [data-di-sel].egx-fbox:not(.is-filled) [data-ipill-value],
[data-di-exportov] [data-di-sel].egx-fbox:not(.is-filled) [data-ipill-value],
[data-co-modal] [data-co-type].egx-fbox:not(.is-filled) [data-ipill-value],
[data-em-modal] [data-em-sel] [data-ipill-value]:not(.selected),
[data-em-modal] [data-em-date] [data-ipill-datelabel]:not(.selected),
[data-sh-modal] [data-sh-sel] [data-ipill-value]:not(.selected),
[data-sh-modal] [data-sh-timebox] [data-ipill-timelabel]:not(.selected),
[data-ho-modal] [data-ho-datebox] [data-ipill-datelabel]:not(.selected),
[data-dp-modal] [data-dp-fcompany] [data-ipill-value]:not(.selected),
[data-dp-modal] [data-dp-fdept] [data-ipill-value]:not(.selected),
[data-dp-modal] [data-dp-fpos] [data-ipill-value]:not(.selected) { color: var(--muted); }
/* O chi doc (readonly): nen pha accent + giam opacity toan o de phan
   biet ro voi o nhap thuong (nen trong suot/card) — giong badge (cung ho
   accent) nen ca o nhin nhu khoi thong tin, khong phai o nhap. Dung
   color-mix thay vi var(--soft) don thuan: soft gan nhu vo hinh o dark
   (#0E1A12 vs card #0B120C). Opacity 0.28 (= 0.56 giam 50%): bot sang,
   van nhin thay; van focus + copy duoc (khac disabled).
   Ap dung TOAN lab (moi trang co o readonly tu co hieu ung, khong can
   rule rieng tung trang). KHONG doi vien (DesignUI §12). */
.egx-fbox:has(> input[readonly]), .egx-fbox:has(> textarea[readonly]) { background: color-mix(in srgb, var(--acc) 10%, var(--card)); opacity: .28; }
.egx-feye { flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 12px; font-size: 14px; }
.egx-feye:hover { color: var(--acc); }
.egx-fsteps { flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--line);
    border-radius: 0 6px 6px 0; overflow: hidden; }
.egx-fsteps button { flex: 1; border: 0; background: var(--soft); color: var(--muted); cursor: pointer;
    padding: 2px 10px; font-size: 10px; }
.egx-fsteps button:hover { color: var(--acc); }
.egx-fsteps button + button { border-top: 1px solid var(--line); }
.egx-ftrigger { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    border: 0; background: none; padding: 10px 12px; font-size: 13px; font-family: inherit; color: var(--text); cursor: pointer; }
.egx-ftrigger i { font-size: 12px; color: var(--muted); }
.egx-fdrop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--card);
    border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: grid; gap: 2px;
    width: max-content; min-width: 100%; max-width: calc(100vw - 32px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .25); }
.egx-ddrop { padding: 10px; width: max(100%, 244px); }
.egx-fdrop[hidden] { display: none; }
.egx-fdrop button { border: 0; background: none; text-align: left; padding: 9px 12px; font-size: 13px;
    font-family: inherit; color: var(--text); border-radius: 6px; cursor: pointer; }
.egx-fdrop button:hover { background: var(--soft); color: var(--acc); }
/* Muc dang chon trong dropdown: nen soft + chu accent + dau tick */
.egx-fdrop [data-egx-opt].is-sel, .egx-fdrop [data-egx-opt2].is-sel { background: var(--soft); color: var(--acc); font-weight: 700; }
.egx-fdrop [data-egx-opt].is-sel::after, .egx-fdrop [data-egx-opt2].is-sel::after { content: '\2713'; margin-left: auto; font-weight: 700; }
.egx-fdrop [data-egx-opt], .egx-fdrop [data-egx-opt2] { display: flex; align-items: center; gap: 8px; }
/* Dropdown co tim kiem + check nhieu + swatch mau + tag + upload */
.egx-fsearch { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line);
    color: var(--muted); font-size: 12px; background: var(--card); }
.egx-fsearch input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13px; font-family: inherit; color: var(--text); }
.egx-fdrop [data-egx-list] { display: grid; gap: 2px; max-height: 180px; overflow-y: auto; }
.egx-fcheck { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 13px;
    border-radius: 6px; cursor: pointer; color: var(--text); }
.egx-fcheck:hover { background: var(--soft); }
.egx-fcheck input { accent-color: var(--acc); width: 15px; height: 15px; }
/* Nhieu lua chon inline kieu lunasoft: option nam truc tiep trong o, dem tren nhan */
.egx-opts { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 8px 12px; }
.egx-opt { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 4px 16px 4px 6px;
    border-radius: 6px; background: var(--card); border: 1px solid var(--line);
    font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap;
    transition: border-color .2s, color .2s; }
.egx-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.egx-optbox { width: 24px; height: 24px; border-radius: 4px; flex: none; display: inline-flex; align-items: center;
    justify-content: center; background: var(--soft); border: 1px solid var(--line); color: transparent; font-size: 12px; }
.egx-opt:has(input:checked) { color: var(--text); border-color: var(--acc); font-weight: 600; }
.egx-opt:has(input:checked) .egx-optbox { color: var(--acc); border-color: var(--acc); }
.egx-opt:has(input:focus-visible) { outline: 2px solid var(--acc); outline-offset: 2px; }
/* Bang mau kieu lunasoft: trigger (hex + cham mau) + drop (tieu de + chip, swatch, RGB, hex + Ap dung) */
.egx-cdot2 { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--acc); }
.egx-ctitle { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; padding: 4px 6px; }
.egx-cchip { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.egx-csub { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 6px 2px; }
.egx-cgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 6px; }
.egx-cgrid button { aspect-ratio: 1 / 1; border-radius: 50%; border: 2px solid var(--card); cursor: pointer;
    background: var(--sw); box-shadow: 0 0 0 1px var(--line); min-width: 0; }
.egx-cgrid button:hover { transform: scale(1.15); }
.egx-crows { display: grid; gap: 6px; padding: 2px 6px; }
.egx-crow { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
.egx-crow input[type="range"] { flex: 1; min-width: 0; accent-color: var(--acc); }
.egx-crow span:last-child { font-family: ui-monospace, monospace; min-width: 28px; text-align: right; color: var(--text); font-weight: 400; }
.egx-chexrow { display: flex; align-items: center; gap: 8px; padding: 8px 6px 4px; font-size: 12px; color: var(--muted); }
.egx-chexrow input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: none; outline: none;
    padding: 8px 10px; font-size: 12px; font-family: ui-monospace, monospace; text-transform: uppercase; color: var(--text); }
.egx-chexrow input:focus { border-color: var(--acc); }
.egx-fdrop .egx-capply { flex: none; border: 0; background: var(--acc); color: #fff; border-radius: 6px;
    padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit;
    box-shadow: 0 8px 24px rgba(16, 185, 129, .25); transition: all .3s var(--ease); white-space: nowrap; }
html.dark .egx-fdrop .egx-capply { color: #04120a; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.egx-fdrop .egx-capply:hover { transform: translateY(-2px); background: var(--acc); color: #fff; filter: brightness(1.06); }
html.dark .egx-fdrop .egx-capply:hover { color: #04120a; }
/* Huy hieu 6 cap quyen kieu lunasoft nhung mau theo theme lab */
:root {
    --rlv0a: #6b7a6e; --rlv0b: #4a554d;
    --rlv1a: #0e7c6b; --rlv1b: #0a5c50;
    --rlv2a: #1d5fc2; --rlv2b: #174a96;
    --rlv3a: #6d28d9; --rlv3b: #551fa8;
    --rlv4a: #047857; --rlv4b: #065f46;
    --rlv5a: #d97706; --rlv5b: #92400e;
}
html.dark {
    --rlv0a: #9db3a4; --rlv0b: #6b7f72;
    --rlv1a: #5fd6c0; --rlv1b: #2ea88f;
    --rlv2a: #6ea8ff; --rlv2b: #3b82f6;
    --rlv3a: #a78bfa; --rlv3b: #7c3aed;
    --rlv4a: #34d399; --rlv4b: #10b981;
    --rlv5a: #fcd34d; --rlv5b: #f59e0b;
}
@keyframes egx-textclip { to { background-position: 200% center; } }
.egx-role { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.6px; text-align: center; padding: 2px 12px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card); }
.egx-role > span { display: inline-block; }
@supports (-webkit-background-clip: text) {
    .egx-role > span { background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
        -webkit-text-fill-color: transparent; animation: egx-textclip 1.05s linear infinite; }
    .egx-role.role-lv-0 > span { background-image: linear-gradient(90deg, var(--rlv0a), var(--rlv0b), var(--rlv0a)); }
    .egx-role.role-lv-1 > span { background-image: linear-gradient(90deg, var(--rlv1a), var(--rlv1b), var(--rlv1a)); }
    .egx-role.role-lv-2 > span { background-image: linear-gradient(90deg, var(--rlv2a), var(--rlv2b), var(--rlv2a)); }
    .egx-role.role-lv-3 > span { background-image: linear-gradient(90deg, var(--rlv3a), var(--rlv3b), var(--rlv3a)); }
    .egx-role.role-lv-4 > span { background-image: linear-gradient(90deg, var(--rlv4a), var(--rlv4b), var(--rlv4a)); }
    .egx-role.role-lv-5 > span { background-image: linear-gradient(90deg, var(--rlv5a), var(--rlv5b), var(--rlv5a)); }
}
@media (prefers-reduced-motion: reduce) { .egx-role > span { animation: none; } }
/* Toc do shimmer chu tang dan nhe theo cap (0 cham nhat, 5 nhanh nhat) */
.egx-role.role-lv-0 > span { animation-duration: 3.2s; }
.egx-role.role-lv-1 > span { animation-duration: 2.8s; }
.egx-role.role-lv-2 > span { animation-duration: 2.4s; }
.egx-role.role-lv-3 > span { animation-duration: 2s; }
.egx-role.role-lv-4 > span { animation-duration: 1.7s; }
.egx-role.role-lv-5 > span { animation-duration: 1.4s; }
/* Trang thai nhan su (rieng trang mau): vao so le + tho nhe theo ngu nghia.
   Ca 3 trang thai deu co nhip sang nhap nhay cung cuong do (chi khac mau
   theo ngu nghia): Chinh thuc cham (4.5s), Thu viec nhanh (3.2s),
   Da nghi trung binh (3.6s). */
@keyframes egx-stin { from { opacity: 0; transform: translateY(8px); } }
#badges .elb-vpill.is-ok { animation: egx-stin .5s ease both, egx-stok 4.5s ease-in-out infinite; }
#badges .elb-vpill.is-warn { animation: egx-stin .5s ease .08s both, egx-stwarn 3.2s ease-in-out infinite; }
#badges .elb-vpill.is-bad { animation: egx-stin .5s ease .16s both, egx-stbad 3.6s ease-in-out infinite; }
/* Cung cong thuc 3px -> 11px, 25% -> 55% nhu egx-stwarn, doi mau theo
   trang thai -> ba pill sang nhap nhay dong deu nhau. */
@keyframes egx-stok {
    0%, 100% { box-shadow: 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
    50% { box-shadow: 0 0 11px color-mix(in srgb, var(--ok) 55%, transparent); }
}
@keyframes egx-stwarn {
    0%, 100% { box-shadow: 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
    50% { box-shadow: 0 0 11px color-mix(in srgb, var(--warn) 55%, transparent); }
}
@keyframes egx-stbad {
    0%, 100% { box-shadow: 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
    50% { box-shadow: 0 0 11px color-mix(in srgb, var(--bad) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) { #badges .elb-vpill { animation: none; } }
/* Hieu ung vao nhe: tung cap noi nhau khi mo trang (ket hop voi hieu ung lap vo han) */
@keyframes egx-enter { from { opacity: 0; transform: translateY(8px); } }
/* Cap 0 (thap nhat): chi co hieu ung vao, khong hieu ung lap — lam moc so sanh */
.egx-role.role-lv-0 { animation: egx-enter .5s ease both; }
/* Cap 1: vien pha mau cap + hao quang tho rat nhe, cham */
.egx-role.role-lv-1 { border-color: color-mix(in srgb, var(--rlv1a) 35%, var(--line)); animation: egx-enter .5s ease .06s both, egx-lv1 4.5s ease-in-out infinite; }
@keyframes egx-lv1 {
    0%, 100% { box-shadow: 0 0 2px color-mix(in srgb, var(--rlv1a) 18%, transparent); }
    50% { box-shadow: 0 0 7px color-mix(in srgb, var(--rlv1a) 40%, transparent); }
}
/* Cap 2: hao quang nhe, nhanh hon cap 1 mot chut */
.egx-role.role-lv-2 { border-color: color-mix(in srgb, var(--rlv2a) 40%, var(--line)); animation: egx-enter .5s ease .12s both, egx-lv2 4s ease-in-out infinite; }
@keyframes egx-lv2 {
    0%, 100% { box-shadow: 0 0 3px color-mix(in srgb, var(--rlv2a) 22%, transparent); }
    50% { box-shadow: 0 0 9px color-mix(in srgb, var(--rlv2a) 48%, transparent); }
}
/* Cap 3: hao quang nhe + tia sang mo quet ngang pill */
.egx-role.role-lv-3 { border-color: color-mix(in srgb, var(--rlv3a) 45%, var(--line)); animation: egx-enter .5s ease .18s both, egx-lv3 3.6s ease-in-out infinite; }
@keyframes egx-lv3 {
    0%, 100% { box-shadow: 0 0 3px color-mix(in srgb, var(--rlv3a) 25%, transparent); }
    50% { box-shadow: 0 0 11px color-mix(in srgb, var(--rlv3a) 52%, transparent); }
}
/* Cap 4: nhu cap 3 nhung nhe manh + nhanh hon mot chut */
.egx-role.role-lv-4 { border-color: color-mix(in srgb, var(--rlv4a) 50%, var(--line)); animation: egx-enter .5s ease .24s both, egx-lv4 3.2s ease-in-out infinite; }
@keyframes egx-lv4 {
    0%, 100% { box-shadow: 0 0 4px color-mix(in srgb, var(--rlv4a) 28%, transparent); }
    50% { box-shadow: 0 0 13px color-mix(in srgb, var(--rlv4a) 58%, transparent); }
}
/* Tia sang quet ngang cho cap 3/4/5 (toc do tang dan) */
.egx-role.role-lv-3, .egx-role.role-lv-4, .egx-role.role-lv-5 { position: relative; overflow: hidden; }
.egx-role.role-lv-3::after, .egx-role.role-lv-4::after, .egx-role.role-lv-5::after {
    content: ""; position: absolute; top: -20%; bottom: -20%; left: -60%; width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .22), transparent);
    transform: skewX(-12deg); pointer-events: none; animation: egx-sheen linear infinite;
}
.egx-role.role-lv-3::after { animation-duration: 4.5s; }
.egx-role.role-lv-4::after { animation-duration: 4s; }
.egx-role.role-lv-5::after { animation-duration: 3.4s; }
@keyframes egx-sheen { 0% { left: -60%; } 55%, 100% { left: 135%; } }
/* iOS: overflow:hidden + border-radius + pseudo co transform(skewX) bi ro
   vet sang ra ngoai nut (WebKit khong cat het). Dung clip-path + mask cung
   tren MOI cap de vet sang chi chay trong long pill. */
@supports (-webkit-touch-callout: none) {
    .egx-role {
        overflow: hidden;
        -webkit-mask-image: -webkit-radial-gradient(#fff, #000);
        clip-path: inset(0 round 999px);
        contain: paint;
    }
}
/* Cap 5 (cao nhat): vien + hao quang accent tho nhe + icon vuong mien nghieng nhe */
.egx-role.role-lv-5 { border-color: var(--acc); animation: egx-enter .5s ease .3s both, egx-lv5 2.6s ease-in-out infinite; }
.egx-role.role-lv-5 > i { color: var(--acc); font-size: 11px; margin-right: 6px; display: inline-block; animation: egx-crown 3s ease-in-out infinite; }
@keyframes egx-lv5 {
    0%, 100% { box-shadow: 0 0 5px rgba(16, 185, 129, .28), inset 0 0 5px rgba(16, 185, 129, .06); }
    50% { box-shadow: 0 0 13px rgba(16, 185, 129, .5), inset 0 0 8px rgba(16, 185, 129, .12); }
}
@keyframes egx-crown {
    0%, 100% { transform: rotate(-6deg); }
    50% { transform: rotate(6deg) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
    .egx-role.role-lv-0, .egx-role.role-lv-1, .egx-role.role-lv-2, .egx-role.role-lv-3,
    .egx-role.role-lv-4, .egx-role.role-lv-5 { animation: none; }
    .egx-role.role-lv-5 { box-shadow: 0 0 8px rgba(16, 185, 129, .35); }
    .egx-role.role-lv-3::after, .egx-role.role-lv-4::after, .egx-role.role-lv-5::after,
    .egx-role.role-lv-5 > i { animation: none; }
}
.egx-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0 6px 12px; }
.egx-tags:empty { display: none; }
.egx-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    background: var(--soft); border: 1px solid var(--acc); color: var(--acc); border-radius: 6px; padding: 3px 6px 3px 10px; }
.egx-tag button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 11px; padding: 0 2px; }
.egx-udrop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 14px;
    border: 1px dashed var(--line); border-radius: 6px; background: var(--soft); color: var(--muted);
    font-size: 13px; cursor: pointer; text-align: center; }
.egx-udrop > i { font-size: 22px; color: var(--acc); }
.egx-udrop b { color: var(--acc); }
.egx-udrop.is-over { border-color: var(--acc); background: rgba(16, 185, 129, .08); }
.egx-udrop.is-err { border-color: var(--bad); }
.egx-ulist { display: grid; gap: 6px; width: 100%; }
.egx-ulist:empty { display: none; }
.egx-ufile { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line);
    border-radius: 6px; padding: 8px 12px; font-size: 12px; color: var(--text); cursor: default; }
.egx-ufile i { color: var(--acc); font-size: 15px; }
.egx-ufile small { margin-left: auto; color: var(--muted); font-family: ui-monospace, monospace; }
.egx-ufile button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.egx-ufile button:hover { color: var(--bad); }
.egx-ufile button[data-egx-view]:hover { color: var(--acc); }
/* Upload anh: luoi thumbnail + nut go */
.egx-imglist { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.egx-imglist .egx-img { flex: 0 1 140px; min-width: 96px; }
.egx-img { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
    background: var(--card); cursor: default; }
.egx-img img { display: block; width: 100%; height: 72px; object-fit: cover; }
.egx-img span { display: block; padding: 4px 6px; font-size: 11px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.egx-img button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 6px;
    background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: 11px;
    display: inline-flex; align-items: center; justify-content: center; }
.egx-img button:hover { background: var(--bad); }
/* Dropdown can noi tren moi noi dung (tranh section duoi de len) */
.egl-ppdrop { z-index: 30; }
/* Lich + gio custom (thay picker mac dinh): popup trong fbox */
.egx-cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px;
    font-size: 13px; font-weight: 700; color: var(--text); }
[data-egx-dcal] { display: block; }
.egx-cal-grid { width: 100%; }
.egx-cal-head span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.egx-cal-head button { border: 1px solid var(--line); background: var(--soft); color: var(--text);
    border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 12px;
    display: inline-flex; align-items: center; justify-content: center; }
.egx-cal-head button:hover { color: var(--acc); border-color: var(--acc); }
.egx-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.egx-cal-grid .egx-dow { font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.egx-cal-grid button { border: 0; background: none; border-radius: 6px; height: auto; aspect-ratio: 1 / 1; min-width: 0; font-size: 12px;
    color: var(--text); cursor: pointer; font-family: inherit; }
.egx-cal-grid button:hover { background: var(--soft); }
.egx-cal-grid button.is-blank { visibility: hidden; }
.egx-cal-grid button.is-today { border: 1px solid var(--acc); }
.egx-cal-grid button.is-sel { background: var(--acc); color: #fff; font-weight: 700; }
html.dark .egx-cal-grid button.is-sel { color: #04120a; }
.egx-tcols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Cot gio/phut kieu slot-machine: khung giua co dinh, cuon snap, so vao khung la duoc chon */
.egx-tframe { position: relative; }
.egx-tframe::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 34px;
    transform: translateY(-50%); border: 1px solid var(--acc); border-radius: 6px;
    background: rgba(16, 185, 129, .08); pointer-events: none; }
.egx-tcol { height: 170px; overflow-y: auto; scroll-snap-type: y proximity; display: grid; gap: 2px;
    align-content: start; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent); }
.egx-tcol::-webkit-scrollbar { display: none; }
.egx-tcol button { scroll-snap-align: center; min-height: 34px; border: 0; background: none; border-radius: 6px;
    padding: 7px 4px; font-size: 12px; font-family: ui-monospace, monospace; color: var(--text);
    cursor: pointer; text-align: center; }
.egx-tpad { height: 68px; }
.egx-tcol button:hover { background: var(--soft); }
.egx-tcol button.is-sel { color: var(--acc); font-weight: 700; font-size: 14px; }
.egx-tdone { width: 100%; margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; }
/* Datetime: vach phan cach giua lich (date) va cot gio/phut (time) */
.egx-dttime { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.egx-dttime .egx-tcol { max-height: 120px; }
/* Mau submenu footer: copy y rule mobile (rule goc chi co duoi 768px)
   de hien dung tren moi man hinh; dung var nen tu theo 2 theme */
.demo-fsub { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 10px;
    display: grid; gap: 0; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.demo-fsub .egl-fsubhead { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px;
    border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.demo-fsub .egl-fsubhead span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text); }
.demo-fsub .egl-fsubhead button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px;
    display: inline-flex; align-items: center; justify-content: center; padding: 2px; transition: color .3s; }
.demo-fsub .egl-fsubhead button:hover { color: var(--acc); }
.demo-fsub .egl-fsubitem { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--muted);
    text-decoration: none; font-size: 12px; font-weight: 500; border: 1px solid var(--line); border-radius: 4px;
    margin-bottom: 5px; background: none; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
    transition: all .3s; box-sizing: border-box; }
.demo-fsub .egl-fsubitem:last-child { margin-bottom: 0; }
.demo-fsub .egl-fsubitem:hover { background: var(--soft); color: var(--acc); }
.demo-fsub .egl-fsubitem.active { background: var(--soft); color: var(--acc); border-color: var(--acc); font-weight: 700; }
.demo-fsub .egl-fsubitem .nic { display: inline-flex; }
.demo-fsub .egl-fsubitem .nic i { font-size: 16px; width: 20px; text-align: center; }
/* Mau submenu header ⋮: khung panel giong footer */
.demo-msub { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 10px;
    display: grid; gap: 0; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
/* Mau submenu responsive dung nhu app that: PC thay sidebot + menu ⋮, mobile thay panel footer */
.demo-pconly { display: block; }
.demo-mobonly { display: none; }
@media (max-width: 768px) { .demo-pconly { display: none !important; } .demo-mobonly { display: block; } }
.demo-sidebot { background: var(--card); border: 1px solid var(--line); border-radius: 6px;
    padding: 10px 8px 12px; display: grid; gap: 8px; max-width: 230px; width: 100%; margin: 0 auto; }
/* Gon nhu sidebar thu gon: chu nho, khoang cach hep */
.demo-sidebot .egl-sidelbl { font-size: 9px; }
.demo-sidebot .egl-lang { padding: 6px 0; font-size: 11px; }
.demo-sidebot .egl-themerow { gap: 6px; }
.demo-sidebot .egl-themeopt { padding: 6px 4px; font-size: 11px; }
.demo-sidebot .egl-themeopt i { font-size: 14px; }
/* ===== PDF viewer (PDF.js local, offline) ===== */
[data-pdfmodalbox] { display: none; align-items: center; justify-content: center; padding: 24px; }
[data-pdfmodalbox].is-show { display: flex; }
[data-pdfmodalbox] .egl-panel { position: relative; z-index: 1; left: auto; top: auto; right: auto; bottom: auto;
    transform: none; width: min(1100px, 88vw); height: 88vh; height: 88dvh;
    margin: 0; display: flex; flex-direction: column; animation: egx-popc .28s var(--ease) both; }
@keyframes egx-popc { from { opacity: 0; transform: scale(.97) translateY(12px); } }
[data-pdfmodalbox] .egl-phead { flex: none; }
[data-pdfmodalbox] .egl-pbody { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.egx-pdfactions { display: inline-flex; gap: 8px; }
/* Toolbar: zoom, page, download */
.egx-pdftoolbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 12px;
    border-bottom: 1px solid var(--line); background: var(--card); overflow-x: auto; scrollbar-width: none; }
.egx-pdftoolbar::-webkit-scrollbar { display: none; }
.egx-pdftbtn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px;
    background: var(--soft); color: var(--text); cursor: pointer; font-size: 13px; font-family: inherit; }
.egx-pdftbtn:hover:not([disabled]) { border-color: var(--acc); color: var(--acc); }
.egx-pdftbtn[disabled] { opacity: .45; cursor: default; }
.egx-pdfzoom, .egx-pdfpage { flex: none; min-width: 52px; text-align: center; font-size: 12px;
    font-family: ui-monospace, monospace; color: var(--muted); }
.egx-pdfsep { flex: none; width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
/* Tooltip hover tren PC/tablet cho nut icon toolbar PDF (mobile cam ung khong hien) */
.egx-pdftip[hidden] { display: none !important; }
.egx-pdftip { position: absolute; z-index: 6; background: var(--card); color: var(--text);
    border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 11px; font-weight: 600;
    white-space: nowrap; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); pointer-events: none;
    animation: egx-tipin .16s var(--ease) both; }
@keyframes egx-tipin { from { opacity: 0; transform: translateY(4px); } }
.egx-pdftoolbar .egx-pdfdl { margin-left: auto; padding: 0; min-width: 30px; width: 30px; }
/* Vung cuon: canvas tung trang */
.egx-pdfscroll { position: relative; flex: 1; min-height: 0; overflow: auto;
    background: var(--soft); padding: 12px; touch-action: pan-x pan-y; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: auto; scrollbar-color: var(--muted) transparent; }
/* Scrollbar de keo hon (nhat la thanh ngang khi zoom) */
.egx-pdfscroll::-webkit-scrollbar { width: 12px; height: 12px; }
.egx-pdfscroll::-webkit-scrollbar-track { background: transparent; }
.egx-pdfscroll::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--muted) 65%, transparent); border-radius: 999px; border: 0; }
.egx-pdfscroll::-webkit-scrollbar-thumb:hover, .egx-pdfscroll::-webkit-scrollbar-thumb:active { background-color: var(--acc); }
.egx-pdfpages2 { display: flex; flex-direction: column; align-items: center; gap: 10px; width: max-content; min-width: 100%; }
.egx-pdfpages2 canvas { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
html.dark .egx-pdfpages2 canvas { box-shadow: 0 4px 16px rgba(0, 0, 0, .6); }
.egx-pdfpages2 canvas + canvas { margin-top: 2px; }
/* iOS du phong: Safari iPhone khong hien PDF nhung trong iframe — hien nut mo bang trinh xem cua may */
.egx-pdfdetail { max-width: 100%; font-size: 11px; color: var(--muted); overflow-wrap: break-word; word-break: normal; }
.egx-pdfopenlink { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 14px;
    border-radius: 6px; background: var(--acc); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; }
.egx-pdfloading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; background: var(--soft); }
.egx-pdfloading[hidden] { display: none !important; }
.egx-pdfloading i { font-size: 26px; color: var(--acc); }
.egx-pdfempty[hidden] { display: none !important; }
.egx-pdfempty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px; padding: 24px; text-align: center; background: var(--soft); color: var(--muted); font-size: 13px; }
.egx-pdfempty > i { font-size: 40px; color: var(--acc); }
/* In: chi giu vung in (anh cac trang PDF) khi bam nut In.
   iOS chi in tin cay noi dung NAM TRONG LUONG TAI LIEU BINH THUONG
   (display:none -> preview trang; position:fixed -> mat hinh). Vi vay
   khi in: vung in hien that o cuoi body (static flow) + body.pdf-printing
   an phan con lai (ca man hinh lan ban in, xem rule duoi). */
.egx-print-root { display: none; }
.egx-print-root.is-run { display: block; background: #fff; }
.egx-print-root.is-run img { display: block; width: 100%; height: auto; background: #fff; }
body.pdf-printing > *:not(.egx-print-root) { display: none !important; }
body.pdf-printing { background: #fff; }
@media print {
    /* Nen trang khi in: trang giay + color-scheme sang (iOS doi kho giay
       render lai: de nen toi cua dark mode lot vao se den hinh preview). */
    html { color-scheme: light; }
    html, body { background: #fff !important; }
    body > *:not(.egx-print-root) { display: none !important; }
    .egx-print-root { display: block !important; background: #fff; }
    .egx-print-root img { display: block; width: 100%; height: auto; page-break-after: always;
        break-after: page; page-break-inside: avoid; break-inside: avoid;
        -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .egx-print-root img:last-child { page-break-after: auto; break-after: auto; }
}
/* Mobile: popup gan full ngang nhung GIOI HAN chieu cao 80vh (khong mo tab moi) */
@media (max-width: 768px) {
    [data-pdfmodalbox] { padding: 12px; }
    [data-pdfmodalbox] .egl-panel { width: 100%; max-width: 100%; height: auto; max-height: 80vh; max-height: 80dvh;
        border-radius: 6px; }
    .egx-pdfscroll { padding: 6px; }
    .egx-pdftoolbar { padding: 6px 8px; gap: 4px; }
}
/* SPA: gallery khong con div boc — padding + tieu de nam thang tren .egx-page
   (class gan truc tiep len view root luc mount, go khi unmount). */
.egx-page { padding: 0; }
@media (max-width: 640px) { .egx-page { padding: 0; } }
.egx-pagetop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.egx-pagetop .egl-titlewrap { flex: 1 1 auto; min-width: 0; }
.egx-pagetop .egl-search { flex: 1 1 220px; max-width: 360px; margin-left: auto; }
@media (max-width: 640px) { .egx-pagetop .egl-search { flex-basis: 100%; max-width: none; } }

/* Lunasoft shell integration — lab layout inside SPA shell.
   .login-card an tren home do login.css dam nhan (tranh trung khai bao). */
body.home > .sysbar-glow,
body.home > .navbar-glow { display: none !important; }
#appShell { display: none; }
body.home #appShell { display: block; }
.egl-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.egl-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.egl-main .container { flex: 1; min-height: 0; overflow-y: auto; }
.egl-main .container .content { max-width: none; }
 /* Requirement E4d: goc bo phai tren td:last-child — rule chung trong style.css + egx-demo.css */
.egl-table th:last-child, .egl-table td:last-child { border-top-right-radius: 10px; }
/* Hover hang bang: mau rieng, khong trung nen tieu de (ca 2 mac dinh deu la
   var(--soft) -> hover xong nhin giong header). Dung accent pha nhe de nhan
   dien duoc o ca 2 theme (sang/toi), khong doi layout/kich thuoc. */
.egl-table tbody tr:hover { background: color-mix(in srgb, var(--acc) 12%, var(--soft)); }
/* Hang bang trang template bam duoc de mo popup chi tiet (chi section #table). */
#table .egl-table tbody tr { cursor: pointer; }
/* 2 pill side popup chi tiet (Trang thai + Chuc vu) xep doc, khe 8px —
   scope attr duy nhat trang template, khong anh huong company. */
[data-td-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* 2 pill side popup chi tiet company (Hoat dong + Da xac minh) — COPY y mau
   template: container flex column + gap 8px + can giua, scope rieng
   [data-co-pills] de khong anh huong trang khac; pill tao bang DOM nen
   khong co <br>/khoang trang giua pill (tranh de -7px nhu DesignUI §15.3). */
[data-co-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Company (PC default + tablet): giu table/thead/row dang bang, chong tran card + khep pager.
   Base = PC >=1025 (default, khong media) + tablet ke thua; mobile <=640
   ghi de lai dang card trong egx-demo-mobile.css. Scope [data-company-root]. */
[data-company-root] { min-width: 0; }
[data-company-root] .egl-card { overflow: hidden; min-width: 0; }
[data-company-root] .egl-table { display: table; width: 100%; table-layout: fixed; }
[data-company-root] .egl-table thead { display: table-header-group; }
[data-company-root] .egl-table tbody { display: table-row-group; }
[data-company-root] .egl-table tr { display: table-row; }
[data-company-root] .egl-table th { overflow-wrap: break-word; word-break: normal; }
[data-company-root] .egl-table td { overflow-wrap: break-word; word-break: normal; min-width: 0; }
[data-company-root] .egl-table td:last-child { border-top-right-radius: 10px; }
[data-company-root] .egl-table tbody tr.is-open td:last-child { border-top-right-radius: 10px; }
[data-company-root] .egl-table .egl-act { white-space: nowrap; }
[data-company-root] .egl-pager { flex-wrap: wrap; row-gap: 8px; min-width: 0; }
[data-company-root] .egl-pages { flex-wrap: wrap; min-width: 0; }
[data-company-root] .egl-nums { min-width: 0; }
[data-company-root] .egl-page { flex: none; }
[data-company-root] .egl-ellipsis { flex: none; }
/* TABLET (<=1024, nam trong 641-1024 cua Task): bang van table nhung bot 2 cot phu
   (Viet tat cot 4 + Ten EN cot 6) de vua khung hep + cuon ngang khi hep.
   PC >1024 (default, khong media) hien du 7 cot. Chi dung breakpoint lab 1024;
   mobile <=640 ghi de lai card trong egx-demo-mobile.css. */
@media (max-width: 1024px) {
    [data-company-root] .egl-card { overflow-x: auto; }
    [data-company-root] .egl-table col:nth-child(4),
    [data-company-root] .egl-table col:nth-child(6) { display: none; }
    [data-company-root] .egl-table th:nth-child(4),
    [data-company-root] .egl-table td:nth-child(4),
    [data-company-root] .egl-table th:nth-child(6),
    [data-company-root] .egl-table td:nth-child(6) { display: none; }
}
/* Category (PC default + tablet): giu table/thead/row dang bang, chong tran
   card + khep pager. Base = PC >=1025 (default, khong media) hien DU 4 cot
   (ID + Ten VN + Ten EN + Thao tac); tablet ke thua. Scope [data-category-root].
   Chi dung breakpoint lab 1024; mobile <=640 ghi de lai dang card bang rule
   lab chung trong employee-green.css. */
[data-category-root] { min-width: 0; }
[data-category-root] .egl-card { overflow: hidden; min-width: 0; }
[data-category-root] .egl-table { display: table; width: 100%; table-layout: fixed; }
[data-category-root] .egl-table thead { display: table-header-group; }
[data-category-root] .egl-table tbody { display: table-row-group; }
[data-category-root] .egl-table tr { display: table-row; }
[data-category-root] .egl-table th { overflow-wrap: break-word; word-break: normal; }
[data-category-root] .egl-table td { overflow-wrap: break-word; word-break: normal; min-width: 0; }
[data-category-root] .egl-table td:last-child { border-top-right-radius: 10px; }
[data-category-root] .egl-table tbody tr.is-open td:last-child { border-top-right-radius: 10px; }
[data-category-root] .egl-table .egl-act { white-space: nowrap; }
[data-category-root] .egl-pager { flex-wrap: wrap; row-gap: 8px; min-width: 0; }
[data-category-root] .egl-pages { flex-wrap: wrap; min-width: 0; }
[data-category-root] .egl-nums { min-width: 0; }
[data-category-root] .egl-page { flex: none; }
[data-category-root] .egl-ellipsis { flex: none; }
/* TABLET (<=1024, nam trong 641..1024 cua Task): bang van table nhung an cot
   phu Ten EN (cot 3) de vua khung hep + cuon ngang khi hep. PC >=1025
   (default, khong media) hien du 4 cot. Chi dung breakpoint lab 1024;
   mobile <=640 tra lai du cot bang card lab chung. */
@media (max-width: 1024px) {
    [data-category-root] .egl-card { overflow-x: auto; }
    [data-category-root] .egl-table col:nth-child(3) { display: none; }
    [data-category-root] .egl-table th:nth-child(3),
    [data-category-root] .egl-table td:nth-child(3) { display: none; }
    [data-category-root] .egl-table td::before { content: none; display: none; }
    [data-category-root] .egl-table tr { border: 0; margin: 0; }
    [data-category-root] .egl-table td { text-align: left; border-bottom: 1px solid var(--line); }
    [data-category-root] .egl-table td.c-act { text-align: right; }
    [data-category-root] .egl-pager { flex-wrap: wrap; }
    [data-category-root] .egl-pages { flex-wrap: wrap; }
}
/* Company popup chi tiet [data-co-view] (task detail): PC giu nguyen lab
   elb-view-detail (side 22%/210px + main cuon doc + grid 2-col + addr ngoai
   grid). Scope [data-co-view] vi modal dock ra body khi mo; khong ghi de
   lab, chi ghim lai de PC nguyen ven. */
[data-co-view] .elb-view-detail { display: flex; }
[data-co-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-co-view] .elb-view-main { min-width: 0; }
[data-co-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
/* Chi tiet company: gia tri (.elb-vval) trong .elb-view-main CAN GIUA,
   tieu de (.elb-vkey) giu trai nhu lab. Ghi de text-align:left toan cuc
   (employee-green.css:322). Scope [data-co-view] de khong anh huong
   trang khac. Xem DesignUI §15.9. */
[data-co-view] .elb-view-main .elb-vval { text-align: center; }
/* Lab .egl-pfoot (employee-green.css:323) flex nhung KHONG co gap -> 2 nut
   (In PDF + Sua) dinh sat nhau. Mau gallery chi 1 nut nen loi an. */
[data-co-view] .egl-pfoot { gap: 8px; }
/* Shift popup form Them/Sua [data-sh-modal]: panel om noi dung (max-height
   86vh + flex column nhu gallery), pbody grid gap 10, pfoot gap 8,
   pipeline padding top 0 — giong mau [data-co-modal] company. Scope
   [data-sh-modal] vi modal dock ra body khi mo. */
[data-sh-modal] > .egl-panel { height: auto; max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-sh-modal] .egl-pbody { padding: 14px; display: grid; gap: 10px;
    align-content: start; overflow-y: auto; min-height: 0; }
[data-sh-modal] .elb-vgrid { gap: 10px; }
[data-sh-modal] .egl-pfoot { gap: 8px; }
[data-sh-modal] [data-sh-pipe] { padding: 14px; }
[data-sh-modal] [data-sh-pipe] .egx-pipe { margin-top: 0; }
/* Dept_position popup form Them/Sua [data-dp-modal]: panel om noi dung
   (max-height 86vh + flex column nhu gallery), pbody grid gap 10,
   pfoot gap 8, pipeline padding du 4 mat — giong mau [data-sh-modal].
   Scope [data-dp-modal] vi modal dock ra body khi mo. */
[data-dp-modal] > .egl-panel { height: auto; max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-dp-modal] .egl-pbody { padding: 14px; display: grid; gap: 10px;
    align-content: start; overflow-y: auto; min-height: 0; }
[data-dp-modal] .elb-vgrid { gap: 10px; }
[data-dp-modal] .egl-pfoot { gap: 8px; }
[data-dp-modal] [data-dp-pipe] { padding: 14px; }
[data-dp-modal] [data-dp-pipe] .egx-pipe { margin-top: 0; }
/* Sua tu Chi tiet (chi Chuc vu): 3 picker bi khoa mo (disabled) nhung van
   hien gia tri; 2 o ten Chuc vu van sua duoc. */
[data-dp-modal].is-editpos .egx-ftrigger:disabled { opacity: .65; cursor: default; }
[data-dp-modal].is-editpos .egx-ftrigger:disabled i { opacity: .5; }
/* Loc cong ty trong header (egl-ppsel dung chung pager): cho cao bang
   nut hanh dong ben canh (min-height 40px = chieu cao egl-goldbtn,
   y .egl-search lab dung min-height 44px; font 13px y goldbtn).
   Mobile co rule rieng (full-width + 44px). */
[data-dp-cofilter] .egl-pptrig { min-height: 40px; font-size: 13px; }
/* Drop cua loc header mo XUONG duoi trigger (khac pager mo nguoc len
   tren): dung lai gia tri lab (100% + 6px), chi doi huong top/bottom. */
[data-dp-cofilter] .egl-ppdrop { top: calc(100% + 6px); bottom: auto; }
/* Drop loc cong ty: o tim kiem (tai dung .egx-fsearch lab) + gioi han
   chieu cao danh sach = 5 option (option lab cao ~33px; phan con lai
   cuon trong list). Empty state dung .egl-empty lab, gon hon trong drop. */
[data-dp-cofilter] [data-co-list] { display: block; max-height: 167px; overflow-y: auto; overscroll-behavior: contain; }
[data-dp-cofilter] [data-co-empty] { display: block; padding: 14px 12px; }
/* Danh sach dept_position dang CAY (mau tree: cong ty > bo phan > chuc vu):
   hang bo goc + nut mo/dong + folder/file icon + ma goc phai + duong
   dashed. Token lab, dark tu doi; khong hardcode mau. */
[data-dept-root] .dp-tree { padding: 12px 14px; font-size: 13px; }
[data-dept-root] .dp-tree-list { list-style: none; margin: 0; padding: 0; }
[data-dept-root] .dp-tree-sub { margin: 4px 0 0 20px; padding-left: 14px; border-left: 1px dashed var(--line); }
[data-dept-root] .dp-tree-node { position: relative; }
[data-dept-root] .dp-tree-sub > .dp-tree-node::before { content: ''; position: absolute; left: -14px; top: 17px; width: 12px; border-top: 1px dashed var(--line); }
[data-dept-root] .dp-tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--text); transition: background .15s var(--ease); }
[data-dept-root] .dp-tree-row:hover { background: var(--soft); }
[data-dept-root] .dp-tree-row:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
[data-dept-root] .dp-tree-exp { width: 16px; height: 16px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--text); font: 700 11px/1 var(--f); display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: pointer; }
[data-dept-root] .dp-tree-exp:hover { border-color: var(--warn); }
[data-dept-root] .dp-tree-ic { width: 16px; text-align: center; color: var(--warn); font-size: 14px; flex: none; }
[data-dept-root] .dp-tree-ic-file { color: var(--muted); }
[data-dept-root] .dp-tree-dot { width: 16px; text-align: center; color: var(--line); flex: none; }
[data-dept-root] .dp-tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-dept-root] .dp-tree-code { margin-left: auto; padding-left: 10px; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
[data-dept-root] .dp-tree-co > .dp-tree-row { font-weight: 700; }
[data-dept-root] .dp-tree-dept > .dp-tree-row { font-weight: 600; }
[data-dept-root] .dp-tree-leaf > .dp-tree-row.is-open { background: var(--soft); box-shadow: inset 0 0 0 1px var(--warn); }
[data-dept-root] .dp-tree-node:not(.is-open) > .dp-tree-sub { display: none; }
/* Shift popup chi tiet [data-sh-view]: PC giu nguyen lab elb-view-detail
   (side 22%/210px + main cuon doc + grid 2-col), giong company. */
[data-sh-view] .elb-view-detail { display: flex; }
[data-sh-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-sh-view] .elb-view-main { min-width: 0; }
[data-sh-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
[data-sh-view] .egl-pfoot { gap: 8px; }
/* Chi tiet shift: gia tri main CAN GIUA (DesignUI S15.9, giong company/category/do/di). */
[data-sh-view] .elb-view-main .elb-vval { text-align: center; }
/* 2 pill side shift (Hoat dong + Da xac minh): flex column gap 8px nhu company (DesignUI S15.3). */
[data-sh-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Pill trong main (Suat an + Ap dung): flex wrap gap 8px can giua, khong text node chen (DesignUI S15.3). */
[data-sh-view] .elb-vval:has(.elb-vpill) { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
[data-sh-view] .elb-vval .elb-vpill { display: inline-flex; align-items: center; gap: 4px; }
/* Dept_position popup chi tiet [data-dp-view]: PC giu nguyen lab
   elb-view-detail (side 22%/210px + main cuon doc + grid 2-col),
   gia tri CAN GIUA (S15.9), pills side doc (S15.3), giong shift. */
[data-dp-view] .elb-view-detail { display: flex; }
[data-dp-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-dp-view] .elb-view-main { min-width: 0; }
[data-dp-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
[data-dp-view] .egl-pfoot { gap: 8px; }
[data-dp-view] .elb-view-main .elb-vval { text-align: center; }
[data-dp-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
[data-dp-view] .elb-vval:has(.elb-vpill) { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
[data-dp-view] .elb-vval .elb-vpill { display: inline-flex; align-items: center; gap: 4px; }
/* Avatar shift theo mau user nhung dam bao tuong phan 2 theme: nen tint + vien/icon pha theme (thay background truc tiep). Dot exact giu o badge list/detail. */
html [data-sh-view] .elb-vavatar { background: color-mix(in srgb, var(--sh-av, var(--acc)) 18%, var(--card)); border: 1px solid color-mix(in srgb, var(--sh-av, var(--acc)) 55%, var(--text)); color: color-mix(in srgb, var(--sh-av, var(--acc)) 45%, var(--text)); box-shadow: 0 0 0 3px var(--card), 0 0 0 5px color-mix(in srgb, var(--sh-av, var(--acc)) 55%, var(--text)); }
/* Badge mau trong Chi tiet (modal dock ra body nen scope [data-sh-view] rieng, cung cong thuc list). */
[data-sh-view] .sh-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; padding: 2px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--sh-c, var(--line)) 55%, var(--text)); background: color-mix(in srgb, var(--sh-c, var(--muted)) 14%, var(--card)); color: color-mix(in srgb, var(--sh-c, var(--text)) 45%, var(--text)); font-weight: 600; white-space: nowrap; }
[data-sh-view] .sh-badge .sh-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--sh-c, var(--muted)); border: 1px solid var(--line); }
[data-sh-view] .sh-badge .sh-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Badge ten ca [data-shift-root] .sh-badge: nen tint 12% + vien mau user + chu pha 70% ve theme de doc duoc ca 2 theme (thay style color truc tiep cu). Dot giu exact mau user. */
[data-shift-root] .sh-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; padding: 2px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--sh-c, var(--line)) 55%, var(--text)); background: color-mix(in srgb, var(--sh-c, var(--muted)) 14%, var(--card)); color: color-mix(in srgb, var(--sh-c, var(--text)) 45%, var(--text)); font-weight: 600; white-space: nowrap; }
[data-shift-root] .sh-badge .sh-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--sh-c, var(--muted)); border: 1px solid var(--line); }
[data-shift-root] .sh-badge .sh-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Holiday popup form Them/Sua [data-ho-modal]: panel om noi dung (max-height
   86vh + flex column nhu gallery) + pbody grid + pfoot gap + pipe padding,
   giong mau [data-co-modal] company. Scope truc tiep vi modal dock ra body. */
[data-ho-modal] > .egl-panel { height: auto; max-height: 86dvh; }
[data-ho-modal] .egl-pbody { padding: 14px; display: grid; gap: 10px;
    align-content: start; overflow-y: auto; min-height: 0; }
[data-ho-modal] .elb-vgrid { gap: 10px; }
[data-ho-modal] .egl-pfoot { gap: 8px; }
[data-ho-modal] [data-ho-pipe] { padding: 14px; }
[data-ho-modal] [data-ho-pipe] .egx-pipe { margin-top: 0; }
/* Holiday popup chi tiet [data-ho-view]: PC ghim lab elb-view-detail
   (side 22%/210px + main + grid 2-col), gia tri main CAN GIUA (S15.9),
   2 pill side flex column (S15.3), pfoot gap. Giong shift/company. */
[data-ho-view] .elb-view-detail { display: flex; }
[data-ho-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-ho-view] .elb-view-main { min-width: 0; }
[data-ho-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
[data-ho-view] .elb-view-main .elb-vval { text-align: center; }
[data-ho-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Holiday list: lich + timeline 2 cot (PC) — lich trai 380px, timeline phai;
   pager nam day card nhu shift (header > card > pager). Scope
   [data-holiday-root]; dung token lab, khong hex rieng. */
[data-holiday-root] .ho-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 14px; align-items: start; }
[data-holiday-root] .ho-left { display: grid; gap: 14px; min-width: 0; }
[data-holiday-root] .ho-cal-card, [data-holiday-root] .ho-policy-card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px; min-width: 0; }
/* Policy card: cac khoi cach nhau (grid gap) + nut Luu full-width can giua
   (y nut form mobile). Ghi de margin lab cua elb-vsech vi gap da dam nhan. */
[data-holiday-root] .ho-policy-card { display: grid; gap: 10px; align-content: start; }
/* Don vi trong o so (vd % Luong lam ngay le): text mo dung truoc steppers. */
[data-holiday-root] .ho-unit { flex: none; align-self: center; color: var(--muted); font-size: 13px; font-weight: 700; padding-right: 10px; }
[data-holiday-root] .ho-policy-card .elb-vsech { margin: 0; }
[data-holiday-root] .ho-policy-card .egl-goldbtn { width: 100%; justify-content: center; }
[data-holiday-root] .ho-year-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
[data-holiday-root] .ho-cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
[data-holiday-root] .ho-cal-head [data-ho-caltitle] { flex: 1; text-align: center; font-size: 13px; font-weight: 700; }
[data-holiday-root] .ho-cal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
[data-holiday-root] .ho-cal-table th { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 6px 2px; }
[data-holiday-root] .ho-cal-table td { text-align: center; vertical-align: top; padding: 4px 2px; border-top: 1px solid var(--line); font-size: 12px; }
/* Lich thang: hover o ngay le hien ten ngay le (y tooltip lab .egl-act
   employee-green.css — gia tri copy y het mau, khong che tay).
   Chi thiet bi co hover that (PC/tablet); card lich khong cat tran
   (khong overflow hidden) nen khong can lat nhu hang cuoi egl-table. */
@media (hover: hover) and (pointer: fine) {
    [data-ho-calgrid] td[data-tip] { position: relative; }
    [data-ho-calgrid] td[data-tip]:hover::after {
        content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
        background: var(--card); color: var(--text); border: 1px solid var(--line);
        font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 8px; white-space: nowrap;
        box-shadow: 0 8px 20px rgba(0, 0, 0, .18); z-index: 999; pointer-events: none; }
}
[data-holiday-root] .ho-day-num { display: block; font-weight: 700; }
[data-holiday-root] .ho-lunar-day { display: block; font-size: 10px; color: var(--muted); min-height: 13px; }
[data-holiday-root] .ho-today .ho-day-num { color: var(--acc); }
[data-holiday-root] .ho-sunday .ho-day-num { color: var(--bad); }
[data-holiday-root] .ho-saturday .ho-day-num { color: var(--warn); }
[data-holiday-root] .ho-holiday-dots { display: flex; justify-content: center; gap: 3px; margin-top: 2px; min-height: 6px; }
[data-holiday-root] .ho-holiday-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); flex: none; }
[data-holiday-root] .ho-lunar-line { margin-top: 8px; font-size: 11px; color: var(--muted); }
/* Timeline + pager moi card rieng: timeline card co padding rieng,
   pager card dung padding lab san co; 2 card cach nhau. */
[data-holiday-root] .ho-right { display: grid; gap: 14px; align-content: start; min-width: 0; }
[data-holiday-root] .ho-tl-card { padding: 14px; }
/* Card pager: cho tran (visible) thay vi lab hidden — pager card lun
   (chi 1 hang pager) nen drop mo len tren khong du cho, bi cat mat
   (do that: drop 414-558 bi card cat o 543). Noi dung pager gon trong
   card nen an toan, khong vo vien bo tron. */
[data-holiday-root] .ho-pager-card { overflow: visible; }
[data-holiday-root] .ho-timeline-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin: 0 0 10px; }
/* Dropdown loc nam mo XUONG duoi (ghi de lab mo len tren): nam o dau trang,
   mo len bi cat ngoai viewport (do that: top -73px). Pager o day card giu
   nguyen mo len theo lab. */
[data-holiday-root] [data-ho-years] .egl-ppdrop { top: calc(100% + 6px); bottom: auto; }
[data-holiday-root] .ho-card { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: border-color .2s var(--ease); }
/* Icon tong ben trai the + body noi dung (flex row). Info co vien duoi
   ngan voi ghi chu (chi khi co ghi chu, qua :has). Dung token lab. */
[data-holiday-root] .ho-card { display: flex; gap: 12px; align-items: center; }
[data-holiday-root] .ho-card-icon { flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--soft); color: var(--acc); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
[data-holiday-root] .ho-card-body { flex: 1; min-width: 0; }
[data-holiday-root] .ho-card-info:has(+ .ho-card-note) { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
[data-holiday-root] .ho-card:hover { border-color: var(--acc); }
[data-holiday-root] .ho-card.is-open { border-color: var(--acc); }
[data-holiday-root] .ho-card-top { display: flex; align-items: center; gap: 8px; }
[data-holiday-root] .ho-card-title { flex: 1; min-width: 0; margin: 0; font-size: 13px; font-weight: 700; overflow-wrap: break-word; }
[data-holiday-root] .ho-card-actions { display: flex; gap: 6px; flex: none; }
[data-holiday-root] .ho-card-info { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
[data-holiday-root] .ho-card-note { margin-top: 8px; font-size: 12px; color: var(--muted); }
[data-holiday-root] .ho-empty { text-align: center; color: var(--muted); padding: 22px; }
[data-holiday-root] .ho-overlap { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border: 1px solid var(--warn); border-radius: 6px; background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); font-size: 12px; font-weight: 600; }
[data-holiday-root] .ho-overlap[hidden] { display: none; }
[data-holiday-root] .ho-cal-table td.ho-cal-empty { border: 0; }
[data-holiday-root] .ho-right, [data-holiday-root] .ho-timeline { min-width: 0; }
[data-holiday-root] .ho-card-info i, [data-holiday-root] .ho-card-note i { color: var(--acc); }

/* Tablet (<=1024): lich + timeline xep doc (y company cat cot phu). */
@media (max-width: 1024px) {
    [data-holiday-root] .ho-layout { grid-template-columns: minmax(0, 1fr); }
}
/* Tablet RIENG (641-1024, giu mobile <=640px nguyen): header xep hang sach
   (search full + nut full 44px, tranh nut rot lung chung do flex-wrap) +
   lich khong dan full-width (cap 560px can giua). Desktop >1024 giu 1 hang. */
@media (min-width: 641px) and (max-width: 1024px) {
    [data-holiday-root] .egx-pagetop { gap: 8px; }
    [data-holiday-root] .egx-pagetop .egl-search { flex-basis: 100%; max-width: none; min-height: 44px; }
    [data-holiday-root] .egx-pagetop .egl-goldbtn { min-height: 44px; width: 100%; justify-content: center; }
    [data-holiday-root] .ho-cal-card { max-width: 560px; width: 100%; margin-left: auto; margin-right: auto; }
}
[data-ho-view] .egl-pfoot { gap: 8px; }
/* Tablet (<=1024) shift: side thu gon, main van grid 2-col. */
@media (max-width: 1024px) {
    [data-sh-view] .elb-view-side { flex: 0 0 160px; max-width: 160px; padding: 12px 10px; }
    [data-sh-view] .elb-view-main { padding: 12px; }
    [data-sh-view] .elb-vgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
    [data-sh-modal] .egl-pbody { padding: 12px; gap: 8px; }
    [data-sh-modal] .elb-vgrid { gap: 8px; }
    [data-sh-modal] [data-sh-pipe] { padding: 14px; }
    [data-dp-view] .elb-view-side { flex: 0 0 160px; max-width: 160px; padding: 12px 10px; }
    [data-dp-view] .elb-view-main { padding: 12px; }
    [data-dp-view] .elb-vgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
    [data-dp-modal] .egl-pbody { padding: 12px; gap: 8px; }
    [data-dp-modal] .elb-vgrid { gap: 8px; }
    [data-dp-modal] [data-dp-pipe] { padding: 14px; }
}
/* Employee list: avatar tron truoc Ho ten (y hr emp-card-avatar).
   Co anh that thi background cover; khong thi hien chu cai dau trong
   vong tron token. Khong co rule nay span chu cai hien dang text tho
   ngay truoc ten gay hieu nham double chu cai dau (vd "NNguyen Van A").
   Scope [data-employee-root] de desktop + mobile card deu dung. */
[data-employee-root] .egl-table td .em-avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; vertical-align: middle; margin-right: 8px; font-size: 12px; font-weight: 800; color: var(--text); background-color: var(--soft); border: 1px solid var(--line); background-size: cover; background-position: center; background-repeat: no-repeat; }
[data-employee-root] .egl-table td .em-avatar-img { font-size: 0; }
/* Dispatch_out list: dong het hang (quantity = 0, class is-zero do rowHtml
   gan) nen nhe + mo 40% (opacity .4) ca dong de phan biet. Chi dung token
   lab --bad qua color-mix (KHONG hardcode hex/rgba — DesignUI §1), tu
   thich nghi light/dark; hover giu nhan dam hon mot chut thay vi mat mau
   ve --soft. Scope [data-dispatchout-root] nen mobile card (tr) cung duoc
   nhuom. */
[data-dispatchout-root] .egl-table tbody tr.is-zero { background: color-mix(in srgb, var(--bad) 10%, transparent); }
[data-dispatchout-root] .egl-table tbody tr.is-zero:hover { background: color-mix(in srgb, var(--bad) 17%, transparent); }
/* Mo 40% noi dung dong het hang NHUNG tru cot Thao tac (nut giu ro de
   bam): opacity tren tr se ke thua xuong nut nen phai danh tren tung
   td:not(.c-act) thay vi ca tr. */
[data-dispatchout-root] .egl-table tbody tr.is-zero td:not(.c-act) { opacity: .4; }
/* Dispatch_in list: nhu dispatch_out — dong het hang (quantity = 0,
   class is-zero do rowHtml gan) nen do nhe + mo 40% noi dung (tru cot
   Thao tac de nut khong bi mo). */
[data-dispatchin-root] .egl-table tbody tr.is-zero { background: color-mix(in srgb, var(--bad) 10%, transparent); }
[data-dispatchin-root] .egl-table tbody tr.is-zero:hover { background: color-mix(in srgb, var(--bad) 17%, transparent); }
[data-dispatchin-root] .egl-table tbody tr.is-zero td:not(.c-act) { opacity: .4; }
/* Dispatch_out popup chi tiet [data-do-view] (Phase 2 — giong company):
   PC giu nguyen lab elb-view-detail (side 22%/210px + main cuon doc +
   grid 2-col + 2 card full-width NGOAI grid). Scope [data-do-view] vi
   modal dock ra body khi mo; khong ghi de lab, chi ghim lai.
   Dispatch_in [data-di-view] dung chung (Phase 2 dispatch_in). */
[data-do-view] .elb-view-detail,
[data-di-view] .elb-view-detail { display: flex; }
[data-do-view] .elb-view-side,
[data-di-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-do-view] .elb-view-main,
[data-di-view] .elb-view-main { min-width: 0; }
[data-do-view] .elb-vgrid,
[data-di-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
/* Chi tiet dispatch_out/dispatch_in: gia tri (.elb-vval) trong
   .elb-view-main CAN GIUA, tieu de (.elb-vkey) giu trai nhu lab
   (DesignUI §15.9). Tom tat/ghi chu giu xuong dong tu nhien (pre-line).
   Scope rieng [data-do-view]/[data-di-view]. */
[data-do-view] .elb-view-main .elb-vval,
[data-di-view] .elb-view-main .elb-vval { text-align: center; }
[data-do-view] [data-do-f-summary], [data-do-view] [data-do-f-notes],
[data-di-view] [data-di-f-summary], [data-di-view] [data-di-f-notes] { white-space: pre-line; }
/* Lab .egl-pfoot gap 8px nhu company (3 nut: Xem/In/Sua). */
[data-do-view] .egl-pfoot,
[data-di-view] .egl-pfoot,
[data-em-view] .egl-pfoot { gap: 8px; }
/* 2 pill side popup chi tiet dispatch_out/dispatch_in — giong
   company/template: container flex column + gap 8px + can giua, scope
   rieng [data-do-pills]/[data-di-pills] (DesignUI §15.3). */
[data-do-pills], [data-di-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Employee popup chi tiet: pill side (trang thai/quyen) va giay to yeu cau. */
[data-em-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Employee popup Chi tiet: PC ghim lab elb-view-detail (side 22%/210px + main + grid 2-col) + gia tri main CAN GIUA (DesignUI S15.9, giong company/category/do/di/shift). Scope [data-em-view] vi modal dock ra body. */
[data-em-view] .elb-view-detail { display: flex; }
[data-em-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-em-view] .elb-view-main { min-width: 0; }
[data-em-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
[data-em-view] .elb-view-main .elb-vval { text-align: center; }
/* Hieu ung trang thai employee (tai dung nguyen van template S2 #badges:416-438): vao so le + tho nhe theo ngu nghia. Chinh thuc cham (4.5s), Thu viec nhanh (3.2s), Da nghi trung binh (3.6s). Scope [data-em-pills] de khong anh huong trang khac; keyframes tai dung, khong tao moi. */
[data-em-pills] .elb-vpill.is-ok { animation: egx-stin .5s ease both, egx-stok 4.5s ease-in-out infinite; }
[data-em-pills] .elb-vpill.is-warn { animation: egx-stin .5s ease .08s both, egx-stwarn 3.2s ease-in-out infinite; }
[data-em-pills] .elb-vpill.is-bad { animation: egx-stin .5s ease .16s both, egx-stbad 3.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { [data-em-pills] .elb-vpill { animation: none; } }
[data-em-docpills] { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
[data-em-docpills] .elb-vpill { display: inline-flex; align-items: center; gap: 4px; }
/* Tablet (<=1024): side thu gon (160px + avatar nho), main van du
   grid 2-col + card full-width. Chi dung breakpoint lab 1024. */
@media (max-width: 1024px) {
    [data-do-view] .elb-view-side, [data-di-view] .elb-view-side { flex: 0 0 160px; max-width: 160px; padding: 12px 10px; }
    [data-do-view] .elb-vavatar, [data-di-view] .elb-vavatar { width: 64px; height: 64px; font-size: 22px; }
    [data-do-view] .elb-view-main, [data-di-view] .elb-view-main { padding: 12px; }
    [data-do-view] .elb-vgrid, [data-di-view] .elb-vgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
/* Dispatch_out popup form them/sua (Phase 3) + nhap/xuat (Phase 4) +
   dispatch_in (Phase 3/4, giong het) + employee form them/sua + in tai lieu
   (giong company: section elb-vsec trong pbody grid): PC grid 1-col +
   pipeline. Panel om noi dung (max-height 86vh nhu gallery demo, flex
   column), pbody cuon doc, gap 10; ong pipeline nam giua pbody va pfoot nen
   can padding ngang 14 nhu pbody (margin-top 0 nhu mau gallery). Scope
   [data-do-*]/[data-di-*]/[data-em-modal]/[data-em-doc] vi modal dock ra
   body khi mo (DesignUI §15.7). */
[data-do-modal] > .egl-panel,
[data-do-import] > .egl-panel,
[data-do-exportov] > .egl-panel,
[data-di-modal] > .egl-panel,
[data-di-import] > .egl-panel,
[data-di-exportov] > .egl-panel { height: auto; max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-do-modal] .egl-pbody,
[data-do-import] .egl-pbody,
[data-do-exportov] .egl-pbody,
[data-di-modal] .egl-pbody,
[data-di-import] .egl-pbody,
[data-di-exportov] .egl-pbody,
[data-em-modal] .egl-pbody,
[data-em-doc] .egl-pbody { padding: 14px; display: grid; gap: 10px;
    align-content: start; overflow-y: auto; min-height: 0; }
[data-do-modal] .egl-pfoot,
[data-do-import] .egl-pfoot,
[data-do-exportov] .egl-pfoot,
[data-di-modal] .egl-pfoot,
[data-di-import] .egl-pfoot,
[data-di-exportov] .egl-pfoot,
[data-em-modal] .egl-pfoot,
[data-em-doc] .egl-pfoot { gap: 8px; }
/* Dispatch_out/dispatch_in popup (form/nhap/xuat/chi tiet/PDF): header +
   footer nen var(--soft) de noi nhe so voi nen panel (var(--card)) +
   nen trang (var(--bg)); chi phan cach bang vien 1px truoc day thi 3 vung
   lan vao nhau. Dung token lab (khong hex rieng, tu doi theo dark mode);
   giu vien var(--line) san co. PDF modal dung markup rieng (.tpl-pdf-head)
   nen scope kem — hanh vi/API pdfview.js khong doi (DesignUI §15.14). */
[data-do-modal] .egl-phead,
[data-do-import] .egl-phead,
[data-do-exportov] .egl-phead,
[data-do-view] .egl-phead,
[data-do-modal] .egl-pfoot,
[data-do-import] .egl-pfoot,
[data-do-exportov] .egl-pfoot,
[data-do-view] .egl-pfoot,
[data-di-modal] .egl-phead,
[data-di-import] .egl-phead,
[data-di-exportov] .egl-phead,
[data-di-view] .egl-phead,
[data-di-modal] .egl-pfoot,
[data-di-import] .egl-pfoot,
[data-di-exportov] .egl-pfoot,
[data-di-view] .egl-pfoot,
[data-em-modal] .egl-phead,
[data-em-view] .egl-phead,
[data-em-doc] .egl-phead,
[data-em-modal] .egl-pfoot,
[data-em-view] .egl-pfoot,
[data-em-doc] .egl-pfoot,
[data-do-pdfmodal] .tpl-pdf-head,
[data-di-pdfmodal] .tpl-pdf-head { background: var(--soft); }
/* Company/category/template: header + footer popup nen var(--soft) nhu
   dispatch_out (DesignUI §15.14) — noi nhe so voi nen panel + nen trang.
   Dung token lab (khong hex rieng, tu doi dark mode); giu vien lab.
   Gallery [data-pdf-modal] dung markup rieng (.tpl-pdf-head) nhu
   dispatch_out — hanh vi JS khong doi. */
[data-co-modal] .egl-phead,
[data-co-view] .egl-phead,
[data-ca-modal] .egl-phead,
[data-ca-view] .egl-phead,
[data-sh-modal] .egl-phead,
[data-sh-view] .egl-phead,
[data-ho-modal] .egl-phead,
[data-ho-view] .egl-phead,
[data-dp-modal] .egl-phead,
[data-dp-view] .egl-phead,
[data-demomodalbox] .egl-phead,
[data-pipemodalbox] .egl-phead,
[data-pipeerrmodalbox] .egl-phead,
[data-pdfmodalbox] .egl-phead,
[data-tabledetail] .egl-phead,
[data-pdf-modal] .tpl-pdf-head,
[data-co-modal] .egl-pfoot,
[data-co-view] .egl-pfoot,
[data-ca-modal] .egl-pfoot,
[data-ca-view] .egl-pfoot,
[data-sh-modal] .egl-pfoot,
[data-sh-view] .egl-pfoot,
[data-ho-modal] .egl-pfoot,
[data-ho-view] .egl-pfoot,
[data-dp-modal] .egl-pfoot,
[data-dp-view] .egl-pfoot,
[data-demomodalbox] .egl-pfoot,
[data-tabledetail] .egl-pfoot { background: var(--soft); }
[data-do-modal] [data-do-pipe], [data-do-modal] [data-do-aipipe],
[data-do-import] [data-do-impipe],
[data-do-exportov] [data-do-expipe],
[data-di-modal] [data-di-pipe], [data-di-modal] [data-di-aipipe],
[data-di-import] [data-di-impipe],
[data-di-exportov] [data-di-expipe] { padding: 14px; }
[data-do-modal] [data-do-pipe] .egx-pipe, [data-do-modal] [data-do-aipipe] .egx-pipe,
[data-do-import] [data-do-impipe] .egx-pipe,
[data-do-exportov] [data-do-expipe] .egx-pipe,
[data-di-modal] [data-di-pipe] .egx-pipe, [data-di-modal] [data-di-aipipe] .egx-pipe,
[data-di-import] [data-di-impipe] .egx-pipe,
[data-di-exportov] [data-di-expipe] .egx-pipe { margin-top: 0; }
/* Form dispatch_out/dispatch_in/company/category/shift (them/sua):
   vien o LUON mau lab mac dinh o moi trang thai (DesignUI §12) —
   is-filled/is-dirty/valid/invalid/warn chi giu cue badge/chu/icon,
   KHONG doi border-color. Ap dung ca dropzone scan (.egx-udrop kieu
   Upload PDF template) de dong nhat toan form. */
[data-do-modal] .egx-fbox.is-filled:not(:focus-within),
[data-do-modal] .egx-fbox.is-dirty:not(:focus-within),
[data-do-modal] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-do-modal] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-do-modal] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-do-modal] .egx-udrop.is-filled:not(:focus-within),
[data-do-modal] .egx-udrop.is-dirty:not(:focus-within),
[data-do-modal] .egx-field.is-valid .egx-udrop:not(:focus-within),
[data-do-modal] .egx-field.is-invalid .egx-udrop:not(:focus-within),
[data-do-modal] .egx-field.is-warn .egx-udrop:not(:focus-within),
[data-do-import] .egx-fbox.is-filled:not(:focus-within),
[data-do-import] .egx-fbox.is-dirty:not(:focus-within),
[data-do-import] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-do-import] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-do-import] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-do-exportov] .egx-fbox.is-filled:not(:focus-within),
[data-do-exportov] .egx-fbox.is-dirty:not(:focus-within),
[data-do-exportov] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-do-exportov] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-do-exportov] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-di-modal] .egx-fbox.is-filled:not(:focus-within),
[data-di-modal] .egx-fbox.is-dirty:not(:focus-within),
[data-di-modal] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-di-modal] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-di-modal] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-di-modal] .egx-udrop.is-filled:not(:focus-within),
[data-di-modal] .egx-udrop.is-dirty:not(:focus-within),
[data-di-modal] .egx-field.is-valid .egx-udrop:not(:focus-within),
[data-di-modal] .egx-field.is-invalid .egx-udrop:not(:focus-within),
[data-di-modal] .egx-field.is-warn .egx-udrop:not(:focus-within),
[data-di-import] .egx-fbox.is-filled:not(:focus-within),
[data-di-import] .egx-fbox.is-dirty:not(:focus-within),
[data-di-import] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-di-import] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-di-import] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-di-exportov] .egx-fbox.is-filled:not(:focus-within),
[data-di-exportov] .egx-fbox.is-dirty:not(:focus-within),
[data-di-exportov] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-di-exportov] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-di-exportov] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-sh-modal] .egx-fbox.is-filled:not(:focus-within),
[data-sh-modal] .egx-fbox.is-dirty:not(:focus-within),
[data-sh-modal] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-sh-modal] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-sh-modal] .egx-field.is-warn .egx-fbox:not(:focus-within),
[data-ho-modal] .egx-fbox.is-filled:not(:focus-within),
[data-ho-modal] .egx-fbox.is-dirty:not(:focus-within),
[data-ho-modal] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-ho-modal] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-ho-modal] .egx-field.is-warn .egx-fbox:not(:focus-within) { border-color: var(--line); }
/* Tablet (<=1024): gon hon — giam padding/gap. Chi dung breakpoint lab
   1024; mobile <=640 ghi de 1-col trong egx-demo-mobile.css. */
@media (max-width: 1024px) {
    [data-do-modal] .egl-pbody,
    [data-do-import] .egl-pbody,
    [data-do-exportov] .egl-pbody,
    [data-di-modal] .egl-pbody,
    [data-di-import] .egl-pbody,
    [data-di-exportov] .egl-pbody,
    [data-em-modal] .egl-pbody,
    [data-em-doc] .egl-pbody { padding: 12px; gap: 8px; }
    [data-do-modal] [data-do-pipe], [data-do-modal] [data-do-aipipe],
    [data-do-import] [data-do-impipe],
    [data-do-exportov] [data-do-expipe],
    [data-di-modal] [data-di-pipe], [data-di-modal] [data-di-aipipe],
    [data-di-import] [data-di-impipe],
    [data-di-exportov] [data-di-expipe],
    [data-em-modal] [data-em-pipe] { padding: 12px; }
}
/* Popup can giua doc (template [data-tabledetail] + company chi tiet
   [data-co-view] + form [data-co-modal] + category chi tiet [data-ca-view]
   + form [data-ca-modal] + dispatch_out chi tiet [data-do-view] +
   dispatch_in chi tiet [data-di-view] + employee chi tiet [data-em-view] +
   form [data-em-modal] + in tai lieu [data-em-doc] + shift chi tiet
   [data-sh-view] + form [data-sh-modal]): ghi de lab top:6%
   (employee-green.css:270,590) — top:50% + translate(-50%,-50%) +
   max-height 86vh + flex column; pbody cuon doc. Mobile giu dang sheet
   top:12px/bottom:12px (translateX) — tru cac popup co rule hug rieng
   trong egx-demo-mobile.css (do/di/em: hug + can giua, DesignUI §15.7). */
[data-tabledetail] > .egl-panel,
[data-co-view] > .egl-panel,
[data-co-modal] > .egl-panel,
[data-ca-view] > .egl-panel,
[data-ca-modal] > .egl-panel,
[data-do-view] > .egl-panel,
[data-do-modal] > .egl-panel,
[data-do-import] > .egl-panel,
[data-do-exportov] > .egl-panel,
[data-di-view] > .egl-panel,
[data-di-modal] > .egl-panel,
[data-di-import] > .egl-panel,
[data-di-exportov] > .egl-panel,
[data-em-view] > .egl-panel,
[data-em-modal] > .egl-panel,
[data-em-doc] > .egl-panel,
[data-sh-view] > .egl-panel,
[data-sh-modal] > .egl-panel,
[data-ho-view] > .egl-panel,
[data-ho-modal] > .egl-panel,
[data-dp-view] > .egl-panel,
[data-dp-modal] > .egl-panel {
    top: 50%; transform: translate(-50%, -50%);
    max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden;
}
[data-tabledetail] > .egl-panel > .egl-pbody,
[data-co-view] > .egl-panel > .egl-pbody,
[data-ca-view] > .egl-panel > .egl-pbody,
[data-do-view] > .egl-panel > .egl-pbody,
[data-do-modal] > .egl-panel > .egl-pbody,
[data-do-import] > .egl-panel > .egl-pbody,
[data-do-exportov] > .egl-panel > .egl-pbody,
[data-di-view] > .egl-panel > .egl-pbody,
[data-di-modal] > .egl-panel > .egl-pbody,
[data-di-import] > .egl-panel > .egl-pbody,
[data-di-exportov] > .egl-panel > .egl-pbody,
[data-em-view] > .egl-panel > .egl-pbody,
[data-em-modal] > .egl-panel > .egl-pbody,
[data-sh-view] > .egl-panel > .egl-pbody,
[data-sh-modal] > .egl-panel > .egl-pbody,
[data-ho-view] > .egl-panel > .egl-pbody,
[data-ho-modal] > .egl-panel > .egl-pbody,
[data-dp-view] > .egl-panel > .egl-pbody,
[data-dp-modal] > .egl-panel > .egl-pbody { overflow-y: auto; min-height: 0; }
/* Chi tiet template: gia tri (.elb-vval) trong .elb-view-main CAN GIUA,
   tieu de (.elb-vkey) giu trai — giong company (DesignUI §15.9). Ghi de
   text-align:left toan cuc (employee-green.css:322). Scope rieng
   [data-tabledetail] de khong anh huong trang khac. */
[data-tabledetail] .elb-view-main .elb-vval { text-align: center; }
@media (max-width: 640px) {
    [data-tabledetail] > .egl-panel,
    [data-co-view] > .egl-panel,
    [data-co-modal] > .egl-panel,
    [data-ca-view] > .egl-panel,
    [data-ca-modal] > .egl-panel,
    [data-do-view] > .egl-panel,
    [data-do-modal] > .egl-panel,
    [data-do-import] > .egl-panel,
    [data-do-exportov] > .egl-panel,
    [data-di-view] > .egl-panel,
    [data-di-modal] > .egl-panel,
    [data-di-import] > .egl-panel,
    [data-di-exportov] > .egl-panel,
    [data-sh-view] > .egl-panel,
    [data-sh-modal] > .egl-panel,
    [data-dp-view] > .egl-panel,
    [data-dp-modal] > .egl-panel { top: 12px; bottom: 12px; transform: translateX(-50%); max-height: none; }
}
/* Tablet (<=1024, gom 641..1024 cua Task): side thu gon (160px + avatar nho),
   main van du grid 2-col + addr full-width. Chi dung breakpoint lab 1024. */
@media (max-width: 1024px) {
    [data-co-view] .elb-view-side { max-width: 160px; padding: 12px 10px; }
    [data-co-view] .elb-vavatar { width: 64px; height: 64px; font-size: 22px; }
    [data-co-view] .elb-view-main { padding: 12px; }
    [data-co-view] .elb-vgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
/* Category popup chi tiet [data-ca-view] (task detail): PC giu nguyen lab
   elb-view-detail (side 22%/210px + main cuon doc + grid 2-col).
   Lab .egl-pfoot (employee-green.css:323) flex nhung KHONG co gap -> 2 nut
   (In + Sua) dinh sat nhau. Scope [data-ca-view] vi modal dock ra body
   khi mo; khong ghi de lab, chi ghim lai de PC nguyen ven. */
[data-ca-view] .elb-view-detail { display: flex; }
[data-ca-view] .elb-view-side { flex: 0 0 22%; max-width: 210px; }
[data-ca-view] .elb-view-main { min-width: 0; }
[data-ca-view] .elb-vgrid { grid-template-columns: 1fr 1fr; }
[data-ca-view] .egl-pfoot { gap: 8px; }
/* Chi tiet category: gia tri (.elb-vval) trong .elb-view-main CAN GIUA,
   tieu de (.elb-vkey) giu trai — giong company/template (DesignUI §15.9).
   Ghi de text-align:left toan cuc (employee-green.css:322). Scope rieng
   [data-ca-view] de khong anh huong trang khac. */
[data-ca-view] .elb-view-main .elb-vval { text-align: center; }
/* 2 pill side popup chi tiet category (Hoat dong + Da xac minh) — COPY y
   mau template: container flex column + gap 8px + can giua, scope rieng
   [data-ca-pills] de khong anh huong trang khac; pill tao bang DOM nen
   khong co <br>/khoang trang giua pill (tranh de -7px nhu DesignUI §15.3). */
[data-ca-pills] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Tablet (<=1024, gom 641..1024 cua Task): side thu gon (160px + avatar nho),
   main van du grid 2-col. Chi dung breakpoint lab 1024. */
@media (max-width: 1024px) {
    [data-ca-view] .elb-view-side { flex: 0 0 160px; max-width: 160px; padding: 12px 10px; }
    [data-ca-view] .elb-vavatar { width: 64px; height: 64px; font-size: 22px; }
    [data-ca-view] .elb-view-main { padding: 12px; }
    [data-ca-view] .elb-vgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
/* Company popup form them/sua (task_4): PC 2-col elb-vgrid + pipeline luu.
   Panel om noi dung (max-height 86vh nhu gallery demo, flex column nhu
   [data-demomodalbox] .egl-panel o tren), pbody cuon doc; pbody grid gap 10
   de cac .elb-vgrid + field full cach deu nhau; ong pipeline nam giua pbody
   va pfoot nen can padding ngang 14 nhu pbody (margin-top 0 nhu mau gallery
   inline margin-top:0). Scope [data-co-modal] vi modal dock ra body khi mo. */
[data-co-modal] > .egl-panel { height: auto; max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-co-modal] .egl-pbody { padding: 14px; display: grid; gap: 10px;
    align-content: start; overflow-y: auto; min-height: 0; }
[data-co-modal] .elb-vgrid { gap: 10px; }
[data-co-modal] .egl-pfoot { gap: 8px; }
[data-co-modal] [data-co-pipe] { padding: 14px; }
[data-co-modal] [data-co-pipe] .egx-pipe { margin-top: 0; }
/* Dispatch_out/dispatch_in modal xem PDF: khung lab egl-modal/egl-veil/
   egl-panel gan them canh class .tpl-pdf-* (giong gallery
   [data-pdfmodalbox]) — CSS lab toan cuc lo khung panel/veil/head, rule
   scoped chi giu phan rieng (rong 880px, can giua, noi dung, iframe, nut
   44px). API dung chung pdfview.js (8 trang) giu nguyen nho hook
   [data-do-pdfmodal]/[data-di-pdfmodal] khong doi; veil khong dong popup
   (DesignUI §15.8). */
[data-do-pdfmodal], [data-di-pdfmodal] { display: none; }
[data-do-pdfmodal].is-show, [data-di-pdfmodal].is-show { display: flex; align-items: center; justify-content: center;
    position: fixed; inset: 0; z-index: 60; padding: 24px; }
[data-do-pdfmodal] > .egl-panel.tpl-pdf-card, [data-di-pdfmodal] > .egl-panel.tpl-pdf-card { top: 50%; bottom: auto; height: auto; transform: translate(-50%, -50%);
    /* Specificity 0,3,0 de thang rule chung .tpl-pdf-modal .tpl-pdf-card
       (neo badge cho cac trang khac, nam sau trong file) + bottom:12px
       cua sheet mobile lab: panel lab phai absolute + hug noi dung de
       can giua doc (DesignUI §15.7). */
    position: absolute; }
[data-do-pdfmodal] .tpl-pdf-card, [data-di-pdfmodal] .tpl-pdf-card { width: min(880px, 100%); max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-do-pdfmodal].is-full, [data-di-pdfmodal].is-full { padding: 12px; }
[data-do-pdfmodal].is-full .tpl-pdf-card, [data-di-pdfmodal].is-full .tpl-pdf-card { width: 100%; max-height: none; height: calc(100vh - 24px); height: calc(100dvh - 24px); }
[data-do-pdfmodal] .tpl-pdf-title, [data-di-pdfmodal] .tpl-pdf-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-weight: 700; }
[data-do-pdfmodal] .tpl-pdf-title span, [data-di-pdfmodal] .tpl-pdf-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-do-pdfmodal] .tpl-pdf-head-actions, [data-di-pdfmodal] .tpl-pdf-head-actions { display: inline-flex; gap: 8px; margin-left: auto; }
[data-do-pdfmodal] .tpl-pdf-expand, [data-do-pdfmodal] .tpl-pdf-close, [data-di-pdfmodal] .tpl-pdf-expand, [data-di-pdfmodal] .tpl-pdf-close { min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; color: var(--text); cursor: pointer; border-radius: 6px; }
[data-do-pdfmodal] .tpl-pdf-body, [data-di-pdfmodal] .tpl-pdf-body { flex: 1; min-height: 320px; overflow: auto; background: var(--soft); }
[data-do-pdfmodal] .tpl-pdf-body iframe, [data-di-pdfmodal] .tpl-pdf-body iframe { display: block; width: 100%; min-height: 70vh; min-height: 70dvh; border: 0; background: #fff; }
@media (max-width: 640px) {
    [data-do-pdfmodal].is-show, [data-di-pdfmodal].is-show { padding: 12px; }
    [data-do-pdfmodal] .tpl-pdf-body, [data-di-pdfmodal] .tpl-pdf-body { min-height: 240px; }
}
/* PDF mobile (pdfview.js render anh server, che do .pdfjs): mac dinh vua
   rong popup + nut zoom (DesignUI §15.16). Breakpoint 768px khop
   isMobilePdf() — desktop (iframe) khong bao gio sinh node .pdfjs-* nen
   rule chi tac dong mobile. pdfview.js dung chung 8 trang (class
   .tpl-pdf-* generic) nen rule de global, khong scope theo trang. */
/* Nut zoom do pdfview.js chen vao head (ensureZoomBtns, nhu nut In):
   desktop an (iframe tu co dieu khien), mobile hien 44px nhu nut ke. */
.tpl-pdf-head-actions .tpl-pdf-zoom { display: none; }
/* Toolbar kieu gallery trong popup co [data-pdf-toolbar]
   (dispatch_out/dispatch_in): mac dinh an (desktop giu nguyen iframe +
   expand/close — chi sua mobile); mobile + che do anh (.pdfjs) thi hien
   flex nhu gallery. */
[data-do-pdfmodal] [data-pdf-toolbar], [data-di-pdfmodal] [data-pdf-toolbar], [data-em-pdfmodal] [data-pdf-toolbar] { display: none; }
.tpl-pdf-modal .tpl-pdf-card { position: relative; }
@media (max-width: 768px) {
    /* An iframe rong o che do anh (khong de cuc trang duoi anh). */
    .tpl-pdf-modal.pdfjs .tpl-pdf-body iframe { display: none; }
    .pdfjs-view { width: 100%; align-items: stretch; gap: 10px; padding: 12px; cursor: default; }
    .pdfjs-pages { width: 100%; display: flex; flex-direction: column; gap: 10px; }
    .pdfjs-pages img { display: block; width: 100%; height: auto; border-radius: 4px; }
    .pdfjs-status { padding: 10px 12px; text-align: center; font-size: 12px; color: var(--muted); }
    .pdfjs-pagebadge { position: absolute; right: 10px; bottom: 10px; z-index: 5;
        font-size: 11px; font-weight: 700; color: var(--text); background: var(--card);
        border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; pointer-events: none; }
    .pdfjs-pagebadge:empty { display: none; }
    .tpl-pdf-modal.pdfjs .tpl-pdf-head-actions .tpl-pdf-zoom { display: inline-flex; min-width: 44px; min-height: 44px;
        align-items: center; justify-content: center; background: none; border: 0;
        color: var(--text); cursor: pointer; border-radius: 6px; }
    /* Toolbar dispatch_out/dispatch_in/employee: chi mobile + che do anh (desktop an han). */
    [data-do-pdfmodal].pdfjs [data-pdf-toolbar], [data-di-pdfmodal].pdfjs [data-pdf-toolbar], [data-em-pdfmodal].pdfjs [data-pdf-toolbar] { display: flex; }
    /* Nut toolbar mobile gon 32px (gallery goc 30px, tung nang 44px theo
       chuan touch nhung tran 1 hang o man hep 390px): 6 nut 32 + 2 nhan
       40 + khe vua gon trong body popup khong can cuon ngang. Chi mobile
       (<=768px) theo yeu cau; desktop giu nguyen. */
    [data-do-pdfmodal] [data-pdf-toolbar] .egx-pdftbtn, [data-di-pdfmodal] [data-pdf-toolbar] .egx-pdftbtn, [data-em-pdfmodal] [data-pdf-toolbar] .egx-pdftbtn { min-width: 32px; height: 32px; font-size: 12px; padding: 0 6px; }
    [data-do-pdfmodal] [data-pdf-toolbar] .egx-pdfzoom, [data-do-pdfmodal] [data-pdf-toolbar] .egx-pdfpage,
    [data-di-pdfmodal] [data-pdf-toolbar] .egx-pdfzoom, [data-di-pdfmodal] [data-pdf-toolbar] .egx-pdfpage,
    [data-em-pdfmodal] [data-pdf-toolbar] .egx-pdfzoom, [data-em-pdfmodal] [data-pdf-toolbar] .egx-pdfpage { min-width: 40px; font-size: 11px; }
}
/* Employee modal xem PDF/anh/word: khung lab egl-modal/egl-veil/egl-panel
   gan them class .tpl-pdf-* dung chung (giong dispatch_out); veil khong
   dong popup (§15.8). Toolbar kieu gallery (mobile-only) nhu dispatch_out. */
[data-em-pdfmodal], [data-em-imgmodal], [data-em-wordov] { display: none; }
[data-em-pdfmodal].is-show, [data-em-imgmodal].is-show, [data-em-wordov].is-show { display: flex; align-items: center; justify-content: center;
    position: fixed; inset: 0; z-index: 60; padding: 24px; }
[data-em-pdfmodal] > .egl-panel.tpl-pdf-card, [data-em-imgmodal] > .egl-panel.tpl-pdf-card { top: 50%; bottom: auto; height: auto; transform: translate(-50%, -50%); position: absolute; }
[data-em-pdfmodal] .tpl-pdf-card, [data-em-imgmodal] .tpl-pdf-card { width: min(880px, 100%); max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-em-wordov] > .egl-panel { top: 50%; bottom: auto; height: auto; transform: translate(-50%, -50%); position: absolute;
    width: min(880px, 100%); max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column; overflow: hidden; }
[data-em-pdfmodal].is-full, [data-em-imgmodal].is-full, [data-em-wordov].is-full { padding: 12px; }
[data-em-pdfmodal].is-full .tpl-pdf-card, [data-em-imgmodal].is-full .tpl-pdf-card, [data-em-wordov].is-full > .egl-panel { width: 100%; max-height: none; height: calc(100vh - 24px); height: calc(100dvh - 24px); }
[data-em-pdfmodal] .tpl-pdf-title, [data-em-imgmodal] .tpl-pdf-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-weight: 700; }
[data-em-pdfmodal] .tpl-pdf-title span, [data-em-imgmodal] .tpl-pdf-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-em-pdfmodal] .tpl-pdf-head-actions, [data-em-imgmodal] .tpl-pdf-head-actions { display: inline-flex; gap: 8px; margin-left: auto; }
[data-em-pdfmodal] .tpl-pdf-expand, [data-em-pdfmodal] .tpl-pdf-close, [data-em-imgmodal] .tpl-pdf-expand, [data-em-imgmodal] .tpl-pdf-close { min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; color: var(--text); cursor: pointer; border-radius: 6px; }
[data-em-pdfmodal] .tpl-pdf-body, [data-em-imgmodal] .tpl-pdf-body { flex: 1; min-height: 320px; overflow: auto; background: var(--soft); }
[data-em-pdfmodal] .tpl-pdf-body iframe, [data-em-imgmodal] .tpl-pdf-body img { display: block; width: 100%; border: 0; background: #fff; }
[data-em-pdfmodal] .tpl-pdf-body iframe { min-height: 70vh; min-height: 70dvh; }
/* Word editor overlay (employee): tai su dung egl-modal/egl-phead/egl-pbody;
   iframe phai fill pbody, nut hanh dong dung egl-act/egl-x (project CSS). */
[data-em-wordov] .egl-pbody { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
[data-em-wordov] .word-editor-frame { flex: 1; width: 100%; min-height: 60vh; min-height: 60dvh; border: 0; display: block; background: var(--card); }
[data-em-wordov] .egl-act { margin-left: auto; }
[data-em-wordov].is-full .word-editor-frame { min-height: 0; }
@media (max-width: 640px) {
    [data-em-pdfmodal].is-show, [data-em-imgmodal].is-show, [data-em-wordov].is-show { padding: 12px; }
    [data-em-pdfmodal] .tpl-pdf-body, [data-em-imgmodal] .tpl-pdf-body { min-height: 240px; }
    [data-em-wordov] .word-editor-frame { min-height: 50vh; min-height: 50dvh; }
}
   nhat ky AI. Lab chua co 3 kieu nay (DesignUI §14): them scope rieng
   [data-do-modal]/[data-di-modal] toi thieu, khai bao o UI-Components §5.
   Hang Gop nam TRONG dropzone (.egx-udrop nen soft): phai co mat card
   rieng nhu chip .egx-ufile (nen card + vien line + radius 6) thi ca 2
   theme moi tach khoi nen dropzone; unchecked o dark khong con chim vao
   nen. Focus theo dung cong thuc .egx-fbox:focus-within cua lab (vien
   accent + glow). Checkbox native giu accent-color token. KHONG che
   appearance rieng (giu hanh vi + a11y goc). */
[data-do-modal] .egx-cal-foot, [data-di-modal] .egx-cal-foot, [data-em-modal] .egx-cal-foot { display: flex; gap: 8px; }
[data-do-modal] .egx-cal-foot .egl-chipbtn, [data-di-modal] .egx-cal-foot .egl-chipbtn, [data-em-modal] .egx-cal-foot .egl-chipbtn { flex: 1; justify-content: center; }
[data-do-modal] .egx-check, [data-di-modal] .egx-check, [data-em-modal] .egx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; max-width: 100%; }
[data-do-modal] .egx-check input, [data-di-modal] .egx-check input, [data-em-modal] .egx-check input { width: 16px; height: 16px; accent-color: var(--acc); margin: 0; flex: none; cursor: pointer; }
[data-do-modal] .egx-check:focus-within, [data-di-modal] .egx-check:focus-within, [data-em-modal] .egx-check:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
[data-do-modal] .egx-pipe-log,
[data-di-modal] .egx-pipe-log,
[data-em-modal] .egx-pipe-log { display: grid; gap: 4px; max-height: 120px; overflow-y: auto; font-size: 12px; color: var(--muted); }
/* Form company: vien o LUON mau lab mac dinh o moi trang thai (DesignUI
   §12) — is-filled (:210) / is-dirty (:217) / is-valid / is-invalid /
   is-warn (:256-258) chi giu cue badge/chu/icon, KHONG doi border-color.
   :not(:focus-within) de giu accent focus cua lab (:207). Scope
   [data-co-modal] vi modal dock ra body khi mo. */
[data-co-modal] .egx-fbox.is-filled:not(:focus-within),
[data-co-modal] .egx-fbox.is-dirty:not(:focus-within),
[data-co-modal] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-co-modal] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-co-modal] .egx-field.is-warn .egx-fbox:not(:focus-within) { border-color: var(--line); }
/* Tablet (<=1024, gom 641..1024 cua Task): giu 2-col, gon hon — giam
   padding/gap. Chi dung breakpoint lab 1024; mobile <=640 ghi de 1-col
   trong egx-demo-mobile.css. */
@media (max-width: 1024px) {
    [data-co-modal] .egl-pbody { padding: 12px; gap: 8px; }
    [data-co-modal] .elb-vgrid { gap: 8px; }
    [data-co-modal] [data-co-pipe] { padding: 12px; }
}
/* Category popup form them/sua (task form): PC grid 1-col (2 field full)
   + pipeline luu. Panel om noi dung (max-height 86vh nhu gallery demo,
   flex column nhu [data-demomodalbox] .egl-panel o tren), pbody cuon doc;
   pbody grid gap 10 de cac field cach deu nhau; ong pipeline nam giua pbody
   va pfoot nen can padding ngang 14 nhu pbody (margin-top 0 nhu mau gallery
   inline margin-top:0). Scope [data-ca-modal] vi modal dock ra body khi mo. */
[data-ca-modal] > .egl-panel { height: auto; max-height: 86vh; max-height: 86dvh;
    display: flex; flex-direction: column; overflow: hidden; }
[data-ca-modal] .egl-pbody { padding: 14px; display: grid; gap: 10px;
    align-content: start; overflow-y: auto; min-height: 0; }
[data-ca-modal] .egl-pfoot { gap: 8px; }
[data-ca-modal] [data-ca-pipe] { padding: 14px; }
[data-ca-modal] [data-ca-pipe] .egx-pipe { margin-top: 0; }
/* Form category: vien o LUON mau lab mac dinh o moi trang thai (DesignUI
   §12) — is-filled / is-dirty / is-valid / is-invalid /
   is-warn chi giu cue badge/chu/icon, KHONG doi border-color.
   :not(:focus-within) de giu accent focus cua lab. Scope
   [data-ca-modal] vi modal dock ra body khi mo. */
[data-ca-modal] .egx-fbox.is-filled:not(:focus-within),
[data-ca-modal] .egx-fbox.is-dirty:not(:focus-within),
[data-ca-modal] .egx-field.is-valid .egx-fbox:not(:focus-within),
[data-ca-modal] .egx-field.is-invalid .egx-fbox:not(:focus-within),
[data-ca-modal] .egx-field.is-warn .egx-fbox:not(:focus-within) { border-color: var(--line); }
/* Tablet (<=1024, gom 641..1024 cua Task): gon hon — giam padding/gap.
   Chi dung breakpoint lab 1024; mobile <=640 ghi de 1-col
   trong egx-demo-mobile.css. */
@media (max-width: 1024px) {
    [data-ca-modal] .egl-pbody { padding: 12px; gap: 8px; }
    [data-ca-modal] [data-ca-pipe] { padding: 12px; }
}
/* iOS rieng (html.is-ios do app.js danh dau): chan Safari tu phong to
   khi focus o nhap (Safari zoom moi input <16px) + tat double-tap zoom.
   Phai cover TOAN BO input tren trang (search, popup company, filter...).
   Popup form khi mo dock ra body nen cover ca [data-co-modal]. Ban dark/
   light dong bo qua var(--*), html background cung phai dung var de vung
   safe-area duoi footer khong bi trang khi doi theme. */
html { background: var(--bg); }
/* iOS: nhan dien bang CSS (-webkit-touch-callout chi WebKit iOS) de khong
   phu thuoc UA/is-ios — iPadOS bao "Macintosh" nen truoc day bi bo sot.
   Safari iOS tu phong to moi o nhap <16px -> ep 16px (khong doi size chu
   tren Android/PC); tat double-tap zoom tren nut/link. */
@supports (-webkit-touch-callout: none) {
    input, textarea, select { font-size: 16px !important; }
    button, a { touch-action: manipulation; }
}
html.is-ios input,
html.is-ios textarea,
html.is-ios select { font-size: 16px !important; }
html.is-ios [data-company-root] .egl-search input,
html.is-ios [data-co-modal] .egx-fbox input,
html.is-ios .egx-fbox input,
html.is-ios .egx-fbox textarea,
html.is-ios .egl-search input { font-size: 16px !important; }
html.is-ios button,
html.is-ios a { touch-action: manipulation; }
/* Vung safe-area duoi footer (home indicator) phai dong bo theme: html
   nen = card (trung footer) de gap duoi footer khong bi trang khi doi
   dark/light; body van giu --bg cho noi dung. */
html.is-ios { background: var(--card); }
html.is-ios body { background: var(--bg); }
