:root {
    --bs-font-sans-serif: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bm-ink: #172033;
    --bm-muted: #64748b;
    --bm-border: rgba(148, 163, 184, 0.22);
    --bm-surface: rgba(255, 255, 255, 0.92);
    --bm-primary: #1d4ed8;
    --bm-primary-soft: rgba(29, 78, 216, 0.1);
    --bm-success: #047857;
    --bm-warning: #b45309;
    --bm-danger: #dc2626;
    --bm-shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 14px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
    font-family: var(--bs-body-font-family);
}

.auth-page {
    min-height: 100vh;
    margin-bottom: 0;
    background: linear-gradient(135deg, #eef4ff 0%, #f8fafc 45%, #e0f2fe 100%);
}

.auth-shell {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
}

.auth-logo {
    display: flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d6efd, #0ea5e9);
    color: #fff;
    font-size: 1.12rem;
    font-weight: 700;
}

.auth-submit {
    border-radius: 11px;
    font-weight: 700;
}

.auth-card .form-control {
    border-radius: 11px;
}

.admin-body {
    min-height: 100vh;
    margin-bottom: 0;
    background: radial-gradient(circle at 16% 8%, rgba(59, 130, 246, 0.12), transparent 28%), radial-gradient(circle at 88% 0%, rgba(20, 184, 166, 0.1), transparent 24%), linear-gradient(180deg, #f7faff 0%, #edf2f7 100%);
    color: var(--bm-ink);
}

.admin-layout {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    width: 220px;
    padding: 18px 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%), radial-gradient(circle at top left, rgba(59, 130, 246, 0.32), transparent 38%);
    color: #fff;
    box-shadow: 18px 0 50px rgba(15, 23, 42, 0.12);
}

.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1025;
    border: 0;
    background: rgba(15, 23, 42, 0.48);
}

.admin-brand {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    color: #fff;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
}

    .admin-brand:hover {
        color: #fff;
    }

.admin-menu {
    display: grid;
    gap: 5px;
    margin-top: 22px;
}

.admin-menu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #a8b3c7;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

    .admin-menu-link:hover,
    .admin-menu-link.active {
        border-color: rgba(147, 197, 253, 0.18);
        color: #fff;
        background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(14, 165, 233, 0.82));
        box-shadow: 0 16px 36px rgba(37, 99, 235, 0.22);
        transform: translateX(2px);
    }

.admin-menu-icon svg,
.admin-menu-icon i,
.admin-icon-button svg,
.admin-icon-button i {
    color: currentColor;
    fill: currentColor;
    font-size: inherit;
    line-height: 1;
}

.admin-panel {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    margin-left: 220px;
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.04);
}

.admin-header-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.admin-mobile-menu {
    display: none;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
}

    .admin-mobile-menu svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
    }

.admin-icon-button {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: #fff;
    color: #475569;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

    .admin-icon-button:hover,
    .admin-icon-button:focus {
        border-color: rgba(13, 110, 253, 0.42);
        color: #0d6efd;
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    }

.admin-notification {
    position: relative;
}

.admin-notification-toggle {
    position: relative;
}

.admin-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
}

.admin-notification-menu {
    width: min(360px, calc(100vw - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.admin-notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.admin-notification-item {
    display: block;
    padding: 12px 16px;
    color: #0f172a;
    text-decoration: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

    .admin-notification-item:hover,
    .admin-notification-item:focus {
        background: #f8fafc;
        color: #0d6efd;
    }

    .admin-notification-item span {
        display: block;
        font-weight: 700;
    }

    .admin-notification-item small {
        display: block;
        margin-top: 4px;
        color: #64748b;
        line-height: 1.35;
    }

    .admin-notification-item.unread {
        background: #eff6ff;
    }

.admin-notification-empty {
    padding: 18px 16px;
    color: #64748b;
    text-align: center;
}

.admin-main {
    flex: 1;
    padding: 18px;
}

.admin-page-title {
    margin-bottom: 4px;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.admin-page-subtitle {
    margin-bottom: 14px;
    color: #64748b;
}

.admin-dashboard-card {
    position: relative;
    overflow: hidden;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    box-shadow: var(--bm-shadow);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

    .admin-dashboard-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto;
        height: 4px;
        background: linear-gradient(90deg, #2563eb, #14b8a6);
        opacity: 0.78;
    }

    .admin-dashboard-card:hover {
        border-color: rgba(37, 99, 235, 0.28);
        box-shadow: 0 28px 70px rgba(15, 23, 42, 0.11);
        transform: translateY(-2px);
    }

.admin-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    color: #64748b;
    text-align: center;
    background: #fff;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.settings-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    background: #fff;
    color: #172033;
    text-decoration: none;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

    .settings-card:hover {
        border-color: rgba(13, 110, 253, 0.36);
        color: #172033;
        box-shadow: 0 22px 55px rgba(15, 23, 42, 0.1);
        transform: translateY(-2px);
    }

.settings-card-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

    .settings-card-icon svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
    }

.settings-card-title,
.settings-card-description {
    display: block;
}

.settings-card-title {
    font-size: 1rem;
    font-weight: 800;
}

.settings-card-description {
    color: #64748b;
    line-height: 1.5;
}

.settings-form-card {
    max-width: 560px;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

    .settings-form-card .form-control {
        border-radius: 11px;
    }

.misa-hero {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid rgba(147, 197, 253, 0.35);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.88)), radial-gradient(circle at 84% 18%, rgba(20, 184, 166, 0.18), transparent 34%);
    box-shadow: var(--bm-shadow);
}

    .misa-hero::after {
        content: "";
        position: absolute;
        right: -42px;
        bottom: -62px;
        width: 170px;
        height: 170px;
        border: 24px solid rgba(37, 99, 235, 0.06);
        border-radius: 50%;
    }

    .misa-hero > * {
        position: relative;
        z-index: 1;
    }

    .misa-hero .admin-page-subtitle {
        max-width: 780px;
        margin-bottom: 0;
    }

.misa-hero-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--bm-primary);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.misa-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.misa-summary-card {
    position: relative;
    overflow: hidden;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--bm-shadow);
}

    .misa-summary-card::after {
        content: "";
        position: absolute;
        right: -28px;
        bottom: -34px;
        width: 96px;
        height: 96px;
        border-radius: 50%;
        background: rgba(37, 99, 235, 0.08);
    }

    .misa-summary-card span {
        position: relative;
        z-index: 1;
        display: block;
        color: var(--bm-muted);
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

    .misa-summary-card strong {
        position: relative;
        z-index: 1;
        display: block;
        margin-top: 5px;
        color: var(--bm-primary);
        font-size: 1.65rem;
        font-weight: 900;
        line-height: 1;
    }

    .misa-summary-card.connected::after {
        background: rgba(4, 120, 87, 0.1);
    }

    .misa-summary-card.connected strong {
        color: var(--bm-success);
    }

    .misa-summary-card.pending::after {
        background: rgba(100, 116, 139, 0.1);
    }

    .misa-summary-card.pending strong {
        color: #475569;
    }

    .misa-summary-card.expired::after {
        background: rgba(180, 83, 9, 0.12);
    }

    .misa-summary-card.expired strong {
        color: var(--bm-warning);
    }

.misa-table-card {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--bm-shadow);
}

    .misa-table-card > .row {
        padding: 0 14px 14px;
    }

.misa-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.82));
}

    .misa-table-header h2 {
        margin: 0 0 4px;
        font-size: 0.95rem;
        font-weight: 800;
    }

    .misa-table-header p {
        margin: 0;
        color: #64748b;
    }

.misa-table {
    --bs-table-bg: transparent;
}

    .misa-table thead th {
        border-bottom: 1px solid rgba(148, 163, 184, 0.16);
        background: #f8fafc;
    }

    .misa-table th {
        padding: 9px 14px;
        color: var(--bm-muted);
        font-size: 0.68rem;
        font-weight: 900;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .misa-table td {
        padding: 10px 14px;
        border-color: rgba(148, 163, 184, 0.13);
    }

/* Giữ giá trị trong bảng sync trên một dòng, phần dài được rút gọn bằng dấu ba chấm. */
.misa-table-one-line {
    min-width: 1120px;
    table-layout: fixed;
}

    .misa-table-one-line th,
    .misa-table-one-line td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .misa-table-one-line .misa-company-name,
    .misa-table-one-line .misa-muted,
    .misa-table-one-line .misa-error-note {
        display: inline;
        max-width: none;
        margin-top: 0;
    }

        .misa-table-one-line .misa-company-name + .misa-muted::before,
        .misa-table-one-line .badge + .misa-error-note::before {
            content: " - ";
        }

    .misa-table-one-line .misa-tax-code,
    .misa-table-one-line .badge,
    .misa-table-one-line .btn {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
        white-space: nowrap;
    }

    .misa-table-one-line .misa-tax-code {
        display: inline-block;
    }

    .misa-table-one-line .misa-empty-state {
        white-space: normal;
    }

    /* Ô được đánh dấu cho phép hiển thị đầy đủ giá trị, xuống dòng khi dài. */
    .misa-table-one-line .misa-cell-wrap {
        white-space: normal;
        word-break: break-word;
    }

.misa-table tbody tr {
    transition: background-color 0.16s ease;
}

    .misa-table tbody tr:hover {
        background: rgba(239, 246, 255, 0.72);
    }

.misa-tax-code {
    display: inline-flex;
    padding: 4px 7px;
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 8px;
    background: #eff6ff;
    color: #1e40af;
    font-weight: 700;
    font-size: 13px;
}

.misa-company-name {
    font-weight: 700;
}

.misa-muted {
    margin-top: 3px;
    color: #64748b;
    font-size: 0.88rem;
}

.misa-error-note {
    max-width: 260px;
    margin-top: 6px;
    color: #dc3545;
    font-size: 0.78rem;
    line-height: 1.35;
}

.misa-empty-state {
    display: grid;
    gap: 6px;
    padding: 24px 16px;
    color: #64748b;
    text-align: center;
}

    .misa-empty-state strong {
        color: #172033;
    }

.misa-sync-nav {
    display: flex;
    align-items: flex-end;
    gap: 34px;
    min-height: 50px;
    margin: -19px -20px 18px;
    padding: 0 28px;
    border-bottom: 1px solid var(--bm-line);
    background: #fff;
    box-shadow: none;
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 60px;
    z-index: 1000;
}

    .misa-sync-nav::-webkit-scrollbar {
        display: none;
    }

.misa-sync-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 50px;
    color: #596884;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.18s ease;
}

    .misa-sync-tab:hover,
    .misa-sync-tab:focus {
        color: var(--bm-primary);
    }

    .misa-sync-tab.active {
        color: var(--bm-primary);
    }

        .misa-sync-tab.active::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 3px;
            border-radius: 3px 3px 0 0;
            background: var(--bm-primary);
        }

.misa-table-card .pagination {
    justify-content: flex-end;
    gap: 5px;
    padding: 0 14px 14px;
}

.misa-table-card .page-link {
    min-width: 30px;
    padding: 5px 9px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 9px !important;
    background: #fff;
    color: #475569;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

    .misa-table-card .page-link:hover,
    .misa-table-card .page-link:focus {
        border-color: rgba(37, 99, 235, 0.28);
        background: #eff6ff;
        color: var(--bm-primary);
        box-shadow: 0 12px 26px rgba(37, 99, 235, 0.12);
        transform: translateY(-1px);
    }

.misa-table-card .page-item.active .page-link {
    border-color: transparent;
    background: linear-gradient(135deg, #2563eb, #0891b2);
    color: #fff;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.2);
}

.misa-table-card .page-item.disabled .page-link {
    border-color: rgba(148, 163, 184, 0.14);
    background: #f8fafc;
    color: #94a3b8;
    box-shadow: none;
    transform: none;
}

/* UI nhật ký đồng bộ theo mẫu thiết kế, giữ nguyên filter và phân trang server-side. */
.history-panel {
    overflow: hidden;
}

.history-filter-panel {
    margin-bottom: 14px;
}

.history-panel-header {
    display: flex;
    min-height: 86px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid #eff3f8;
}

.history-panel-title {
    margin: 0;
    color: #0b1738;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.25px;
}

.history-panel-subtitle {
    margin: 5px 0 0;
    color: #61718e;
    font-size: 13px;
}

.history-refresh-btn,
.history-filter-btn,
.history-reset-btn,
.history-detail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    transition: 0.15s ease;
}

.history-refresh-btn {
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid var(--bm-blue);
    background: linear-gradient(180deg, #0d6ff1, #075cdf);
    color: #fff;
    box-shadow: 0 4px 11px rgba(8, 102, 239, 0.18);
}

    .history-refresh-btn:hover {
        color: #fff;
        background: #0758d9;
        transform: translateY(-1px);
    }

.history-filter-zone {
    padding: 16px 22px 20px;
}

.history-filter-label {
    display: block;
    margin-bottom: 6px;
    color: #0b1738;
    font-size: 13px;
    font-weight: 750;
}

.history-filter-control {
    height: 35px;
    border-color: #d5deeb;
    border-radius: 6px;
    color: #263755;
    background-color: #fff;
    font-size: 13px;
    box-shadow: none !important;
}

    .history-filter-control:focus {
        border-color: #7bacff;
    }

.history-filter-actions {
    display: flex;
    align-items: center;
    gap: 11px;
}

.history-filter-btn,
.history-reset-btn {
    min-height: 35px;
    padding: 0 15px;
}

.history-filter-btn {
    border: 1px solid var(--bm-blue);
    background: var(--bm-blue);
    color: #fff;
}

    .history-filter-btn:hover {
        border-color: var(--bm-blue-dark);
        background: var(--bm-blue-dark);
        color: #fff;
    }

.history-reset-btn {
    border: 1px solid #d7e0ed;
    background: #fff;
    color: #172746;
    text-decoration: none;
}

    .history-reset-btn:hover {
        border-color: #b9c9df;
        background: #f9fbfe;
        color: #172746;
    }

.history-log-panel {
    margin-top: 22px;
}

.history-table-shell {
    overflow-x: auto;
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.history-table {
    min-width: 1210px;
    margin: 0;
    color: var(--bm-ink);
    vertical-align: middle;
    table-layout: fixed;
}

    .history-table thead th {
        height: 48px;
        padding: 0 14px;
        border-bottom: 1px solid var(--bm-border);
        color: #52627f;
        background: #f6f9fd;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .history-table tbody td {
        height: 70px;
        padding: 10px 14px;
        border-color: #e6ecf4;
        font-size: 13px;
        white-space: nowrap;
    }

    .history-table tbody tr:nth-child(even) td {
        background: #fcfdff;
    }

    .history-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .history-table tbody tr:hover td {
        background: #f4f8ff;
    }

.history-col-time {
    width: 190px;
}

.history-col-type {
    width: 145px;
}

.history-col-tax {
    width: 128px;
}

.history-col-tenant {
    width: 118px;
}

.history-col-status {
    width: 170px;
}

.history-col-number {
    width: 82px;
    text-align: center;
}

.history-col-runner {
    width: 125px;
}

.history-col-action {
    width: 116px;
    text-align: right;
}

.history-run-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.history-run-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 50%;
    color: #075ef4;
    background: #eaf3ff;
    font-size: 16px;
}

.history-date {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.12px;
}

.history-time {
    margin-top: 4px;
    color: #5b7299;
    font-size: 12px;
}

.history-type-chip,
.history-tenant-chip,
.history-runner {
    display: inline-flex;
    max-width: 100%;
    min-height: 28px;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-type-chip {
    padding: 0 9px;
    border-radius: 999px;
    color: #263755;
    background: #eef4fc;
    font-size: 12px;
    font-weight: 750;
}

.history-tenant-chip {
    padding: 0 8px;
    border: 1px solid #dce5f1;
    border-radius: 6px;
    color: #405373;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
}

.history-runner {
    color: #31425f;
    font-weight: 700;
}

.history-tax-code {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 7px;
    border: 1px solid #bcd9ff;
    border-radius: 5px;
    color: #0561e9;
    background: #eaf4ff;
    font-weight: 800;
    letter-spacing: 0.15px;
}

.history-status-badge {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

    .history-status-badge::before {
        width: 7px;
        height: 7px;
        content: "";
        border-radius: 50%;
    }

.history-status-success {
    color: #087a5b;
    background: #d9f4ec;
}

    .history-status-success::before {
        background: #0aa77d;
    }

.history-status-warning {
    color: #9a6105;
    background: #ffecc8;
}

    .history-status-warning::before {
        background: #f0a000;
    }

.history-status-error {
    color: #d82340;
    background: #ffe1e7;
}

    .history-status-error::before {
        background: #f51f49;
    }

.history-status-info {
    color: #0b6fd8;
    background: #ddecff;
}

    .history-status-info::before {
        background: #0b6fd8;
    }

.history-status-muted {
    color: #52627a;
    background: #eef2f7;
}

    .history-status-muted::before {
        background: #74839a;
    }

.history-success-number {
    color: #008d60 !important;
}

.history-error-number {
    color: #ee0b25 !important;
}

.history-error-note {
    max-width: 155px;
    margin-top: 6px;
    overflow: hidden;
    color: #dc3545;
    font-size: 0.78rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-count-pill {
    display: inline-flex;
    min-width: 42px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border-radius: 999px;
    color: #243856;
    background: #eef3f9;
    font-weight: 800;
}

    .history-count-pill.success {
        color: #087a5b;
        background: #dff6ee;
    }

    .history-count-pill.error {
        color: #d82340;
        background: #ffe5eb;
    }

    .history-count-pill.muted {
        color: #60718a;
        background: #edf1f6;
    }

.history-empty-state {
    padding: 24px 16px;
}

.history-detail-btn {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid #7cafec;
    border-radius: 999px;
    color: #075cf0;
    background: #fff;
    font-size: 12px;
    text-decoration: none;
}

    .history-detail-btn:hover,
    .history-detail-btn:focus {
        color: #fff;
        background: var(--bm-blue);
        border-color: var(--bm-blue);
    }

.history-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 22px;
    border-top: 1px solid var(--bm-border);
    color: #5a7194;
    background: #fff;
    font-size: 13px;
}

.history-pager-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
}

.history-pager {
    display: flex;
    align-items: center;
    gap: 9px;
}

.history-page-btn {
    display: grid;
    width: 33px;
    height: 33px;
    place-items: center;
    border: 1px solid #d6dfec;
    border-radius: 5px;
    color: #172746;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

    .history-page-btn:hover {
        border-color: #8bb3f6;
        color: var(--bm-blue);
    }

    .history-page-btn.active {
        border-color: var(--bm-blue);
        color: #fff;
        background: var(--bm-blue);
    }

    .history-page-btn.disabled {
        border-color: #e0e7f1;
        color: #8ca0bd;
        background: #fbfcfe;
    }

.history-pager-separator {
    width: 1px;
    height: 33px;
    background: #e1e7f0;
}

.history-page-size-form {
    display: flex;
    align-items: center;
}

.history-per-page {
    height: 33px;
    padding: 0 29px 0 12px;
    border: 1px solid #d6dfec;
    border-radius: 5px;
    color: #172746;
    background-color: #fff;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 780px) {
    .history-panel-header,
    .history-table-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-filter-zone {
        padding: 14px 16px 16px;
    }

    .history-table-footer {
        padding: 14px 16px;
    }
}

@media (max-width: 575.98px) {
    .history-panel-header {
        min-height: 0;
    }

    .history-panel-title {
        font-size: 18px;
    }

    .history-pager-wrap {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }
}

/* UI chi tiết nhật ký đồng bộ theo mẫu, giữ filter và paging server-side. */
.run-detail-panel {
    overflow: hidden;
    border-radius: 11px;
    box-shadow: 0 6px 20px rgba(19, 49, 91, 0.035);
}

.run-detail-mb-panel {
    margin-bottom: 10px;
}

.run-detail-heading {
    display: flex;
    min-height: 94px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--bm-border);
}

.run-detail-page-title {
    margin: 0 0 5px;
    color: var(--bm-ink);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.35px;
}

.run-detail-page-subtitle {
    margin: 0;
    color: #5c7194;
    font-size: 13px;
}

.run-detail-btn-white,
.run-detail-btn-blue {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 13px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: 0.15s ease;
}

.run-detail-btn-white {
    border: 1px solid #d6dfeb;
    background: #fff;
    color: #172746;
}

    .run-detail-btn-white:hover,
    .run-detail-btn-white:focus {
        border-color: #b8c8df;
        background: #f9fbfe;
        color: #172746;
    }

.run-detail-btn-blue {
    border: 1px solid var(--bm-blue);
    background: var(--bm-blue);
    color: #fff;
    box-shadow: 0 5px 10px rgba(7, 94, 244, 0.14);
}

    .run-detail-btn-blue:hover,
    .run-detail-btn-blue:focus {
        border-color: var(--bm-blue-dark);
        background: var(--bm-blue-dark);
        color: #fff;
    }

.run-detail-summary-zone {
    padding: 15px;
}

.run-detail-summary-card {
    display: flex;
    min-height: 102px;
    align-items: center;
    gap: 18px;
    padding: 14px 17px;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    background: #fff;
}

.run-detail-summary-icon {
    display: grid;
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    place-items: center;
    border-radius: 50%;
    font-size: 27px;
}

.run-detail-icon-total {
    background: #dfebff;
    color: #0864f0;
}

.run-detail-icon-success {
    background: #d9f4eb;
    color: #009d6c;
}

.run-detail-icon-error {
    background: #ffe0e6;
    color: #ef193d;
}

.run-detail-icon-skip {
    background: #eef2f8;
    color: #8797af;
}

.run-detail-summary-label {
    margin-bottom: 6px;
    color: #172746;
    font-size: 12px;
    font-weight: 700;
}

.run-detail-summary-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #075ef4;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

    .run-detail-summary-value.success {
        color: #008c5d;
    }

    .run-detail-summary-value.error {
        color: #ee1437;
    }

    .run-detail-summary-value.skip {
        color: #556987;
    }

.run-detail-summary-rate {
    font-size: 15px;
    letter-spacing: 0;
}

.run-detail-middle-row {
    margin-bottom: 10px;
}

.run-detail-subpanel {
    height: 100%;
}

.run-detail-section-title {
    margin: 0;
    padding: 17px 18px 9px;
    color: var(--bm-ink);
    font-size: 14px;
    font-weight: 800;
}

.run-detail-info {
    padding: 11px 20px 14px;
}

.run-detail-grid {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) 112px minmax(0, 1.2fr);
    gap: 13px 17px;
    font-size: 12px;
}

.run-detail-info-label {
    color: #587094;
}

.run-detail-info-value {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--bm-ink);
    font-weight: 500;
}

.run-detail-link-chip {
    display: inline-flex;
    min-height: 21px;
    align-items: center;
    max-width: 100%;
    padding: 0 6px;
    border: 1px solid #bcd9ff;
    border-radius: 4px;
    background: #eaf4ff;
    color: #0561e9;
    font-weight: 800;
    letter-spacing: 0.12px;
}

.run-detail-status-badge {
    display: inline-flex;
    min-height: 19px;
    align-items: center;
    gap: 5px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

    .run-detail-status-badge::before {
        width: 7px;
        height: 7px;
        content: "";
        border-radius: 50%;
    }

.run-detail-status-success {
    background: #d9f4ec;
    color: #087a5b;
}

    .run-detail-status-success::before {
        background: #0aa77d;
    }

.run-detail-status-warning {
    background: #ffecc8;
    color: #9a6105;
}

    .run-detail-status-warning::before {
        background: #f0a000;
    }

.run-detail-status-error {
    background: #ffe1e7;
    color: #d82340;
}

    .run-detail-status-error::before {
        background: #f51f49;
    }

.run-detail-status-info {
    background: #ddecff;
    color: #0b6fd8;
}

    .run-detail-status-info::before {
        background: #0b6fd8;
    }

.run-detail-status-skip {
    background: #edf1f6;
    color: #65758e;
}

    .run-detail-status-skip::before {
        background: #7d8ca1;
    }

.run-detail-error-text {
    color: #d82340;
}

.run-detail-filter-zone {
    padding: 11px 17px 17px;
}

.run-detail-filter-label {
    display: block;
    margin-bottom: 6px;
    color: #172746;
    font-size: 12px;
    font-weight: 750;
}

.run-detail-filter-control {
    height: 34px;
    border-color: #d5deeb;
    border-radius: 5px;
    background-color: #fff;
    color: #263755;
    font-size: 12px;
    box-shadow: none !important;
}

    .run-detail-filter-control:focus {
        border-color: #7bacff;
    }

.run-detail-keyword-row {
    display: flex;
    align-items: end;
    gap: 11px;
}

.run-detail-keyword-field {
    min-width: 0;
    flex: 1 1 auto;
}

.run-detail-filter-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 11px;
}

.run-detail-records-panel {
    margin-bottom: 0;
}

.run-detail-records-header {
    display: flex;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--bm-border);
}

    .run-detail-records-header .run-detail-section-title {
        padding: 0;
    }

.run-detail-records-subtitle {
    margin: 4px 0 0;
    color: #5c7194;
    font-size: 12px;
}

.run-detail-table-shell {
    overflow-x: auto;
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.run-detail-records-table {
    min-width: 1360px;
    margin: 0;
    color: var(--bm-ink);
    vertical-align: middle;
    table-layout: fixed;
}

    .run-detail-records-table thead th {
        height: 48px;
        padding: 0 12px;
        border-bottom: 1px solid var(--bm-border);
        background: #f6f9fd;
        color: #536587;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .run-detail-records-table tbody td {
        height: 62px;
        padding: 9px 12px;
        border-color: #e6ecf4;
        font-size: 12px;
        white-space: nowrap;
    }

    .run-detail-records-table tbody tr:nth-child(even) td {
        background: #fcfdff;
    }

    .run-detail-records-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .run-detail-records-table tbody tr:hover td {
        background: #f4f8ff;
    }

.run-detail-col-stt {
    width: 56px;
}

.run-detail-col-table {
    width: 132px;
}

.run-detail-col-bizid {
    width: 145px;
}

.run-detail-col-name {
    width: 240px;
}

.run-detail-col-misa {
    width: 155px;
}

.run-detail-col-operation {
    width: 118px;
}

.run-detail-col-state {
    width: 140px;
}

.run-detail-col-error {
    width: 230px;
}

.run-detail-col-time {
    width: 144px;
}

.run-detail-index {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    color: #50617f;
    background: #eef3f9;
    font-size: 11px;
    font-weight: 800;
}

.run-detail-table-chip,
.run-detail-code-chip,
.run-detail-misa-id,
.run-detail-empty-chip {
    display: inline-flex;
    max-width: 100%;
    min-height: 28px;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-detail-table-chip {
    padding: 0 9px;
    border-radius: 999px;
    color: #263755;
    background: #eef4fc;
    font-size: 12px;
    font-weight: 800;
}

.run-detail-code-chip,
.run-detail-misa-id {
    padding: 0 8px;
    border: 1px solid #bcd9ff;
    border-radius: 6px;
    color: #0561e9;
    background: #eaf4ff;
    font-size: 12px;
    font-weight: 800;
}

.run-detail-empty-chip {
    padding: 0 8px;
    border-radius: 999px;
    color: #738197;
    background: #edf1f6;
    font-size: 12px;
    font-weight: 700;
}

.run-detail-record-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

    .run-detail-record-cell > div {
        min-width: 0;
    }

.run-detail-record-icon {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border-radius: 50%;
    color: #075ef4;
    background: #eaf3ff;
    font-size: 15px;
}

.run-detail-record-name,
.run-detail-misa-id {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-detail-misa-id {
    display: inline-flex;
}

.run-detail-muted {
    color: #667896;
}

.run-detail-operation {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    gap: 7px;
    padding: 0 9px;
    border-radius: 999px;
    color: #087a5b;
    background: #dff6ee;
    font-weight: 800;
}

    .run-detail-operation.skip {
        color: #708099;
        background: #edf1f6;
    }

    .run-detail-operation i {
        font-size: 13px;
    }

.run-detail-error-cell {
    white-space: normal !important;
}

.run-detail-error-note {
    max-width: 210px;
    overflow: hidden;
    color: #d82340;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.run-detail-date-cell {
    display: grid;
    gap: 4px;
}

.run-detail-date {
    color: #243856;
    font-weight: 800;
}

.run-detail-time {
    color: #667896;
    font-size: 11px;
}

.run-detail-empty-state {
    padding: 24px 16px;
}

.run-detail-table-footer {
    display: flex;
    min-height: 61px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 20px;
    border-top: 1px solid var(--bm-border);
    background: #fff;
    color: #5a7194;
    font-size: 13px;
}

.run-detail-pager-wrap {
    display: flex;
    align-items: center;
    gap: 15px;
}

.run-detail-pager {
    display: flex;
    align-items: center;
    gap: 10px;
}

.run-detail-page-size-form {
    display: flex;
    align-items: center;
}

.run-detail-page-btn {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid #d6dfec;
    border-radius: 5px;
    background: #fff;
    color: #172746;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

    .run-detail-page-btn:hover,
    .run-detail-page-btn:focus {
        border-color: #8bb3f6;
        color: var(--bm-blue);
    }

    .run-detail-page-btn.active {
        border-color: var(--bm-blue);
        background: var(--bm-blue);
        color: #fff;
    }

    .run-detail-page-btn.disabled {
        border-color: #d6dfec;
        background: #fbfcfe;
        color: #8ca0bd;
    }

.run-detail-per-page {
    height: 34px;
    padding: 0 29px 0 12px;
    border: 1px solid #d6dfec;
    border-radius: 5px;
    background-color: #fff;
    color: #172746;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .run-detail-grid {
        grid-template-columns: 120px minmax(0, 1fr) 100px minmax(0, 1fr);
    }

    .run-detail-keyword-row {
        flex-wrap: wrap;
    }

    .run-detail-keyword-field {
        flex-basis: 100%;
    }
}

@media (max-width: 992px) {
    .run-detail-heading {
        padding: 16px;
    }

    .run-detail-summary-zone {
        padding: 12px;
    }

    .run-detail-records-header {
        padding: 11px 15px;
    }

    .run-detail-table-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px;
    }
}

@media (max-width: 576px) {
    .run-detail-heading {
        min-height: 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .run-detail-page-title {
        font-size: 18px;
    }

    .run-detail-summary-card {
        min-height: 90px;
    }

    .run-detail-summary-icon {
        width: 53px;
        height: 53px;
        flex-basis: 53px;
    }

    .run-detail-summary-value {
        font-size: 24px;
    }

    .run-detail-grid {
        grid-template-columns: 108px minmax(0, 1fr);
        gap: 11px 12px;
    }

    .run-detail-keyword-row {
        align-items: stretch;
    }

    .run-detail-filter-actions {
        width: 100%;
    }

        .run-detail-filter-actions .run-detail-btn-blue,
        .run-detail-filter-actions .run-detail-btn-white {
            flex: 1 1 0;
        }

    .run-detail-pager-wrap {
        width: 100%;
        flex-wrap: wrap;
    }

    .run-detail-pager {
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }
}

.badge.text-bg-success {
    background: rgba(4, 120, 87, 0.12) !important;
    color: #047857 !important;
}

.badge.text-bg-secondary {
    background: rgba(100, 116, 139, 0.13) !important;
    color: #475569 !important;
}

.badge.text-bg-warning {
    background: rgba(180, 83, 9, 0.14) !important;
    color: #92400e !important;
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, #2563eb, #0891b2);
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-secondary {
    font-weight: 800;
}

    .btn-outline-primary:hover,
    .btn-outline-success:hover {
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    }

.misa-modal {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
}

    .misa-modal .modal-header,
    .misa-modal .modal-footer {
        border-color: rgba(148, 163, 184, 0.18);
    }

.misa-modal-subtitle {
    color: #64748b;
    font-size: 0.92rem;
}

.misa-selected-tax {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px dashed rgba(13, 110, 253, 0.28);
    border-radius: 12px;
    background: rgba(13, 110, 253, 0.06);
}

    .misa-selected-tax span {
        color: #64748b;
        font-size: 0.82rem;
        font-weight: 700;
    }

    .misa-selected-tax strong {
        color: #0d6efd;
        font-size: 1rem;
    }

    .misa-selected-tax small {
        color: #475569;
    }

.logout-modal .modal-content {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.logout-modal .modal-body {
    padding: 22px;
}

.logout-modal-icon {
    display: flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

    .logout-modal-icon svg,
    .logout-modal-icon i {
        width: 24px;
        height: 24px;
        color: currentColor;
        fill: currentColor;
        font-size: 24px;
        line-height: 1;
    }

.text-bg-info {
    color: #000000b0 !important;
    background-color: #0dcaf0 !important;
}

.text-bg-danger {
    color: #ffffffcc !important;
    background-color: #dc3545 !important;
}

@media (max-width: 991.98px) {
    .admin-body.sidebar-open {
        overflow: hidden;
    }

    .admin-sidebar {
        width: min(82vw, 320px);
        transform: translateX(-105%);
        box-shadow: 22px 0 50px rgba(15, 23, 42, 0.26);
        transition: transform 0.22s ease;
    }

    .admin-body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-body.sidebar-open .admin-sidebar-backdrop {
        display: block;
    }

    .admin-panel {
        margin-left: 0;
    }

    .admin-header {
        min-height: 52px;
        padding: 0 12px;
    }

    .admin-mobile-menu {
        display: inline-flex;
    }

    .admin-header-actions {
        gap: 5px;
    }

    .admin-icon-button,
    .admin-mobile-menu {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .admin-main {
        padding: 14px 10px;
    }

    .admin-page-title {
        font-size: 1.25rem;
    }

    .admin-page-subtitle {
        margin-bottom: 12px;
    }

    .settings-grid,
    .misa-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .misa-hero {
        flex-direction: column;
        padding: 14px;
    }

    .settings-form-card,
    .admin-dashboard-card,
    .settings-card {
        border-radius: 14px;
    }
}

@media (max-width: 575.98px) {
    .auth-shell {
        padding: 12px;
    }

    .auth-card {
        padding: 20px 14px;
        border-radius: 16px;
    }

    .admin-sidebar {
        width: min(88vw, 260px);
        padding: 14px 10px;
    }

    .admin-brand {
        min-height: 36px;
        font-size: 1rem;
    }

    .admin-menu {
        gap: 4px;
        margin-top: 18px;
    }

    .admin-menu-link {
        padding: 9px;
        border-radius: 9px;
    }

    .admin-header {
        gap: 10px;
    }

    .admin-header-actions {
        margin-left: auto;
    }

    .admin-main {
        padding: 12px 8px;
    }

    .admin-dashboard-card,
    .settings-card,
    .settings-form-card {
        padding: 14px !important;
    }

    .settings-card {
        gap: 8px;
    }

    .settings-card-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .misa-summary-grid {
        grid-template-columns: 1fr;
    }

    .misa-table-card > .row {
        padding: 0 10px 10px;
    }

    .misa-table-header,
    .misa-table th,
    .misa-table td {
        padding-left: 10px;
        padding-right: 10px;
    }

    .misa-table-card .pagination {
        justify-content: center;
        padding: 0 10px 10px;
    }

    .misa-table-card .page-link {
        min-width: 28px;
        padding: 5px 8px;
    }

    .settings-form-card .btn {
        width: 100%;
    }

    .admin-footer {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
}

/* Giao diện kết nối MISA theo mẫu thiết kế mới, giữ nguyên luồng xử lý hiện có. */
:root {
    --bs-font-sans-serif: Inter, 'Segoe UI', Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bm-blue: #0866ef;
    --bm-blue-dark: #0758d9;
    --bm-navy: #061a35;
    --bm-ink: #07162f;
    --bm-muted: #57708f;
    --bm-border: #dce5f2;
    --bm-page: #f5f8fc;
    --bm-primary: var(--bm-blue);
    --bm-primary-soft: rgba(8, 102, 239, 0.1);
    --bm-success: #059669;
    --bm-warning: #ec7508;
    --bm-danger: #dc2626;
    --bm-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.admin-body {
    min-height: 100vh;
    margin-bottom: 0;
    background: var(--bm-page);
    color: var(--bm-ink);
    font-size: 14px;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    width: 206px;
    padding: 18px 12px 14px;
    color: #fff;
    background: radial-gradient(circle at 75% 45%, #0a2a58 0%, rgba(10, 42, 88, 0.3) 22%, rgba(10, 42, 88, 0) 52%), linear-gradient(180deg, #061a37 0%, #031229 100%);
    box-shadow: 4px 0 16px rgba(5, 24, 55, 0.08);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: auto;
    padding: 4px 10px 12px;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    text-decoration: none;
}

    .admin-brand:hover {
        color: #fff;
    }

.admin-brand-mark {
    position: relative;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
}

    .admin-brand-mark::before,
    .admin-brand-mark::after {
        content: '';
        position: absolute;
        border-radius: 2px;
        background: #1471fa;
    }

    .admin-brand-mark::before {
        width: 15px;
        height: 22px;
        left: 2px;
        top: 1px;
        clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%, 0 100%);
    }

    .admin-brand-mark::after {
        width: 20px;
        height: 10px;
        left: 7px;
        top: 13px;
        border: 4px solid #1471fa;
        border-left-width: 6px;
        background: transparent;
    }

.admin-menu {
    display: grid;
    gap: 0;
    margin-top: 0;
}

.admin-menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    margin: 3px 0;
    border: 0;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.88);
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s ease;
}

    .admin-menu-link:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.07);
        box-shadow: none;
        transform: none;
    }

    .admin-menu-link.active {
        color: #fff;
        background: linear-gradient(180deg, #0d68fa, #0756dc);
        box-shadow: 0 9px 16px rgba(0, 75, 210, 0.32);
        transform: none;
    }

.admin-menu-icon {
    display: inline-flex;
    width: 19px;
    height: 19px;
    justify-content: center;
    align-items: center;
}

.admin-menu-text {
    flex: 1;
}

.admin-menu-group {
    display: grid;
    gap: 0;
}

.admin-menu-toggle {
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.admin-menu-caret {
    margin-left: auto;
    font-size: 13px;
    opacity: 0.75;
    transition: transform 0.18s ease;
}

.admin-menu-group.open .admin-menu-caret {
    transform: rotate(180deg);
}

.admin-submenu {
    display: none;
    position: relative;
    gap: 0;
    margin: 8px 0 14px 14px;
    padding-left: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-menu-group.open .admin-submenu {
    display: grid;
}

.admin-submenu-link {
    position: relative;
    padding: 11px 9px 11px 22px;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s ease;
}

    .admin-submenu-link::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 6px;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: rgba(149, 174, 215, 0.45);
        transform: translateY(-50%);
    }

    .admin-submenu-link:hover,
    .admin-submenu-link:focus {
        color: #fff;
        background: rgba(255, 255, 255, 0.07);
    }

    .admin-submenu-link.active {
        color: #fff;
        background: rgba(255, 255, 255, 0.06);
        box-shadow: none;
    }

        .admin-submenu-link.active::before {
            width: 8px;
            height: 8px;
            background: #1977ff;
        }

.admin-menu-icon svg,
.admin-menu-icon i,
.admin-icon-button svg,
.admin-icon-button i,
.admin-mobile-menu svg,
.admin-mobile-menu i {
    color: currentColor;
    fill: currentColor;
    font-size: 18px;
    line-height: 1;
}

.admin-sidebar-user {
    position: absolute;
    right: 14px;
    bottom: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 17px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    background: #0c67f5;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.admin-user-name {
    font-size: 14px;
    font-weight: 700;
}

.admin-user-tenant {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.admin-user-chevron {
    margin-left: auto;
    font-size: 13px;
}

.admin-panel {
    display: flex;
    min-height: 100vh;
    flex: 1;
    flex-direction: column;
    margin-left: 206px;
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    min-height: 60px;
    height: 60px;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--bm-border);
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
}

.admin-header-left {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.admin-header-title {
    min-width: 0;
    overflow: hidden;
    color: #0b1738;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.admin-main {
    flex: 1;
    padding: 19px 20px 0;
}

.admin-icon-button,
.admin-mobile-menu {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #10294c;
    font-size: 19px;
    line-height: 1;
    text-decoration: none;
}

.admin-mobile-menu {
    display: none;
}

    .admin-icon-button:hover,
    .admin-icon-button:focus,
    .admin-mobile-menu:hover,
    .admin-mobile-menu:focus {
        color: var(--bm-blue-dark);
        box-shadow: none;
    }

.admin-footer {
    display: flex;
    min-height: 77px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-top: 0;
    background: transparent;
    color: #6a7f9c;
    font-size: 14px;
}

.admin-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    min-width: 17px;
    height: 17px;
    place-items: center;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #d9232e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.app-icon {
    display: inline-flex;
    width: 1em;
    height: 1em;
    align-items: center;
    justify-content: center;
    font-style: normal;
    line-height: 1;
}

.app-icon-plus::before {
    content: '+';
    font-weight: 800;
}

.app-icon-link::before {
    content: '↔';
    font-weight: 800;
}

.app-icon-refresh::before {
    content: '↻';
    font-weight: 800;
}

.app-icon-check::before {
    content: '✓';
    font-weight: 800;
}

.app-icon-clock::before {
    content: '◷';
    font-weight: 800;
}

.app-icon-warning::before {
    content: '!';
    font-weight: 900;
}

.app-icon-search::before {
    content: '⌕';
    font-weight: 800;
}

.app-icon-filter::before {
    content: '⏷';
    font-weight: 800;
    transform: rotate(90deg);
}

.app-icon-building::before {
    content: '▦';
    font-weight: 800;
}

.panel {
    background: #fff;
    border: 1px solid #e7edf6;
    border-radius: 15px;
    box-shadow: var(--bm-shadow);
}

.overview {
    margin-bottom: 16px;
}

.overview-header {
    display: flex;
    min-height: 108px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 26px 25px 19px;
    border-bottom: 1px solid #e7edf6;
}

    .overview-header h1 {
        margin: 0;
        font-size: 23px;
        font-weight: 760;
        letter-spacing: -0.3px;
    }

.subtitle {
    margin: 8px 0 0;
    color: var(--bm-muted);
    font-size: 15px;
}

.btn-primary-app {
    display: inline-flex;
    min-height: 41px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 15px;
    border: 1px solid var(--bm-blue);
    border-radius: 7px;
    background: linear-gradient(180deg, #0d6ff1, #075cdf);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 11px rgba(8, 102, 239, 0.18);
    transition: 0.15s ease;
}

    .btn-primary-app:hover {
        color: #fff;
        background: #0758d9;
        transform: translateY(-1px);
    }

    .btn-primary-app:disabled {
        opacity: 0.65;
        transform: none;
    }

.btn-outline-app {
    display: inline-flex;
    min-height: 41px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid #ccd8e6;
    border-radius: 6px;
    background: #fff;
    color: #0b203e;
    font-weight: 700;
    transition: 0.15s ease;
}

    .btn-outline-app:hover {
        border-color: #8caee1;
        background: #f8fbff;
        color: #075bdc;
    }

.stats-wrap {
    padding: 21px 20px 22px;
}

.stat-card {
    display: flex;
    min-height: 105px;
    align-items: center;
    gap: 21px;
    padding: 19px 22px;
    border: 1px solid var(--bm-border);
    border-radius: 12px;
    background: #fff;
}

.stat-icon {
    display: grid;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    place-items: center;
    border-radius: 50%;
    font-size: 29px;
}

.icon-blue {
    background: #e8f0ff;
    color: #0a68f4;
}

.icon-green {
    background: #e5f7ef;
    color: #059669;
}

.icon-gray {
    background: #eef2f7;
    color: #63748e;
}

.icon-orange {
    background: #fff1e4;
    color: #e96e00;
}

.stat-label {
    color: #3e5675;
    font-size: 14px;
    font-weight: 700;
}

.stat-value {
    margin-top: 9px;
    font-size: 27px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.4px;
}

.text-blue {
    color: #0a64e8;
}

.text-success-app {
    color: #00966e;
}

.text-orange {
    color: #e36d00;
}

.list-panel {
    padding: 0 23px 18px;
}

.misa-index-page,
.misa-index-page .table,
.misa-index-page .form-control,
.misa-index-page .form-label,
.misa-index-page .form-hint,
.misa-index-page .btn,
.misa-index-page .badge,
.misa-index-page .misa-tax-code,
.misa-index-page .misa-muted,
.misa-index-page .misa-error-note,
.misa-index-page .table-footer {
    font-size: 13px;
}

    .misa-index-page .misa-table td {
        height: auto;
    }

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px 0;
}

.list-title {
    margin: 0;
    font-size: 17px;
    font-weight: 760;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-control {
    position: relative;
    width: 276px;
}

    .search-control .app-icon {
        position: absolute;
        left: 13px;
        top: 50%;
        color: #647995;
        font-size: 17px;
        transform: translateY(-50%);
    }

    .search-control input {
        height: 41px;
        padding-left: 36px;
        border-color: #cfdae8;
        border-radius: 6px;
        color: #263a59;
    }

        .search-control input::placeholder {
            color: #6b7e98;
        }

.connection-table {
    margin-bottom: 0;
    vertical-align: middle;
}

    .connection-table thead th {
        height: 48px;
        border-bottom: 1px solid #cdd8e6;
        background: linear-gradient(180deg, #fbfcfe, #f6f8fb);
        color: #516887;
        font-size: 13px;
        font-weight: 760;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .connection-table tbody td {
        height: 111px;
        min-height: 111px;
        border-bottom: 1px solid #dde6f0;
        color: #081730;
        font-size: 15px;
        vertical-align: middle;
    }

    .connection-table tbody tr:hover {
        background: #fbfdff;
    }

.company {
    max-width: 340px;
    line-height: 1.55;
}

.mst {
    font-weight: 780;
    letter-spacing: 0.1px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

    .status-badge::before {
        content: '';
        width: 9px;
        height: 9px;
        border-radius: 50%;
    }

.status-connected {
    background: #dff5eb;
    color: #087a55;
}

    .status-connected::before {
        background: #0aa170;
    }

.status-disconnected {
    background: #f0f3f7;
    color: #243753;
}

    .status-disconnected::before {
        background: #9cacbe;
    }

.status-expired {
    background: #fff1e4;
    color: #e36d00;
}

    .status-expired::before {
        background: #e96e00;
    }

.expire {
    line-height: 1.65;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.btn-row {
    display: inline-flex;
    height: 39px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border: 1px solid #4f91ff;
    border-radius: 6px;
    background: #fff;
    color: #075fdc;
    font-weight: 700;
    white-space: nowrap;
}

    .btn-row:hover {
        background: #f2f7ff;
    }

    .btn-row:disabled {
        opacity: 0.65;
    }

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: #536d8f;
    margin-top: 16px;
}

.filter-box {
    width: 300px;
    padding: 15px;
    border: 1px solid #dce6f2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}

.misa-error-note {
    max-width: 260px;
    margin-top: 6px;
    color: #dc3545;
    font-size: 0.78rem;
    line-height: 1.35;
}

.misa-empty-state {
    display: grid;
    gap: 6px;
    padding: 24px 16px;
    color: #64748b;
    text-align: center;
}

    .misa-empty-state strong {
        color: #172033;
    }

.modal-backdrop.show {
    background: #6b7787;
    opacity: 0.62;
}

#misaConnectModal .modal-dialog {
    max-width: 630px;
}

/* Bảo đảm modal luôn nằm trong màn hình và cuộn thân độc lập với modal-dialog-scrollable của Bootstrap. */
#misaConnectModal .modal-content {
    max-height: calc(100vh - 42px);
}

/* Form là con trực tiếp của modal-content nên phải giữ layout flex để modal-body cuộn đúng. */
#misaConnectModal .modal-content > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
}

#misaConnectModal .modal-body {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.misa-modal {
    overflow: hidden;
    border: 0;
    border-radius: 13px;
    box-shadow: 0 21px 65px rgba(15, 23, 42, 0.28);
}

    .misa-modal .modal-header {
        align-items: flex-start;
        padding: 20px 20px 15px;
        border-bottom: 1px solid #e1e8f2;
    }

.modal-title-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.modal-title-icon {
    margin-top: 2px;
    color: #0871f6;
    font-size: 22px;
}

.misa-modal .modal-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.misa-modal-subtitle {
    margin-top: 6px;
    color: #536c8e;
    font-size: 13px;
}

.misa-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.misa-modal-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 50%;
    background: #e8f0ff;
    color: #0d5ef4;
    font-size: 18px;
}

.misa-modal .modal-body {
    padding: 14px 20px 17px;
    /* modal-dialog-scrollable biến body thành vùng cuộn; thanh cuộn mảnh cho khớp thiết kế. */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

    .misa-modal .modal-body::-webkit-scrollbar {
        width: 8px;
    }

    .misa-modal .modal-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .misa-modal .modal-body::-webkit-scrollbar-thumb {
        border: 2px solid transparent;
        border-radius: 8px;
        background-color: #cbd5e1;
        background-clip: padding-box;
    }

    .misa-modal .modal-body::-webkit-scrollbar-thumb:hover {
        background-color: #94a3b8;
    }

.company-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 17px;
    margin-bottom: 15px;
    border: 1px solid #9dc6ff;
    border-radius: 9px;
    background: #f1f7ff;
}

.company-summary-icon {
    display: grid;
    width: 49px;
    height: 49px;
    flex: 0 0 49px;
    place-items: center;
    border-radius: 50%;
    background: #d8e8ff;
    color: #0767e9;
    font-size: 23px;
}

.company-summary-label {
    color: #536c8e;
    font-size: 13px;
}

.company-summary-name {
    margin-top: 3px;
    font-size: 14px;
    font-weight: 760;
    line-height: 1.35;
}

.company-summary-meta {
    margin-top: 5px;
    color: #526c8c;
    font-size: 13px;
}

.form-label {
    margin-bottom: 6px;
    color: #253a59;
    font-size: 13px;
    font-weight: 700;
}

.form-control,
.form-select {
    min-height: 36px;
    border-color: #ccd8e7;
    border-radius: 6px;
    color: #1a2637;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #66a4ff;
        box-shadow: 0 0 0 0.17rem rgba(8, 102, 239, 0.13);
    }

    .form-control:disabled {
        color: #8290a4;
        background: #f7f8fa;
    }

textarea.form-control {
    min-height: 125px;
    resize: vertical;
    line-height: 1.42;
}

.form-hint {
    margin-top: 5px;
    color: #6b7e98;
    font-size: 12px;
    line-height: 1.35;
}

.misa-modal .modal-footer {
    gap: 4px;
    padding: 17px 20px 19px;
    border-top: 1px solid #e1e8f2;
}

    .misa-modal .modal-footer .btn-outline-app {
        min-width: 92px;
    }

    .misa-modal .modal-footer .btn-primary-app {
        min-width: 95px;
    }

/* select2 trong modal kết nối: đồng bộ chiều cao, màu viền, trạng thái focus với .form-control. */
.misa-modal .select2-container--default .select2-selection--single {
    height: 36px;
    border: 1px solid #ccd8e7;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
}

    .misa-modal .select2-container--default .select2-selection--single .select2-selection__rendered {
        padding-right: 34px;
        padding-left: 12px;
        color: #1a2637;
        font-size: 14px;
        line-height: 34px;
    }

    .misa-modal .select2-container--default .select2-selection--single .select2-selection__arrow {
        top: 1px;
        right: 6px;
        height: 34px;
    }

.misa-modal .select2-container--default.select2-container--focus .select2-selection--single,
.misa-modal .select2-container--default.select2-container--open .select2-selection--single {
    border-color: #66a4ff;
    box-shadow: 0 0 0 0.17rem rgba(8, 102, 239, 0.13);
}

/* Dropdown nằm ngoài modal-body để không làm thay đổi chiều cao vùng cuộn. */
#misaConnectModal .select2-dropdown {
    z-index: 1080;
    border: 1px solid #ccd8e7;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

    #misaConnectModal .select2-dropdown.select2-dropdown--above {
        border-radius: 8px;
    }

#misaConnectModal .select2-results > .select2-results__options {
    max-height: 240px;
    padding: 4px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#misaConnectModal .select2-results__option {
    padding: 9px 12px;
    color: #1a2637;
    font-size: 14px;
    line-height: 1.35;
}

#misaConnectModal .select2-container--default .select2-results__option--highlighted {
    background: #f1f7ff;
    color: #0857c3;
}

#misaConnectModal .select2-container--default .select2-results__option--selected {
    background: #e8f0ff;
    color: #0b57d0;
    font-weight: 700;
}

/* UI tổng quan đồng bộ theo mẫu thiết kế. */
.sync-overview-panel {
    margin-bottom: 14px;
    overflow: hidden;
}

.sync-panel-header {
    display: flex;
    min-height: 86px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0 12px 0;
}

.sync-panel-title,
.sync-section-title {
    margin: 0;
    color: #0b1738;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.25px;
}

.sync-panel-subtitle,
.sync-section-subtitle {
    margin: 5px 0 0;
    color: #61718e;
    font-size: 13px;
}

.sync-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
}

.sync-summary-card,
.sync-quick-card,
.sync-data-card {
    border: 1px solid #dce5f1;
    background: #fff;
}

.sync-summary-card {
    display: flex;
    min-height: 124px;
    align-items: center;
    gap: 16px;
    padding: 18px 16px;
    border-radius: 9px;
}

.sync-circle-icon {
    display: grid;
    width: 66px;
    height: 66px;
    flex: 0 0 66px;
    place-items: center;
    border-radius: 50%;
    font-size: 30px;
}

.sync-icon-blue {
    background: linear-gradient(135deg, #e8efff, #f4f7ff);
    color: #0e5be4;
}

.sync-icon-green {
    background: linear-gradient(135deg, #dff5df, #f4fbf4);
    color: #149547;
}

.sync-icon-red {
    background: linear-gradient(135deg, #ffe0e4, #fff4f5);
    color: #dd1d38;
}

.sync-icon-purple {
    background: linear-gradient(135deg, #efe4ff, #fbf7ff);
    color: #7926e8;
}

.sync-icon-orange {
    background: linear-gradient(135deg, #ffead8, #fff8f2);
    color: #ef7417;
}

.sync-icon-gray {
    background: linear-gradient(135deg, #eef2f7, #fbfcfe);
    color: #64748b;
}

.sync-metric-label {
    color: #334568;
    font-size: 13px;
    font-weight: 700;
}

.sync-metric-value {
    margin: 4px 0 2px;
    color: #0d5ef4;
    font-size: 31px;
    font-weight: 800;
    line-height: 1;
}

.sync-metric-help {
    color: #506382;
    font-size: 13px;
}

.text-danger-app {
    color: #dc1c34;
}

.sync-section-panel,
.sync-data-panel {
    margin-top: 14px;
    padding: 14px 14px 16px;
}

.sync-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.sync-quick-card {
    position: relative;
    display: flex;
    min-height: 124px;
    align-items: center;
    gap: 15px;
    padding: 16px;
    border-color: #cfe0ff;
    border-radius: 9px;
    background: linear-gradient(90deg, #fff, rgba(245, 249, 255, 0.8));
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

    .sync-quick-card:hover {
        box-shadow: 0 8px 16px rgba(34, 78, 148, 0.08);
        transform: translateY(-2px);
    }

    .sync-quick-card .sync-circle-icon {
        width: 51px;
        height: 51px;
        flex-basis: 51px;
        font-size: 24px;
    }

.sync-quick-content {
    min-width: 0;
    flex: 1;
}

.sync-quick-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

    .sync-quick-top > div:first-child {
        min-width: 0;
    }

.sync-quick-title {
    margin-top: 8px;
    color: #0b1738;
    font-size: 14px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-quick-desc {
    margin-top: 5px;
    color: #61718d;
    font-size: 12px;
}

.sync-quick-actions {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

.sync-action-main {
    width: 100%;
    min-height: 37px;
    font-size: 13px;
}

.sync-mini-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.sync-mini-btn,
.sync-detail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #c7d8f7;
    background: #fff;
    color: #065cf3;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sync-mini-btn {
    width: 100%;
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 6px;
}

    .sync-mini-btn:hover,
    .sync-detail-btn:hover {
        border-color: #bdd0ef;
        background: #f1f6ff;
        color: #065cf3;
    }

    .sync-mini-btn:disabled,
    .sync-detail-btn:disabled {
        border-color: #d9e2ef;
        color: #8a98aa;
        background: #f8fafc;
    }

.sync-quick-arrow {
    margin-left: auto;
    color: #0a57d8;
    font-size: 22px;
    line-height: 1;
}

.sync-link-more {
    display: inline-flex;
    align-items: center;
    color: #0758d8;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

    .sync-link-more i {
        font-size: 14px;
        line-height: 1;
    }

.sync-data-card {
    display: flex;
    min-height: 99px;
    align-items: center;
    gap: 13px;
    padding: 14px 12px;
    border-radius: 8px;
}

    .sync-data-card .sync-circle-icon {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
        font-size: 23px;
    }

.sync-data-content {
    min-width: 0;
    flex: 1;
}

.sync-data-card-title {
    color: #0b1738;
    font-size: 13px;
    font-weight: 800;
}

.sync-data-title-link {
    display: inline-block;
    text-decoration: none;
    transition: color 0.18s ease;
}

    .sync-data-title-link:hover,
    .sync-data-title-link:focus {
        color: #075be6;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

.sync-data-card-line {
    margin-top: 5px;
    color: #61718d;
    font-size: 12px;
}

    .sync-data-card-line .ok {
        color: #099147;
        font-weight: 800;
    }

    .sync-data-card-line .bad {
        color: #e21f38;
        font-weight: 700;
    }

.sync-detail-btn {
    min-height: 32px;
    padding: 7px 12px;
    border-color: #d3dfed;
    border-radius: 6px;
    white-space: nowrap;
}

/* UI danh mục đồng bộ theo mẫu thiết kế, giữ nguyên form xử lý hiện có. */
.catalog-panel {
    overflow: hidden;
}

.catalog-panel-header {
    padding: 17px 20px;
}

.catalog-sync-dropdown {
    flex: 0 0 auto;
}

.catalog-sync-all-btn {
    min-height: 38px;
    padding: 0 17px;
    border-radius: 7px;
    font-size: 13px;
}

.catalog-sync-menu {
    width: min(360px, 90vw);
    padding: 6px;
    border-color: #e2e9f3;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(31, 65, 120, 0.13);
}

.catalog-sync-option {
    margin: 0;
}

.catalog-sync-item {
    display: grid;
    gap: 5px;
    padding: 8px 9px;
    border-radius: 6px;
    color: #172747;
    white-space: normal;
}

    .catalog-sync-item:hover,
    .catalog-sync-item:focus {
        background: #f1f6ff;
        color: #172747;
    }

    .catalog-sync-item:disabled {
        opacity: 0.58;
    }

.catalog-sync-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
}

.catalog-sync-item small,
.catalog-sync-empty {
    color: #60708f;
    font-size: 12px;
}

.catalog-sync-empty {
    padding: 8px 9px;
}

.catalog-body {
    padding: 17px;
}

.catalog-section-title {
    color: #0b1738;
    font-size: 14px;
    font-weight: 800;
}

.catalog-section-subtitle {
    margin-top: 5px;
    color: #60708f;
    font-size: 13px;
}

.catalog-table-frame {
    overflow: hidden;
    border: 1px solid #e7edf6;
    border-radius: 8px;
}

.catalog-table {
    min-width: 1120px;
    margin: 0;
    vertical-align: middle;
}

    .catalog-table > :not(caption) > * > * {
        border-color: #e8edf4;
    }

    .catalog-table thead th {
        padding: 10px 12px;
        color: #4f6080;
        background: #f7f9fc;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.1px;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .catalog-table tbody td {
        height: 48px;
        padding: 6px 12px;
        color: #172747;
        font-size: 12px;
    }

    .catalog-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .catalog-table tbody tr:hover td {
        background: #fbfdff;
    }

.catalog-category-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 190px;
}

.catalog-row-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 50%;
    font-size: 17px;
}

.catalog-icon-green {
    color: #079343;
    background: #e2f7e8;
}

.catalog-icon-purple {
    color: #6f28ed;
    background: #f0e8ff;
}

.catalog-icon-orange {
    color: #f27816;
    background: #ffecda;
}

.catalog-icon-blue {
    color: #1769f2;
    background: #e6efff;
}

.catalog-icon-yellow {
    color: #d89000;
    background: #fff5d8;
}

.catalog-icon-cyan {
    color: #0ea6c9;
    background: #dcf6fb;
}

.catalog-icon-red {
    color: #e42741;
    background: #ffe4e9;
}

.catalog-icon-gray {
    color: #64748b;
    background: #eef2f7;
}

.catalog-category-name {
    color: #101d3b;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.catalog-title-link {
    text-decoration: none;
    transition: color 0.18s ease;
}

    .catalog-title-link:hover,
    .catalog-title-link:focus {
        color: #075be6;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

.catalog-description {
    color: #516486 !important;
}

.catalog-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 3px 8px;
    border-radius: 4px;
    color: #087944;
    background: #dcf4e8;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

    .catalog-status-badge.pending {
        color: #52627a;
        background: #eef2f7;
    }

.catalog-sync-count {
    color: #182b51 !important;
    font-weight: 700;
    text-align: center;
}

.catalog-error-count {
    color: #e21f38 !important;
    font-weight: 700;
    text-align: center;
}

.catalog-last-sync {
    color: #182b51 !important;
    white-space: nowrap;
}

.catalog-action-cell {
    white-space: nowrap;
}

.catalog-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.catalog-row-sync-dropdown {
    display: inline-flex;
}

.catalog-sync-row-btn {
    display: inline-flex;
    width: 32px;
    height: 33px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #d7e0ee;
    border-radius: 8px;
    color: #1f73ff;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

    .catalog-sync-row-btn:hover,
    .catalog-sync-row-btn:focus {
        border-color: #bfd0ea;
        color: #075be6;
        background: #f8fbff;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    }

    .catalog-sync-row-btn:disabled {
        border-color: #d9e2ef;
        color: #98a6ba;
        background: #f8fafc;
        cursor: not-allowed;
        opacity: 0.8;
        box-shadow: none;
    }

.catalog-detail-btn {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #d7e0ee;
    border-radius: 8px;
    color: #40516f;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

    .catalog-detail-btn:hover,
    .catalog-detail-btn:focus {
        border-color: #bfd0ea;
        background: #f8fbff;
        color: #243b63;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    }

    .catalog-detail-btn:disabled {
        border-color: #d9e2ef;
        color: #8a98aa;
        background: #f8fafc;
        cursor: not-allowed;
        box-shadow: none;
    }

/* Toast thông báo đồng bộ dùng chung cho các màn tenant. */
.app-toast-container {
    z-index: 1080;
}

.app-toast {
    width: min(420px, calc(100vw - 24px));
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

    .app-toast .toast-body {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
        color: #172033;
        font-size: 13px;
        font-weight: 700;
        line-height: 1.45;
    }

        .app-toast .toast-body > span {
            min-width: 0;
            flex: 1;
        }

    .app-toast .btn-close {
        flex: 0 0 auto;
        margin-top: 2px;
    }

.app-toast-success i {
    color: var(--bm-success);
}

.app-toast-error i {
    color: var(--bm-danger);
}

/* Toast thông báo realtime ở góc bottom-right, độc lập với app-toast top-right. */
.notification-toast-container {
    z-index: 1080;
}

.notification-toast {
    width: min(420px, calc(100vw - 24px));
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.notification-toast-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
}

    .notification-toast-body > i {
        color: var(--bm-primary);
        margin-top: 2px;
    }

.notification-toast-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
    cursor: pointer;
}

.notification-toast-title {
    color: #172033;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.notification-toast-message {
    color: #5b6675;
    font-size: 12px;
    line-height: 1.4;
}

.notification-toast .btn-close {
    flex: 0 0 auto;
    margin-top: 2px;
}

.sync-detail-panel {
    overflow: hidden;
}

.sync-detail-header {
    align-items: flex-start;
    padding: 17px 20px;
}

.sync-detail-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #0758d8;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

    .sync-detail-back-link:hover,
    .sync-detail-back-link:focus {
        color: #034fd7;
    }

.sync-history-table-actions {
    display: flex;
    justify-content: flex-end;
}

.sync-history-table-refresh-btn {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9e5f6;
    border-radius: 7px;
    color: #0758d8;
    background: #fff;
    font-size: 18px;
    text-decoration: none;
    transition: 0.15s ease;
}

    .sync-history-table-refresh-btn:hover,
    .sync-history-table-refresh-btn:focus {
        color: #fff;
        border-color: #0758d8;
        background: #0758d8;
    }

.sync-detail-badge {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid #d9e5f6;
    border-radius: 999px;
    color: #0758d8;
    background: #f1f6ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Block "Dữ liệu khách hàng từ MISA" ở đầu trang chi tiết khách hàng (luồng MISA → hệ thống). */
.sync-amis-refresh-card {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0 0 14px;
    padding: 13px 16px;
    border: 1px solid #d9e5f6;
    border-radius: 10px;
    background: #f7faff;
}

.sync-amis-refresh-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #fff;
    background: #0758d8;
    font-size: 18px;
}

.sync-amis-refresh-text {
    flex: 1 1 auto;
    min-width: 0;
}

.sync-amis-refresh-title {
    color: #0b1738;
    font-size: 13px;
    font-weight: 700;
}

.sync-amis-refresh-desc {
    margin-top: 2px;
    color: #5b6b82;
    font-size: 12px;
}

.sync-amis-refresh-form {
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .sync-amis-refresh-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

.sync-detail-body {
    padding-top: 0;
}

.sync-detail-section-header {
    margin-bottom: 13px;
}

.sync-detail-table {
    min-width: 1180px;
}

.sync-detail-tax-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 154px;
}

    .sync-detail-tax-cell .catalog-row-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        font-size: 15px;
    }

.sync-detail-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

    .sync-detail-status.connected {
        color: #087944;
        background: #dcf4e8;
    }

    .sync-detail-status.expired {
        color: #b65b00;
        background: #fff1dc;
    }

    .sync-detail-status.pending {
        color: #52627a;
        background: #eef2f7;
    }

.sync-detail-error {
    max-width: 260px;
    color: #dc1c34;
    font-size: 12px;
    line-height: 1.35;
}

.sync-detail-sync-form {
    margin: 0;
}

.sync-detail-action-btn {
    min-height: 32px;
    padding: 0 11px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: none;
}

.sync-detail-history-panel {
    margin-top: 14px;
    padding: 14px 14px 16px;
}

@media (max-width: 1199.98px) {
    .sync-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {

    .sync-panel-header,
    .sync-section-header,
    .sync-quick-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .sync-summary-grid,
    .sync-mini-actions {
        grid-template-columns: 1fr;
    }

    .sync-detail-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .sync-detail-badge {
        align-self: flex-start;
    }

    .sync-summary-card {
        min-height: 104px;
    }

    .sync-circle-icon {
        width: 55px;
        height: 55px;
        flex-basis: 55px;
        font-size: 26px;
    }
}

@media (max-width: 1100px) {
    .admin-sidebar {
        width: 206px;
    }

    .admin-panel {
        margin-left: 206px;
    }

    .stats-wrap .row {
        --bs-gutter-x: 0.7rem;
    }

    .stat-card {
        gap: 14px;
        padding: 17px 15px;
    }

    .stat-icon {
        width: 51px;
        height: 51px;
        flex-basis: 51px;
        font-size: 25px;
    }

    .connection-table {
        min-width: 1050px;
    }

    .table-responsive {
        overflow-x: auto;
    }
}


@media (max-width: 780px) {
    .admin-main {
        padding: 12px;
    }

    .misa-sync-nav {
        gap: 18px;
        margin: -12px -12px 16px;
        padding: 0 16px;
    }

    .overview-header {
        gap: 15px;
        padding: 20px;
    }

        .overview-header h1 {
            font-size: 20px;
        }

    .list-toolbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 0;
    }

    .toolbar-right {
        width: 100%;
        gap: 9px;
    }

    .search-control {
        width: 100%;
    }

    .admin-footer {
        min-height: 55px;
    }
}

@media (max-width: 575.98px) {
    .admin-sidebar {
        width: 206px;
        padding: 14px 10px;
    }

    .admin-brand {
        font-size: 1rem;
    }

    .stats-wrap .row {
        --bs-gutter-y: 0.75rem;
    }
}

/* Responsive layout guardrails: keep wide tables/cards from stretching the whole page. */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

.admin-layout,
.admin-panel,
.admin-header,
.admin-header-left,
.admin-main,
.admin-footer,
.panel,
.overview,
.list-panel,
.catalog-panel,
.history-panel,
.sync-section-panel,
.sync-data-panel,
.misa-index-page,
.settings-page,
.row,
[class*="col-"] {
    min-width: 0;
}

.admin-panel {
    width: calc(100% - 206px);
    max-width: calc(100vw - 206px);
}

.admin-main,
.admin-header,
.admin-footer,
.panel,
.overview,
.list-panel,
.catalog-panel,
.history-panel,
.sync-section-panel,
.sync-data-panel,
.misa-index-page,
.settings-page {
    max-width: 100%;
}

.admin-main {
    overflow-x: clip;
}

.table-responsive,
.catalog-table-frame.table-responsive,
.history-table-shell {
    max-width: 100%;
    max-height: clamp(320px, 68vh, 720px);
    min-width: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    margin-bottom: 10px;
}

    .table-responsive > .table {
        margin-bottom: 0;
    }

        .table-responsive > .table thead th,
        .catalog-table-frame.table-responsive > .table thead th,
        .history-table-shell > .table thead th {
            position: sticky;
            top: 0;
            z-index: 3;
        }

        .table-responsive > .table:not(.misa-table):not(.catalog-table) thead th,
        .history-table-shell > .table:not(.misa-table):not(.catalog-table) thead th {
            background: #fff;
        }

    .table-responsive::-webkit-scrollbar,
    .catalog-table-frame.table-responsive::-webkit-scrollbar,
    .history-table-shell::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    .table-responsive::-webkit-scrollbar-track,
    .catalog-table-frame.table-responsive::-webkit-scrollbar-track,
    .history-table-shell::-webkit-scrollbar-track {
        background: transparent;
    }

    .table-responsive::-webkit-scrollbar-thumb,
    .catalog-table-frame.table-responsive::-webkit-scrollbar-thumb,
    .history-table-shell::-webkit-scrollbar-thumb {
        border: 2px solid transparent;
        border-radius: 999px;
        background: #cbd5e1;
        background-clip: padding-box;
    }

        .table-responsive::-webkit-scrollbar-thumb:hover,
        .catalog-table-frame.table-responsive::-webkit-scrollbar-thumb:hover,
        .history-table-shell::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
            background-clip: padding-box;
        }
/* Giữ cột thao tác cuối cố định khi bảng scroll ngang. */
.sticky-action-table {
    --sticky-action-col-width: 145px;
    --sticky-action-col-bg: #fff;
    --sticky-action-col-head-bg: #f8fafc;
}

.catalog-table.sticky-action-table {
    --sticky-action-col-head-bg: #f7f9fc;
}

.sticky-action-table .sticky-action-col {
    position: sticky;
    right: 0;
    width: var(--sticky-action-col-width);
    min-width: var(--sticky-action-col-width);
    max-width: var(--sticky-action-col-width);
    background: var(--sticky-action-col-bg);
    box-shadow: -14px 0 18px -18px rgba(15, 23, 42, 0.72);
    z-index: 2;
}

.sticky-action-table thead .sticky-action-col {
    background: var(--sticky-action-col-head-bg);
    z-index: 6;
}

.misa-table.sticky-action-table tbody tr:hover > .sticky-action-col {
    background: rgba(239, 246, 255, 0.96);
}

.catalog-table.sticky-action-table tbody tr:hover > .sticky-action-col {
    background: #fbfdff;
}

.responsive-table-desktop {
    display: block;
}

.mobile-card-list {
    display: none;
}

.text-truncate-2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

@media (max-width: 991.98px) {
    .admin-body.sidebar-open {
        overflow: hidden;
    }

    .admin-sidebar {
        width: 206px;
        transform: translateX(-105%);
        box-shadow: 22px 0 50px rgba(15, 23, 42, 0.26);
        transition: transform 0.22s ease;
    }

    .admin-body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-body.sidebar-open .admin-sidebar-backdrop {
        display: block;
    }

    .admin-panel {
        width: 100%;
        max-width: 100vw;
        margin-left: 0;
    }

    .admin-header,
    .admin-footer {
        width: 100%;
        max-width: 100%;
    }

    .admin-mobile-menu {
        display: inline-flex;
    }

    .misa-sync-nav {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .admin-header {
        padding: 0 12px;
        gap: 8px;
    }

    .admin-header-title {
        font-size: 18px;
    }

    .admin-header-actions {
        flex: 0 0 auto;
        gap: 4px;
    }

    .responsive-table-desktop {
        display: none !important;
    }

    .mobile-card-list {
        display: grid;
        gap: 10px;
    }

    .panel {
        border-radius: 13px;
    }

    .overview-header,
    .sync-panel-header,
    .sync-section-header,
    .history-panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .catalog-sync-dropdown,
    .catalog-sync-all-btn,
    .history-refresh-btn,
    .history-filter-btn,
    .history-reset-btn {
        width: 100%;
    }

    .sync-section-panel,
    .sync-data-panel,
    .catalog-body,
    .history-filter-zone {
        padding-right: 12px;
        padding-left: 12px;
    }

    .misa-sync-nav {
        min-height: 48px;
        padding: 0 12px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-card {
        align-items: flex-start;
        padding: 14px;
    }
}

.settings-page {
    width: min(100%, 1180px);
}

.settings-page-heading {
    margin-bottom: 18px;
}

.settings-section-head {
    margin-bottom: 12px;
}

    .settings-section-head h2 {
        margin: 0;
        color: #0b1738;
        font-size: 15px;
        font-weight: 800;
    }

    .settings-section-head p {
        margin: 4px 0 0;
        color: #61718e;
        font-size: 13px;
    }

.settings-card-icon i {
    color: currentColor;
    font-size: 18px;
    line-height: 1;
}

@media (max-width: 575.98px) {
    .settings-page-heading {
        margin-bottom: 14px;
    }
}

/* Mobile data cards used instead of wide operational tables. */
.min-w-0 {
    min-width: 0 !important;
}

.sync-mobile-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #dce5f1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.sync-mobile-title {
    color: #0b1738;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    word-break: break-word;
}

.sync-mobile-meta {
    margin-top: 4px;
    color: #60708f;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.sync-mobile-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.sync-mobile-stat {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #e5ecf6;
    border-radius: 8px;
    background: #f8fbff;
}

    .sync-mobile-stat span {
        color: #60708f;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .sync-mobile-stat strong {
        color: #0b1738;
        font-size: 13px;
        font-weight: 800;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

.sync-mobile-card .badge,
.sync-mobile-card .catalog-status-badge {
    flex: 0 0 auto;
    white-space: nowrap;
}

.sync-mobile-card .misa-error-note {
    max-width: none;
    margin-top: 0;
}

.sync-mobile-card .catalog-detail-btn,
.sync-mobile-card .catalog-sync-row-btn,
.sync-mobile-card .btn {
    width: 100%;
    min-height: 36px;
    height: auto;
    gap: 6px;
    padding: 7px 11px;
    font-size: 12px;
    justify-content: center;
    white-space: normal;
}

.catalog-mobile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.text-bg-primary {
    background: #0d6efd;
}

@media (max-width: 575.98px) {
    .stats-wrap {
        padding: 14px 12px;
    }

    .stat-card {
        min-height: 86px;
        gap: 14px;
        padding: 14px;
    }

    .sync-quick-card,
    .sync-data-card {
        min-width: 0;
    }

    .sync-quick-card {
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }

        .sync-quick-card .sync-circle-icon,
        .sync-data-card .sync-circle-icon {
            width: 42px;
            height: 42px;
            flex-basis: 42px;
            font-size: 20px;
        }

    .sync-quick-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .sync-quick-title {
        display: -webkit-box;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .sync-mini-actions {
        grid-template-columns: 1fr;
    }

    .sync-action-main,
    .sync-mini-btn,
    .sync-detail-btn {
        min-width: 0;
        white-space: normal;
    }

    .sync-data-card {
        align-items: flex-start;
        padding: 12px;
    }

    .sync-mobile-stats-3 .sync-mobile-stat:last-child {
        grid-column: 1 / -1;
    }

    .table-footer,
    .history-table-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .history-pager-wrap {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .history-page-size-form,
    .history-per-page {
        width: 100%;
    }
}

/* Cấu hình bật/tắt đồng bộ theo từng loại chứng từ, danh mục. */
.sync-config-panel {
    margin-top: 14px;
    padding: 0 22px 14px;
}

.sync-config-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sync-config-scope-btn {
    min-width: 148px;
    font-weight: 500;
}

/* btn-check đã ẩn radio nên phải tô nền nút phạm vi đang chọn để nhìn rõ đang ở tab nào. */
.sync-config-scope-switch .btn-check:checked + .sync-config-scope-btn {
    border-color: var(--bm-primary);
    background: var(--bm-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
}

.sync-config-tax-select {
    width: 290px;
    max-width: 100%;
}

/* Đồng bộ chiều cao và viền của select2 với các điều khiển form trong app. */
.sync-config-tax-select .select2-container--default .select2-selection--single {
    height: 41px;
    border: 1px solid #ccd8e6;
    border-radius: 6px;
    background: #fff;
}

.sync-config-tax-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 12px;
    color: #0b203e;
    line-height: 39px;
}

.sync-config-tax-select .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 39px;
}

.sync-config-tax-select .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--bm-muted);
}

.sync-config-tax-select .select2-container--default.select2-container--disabled .select2-selection--single {
    background: #f1f5f9;
    cursor: default;
}

.sync-config-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 2px 0 4px;
}

.sync-config-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--bm-border);
    border-radius: 999px;
    background: #f6f8fc;
    color: var(--bm-muted);
    font-size: 12.5px;
}

.sync-config-chip strong {
    color: var(--bm-ink);
    font-weight: 700;
}

.sync-config-chip-warn {
    border-color: rgba(180, 83, 9, 0.28);
    background: rgba(180, 83, 9, 0.08);
}

.sync-config-chip-scope {
    border-color: rgba(29, 78, 216, 0.35);
    background: var(--bm-primary-soft);
    color: var(--bm-primary);
}

.sync-config-chip-scope strong {
    color: var(--bm-primary);
}

.sync-config-note {
    margin-top: 6px;
}

.sync-config-automation-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 14px;
    padding: 18px 22px;
    border-left: 4px solid var(--bm-primary);
    background: linear-gradient(105deg, #f8fbff 0%, #ffffff 70%);
}

.sync-config-automation-content {
    display: flex;
    align-items: center;
    gap: 13px;
}

.sync-config-automation-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 12px;
    background: var(--bm-primary-soft);
    color: var(--bm-primary);
    font-size: 20px;
}

.sync-config-automation-switch {
    flex: 0 0 auto;
}

.sync-config-help-btn {
    display: inline-flex;
    min-height: 41px;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid #ccd8e6;
    border-radius: 6px;
    background: #fff;
    color: var(--bm-primary);
    font-size: 13px;
    font-weight: 500;
}

.sync-config-help-btn:hover {
    border-color: rgba(29, 78, 216, 0.4);
    background: var(--bm-primary-soft);
}

/* Panel hướng dẫn trượt ra từ mép phải, bản hẹp để không che bảng cấu hình đang xem. */
.sync-config-help-panel {
    width: min(430px, 92vw);
    border-left: 1px solid var(--bm-border);
    background: #fff;
    color: var(--bm-ink);
}

.sync-config-help-panel .offcanvas-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--bm-border);
}

.sync-config-help-list {
    margin: 0;
    padding-left: 18px;
    color: #31415e;
    font-size: 13.5px;
    line-height: 1.6;
}

.sync-config-help-list li + li {
    margin-top: 10px;
}

.sync-config-help-list strong {
    color: var(--bm-ink);
}

/* Đề mục trong panel hướng dẫn: chữ nhỏ in hoa để lướt nhanh từng chủ đề. */
.sync-config-help-heading {
    margin: 16px 0 5px;
    color: var(--bm-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.sync-config-help-heading:first-child {
    margin-top: 0;
}

.sync-config-help-text {
    margin: 0;
    color: #31415e;
    font-size: 13.5px;
    line-height: 1.6;
}

/* Khối ví dụ lồng màu nhạt để phân biệt thao tác với tình huống minh họa. */
.sync-config-help-example {
    margin: 7px 0 0;
    padding: 8px 11px;
    border-left: 3px solid var(--bm-primary);
    border-radius: 0 8px 8px 0;
    background: var(--bm-primary-soft);
    color: #31415e;
    font-size: 12.5px;
    line-height: 1.55;
}

.sync-config-hint {
    margin-top: 8px;
}

.sync-config-group {
    margin-top: 14px;
    padding: 14px 18px 6px;
}

.sync-config-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

/* Tiêu đề nhóm là nút thu gọn của Bootstrap collapse nên bỏ hết nền viền của button. */
.sync-config-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.sync-config-group-titles {
    display: block;
}

.sync-config-group-toggle:hover .sync-section-title {
    color: var(--bm-primary);
}

.sync-config-chevron {
    color: var(--bm-muted);
    font-size: 16px;
    transition: transform 0.15s ease;
}

/* Plugin collapse tự gắn .collapsed lên nút trigger khi nhóm thu gọn. */
.sync-config-group-toggle.collapsed .sync-config-chevron {
    transform: rotate(-90deg);
}

.sync-config-group-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-config-bulk-btn {
    padding: 5px 11px;
    border: 1px solid var(--bm-border);
    border-radius: 8px;
    background: #fff;
    color: var(--bm-primary);
    font-size: 12.5px;
    font-weight: 500;
}

.sync-config-bulk-btn:hover {
    border-color: rgba(29, 78, 216, 0.4);
    background: var(--bm-primary-soft);
}

.sync-config-bulk-btn:disabled {
    color: var(--bm-muted);
    cursor: default;
    opacity: 0.6;
}

.sync-config-table {
    min-width: 940px;
}

.sync-config-name {
    display: flex;
    align-items: center;
    gap: 11px;
}

.sync-config-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.sync-config-kind {
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.sync-config-kind-catalog {
    background: rgba(29, 78, 216, 0.1);
    color: var(--bm-primary);
}

.sync-config-kind-voucher {
    background: rgba(4, 120, 87, 0.1);
    color: var(--bm-success);
}

/* Badge nhỏ báo loại đang tắt trong Cấu hình đồng bộ, dùng trên trang Danh mục và Chứng từ. */
.sync-config-off-badge {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--bm-muted);
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.sync-config-source {
    color: var(--bm-muted);
}

.sync-config-switch {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding-left: 0;
}

.sync-config-switch .form-check-input {
    margin: 0;
    float: none;
}

.sync-config-state {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.sync-config-state.is-on {
    color: var(--bm-success);
}

.sync-config-state.is-off {
    color: var(--bm-muted);
}

.sync-config-date-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-config-date {
    width: 152px;
    padding: 5px 9px;
}

.sync-config-save-btn {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border: 1px solid var(--bm-border);
    border-radius: 8px;
    background: #fff;
    color: var(--bm-primary);
    font-size: 15px;
}

.sync-config-save-btn:hover {
    border-color: rgba(29, 78, 216, 0.4);
    background: var(--bm-primary-soft);
}

.sync-config-reset-btn {
    padding: 5px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--bm-muted);
    font-size: 12.5px;
    font-weight: 500;
}

.sync-config-reset-btn:hover {
    background: #f6f8fc;
    color: var(--bm-danger);
}

.sync-config-confirm-text {
    color: var(--bm-ink);
    line-height: 1.55;
}

/* Đẩy toast của màn hình cấu hình xuống dưới để không đè toast của header. */
.sync-config-toast-container {
    top: 72px;
    z-index: 1080;
}

.sync-config-scope-form {
    margin-bottom: 0;
}

@media (max-width: 991.98px) {
    .sync-config-panel,
    .sync-config-group {
        padding: 12px 14px;
    }

    .sync-config-controls {
        width: 100%;
    }

    .sync-config-tax-select {
        width: 100%;
    }

    .sync-config-automation-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}
