:root {
    --app-bg: #090b12;
    --surface: #111520;
    --surface-2: #171c29;
    --border: rgba(255, 255, 255, .075);
    --muted: #8e98ad;
    --primary: #7c5cff;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--app-bg); color: #eef1f7; font-family: Inter, sans-serif; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); height: 100vh; max-height: 100vh; z-index: 1040; display: flex; flex-direction: column; overflow: hidden; padding: 20px 14px 14px; background: #0d1019; border-right: 1px solid var(--border); transition: transform .25s ease; }
.brand { display: flex; flex: 0 0 auto; min-width: 0; align-items: center; gap: 11px; padding: 0 10px 18px; color: #fff; text-decoration: none; font-size: 1.15rem; }
.brand span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #8a6cff, #5941d8); box-shadow: 0 8px 24px rgba(124,92,255,.3); }
.nav-label, .eyebrow { color: #6f7a91; font-size: .69rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-label { padding: 0 12px; }
.sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 4px 12px 0; scrollbar-color: rgba(124,92,255,.45) transparent; scrollbar-width: thin; overscroll-behavior: contain; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(124,92,255,.45); }
.nav-group { margin: 0 0 7px; }
.nav-group-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px; border: 0; border-radius: 10px; background: transparent; color: #7d879c; font-family: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .08em; line-height: 1.2; text-align: left; text-transform: uppercase; }
.nav-group-toggle:hover, .nav-group.open > .nav-group-toggle { color: #d7dcf0; background: rgba(255,255,255,.035); }
.nav-group.active > .nav-group-toggle { color: #b4a6ff; }
.nav-group-title { display: flex; min-width: 0; align-items: center; gap: 9px; }
.nav-group-title i { flex: 0 0 17px; font-size: .95rem; line-height: 1; text-align: center; }
.nav-group-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-chevron { flex: 0 0 auto; font-size: .78rem; transition: transform .18s ease; }
.nav-group.open .nav-group-chevron { transform: rotate(180deg); }
.nav-group-items { display: none; padding: 2px 0 2px 8px; }
.nav-group.open .nav-group-items { display: block; }
.sidebar-nav .nav-link { display: flex; min-width: 0; align-items: center; gap: 11px; margin: 3px 0; padding: 9px 10px 9px 12px; border-radius: 10px; color: #919bad; font-size: .84rem; line-height: 1.2; text-decoration: none; }
.sidebar-nav .nav-link i { flex: 0 0 18px; font-size: 1rem; line-height: 1; text-align: center; }
.sidebar-nav .nav-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav .nav-link.active { color: #fff; background: rgba(124,92,255,.14); }
.sidebar-nav .nav-link.active i { color: #9b86ff; }
.sidebar-nav .nav-link.disabled { opacity: .47; cursor: not-allowed; }
.sidebar-nav small { margin-left: auto; font-size: .58rem; text-transform: uppercase; }
.sidebar-bottom { flex: 0 0 auto; padding-top: 10px; border-top: 1px solid var(--border); background: #0d1019; }
.logout-form { margin: 0; }
.logout-link { display: flex; width: 100%; align-items: center; gap: 13px; margin: 0; padding: 12px 13px; border: 0; border-radius: 10px; background: transparent; color: #919bad; font-family: inherit; font-size: .9rem; line-height: 1.25; text-align: left; }
.logout-link i { flex: 0 0 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; line-height: 1; }
.logout-link span { display: block; min-width: 0; overflow: hidden; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.logout-link:hover { color: #ff8294 !important; background: rgba(255, 102, 124, .08); }
.sidebar-footer { display: flex; gap: 12px; align-items: center; min-width: 0; margin-top: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); color: #9b86ff; }
.sidebar-footer > i { flex: 0 0 auto; }
.sidebar-footer div { display: flex; min-width: 0; flex-direction: column; color: #d9deea; font-size: .75rem; }
.sidebar-footer strong, .sidebar-footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer span { color: var(--muted); font-size: .65rem; }
.app-main { min-height: 100vh; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
.topbar { height: 84px; display: flex; align-items: center; gap: 16px; padding: 0 34px; border-bottom: 1px solid var(--border); background: rgba(9,11,18,.88); backdrop-filter: blur(14px); }
.topbar-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; }
.status-dot, .health { display: block; width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 4px rgba(61,220,151,.1); }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; margin-left: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: #fff; font-weight: 700; }
.content-area { flex: 1; padding: 34px; }
.hero-panel { display: flex; align-items: center; justify-content: space-between; overflow: hidden; position: relative; padding: 35px; border: 1px solid rgba(124,92,255,.22); border-radius: 18px; background: radial-gradient(circle at 80% 50%, rgba(124,92,255,.16), transparent 33%), var(--surface); }
.hero-panel h2 { font-weight: 700; }
.hero-panel p { max-width: 650px; color: var(--muted); }
.badge-soft { color: #b4a6ff; background: rgba(124,92,255,.13); }
.hero-icon { font-size: 5rem; color: rgba(155,134,255,.38); }
.metric-card, .panel { border: 1px solid var(--border); background: var(--surface); }
.metric-card { position: relative; display: flex; gap: 16px; align-items: center; min-height: 125px; padding: 22px; border-radius: 15px; }
.metric-card > div:nth-child(2) { min-width: 0; }
.metric-card span, .metric-card small { color: var(--muted); font-size: .72rem; }
.metric-card h3 { margin: 5px 0 3px; font-size: 1.05rem; }
.metric-icon { flex: 0 0 45px; display: grid; place-items: center; height: 45px; border-radius: 12px; font-size: 1.2rem; }
.metric-icon.purple { color: #a895ff; background: rgba(124,92,255,.13); }
.metric-icon.blue { color: #5db8ff; background: rgba(47,151,255,.13); }
.metric-icon.green { color: #3ddc97; background: rgba(61,220,151,.12); }
.health { position: absolute; top: 22px; right: 22px; }
.health.offline { background: #ff667c; box-shadow: 0 0 0 4px rgba(255,102,124,.1); }
.panel { padding: 26px; border-radius: 15px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 21px; border-bottom: 1px solid var(--border); }
.checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 21px; }
.checklist-item { display: flex; align-items: center; gap: 11px; padding: 13px 15px; border-radius: 10px; background: var(--surface-2); color: #c5ccda; font-size: .85rem; }
.checklist-item i { color: #3ddc97; }
.app-footer { display: flex; justify-content: space-between; padding: 20px 34px; border-top: 1px solid var(--border); color: #687287; font-size: .72rem; }
.btn-icon { color: #fff; border: 1px solid var(--border); }
.sidebar-backdrop { display: none; }

.auth-body { min-height: 100vh; background: radial-gradient(circle at 15% 15%, rgba(124,92,255,.13), transparent 30%), radial-gradient(circle at 85% 85%, rgba(47,151,255,.08), transparent 27%), var(--app-bg); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.auth-card { width: min(100%, 440px); padding: 38px; border: 1px solid var(--border); border-radius: 20px; background: rgba(17,21,32,.92); box-shadow: 0 30px 80px rgba(0,0,0,.35); backdrop-filter: blur(18px); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 34px; font-size: 1.15rem; }
.auth-heading { margin-bottom: 26px; text-align: center; }
.auth-heading h1 { margin-bottom: 10px; font-size: 1.75rem; font-weight: 700; }
.auth-heading p:last-child { margin: 0; color: var(--muted); font-size: .86rem; }
.auth-card .form-label { color: #cbd2df; font-size: .78rem; font-weight: 600; }
.input-shell { position: relative; }
.input-shell > i { position: absolute; top: 50%; left: 15px; z-index: 2; transform: translateY(-50%); color: #778197; }
.input-shell .form-control { min-height: 49px; padding-left: 43px; border-color: var(--border); background: #0c0f17; color: #fff; }
.input-shell .form-control:focus { border-color: rgba(124,92,255,.7); box-shadow: 0 0 0 .2rem rgba(124,92,255,.12); }
.auth-submit { min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; background: linear-gradient(135deg, #8468ff, #6548e5); font-weight: 600; }
.auth-submit:hover { background: linear-gradient(135deg, #9077ff, #7357eb); }
.auth-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid rgba(255,102,124,.18); background: rgba(255,102,124,.08); color: #ff9aaa; font-size: .79rem; }
.auth-note { margin: 24px 0 0; color: #687287; font-size: .7rem; text-align: center; }
.auth-note i { margin-right: 5px; color: #3ddc97; }
.error-state { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; padding: 40px 20px; text-align: center; }
.error-code { position: absolute; color: rgba(255,255,255,.025); font-size: clamp(9rem, 25vw, 18rem); font-weight: 700; line-height: 1; user-select: none; }
.error-icon { z-index: 1; display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 24px; border: 1px solid rgba(255,102,124,.2); border-radius: 20px; background: rgba(255,102,124,.08); color: #ff8294; font-size: 1.8rem; }
.error-state > *:not(.error-code) { position: relative; z-index: 1; }
.error-state h2 { margin-bottom: 12px; font-weight: 700; }
.error-state > p:not(.eyebrow) { max-width: 560px; margin-bottom: 25px; color: var(--muted); }
.error-state .btn { border: 0; background: linear-gradient(135deg, #8468ff, #6548e5); }
.page-toolbar { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 28px; padding: 4px 2px 2px; }
.page-toolbar > div:first-child { min-width: 0; }
.page-toolbar .text-secondary { max-width: 720px; line-height: 1.65; }
.page-toolbar > .btn { flex: 0 0 auto; align-self: center; margin-left: auto; padding: 10px 17px; border-radius: 10px; white-space: nowrap; }
.page-toolbar .btn-primary, .modal-footer .btn-primary { border: 0; background: linear-gradient(135deg, #8468ff, #6548e5); box-shadow: 0 9px 24px rgba(124,92,255,.2); }
.page-toolbar .btn-primary:hover, .modal-footer .btn-primary:hover { background: linear-gradient(135deg, #9179ff, #7256e8); box-shadow: 0 11px 28px rgba(124,92,255,.28); }
.table-panel { width: 100%; min-width: 0; padding: 18px 24px 22px; border-radius: 17px; box-shadow: 0 14px 38px rgba(0,0,0,.12); }
.table-panel .table-responsive { width: 100%; min-width: 0; overflow-x: auto; border-radius: 11px; scrollbar-color: rgba(124,92,255,.45) transparent; scrollbar-width: thin; }
.table-panel .table { --bs-table-bg: transparent; --bs-table-border-color: var(--border); width: 100% !important; margin: 0; }
#usersTable, #rolesTable { min-width: 820px; }
#templatesTable { min-width: 980px; }
#payinTemplatesTable { min-width: 1220px; }
#payoutTemplatesTable { min-width: 1320px; }
#banksTable { min-width: 1120px; }
#uploadHistoryTable { min-width: 1040px; }
#payinUploadHistoryTable { min-width: 1120px; }
#payoutUploadHistoryTable { min-width: 1120px; }
#adminReportTable { min-width: 1660px; }
#failedRowsTable { min-width: 780px; }
.table-panel thead th { padding: 18px 13px; color: #7d879c; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.table-panel tbody td { padding: 15px 13px; color: #cbd2df; font-size: .8rem; }
.user-cell { display: flex; align-items: center; gap: 11px; }
.user-avatar { flex: 0 0 36px; display: grid; place-items: center; height: 36px; border-radius: 10px; background: rgba(124,92,255,.13); color: #a895ff; font-weight: 700; }
.user-cell div { display: flex; min-width: 0; flex-direction: column; }
.user-cell strong { color: #eef1f7; font-size: .82rem; }
.user-cell small { overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 20px; font-size: .68rem; text-transform: capitalize; }
.status-badge i { width: 6px; height: 6px; border-radius: 50%; }
.status-badge.active { color: #55dda4; background: rgba(61,220,151,.1); }
.status-badge.active i { background: #3ddc97; }
.status-badge.inactive { color: #ff91a1; background: rgba(255,102,124,.1); }
.status-badge.inactive i { background: #ff667c; }
.table-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.table-actions .btn-icon { display: inline-grid; width: 36px; height: 36px; place-items: center; padding: 0; border-color: rgba(255,255,255,.09); background: var(--surface-2); color: #b7c0d1; box-shadow: 0 5px 14px rgba(0,0,0,.12); }
.table-actions .btn-icon i { line-height: 1; }
.table-actions .edit-user, .table-actions .edit-role { border-color: rgba(124,92,255,.25); background: rgba(124,92,255,.12); color: #ad9cff; }
.table-actions .toggle-status, .table-actions .delete-role { border-color: rgba(255,102,124,.18); background: rgba(255,102,124,.08); color: #ff91a1; }
.table-actions .download-template { border-color: rgba(61,220,151,.2); background: rgba(61,220,151,.09); color: #55dda4; text-decoration: none; }
.table-actions .btn-icon:hover { transform: translateY(-1px); border-color: rgba(124,92,255,.45); background: rgba(124,92,255,.2); color: #fff; }
.table-actions .toggle-status:hover, .table-actions .delete-role:hover { border-color: rgba(255,102,124,.4); background: rgba(255,102,124,.16); color: #fff; }
.table-actions .download-template:hover { border-color: rgba(61,220,151,.4); background: rgba(61,220,151,.17); color: #fff; }
.btn-icon.view-result, .btn-icon.view-details { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; border-color: rgba(124,92,255,.25); background: rgba(124,92,255,.12); color: #ad9cff; }
.btn-icon.view-result:hover, .btn-icon.view-details:hover { border-color: rgba(124,92,255,.45); background: rgba(124,92,255,.2); color: #fff; }
.compare-filter-grid { display: grid; grid-template-columns: minmax(260px, 1.7fr) repeat(5, minmax(118px, 1fr)); gap: 12px; align-items: end; }
.compare-filter-field { min-width: 0; }
.compare-filter-field .form-label { margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.compare-filter-batch { min-width: 280px; }
.compare-history-shell { width: 100%; min-width: 0; overflow-x: hidden; }
.compare-results-shell { position: relative; overflow-x: visible; }
.compare-loader { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-start; justify-content: center; gap: 10px; padding-top: 64px; border-radius: 14px; background: rgba(9, 11, 18, .72); color: #dce3f2; font-weight: 700; backdrop-filter: blur(2px); }
.compare-stack { display: grid; gap: 3px; min-width: 0; max-width: 100%; font-size: .76rem; line-height: 1.25; }
.compare-stack-source { max-width: 170px; }
.compare-stack-admin { max-width: 150px; }
.compare-stack-transaction { max-width: 190px; }
.compare-k { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.compare-truncate { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-type-pill { display: inline-flex; width: fit-content; align-items: center; border: 1px solid rgba(124,92,255,.22); border-radius: 999px; padding: 2px 7px; color: #b9abff; background: rgba(124,92,255,.11); font-size: .62rem; font-weight: 800; letter-spacing: .08em; }
.compare-batch-option { display: block; max-width: 760px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-history-sources { display: flex; max-width: 145px; flex-direction: column; gap: 2px; color: #c8cfdd; font-size: .76rem; line-height: 1.25; }
.compare-history-sources span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-summary-badges { display: flex; max-width: 100%; flex-wrap: wrap; gap: 5px; }
.compare-summary-badges span { display: inline-flex; align-items: center; gap: 3px; max-width: 138px; border: 1px solid rgba(255,255,255,.07); border-radius: 999px; padding: 3px 7px; overflow: hidden; background: rgba(255,255,255,.035); color: #c6cddd; font-size: .68rem; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.compare-summary-badges b { color: #9fa8bc; font-weight: 700; }
.compare-line { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.compare-line span { color: var(--muted); }
.compare-line strong { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.compare-detail-section { border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.02); padding: 14px; }
.compare-raw-json { max-height: 280px; min-height: 110px; overflow: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(0,0,0,.22); color: #dce3f2; padding: 12px; font-size: .75rem; white-space: pre-wrap; }
#compareHistoryTable, #compareResultsTable { table-layout: fixed; min-width: 0 !important; }
#bankCompareHistoryTable, #bankCompareResultsTable { table-layout: fixed; min-width: 0 !important; }
#compareHistoryTable th:nth-child(1) { width: 54px; }
#compareHistoryTable th:nth-child(2) { width: 142px; }
#compareHistoryTable th:nth-child(3) { width: 155px; }
#compareHistoryTable th:nth-child(4) { width: 112px; }
#compareHistoryTable th:nth-child(6) { width: 64px; }
#compareHistoryTable td { vertical-align: middle; overflow: hidden; }
#compareResultsTable th:nth-child(1) { width: 106px; }
#compareResultsTable th:nth-child(2) { width: 126px; }
#compareResultsTable th:nth-child(3) { width: 178px; }
#compareResultsTable th:nth-child(4) { width: 160px; }
#compareResultsTable th:nth-child(5) { width: 205px; }
#compareResultsTable th:nth-child(6) { width: 78px; }
#compareResultsTable th:nth-child(7) { width: 58px; }
#compareResultsTable td { vertical-align: middle; overflow: hidden; }
#compareHistoryTable .status-badge, #compareResultsTable .status-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#compareHistoryTable_wrapper .dt-scroll, #compareHistoryTable_wrapper .dt-scroll-body, #compareResultsTable_wrapper .dt-scroll, #compareResultsTable_wrapper .dt-scroll-body { overflow-x: hidden !important; }
#bankCompareHistoryTable th:nth-child(1) { width: 54px; }
#bankCompareHistoryTable th:nth-child(2) { width: 92px; }
#bankCompareHistoryTable th:nth-child(3) { width: 150px; }
#bankCompareHistoryTable th:nth-child(4) { width: 112px; }
#bankCompareResultsTable th:nth-child(1) { width: 138px; }
#bankCompareResultsTable th:nth-child(2) { width: 220px; }
#bankCompareResultsTable th:nth-child(3) { width: 220px; }
#bankCompareResultsTable th:nth-child(4) { width: 82px; }
#bankCompareResultsTable th:nth-child(5) { width: 132px; }
#bankCompareResultsTable th:nth-child(6) { width: 58px; }
#bankCompareHistoryTable td, #bankCompareResultsTable td { vertical-align: middle; overflow: hidden; }
#bankCompareHistoryTable_wrapper .dt-scroll, #bankCompareHistoryTable_wrapper .dt-scroll-body, #bankCompareResultsTable_wrapper .dt-scroll, #bankCompareResultsTable_wrapper .dt-scroll-body { overflow-x: hidden !important; }
.bank-compare-filter-grid { grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(140px, 1fr)); }
.admin-report-table-wrap { max-width: 100%; overflow-x: auto; }
.admin-report-remark { max-width: 260px; }
.select2-container--default .select2-selection--single { height: 42px; border-color: var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); }
.select2-container--default .select2-selection--single .select2-selection__rendered { padding-right: 36px; padding-left: 14px; color: var(--text); line-height: 40px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; right: 8px; }
.select2-container--default .select2-selection--multiple { min-height: 42px; border-color: var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); padding: 4px 7px; }
.select2-container--default.select2-container--focus .select2-selection--multiple, .select2-container--default.select2-container--focus .select2-selection--single { border-color: rgba(124,92,255,.55); box-shadow: 0 0 0 .2rem rgba(124,92,255,.14); }
.select2-container--default .select2-selection--multiple .select2-selection__choice { border-color: rgba(124,92,255,.24); border-radius: 999px; background: rgba(124,92,255,.16); color: #ded9ff; font-size: .75rem; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { border-color: rgba(255,255,255,.08); color: #bdb6ff; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { background: rgba(255,255,255,.08); color: #fff; }
.select2-container--default .select2-selection--multiple .select2-search__field { color: var(--text); }
.select2-container--default .select2-selection--multiple .select2-search__field::placeholder { color: var(--muted); }
.select2-dropdown { border-color: var(--border); background: var(--surface); color: var(--text); }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: rgba(124,92,255,.35); color: #fff; }
.select2-container--default .select2-results__option--selected { background: rgba(124,92,255,.2); }
.select2-search--dropdown .select2-search__field { border-color: var(--border) !important; border-radius: 10px; background: #0c0f17; color: var(--text); }
.modal-dialog { width: 95%; margin-right: auto; margin-left: auto; }
.modal-dialog-scrollable { height: auto; max-height: 90vh; }
.modal-content { max-height: 90vh; overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.5); }
.modal-content > form { display: flex; min-height: 0; max-height: 90vh; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
.modal-header, .modal-footer { position: sticky; z-index: 5; flex: 0 0 auto; padding: 20px 24px; border-color: var(--border); background: var(--surface); }
.modal-header { top: 0; }
.modal-footer { bottom: 0; min-height: 72px; box-shadow: 0 -10px 24px rgba(9,11,18,.22); }
.modal-footer .btn { min-width: 110px; }
.modal-body { min-height: 0; padding: 24px; overflow-y: auto !important; overscroll-behavior: contain; }
.modal .form-label { color: #b9c1d0; font-size: .75rem; font-weight: 600; }
.modal .form-control, .modal .form-select { border-color: var(--border); background-color: #0c0f17; }
.permission-editor { display: flex; max-height: 340px; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 13px; }
.permission-editor-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.permission-heading { position: sticky; top: 0; z-index: 2; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; background: var(--surface-2); }
.permission-heading p { color: var(--muted); font-size: .7rem; }
.permission-module { display: grid; grid-template-columns: 130px 1fr; gap: 18px; align-items: start; padding: 15px 18px; border-top: 1px solid var(--border); }
.permission-module > strong { padding-top: 7px; color: #dbe0ea; font-size: .77rem; }
.permission-actions { display: grid; grid-template-columns: repeat(5, minmax(105px, 1fr)); gap: 10px; }
.permission-actions label span { display: block; margin-bottom: 5px; color: #7d879c; font-size: .63rem; text-transform: uppercase; }
.field-template-editor { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; }
.field-template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-height: 350px; padding: 18px; overflow-y: auto; scrollbar-gutter: stable; }
.upload-panel .form-label { color: #b9c1d0; font-size: .75rem; font-weight: 600; }
.upload-panel .form-control, .upload-panel .form-select { border-color: var(--border); background-color: #0c0f17; color: #eef1f7; }
.upload-panel .btn-primary { border: 0; background: linear-gradient(135deg, #8468ff, #6548e5); box-shadow: 0 9px 24px rgba(124,92,255,.2); }
.upload-panel .btn-outline-secondary.disabled { pointer-events: none; opacity: .45; }
.status-badge:not(.active):not(.inactive) { color: #ffd27a; background: rgba(255,190,92,.1); }
.status-badge:not(.active):not(.inactive) i { background: #ffbe5c; }
.dt-container .dt-search input, .dt-container .dt-length select { border: 1px solid var(--border) !important; background: #0c0f17 !important; color: #fff !important; }
.dt-container .dt-info, .dt-container .dt-length, .dt-container .dt-search { color: var(--muted) !important; font-size: .72rem; }
.table-panel .dt-container { width: 100%; }
.table-panel .dt-layout-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 18px; margin: 0; padding: 12px 2px; }
.table-panel .dt-layout-row:first-child { padding-top: 2px; padding-bottom: 17px; }
.table-panel .dt-layout-row:last-child { padding-top: 18px; padding-bottom: 0; border-top: 1px solid var(--border); }
.table-panel .dt-layout-cell { min-width: 0; }
.table-panel .dt-layout-end { margin-left: auto; text-align: right; }
.table-panel .dt-search label, .table-panel .dt-length label { margin-right: 7px; }
.table-panel .dt-search input { min-width: 210px; min-height: 36px; margin-left: 7px !important; border-radius: 9px !important; }
.table-panel .dt-length select { min-height: 36px; border-radius: 9px !important; }
.table-panel .dt-paging { display: flex; justify-content: flex-end; }
.table-panel .dt-paging nav { display: flex; justify-content: flex-end; gap: 4px; }
.table-panel .dt-paging .dt-paging-button { min-width: 34px; height: 34px; margin: 0 2px !important; border: 1px solid var(--border) !important; border-radius: 8px !important; background: #0c0f17 !important; color: #9ca6b9 !important; }
.table-panel .dt-paging .dt-paging-button.current, .table-panel .dt-paging .dt-paging-button:hover { border-color: rgba(124,92,255,.4) !important; background: rgba(124,92,255,.16) !important; color: #fff !important; }
.table-panel .dt-paging .dt-paging-button.disabled { opacity: .35; }
.role-cell { display: flex; align-items: center; gap: 11px; }
.role-icon { flex: 0 0 38px; display: grid; place-items: center; height: 38px; border-radius: 11px; background: rgba(124,92,255,.12); color: #a895ff; font-size: 1rem; }
.role-cell > div { display: flex; min-width: 0; flex-direction: column; }
.role-cell strong { color: #eef1f7; font-size: .82rem; }
.role-cell small { max-width: 280px; overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.permission-count { color: #a895ff; font-weight: 600; }
.role-permission-grid { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; }
.permission-grid-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 19px; background: var(--surface-2); }
.permission-grid-heading p { color: var(--muted); font-size: .7rem; }
.permission-grid-tools { display: flex; gap: 7px; }
.permission-grid-scroll { max-height: 360px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.permission-grid-table { width: 100%; min-width: 700px; border-collapse: collapse; }
.permission-grid-table th, .permission-grid-table td { padding: 13px 16px; border-top: 1px solid var(--border); text-align: center; }
.permission-grid-table thead th { position: sticky; top: 0; z-index: 2; color: #7d879c; background: #0e111a; font-size: .65rem; letter-spacing: .06em; text-transform: uppercase; }
.permission-grid-table th:first-child { width: 180px; text-align: left; }
.permission-grid-table tbody th { color: #dbe0ea; font-size: .76rem; }
.permission-grid-table .form-check-input { width: 1.05rem; height: 1.05rem; cursor: pointer; }
.permission-grid-table .form-check-input:checked { border-color: var(--primary); background-color: var(--primary); }
.protected-role-note { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border: 1px solid rgba(124,92,255,.18); border-radius: 10px; background: rgba(124,92,255,.07); color: #b8acf4; font-size: .75rem; }
.protected-role-note.d-none { display: none; }
.confirmation-modal { padding: 34px; text-align: center; }
.confirmation-modal .danger-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 16px; background: rgba(255,102,124,.1); color: #ff8294; font-size: 1.35rem; }
.confirmation-modal p { margin: 10px 0 24px; color: var(--muted); font-size: .8rem; }
.settings-layout { display: grid; gap: 18px; }
.settings-card { padding: 24px; }
.settings-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.settings-card-heading .metric-icon { flex-basis: 42px; height: 42px; }
.settings-card-heading p { margin: 0; color: var(--muted); font-size: .72rem; }
.settings-card .form-label, .log-filters .form-label { color: #b9c1d0; font-size: .73rem; font-weight: 600; }
.settings-card .form-control, .settings-card .form-select, .settings-card .input-group-text, .log-filters .form-control, .log-filters .form-select { border-color: var(--border); background-color: #0c0f17; color: #eef1f7; }
.settings-card .input-group-text { color: var(--muted); }
.settings-actions { display: flex; justify-content: flex-end; position: sticky; bottom: 16px; z-index: 10; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: rgba(17,21,32,.94); backdrop-filter: blur(12px); }
.settings-actions .btn-primary, .log-filters .btn-primary { border: 0; background: linear-gradient(135deg, #8468ff, #6548e5); }
.log-filters { padding: 20px; }
.log-module { display: inline-flex; padding: 5px 9px; border-radius: 18px; background: rgba(124,92,255,.1); color: #ad9cff; font-size: .67rem; text-transform: capitalize; }
.log-action { display: flex; max-width: 280px; flex-direction: column; }
.log-action strong { color: #dce1eb; font-size: .76rem; font-weight: 600; text-transform: capitalize; }
.log-action small { overflow: hidden; color: var(--muted); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.log-user-agent { display: block; max-width: 260px; overflow: hidden; color: #8e98ad; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.table-panel code { color: #72c5ff; font-size: .68rem; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; z-index: 1030; background: rgba(0,0,0,.62); }
    .app-main { margin-left: 0; }
    .compare-filter-grid { grid-template-columns: 1fr 1fr; }
    .compare-filter-batch { grid-column: 1 / -1; min-width: 0; }
}
@media (max-width: 767.98px) {
    .topbar, .content-area { padding-left: 20px; padding-right: 20px; }
    .content-area { padding-top: 24px; }
    .hero-panel { padding: 25px; }
    .hero-icon { display: none; }
    .checklist { grid-template-columns: 1fr; }
    .app-footer { padding: 18px 20px; }
    .auth-card { padding: 30px 23px; }
    .page-toolbar { align-items: stretch; gap: 18px; flex-direction: column; padding-top: 2px; }
    .page-toolbar > .btn { width: 100%; align-self: stretch; margin-left: 0; }
    .table-panel { padding: 14px 14px 18px; }
    .table-panel .dt-layout-row { align-items: stretch; gap: 12px; flex-direction: column; }
    .table-panel .dt-layout-end { width: 100%; margin-left: 0; text-align: left; }
    .table-panel .dt-search { display: flex; align-items: center; }
    .table-panel .dt-search input { min-width: 0; flex: 1 1 auto; }
    .table-panel .dt-info { text-align: center; }
    .table-panel .dt-paging, .table-panel .dt-paging nav { justify-content: center; }
    .permission-module { grid-template-columns: 1fr; }
    .permission-actions { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .field-template-grid { grid-template-columns: 1fr; max-height: 320px; }
    .modal-dialog { width: 95%; max-width: 95%; margin: .75rem auto; }
    .modal-dialog-scrollable { height: auto; max-height: 90vh; }
    .modal-content, .modal-content > form { max-height: 90vh; }
    .modal-header, .modal-footer { padding: 15px 16px; }
    .modal-body { padding: 16px; }
    .modal-footer { min-height: 66px; flex-wrap: nowrap; }
    .modal-footer .btn { min-width: 0; flex: 1 1 0; }
    .permission-editor { max-height: 300px; }
    .permission-heading { align-items: flex-start; flex-direction: column; }
    .permission-grid-heading { align-items: flex-start; flex-direction: column; }
    .permission-grid-scroll { max-height: 320px; }
    .compare-filter-grid { grid-template-columns: 1fr; }
    #compareResultsTable { table-layout: auto; }
    #compareResultsTable thead { display: none; }
    #compareResultsTable tbody tr { display: grid; gap: 10px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: rgba(255,255,255,.02); }
    #compareResultsTable tbody td { display: block; border: 0; padding: 0; }
    #compareResultsTable tbody td:last-child { text-align: left !important; }
    .compare-stack-source, .compare-stack-admin, .compare-stack-transaction { max-width: 100%; }
}
