/* ═══ Grid danh sách quyết toán ═══ */
#grid-quyettoan .grid-table tbody td {
    border-bottom: 1px solid #e2e8f0;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 12px;
}
#grid-quyettoan .grid-table tbody tr:nth-child(even) td { background: rgba(248,250,252,.6); }
#grid-quyettoan .grid-table tbody tr:hover td { background: #f8fafc; }
#grid-quyettoan .grid-table tbody tr.ram-highlight-row td {
    background: var(--brand-soft) !important;
    border-top: 1px dashed #81C784 !important;
    border-bottom: 1px dashed #81C784 !important;
}
#grid-quyettoan .grid-table tbody tr.ram-highlight-row td:first-child { border-left: 3px solid #0f9d4f !important; }
#grid-quyettoan .grid-table tbody td.sticky-col,
#grid-quyettoan .grid-table tbody td.col-action { background: #fff; }
#grid-quyettoan .grid-table tbody tr:nth-child(even) td.sticky-col,
#grid-quyettoan .grid-table tbody tr:nth-child(even) td.col-action { background: rgba(248,250,252,.95); }

/* Cột Số QT — key chính, nổi bật */
.qt-sqt-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.qt-sqt-code {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.3px;
    line-height: 1.2;
}
.qt-sqt-date {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    color: #94a3b8;
    line-height: 1;
}
.qt-sqt-date i {
    font-size: 9px;
}

/* Cột tiền */
.qt-grid-money { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.qt-grid-thu { color: #15803d; }
.qt-grid-chi { color: #dc2626; }
.qt-grid-thuho { color: #1d4ed8; font-weight: 500; font-size: 11px; }
.qt-grid-chiho { color: #be185d; font-weight: 500; font-size: 11px; }
.qt-grid-profit { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.qt-grid-profit.positive { color: #047857; }
.qt-grid-profit.negative { color: #dc2626; }

/* ═══ Form shell ═══ */
.qt-form-shell {
    display: flex;
    flex-direction: column;
    gap: 0px;
    height: 100%;
    min-height: 0;
}

.app-dialog:has(.qt-form-shell) {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    max-width: 1580px;
}

.app-dialog:has(.qt-form-shell) .app-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    overflow: hidden !important;
    padding:5px;
}

.app-dialog:has(.qt-form-shell) .app-dialog-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    user-select:none;
}

.app-dialog:has(.qt-form-shell) .app-dialog-header {
    gap: 14px;
    padding-right: 12px;
    position: relative;
}

.app-dialog:has(.qt-form-shell) .dialog-title {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.app-dialog:has(.qt-form-shell) .dialog-header-content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: max-content;
    pointer-events: none;
}

.app-dialog:has(.qt-form-shell) .dialog-header-content .qt-tab-header {
    pointer-events: auto;
}

.app-dialog:has(.qt-form-shell) .dialog-close {
    position: relative;
    z-index: 2;
}

.qt-top-strip {
    display: block;
    padding: 5px 2px;
    overflow: visible;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    background: #f8fafc;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    animation: qt-strip-in .35s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes qt-strip-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.qt-tab-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    width: fit-content;
    max-width: 100%;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(8px);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
    flex-shrink: 0;
    margin-bottom: 0;
}

.qt-top-fields {
    display: grid;
    grid-template-columns: 230px 155px 250px 180px auto minmax(220px, 1fr);
    gap: 8px;
    align-items: end;
    min-width: 0;
    flex: 1;
}

.qt-field {
    min-width: 0;
}

.qt-tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: all .18s ease;
}

.qt-tab-btn i { font-size: 14px; }

.qt-tab-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.qt-tab-btn.active {
    background: linear-gradient(135deg, var(--qt-accent), color-mix(in srgb, var(--qt-accent) 76%, #ffffff));
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--qt-accent) 28%, transparent);
}

.qt-tab-count {
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    font-size: 11px;
    font-weight: 900;
}

.qt-tab-btn.active .qt-tab-count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.qt-compact-panel { padding: 8px 10px; }

.qt-sub-filter-panel {
    background: #ffffff;
    border: 1px solid #edf2f7;
    box-shadow: none;
}

.qt-form-grid {
    display: grid;
    grid-template-columns: 220px auto;
    gap: 10px;
    align-items: center;
    justify-content: start;
}

.qt-segment {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 10px;
    background: rgba(37, 99, 235, .06);
    border: 0;
    user-select:none;
}

.qt-segment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 56px;
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}

.qt-segment-btn i {
    font-size: 12px;
    transition: transform .18s ease;
}

.qt-segment-btn:hover {
    color: #1e40af;
    background: rgba(255, 255, 255, .7);
}

    .qt-segment-btn.active {
        color: #388E3C;
        background: #E8F5E9;
    }

.qt-segment-btn.active i {
    transform: scale(1.1);
}

.qt-form-grid .app-form-group,
.qt-compact-panel .app-form-group,
.qt-top-fields .app-form-group {
    margin-bottom: 0;
}

.qt-top-fields .form-control,
.qt-top-fields .cmbgt-shell,
.qt-top-fields .inputd-shell {
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
    border: 1px solid #93c5fd !important;
    background: #fff !important;
}

.qt-top-fields .inputd-root {
    width: 100% !important;
}

.qt-top-fields .inputd-input {
    height: 32px;
}

.qt-mini-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.qt-mini-title b {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.qt-lohang-panel {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #ddd6fe;
    background:
        radial-gradient(circle at 0 0, rgba(124, 58, 237, .13), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
    box-shadow: 0 18px 38px rgba(88, 28, 135, .10), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.qt-lohang-title {
    flex: 0 0 auto;
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid #ede9fe;
    background: rgba(255, 255, 255, .76);
    backdrop-filter: blur(8px);
    user-select:none;
}

.qt-lohang-title b {
    color: #4c1d95;
    font-size: 14px;
    letter-spacing: -.01em;
}

.qt-lohang-title b i {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    box-shadow: 0 10px 18px rgba(124, 58, 237, .25);
}

.qt-lohang-title span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.qt-lohang-scroll {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: auto;
    background: #fff;
}

.qt-lohang-table {
    width: 100%;
    min-width: 1380px;
    table-layout: fixed;
    margin-bottom: 0;
}

.qt-lohang-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 34px;
    padding: 0 6px !important;
    color: #475569;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #cbd5e1;
    border-right: 1px solid #e2e8f0;
    font-size: 10.5px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.qt-lohang-table tbody td {
    height: auto;
    padding: 4px 6px !important;
    border-bottom: 1px solid #eef2f7;
    border-right: 1px solid #f1f5f9;
    color: #334155;
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.3;
}

.qt-lohang-table thead th:last-child,
.qt-lohang-table tbody td:last-child {
    border-right: 0;
    text-align: center;
}

.qt-lohang-table tbody tr {
    transition: background-color .14s ease, box-shadow .14s ease;
}

.qt-lohang-table tbody tr:nth-child(even) {
    background: #fcfdff;
}

.qt-lohang-table tbody tr:hover {
    background: #f5f3ff;
    box-shadow: inset 4px 0 0 #7c3aed;
}

.qt-lohang-table thead th:nth-child(1) { width: 44px; text-align: center; }
.qt-lohang-table thead th:nth-child(2) { width: 120px; }
.qt-lohang-table thead th:nth-child(3) { width: 260px; }
.qt-lohang-table thead th:nth-child(4) { width: 70px; text-align: right; }
.qt-lohang-table thead th:nth-child(5) { width: 110px; text-align: center; }
.qt-lohang-table thead th:nth-child(6) { width: 155px; }
.qt-lohang-table thead th:nth-child(7) { width: 140px; }
.qt-lohang-table thead th:nth-child(8) { width: 200px; }
.qt-lohang-table thead th:nth-child(9) { width: 100px; }
.qt-lohang-table thead th:nth-child(10) { width: 125px; }
.qt-lohang-table thead th:nth-child(11) { width: 44px; }

.qt-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    line-height: 1.25;
}

.qt-cell-stack span {
    display: block;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}

.qt-cell-stack i {
    margin-right: 3px;
    color: #64748b;
    font-size: 9px;
}

.qt-center-stack {
    align-items: center;
    text-align: center;
}

.qt-num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #0f172a !important;
}

.qt-row-index {
    width: 22px;
    height: 22px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 10px;
    font-weight: 900;
}

.qt-lohang-xe {
    font-weight: 900;
    color: #0f172a;
}

.qt-main-text {
    color: #0f172a;
    font-weight: 700;
}

.qt-note-text {
    padding-left: 7px;
    border-left: 2px solid #d1d5db;
    color: #6b7280;
    font-style: italic;
}

.qt-driver-text {
    color: #303f9f;
    font-weight: 700;
}

.qt-seal-text {
    color: #5d4037;
}

.qt-deadline-text {
    color: #880e4f;
}

.qt-procedure-text {
    color: #6a1b9a;
}

.qt-real-time {
    color: #166534;
    font-weight: 800;
}

.qt-lohang-delete {
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 8px;
    opacity: .45;
    transition: all .14s ease;
}

.qt-lohang-table tbody tr:hover .qt-lohang-delete,
.qt-lohang-delete:focus-visible {
    opacity: 1;
    transform: scale(1.03);
}

.qt-compact-table.table > :not(caption) > * > * {
    padding: 4px 6px;
    vertical-align: middle;
}

.qt-money-grid {
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0px;
    min-height: 0;
    flex: 1 1 auto;
    height: auto;
}

.qt-money-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0px;
    overflow: hidden;
}

.qt-money-panel:hover {
    box-shadow: none;
}

.qt-money-panel-thu {
    border: 1px solid #c8e6c9;
    background: #fff;
    padding: 0px;
}

.qt-money-panel-chi {
    border: 1px solid #ffcdd2;
    background: #fff;
    padding: 0px;
}

.qt-table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 0;
    background: #fff;
}

.qt-table-scroll .qt-compact-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

    .qt-table-scroll thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        height: 28px;
        padding: 0 8px !important;
        color: #fff;
        font-size: 10.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        white-space: nowrap;
        border-right: 1px solid rgba(255,255,255,.15) !important;
        border-bottom: 0 !important;
    }

.qt-money-panel-thu .qt-table-scroll thead th {
    background: linear-gradient(180deg, #22c55e, #16a34a);
    border-bottom: 0;
}
.qt-money-panel-thu .qt-table-scroll thead th:first-child {
    color: #fff;
    font-weight: 800;
    font-size: 11px;
}
    .qt-money-panel-thu .qt-table-scroll thead th:nth-child(1),
    .qt-money-panel-thu .qt-table-scroll thead th:nth-child(2),
    .qt-money-panel-chi .qt-table-scroll thead th:nth-child(1),
    .qt-money-panel-chi .qt-table-scroll thead th:nth-child(2) {
        text-align: left;
    }
    .qt-money-panel-thu .qt-table-scroll thead th:nth-child(3),
    .qt-money-panel-chi .qt-table-scroll thead th:nth-child(3) {
        text-align: right;
    }
    .qt-money-panel-thu .qt-table-scroll thead th i,
    .qt-money-panel-chi .qt-table-scroll thead th i{
       margin-right:5px;
    }

    .qt-money-panel-chi .qt-table-scroll thead th {
        background: linear-gradient(180deg, #ef4444, #dc2626);
        border-bottom: 0;
    }
.qt-money-panel-chi .qt-table-scroll thead th:first-child {
    color: #fff;
    font-weight: 800;
    font-size: 11px;
}

.qt-table-scroll thead th:last-child,
.qt-flat-table tbody td:last-child {
    border-right: 0;
}

.qt-flat-table thead th:nth-child(1) { width: 200px; }
/*.qt-flat-table thead th:nth-child(2) { width: auto — flex }*/
.qt-flat-table thead th:nth-child(3) { width: 125px; }
.qt-flat-table thead th:nth-child(4) { width: 70px; text-align: center; }
.qt-flat-table tbody td:nth-child(4) { text-align: center; }
.qt-flat-table tbody td:nth-child(4) input,
.qt-flat-table tbody td:nth-child(4) input::placeholder {
    text-align: center;
}
.qt-flat-table thead th:nth-child(5) { width: 115px; text-align: right; }
.qt-flat-table tbody td:nth-child(5) { text-align: right; }
.qt-flat-table thead th:nth-child(6) { width: 60px; }
.qt-flat-table thead th:nth-child(7) { width: 90px; text-align: center; }
.qt-flat-table tbody td:nth-child(7) { text-align: center; }
.qt-flat-table tbody td:nth-child(7) input,
.qt-flat-table tbody td:nth-child(7) input::placeholder {
    text-align: center;
}
.qt-flat-table thead th:nth-child(8) { width: 110px; text-align: center; }
.qt-flat-table tbody td:nth-child(8) { text-align: center; }
.qt-flat-table tbody td:nth-child(8) input::placeholder {
    text-align: center;
}
.qt-flat-table thead th:nth-child(9) { width: 180px; }
.qt-flat-table thead th:nth-child(10) { width: 58px; text-align: center; }
.qt-flat-table td:nth-child(3) input {
    color: #B71C1C !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    font-variant-numeric: tabular-nums;
}
.qt-money-panel-chi .qt-flat-table td:nth-child(3) input {
    color: #333333 !important;
    font-weight: 700 !important;
    font-size: 11px !important;
    font-variant-numeric: tabular-nums;
}
.qt-th-count {
    display: inline-flex;
    margin-top: -2px;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
    color: rgba(255,255,255,.9);
}

.qt-money-panel-thu .qt-th-count { background: rgba(255,255,255,.22); color: #fff; }
.qt-money-panel-chi .qt-th-count { background: rgba(255,255,255,.22); color: #fff; }

.qt-flat-table tbody td:nth-child(3) {
    text-align: right;
}

.qt-flat-table tbody td:nth-child(3) .inputn-root,
.qt-flat-table tbody td:nth-child(3) .inputn-shell {
    width: 100%;
}

.qt-flat-table tbody td:nth-child(3) .inputn-input {
    text-align: right;
    padding-right: 18px;
    font-variant-numeric: tabular-nums;
}

.qt-flat-table.table > :not(caption) > * > * {
    border-bottom: 1px dashed #d1d5db;
    border-right: 1px dashed #e5e7eb;
}

.qt-flat-table tbody tr {
    transition: background-color .08s ease;
}

.qt-flat-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, .7);
}

.qt-flat-table tbody tr:hover {
    background: #eef2f7;
}

/* Highlight row đang edit — nổi bật rõ */
.qt-flat-table tbody tr:focus-within {
    background: #eff6ff !important;
    box-shadow: inset 4px 0 0 #3b82f6;
    border-radius: 3px;
}

.qt-flat-table tbody td {
    overflow: visible;
    font-size: 11px;
    color: #334155;
    vertical-align: middle;
    padding: 0 !important;
    height: auto;
    min-height: 24px;
    line-height: 1.25;
}

.qt-flat-table .form-control:not(.qt-dienGiai),
.qt-flat-table .inputn-input {
    height: 22px !important;
    min-height: 22px !important;
    padding: 0 6px !important;
    font-size: 11px !important;
    padding-right: 16px !important;
}
.qt-flat-table .inputn-shell.no-spin .inputn-icon-btn.clear {
    right: 0px;
    font-size: 9px;
    width: 14px !important;
}

.qt-flat-table .cmbgt-shell {
    height: auto !important;
    min-height: 22px;
}

.qt-flat-table .cmbgt-shell-main {
    padding: 0 0 0 4px !important;
}

.qt-flat-table .cmbgt-shell-label {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word;
    line-height: 1.25;
    font-size: 11px;
}

.qt-flat-table .cmbgt-icon-btn {
    width: 20px !important;
    min-width: 20px !important;
    height: 22px !important;
}

.qt-flat-table .inputd-shell {
    height: 22px !important;
    min-height: 22px !important;
}

.qt-flat-table .inputd-input {
    height: 20px !important;
    font-size: 11px !important;
    padding-right: 20px !important;
}

.qt-flat-table .inputd-icon-btn {
    width: 20px !important;
    min-width: 20px !important;
    height: 22px !important;
}

.qt-flat-table .inputn-shell {
    height: 22px !important;
    min-height: 22px !important;
}

.qt-dienGiai {
    resize: none;
    overflow: hidden;
    min-height: 22px !important;
    height: auto !important;
    padding: 1px 6px !important;
    font-size: 11px;
    line-height: 1.25;
    white-space: pre-wrap;
    word-break: break-word;
    field-sizing: content;
}

.qt-flat-table .form-control,
.qt-flat-table .cmbgt-shell,
.qt-flat-table .inputn-shell,
.qt-flat-table .inputd-shell {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 2px !important;
    transition: background .12s ease;
}

.qt-flat-table tbody tr:hover .form-control,
.qt-flat-table tbody tr:hover .cmbgt-shell,
.qt-flat-table tbody tr:hover .inputn-shell,
.qt-flat-table tbody tr:hover .inputd-shell {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.qt-flat-table .form-control:focus,
.qt-flat-table .cmbgt-shell:focus-within,
.qt-flat-table .inputn-shell:focus-within,
.qt-flat-table .inputd-shell:focus-within {
    border: 0 !important;
    background: #eff6ff !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 2px !important;
}

/* inputD clear: ẩn mặc định, hiện khi hover */
.qt-flat-table .inputd-icon-btn.clear {
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
}
.qt-flat-table .inputd-shell:hover .inputd-icon-btn.clear,
.qt-flat-table .inputd-shell:focus-within .inputd-icon-btn.clear {
    opacity: 1;
    pointer-events: auto;
}

.qt-check-cell {
    text-align: center;
    width: 48px;
}

.qt-check-only {
    justify-content: center;
    margin: 0;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    cursor: pointer;
}

.qt-check-only .app-check-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #cbd5e1;
    background: #fff;
    box-shadow: none;
    transition: all .15s ease;
}

.qt-check-only:hover .app-check-box {
    border-color: #93c5fd;
    background: #eff6ff;
}

.qt-check-only input:checked + .app-check-box {
    background: #eff6ff;
    border-color: var(--brand, #0f9d4f);
    color: var(--brand, #0f9d4f);
    box-shadow: 0 0 0 3px rgba(15, 157, 79, .12);
}

.qt-check-only .app-check-box i {
    font-size: 12px;
}

.qt-check-only .app-check-text {
    display: none;
}

.qt-action-th {
    width: 42px;
    text-align: center;
}

.qt-row-action {
    width: 42px;
    text-align: center;
}

.qt-file-cell {
    width: 48px;
    text-align: center;
}

.qt-file-btn {
    min-width: 32px;
    height: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 900;
    transition: all .15s ease;
    cursor:pointer;
}

.qt-file-btn:hover,
.qt-file-btn.has-file {
    color: #2563eb;
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, .12);
}

.qt-file-btn span {
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.qt-delete-row-btn {
    opacity: 0;
    transform: scale(.92);
    transition: all .14s ease;
}

.qt-flat-table tbody tr:hover .qt-delete-row-btn,
.qt-delete-row-btn:focus-visible {
    opacity: 1;
    transform: scale(1);
}

.qt-add-row-btn {
    min-width: 28px;
    height: 26px;
    padding: 0 7px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qt-add-row-btn-mini {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
}

.qt-add-row-btn-mini:hover {
    border-color: var(--brand, #0f9d4f);
    color: var(--brand, #0f9d4f);
    background: rgba(15, 157, 79, .06);
}

.qt-dialog-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.qt-summary-cards {
    display: flex;
    align-items: stretch;
    gap: 5px;
    flex: 0 0 50%;
    min-width: 0;
    padding-left:0px !important;
    margin-left:-13px;
}

.qt-summary-card {
    flex: 1;
    min-width: 0;
    padding: 5px 6px;
    border-radius: 6px;
    border: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    border:1px solid #fecdd3;
}

.qt-sc-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.qt-sc-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.qt-sc-body span {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    line-height: 1.2;
}

.qt-sc-body b {
    font-size: 11px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1.1;
}

.qt-summary-card.is-thu { background: #f0fdf4; }
.qt-summary-card.is-thu .qt-sc-icon { background: #bbf7d0; color: #15803d; }
.qt-summary-card.is-thu .qt-sc-body span { color: #16a34a; }
.qt-summary-card.is-thu .qt-sc-body b { color: #15803d; }

.qt-summary-card.is-chi { background: #fff1f2; }
.qt-summary-card.is-chi .qt-sc-icon { background: #fecdd3; color: #e11d48; }
.qt-summary-card.is-chi .qt-sc-body span { color: #f43f5e; }
.qt-summary-card.is-chi .qt-sc-body b { color: #e11d48; }

.qt-summary-card.is-thuho { background: #eff6ff; }
.qt-summary-card.is-thuho .qt-sc-icon { background: #bfdbfe; color: #1d4ed8; }
.qt-summary-card.is-thuho .qt-sc-body span { color: #3b82f6; }
.qt-summary-card.is-thuho .qt-sc-body b { color: #1d4ed8; }

.qt-summary-card.is-chiho { background: #fdf2f8; }
.qt-summary-card.is-chiho .qt-sc-icon { background: #fbcfe8; color: #be185d; }
.qt-summary-card.is-chiho .qt-sc-body span { color: #ec4899; }
.qt-summary-card.is-chiho .qt-sc-body b { color: #be185d; }

.qt-summary-card.is-profit { flex: 1.2; }
.qt-summary-card.is-profit.positive { background: #ecfdf5; }
.qt-summary-card.is-profit.positive .qt-sc-icon { background: #a7f3d0; color: #047857; }
.qt-summary-card.is-profit.positive .qt-sc-body span { color: #059669; }
.qt-summary-card.is-profit.positive .qt-sc-body b { color: #047857; font-size: 12px; }
.qt-summary-card.is-profit.negative { background: #fef2f2; }
.qt-summary-card.is-profit.negative .qt-sc-icon { background: #fecaca; color: #dc2626; }
.qt-summary-card.is-profit.negative .qt-sc-body span { color: #ef4444; }
.qt-summary-card.is-profit.negative .qt-sc-body b { color: #dc2626; font-size: 12px; }

.qt-footer-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.qt-footer-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding-top: 0;
    padding-bottom: 0;
}

.qt-file-dialog {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qt-file-upload {
    position: relative;
    min-height: 56px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: border-color .15s ease, color .15s ease;
}

.qt-file-upload:hover {
    border-color: #93c5fd;
    color: #2563eb;
}

.qt-file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.qt-file-upload i { font-size: 18px; }

.qt-file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 360px;
    overflow: auto;
}

.qt-file-empty {
    padding: 24px;
    color: #94a3b8;
    text-align: center;
    font-size: 12px;
}

.qt-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    background: transparent;
    transition: background .12s ease;
}

.qt-file-item:last-child { border-bottom: 0; }

.qt-file-item:hover { background: #f8fafc; }

.qt-file-item > i {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.qt-file-item > div:first-of-type {
    flex: 1;
    min-width: 0;
}

.qt-file-item b {
    display: block;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0f172a;
}

.qt-file-item span {
    display: block;
    font-size: 10px;
    color: #94a3b8;
}

.qt-file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.qt-file-actions .btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
}

.qt-file-footer { display: flex; justify-content: flex-end; padding-top: 4px; }

/* Preview loading */
.qt-preview-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(255, 255, 255, .9);
}

.qt-preview-loading span {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    animation: qt-pulse 1.5s ease-in-out infinite;
}

.qt-preview-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: qt-spin .7s linear infinite;
}

@keyframes qt-spin {
    to { transform: rotate(360deg); }
}

@keyframes qt-pulse {
    0%, 100% { opacity: .5; }
    50% { opacity: 1; }
}

.qt-compact-table .cmbgt-shell,
.qt-compact-table .form-control,
.qt-form-grid .cmbgt-shell,
.qt-form-grid .form-control {
    min-height: 28px;
}

@media (max-width: 1280px) {
    .qt-form-grid {
        grid-template-columns: 210px auto;
    }

    .qt-top-strip {
        padding: 9px;
    }

    .qt-top-fields {
        grid-template-columns: 1fr 150px 1fr 1fr auto;
        min-width: 0;
        width: 100%;
    }

    .qt-top-fields .qt-field:last-child {
        grid-column: 1 / -1;
    }

    .qt-summary-cards {
        flex-wrap: wrap;
    }
}

/* Số QT bold + word wrap trong cả 2 bảng */
.qt-lohang-table tbody td:nth-child(2) {
    font-weight: 800;
    color: #0f172a;
    white-space: normal;
    word-break: break-word;
}

/* Ô Số QT input có icon */
.qt-sqt-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.qt-sqt-input-wrap > i {
    position: absolute;
    left: 10px;
    z-index: 1;
    font-size: 14px;
    color: #2563eb;
    pointer-events: none;
}

.qt-sqt-input {
    padding-left: 32px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    color: #283593 !important;
    letter-spacing: .01em;
}
.qt-money-panel thead tr{
    user-select:none;
}
/* Header icon trong bảng thu/chi */
.qt-money-panel-thu .qt-flat-table thead th:first-child i,
.qt-money-panel-chi .qt-flat-table thead th:first-child i {
    margin-right: 4px;
    font-size: 11px;
}

/* Dropdown gợi ý số quyết toán */
.qt-sqt-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 480px;
    max-height: 340px;
    overflow: auto;
    z-index: 10000;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .10);
    padding: 4px;
    animation: qt-dropdown-in .15s ease both;
}

@keyframes qt-dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.qt-sqt-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
}

.qt-sqt-item:hover {
    background: #f1f5f9;
}

.qt-sqt-item + .qt-sqt-item {
    border-top: 1px solid #f8fafc;
}

.qt-sqt-item-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qt-sqt-item-head > i {
    color: #2563eb;
    font-size: 12px;
    flex-shrink: 0;
}

.qt-sqt-item-code {
    font-weight: 800;
    font-size: 12px;
    color: #0f172a;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.qt-sqt-item-count {
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 9px;
    font-weight: 800;
}

.qt-sqt-item-time {
    flex-shrink: 0;
    font-size: 9px;
    color: #94a3b8;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.qt-sqt-item-time i { font-size: 9px; }

.qt-sqt-item-subs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
    padding-left: 18px;
}

.qt-sqt-sub {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    font-size: 10px;
    line-height: 1.5;
}

.qt-sqt-sub-label {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    color: #b0bec5;
}

.qt-sqt-sub-val {
    color: #78909c;
    word-break: break-word;
    min-width: 0;
}

/* ═══ Tên khoản thu/chi — hiển thị text readonly ═══ */
.qt-khoan-name {
    font-size: 11px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.25;
    padding: 0 5px;
    white-space: normal;
    word-break: break-word;
    min-height: 22px;
    display: flex;
    align-items: center;
    gap: 2px;
}
.qt-khoan-name i {
    font-size: 14px;
    color: #94a3b8;
    flex-shrink: 0;
}

/* ═══ Dòng chưa lưu (pending) — nền xám nhẹ, dễ đọc ═══ */
.qt-row-pending td {
    opacity: .78;
    background: #FAFAFA;
    transition: opacity .15s ease, background .15s ease;
}
.qt-row-pending .qt-khoan-name {
    color: #6b7280;
    font-weight: 500;
}
.qt-row-pending:hover td,
.qt-row-pending:focus-within td {
    opacity: .95;
    background: #f1f5f9;
}
.qt-row-pending:has(.inputn-input:not(:placeholder-shown)) td,
.qt-row-pending:has(.form-control:not(:placeholder-shown)) td {
    opacity: 1;
}
.qt-row-pending:has(.inputn-input:not(:placeholder-shown)) .qt-khoan-name {
    color: #1e293b;
    font-weight: 600;
}

.qt-row-pending textarea {
   
}
/* ═══ Row đã có giá trị Thành tiền ≠ 0 — nổi bật hơn ═══ */
.qt-has-value td {
    background: #f0fdf4;
    border-bottom-color: #bbf7d0 !important;
}
.qt-money-panel-chi .qt-has-value td {
    background: #fff1f2;
    border-bottom-color: #fecdd3 !important;
}
.qt-has-value td:nth-child(3) input {
    color: #0f172a !important;
    font-weight: 700 !important;
}
.qt-has-value .qt-khoan-name {
    color: #0f172a;
    font-weight: 700;
}
.qt-has-value:hover td {
    background: #dcfce7;
}
.qt-money-panel-chi .qt-has-value:hover td {
    background: #ffe4e6;
}

/* ═══ Badge trạng thái Tạo mới / Cập nhật ═══ */
.qt-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -.01em;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    animation: qt-badge-in .3s ease both;
}
@keyframes qt-badge-in {
    from { opacity: 0; transform: scale(.9); }
    to   { opacity: 1; transform: scale(1); }
}
.qt-mode-badge i { font-size: 14px; }

.qt-mode-badge.is-new {
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    color: #1d4ed8;
    border: 1px solid #93c5fd;
    box-shadow: 0 2px 8px rgba(29, 78, 216, .12);
}
.qt-mode-badge.is-edit {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    color: #92400e;
    border: 1px solid #fcd34d;
    box-shadow: 0 2px 8px rgba(146, 64, 14, .10);
}

/* ═══ Row đã lưu trong CSDL ═══ */
.qt-row-saved td {
    transition: background .15s ease, border-color .15s ease;
}

/* Icon trạng thái trước tên khoản */
.qt-row-icon-saved {
    color: #22c55e;
    font-size: 10px !important;
    margin-right: 3px;
    flex-shrink: 0;
}
.qt-row-icon-changed {
    color: #f59e0b;
    font-size: 9px !important;
    margin-right: 3px;
    flex-shrink: 0;
    animation: qt-changed-pulse 1.5s ease-in-out infinite;
}
@keyframes qt-changed-pulse {
    0%, 100% { opacity: .6; }
    50% { opacity: 1; }
}

/* ═══ Row đã thay đổi so với CSDL ═══ */
.qt-row-changed td {
    background: #fffbeb !important;
    border-bottom-color: #fde68a !important;
}
.qt-row-changed:hover td {
    background: #fef3c7 !important;
}
.qt-row-changed .qt-khoan-name {
    color: #92400e !important;
    font-weight: 700 !important;
}
/* Viền trái amber cho row đã thay đổi */
.qt-row-changed td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

/* ═══ Row đã lưu + có giá trị — viền trái xanh nhẹ ═══ */
.qt-row-saved.qt-has-value td:first-child {
    box-shadow: inset 3px 0 0 #22c55e;
}
.qt-money-panel-chi .qt-row-saved.qt-has-value td:first-child {
    box-shadow: inset 3px 0 0 #ef4444;
}
/* Override: row changed luôn ưu tiên amber */
.qt-row-changed.qt-has-value td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b !important;
}
