/* QLGN - Quan ly giai ngan von bao tri duong bo */
:root {
    --qg-pri: #0E4D92; --qg-pri-2: #1565C0; --qg-acc: #F2A900;
    --qg-bg: #F3F5F8; --qg-card: #FFFFFF; --qg-line: #E3E7ED; --qg-text: #1E2A38; --qg-muted: #667385;
    --qg-ok: #1E8E3E; --qg-warn: #E37400; --qg-bad: #C5221F;
    --qg-top-h: 56px; --qg-side-w: 252px; --qg-tab-h: 62px;
}
html, body { background: var(--qg-bg); color: var(--qg-text); }
body { font-family: "Segoe UI", Roboto, Arial, sans-serif; font-size: 14.5px; }
a { color: var(--qg-pri-2); }

/* ---- Top bar ---- */
.qg-top { position: sticky; top: 0; z-index: 1030; height: var(--qg-top-h); display: flex; align-items: center; gap: 10px;
    padding: 0 14px; background: var(--qg-pri); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.qg-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.qg-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--qg-acc); color: #3a2a00; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.qg-brand-t { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.qg-brand-t b { font-size: .98rem; white-space: nowrap; }
.qg-brand-t small { font-size: .78rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.qg-top-r { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.qg-selso { width: 230px; background-color: rgba(255,255,255,.95); }
.qg-ico, .qg-user, .qg-burger { border: 0; background: transparent; color: #fff; height: 38px; min-width: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative; padding: 0 8px; }
.qg-ico:hover, .qg-user:hover, .qg-burger:hover { background: rgba(255,255,255,.14); }
.qg-ico i, .qg-user i, .qg-burger i { font-size: 1.25rem; }
a.qg-ico { text-decoration: none; }
.qg-ico.active { background: rgba(255,255,255,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.qg-badge { position: absolute; top: 3px; right: 2px; background: var(--qg-bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 5px; }

/* ---- Shell ---- */
.qg-shell { display: flex; min-height: calc(100vh - var(--qg-top-h)); }
.qg-side { width: var(--qg-side-w); flex: none; background: #fff; border-right: 1px solid var(--qg-line); padding: 10px 8px 30px;
    position: sticky; top: var(--qg-top-h); height: calc(100vh - var(--qg-top-h)); overflow-y: auto; }
.qg-side-grp { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--qg-muted); font-weight: 700; padding: 14px 12px 6px; }
.qg-side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--qg-text); text-decoration: none; font-weight: 500; }
.qg-side a i { font-size: 1.05rem; color: var(--qg-muted); width: 20px; text-align: center; }
.qg-side a:hover { background: #EEF3FA; }
.qg-side a.active { background: #E3EDF9; color: var(--qg-pri); font-weight: 650; }
.qg-side a.active i { color: var(--qg-pri); }
.qg-side-bg { display: none; }
/* So buoc nhap lieu trong vong tron (menu nhom Ke hoach & giai ngan) */
.qg-step { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--qg-pri); color: #fff; font-size: .78rem; font-weight: 800;
    display: inline-grid; place-items: center; line-height: 1; margin: 0 -1px; box-shadow: 0 0 0 2px #E3EDF9; }
.qg-side a.active .qg-step { background: var(--qg-acc); color: #3a2a00; box-shadow: 0 0 0 2px #fff; }
html.side-min .qg-side .qg-step { width: 26px; height: 26px; font-size: .9rem; }
.qg-has-step { position: relative; }
.qg-step-mini { position: absolute; top: -5px; right: -5px; width: 19px; height: 19px; border-radius: 50%; background: var(--qg-pri); color: #fff;
    font: 800 .7rem/19px "Segoe UI", Roboto, Arial, sans-serif; text-align: center; box-shadow: 0 0 0 2px #fff; }
.qg-side { transition: width .18s ease; }
/* Nut thu gon / mo rong menu: noi bat */
.qg-side-tg { display: flex; align-items: center; justify-content: center; margin: 0 0 6px auto; width: 34px; height: 34px; border: 0; border-radius: 50%;
    background: linear-gradient(135deg, var(--qg-pri-2), var(--qg-pri)); color: #fff; font-size: 1rem;
    box-shadow: 0 3px 10px rgba(14,77,146,.38), 0 0 0 3px #E3EDF9; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.qg-side-tg i { -webkit-text-stroke: 1px currentColor; transition: transform .18s ease; }
.qg-side-tg:hover { transform: scale(1.1); box-shadow: 0 5px 14px rgba(14,77,146,.48), 0 0 0 4px #CFE0F5; }
.qg-side-tg:active { transform: scale(.95); }
.qg-side-tg:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(242,169,0,.55); }
/* Khi da thu gon: mau vang nhan de de thay cho mo lai */
html.side-min .qg-side .qg-side-tg { background: linear-gradient(135deg, #FFC533, var(--qg-acc)); color: #3a2a00; box-shadow: 0 3px 10px rgba(242,169,0,.45), 0 0 0 3px #FFF3D6; }
html.side-min .qg-side .qg-side-tg:hover { box-shadow: 0 5px 14px rgba(242,169,0,.6), 0 0 0 4px #FFE7A8; }
/* Nhap nhay nhe cho den lan bam dau tien */
.qg-side-tg.hint { animation: qg-tg-pulse 1.8s ease-out infinite; }
@keyframes qg-tg-pulse {
    0% { box-shadow: 0 3px 10px rgba(14,77,146,.38), 0 0 0 0 rgba(21,101,192,.55); }
    70% { box-shadow: 0 3px 10px rgba(14,77,146,.38), 0 0 0 12px rgba(21,101,192,0); }
    100% { box-shadow: 0 3px 10px rgba(14,77,146,.38), 0 0 0 0 rgba(21,101,192,0); }
}
@media (prefers-reduced-motion: reduce) { .qg-side-tg.hint { animation: none; } }
@media (min-width: 992px) {
    html.side-min { --qg-side-w: 64px; }
    html.side-min .qg-side { padding: 10px 8px 30px; overflow-x: hidden; }
    html.side-min .qg-side .qg-side-tg { margin: 0 auto 6px; }
    html.side-min .qg-side .qg-side-tg i { transform: rotate(180deg); }
    html.side-min .qg-side-grp { font-size: 0; padding: 8px 0 4px; margin: 0 6px; border-top: 1px solid var(--qg-line); }
    html.side-min .qg-side-grp:first-of-type { border-top: 0; }
    html.side-min .qg-side a { justify-content: center; padding: 9px 0; gap: 0; }
    html.side-min .qg-side a span { display: none; }
    html.side-min .qg-side a i { font-size: 1.2rem; width: auto; }
}
@media (max-width: 991.98px) { .qg-side .qg-side-tg { display: none; } }
/* Nut thu gon nam cung hang voi nhan nhom dau tien ("TONG QUAN"), khong chiem 1 dong rieng */
@media (min-width: 992px) {
    html:not(.side-min) .qg-side .qg-side-tg { position: absolute; top: 10px; right: 10px; margin: 0; z-index: 2; }
    html:not(.side-min) .qg-side > .qg-side-grp:first-of-type { padding-top: 0; padding-right: 52px; min-height: 34px; display: flex; align-items: center; }
}
.qg-main { flex: 1; min-width: 0; padding: 18px 22px 40px; }
.qg-pagehead { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.qg-pagehead h1 { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--qg-pri); }
.qg-pagehead > :not(h1) { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Cards ---- */
.qg-card { background: var(--qg-card); border: 1px solid var(--qg-line); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.qg-card + .qg-card { margin-top: 14px; }
.qg-card h2 { font-size: 1.02rem; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.qg-card h2 small { font-weight: 400; color: var(--qg-muted); font-size: .82rem; }
.qg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.qg-kpi { background: #fff; border: 1px solid var(--qg-line); border-radius: 14px; padding: 14px 16px; }
.qg-kpi .l { color: var(--qg-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.qg-kpi .v { font-size: 1.45rem; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.qg-kpi .s { color: var(--qg-muted); font-size: .8rem; }
.qg-kpi.pri { background: linear-gradient(135deg, var(--qg-pri), var(--qg-pri-2)); color: #fff; border: 0; }
.qg-kpi.pri .l, .qg-kpi.pri .s { color: rgba(255,255,255,.82); }

/* ---- Gauge ---- */
.qg-gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.qg-gauge { text-align: center; background: #fff; border: 1px solid var(--qg-line); border-radius: 14px; padding: 12px 10px 10px; cursor: default; }
.qg-gauge svg { width: 100%; max-width: 220px; height: auto; display: block; margin: 0 auto; }
.qg-gauge .t { font-weight: 650; font-size: .9rem; margin-top: 4px; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; justify-content: center; }
.qg-gauge .s { color: var(--qg-muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.qg-gauge.big svg { max-width: 300px; }
.qg-gauge.big .t { font-size: 1rem; }

/* ---- Toolbar & table ---- */
.qg-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.qg-toolbar .qg-search { max-width: 280px; }
.qg-toolbar .form-select, .qg-toolbar .form-control { width: auto; min-width: 120px; }
.qg-toolbar .sp { flex: 1; }
.qg-tablewrap { overflow: auto; max-height: calc(100vh - 250px); border: 1px solid var(--qg-line); border-radius: 12px; background: #fff; }
table.qg-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
table.qg-table th { position: sticky; top: 0; z-index: 2; background: #EEF2F7; color: #334155; font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--qg-line); white-space: nowrap; cursor: pointer; user-select: none; }
table.qg-table th.nosort { cursor: default; }
table.qg-table th .srt { opacity: .5; font-size: .7rem; margin-left: 3px; }
table.qg-table td { padding: 7px 10px; border-bottom: 1px solid #F0F2F5; vertical-align: top; }
table.qg-table tr:hover td { background: #F8FAFD; }
table.qg-table td.num, table.qg-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.qg-table td.act { white-space: nowrap; width: 1%; }
table.qg-table tfoot td { position: sticky; bottom: 0; background: #F6F8FB; font-weight: 700; border-top: 1px solid var(--qg-line); }
table.qg-table td.wrap { min-width: 260px; max-width: 520px; }
.qg-pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; color: var(--qg-muted); font-size: .85rem; }
.qg-pager .sp { flex: 1; }
.qg-empty { padding: 30px; text-align: center; color: var(--qg-muted); }
.btn-ic { padding: 2px 7px; line-height: 1.2; }
/* Nut thao tac trong cot dau cua bang */
table.qg-table td.has-act { white-space: nowrap; }
table.qg-table td.has-act .cell-v { white-space: normal; }
table.qg-table td.has-act.num .row-act { justify-content: flex-end; }
.row-act { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 5px; }
.row-act:empty { display: none; }
@media (max-width: 991.98px) {
    table.qg-table.cards td.has-act { flex-wrap: wrap; white-space: normal; }
    table.qg-table.cards td.has-act .cell-v { flex: 1; text-align: right; }
    table.qg-table.cards td.has-act.wrap .cell-v { text-align: left; }
    table.qg-table.cards td.has-act .row-act { flex-basis: 100%; justify-content: flex-end; }
}
.pct { display: inline-flex; align-items: center; gap: 6px; min-width: 110px; }
.pct .bar { flex: 1; height: 7px; background: #E8ECF1; border-radius: 4px; overflow: hidden; min-width: 50px; }
.pct .bar i { display: block; height: 100%; border-radius: 4px; }
.tag { display: inline-block; font-size: .74rem; padding: 1px 7px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.tag-ct { background: #FFF3D6; color: #8A5A00; } .tag-lm { background: #E3F2E8; color: #1D6B34; } .tag-th { background: #EDE7F6; color: #5B3B99; }
.tag-khan { background: #FDE2E1; color: #A50E0E; } .tag-qt { background: #FFF0D9; color: #9A5B00; } .tag-tt { background: #E6F0FB; color: #0E4D92; }

/* ---- Modal form ---- */
.qg-form .row > div { margin-bottom: 10px; }
.qg-form label { font-size: .82rem; font-weight: 600; color: #475467; margin-bottom: 3px; }
.qg-form .req::after { content: " *"; color: var(--qg-bad); }
.qg-help { font-size: .78rem; color: var(--qg-muted); }

/* ---- O chon nhieu (type: 'multi') ---- */
.qg-multi { border: 1px solid #DEE2E6; border-radius: 8px; padding: 6px 8px; background: #fff; }
.qg-multi-l { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; max-height: 220px; overflow-y: auto; }
.qg-multi-o { display: flex; align-items: center; gap: 6px; padding: 4px 2px; cursor: pointer; font-size: .9rem; margin: 0; }
.qg-multi-o input { margin: 0; flex: none; }
.qg-multi-n { margin-top: 2px; }

/* ---- Import preview ---- */
.qg-imp-table { max-height: 50vh; overflow: auto; font-size: .8rem; }
.qg-imp-table table td, .qg-imp-table table th { padding: 3px 6px; border: 1px solid #eee; white-space: nowrap; }
.qg-imp-table tr.err td { background: #FFF1F0; }

/* ---- Cay chuyen tiep ---- */
.ct-tree { list-style: none; padding: 0; margin: 0; }
.ct-root { border: 1px solid var(--qg-line); border-radius: 12px; margin-bottom: 10px; background: #fff; overflow: hidden; }
.ct-root > .ct-hd { display: flex; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; background: #F8FAFD; }
.ct-root > .ct-hd .nm { font-weight: 600; flex: 1; min-width: 0; }
.ct-chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; padding: 12px; }
.ct-node { border: 1px solid var(--qg-line); border-radius: 12px; padding: 10px 12px; min-width: 210px; background: #fff; position: relative; }
.ct-node .y { font-weight: 800; color: var(--qg-pri); font-size: 1.05rem; }
.ct-node .r { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; font-variant-numeric: tabular-nums; }
.ct-node .r b { font-weight: 650; }
.ct-node.root { border-color: #9CC3EC; }
.ct-arrow { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 8px; color: var(--qg-warn); font-size: .78rem; font-weight: 700; min-width: 92px; text-align: center; }
.ct-arrow i { font-size: 1.5rem; }
.ct-end { display: flex; align-items: center; padding: 0 10px; color: var(--qg-muted); font-size: .8rem; }

/* ---- Tai lieu ---- */
.fb-list .fb-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #F0F2F5; }
.fb-list .fb-item i { font-size: 1.3rem; color: var(--qg-muted); }
.fb-list .fb-item .nm { flex: 1; min-width: 0; word-break: break-word; }
.fb-list .fb-item.dir i { color: #E0A100; }

/* ---- Thong bao ---- */
.tb-item { padding: 12px 16px; border-bottom: 1px solid var(--qg-line); cursor: pointer; }
.tb-item.unread { background: #F2F7FE; }
.tb-item .h { font-weight: 650; }
.tb-item .m { font-size: .8rem; color: var(--qg-muted); }
.tb-item .c { font-size: .88rem; margin-top: 4px; white-space: pre-line; display: none; }
.tb-item.open .c { display: block; }

/* ---- Tabbar mobile (kieu app) ---- */
.qg-tabbar { display: none; }
.qg-sheet[hidden] { display: none !important; }
@media (max-width: 991.98px) {
    :root { --qg-top-h: 54px; }
    body.qg-app { padding-bottom: calc(var(--qg-tab-h) + env(safe-area-inset-bottom, 0px)); }
    .qg-side { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; z-index: 1050; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 6px 0 24px rgba(0,0,0,.18); width: 280px; }
    body.side-open .qg-side { transform: none; }
    body.side-open .qg-side-bg { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 1040; }
    .qg-main { padding: 12px 12px 30px; }
    .qg-selso { width: 150px; }
    .qg-card h2 { flex-wrap: wrap; }
    .qg-tablewrap { max-height: none; }
    .qg-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; height: calc(var(--qg-tab-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px); background: #fff; border-top: 1px solid var(--qg-line); box-shadow: 0 -2px 12px rgba(15,27,42,.07); }
    .qg-tabbar > a, .qg-tabbar > button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
        border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 600; color: #5F6B77; text-decoration: none; position: relative; }
    .qg-tabbar i { font-size: 1.3rem; line-height: 1; }
    .qg-tabbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
    .qg-tabbar > .is-active, .qg-tabbar > [aria-expanded="true"] { color: var(--qg-pri); }
    .qg-tabbar > .is-active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--qg-pri); }
    .qg-tabbar > .is-loading i { animation: qg-spin .7s linear infinite; }
    html[data-tabbar="brand"] .qg-tabbar { background: var(--qg-pri); border-color: var(--qg-pri); }
    html[data-tabbar="brand"] .qg-tabbar > * { color: rgba(255,255,255,.78); }
    html[data-tabbar="brand"] .qg-tabbar > .is-active { color: #fff; }
    html[data-tabbar="brand"] .qg-tabbar > .is-active::before { background: var(--qg-acc); }
    html[data-tabbar="minimal"] .qg-tabbar span { display: none; }
    html[data-tabbar="minimal"] .qg-tabbar i { font-size: 1.45rem; }
    body.kb-open .qg-tabbar { display: none; }
    .qg-sheet { position: fixed; inset: 0; z-index: 1060; }
    .qg-sheet-bd { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
    .qg-sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 18px 18px 0 0; padding: 8px 14px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 80vh; overflow-y: auto; animation: qg-up .2s ease; }
    .qg-sheet-grip { width: 42px; height: 5px; background: #D0D5DD; border-radius: 3px; margin: 4px auto 12px; }
    .qg-sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .qg-sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; text-decoration: none; color: var(--qg-text); font-size: .74rem; text-align: center; line-height: 1.2; }
    .qg-sheet-grid a i { font-size: 1.35rem; width: 46px; height: 46px; border-radius: 14px; background: #EEF3FA; color: var(--qg-pri); display: grid; place-items: center; }
    .qg-sheet-grid a:active { background: #F2F4F7; }
    .qg-sheet-style { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--qg-muted); border-top: 1px solid var(--qg-line); margin-top: 10px; padding-top: 10px; }
    .qg-sheet-style button { border: 1px solid var(--qg-line); background: #fff; border-radius: 14px; padding: 3px 10px; font-size: .76rem; }
    /* Bang -> the tren mobile */
    table.qg-table.cards thead { display: none; }
    table.qg-table.cards, table.qg-table.cards tbody, table.qg-table.cards tr, table.qg-table.cards td { display: block; width: 100%; }
    table.qg-table.cards tr { border-bottom: 8px solid var(--qg-bg); padding: 6px 0; }
    table.qg-table.cards td { border: 0; padding: 3px 12px; display: flex; gap: 10px; justify-content: space-between; text-align: right; max-width: none; min-width: 0; }
    table.qg-table.cards td::before { content: attr(data-l); color: var(--qg-muted); font-size: .78rem; text-align: left; flex: none; max-width: 45%; }
    table.qg-table.cards td.wrap { text-align: left; display: block; font-weight: 600; }
    table.qg-table.cards td.wrap::before { display: block; }
    table.qg-table.cards td.act { width: auto; justify-content: flex-end; }
    table.qg-table.cards td.act::before { content: none; }
    table.qg-table.cards tfoot { display: block; }
    table.qg-table.cards tfoot tr { display: block; }
}
@media (max-width: 575.98px) {
    /* Mobile: luon hien ten he thong, co ngan bang dau ... khi chat */
    .qg-top { gap: 4px; padding: 0 6px; }
    .qg-brand { flex: 1 1 auto; min-width: 0; gap: 8px; }
    .qg-logo { width: 30px; height: 30px; font-size: 1rem; }
    .qg-brand-t { min-width: 0; }
    .qg-brand-t b { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
    .qg-brand-t small { font-size: .72rem; max-width: none; }
    .qg-top-r { flex: none; gap: 2px; }
    .qg-selso { width: 104px; padding-right: 1.6rem; font-size: .78rem; }
    .qg-ico, .qg-user, .qg-burger { min-width: 34px; padding: 0 5px; }
}
/* ---- Tro giup ngu canh (js/help.js) ---- */
.qg-hi { display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; color: #1565C0; opacity: .75; cursor: help; font-size: .92em; line-height: 1; vertical-align: middle; border-radius: 50%; font-weight: 400; text-transform: none; letter-spacing: 0; }
.qg-hi:hover, .qg-hi:focus { opacity: 1; outline: none; color: #0E4D92; }
.qg-hi:focus-visible { box-shadow: 0 0 0 3px rgba(21,101,192,.3); }
.qg-pagehead h1 .qg-hi { font-size: .7em; margin-left: 8px; }
table.qg-table th .qg-hi { font-size: .85em; }
.qg-kpi .qg-hi, .qg-kpi.pri .qg-hi { color: inherit; }
.qg-hpop { position: fixed; z-index: 2200; background: #fff; color: var(--qg-text); border: 1px solid #C9D2DE; border-radius: 12px; box-shadow: 0 14px 36px rgba(15,23,42,.22); font-size: .86rem; line-height: 1.5; animation: qg-fade .12s ease; }
.qg-hpop::before { content: ""; position: absolute; left: calc(var(--ax, 50%) - 7px); width: 12px; height: 12px; background: #fff; border: 1px solid #C9D2DE; transform: rotate(45deg); }
.qg-hpop.down::before { top: -7px; border-right: 0; border-bottom: 0; }
.qg-hpop.up::before { bottom: -7px; border-left: 0; border-top: 0; }
.qg-hpop-t { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--qg-pri); padding: 9px 12px 4px; position: relative; }
.qg-hpop-t i { color: #E0A100; }
.qg-hpop-x { margin-left: auto; border: 0; background: transparent; font-size: 1.25rem; line-height: 1; color: var(--qg-muted); padding: 0 2px; }
.qg-hpop-b { padding: 0 12px 10px; }
.qg-hpop-b code { font-size: .82em; }
.qg-hpop-more { display: block; padding: 7px 12px; border-top: 1px solid var(--qg-line); font-size: .8rem; font-weight: 600; text-decoration: none; background: #F8FAFD; border-radius: 0 0 12px 12px; }
@keyframes qg-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---- Trang huong dan ---- */
.hd-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.hd-toc { position: sticky; top: calc(var(--qg-top-h) + 12px); max-height: calc(100vh - 100px); overflow-y: auto; }
.hd-toc a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--qg-text); text-decoration: none; font-size: .88rem; }
.hd-toc a:hover { background: #EEF3FA; }
.hd-toc .g { font-size: .72rem; text-transform: uppercase; color: var(--qg-muted); font-weight: 700; padding: 10px 10px 4px; letter-spacing: .04em; }
.hd-sec { scroll-margin-top: calc(var(--qg-top-h) + 12px); }
.hd-sec h2 { color: var(--qg-pri); }
.hd-sec h3 { font-size: .98rem; font-weight: 700; margin: 16px 0 6px; }
.hd-sec p, .hd-sec li { line-height: 1.6; }
.hd-role { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; background: #E3EDF9; color: var(--qg-pri); font-weight: 650; }
.hd-steps { counter-reset: st; list-style: none; padding-left: 0; }
.hd-steps > li { counter-increment: st; position: relative; padding: 8px 0 8px 42px; border-bottom: 1px dashed var(--qg-line); }
.hd-steps > li::before { content: counter(st); position: absolute; left: 0; top: 7px; width: 28px; height: 28px; border-radius: 50%; background: var(--qg-pri); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .85rem; }
.hd-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 12px; }
.hd-flow span { background: #fff; border: 1px solid #C9D2DE; border-radius: 10px; padding: 6px 10px; font-size: .84rem; font-weight: 600; }
.hd-flow i { color: var(--qg-muted); }
.hd-note { background: #FFF8E6; border-left: 4px solid #F2A900; padding: 8px 12px; border-radius: 6px; font-size: .88rem; margin: 10px 0; }
.hd-ex { background: #F2F7FE; border-left: 4px solid #1565C0; padding: 8px 12px; border-radius: 6px; font-size: .88rem; margin: 10px 0; }
@media (max-width: 991.98px) { .hd-wrap { grid-template-columns: 1fr; } .hd-toc { position: static; max-height: none; } }

/* ---- Khung co the thu gon (Tong quan: Chuyen tieu von) - cung kieu nut voi menu trai ---- */
.qg-pane-h { display: flex; align-items: center; gap: 8px; }
.qg-pane-t { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.qg-pane-tg { margin: 0; flex: none; }
.qg-panes .qg-pane-side, .qg-panes .qg-pane-main { transition: width .2s ease, flex-basis .2s ease; }
.qg-panes.pane-min .qg-pane-tg { background: linear-gradient(135deg, #FFC533, var(--qg-acc)); color: #3a2a00; box-shadow: 0 3px 10px rgba(242,169,0,.45), 0 0 0 3px #FFF3D6; }
.qg-panes.pane-min .qg-pane-tg i { transform: rotate(180deg); }
.qg-panes.pane-min .qg-pane-side #ctBox { display: none; }
@media (min-width: 992px) {
    /* Thu gon: khung phai con dai hep 72px, chu doc; bang trai gian het phan con lai */
    .qg-panes.pane-min .qg-pane-main { flex: 1 1 0; width: auto; max-width: none; }
    .qg-panes.pane-min .qg-pane-side { flex: 0 0 auto; width: 72px; }
    .qg-panes.pane-min .qg-pane-side .qg-card { height: 100%; padding: 12px 6px; }
    .qg-panes.pane-min .qg-pane-h { flex-direction: column; gap: 12px; margin: 0; }
    .qg-panes.pane-min .qg-pane-tg { order: -1; }
    .qg-panes.pane-min .qg-pane-t { writing-mode: vertical-rl; white-space: nowrap; flex: none; font-size: .95rem; }
    .qg-panes.pane-min .qg-pane-t .bi-diagram-3 { transform: rotate(90deg); }
    .qg-panes.pane-min .qg-pane-t .qg-hi { display: none; }
}

/* ---- So do cong viec (HuongDan "Viec cua ban") ---- */
.hd-diagram { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; padding: 12px; border-radius: 14px; background: #F6F9FD; border: 1px dashed #C9D7EA; }
.hd-lane-t { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--qg-muted); margin-bottom: 6px; }
.hd-lane-c { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hd-lane-a { color: #9AA8BA; font-size: 1.1rem; }
.hd-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border-radius: 22px; background: #fff; border: 1.5px solid #C9D7EA;
    color: var(--qg-text); text-decoration: none; font-weight: 600; font-size: .86rem; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: transform .12s, border-color .12s, box-shadow .12s; }
.hd-chip:hover { transform: translateY(-1px); border-color: var(--qg-pri-2); box-shadow: 0 4px 10px rgba(21,101,192,.18); color: var(--qg-pri); }
.hd-chip.k-num { border-color: #9CC3EC; background: #EEF5FD; }
.hd-letter { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .76rem; font-weight: 800; line-height: 1; }
.hd-letter.k-prep { background: #E7ECF3; color: #475467; box-shadow: 0 0 0 2px #fff; }
.hd-letter.k-view { background: #E3F2E8; color: #1D6B34; box-shadow: 0 0 0 2px #fff; }
.hd-steps2 { display: flex; flex-direction: column; gap: 0; }
.hd-sub { font-weight: 700; color: var(--qg-pri); margin: 14px 0 6px; font-size: .92rem; }
.hd-step { display: flex; gap: 14px; position: relative; padding: 0 0 16px; }
.hd-step::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: #D6E2F1; }
.hd-step:last-child::before { display: none; }
.hd-step-n { flex: none; width: 40px; display: flex; justify-content: center; }
.hd-step-n .qg-step.hd-big, .hd-step-n .hd-letter { width: 38px; height: 38px; font-size: 1.05rem; }
.hd-step-b { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--qg-line); border-radius: 12px; padding: 10px 14px; transition: border-color .15s, box-shadow .15s; }
.hd-step:hover .hd-step-b { border-color: #9CC3EC; box-shadow: 0 4px 14px rgba(21,101,192,.12); }
.hd-step.k-num .hd-step-b { border-left: 4px solid var(--qg-pri); }
.hd-step-t { font-weight: 700; font-size: 1rem; }
.hd-step-w { font-size: .8rem; color: var(--qg-muted); margin: 3px 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.hd-step-w .bi-chevron-right { font-size: .7rem; }
.hd-where-l { font-weight: 600; color: #475467; }
.hd-mi { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 4px; border-radius: 8px; background: #E3EDF9; color: var(--qg-pri); font-weight: 650; }
.hd-mi .qg-step { width: 18px; height: 18px; font-size: .68rem; box-shadow: none; }
.hd-mi .bi { padding-left: 3px; }
.hd-step-b ul { margin: 0 0 6px; padding-left: 18px; font-size: .9rem; }
.hd-step-b ul li { margin: 2px 0; }
.hd-go { font-size: .78rem; padding: 2px 10px; }
.hd-step.hd-flash .hd-step-b { animation: hd-flash 1.2s ease; }
@keyframes hd-flash { 0%, 60% { box-shadow: 0 0 0 4px rgba(242,169,0,.55); border-color: var(--qg-acc); } 100% { box-shadow: none; } }
/* Muc menu trai tuong ung khi re chuot vao buoc */
.qg-side a.hd-glow { background: #FFF3D6 !important; color: #7A4F00 !important; box-shadow: inset 4px 0 0 var(--qg-acc), 0 0 0 2px rgba(242,169,0,.45); }
.qg-side a.hd-glow .qg-step { background: var(--qg-acc); color: #3a2a00; }
@media (max-width: 575.98px) { .hd-lane-a { transform: rotate(90deg); } .hd-lane-c { flex-direction: column; align-items: flex-start; } }

/* Tieu de + nut dong cua bang "Them" */
.qg-sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.qg-sheet-head b { font-size: 1rem; }
.qg-sheet-x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #F2F4F7; color: #344054; display: grid; place-items: center; font-size: 1.1rem; }
.qg-sheet-x:active { background: #E4E7EC; }
.pct { white-space: nowrap; }

/* ---- O chon co tim kiem (js/app.js: App.bodau, ssOpen) ---- */
select.form-select { cursor: pointer; }
.qg-ss { position: fixed; z-index: 2100; background: #fff; border: 1px solid #C9D2DE; border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,.18); overflow: hidden; font-size: .9rem; }
.qg-ss-s { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--qg-line); color: var(--qg-muted); }
.qg-ss-s input { flex: 1; border: 0; outline: 0; padding: 4px 2px; font-size: .9rem; min-width: 0; background: transparent; }
.qg-ss-l { overflow-y: auto; max-height: 300px; padding: 4px 0; overscroll-behavior: contain; }
.qg-ss-o { padding: 6px 12px; cursor: pointer; line-height: 1.3; }
.qg-ss-o:hover, .qg-ss-o.act { background: #EEF3FA; }
.qg-ss-o.cur { color: var(--qg-pri); font-weight: 650; background: #E3EDF9; }
.qg-ss-o.cur::after { content: " ✓"; }
.qg-ss-o.emp { color: var(--qg-muted); }
.qg-ss-o.dis { opacity: .45; pointer-events: none; }
.qg-ss-none { padding: 14px; text-align: center; color: var(--qg-muted); }
.qg-ss-f { padding: 4px 12px; font-size: .74rem; color: var(--qg-muted); border-top: 1px solid var(--qg-line); background: #FAFBFC; }
.qg-ss.sheet { left: 0 !important; right: 0; bottom: 0 !important; top: auto !important; width: auto !important; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: qg-up .18s ease; }
.qg-ss.sheet .qg-ss-l { max-height: 55vh !important; }
.qg-ss.sheet .qg-ss-o { padding: 11px 16px; border-bottom: 1px solid #F2F4F7; }
.qg-ss.sheet .qg-ss-s input { font-size: 16px; }
@keyframes qg-up { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes qg-spin { to { transform: rotate(360deg); } }

/* ---- Dang nhap ---- */
.qg-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, #2a6fc0 0%, transparent 60%), linear-gradient(160deg, #0B3B70, #0E4D92 55%, #13355e); }
.qg-login .box { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.qg-login h1 { font-size: 1.25rem; font-weight: 750; color: var(--qg-pri); margin: 12px 0 2px; }

@media print {
    .qg-top, .qg-side, .qg-tabbar, .qg-toolbar, .qg-pager, .no-print, .qg-pagehead > :not(h1) { display: none !important; }
    .qg-main { padding: 0; } .qg-tablewrap { max-height: none; overflow: visible; border: 0; }
    table.qg-table th { position: static; }
    body { background: #fff; }
}
