/* kt-mobile.css — Responsive mobile cho Admin_KeToan (breakpoint 767.98px) */

/* Desktop: ẩn menu mobile */
.kt-mobile-home-menu {
    display: none;
}

@media (max-width: 767.98px) {
    html.kt-mobile body,
    body {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }

    /* Ẩn toàn bộ shell desktop + launchpad/kt-tile — chỉ dùng @media, không cần class JS */
    .kt-app,
    .kt-quickbar,
    .kt-launchpad,
    #ktLaunchpad,
    .kt-launch-panel,
    .kt-launch-grid,
    .kt-launch-tmap,
    .kt-empty,
    .kt-desktop-launch,
    .kt-menubar,
    .kt-tabbar,
    .kt-taskbar,
    .kt-topbar,
    .kt-hsd-banner,
    .kt-tile {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        pointer-events: none !important;
    }

    /* Menu mobile: phủ full viewport */
    #ktMobileHomeMenu,
    .kt-mobile-home-menu {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 9999;
        width: 100vw;
        max-width: 100vw;
        min-height: 100dvh;
        margin: 0;
        padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0));
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--kt-mesh-base, #e8ecf0);
        box-sizing: border-box;
    }

    html.kt-mobile .kt-empty.is-overlay {
        display: none !important;
    }

    #ktMobileHomeMenu .kt-mobile-home-head {
        flex-shrink: 0;
        margin-bottom: 10px;
        padding: 4px 2px 0;
        text-align: center;
    }

    #ktMobileHomeMenu .kt-mobile-menu-title {
        margin: 0 0 4px;
        font-size: var(--tx-fs-xl);
        font-weight: 700;
        color: var(--kt-navy, #1f4e79);
    }

    #ktMobileHomeMenu .kt-mobile-menu-sub {
        margin: 0;
        font-size: var(--tx-fs-sm);
        color: var(--kt-muted, #64748b);
        line-height: 1.35;
    }

    #ktMobileHomeMenu .kt-mobile-stats {
        flex-shrink: 0;
        margin-bottom: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid var(--kt-border-solid, rgba(30, 58, 95, 0.1));
        background: rgba(255, 255, 255, 0.88);
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
        box-sizing: border-box;
    }

    #ktMobileHomeMenu .kt-mobile-stats-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 8px;
    }

    #ktMobileHomeMenu .kt-mobile-stats-title {
        margin: 0;
        font-size: var(--tx-fs-xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--kt-muted, #64748b);
    }

    #ktMobileHomeMenu .kt-mobile-stats-meta {
        margin: 0;
        font-size: var(--tx-fs-xs);
        color: var(--kt-muted, #64748b);
        text-align: right;
        line-height: 1.3;
    }

    #ktMobileHomeMenu .kt-mobile-stats-body {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    #ktMobileHomeMenu .kt-mobile-stats-loading {
        margin: 0;
        font-size: var(--tx-fs-sm);
        color: var(--kt-muted, #64748b);
        text-align: center;
        padding: 4px 0;
    }

    #ktMobileHomeMenu .kt-mobile-stats-row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
        padding: 6px 8px;
        border-radius: 8px;
        background: var(--kt-menu-bg, #fff);
        border: 1px solid var(--kt-border-solid, rgba(30, 58, 95, 0.06));
    }

    #ktMobileHomeMenu .kt-mobile-stats-label {
        flex: 1 1 auto;
        min-width: 0;
        font-size: var(--tx-fs-xs);
        font-weight: 600;
        color: var(--kt-text, #1e3a5f);
        line-height: 1.3;
    }

    #ktMobileHomeMenu .kt-mobile-stats-val {
        flex: 0 0 auto;
        max-width: 58%;
        font-size: var(--tx-fs-xs);
        font-weight: 700;
        color: var(--kt-navy, #1f4e79);
        text-align: right;
        line-height: 1.3;
        word-break: break-word;
    }

    #ktMobileHomeMenu .kt-mobile-stats-row--profit .kt-mobile-stats-val {
        color: #0f7a4a;
    }

    #ktMobileHomeMenu .kt-mobile-stats-row--loss .kt-mobile-stats-val {
        color: #b42318;
    }

    #ktMobileHomeMenu .kt-mobile-stats-row--warn .kt-mobile-stats-val {
        color: #c2410c;
    }

    #ktMobileHomeMenu .kt-mobile-stats-row--ok .kt-mobile-stats-val {
        color: #0f7a4a;
    }

    #ktMobileHomeMenu .kt-mobile-menu-body {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    #ktMobileHomeMenu .kt-mobile-menu-group {
        width: 100%;
        max-width: 100%;
        padding: 10px;
        border-radius: 12px;
        border: 1px solid var(--kt-border-solid, rgba(30, 58, 95, 0.1));
        background: rgba(255, 255, 255, 0.72);
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
        box-sizing: border-box;
    }

    #ktMobileHomeMenu .kt-mobile-menu-section {
        margin: 0 0 8px;
        padding: 0 2px;
        font-size: var(--tx-fs-xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--kt-muted, #64748b);
    }

    #ktMobileHomeMenu .kt-mobile-menu-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-flow: row;
        gap: 8px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    #ktMobileHomeMenu .kt-mobile-menu-item {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 0;
        width: 100%;
        min-height: 5.25rem;
        padding: 10px 6px;
        border-radius: 10px;
        border: 1px solid var(--kt-border-solid, rgba(30, 58, 95, 0.1));
        background: var(--kt-menu-bg, #fff);
        color: var(--kt-text, #1e3a5f);
        text-decoration: none;
        text-align: center;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box;
    }

    #ktMobileHomeMenu .kt-mobile-menu-item:active {
        transform: scale(0.98);
        background: var(--kt-hover, #f1f5f9);
    }

    #ktMobileHomeMenu .kt-mobile-menu-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 10px;
        background: var(--kt-root-hover, #e8f1fb);
        color: var(--kt-accent, #2b5c8a);
        font-size: var(--tx-fs-lg);
        flex-shrink: 0;
        overflow: hidden;
    }

    #ktMobileHomeMenu .kt-mobile-menu-icon i {
        display: block;
        line-height: 1;
    }

    #ktMobileHomeMenu .kt-mobile-menu-label {
        display: block;
        width: 100%;
        font-size: var(--tx-fs-sm);
        font-weight: 600;
        line-height: 1.25;
        word-break: break-word;
    }

    #ktMobileHomeMenu .kt-mobile-menu-group-logout {
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    #ktMobileHomeMenu .kt-mobile-menu-item-logout {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        min-height: 3rem;
        padding: 10px 14px;
        color: #b42318;
        background: rgba(220, 53, 69, 0.06);
        border-color: rgba(220, 53, 69, 0.18);
    }

    #ktMobileHomeMenu .kt-mobile-menu-item-logout .kt-mobile-menu-icon {
        background: rgba(220, 53, 69, 0.12);
        color: #b42318;
        width: 2rem;
        height: 2rem;
        font-size: var(--tx-fs-base);
    }

    /* Window pages — full page on mobile */
    html.kt-mobile body {
        overflow-x: hidden;
    }

    html.kt-mobile .ktw-page {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    html.kt-mobile .ktw-head h1 {
        font-size: var(--tx-fs-lg);
    }

    html.kt-mobile .ktw-head p {
        font-size: var(--tx-fs-sm);
    }

    html.kt-mobile .ktw-note {
        display: none;
    }

    html.kt-mobile .kt-mobile-home-bar {
        margin-bottom: 8px;
    }

    html.kt-mobile .kt-btn-kt-home {
        flex-shrink: 0;
    }

    /* Table scroll */
    html.kt-mobile .kt-table-scroll,
    html.kt-mobile .kt-luoi-ketoan-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Doc mobile form */
    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-hide {
        display: none !important;
    }

    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions {
        position: sticky;
        top: 0;
        z-index: 40;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--ktw-card, #fff);
        border-bottom: 1px solid var(--ktw-line, #e2e8f0);
        padding-top: 6px;
        padding-bottom: 6px;
        gap: 6px;
    }

    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions .ktw-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions .ktw-btn i {
        margin-right: 0;
    }

    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions .ktw-btn span {
        display: none;
    }

    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions #ktPhSave,
    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions .primary {
        order: -20;
    }

    html.kt-mobile .kt-doc-mobile-form .kt-doc-mobile-actions #ktPhListBtn {
        order: -10;
    }

    html.kt-mobile .kt-doc-mobile-footer {
        position: sticky;
        bottom: 0;
        z-index: 40;
        display: flex;
        gap: 8px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0));
        background: var(--ktw-card, #fff);
        border-top: 1px solid var(--ktw-line, #e2e8f0);
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    }

    html.kt-mobile .kt-doc-mobile-footer .ktw-btn {
        flex: 1;
        justify-content: center;
    }

    html.kt-mobile .kt-doc-mobile-form .ktw-phieu-head {
        grid-template-columns: 1fr;
    }

    html.kt-mobile .kt-doc-mobile-form .ktw-phieu-col-right {
        padding-left: 0;
        border-left: 0;
        padding-top: 10px;
        border-top: 1px solid var(--ktw-line, #e2e8f0);
    }

    /* Phiếu line grid → card input (giống Chungtu #tblProducts mobile) */
    .kt-luoi-mobile-card.kt-luoi-ketoan-scroll,
    .kt-luoi-mobile-card.ktw-table-wrap,
    .kt-luoi-mobile-card .kt-luoi-ketoan-scroll,
    .kt-luoi-mobile-card .ktw-phieu-wrap {
        overflow: visible !important;
        min-height: 0;
        border: none !important;
    }

    .kt-luoi-mobile-card table.ktw-phieu-table.kt-luoi-ketoan,
    .kt-luoi-mobile-card table.kt-luoi-ketoan {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: 0;
        background: transparent;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan thead {
        display: none;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot {
        display: block;
        width: 100%;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody {
        counter-reset: kt-phieu-line;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody tr {
        counter-increment: kt-phieu-line;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem 0.7rem;
        width: 100%;
        margin: 0 0 0.85rem;
        padding: 0.75rem 0.8rem 0.85rem;
        background: var(--ktw-card, #fff);
        border: 1px solid var(--ktw-line, #dbe4ee);
        border-radius: 12px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
        box-sizing: border-box;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody tr::before {
        grid-column: 1 / -1;
        content: "Dòng " counter(kt-phieu-line);
        font-weight: 700;
        font-size: var(--tx-fs-sm);
        color: var(--ktw-navy, #1e40af);
        padding-bottom: 0.15rem;
        border-bottom: 1px dashed var(--ktw-line, #e2e8f0);
        margin-bottom: 0.15rem;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0.2rem;
        border: 0 !important;
        padding: 0 !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        visibility: visible !important;
        white-space: normal !important;
        background: transparent;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-label]::before {
        content: attr(data-label);
        font-size: var(--tx-fs-sm);
        font-weight: 650;
        color: #64748b;
        margin-bottom: 0.15rem;
        line-height: 1.2;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.kt-mobile-field-hide,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.ktw-ph-id,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.ktw-stt,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.kt-col-mobile-hidden {
        display: none !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-mobile-field="tkno"] {
        grid-column: 1;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-mobile-field="tkco"] {
        grid-column: 2;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-mobile-field="sl"] {
        grid-column: 1;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-mobile-field="dgia"] {
        grid-column: 2;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.kt-mobile-field:not([data-mobile-field="tkno"]):not([data-mobile-field="tkco"]):not([data-mobile-field="sl"]):not([data-mobile-field="dgia"]) {
        grid-column: 1 / -1;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.ktw-row-del,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-luoi-type="del"] {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: stretch;
        align-items: center;
        padding-top: 0.35rem !important;
        margin-top: 0.1rem;
        border-top: 1px dashed var(--ktw-line, #e2e8f0) !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.ktw-row-del::before,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td[data-luoi-type="del"]::before {
        content: none !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td input:not([type="hidden"]),
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td select,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td textarea,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td .inputpicker-input {
        font-size: var(--tx-fs-lg) !important;
        min-height: 2.65rem !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.375rem 0.65rem !important;
        border: 1px solid var(--ktw-line, #ced4da) !important;
        border-radius: 0.375rem !important;
        background: var(--ktw-card, #fff) !important;
        color: var(--ktw-text, #212529) !important;
        box-sizing: border-box;
        white-space: normal !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td .inputpicker-overflow-hidden,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td .inputpicker-div {
        width: 100% !important;
        max-width: 100% !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td .ktw-ph-ro {
        font-size: var(--tx-fs-lg);
        min-height: 2.65rem;
        padding: 0.375rem 0.65rem;
        border: 1px solid var(--ktw-line, #ced4da);
        border-radius: 0.375rem;
        background: var(--ktw-bg, #f8fafc);
        display: flex;
        align-items: center;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.ktw-row-del .ktw-row-del-btn {
        width: 100%;
        min-height: 2.5rem;
        border: 1px solid var(--ktw-line, #ced4da);
        border-radius: 0.375rem;
        background: var(--ktw-card, #fff);
        color: var(--ktw-text, #334155);
        justify-content: center;
        gap: 0.35rem;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tbody td.ktw-row-del .ktw-row-del-btn::after {
        content: " Xóa dòng";
        font-size: var(--tx-chrome-fs);
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 12px;
        padding: 10px 12px;
        margin-top: 4px;
        border-radius: 10px;
        background: var(--ktw-head, #f1f5f9);
        border: 1px solid var(--ktw-line, #e2e8f0);
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot td.ktw-ph-id,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot td.ktw-stt,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot td.ktw-row-del,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot td.ktw-col-off,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot td.kt-col-mobile-hidden,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot td.kt-mobile-field-hide {
        display: none !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot .ktw-phieu-total-lbl {
        flex: 1 1 auto;
        font-weight: 700;
        border: 0 !important;
        padding: 0 !important;
    }

    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot .ktw-ph-tien,
    .kt-luoi-mobile-card table.kt-luoi-ketoan tfoot .ktw-ph-tiennt {
        flex: 0 0 auto;
        border: 0 !important;
        padding: 0 !important;
        text-align: right;
    }

    /* Hide columns marked mobile-hidden */
    html.kt-mobile .kt-col-mobile-hidden,
    .kt-col-mobile-hidden {
        display: none !important;
    }

    /* Danh sách phiếu — card list (chọn / xem phiếu) */
    .ktw-dsp-page .ktw-note {
        display: none;
    }

    .ktw-dsp-page .ktw-dsp-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-end;
    }

    .ktw-dsp-page .ktw-dsp-toolbar .ktw-phieu-ngay {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .ktw-dsp-page .ktw-dsp-nam {
        flex: 1 1 100%;
        font-size: var(--tx-fs-sm);
        color: var(--ktw-muted, #64748b);
    }

    .ktw-dsp-page .ktw-dsp-toolbar #ktDspLoad {
        flex: 1 1 100%;
        justify-content: center;
    }

    .ktw-dsp-page .ktw-hh-pager {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
        padding: 4px 0 8px;
    }

    .kt-luoi-mobile-list.kt-luoi-ketoan-scroll,
    .kt-luoi-mobile-list .ktw-dsp-wrap {
        overflow: visible !important;
        border: none !important;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table.kt-luoi-ketoan {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: 0;
        background: transparent;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table thead {
        display: none;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody,
    .kt-luoi-mobile-list table.ktw-dsp-table tfoot {
        display: block;
        width: 100%;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody tr {
        display: grid;
        grid-template-columns: 2.25rem 1fr auto;
        grid-template-areas:
            "chk so xem"
            "ngay ngay ngay"
            "ten ten ten"
            "sum sum sum"
            "paid paid paid";
        gap: 6px 10px;
        padding: 12px;
        margin: 0 0 10px;
        border: 1px solid var(--ktw-line, #dbe4ee);
        border-radius: 12px;
        background: var(--ktw-card, #fff);
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
        box-sizing: border-box;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody tr.ktw-tk-selected {
        border-color: var(--ktw-accent, #6366f1);
        background: #f5f7ff;
        box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td {
        display: block !important;
        border: 0 !important;
        padding: 0 !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        overflow: visible !important;
        visibility: visible !important;
        white-space: normal !important;
        text-overflow: clip !important;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td.kt-dsp-mobile-hide,
    .kt-luoi-mobile-list table.ktw-dsp-table tbody td.ktw-ph-id,
    .kt-luoi-mobile-list table.ktw-dsp-table tbody td.ktw-stt {
        display: none !important;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="chk"] {
        grid-area: chk;
        align-self: center;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="so"] {
        grid-area: so;
        align-self: center;
        font-weight: 700;
        font-size: var(--tx-fs-lg);
        color: var(--ktw-navy, #1e40af);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="xem"] {
        grid-area: xem;
        align-self: center;
        justify-self: end;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="ngay"] {
        grid-area: ngay;
        font-size: var(--tx-chrome-fs);
        color: var(--ktw-muted, #64748b);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="tencty"] {
        grid-area: ten;
        font-size: var(--tx-fs-base);
        line-height: 1.35;
        color: var(--ktw-text, #1e293b);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="tongcong"] {
        grid-area: sum;
        display: flex !important;
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
        gap: 8px;
        padding-top: 4px !important;
        border-top: 1px dashed var(--ktw-line, #e2e8f0) !important;
        margin-top: 2px;
        font-weight: 700;
        font-size: var(--tx-fs-base);
        color: var(--ktw-navy, #1e40af);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="paid"] {
        grid-area: paid;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="paid"]:empty {
        display: none !important;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: var(--tx-fs-xs);
        font-weight: 650;
        color: #64748b;
        margin-bottom: 2px;
        line-height: 1.2;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="so"]::before,
    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="xem"]::before,
    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="chk"]::before,
    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="tongcong"]::before {
        content: none;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="tongcong"]::before {
        content: "Tổng cộng";
        font-size: var(--tx-fs-xs);
        font-weight: 650;
        color: #64748b;
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="chk"] input[type="checkbox"] {
        width: 1.2rem;
        height: 1.2rem;
        margin: 0;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="xem"] .ktw-xem-btn {
        min-width: 2.5rem;
        min-height: 2.5rem;
        border-radius: 8px;
        border: 1px solid var(--ktw-line, #ced4da);
        background: var(--ktw-card, #fff);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tbody td[data-col="paid"] .ktw-dsp-view-tm {
        width: 100%;
        justify-content: center;
        min-height: 2.35rem;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tfoot tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 12px;
        padding: 10px 12px;
        margin-top: 4px;
        border-radius: 10px;
        background: var(--ktw-head, #f1f5f9);
        border: 1px solid var(--ktw-line, #e2e8f0);
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tfoot td.kt-dsp-mobile-hide,
    .kt-luoi-mobile-list table.ktw-dsp-table tfoot td.ktw-ph-id,
    .kt-luoi-mobile-list table.ktw-dsp-table tfoot td.ktw-stt {
        display: none !important;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tfoot .ktw-dsp-total-lbl {
        flex: 1 1 auto;
        font-weight: 700;
        border: 0 !important;
        padding: 0 !important;
    }

    .kt-luoi-mobile-list table.ktw-dsp-table tfoot td[data-col="tongcong"] {
        flex: 0 0 auto;
        font-weight: 700;
        border: 0 !important;
        padding: 0 !important;
        text-align: right;
    }

    /* Sổ sách toolbar */
    html.kt-mobile .ktw-sosach-page .ktw-toolbar {
        position: sticky;
        top: 0;
        z-index: 30;
        flex-wrap: wrap;
        background: var(--ktw-bg, #f8fafc);
        padding-bottom: 8px;
    }

    html.kt-mobile .ktw-sosach-page .ktw-field {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Toolbar overflow menu */
    html.kt-mobile .kt-toolbar-more-wrap {
        position: relative;
    }

    html.kt-mobile .kt-toolbar-more-menu {
        position: absolute;
        right: 0;
        top: 100%;
        z-index: 50;
        min-width: 200px;
        padding: 6px;
        border-radius: 10px;
        border: 1px solid var(--ktw-line, #e2e8f0);
        background: var(--ktw-card, #fff);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    html.kt-mobile .kt-toolbar-more-menu[hidden] {
        display: none !important;
    }

    html.kt-mobile .kt-toolbar-more-menu .ktw-btn {
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 4px;
    }

    html.kt-mobile .kt-toolbar-extra-mobile {
        display: none;
    }

    /* Phiếu list bottom sheet */
    html.kt-mobile .ktw-phieu-list-card {
        width: 100%;
        max-height: 92dvh;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }

    html.kt-mobile .ktw-phieu-list {
        align-items: flex-end;
        padding: 0;
    }

    /* Wizard */
    html.kt-mobile .ktw-ktdl-steps,
    html.kt-mobile .ktw-rasoat-steps {
        flex-direction: column;
        align-items: stretch;
    }

    html.kt-mobile .ktw-ktdl-step,
    html.kt-mobile .ktw-rasoat-step {
        width: 100%;
    }

    /* BCTC tabs stacked */
    html.kt-mobile .ktw-bctc-tabs {
        flex-wrap: wrap;
        gap: 6px;
    }

    html.kt-mobile .ktw-bctc-tabs .ktw-btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        font-size: var(--tx-fs-sm);
        padding: 0 8px;
    }

    /* HeThong forms */
    html.kt-mobile .ktw-ht-form .ktw-grid {
        grid-template-columns: 1fr;
    }

    html.kt-mobile .ktw-ht-form .ktw-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .kt-mobile-home-menu {
        display: none !important;
    }

    .kt-doc-mobile-footer {
        display: none;
    }

    .kt-toolbar-more-wrap {
        display: none;
    }
}

/* Login polish */
@media (max-width: 640px) {
    .ktl-page {
        min-height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .ktl-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .ktl-btn-submit,
    .ktl-form .ktl-btn-primary {
        width: 100%;
    }
}
