/*!
 * 1NET Thu chi - giao dien 2026 (sang / toi) - cung bo voi sale.1net.vn
 * Nap SAU style.css + custom.css. Moi mau deu lay tu bien CSS ben duoi,
 * doi theme = doi thuoc tinh data-theme tren <html> (theme.js).
 */

/* ===================== 1. TOKENS ===================== */
:root,
html[data-theme="light"] {
    --bg: #f2f4f8;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef2f7;
    --border: #e3e8ef;
    --border-strong: #cbd5e1;
    --text: #152033;
    --text-2: #475569;
    --muted: #7b8798;
    --side-bg: #ffffff;
    --side-text: #334155;
    --side-muted: #94a3b8;
    --side-hover: #f3f6fa;
    --side-active-bg: #fff3e6;
    --side-active: #d9730d;
    --accent: #f0892a;
    --accent-2: #f7a957;
    --accent-ink: #ffffff;
    --accent-soft: rgba(240, 137, 42, .12);
    --blue: #2563eb;
    --blue-soft: rgba(37, 99, 235, .10);
    --cyan: #0891b2;
    --green: #16a34a;
    --green-soft: rgba(22, 163, 74, .12);
    --red: #dc2626;
    --red-soft: rgba(220, 38, 38, .10);
    --yellow: #d97706;
    --yellow-soft: rgba(217, 119, 6, .12);
    --purple: #7c3aed;
    --purple-soft: rgba(124, 58, 237, .10);
    --row-alt: #fafbfd;
    --row-hover: #f3f7fc;
    --focus: rgba(240, 137, 42, .35);
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
    --radius: 16px;
    --radius-sm: 10px;
    --side-w: 264px;
    --top-h: 64px;
    --tab-h: 64px;
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #0d1520;
    --surface: #141e2b;
    --surface-2: #182332;
    --surface-3: #1e2b3c;
    --border: #243246;
    --border-strong: #34465f;
    --text: #e8eef6;
    --text-2: #b7c3d3;
    --muted: #8292a8;
    --side-bg: #111a26;
    --side-text: #c8d3e1;
    --side-muted: #66778e;
    --side-hover: #18232f;
    --side-active-bg: #1f2a38;
    --side-active: #f5a650;
    --accent: #f0994a;
    --accent-2: #f6b46b;
    --accent-ink: #1a1206;
    --accent-soft: rgba(240, 153, 74, .16);
    --blue: #4f8ff7;
    --blue-soft: rgba(79, 143, 247, .16);
    --cyan: #22b8d8;
    --green: #34c26b;
    --green-soft: rgba(52, 194, 107, .16);
    --red: #f26464;
    --red-soft: rgba(242, 100, 100, .16);
    --yellow: #f2b544;
    --yellow-soft: rgba(242, 181, 68, .16);
    --purple: #a07af5;
    --purple-soft: rgba(160, 122, 245, .18);
    --row-alt: #162130;
    --row-hover: #1c2939;
    --focus: rgba(240, 153, 74, .40);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* ===================== 2. BASE ===================== */
html { -webkit-tap-highlight-color: transparent; }
body.app {
    background: var(--bg) !important;
    color: var(--text);
    font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-width: 0 !important;
}
body.app::-webkit-scrollbar { width: 10px; height: 10px; }
body.app::-webkit-scrollbar-track { box-shadow: none; background: var(--bg); }
body.app::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; outline: 0; border: 2px solid var(--bg); }
.app ::-webkit-scrollbar { width: 8px; height: 8px; }
.app ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.app ::-webkit-scrollbar-track { background: transparent; }
.app a { color: var(--blue); }
.app a:hover { color: var(--accent); text-decoration: none; }
.app hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.app h1, .app h2, .app h3, .app h4, .app h5, .app h6 { color: var(--text); }
.app .smallsub { color: var(--muted); font-size: 12px; margin: 2px 0 0; }
.app label { color: var(--text-2); }
.app .help-block { color: var(--muted); }
.app ::selection { background: var(--accent-soft); }

/* ===================== 3. SHELL ===================== */
.app-side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1040;
    width: var(--side-w);
    background: var(--side-bg);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.app-brand {
    display: flex; align-items: center; gap: 12px;
    height: 76px; padding: 0 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none !important;
    flex: none;
}
.app-brand-logo {
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.5px;
    box-shadow: 0 4px 12px var(--accent-soft);
}
.app-brand-name { color: var(--text); font-weight: 700; font-size: 16px; line-height: 1.2; display: block; padding-right: 34px; }
.app-brand-sub { color: var(--muted); font-size: 12px; display: block; }

.app-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; overscroll-behavior: contain; }
.app-nav-title {
    font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--side-muted); padding: 18px 12px 6px; white-space: nowrap; overflow: hidden;
}
.app-nav a.app-link, .app-nav button.app-link {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 10px 12px; margin: 2px 0;
    border-radius: 12px; border: 0; background: transparent;
    color: var(--side-text); font-size: 14.5px; font-weight: 500; text-align: left;
    text-decoration: none; cursor: pointer; position: relative;
    transition: background .15s, color .15s;
}
.app-nav .app-link:hover { background: var(--side-hover); color: var(--text); }
.app-nav .app-link .ico {
    width: 30px; height: 30px; border-radius: 9px; flex: none;
    display: grid; place-items: center; font-size: 15px;
    background: var(--surface-3); color: var(--muted);
}
.app-nav .app-link .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav .app-link .badge-n {
    background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700;
    padding: 1px 7px;
}
.app-nav .app-link.active { background: var(--side-active-bg); color: var(--side-active); font-weight: 600; }
.app-nav .app-link.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px;
    border-radius: 0 4px 4px 0; background: var(--accent);
}
.app-nav .app-link.active .ico { background: var(--accent-soft); color: var(--side-active); }
.app-nav .c-blue .ico { color: var(--blue); }
.app-nav .c-green .ico { color: var(--green); }
.app-nav .c-red .ico { color: var(--red); }
.app-nav .c-purple .ico { color: var(--purple); }
.app-nav .c-yellow .ico { color: var(--yellow); }
.app-nav .c-cyan .ico { color: var(--cyan); }
.app-nav .c-accent .ico { color: var(--accent); }
.app-nav .app-group > .app-link .caret { transition: transform .2s; color: var(--side-muted); }
.app-nav .app-group.open > .app-link .caret { transform: rotate(90deg); }
.app-nav .app-sub { display: none; padding: 2px 0 6px 42px; }
.app-nav .app-group.open > .app-sub { display: block; }
.app-nav .app-sub a {
    display: block; padding: 7px 12px; border-radius: 9px;
    color: var(--side-text); font-size: 13.5px; text-decoration: none;
}
.app-nav .app-sub a:hover { background: var(--side-hover); color: var(--text); }
.app-nav .app-sub a.active { color: var(--side-active); background: var(--side-active-bg); font-weight: 600; }

.app-side-foot { padding: 12px; border-top: 1px solid var(--border); flex: none; }
.app-user-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.app-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-weight: 700;
    background: var(--accent-soft); color: var(--side-active);
}
.app-user-card b { display: block; color: var(--text); font-size: 13.5px; line-height: 1.2; }
.app-user-card small { color: var(--muted); font-size: 12px; }
.app-user-card a { margin-left: auto; color: var(--muted); padding: 6px; }
.app-status { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.app-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 0 3px var(--green-soft); }
.app-status .ver { border: 1px solid var(--border); border-radius: 20px; padding: 1px 10px; }

/* KHONG dung overflow clip/hidden o day: phan tran se bi cat mat, khong co thanh cuon (loi "lech phai") */
.app-main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.app-top {
    position: sticky; top: 0; z-index: 1030;
    height: var(--top-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.app-top .grow { flex: 1; min-width: 0; }
.app-iconbtn {
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    display: inline-grid; place-items: center;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-2); font-size: 16px; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none !important;
}
.app-iconbtn:hover { color: var(--accent); border-color: var(--border-strong); }
.app-burger { display: inline-grid; }
.app-top-title { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top-title small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.app-pill {
    display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px;
    border-radius: 12px; font-weight: 600; font-size: 14px; white-space: nowrap;
    text-decoration: none !important; border: 1px solid transparent; cursor: pointer;
}
.app-pill.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink) !important; box-shadow: 0 4px 14px var(--accent-soft); }
.app-pill.primary:hover { filter: brightness(1.05); }
.app-pill.blue { background: var(--blue); color: #fff !important; }
.app-userbtn {
    display: flex; align-items: center; gap: 10px; height: 46px; padding: 4px 6px 4px 14px;
    border-radius: 24px; background: var(--surface); border: 1px solid var(--border);
    cursor: pointer; color: var(--text); position: relative;
}
.app-userbtn .who { text-align: right; line-height: 1.2; }
.app-userbtn .who b { display: block; font-size: 13.5px; }
.app-userbtn .who small { color: var(--muted); font-size: 11.5px; }
.app-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 1100;
}
.app-dropdown.open { display: block; }
.app-dropdown a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    color: var(--text) !important; text-decoration: none; font-size: 14px;
}
.app-dropdown a i { width: 18px; text-align: center; color: var(--muted); }
.app-dropdown a:hover { background: var(--surface-3); }
.app-dropdown a.danger, .app-dropdown a.danger i { color: var(--red) !important; }
.app-dropdown hr { margin: 4px 6px; }

.app-content { flex: 1; padding: 20px 24px 28px; min-width: 0; }
.app-foot { padding: 14px 24px 22px; color: var(--muted); font-size: 12px; text-align: center; }
.app-backdrop { display: none; }
.app-tabbar { display: none; }

.theme-toggle .fa-sun-o { display: none; }
html[data-theme="dark"] .theme-toggle .fa-sun-o { display: inline-block; }
html[data-theme="dark"] .theme-toggle .fa-moon-o { display: none; }

/* ---------- menu trai thu gon (chi bieu tuong), di chuot vao thi bung ra de len noi dung ---------- */
.app-side-pin { display: none; position: absolute; top: 23px; right: 14px; z-index: 2; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; flex: none; }
.app-side-pin:hover { color: var(--accent); border-color: var(--accent); }
.app-side-pin i { transition: transform .2s; }
html.side-mini .app-side-pin i { transform: rotate(180deg); }
@media (min-width: 992px) {
    .app-side-pin { display: inline-grid; place-items: center; }
    .app-side, .app-main { transition: width .2s ease, margin-left .2s ease, box-shadow .2s ease; }
    .app-brand { overflow: hidden; }
    .app-brand > span:not(.app-brand-logo) { min-width: 0; white-space: nowrap; }

    html.side-mini { --side-w: 76px; }
    html.side-mini .app-side { width: 76px; overflow: hidden; }
    html.side-mini .app-main { margin-left: 76px; }
    html.side-mini .app-side .lbl,
    html.side-mini .app-side .caret,
    html.side-mini .app-side .badge-n,
    html.side-mini .app-side .app-brand > span:not(.app-brand-logo),
    html.side-mini .app-side .app-user-card > span:not(.app-avatar),
    html.side-mini .app-side .app-user-card > a,
    html.side-mini .app-side .app-status,
    html.side-mini .app-side .app-side-pin { opacity: 0; pointer-events: none; transition: opacity .12s; }
    html.side-mini .app-side .app-sub { display: none !important; }
    html.side-mini .app-side .app-nav-title { height: 1px; padding: 0; margin: 12px 14px; background: var(--border); overflow: hidden; color: transparent; }
    html.side-mini .app-side .app-brand { padding: 0 17px; }
    html.side-mini .app-side .app-nav { padding: 8px 10px 16px; overflow-x: hidden; }
    html.side-mini .app-side .app-nav .app-link { padding: 10px 13px; }
    html.side-mini .app-side .app-side-foot { padding: 12px 10px; }
    html.side-mini .app-side .app-user-card { padding: 7px 0; justify-content: center; gap: 0; }
    /* opacity 0 van chiem cho => avatar bi day lech trai: luc thu gon bo han ten / nut thoat / trang thai khoi bo cuc */
    html.side-mini .app-side:not(:hover):not(:focus-within) .app-user-card > span:not(.app-avatar),
    html.side-mini .app-side:not(:hover):not(:focus-within) .app-user-card > a,
    html.side-mini .app-side:not(:hover):not(:focus-within) .app-status { display: none; }

    /* bung ra khi di chuot / dung phim Tab vao menu: de len noi dung, khong day trang */
    html.side-mini .app-side:hover,
    html.side-mini .app-side:focus-within { width: var(--side-full, 264px); box-shadow: var(--shadow-lg); }
    html.side-mini .app-side:hover .lbl, html.side-mini .app-side:focus-within .lbl,
    html.side-mini .app-side:hover .caret, html.side-mini .app-side:focus-within .caret,
    html.side-mini .app-side:hover .badge-n, html.side-mini .app-side:focus-within .badge-n,
    html.side-mini .app-side:hover .app-brand > span:not(.app-brand-logo), html.side-mini .app-side:focus-within .app-brand > span:not(.app-brand-logo),
    html.side-mini .app-side:hover .app-user-card > span:not(.app-avatar), html.side-mini .app-side:focus-within .app-user-card > span:not(.app-avatar),
    html.side-mini .app-side:hover .app-user-card > a, html.side-mini .app-side:focus-within .app-user-card > a,
    html.side-mini .app-side:hover .app-status, html.side-mini .app-side:focus-within .app-status,
    html.side-mini .app-side:hover .app-side-pin, html.side-mini .app-side:focus-within .app-side-pin { opacity: 1; pointer-events: auto; transition-delay: .16s; }
    html.side-mini .app-side:hover .app-group.open > .app-sub, html.side-mini .app-side:focus-within .app-group.open > .app-sub { display: block !important; }
    html.side-mini .app-side:hover .app-nav-title, html.side-mini .app-side:focus-within .app-nav-title { height: auto; margin: 0; padding: 18px 12px 6px; background: none; color: var(--side-muted); }
    html.side-mini .app-side:hover .app-user-card, html.side-mini .app-side:focus-within .app-user-card { justify-content: flex-start; padding: 10px 12px; gap: 10px; }
    html.side-mini .app-side:hover .app-nav, html.side-mini .app-side:focus-within .app-nav { overflow-y: auto; }
}

/* ===================== 4. PAGE HEAD / BREADCRUMB ===================== */
.app .page-content-wrapper { padding: 0; min-height: 0; }
.app .page-title {
    font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text);
    margin: 4px 0 4px;
}
.app .page-title small { color: var(--muted); font-size: 14px; font-weight: 500; margin-left: 6px; }
.app .page-bar { background: transparent; margin: 0 0 16px; }
.app .page-bar .breadcrumb {
    background: transparent; padding: 0; margin: 0; font-size: 13px; color: var(--muted);
    display: flex; flex-wrap: wrap; list-style: none;
}
.app .page-bar .breadcrumb a { color: var(--muted); }
.app .page-bar .breadcrumb a:hover { color: var(--accent); }
.app .breadcrumb-item + .breadcrumb-item::before { color: var(--border-strong); }
.app .page-bar .breadcrumb .fa-home { margin-right: 6px; }

/* ===================== 5. CARDS (portlet) ===================== */
.app .portlet {
    background: var(--surface);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0 !important;
    margin-bottom: 20px;
    overflow: visible;
}
.app .portlet > .portlet-title {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    min-height: 0; padding: 14px 18px !important; margin: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    background: transparent !important; color: var(--text) !important;
    border-radius: var(--radius) var(--radius) 0 0;
}
.app .portlet > .portlet-title > .caption {
    float: none; padding: 0 !important; font-size: 16px; font-weight: 700; line-height: 1.4;
    color: var(--text) !important; flex: 1 1 auto;
}
.app .portlet > .portlet-title > .caption:empty { display: none; }
.app .portlet > .portlet-title > .caption > i { color: var(--accent) !important; float: none; margin-right: 8px; font-size: 15px; }
.app .portlet > .portlet-title > .caption a { color: var(--text); }
/* thanh lenh: 1 hang, can trai, hep thi cuon ngang (truoc: xuong dong lech phai) */
.app .portlet > .portlet-title .actions { float: none; padding: 0 0 2px; margin: 0; display: flex; flex-wrap: nowrap; gap: 8px; justify-content: flex-start; overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
.app .portlet > .portlet-title .actions > .btn { flex: none; white-space: nowrap; }
.app .portlet > .portlet-title .caption:not(:empty) + .actions { margin-left: auto; }
.app .portlet > .portlet-title .actions > .btn { margin: 0 !important; }
/* nut lenh (Back / Them / Sua / Xoa...) dat ben PHAI: dung margin-left:auto cho nut dau thay vi justify-content:flex-end
   - khi hang qua dai va phai cuon ngang (mobile), auto = 0 nen khong bi mat cac nut ben trai */
.app .portlet > .portlet-title .actions { margin-left: auto; }
.app .portlet > .portlet-title .actions > :first-child { margin-left: auto !important; }
.app .portlet > .portlet-body { padding: 16px 18px; background: transparent !important; border-radius: 0 0 var(--radius) var(--radius); }
.app .portlet .portlet { box-shadow: none; background: var(--surface-2); border-radius: 14px; margin-bottom: 16px; }
.app .portlet .portlet > .portlet-title { padding: 12px 16px !important; }
.app .portlet .portlet > .portlet-title > .caption { font-size: 14.5px; }
/* mau de cu: box blue-steel / green-haze / red-sunglo -> vach mau tren dau the */
.app .portlet.box { position: relative; }
.app .portlet.box::before { content: ""; position: absolute; left: 14px; right: 14px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
.app .portlet.box.green-haze::before, .app .portlet.box.green::before { background: var(--green); }
.app .portlet.box.red-sunglo::before, .app .portlet.box.red::before { background: var(--red); }
.app .portlet.box.purple::before { background: var(--purple); }
.app .portlet.box.yellow::before { background: var(--accent); }
.app .portlet.box.box-boder::before { display: none; }
.app .portlet-title-sub { color: var(--text-2); }
.app .card { background: var(--surface); border-color: var(--border); border-radius: var(--radius); color: var(--text); }
.app .card-header, .app .card-footer { background: var(--surface-2); border-color: var(--border); }
.app .well, .app .note, .app .alert-info { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }

/* Khung thong bao sau khi luu / bao loi (CPViewControl.ShowMessage) - noi bat, co icon + nut dong */
.app .note.cp-msg {
    --m: var(--blue); --m-soft: var(--blue-soft);
    position: relative; display: flex; align-items: flex-start; gap: 12px;
    margin: 0 0 16px; padding: 14px 44px 14px 16px;
    background: var(--surface); background-image: linear-gradient(var(--m-soft), var(--m-soft));
    border: 1px solid var(--m); border-left: 6px solid var(--m); border-radius: 12px;
    color: var(--text); box-shadow: 0 6px 20px -8px var(--m), var(--shadow);
    animation: cp-msg-in .45s cubic-bezier(.2, .9, .3, 1.2);
}
.app .note.cp-msg.note-success { --m: var(--green); --m-soft: var(--green-soft); }
.app .note.cp-msg.note-danger { --m: var(--red); --m-soft: var(--red-soft); animation: cp-msg-in .45s cubic-bezier(.2, .9, .3, 1.2), cp-msg-shake .5s .45s; }
.app .note.cp-msg.note-warning { --m: var(--yellow); --m-soft: var(--yellow-soft); }
.app .cp-msg-ico { flex: 0 0 auto; font-size: 26px; line-height: 1; color: var(--m); margin-top: 1px; }
.app .cp-msg-body { flex: 1; min-width: 0; font-size: 15px; line-height: 1.45; }
.app .cp-msg-title { display: block; margin-bottom: 2px; font-size: 15.5px; font-weight: 800; color: var(--m); }
.app .cp-msg-body p { margin: 0; font-weight: 600; color: var(--text); }
.app .cp-msg-body p + p { margin-top: 4px; }
.app .note-danger .cp-msg-body p { padding-left: 14px; position: relative; }
.app .note-danger .cp-msg-body p::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--m); }
.app .cp-msg-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; line-height: 28px; cursor: pointer; }
.app .cp-msg-x:hover { background: var(--m-soft); color: var(--m); }
@keyframes cp-msg-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cp-msg-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .app .note.cp-msg { animation: none !important; } }
/* cac khung .note tinh khac trong view (note-danger/warning/success) cung co mau ro rang */
.app .note:not(.cp-msg).note-danger { background: var(--red-soft); border-color: var(--red); border-left: 4px solid var(--red); color: var(--text); }
.app .note:not(.cp-msg).note-warning { background: var(--yellow-soft); border-color: var(--yellow); border-left: 4px solid var(--yellow); color: var(--text); }
.app .note:not(.cp-msg).note-success { background: var(--green-soft); border-color: var(--green); border-left: 4px solid var(--green); color: var(--text); }

/* ===================== 6. BUTTONS ===================== */
.app .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 38px; padding: 7px 14px;
    border-radius: 10px !important; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; line-height: 1.2;
    box-shadow: none; text-shadow: none;
    transition: filter .15s, background .15s, border-color .15s, transform .05s;
    cursor: pointer;
}
.app .btn:active { transform: translateY(1px); }
.app .btn:focus, .app .btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--focus) !important; }
.app .btn i { margin: 0 !important; padding: 0 !important; }
.app .btn.btn-xs, .app .btn.btn-sm, .app .btn.btn-mini { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.app .btn:hover { filter: brightness(1.06); }

.app .btn.default, .app .btn.btn-default, .app .btn.btn-light, .app .btn.grey, .app .btn.btn-secondary {
    background: var(--surface) !important; color: var(--text) !important; border-color: var(--border-strong) !important;
}
.app .btn.default:hover, .app .btn.btn-default:hover, .app .btn.btn-light:hover, .app .btn.grey:hover, .app .btn.btn-secondary:hover { background: var(--surface-3) !important; }
.app .btn.blue, .app .btn.btn-primary, .app .btn.btn-info { background: var(--blue) !important; color: #fff !important; border-color: var(--blue) !important; }
.app .btn.green, .app .btn.btn-success { background: var(--green) !important; color: #fff !important; border-color: var(--green) !important; }
.app .btn.red, .app .btn.btn-danger { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
.app .btn.purple { background: var(--purple) !important; color: #fff !important; border-color: var(--purple) !important; }
.app .btn.yellow, .app .btn.btn-warning { background: linear-gradient(135deg, var(--accent-2), var(--accent)) !important; color: var(--accent-ink) !important; border-color: transparent !important; }
.app .btn.btn-dark { background: var(--text) !important; color: var(--bg) !important; }

/* thanh lenh (Them / Sua / Xoa...) - theo lenh, khong theo thu tu mau */
.app .btn-set .btn { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border-strong) !important; }
.app .btn-set .btn:hover { background: var(--surface-3) !important; }
.app .btn-set .btn i { color: var(--muted); }
.app .btn-set .btn.cmd-new, .app .btn-set .btn.cmd-apply, .app .btn-set .btn.cmd-save {
    background: linear-gradient(135deg, var(--accent-2), var(--accent)) !important; color: var(--accent-ink) !important; border-color: transparent !important;
    box-shadow: 0 4px 12px var(--accent-soft) !important;
}
.app .btn-set .btn.cmd-new i, .app .btn-set .btn.cmd-apply i, .app .btn-set .btn.cmd-save i { color: inherit; }
.app .btn-set .btn.cmd-delete { color: var(--red) !important; }
.app .btn-set .btn.cmd-delete i { color: var(--red); }
.app .btn-set .btn.cmd-publish i { color: var(--green); }
.app .btn-set .btn.cmd-edit i { color: var(--blue); }
.app .btn-set .btn.cmd-back { padding-left: 10px; padding-right: 12px; }

/* trang form (Them / Sua): thanh Luu / Luu & dong dinh dau trang khi cuon => khong phai keo xuong cuoi de luu */
.app .form-horizontal > .portlet > .portlet-title:has(.btn-set) { position: sticky; top: var(--top-h); z-index: 25; background: var(--surface) !important; box-shadow: 0 6px 12px -10px rgba(0, 0, 0, .25); }
/* nhom nut chon nhanh ngay (Thang truoc / Tuan qua / Hom qua / Hom nay) */
.app .dataTables_search .btn.blue, .app .dataTables_search .btn.purple, .app .dataTables_search .btn.yellow, .app .dataTables_search .btn.red, .app .dataTables_search .btn.green {
    background: var(--surface) !important; color: var(--text-2) !important; border-color: var(--border-strong) !important;
}
.app .dataTables_search .btn:hover { color: var(--accent) !important; border-color: var(--accent) !important; }
.app .dataTables_search .btn.blue:first-of-type:not([onclick*="Get"]) { background: var(--blue) !important; color: #fff !important; border-color: var(--blue) !important; }

/* ===================== 7. FORMS ===================== */
.app .form-control, .app input[type="text"], .app input[type="number"], .app input[type="password"], .app input[type="email"], .app input[type="tel"], .app input[type="search"], .app input[type="date"], .app textarea, .app select {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    min-height: 38px;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.app input[type="checkbox"], .app input[type="radio"] { min-height: 0; }
.app textarea.form-control, .app textarea { min-height: 80px; padding: 8px 12px; }
.app .form-control::placeholder, .app input::placeholder, .app textarea::placeholder { color: var(--muted); opacity: 1; }
.app .form-control:focus, .app input:focus, .app textarea:focus, .app select:focus {
    border-color: var(--accent) !important; outline: 0; box-shadow: 0 0 0 3px var(--focus) !important;
}
.app .form-control[readonly], .app .form-control[disabled], .app input[readonly], .app input[disabled] { background-color: var(--surface-3) !important; color: var(--text-2) !important; }
.app .input-sm, .app .form-control.input-sm { height: 38px; min-height: 38px; padding: 6px 12px; font-size: 13.5px; }
.app select.form-control { padding-right: 30px; }
.app .col-form-label, .app .control-label { color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.app .form-group { margin-bottom: 14px; }
.app .form-row-seperated .form-group { border-color: var(--border) !important; }
.app .input-group-addon, .app .input-group-text { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-2); }

/* checkbox kieu cu */
.app .itemCheckBox .check-box { border-color: var(--border-strong); border-radius: 6px; background: var(--surface); }
.app .itemCheckBox input[type="checkbox"]:checked + .check-box,
.app .itemCheckBox input[type="checkbox"]:checked ~ .check-box { border-color: var(--accent); background: var(--accent-soft); }
.app .itemCheckBox .check-box::before, .app .itemCheckBox .check-box::after { background-color: var(--accent); }
.app .radioPure .outer { border-color: var(--border-strong); background: var(--surface); }
.app .radioPure input:checked + .outer { border-color: var(--accent); }
.app .radioPure .inner { background-color: var(--accent); }
.app .radioPure i { color: var(--text); font-style: normal; }

/* select2 */
.app .select2-container--default .select2-selection--single,
.app .select2-container--default .select2-selection--multiple,
.app .select2-container--bootstrap .select2-selection {
    background: var(--surface) !important; border: 1px solid var(--border-strong) !important;
    border-radius: 10px !important; min-height: 38px; color: var(--text);
}
.app .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text) !important; line-height: 36px !important; padding-left: 12px; }
.app .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px !important; }
.app .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--muted); }
.app .select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: var(--muted) transparent transparent; }
.app .select2-container--default.select2-container--focus .select2-selection--multiple,
.app .select2-container--default.select2-container--open .select2-selection--single { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--focus); }
.app .select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--accent-soft); border-color: transparent; color: var(--text); border-radius: 8px; }
.app .select2-dropdown { background: var(--surface) !important; border: 1px solid var(--border-strong) !important; border-radius: 12px !important; overflow: hidden; box-shadow: var(--shadow-lg); color: var(--text); }
.app .select2-search--dropdown .select2-search__field { background: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; border-radius: 8px; min-height: 36px; }
.app .select2-container--default .select2-results__option[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.app .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--accent) !important; color: var(--accent-ink) !important; }
.app .select2-results__option { padding: 8px 12px; }

/* datepicker (fengyuanchen) */
.app .datepicker-container { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 2000 !important; }
.app .datepicker-container::before, .app .datepicker-container::after { display: none; }
.app .datepicker-panel > ul > li { background: transparent; color: var(--text); border-radius: 8px; }
.app .datepicker-panel > ul > li:hover { background: var(--surface-3); }
.app .datepicker-panel > ul > li.muted, .app .datepicker-panel > ul > li.disabled { color: var(--muted); }
.app .datepicker-panel > ul > li.highlighted { background: var(--accent-soft); }
.app .datepicker-panel > ul > li.picked, .app .datepicker-panel > ul > li.picked:hover { background: var(--accent); color: var(--accent-ink); }
.app .datepicker-panel > ul[data-view="week"] > li { color: var(--muted); }

/* jquery-ui autocomplete */
.ui-autocomplete.ui-menu { background: var(--surface) !important; border: 1px solid var(--border-strong) !important; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; max-height: 320px; overflow-y: auto; color: var(--text); }
.ui-menu .ui-menu-item-wrapper { padding: 8px 10px; border-radius: 8px; border: 0 !important; color: var(--text); }
.ui-menu .ui-state-active, .ui-menu .ui-menu-item-wrapper.ui-state-active { background: var(--accent) !important; color: var(--accent-ink) !important; margin: 0 !important; }

/* ===================== 8. TABLES ===================== */
.app .table-scrollable, .app .table-responsive {
    border: 1px solid var(--border); border-radius: 12px; margin: 12px 0 !important;
    background: var(--surface); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.app .table { color: var(--text); margin-bottom: 0; background: transparent; border-collapse: separate; border-spacing: 0; width: 100%; }
.app .table > thead > tr > th, .app .table thead th {
    background: var(--surface-2) !important; color: var(--muted) !important;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    border: 0 !important; border-bottom: 1px solid var(--border) !important;
    padding: 11px 12px; vertical-align: middle; white-space: nowrap;
}
.app .table > thead > tr > th a { color: var(--muted); }
.app .table > tbody > tr > td, .app .table tbody td, .app .table tfoot td {
    border: 0 !important; border-bottom: 1px solid var(--border) !important;
    padding: 11px 12px; vertical-align: middle; background: transparent;
}
.app .table > tbody > tr:last-child > td { border-bottom: 0 !important; }
.app .table-striped > tbody > tr:nth-of-type(odd), .app .table-striped tbody tr:nth-of-type(odd) { background: var(--row-alt); }
.app .table-hover > tbody > tr:hover, .app .table-hover tbody tr:hover { background: var(--row-hover) !important; }
.app .table tr.active > td, .app .table tr.selected > td { background: var(--accent-soft) !important; }
.app .table .publish { color: var(--green) !important; }
.app .table .unpublish { color: var(--red) !important; }
.app .table-bordered { border: 0 !important; }
.app .table td a { font-weight: 600; }
/* to mau theo hang cu (tr.brand-x, phancach) */
.app tr.phancach { border-top: 0 !important; }
.app tr.phancach > td { border-top: 10px solid var(--bg) !important; }
.app tr.brand-1, .app tr.brand-9, .app tr.brand-12, .app tr.brand-17 { background: var(--surface-3) !important; }

/* tong tien phia tren bang */
.app .total-price { margin: 12px 0 0 !important; gap: 10px 0; background: transparent !important; }
.app .total-price > div { background: transparent !important; }
.app .total-price > div > label { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 0 6px 0 0; }
.app .total-price > div > span, .app .total-price span { color: var(--text); font-weight: 700; font-size: 16px; }

/* loc */
.app .dataTables_wrapper .row { row-gap: 10px; }
.app .dataTables_search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app .dataTables_search .form-control { width: auto; flex: 1 1 140px; margin: 0 !important; }
.app .dataTables_search .datepicker { flex: 0 1 140px; width: 140px; }
.app .table-group-actions { margin: 0 8px 8px 0; vertical-align: middle; }
.app .table-group-actions > label { color: var(--muted); font-size: 12px; font-weight: 600; margin-right: 6px; }
.app .table-group-actions .select2-container { min-width: 200px; }

/* phan trang */
.app .dataTables_length, .app .dataTables_paginate { display: flex; align-items: center; gap: 8px; margin: 8px 6px; color: var(--muted); }
.app .pagination { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.app .pagination > li > a, .app .pagination > li > span, .app .pagination .page-link {
    min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 10px;
    border-radius: 10px !important; border: 1px solid var(--border) !important;
    background: var(--surface) !important; color: var(--text-2) !important; margin: 0 !important; font-weight: 600;
}
.app .pagination > li > a:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
.app .pagination > .active > a, .app .pagination > .active > span, .app .pagination .active .page-link, .app .pagination > li.active > a {
    background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-ink) !important;
}
.app .pagination > .disabled > a, .app .pagination > .disabled > span { opacity: .45; }

/* nhan trang thai */
.app .label, .app .badge { border-radius: 20px; padding: 3px 9px; font-weight: 600; font-size: 11.5px; }
.app b.blue, .app b.red, .app .text-success, .app .text-danger { font-weight: 600; }
.app [style*="color: forestgreen"], .app [style*="color:forestgreen"] { color: var(--green) !important; }
.app [style*="color: red"], .app [style*="color:red"], .app [style*="color: #f00"], .app [style*="color:#f00"] { color: var(--red) !important; }
.app .green { color: var(--green) !important; }
.app .red { color: var(--red) !important; }
.app .orange { color: var(--yellow) !important; }


/* ===================== 8b. CHONG TRAN PHAI (dung chung moi bang) ===================== */
/* extend-style.css: .table-bordered td { white-space: nowrap } => ten, dia chi, ghi chu, link khong xuong dong */
/* break-word (KHONG dung anywhere): anywhere lam bang tu co cot toi muc be ca ma so/ngay/so tien giua chu */
.app .table > tbody > tr > td { white-space: normal; overflow-wrap: break-word; }
.app .table > tbody > tr > td.text-center, .app .table td.c-money, .app .table td.l-money { overflow-wrap: normal; }
.app .table > thead > tr > th { white-space: nowrap; }
/* tieu de cot dai (>10 ky tu, vd "LOAI KHOA / LOAI CUA") duoc xuong dong de khong noi rong cot du lieu ngan */
.app .table > thead > tr > th.th-long { white-space: normal; min-width: 76px; }
.app .table > tbody > tr > td, .app .table > thead > tr > th { padding-left: 10px; padding-right: 10px; }
/* o ngan (ngay gio, ma, SDT, ten ngan...) - theme.js tu gan .nw; chi tren man >= 768 (mobile la the) */
@media (min-width: 768px) {
    .app .table > tbody > tr > td.nw { white-space: nowrap; }
}
/* o chu dai (ten SP, dia chi, ghi chu) - khong de cot bi ep qua hep */
@media (min-width: 1200px) {
    .app .table > tbody > tr > td.wl { min-width: 200px; }
    .app .table.cols-few > tbody > tr > td.wl { min-width: 300px; }
}
.app .btn { white-space: nowrap; }
/* nut tinh trang dat cung width: 150px trong o bang */
.app .table td .btn[style*="width"] { width: auto !important; max-width: none; white-space: nowrap; }
.app .table td [style*="width: 350px"], .app .table td [style*="width:350px"] { width: auto !important; max-width: 100%; white-space: normal !important; }
/* select2 tu ghi width = option dai nhat => vuot cot */
.app .table-group-actions { max-width: 100%; }
.app .table-group-actions .select2-container, .app .form-inline .select2-container, .app .dataTables_search .select2-container { max-width: 100% !important; min-width: 0; }
.app .portlet-body .select2-container { max-width: 100%; }
/* thanh cuon ngang luon trong tam nhin: bang dai cuon trong khung, dau bang dinh */
@media (min-width: 768px) {
    .app .table-scrollable:not(.inv-scroll):not(.has-cards) { overflow: auto; max-height: calc(100vh - 170px); }
    .app .table-scrollable:not(.has-cards) > .table > thead > tr > th { position: sticky; top: 0; z-index: 3; }
}
/* ===================== 9. NAV TABS / ALERTS / MODAL ===================== */
.app .nav-tabs { border-bottom: 1px solid var(--border); display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
.app .nav-tabs > li > a, .app .nav-tabs .nav-link { border: 0 !important; border-bottom: 2px solid transparent !important; color: var(--muted); background: transparent !important; border-radius: 0; padding: 10px 14px; white-space: nowrap; font-weight: 600; }
.app .nav-tabs > li.active > a, .app .nav-tabs .nav-link.active { color: var(--accent) !important; border-bottom-color: var(--accent) !important; }
.app .alert { border-radius: 12px; border: 1px solid var(--border); }
.app .alert-success { background: var(--green-soft); color: var(--green); border-color: transparent; }
.app .alert-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.app .alert-warning { background: var(--yellow-soft); color: var(--yellow); border-color: transparent; }
.app .modal-content { background: var(--surface); color: var(--text); border-radius: var(--radius); border: 1px solid var(--border); }
.app .modal-header, .app .modal-footer { border-color: var(--border); }
.app .modal-backdrop.show, .app .modal-backdrop.in { opacity: .55; }

.app .tooltip-inner { background: var(--text); color: var(--bg); border-radius: 8px; }
.app .dropdown-menu { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.app .dropdown-menu > li > a { color: var(--text); }
.app .dropdown-menu > li > a:hover { background: var(--surface-3); }

/* sweetalert2 */
.swal2-popup { background: var(--surface) !important; color: var(--text) !important; border-radius: 18px !important; }
.swal2-title, .swal2-content, .swal2-html-container { color: var(--text) !important; }
.swal2-styled.swal2-confirm { background: var(--accent) !important; border-radius: 10px !important; color: var(--accent-ink) !important; }
.swal2-styled.swal2-cancel { border-radius: 10px !important; }

/* fancybox v2 */
.fancybox-skin { background: var(--surface) !important; border-radius: 16px !important; }
.fancybox-overlay { background: rgba(5, 10, 20, .55) !important; }

/* nprogress */
#nprogress .bar { background: var(--accent) !important; height: 3px; }
#nprogress .peg { box-shadow: 0 0 10px var(--accent), 0 0 5px var(--accent) !important; }
#nprogress .spinner-icon { border-top-color: var(--accent) !important; border-left-color: var(--accent) !important; }

.app .back-to-top { display: none !important; }
.app .loading { background: var(--bg); }

/* ===================== 10. DASHBOARD ===================== */
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.dash-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.dash-head p { color: var(--muted); margin: 4px 0 0; }
.dash-head .acts { display: flex; flex-wrap: wrap; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
/* admin: Doanh thu | Tien lai | Don hom nay */
.app .kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767px) {
    .app .kpis.kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app .kpis.kpis-3 > .kpi:last-child { grid-column: 1 / -1; }
}
/* so tien KHONG bi cat bot ("39.890.…"): bo ellipsis, so dai thi chu nho lai */
.app .kpi .k-val { overflow: visible; text-overflow: clip; font-size: clamp(17px, 2.1vw, 24px); }
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
    text-decoration: none !important; color: var(--text) !important; display: block;
}
.kpi .k-lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .k-lbl i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.kpi .k-val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; line-height: 1.15; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-val small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .k-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi .k-sub b { color: var(--text-2); }
.t-blue { background: var(--blue-soft); color: var(--blue); }
.t-green { background: var(--green-soft); color: var(--green); }
.t-red { background: var(--red-soft); color: var(--red); }
.t-yellow { background: var(--yellow-soft); color: var(--yellow); }
.t-purple { background: var(--purple-soft); color: var(--purple); }
.t-accent { background: var(--accent-soft); color: var(--accent); }

.hub { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.hub-head { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.hub-head h2 { font-size: 18px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.hub-head h2 i { color: var(--accent); }
.hub-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.hub-card {
    border: 1px solid var(--border); border-radius: 16px; padding: 18px; position: relative;
    background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; overflow: hidden;
}
.hub-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--hc, var(--blue)); }
.hub-card .hc-top { display: flex; gap: 14px; align-items: flex-start; }
.hub-card .hc-ico { width: 52px; height: 52px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 22px; background: var(--surface); border: 1px solid var(--border); color: var(--hc, var(--blue)); }
.hub-card h3 { font-size: 17px; font-weight: 700; margin: 2px 0 4px; }
.hub-card .hc-desc { color: var(--muted); font-size: 13px; margin: 0; }
.hub-card .hc-tag { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; }
.hub-card .hc-acts { display: flex; gap: 10px; margin-top: auto; }
.hub-card .hc-acts a { flex: 1; }
.hub-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 12px;
    font-weight: 700; font-size: 14px; text-decoration: none !important; border: 1px solid transparent;
}
.hub-btn.main { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink) !important; box-shadow: 0 4px 14px var(--accent-soft); }
.hub-btn.alt { background: var(--surface); color: var(--text) !important; border-color: var(--border-strong); }
.hub-btn.alt:hover { border-color: var(--accent); color: var(--accent) !important; }
.hub-btn.main:hover { filter: brightness(1.05); }
.hub-card.hl { border-color: var(--hc, var(--blue)); }

.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-card .lc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.list-card .lc-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.list-card .lc-head a { font-size: 13px; font-weight: 600; }
.lc-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); color: var(--text) !important; text-decoration: none !important; }
.lc-item:last-child { border-bottom: 0; }
.lc-item:hover { background: var(--row-hover); }
.lc-item .lc-ico { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 15px; }
.lc-item .lc-main { flex: 1; min-width: 0; }
.lc-item .lc-main b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-item .lc-main small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-item .lc-end { text-align: right; flex: none; }
.lc-item .lc-end b { display: block; font-size: 14px; }
.lc-item .lc-end small { color: var(--muted); font-size: 12px; }
.lc-empty { padding: 28px; text-align: center; color: var(--muted); }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
/* select goc da bi select2 an: luon 1px (cac quy tac width:100% !important o tren khong duoc lam no phinh trang) */
body.app select.select2-hidden-accessible.select2-hidden-accessible.select2-hidden-accessible, body.app select.form-control.select2-hidden-accessible.select2-hidden-accessible { width: 1px !important; min-width: 0 !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; position: absolute !important; }
/* ===================== 11. RESPONSIVE ===================== */
@media (max-width: 1199px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 991px) {
    .app-side { transform: translateX(-102%); box-shadow: var(--shadow-lg); width: min(300px, 86vw); }
    body.side-open .app-side { transform: none; }
    .app-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(5, 10, 20, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
    body.side-open .app-backdrop { opacity: 1; pointer-events: auto; }
    body.side-open { overflow: hidden; }
    .app-main { margin-left: 0; }
    .app-burger { display: inline-grid; }
    .app-top { padding: 0 14px; }
    .app-content { padding: 16px 14px 24px; }
    .hide-md { display: none !important; }
}

@media (max-width: 767px) {
    :root { --top-h: 58px; }
    body.app { font-size: 15px; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
    .app-top { gap: 8px; }
    .app-iconbtn { width: 40px; height: 40px; }
    .app-userbtn .who, .hide-sm { display: none !important; }
    .app-userbtn { padding: 3px; height: 42px; }
    .app-content { padding: 12px 15px 20px; } /* >= 15px de bu le am cua .row, khong tran ngang */
    .app-foot { display: none; }

    /* thanh tab duoi */
    .app-tabbar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        height: calc(var(--tab-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
        border-top: 1px solid var(--border);
    }
    .app-tabbar a, .app-tabbar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        color: var(--muted) !important; font-size: 11px; font-weight: 600; text-decoration: none !important;
        background: none; border: 0; padding: 0; cursor: pointer;
    }
    .app-tabbar i { font-size: 19px; }
    .app-tabbar .active { color: var(--accent) !important; }
    .app-tabbar .fab i {
        width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; margin-top: -22px;
        background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink);
        box-shadow: 0 6px 18px var(--accent-soft), 0 0 0 4px var(--bg); font-size: 20px;
    }

    .app .page-title { font-size: 21px; }
    .app .page-bar { margin-bottom: 10px; }
    .app .portlet { border-radius: 14px; margin-bottom: 14px; }
    .app .portlet > .portlet-title { padding: 10px 12px !important; }
    .app .portlet > .portlet-body { padding: 12px; }

    /* thanh lenh: cuon ngang, dinh tren dau */
    .app .portlet > .portlet-title .actions {
        flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; margin: 0;
        scrollbar-width: none; padding-bottom: 2px;
    }
    .app .portlet > .portlet-title .actions::-webkit-scrollbar { display: none; }
    .app .portlet > .portlet-title .actions > .btn { flex: none; min-height: 40px; }
    .app .page-content-wrapper > .row > .col-md-12 > .portlet > .portlet-title:has(.btn-set),
    .app .page-content-wrapper > .row > .col-md-12 > .form-horizontal > .portlet > .portlet-title:has(.btn-set) {
        position: sticky; top: var(--top-h); z-index: 20; background: var(--surface) !important;
    }

    /* o nhap: to hon cho ngon tay, chong iOS zoom (>= 16px) */
    .app .form-control, .app input[type="text"], .app input[type="number"], .app input[type="password"], .app input[type="email"], .app input[type="tel"], .app input[type="search"], .app textarea, .app select { font-size: 16px !important; min-height: 44px; }
    .app .input-sm, .app .form-control.input-sm { height: 44px; min-height: 44px; }
    .app .select2-container--default .select2-selection--single { min-height: 44px; }
    .app .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 42px !important; }
    .app .select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px !important; }
    .app .btn { min-height: 42px; }

    /* form ngang -> doc */
    .app .form-group.row > [class*="col-"], .app .form-group.row > label { flex: 0 0 100%; max-width: 100%; width: 100% !important; }
    .app .form-group.row > .text-right, .app .col-form-label.text-right { text-align: left !important; padding-bottom: 4px; }
    .app .form-inline input, .app .form-inline select { width: 100% !important; }
    .app .col-md-6 { width: 100%; float: none; }
    .app .select2-container { width: 100% !important; }

    /* loc */
    .app .dataTables_search .form-control { flex: 1 1 100%; }
    .app .dataTables_search .datepicker { flex: 1 1 calc(50% - 4px); width: auto; }
    .app .dataTables_search .btn { flex: 1 1 auto; }
    .app .table-group-actions { display: block !important; width: 100%; margin: 0 0 8px; }
    .app .table-group-actions .select2-container { min-width: 0; }
    .app .total-price > div { text-align: left !important; }

    /* bang -> the (do theme.js gan .tbl-cards + data-label) */
    .app .table-scrollable.has-cards, .app .table-responsive.has-cards { border: 0; background: transparent; overflow: visible; }
    .app table.tbl-cards, .app table.tbl-cards tbody { display: block; width: 100%; }
    .app table.tbl-cards thead { display: none; }
    .app table.tbl-cards tbody > tr {
        display: block; position: relative;
        background: var(--surface) !important; border: 1px solid var(--border); border-radius: 14px;
        padding: 10px 12px; margin-bottom: 10px; box-shadow: var(--shadow);
    }
    .app table.tbl-cards tbody > tr > td {
        display: grid; grid-template-columns: minmax(84px, 40%) minmax(0, 1fr); column-gap: 12px; justify-items: end; align-items: start;
        padding: 6px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--border) !important;
        text-align: right !important; width: auto !important; min-height: 0;
    }
    .app table.tbl-cards tbody > tr > td:last-child { border-bottom: 0 !important; }
    .app table.tbl-cards tbody > tr > td::before {
        content: attr(data-label); grid-column: 1; grid-row: 1 / span 20; justify-self: start;
        color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; padding-top: 2px;
    }
    .app table.tbl-cards tbody > tr > td > * { grid-column: 2; margin: 0; }
    .app table.tbl-cards tbody > tr > td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
    .app table.tbl-cards tbody > tr > td[data-label=""] > * { grid-column: 1; }
    .app table.tbl-cards tbody > tr > td[data-label=""]::before { display: none; }
    .app table.tbl-cards tbody > tr > td > * { max-width: 100%; }
    .app table.tbl-cards tbody > tr > td.td-title {
        order: -1; font-size: 15.5px; text-align: left !important; display: block;
        border-bottom: 1px solid var(--border) !important; padding: 2px 34px 8px 0 !important;
    }
    .app table.tbl-cards tbody > tr > td.td-title::before { display: none; }
    .app table.tbl-cards tbody > tr > td.td-idx { display: none; }
    .app table.tbl-cards tbody > tr > td.td-check { display: block; position: absolute; top: 10px; right: 10px; border: 0 !important; padding: 0 !important; }
    .app table.tbl-cards tbody > tr > td.td-check::before { display: none; }
    .app table.tbl-cards tbody > tr > td.td-empty { display: none; }
    .app table.tbl-cards tbody > tr.phancach > td { border-top: 0 !important; }
    .app table.tbl-cards tbody > tr { display: flex; flex-direction: column; }

    .dash-head h1 { font-size: 22px; }
    .dash-head .acts { width: 100%; }
    .dash-head .acts .app-pill { flex: 1; justify-content: center; }
    .kpis { gap: 10px; }
    .kpi { padding: 12px 14px; }
    .kpi .k-val { font-size: 19px; }
    .hub-grid { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
    .hub-card { padding: 14px; }
    .hub-card .hc-ico { width: 44px; height: 44px; font-size: 19px; }
    .lc-item { padding: 12px 14px; }
}

@media (max-width: 380px) {
    .kpi .k-val { font-size: 17px; }
}

/* ===================== 12. FORM.MASTER (popup iframe) / LOGIN ===================== */
body.app.app-form .app-content { padding: 14px; }
body.app.app-form { padding-bottom: 0; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 28px 24px; }
.login-card .app-brand { border: 0; height: auto; padding: 0 0 18px; }
.app .content-main-login { background: transparent; margin: 0; padding: 0; overflow: visible; }
.app .content-main-login .form-title { color: var(--text); font-size: 22px; font-weight: 700 !important; text-align: left; margin: 0 0 14px; }
.app .content-main-login .col-form-label { color: var(--text-2); padding-bottom: 4px; }
.app .content-main-login .form-control { min-height: 46px; font-size: 16px; }
.app .content-main-login .form-actions .btn { width: 100%; min-height: 48px; font-size: 15px; background: linear-gradient(135deg, var(--accent-2), var(--accent)) !important; border: 0 !important; color: var(--accent-ink) !important; }
.app.login .app-foot { display: block; }

@media print {
    .app-side, .app-top, .app-tabbar, .app-foot, .app-backdrop { display: none !important; }
    .app-main { margin: 0 !important; }
    body.app { background: #fff !important; color: #000; }
}

/* ===================== 13. THU CHI (rieng thuchi.1net.vn) ===================== */
.app-pill.green { background: var(--green); color: #fff !important; box-shadow: 0 4px 14px var(--green-soft); }
.app-pill.green:hover, .app-pill.blue:hover { filter: brightness(1.06); }
.app-pill.ghost { background: var(--surface); color: var(--text) !important; border-color: var(--border-strong); }
.app-pill.ghost:hover { border-color: var(--accent); color: var(--accent) !important; }

/* so tien: thu xanh / chi do */
.app .kpi .k-val.pos { color: var(--green); }
.app .kpi .k-val.neg { color: var(--red); }

/* o so du (Tong hop ca nhan / doanh nghiep) */
.app .kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.app .tc-bal .kpi-main { border-top: 3px solid var(--accent); }
.app .tc-bal .kpi-main .k-val { color: var(--accent); }
.app .tc-bal .kpi-main .k-val.neg { color: var(--red); }
.app .tc-bal .kpi .k-sub { font-variant-numeric: tabular-nums; }
.app .kpi .k-val { font-variant-numeric: tabular-nums; }
@media (max-width: 1199px) { .app .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Thu chi hom nay: 2 khung chi / thu */
.tc-card { --uc: var(--red); --uc-soft: var(--red-soft); border-top: 3px solid var(--uc); }
.tc-card.tc-in { --uc: var(--green); --uc-soft: var(--green-soft); }
.tc-card .lc-head h3 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tc-card .lc-head h3 > i { color: var(--uc); }
.tc-card .lc-cnt { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--uc); color: #fff; font-size: 12px; font-weight: 800; }
.tc-card .lc-sum { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 9px 18px; background: var(--uc-soft); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.tc-card .lc-sum b { color: var(--uc); font-size: 14px; font-variant-numeric: tabular-nums; }
.tc-card .lc-item .lc-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.tc-card .tc-amt { color: var(--uc); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc-card .lc-item .lc-main small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tc-card .lc-empty i { color: var(--muted); }

/* tai khoan nhan / chi: Ms.Ngoan (1) / Mr.Hung (2) */
.chip.bank-chip { background: var(--surface-3); color: var(--text-2); }
.chip.bank-1 { background: var(--blue-soft); color: var(--blue); }
.chip.bank-2 { background: var(--accent-soft); color: var(--accent); }
.app .table > tbody > tr > td.bank-1, .app .table > tbody > tr > td.bank-2 { font-weight: 600; }
.app .table > tbody > tr > td.bank-1 { color: var(--blue); }
.app .table > tbody > tr > td.bank-2 { color: var(--accent); }
/* Tong hop: nut Them khoan thu/chi dung truoc nhan tong tien */
.app .total-price > div > .btn { margin: 0 14px 0 0; vertical-align: middle; }

@media (max-width: 767px) {
    .app .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app .tc-bal .kpi-main { grid-column: 1 / -1; }
    .app .kpis-4.tc-bal > .kpi:last-child { grid-column: 1 / -1; }
    .tc-card .lc-sum { padding: 9px 14px; }
}
/* trang Main.Master mo trong popup fancybox (iframe): Them/Sua khoan thu chi tu Trang chu / Tong hop
   => bo khung (menu, thanh tren, tab duoi), chi giu noi dung form. Co html.in-frame do script dau <head> gan */
html.in-frame .app-side, html.in-frame .app-top, html.in-frame .app-tabbar, html.in-frame .app-foot, html.in-frame .app-backdrop { display: none !important; }
html.in-frame .app-main { margin-left: 0 !important; min-height: 0; }
html.in-frame .app-content { padding: 14px 16px; }
html.in-frame body.app { padding-bottom: 0 !important; }
html.in-frame .app .page-bar { display: none; }
html.in-frame .app .page-content-wrapper > .row > .col-md-12 > .portlet > .portlet-title:has(.btn-set),
html.in-frame .app .page-content-wrapper > .row > .col-md-12 > .form-horizontal > .portlet > .portlet-title:has(.btn-set) { top: 0; }

/* link dat trong nut (vd "Them danh muc": <p class="btn btn-primary"><a>) - truoc: chu xanh tren nen xanh, vo hinh */
.app .btn > a, .app .btn > a:hover { color: inherit !important; text-decoration: none; }
/* ---- mau rieng tung tai khoan: Ms.Ngoan = hong, Mr.Hung = xanh ngoc (khac han mau thu xanh la / chi do / cam chu dao) ---- */
:root, html[data-theme="light"] { --bank1: #c026d3; --bank1-soft: rgba(192, 38, 211, .12); --bank2: #0d9488; --bank2-soft: rgba(13, 148, 136, .13); }
html[data-theme="dark"] { --bank1: #e879f9; --bank1-soft: rgba(232, 121, 249, .18); --bank2: #2dd4bf; --bank2-soft: rgba(45, 212, 191, .17); }
.bank-tag {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 9px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.35; border: 1px solid transparent;
}
.bank-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.bank-tag.bank-1, .chip.bank-1 { background: var(--bank1-soft); color: var(--bank1); border-color: color-mix(in srgb, var(--bank1) 35%, transparent); }
.bank-tag.bank-2, .chip.bank-2 { background: var(--bank2-soft); color: var(--bank2); border-color: color-mix(in srgb, var(--bank2) 35%, transparent); }
.app .table > tbody > tr > td.td-bank { white-space: nowrap; }
/* o so du tung tai khoan cung mau voi nhan */
.app .kpi.kpi-bank { border-top: 3px solid var(--bk); --bk: var(--bank1); --bk-soft: var(--bank1-soft); }
.app .kpi.kpi-bank.bank-2 { --bk: var(--bank2); --bk-soft: var(--bank2-soft); }
.app .kpi.kpi-bank .k-lbl { color: var(--bk); }
.app .kpi.kpi-bank .k-lbl i { background: var(--bk-soft); color: var(--bk); }
.app .kpi.kpi-bank .k-val:not(.neg) { color: var(--bk); }
/* ===================== 14. POPUP THEM NHANH THU / CHI (theme.js: tcBuild) ===================== */
html.tc-lock, html.tc-lock body { overflow: hidden; }
.tc-overlay { --tc: var(--red); --tc-soft: var(--red-soft); position: fixed; inset: 0; z-index: 2000; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; background: rgba(15, 23, 42, .55); overflow-y: auto; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif; }
.tc-overlay.open { display: flex; }
.tc-overlay.is-thu { --tc: var(--green); --tc-soft: var(--green-soft); }
.tc-panel { width: 100%; max-width: 560px; background: var(--surface); color: var(--text); border-radius: 20px; box-shadow: var(--shadow-lg); border-top: 4px solid var(--tc); overflow: visible; animation: tc-in .18s ease-out; }
@keyframes tc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.tc-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.tc-seg { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--surface-3); gap: 4px; }
.tc-seg button { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s, color .15s; }
.tc-seg button[data-type="thu"].on { background: var(--green); color: #fff; box-shadow: 0 3px 10px var(--green-soft); }
.tc-seg button[data-type="chi"].on { background: var(--red); color: #fff; box-shadow: 0 3px 10px var(--red-soft); }
.tc-biz-tag { display: none; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.tc-overlay.is-biz .tc-biz-tag { display: inline-flex; }
.tc-x { margin-left: auto; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
.tc-x:hover { background: var(--surface-3); color: var(--text); }
.tc-body { padding: 8px 18px 6px; display: flex; flex-direction: column; gap: 14px; }
.tc-lbl { display: block; margin: 0 0 7px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tc-lbl small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 4px; }
.tc-amount { display: block; margin: 0; font-weight: 400; }
.tc-money { display: flex; align-items: center; border: 2px solid var(--border-strong); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.tc-money:focus-within { border-color: var(--tc); box-shadow: 0 0 0 4px var(--tc-soft); }
.tc-money input { flex: 1; min-width: 0; height: 60px; padding: 0 14px; border: 0; outline: 0; background: transparent; color: var(--tc); font: inherit; font-size: 30px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.tc-money input::placeholder { color: var(--border-strong); }
.tc-money em { padding-right: 16px; font-style: normal; font-size: 18px; font-weight: 700; color: var(--muted); }
.tc-words { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; text-align: right; }
.tc-words b { color: var(--text-2); }
.tc-banks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tc-overlay.is-biz .tc-banks-row { display: none; }
.tc-bank { --bk: var(--bank1); --bk-soft: var(--bank1-soft); position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.tc-bank.bank-2 { --bk: var(--bank2); --bk-soft: var(--bank2-soft); }
.tc-bank > .fa-user { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--bk-soft); color: var(--bk); font-size: 15px; }
.tc-bank span { min-width: 0; line-height: 1.25; }
.tc-bank b { display: block; color: var(--bk); font-size: 15px; }
.tc-bank small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tc-bank .tc-on { margin-left: auto; font-size: 20px; color: var(--border-strong); }
.tc-bank:hover { border-color: color-mix(in srgb, var(--bk) 50%, var(--border)); }
.tc-bank.on { border-color: var(--bk); background: var(--bk-soft); box-shadow: 0 0 0 3px var(--bk-soft); }
.tc-bank.on .tc-on { color: var(--bk); }
.tc-cats { display: flex; flex-wrap: wrap; gap: 7px; min-height: 34px; }
.tc-cat { padding: 7px 13px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; line-height: 1.25; transition: border-color .15s, background .15s, color .15s; }
.tc-cat:hover { border-color: var(--tc); color: var(--tc); }
.tc-cat.on { background: var(--tc); border-color: var(--tc); color: #fff; }
.tc-loading { color: var(--muted); font-size: 13px; align-self: center; }
.tc-find { position: relative; margin-top: 8px; }
.tc-find > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.tc-find input, .tc-row input.tc-content, .tc-date { width: 100%; height: 42px; padding: 0 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px; outline: 0; }
.tc-find input { padding-left: 34px; }
.tc-find input:focus, .tc-row input.tc-content:focus, .tc-date:focus { border-color: var(--tc); box-shadow: 0 0 0 3px var(--tc-soft); }
.tc-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; max-height: 240px; overflow: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); }
.tc-opt { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.tc-opt small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tc-opt.on, .tc-opt:hover { background: var(--surface-3); }
.tc-opt.sel { color: var(--tc); font-weight: 700; }
.tc-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.tc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px; }
.tc-row { display: block; margin: 0; font-weight: 400; }
.tc-dates { display: flex; gap: 6px; }
.tc-chip { flex: none; height: 42px; padding: 0 11px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tc-chip.on { border-color: var(--tc); color: var(--tc); background: var(--tc-soft); }
.tc-date { flex: 1; min-width: 0; padding: 0 8px; }
.tc-msg { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13.5px; font-weight: 600; }
.tc-ok { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-size: 13.5px; }
.tc-ok > i { font-size: 20px; }
.tc-ok b { color: var(--text); }
.tc-ok small { color: var(--muted); margin-left: 4px; }
.tc-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px 18px; }
.tc-keys { margin-right: auto; color: var(--muted); font-size: 12px; }
.tc-foot .btn { min-height: 44px; border-radius: 12px; padding: 0 16px; font-weight: 700; }
.tc-foot .tc-save { background: var(--tc) !important; border-color: var(--tc) !important; color: #fff !important; padding: 0 22px; }
.tc-foot .tc-save i { margin-right: 6px; }
.tc-foot .tc-save:hover { filter: brightness(1.06); }
.tc-foot .btn[disabled] { opacity: .55; }
@media (max-width: 575px) {
    .tc-overlay { padding: 0; align-items: flex-end; }
    .tc-panel { max-width: none; border-radius: 20px 20px 0 0; max-height: 100%; overflow-y: auto; }
    .tc-grid { grid-template-columns: minmax(0, 1fr); }
    .tc-keys { display: none; }
    .tc-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .tc-foot .btn { flex: 1; padding: 0 10px; }
    .tc-seg button { padding: 0 12px; }
    .tc-money input { font-size: 26px; }
}
/* ===================== 15. TRANG TONG HOP (ModTongHop: .th-page) ===================== */
/* bo loc: hang tren = chon nhanh ky + lenh; hang duoi = khoang ngay + 3 o loc */
.app .th-filter { padding: 14px 16px; margin-bottom: 14px; }
.th-filter-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.th-periods { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.th-period { height: 34px; padding: 0 13px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.th-period:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.th-period.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.app .th-filter .th-cmd { margin-left: auto; padding: 0; border: 0; background: transparent; width: auto; }
.th-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.th-range { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; height: 42px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.th-range > i { color: var(--muted); }
.th-range > span { color: var(--muted); }
.app .th-range .form-control { width: 108px !important; height: 34px; min-height: 0; padding: 0 6px; border: 0 !important; background: transparent !important; box-shadow: none !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.app .th-range .th-go { height: 34px; padding: 0 14px; border-radius: 9px; background: var(--accent) !important; border: 0 !important; color: var(--accent-ink) !important; font-weight: 700; }
.app .th-sel { width: auto !important; min-width: 160px; max-width: 230px; height: 42px; border-radius: 12px; font-size: 13.5px; }
.app .th-sel.set { border-color: var(--accent) !important; color: var(--accent); font-weight: 600; background: var(--accent-soft) !important; }
.th-clear { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--red) !important; }

/* tong ket ky: thu / chi / chenh lech */
.th-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.th-sum-item { --c: var(--text); --cs: var(--surface-3); display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); box-shadow: var(--shadow); }
.th-sum-item.in { --c: var(--green); }
.th-sum-item.out { --c: var(--red); }
.th-sum-item.net { --c: var(--blue); }
.th-sum-item.net.neg { --c: var(--red); }
.th-sum-item span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.th-sum-item span i { color: var(--c); margin-right: 6px; }
.th-sum-item b { grid-column: 1; font-size: 21px; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.th-sum-item small { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 2 cot chi | thu */
.th-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.th-card { --c: var(--red); --cs: var(--red-soft); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.th-card.in { --c: var(--green); --cs: var(--green-soft); }
.th-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); border-top: 3px solid var(--c); }
.th-card-head h3 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.th-card-head h3 > i { color: var(--c); }
.th-cnt { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--cs); color: var(--c); font-size: 12px; font-weight: 800; }
.th-card-total { margin-left: auto; color: var(--c); font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-add { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--c); color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: 0 3px 10px var(--cs); }
.th-add:hover { filter: brightness(1.06); }
.th-empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.th-empty i { display: block; font-size: 26px; margin-bottom: 8px; opacity: .6; }
.app .th-scroll { margin: 0 !important; border: 0 !important; border-radius: 0; max-height: calc(100vh - 150px); }
.app .th-table { margin: 0; border: 0; }
.app .th-table > thead > tr > th { padding: 9px 12px; font-size: 11.5px; text-align: left; background: var(--surface-2) !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; }
.app .th-table > tbody > tr > td { padding: 10px 12px; vertical-align: middle; border: 0 !important; border-bottom: 1px solid var(--border) !important; background: transparent !important; text-align: left; }
.app .th-table > tbody > tr:last-child > td { border-bottom: 0 !important; }
.app .th-table > tbody > tr:hover > td { background: var(--row-hover) !important; }
.app .th-table .th-c-date { width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.app .th-table td.th-c-date a { font-weight: 600; }
.th-lock { color: var(--muted); }
.app .th-table .th-c-cat b { display: block; font-weight: 600; color: var(--text); line-height: 1.35; }
.app .th-table .th-c-cat small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.35; overflow-wrap: break-word; }
.app .th-table .th-c-bank { width: 1%; white-space: nowrap; }
.app .th-table .th-c-amt { width: 1%; white-space: nowrap; text-align: right !important; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c); }
.app .th-table > thead > tr > th.th-c-amt { text-align: right !important; }
.th-none { color: var(--border-strong); }

@media (max-width: 1399px) { .th-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 991px) { .th-sum { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
    .th-periods { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .th-periods::-webkit-scrollbar { display: none; }
    .th-range { width: 100%; }
    .app .th-range .form-control { flex: 1; width: auto !important; }
    .app .th-sel { flex: 1 1 calc(50% - 5px); max-width: none; min-width: 0; }
    .app .th-filter .th-cmd { margin-left: 0; }
    .th-card-total { margin-left: 0; }
    .th-add { margin-left: auto; }
    .app .th-scroll.has-cards { padding: 10px; }
    .app .th-table.tbl-cards tbody > tr { box-shadow: none; }
}
.app-pill.red { background: var(--red); color: #fff !important; box-shadow: 0 4px 14px var(--red-soft); }
.app-pill.red:hover { filter: brightness(1.06); }
@media (max-width: 991px) { .app-top .app-pill { padding: 0 12px; } }
@media (max-width: 575px) { .app-top .app-pill.green, .app-top .app-pill.red { display: none; } }
.th-add.th-add-out { --c: var(--red); --cs: var(--red-soft); }
.th-add.th-add-in { --c: var(--green); --cs: var(--green-soft); }
.app .total-price > div > .th-add { margin: 0 14px 0 0; vertical-align: middle; }
/* popup: ngay du rong (truoc: o date bi bop con "11") */
.tc-grid { grid-template-columns: auto minmax(0, 1fr); }
.tc-date { flex: none; width: 150px; }
@media (max-width: 575px) { .tc-date { flex: 1; width: auto; } }
@media (max-width: 767px) {
    .th-range { padding: 0 4px 0 10px; gap: 4px; }
    .app .th-range .form-control { flex: 1 1 0; width: 0 !important; min-width: 0; min-height: 0 !important; height: 34px; font-size: 15px !important; padding: 0 2px; text-align: center; }
    .app .th-range .th-go { flex: none; min-height: 0; }
}
/* Tong hop: hien du danh sach, khong cat phan duoi (truoc: khung bang cao toi da 100vh - 150px, phai cuon trong khung) */
.app .th-page .table-scrollable.th-scroll { max-height: none !important; overflow-y: visible !important; overflow-x: auto; }
.app .th-page .th-scroll > .table > thead > tr > th { position: static; }
/* noi dung la chinh (dam), danh muc phu (mo, nho, nam duoi) */
.app .th-table .th-c-cat b { font-weight: 600; color: var(--text); overflow-wrap: break-word; }
.app .th-table .th-c-cat small { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; opacity: .9; }
.app .th-table .th-c-cat small i { font-size: 10.5px; opacity: .8; }
.app .th-table .th-c-cat b.th-no-note { font-weight: 500; color: var(--text-2); }
/* ===================== 16. SUA / XOA KHOAN THU CHI ===================== */
.tc-edit-title { display: none; line-height: 1.2; }
.tc-edit-title b { display: block; font-size: 17px; color: var(--tc); }
.tc-edit-title small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tc-overlay.is-edit .tc-seg { display: none; }
.tc-overlay.is-edit .tc-edit-title { display: block; }
.tc-overlay.is-edit .tc-more, .tc-overlay.is-edit .tc-keys { display: none; }
.tc-foot .tc-del { display: none; margin-right: auto; background: transparent !important; border: 1.5px solid color-mix(in srgb, var(--red) 45%, transparent) !important; color: var(--red) !important; }
.tc-foot .tc-del i { margin-right: 6px; }
.tc-foot .tc-del:hover { background: var(--red-soft) !important; }
.tc-overlay.is-edit.can-del .tc-del { display: inline-flex; align-items: center; }
.tc-overlay.is-locked .tc-save { display: none; }
.tc-overlay.is-locked .tc-body { opacity: .75; pointer-events: none; }
.tc-overlay.is-locked .tc-msg { background: var(--yellow-soft); color: var(--yellow); }

/* hop xac nhan xoa */
.tc-confirm { position: fixed; inset: 0; z-index: 2100; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .5); font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif; }
.tc-confirm.open { display: flex; }
.tcc-box { width: 100%; max-width: 380px; padding: 22px 20px 18px; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); text-align: center; animation: tc-in .15s ease-out; }
.tcc-ico { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); font-size: 22px; }
.tc-confirm.is-info .tcc-ico { background: var(--yellow-soft); color: var(--yellow); }
.tc-confirm.is-info .tcc-ico i::before { content: "\f071"; }
.tcc-title { display: block; font-size: 17px; margin-bottom: 6px; }
.tcc-text { margin: 0 0 18px; color: var(--text-2); font-size: 14px; overflow-wrap: break-word; }
.tcc-acts { display: flex; gap: 8px; }
.tcc-acts .btn { flex: 1; min-height: 44px; border-radius: 12px; font-weight: 700; }
.tcc-acts .tcc-yes { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; }

/* nut Sua / Xoa tren tung dong (Tong hop) */
.app .th-table .th-c-act { width: 1%; white-space: nowrap; text-align: right !important; padding-left: 4px !important; }
.th-act { width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; display: inline-grid; place-items: center; }
.th-act:hover { background: var(--surface-3); color: var(--blue); }
.th-act.del:hover { background: var(--red-soft); color: var(--red); }
.th-act-lock { display: inline-grid; place-items: center; width: 32px; height: 32px; color: var(--border-strong); font-size: 13px; }
.app .th-table td.th-c-date a { cursor: pointer; }
@media (min-width: 768px) {
    .app .th-table tbody tr .th-act { opacity: .55; }
    .app .th-table tbody tr:hover .th-act { opacity: 1; }
}
@media (max-width: 767px) {
    .app .th-table.tbl-cards tbody > tr > td.th-c-act { display: flex; justify-content: flex-end; gap: 8px; border-bottom: 0 !important; padding-top: 8px !important; }
    .app .th-table.tbl-cards tbody > tr > td.th-c-act::before { display: none; }
    .th-act { width: auto; height: 36px; padding: 0 14px; border: 1px solid var(--border); gap: 6px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--text-2); }
    .app .th-act span { display: inline; }
}
.th-act span { display: none; }
/* ===================== 17. TRANG THU TIEN / CHI TIEN (danh sach: .tl-table, dung chung kieu .th-table) ===================== */
.app .tl-table.tl-in { --c: var(--green); }
.app .tl-table.tl-out { --c: var(--red); }
.app .tl-table .tl-c-chk { width: 1%; padding-right: 0 !important; }
.app .tl-table tr.tl-draft { display: none; }
.app .table-scrollable.tl-scroll { max-height: none !important; overflow-y: visible !important; overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.app .tl-table > thead > tr > th a { color: inherit; }
/* ===================== 18. FORM THEM / SUA THU CHI (ModEImport|ModEExport[2]/Add: .tf) ===================== */
.app .tf { --c: var(--red); --cs: var(--red-soft); }
.app .tf.tf-thu { --c: var(--green); --cs: var(--green-soft); }
.app .tf .tf-body { padding: 20px 22px 18px; }
.tf-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.tf-ico { width: 48px; height: 48px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--cs); color: var(--c); font-size: 20px; }
.tf-ttl b { display: block; font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.tf-ttl small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tf-biz { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 12px; }
.tf-lock { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 11px 14px; border-radius: 12px; background: var(--yellow-soft); color: var(--yellow); font-weight: 600; }
.app .tf.tf-locked .btn-set .btn:not(.cmd-back) { display: none; }
fieldset.tf-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 28px; margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.tf-grid[disabled] { opacity: .8; }
.tf-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.app .tf-field { display: block; margin: 0; font-weight: 400; }
.app .tf .tf-lbl { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.app .tf .tf-addcat { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--blue) !important; }
.app .tf .tf-addcat i { margin-right: 4px; }
.tf-money { display: flex; align-items: center; border: 2px solid var(--border-strong); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.tf-money:focus-within { border-color: var(--c); box-shadow: 0 0 0 4px var(--cs); }
.app .tf-money input, .app .tf-money input.form-control { flex: 1; min-width: 0; height: 64px !important; padding: 0 14px !important; border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important; color: var(--c) !important; font-size: 32px !important; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.tf-money em { padding-right: 16px; font-style: normal; font-size: 18px; font-weight: 700; color: var(--muted); }
.tf-words { display: block; min-height: 18px; margin-top: 6px; color: var(--muted); font-size: 13px; text-align: right; }
.tf-banks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app .tf-bank { --bk: var(--bank1); --bk-soft: var(--bank1-soft); position: relative; display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 400; transition: border-color .15s, background .15s, box-shadow .15s; }
.app .tf-bank.bank-2 { --bk: var(--bank2); --bk-soft: var(--bank2-soft); }
.tf-bank input { position: absolute; opacity: 0; pointer-events: none; }
.tf-bank > .fa-user { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--bk-soft); color: var(--bk); }
.tf-bank span { min-width: 0; line-height: 1.25; }
.tf-bank b { display: block; color: var(--bk); font-size: 15px; }
.tf-bank small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tf-bank .tf-on { margin-left: auto; font-size: 20px; color: var(--border-strong); }
.app .tf-bank:has(input:checked) { border-color: var(--bk); background: var(--bk-soft); box-shadow: 0 0 0 3px var(--bk-soft); }
.tf-bank:has(input:checked) .tf-on { color: var(--bk); }
.tf-bank:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--focus); }
.tf-dates { display: flex; gap: 8px; }
.app .tf-dates .form-control { flex: 1; min-width: 0; width: auto !important; height: 44px; border-radius: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tf-chip { flex: none; height: 44px; padding: 0 13px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.tf-chip:hover { border-color: var(--c); color: var(--c); }
.app .tf .select2-container { width: 100% !important; }
.app .tf .select2-container .select2-selection--single { min-height: 44px; border-radius: 12px !important; }
.app .tf .select2-container .select2-selection__rendered { line-height: 42px !important; }
.app .tf .select2-container .select2-selection__arrow { height: 42px !important; }
.app .tf textarea.tf-note { min-height: 92px; border-radius: 12px; resize: vertical; }
.tf-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--border); }
.tf-foot small { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.tf-foot small i { margin-right: 6px; }
.app .tf-foot .tf-del { min-height: 40px; border-radius: 11px; background: transparent !important; border: 1.5px solid color-mix(in srgb, var(--red) 45%, transparent) !important; color: var(--red) !important; font-weight: 700; }
.app .tf-foot .tf-del i { margin-right: 6px; }
.app .tf-foot .tf-del:hover { background: var(--red-soft) !important; }
@media (max-width: 991px) { fieldset.tf-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
    .app .tf .tf-body { padding: 14px 12px; }
    .app .tf-money input, .app .tf-money input.form-control { font-size: 26px !important; height: 56px !important; }
    .tf-dates { flex-wrap: wrap; }
    .app .tf-dates .form-control { flex: 1 1 100%; }
    .tf-chip { flex: 1; }
}
/* ===================== 19. TONG HOP TK DOANH NGHIEP (ModTongHop2: .th-biz) - cung bo cuc ModTongHop, mau nhan xanh duong ===================== */
.app .tc-bal .kpi-main.kpi-biz { border-top-color: var(--blue); }
.app .tc-bal .kpi-main.kpi-biz .k-lbl { color: var(--blue); }
.app .tc-bal .kpi-main.kpi-biz .k-lbl i { background: var(--blue-soft); color: var(--blue); }
.app .tc-bal .kpi-main.kpi-biz .k-val:not(.neg) { color: var(--blue); }
.app .th-biz .th-period.on { color: var(--blue); }
/* popup: o noi dung / ghi chu 1 hang rieng, rong het khung, nhieu dong, tu cao them */
.tc-row textarea.tc-content { display: block; width: 100%; min-height: 84px; max-height: 230px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px; line-height: 1.5; outline: 0; resize: vertical; overflow-y: auto; }
.tc-row textarea.tc-content:focus { border-color: var(--tc); box-shadow: 0 0 0 3px var(--tc-soft); }
.tc-row textarea.tc-content::placeholder { color: var(--muted); }
.tc-dates .tc-date { flex: 0 1 170px; }
@media (max-width: 575px) { .tc-row textarea.tc-content { font-size: 16px; } .tc-dates .tc-date { flex: 1; } }
/* ===================== 20. BIEU DO DOANH THU THEO THANG (trang chu: .rev-card) ===================== */
.rev-card { margin-bottom: 20px; overflow: visible; }
.rev-head { flex-wrap: wrap; align-items: center; }
.rev-head h3 { display: flex; align-items: center; gap: 8px; }
.rev-head h3 i { color: var(--green); }
.rev-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.rev-acc { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-3); margin-left: auto; }
.rev-acc button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.rev-acc button.on { background: var(--surface); color: var(--green); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.rev-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 14px 18px 4px; }
.rev-stats div { min-width: 0; }
.rev-stats small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.rev-stats b { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.rev-stats em { display: block; font-style: normal; font-size: 12px; font-weight: 600; }
.rev-stats em.up { color: var(--green); }
.rev-stats em.down { color: var(--red); }
.rev-chart { position: relative; padding: 6px 12px 4px 4px; min-height: 210px; }
.rev-svg { display: block; overflow: visible; font-family: inherit; }
.rev-grid { stroke: var(--border); stroke-width: 1; }
.rev-grid.base { stroke: var(--border-strong); }
.rev-ytick, .rev-xtick, .rev-year { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.rev-xtick.cur { fill: var(--text); font-weight: 700; }
.rev-year { font-size: 10px; opacity: .8; }
.rev-bar { fill: var(--green); transition: opacity .12s; }
.rev-bar.cur { fill-opacity: .55; }
.rev-bar.dim { opacity: .35; }
.rev-val { fill: var(--text-2); font-size: 11.5px; font-weight: 700; }
.rev-val.cur { fill: var(--text); }
.rev-hit { fill: transparent; cursor: pointer; outline: none; }
.rev-hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.rev-tip { position: absolute; z-index: 5; min-width: 190px; padding: 9px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); pointer-events: none; font-size: 12.5px; }
.rev-tip b { display: block; margin-bottom: 5px; font-size: 13px; color: var(--text); }
.rev-tip b small { font-weight: 500; color: var(--muted); }
.rev-tip span { display: flex; align-items: center; gap: 7px; color: var(--text-2); line-height: 1.7; }
.rev-tip span i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.rev-tip span.in i { background: var(--green); }
.rev-tip span.out i { background: var(--red); }
.rev-tip span.net { border-top: 1px solid var(--border); margin-top: 3px; padding-top: 3px; }
.rev-tip em { margin-left: auto; padding-left: 14px; font-style: normal; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.rev-tip em.neg { color: var(--red); }
.rev-tip em.pos { color: var(--green); }
.rev-table { padding: 4px 18px 14px; }
.rev-table summary { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--blue); font-size: 13px; font-weight: 600; }
.rev-table table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rev-table th { text-align: right; padding: 6px 8px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.rev-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.rev-table th:first-child, .rev-table td:first-child { text-align: left; }
.rev-table td.neg { color: var(--red); }
.rev-table td.pos { color: var(--green); }
@media (max-width: 767px) {
    .rev-acc { margin-left: 0; width: 100%; }
    .rev-acc button { flex: 1; padding: 0 6px; }
    .rev-stats { padding: 12px 14px 2px; gap: 8px 18px; }
    .rev-stats b { font-size: 16px; }
    .rev-chart { padding: 6px 6px 4px 0; }
    .rev-table { padding: 4px 12px 12px; }
}
/* bieu do thu chi: 2 cot / thang. Mau da kiem bang validate_palette (CVD deutan/protan): xanh ngoc / cam
   - cap xanh la / do cua giao dien truot kiem tra mu mau (dE 5.0 sang, 2.8 toi) nen bieu do dung cap rieng */
:root, html[data-theme="light"] { --rev-in: #0f9f8f; --rev-out: #e8590c; }
html[data-theme="dark"] { --rev-in: #15a090; --rev-out: #e8590c; }
.rev-bar.in { fill: var(--rev-in); }
.rev-bar.out { fill: var(--rev-out); }
.rev-head h3 i { color: var(--rev-in); }
.rev-acc button.on { color: var(--text); }
.rev-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 3px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.rev-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rev-legend small { color: var(--muted); font-weight: 500; margin: 0; }
i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
i.sw.in { background: var(--rev-in); }
i.sw.out { background: var(--rev-out); }
.rev-stats small i.sw { margin-right: 5px; vertical-align: -1px; }
.rev-stats b.pos { color: var(--green); }
.rev-stats b.neg { color: var(--red); }
.rev-stats .dimtxt { font-size: 12px; font-weight: 600; color: var(--muted); }
.rev-tip span.in i { background: var(--rev-in); }
.rev-tip span.out i { background: var(--rev-out); }