:root {
    --primary: #4e73df;
    --primary-dark: #2e59d9;
    --primary-light: #7c9ef5;
    --secondary: #858796;
    --secondary-dark: #6c6e80;
    --success: #1cc88a;
    --success-dark: #17a673;
    --info: #36b9cc;
    --info-dark: #2a96ad;
    --warning: #f6c23e;
    --warning-dark: #d4a017;
    --danger: #e74a3b;
    --danger-dark: #c0392b;
    --dark: #2c3e50;
    --dark-light: #34495e;
    --dark-lighter: #3d5366;
    --body-bg: #f8f9fc;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #3d5366;
    --sidebar-active: #4e73df;
    --sidebar-text: #adb5bd;
    --sidebar-text-active: #ffffff;
    --card-bg: #ffffff;
    --card-border: #e3e6f0;
    --text-primary: #2c3e50;
    --text-secondary: #858796;
    --text-muted: #b7b9cc;
    --border-color: #e3e6f0;
    --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-sm: 0.8rem;
    --font-size-xs: 0.7rem;
    --font-size-lg: 1.2rem;
    --font-size-xl: 1.5rem;
    --border-radius: 0.35rem;
    --border-radius-lg: 0.5rem;
    --border-radius-sm: 0.25rem;
    --box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --box-shadow-sm: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.05);
    --box-shadow-lg: 0 0.35rem 1.6rem 0 rgba(58, 59, 69, 0.2);
    --transition: all 0.2s ease-in-out;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: #0f0f1a;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-sm);
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--box-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1rem 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--card-border);
    padding: 0.75rem 1.25rem;
}

.backend-logs-table-wrap .table-responsive {
    overflow-x: auto;
}

/* KPI Cards */
.backend-log-details-row > td {
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.12);
}

.backend-log-details-panel {
    max-width: 100%;
    max-height: 20rem;
    overflow: auto;
}

.backend-log-details-panel pre {
    width: max-content;
    min-width: 100%;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-sm);
    padding: 1.25rem;
    border-left: 4px solid var(--primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(78, 115, 223, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.kpi-card.success {
    border-left-color: var(--success);
}

.kpi-card.danger {
    border-left-color: var(--danger);
}

.kpi-card.warning {
    border-left-color: var(--warning);
}

.kpi-card.info {
    border-left-color: var(--info);
}

.kpi-card .kpi-icon {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0;
}

.kpi-card .kpi-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.kpi-card .kpi-change {
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.kpi-change.up {
    color: var(--success);
}

.kpi-change.down {
    color: var(--danger);
}

/* Chart Containers */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    padding: 0.5rem;
}

.chart-container-sm {
    height: 200px;
}

.chart-container-lg {
    height: 400px;
}

.chart-container canvas {
    max-height: 100%;
    width: 100% !important;
}

.chart-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: var(--font-size-sm);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* DataTable Custom Styles */
.dataTables_wrapper .dataTables_length {
    margin-bottom: 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: var(--font-size-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.15);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: var(--font-size-sm);
    outline: none;
    transition: var(--transition);
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.15);
}

table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
}

table.dataTable thead th {
    background: var(--body-bg);
    color: var(--text-primary);
    font-weight: 700;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.7rem 1rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting::after {
    opacity: 0.3;
}

table.dataTable thead th.sorting_asc::before,
table.dataTable thead th.sorting_desc::after {
    opacity: 1;
    color: var(--primary);
}

table.dataTable tbody tr {
    transition: var(--transition);
}

table.dataTable tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.04);
}

table.dataTable tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: var(--font-size-sm);
    vertical-align: middle;
}

table.dataTable tbody tr.selected {
    background-color: rgba(78, 115, 223, 0.08) !important;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 0.5rem 0;
    text-align: right;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.3rem 0.6rem;
    font-size: var(--font-size-sm);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    margin: 0 1px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

table.dataTable th,
table.dataTable td {
    text-align: left !important;
}

.dataTables_display .dataTables_info {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    padding: 0.5rem 0;
}

/* Form Styles */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--body-bg);
    opacity: 0.7;
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 0.15rem rgba(231, 74, 59, 0.15);
}

.form-control.is-valid {
    border-color: var(--success);
}

.form-control.is-valid:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 0.15rem rgba(28, 200, 138, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    display: block;
}

.form-text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    width: 100%;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.15);
    outline: none;
}

.input-group .btn {
    border-color: var(--border-color);
}

.input-group .form-control {
    border-right: none;
}

.input-group .form-control:focus {
    z-index: 1;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.invalid-feedback {
    font-size: var(--font-size-xs);
    color: var(--danger);
    margin-top: 0.2rem;
}

.valid-feedback {
    font-size: var(--font-size-xs);
    color: var(--success);
    margin-top: 0.2rem;
}

/* Status Badges */
.badge-status-active {
    background-color: var(--success);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-banned {
    background-color: var(--danger);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-shadow-banned {
    background-color: var(--warning);
    color: #1a1a2e;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-pending {
    background-color: var(--info);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-succeeded {
    background-color: var(--success);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-failed {
    background-color: var(--danger);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-processing {
    background-color: var(--info);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
    animation: pulse-badge 2s infinite;
}

.badge-status-completed {
    background-color: var(--success);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-disabled {
    background-color: var(--secondary);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-refunded {
    background-color: var(--warning);
    color: #1a1a2e;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-voided {
    background-color: var(--secondary);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-fraudulent {
    background-color: var(--danger);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-deleted {
    background-color: var(--danger);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-verified {
    background-color: var(--success);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-status-alternate {
    background-color: var(--secondary);
    color: #fff;
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-weight: 600;
}

/* JSON Display */
.json-display {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
    font-size: var(--font-size-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    position: relative;
}

.json-display .json-key {
    color: #89b4fa;
    font-weight: 600;
}

.json-display .json-string {
    color: #a6e3a1;
}

.json-display .json-number {
    color: #fab387;
}

.json-display .json-boolean {
    color: #cba6f7;
}

.json-display .json-null {
    color: #f38ba8;
}

.json-display .json-bracket {
    color: #6c7086;
}

.json-display .json-comma {
    color: #6c7086;
}

.json-display-header {
    background: #181825;
    color: #a6adc8;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
    font-family: 'Fira Code', monospace;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #313244;
}

.json-display-header + .json-display {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.json-copy-btn {
    background: none;
    border: none;
    color: #89b4fa;
    cursor: pointer;
    font-size: var(--font-size-xs);
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.json-copy-btn:hover {
    background: #313244;
    color: #89b4fa;
}

/* SSE Live Tiles */
.sse-tile {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    transition: var(--transition);
    position: relative;
}

.sse-tile.connected {
    border-left: 3px solid var(--success);
}

.sse-tile.disconnected {
    border-left: 3px solid var(--danger);
}

.sse-tile.connecting {
    border-left: 3px solid var(--warning);
}

.sse-tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sse-tile-title {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sse-tile-status {
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
}

.sse-tile-status.online {
    background: rgba(28, 200, 138, 0.1);
    color: var(--success);
}

.sse-tile-status.offline {
    background: rgba(231, 74, 59, 0.1);
    color: var(--danger);
}

.sse-tile-status.waiting {
    background: rgba(246, 194, 62, 0.1);
    color: var(--warning);
}

.sse-tile-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.sse-tile-detail {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.sse-tile-updated {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.sse-tile-content {
    min-height: 40px;
    display: flex;
    align-items: center;
}

.sse-tile-flash {
    animation: sse-flash 0.5s ease-out;
}

@keyframes sse-flash {
    0% { background: rgba(78, 115, 223, 0.15); }
    100% { background: transparent; }
}

/* Responsive adjustments */
@media (max-width: 1199.98px) {
    .kpi-card .kpi-value {
        font-size: 1.4rem;
    }

    .chart-container {
        height: 250px;
    }
}

@media (max-width: 991.98px) {
    .kpi-card .kpi-value {
        font-size: 1.2rem;
    }

    .chart-container {
        height: 220px;
    }

    .sse-tile-value {
        font-size: 1.2rem;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 0.5rem 0.6rem;
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 767.98px) {
    .kpi-card .kpi-value {
        font-size: 1.1rem;
    }

    .chart-container {
        height: 200px;
    }

    .json-display {
        font-size: var(--font-size-xs);
        max-height: 300px;
    }

    .card-body {
        padding: 0.75rem;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }

    .modal-xl {
        max-width: 100%;
        margin: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .kpi-card {
        padding: 0.75rem;
    }

    .kpi-card .kpi-value {
        font-size: 1rem;
    }

    .kpi-card .kpi-label {
        font-size: var(--font-size-xs);
    }

    .sse-tile {
        padding: 0.5rem;
    }

    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
    background: var(--body-bg);
}

.modal-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
    background: var(--body-bg);
}

.modal-backdrop {
    background: rgba(44, 62, 80, 0.6);
    backdrop-filter: blur(4px);
}

.modal-xl {
    max-width: 900px;
}

.modal-lg {
    max-width: 700px;
}

.modal-sm {
    max-width: 400px;
}

.modal-header .btn-close {
    opacity: 0.6;
    transition: var(--transition);
}

.modal-header .btn-close:hover {
    opacity: 1;
}

/* Loading / Spinner Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--card-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
    display: inline-block;
    vertical-align: middle;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--border-radius-lg);
}

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

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading-text {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
    display: inline-block;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 10px;
    width: 60%;
}

.skeleton-block {
    height: 100px;
    width: 100%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Scrollbar Customizations */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--body-bg);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
    transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

::-webkit-scrollbar-corner {
    background: var(--body-bg);
}

/* Sidebar Overrides (AdminLTE 4) */
.app-sidebar {
    background-color: var(--sidebar-bg) !important;
    overflow: hidden;
}

.app-sidebar .sidebar-brand {
    background: rgba(0, 0, 0, 0.15);
}

.app-sidebar .sidebar-menu > .nav-item > .nav-link {
    color: var(--sidebar-text) !important;
    padding: 0.65rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: var(--transition);
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none !important;
}

.app-sidebar .sidebar-menu > .nav-item > .nav-link:hover {
    background: var(--sidebar-hover) !important;
    color: var(--sidebar-text-active) !important;
}

.app-sidebar .sidebar-menu > .nav-item > .nav-link.active {
    background: var(--sidebar-active) !important;
    color: var(--sidebar-text-active) !important;
    font-weight: 700;
}

.app-sidebar .sidebar-menu > .nav-item > .nav-link .nav-icon {
    width: 24px;
    text-align: center;
    font-size: 1rem;
}

.app-sidebar .nav-header {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 1rem 1.25rem 0.4rem;
}

.app-sidebar .sidebar-wrapper {
    height: calc(100vh - 3.5rem);
    overflow-x: hidden;
    overflow-y: auto;
}

/* Top Navbar Override (AdminLTE 4) */
.app-header {
    background: #15151f !important;
    border-bottom: 1px solid var(--card-border);
    box-shadow: var(--box-shadow-sm);
    height: 56px;
}

.app-header .nav-link {
    color: var(--text-primary) !important;
    font-size: 0.85rem;
}

.app-header .dropdown-menu {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 0.5rem;
}

.app-header .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    transition: var(--transition);
}

.app-header .dropdown-item:hover {
    background: var(--body-bg);
}

/* Buttons */
.btn {
    font-weight: 600;
    font-size: var(--font-size-sm);
    border-radius: var(--border-radius);
    padding: 0.4rem 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.25);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-dark);
    border-color: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-dark);
    border-color: var(--danger-dark);
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #1a1a2e;
}

.btn-warning:hover {
    background: var(--warning-dark);
    border-color: var(--warning-dark);
}

.btn-info {
    background: var(--info);
    border-color: var(--info);
    color: #fff;
}

.btn-info:hover {
    background: var(--info-dark);
    border-color: var(--info-dark);
}

.btn-secondary {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    border-color: var(--secondary-dark);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-outline-secondary {
    border-color: var(--secondary);
    color: var(--secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--secondary);
    color: #fff;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: 0.6rem 1.5rem;
    font-size: var(--font-size-lg);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--box-shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Alert notification styles */
.alert-fixed {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-lg);
    animation: slideInRight 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.alert-dismissible .btn-close {
    padding: 0.2rem 0.5rem;
    font-size: 1rem;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--primary);
}

.toast-item.toast-success {
    border-left-color: var(--success);
}

.toast-item.toast-danger,
.toast-item.toast-error {
    border-left-color: var(--danger);
}

.toast-item.toast-warning {
    border-left-color: var(--warning);
}

.toast-item.toast-info {
    border-left-color: var(--info);
}

.toast-item .toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-item .toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.toast-item .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.toast-item.removing {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Toggle / Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-muted);
    transition: var(--transition);
    border-radius: 22px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.3);
}

/* Rollout Percentage Slider */
.rollout-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--card-border);
    outline: none;
    transition: var(--transition);
}

.rollout-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.2);
    transition: var(--transition);
}

.rollout-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 5px rgba(78, 115, 223, 0.3);
}

.rollout-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.2);
}

.rollout-value {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    min-width: 45px;
    text-align: right;
}

/* Confirmation Modal */
.confirm-modal .modal-body {
    text-align: center;
    padding: 2rem 1.5rem;
}

.confirm-modal .confirm-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.confirm-modal .confirm-icon.danger {
    color: var(--danger);
}

.confirm-modal .confirm-icon.warning {
    color: var(--warning);
}

.confirm-modal .confirm-icon.info {
    color: var(--info);
}

.confirm-modal .confirm-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.confirm-modal .confirm-message {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 1.5rem;
}

.confirm-modal .confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Clipboard Copy Button */
.clipboard-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.clipboard-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.clipboard-btn.copied {
    border-color: var(--success);
    color: var(--success);
}

.clipboard-btn.copied::after {
    content: '';
    position: absolute;
    top: -8px;
    right: 0;
    background: var(--success);
    color: #fff;
    padding: 0.15rem 0.4rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    pointer-events: none;
}

/* Pagination Styles */
.pagination {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.page-link {
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.page-link:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 1rem;
    display: block;
}

.empty-state .empty-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state .empty-text {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* Drag and Drop (SortableJS) */
.sortable-drag {
    opacity: 0.9;
    box-shadow: var(--box-shadow-lg);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    z-index: 9999;
}

.sortable-chosen {
    background: rgba(78, 115, 223, 0.05);
}

.sortable-ghost {
    opacity: 0.4;
    background: rgba(78, 115, 223, 0.08);
    border: 2px dashed var(--primary);
}

.sortable-handle {
    cursor: grab;
    color: var(--text-muted);
    transition: var(--transition);
}

.sortable-handle:hover {
    color: var(--primary);
}

.sortable-handle:active {
    cursor: grabbing;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: transparent;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(78, 115, 223, 0.04);
}

.drop-zone .drop-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.drop-zone .drop-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

/* Export Button */
.export-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.export-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--box-shadow-sm);
}

/* Table Action Bar */
.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.table-actions .btn {
    padding: 0.2rem 0.5rem;
    font-size: var(--font-size-xs);
}

/* Pagination bar */
.table-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-bottom-bar .table-info {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.table-bottom-bar .table-search {
    max-width: 250px;
}

.table-bottom-bar .table-search input {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: var(--font-size-sm);
    width: 100%;
    outline: none;
    transition: var(--transition);
}

.table-bottom-bar .table-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(78, 115, 223, 0.15);
}

/* AdminLTE Overrides */
.card-primary,
.card-info,
.card-success,
.card-warning,
.card-danger {
    border-left: none;
    border-top: none;
}

.card-primary .card-header {
    background-color: var(--primary);
    border-bottom: none;
    color: #fff;
}

.card-info .card-header {
    background-color: var(--info);
    border-bottom: none;
    color: #fff;
}

.card-success .card-header {
    background-color: var(--success);
    border-bottom: none;
    color: #fff;
}

.card-warning .card-header {
    background-color: var(--warning);
    border-bottom: none;
    color: #1a1a2e;
}

.card-danger .card-header {
    background-color: var(--danger);
    border-bottom: none;
    color: #fff;
}

/* Audit log inline */
.audit-log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.audit-log-entry:last-child {
    border-bottom: none;
}

.audit-log-timestamp {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    white-space: nowrap;
    min-width: 120px;
}

.audit-log-action {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.audit-log-detail {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Responsive Nav Tabs */
.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 600;
    font-size: var(--font-size-sm);
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Layout utility */
.app-main {
    background: var(--body-bg);
    min-height: 100vh;
}

.app-content {
    padding: 0 0.5rem 1rem;
}

.app-footer {
    background: transparent;
    border-top: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    padding: 1rem;
    text-align: center;
}

/* Section header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-header h4 {
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
}

.section-header .section-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Status dot indicator */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.4rem;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(28, 200, 138, 0.3);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(231, 74, 59, 0.3);
}

.status-dot.busy {
    background: var(--warning);
    box-shadow: 0 0 0 3px rgba(246, 194, 62, 0.3);
}

/* Responsive adjustments utilities */
.d-none-mobile { display: table-cell; }
.d-none-desktop { display: none; }

@media (max-width: 767.98px) {
    .d-none-mobile { display: none !important; }
    .d-none-desktop { display: block !important; }
}

/* Auth pages (login / setup / 2fa) — branded dark theme */
.auth-page {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%) !important;
    min-height: 100vh;
}

.auth-page .login-box {
    width: 420px;
    max-width: 92vw;
}

.auth-page .login-logo {
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(108, 99, 255, 0.35);
}

.auth-page .login-logo b {
    color: #ffffff;
}

.auth-page .card.auth-card,
.auth-page .card {
    background: rgba(26, 26, 46, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    margin-bottom: 0;
}

.auth-page .login-card-body {
    background: transparent;
}

.auth-page .card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
}

.auth-page .card-header h1,
.auth-page .card-title {
    color: #ffffff;
}

.auth-page .login-box-msg,
.auth-page .login-card-body > p {
    color: rgba(255, 255, 255, 0.7);
}

.auth-page .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

.auth-page .form-control {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.auth-page .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.auth-page .form-control:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #6c63ff;
    box-shadow: 0 0 0 0.2rem rgba(108, 99, 255, 0.25);
    color: #ffffff;
}

.auth-page .input-group-text {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}

.auth-page .input-group .form-control {
    border-right: none;
}

.auth-page .form-check-label {
    color: rgba(255, 255, 255, 0.7);
}

.auth-page .btn-primary {
    background: linear-gradient(135deg, #6c63ff 0%, #e55a8a 100%);
    border: none;
    box-shadow: 0 10px 24px rgba(108, 99, 255, 0.35);
}

.auth-page .btn-primary:hover {
    background: linear-gradient(135deg, #5a52e0 0%, #d44e7c 100%);
    box-shadow: 0 12px 28px rgba(108, 99, 255, 0.45);
}

.auth-page .alert {
    color: #ffffff;
    border: none;
}

.auth-page .alert-danger {
    background: rgba(231, 74, 59, 0.18);
    border: 1px solid rgba(231, 74, 59, 0.4);
    color: #ffb3aa;
}

.auth-page .alert-success {
    background: rgba(28, 200, 138, 0.18);
    border: 1px solid rgba(28, 200, 138, 0.4);
    color: #9ff0cf;
}

.auth-page .badge.bg-danger {
    background: linear-gradient(135deg, #6c63ff, #e55a8a) !important;
}

/* ===========================================================================
   Dark Theme
   The dashboard uses Bootstrap 5.3 theming via [data-bs-theme="dark"] plus the
   custom CSS variables below. Components reference these variables, so flipping
   them here restyles the whole admin area to match the branded dark auth pages.
   =========================================================================== */
[data-bs-theme="dark"] {
    --body-bg: #0f0f1a;
    --sidebar-bg: #15151f;
    --sidebar-hover: #232336;
    --sidebar-active: #4e73df;
    --sidebar-text: #a0a4b8;
    --sidebar-text-active: #ffffff;
    --card-bg: #15151f;
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #e6e8f0;
    --text-secondary: #a6abbf;
    --text-muted: #7f849c;
    --border-color: rgba(255, 255, 255, 0.10);
    --box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.5);
    --box-shadow-sm: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.3);
    --box-shadow-lg: 0 0.35rem 1.6rem 0 rgba(0, 0, 0, 0.6);
}

[data-bs-theme="dark"] .app-header {
    background: #15151f !important;
    border-bottom-color: var(--card-border);
}

[data-bs-theme="dark"] .app-main {
    background: var(--body-bg);
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .kpi-card,
[data-bs-theme="dark"] .sse-tile,
[data-bs-theme="dark"] .toast-item {
    background: var(--card-bg);
    border-color: var(--card-border);
}

[data-bs-theme="dark"] table.dataTable tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.14);
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(15, 15, 26, 0.85);
}

[data-bs-theme="dark"] .spinner-overlay {
    background: rgba(15, 15, 26, 0.8);
}

[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1a1a2e 25%, #2a2a3e 50%, #1a1a2e 75%);
}

[data-bs-theme="dark"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

[data-bs-theme="dark"] .audit-log-entry,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: var(--card-border);
}

/* The .bg-warning boxes are bright yellow; force dark text for contrast in both themes */
.small-box.bg-warning,
.small-box.bg-warning .inner,
.small-box.bg-warning p {
    color: #1a1a2e !important;
}

.info-box .info-box-icon.bg-warning,
.info-box .info-box-icon.bg-warning i {
    color: #1a1a2e !important;
}
