/*
 * Profit Shop Admin Panel - Premium Metronic/Tailwind SaaS Aesthetic
 * Synced with Android App's Premium Theme
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* CSS Variables - Premium Color System */
:root {
    /* Primary Colors from Android Theme */
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --primary-light: #DBEAFE;
    
    /* Secondary Colors */
    --secondary: #8B5CF6;
    --secondary-dark: #7C3AED;
    --secondary-light: #F3E8FF;
    
    /* Surface System */
    --background: #F4F7FE;
    --surface: #FFFFFF;
    --surface-variant: #F9FAFB;
    --surface-elevated: #FFFFFF;
    
    /* Text Colors — high-contrast for readability */
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --text-inverse: #FFFFFF;
    
    /* Status Colors */
    --success: #10B981;
    --success-dark: #047857;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-dark: #B45309;
    --warning-light: #FEF3C7;
    --error: #EF4444;
    --error-dark: #B91C1C;
    --error-light: #FEE2E2;
    --info: #3B82F6;
    --info-dark: #1D4ED8;
    --info-light: #DBEAFE;
    
    /* Borders & Shadows */
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 17px;
    --font-size-xl: 20px;
    --font-size-2xl: 26px;
    --font-size-3xl: 34px;
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    
    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
}

/* Global Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

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

/* Premium Card Styles — translucent 3D glassmorphism surface.
   The four explicit edges (light top/left, dark bottom/right) create the
   floating glass pane look without a heavy outer stroke. */
.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.3));
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    box-shadow: 8px 8px 32px 0 rgba(31, 38, 135, 0.04),
                inset 2px 2px 5px rgba(255, 255, 255, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    color: var(--text-primary);
}

/* Shadow-only hover for the generic card: tables, charts and their action
   buttons must never shift while the pointer moves across the surface.
   Interactive cards opt into the lift with .stat-card / .card-hover. */
.card:hover {
    box-shadow: 12px 12px 38px 0 rgba(31, 38, 135, 0.10),
                inset 2px 2px 5px rgba(255, 255, 255, 0.7);
}

.card-hover:hover,
.interactive-card:hover {
    transform: translateY(-4px);
    box-shadow: 16px 18px 42px -12px rgba(31, 38, 135, 0.20),
                0 10px 24px -12px rgba(31, 38, 135, 0.16),
                inset 2px 2px 5px rgba(255, 255, 255, 0.8);
}

.card-header,
.card-body,
.card-footer {
    padding: var(--spacing-md);
    color: var(--text-primary);
}

.card-header {
    background-color: rgba(255, 255, 255, 0.26);
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: var(--font-weight-semibold);
    color: #111827;
}

.card-footer {
    background-color: rgba(255, 255, 255, 0.22);
    border-top: 1px solid rgba(15, 23, 42, 0.05);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 0;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

/* Premium 3D Glassmorphism Surfaces (Dashboard)
   Shares the exact global card surface while adding the floating sheen. */
.stat-card,
.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.3));
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    box-shadow: 8px 8px 32px 0 rgba(31, 38, 135, 0.04),
                inset 2px 2px 5px rgba(255, 255, 255, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* No colored top accent — the glass edge provides the depth instead. */
.stat-card::before,
.glass-card::before {
    display: none;
}

/* Soft diagonal sheen for the glass surface. */
.stat-card::after,
.glass-card::after {
    content: '';
    position: absolute;
    top: -45%;
    right: -20%;
    width: 190px;
    height: 190px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 16px 18px 42px -12px rgba(31, 38, 135, 0.20),
                0 10px 24px -12px rgba(31, 38, 135, 0.16),
                inset 2px 2px 5px rgba(255, 255, 255, 0.8);
}

/* Dashboard widgets share the glass surface but must not lift/move while
   the pointer is over a chart or an action row. */
.glass-card:hover {
    box-shadow: 12px 12px 40px 0 rgba(31, 38, 135, 0.10),
                inset 2px 2px 5px rgba(255, 255, 255, 0.85);
}

.stat-card .card-body,
.glass-card .card-body {
    position: relative;
    z-index: 1;
    padding: 1.4rem 1.5rem;
}

/* Floating neumorphic 3D icon wrapper. */
.stat-icon {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    box-shadow: 5px 5px 10px #d1d1d1, -5px -5px 10px #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.9);
    color: var(--stat-accent, var(--primary));
    font-weight: 700;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.4s ease;
}

.stat-card:hover .stat-icon {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 6px 6px 12px #d1d1d1, -6px -6px 12px #ffffff;
}

.stat-icon i { line-height: 1; }

/* Reusable floating neumorphic orbs for small icons, indicators and
   counters. Keeps those micro-surfaces consistent with .stat-icon. */
.icon-orb,
.icon-orb-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff, #e9eefb);
    border: 1px solid rgba(255, 255, 255, 0.9);
    color: #4f46e5;
    line-height: 1;
    box-shadow: 4px 4px 10px rgba(31, 38, 135, 0.10),
                -4px -4px 10px rgba(255, 255, 255, 0.95),
                inset 1px 1px 2px rgba(255, 255, 255, 0.9);
}

.icon-orb {
    width: 46px;
    height: 46px;
    font-size: 1.15rem;
}

.icon-orb-sm {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    box-shadow: 3px 3px 7px rgba(31, 38, 135, 0.10),
                -3px -3px 7px rgba(255, 255, 255, 0.95),
                inset 1px 1px 2px rgba(255, 255, 255, 0.9);
}

.stat-icon-primary {
    --stat-accent: #2563EB;
}

.stat-icon-success {
    --stat-accent: #047857;
}

.stat-icon-warning {
    --stat-accent: #B45309;
}

.stat-icon-danger {
    --stat-accent: #DC2626;
}

.stat-icon-info {
    --stat-accent: #1D4ED8;
}

.stat-icon-secondary {
    --stat-accent: #475569;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 0.4rem;
}

/* ---------------------------------------------------------
   Dashboard widgets (activity chart + recent withdrawals)
   --------------------------------------------------------- */
.widget-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.15rem;
}

.widget-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    margin: 0;
}

.widget-sub {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    margin: 0.2rem 0 0;
}

.widget-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    color: #4338ca;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.widget-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: #4f46e5;
    text-decoration: none;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}

.widget-link:hover,
.widget-link:focus-visible {
    background: rgba(99, 102, 241, 0.12);
    color: #3730a3;
}

.dashboard-chart-wrap {
    position: relative;
    width: 100%;
    height: 300px;
    flex: 1 1 300px;
    min-height: 300px;
}

.dashboard-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Recent withdrawals */
.withdraw-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.withdraw-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.withdraw-item:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(2px);
    box-shadow: 0 6px 16px rgba(31, 38, 135, 0.07),
                inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.withdraw-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.withdraw-info {
    flex: 1 1 auto;
    min-width: 0;
}

.withdraw-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.withdraw-meta {
    font-size: 0.72rem;
    font-weight: 500;
    color: #7c8aa0;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.withdraw-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.withdraw-amount {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    white-space: nowrap;
}

.withdraw-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.28);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 2px 6px rgba(31, 38, 135, 0.06);
    color: #4338ca;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.withdraw-view:hover,
.withdraw-view:focus-visible {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.withdraw-empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    color: #64748b;
}

.withdraw-empty-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 0.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #047857;
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    box-shadow: 5px 5px 10px #d1d1d1, -5px -5px 10px #ffffff;
}

@media (max-width: 575.98px) {
    .glass-card .card-body {
        padding: 1.15rem;
    }

    .dashboard-chart-wrap {
        height: 240px;
        min-height: 240px;
        flex-basis: 240px;
    }

    .withdraw-item {
        padding: 0.65rem;
        gap: 0.6rem;
    }
}

/* Modern Navigation Sidebar */
.admin-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--background);
}

.admin-sidebar {
    width: 280px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-md);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
}

.brand-mark {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.brand-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.admin-nav {
    flex: 1;
    padding: var(--spacing-sm);
}

.admin-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 11px var(--spacing-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: var(--spacing-xs);
}

.admin-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.admin-link.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-weight: var(--font-weight-semibold);
}

.admin-link i {
    font-size: 19px;
    width: 22px;
    text-align: center;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: var(--font-size-base);
}

/* Premium Top Navbar */
.admin-topbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: 72px;
}

.topbar-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
}

/* Premium Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success-dark);
    border: 1px solid var(--success-light);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning-light);
}

.badge-danger {
    background-color: var(--error-light);
    color: var(--error-dark);
    border: 1px solid var(--error-light);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info-dark);
    border: 1px solid var(--info-light);
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary-light);
}

/* Modern Table Styles — translucent rows that sit *inside* the glass card
   instead of looking like a second solid white panel. */
.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    background-color: transparent;
    border: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: none;

    /* Neutralise Bootstrap's own table paint variables so each row can use
       the shared translucent hover tint. */
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: rgba(0, 0, 0, 0.03);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.22);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-active-bg: rgba(79, 70, 229, 0.08);
    --bs-table-active-color: var(--text-primary);
    --bs-table-hover-bg: rgba(79, 70, 229, 0.06);
    --bs-table-hover-color: var(--text-primary);
}

/* Remove Bootstrap's inset row paint (it would block the glass behind). */
.table > :not(caption) > * > * {
    background-color: transparent;
    box-shadow: none;
}

.table thead {
    background-color: rgba(255, 255, 255, 0.34);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.table thead th,
.table thead.table-light th {
    padding: 0.95rem var(--spacing-lg);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background-color: rgba(255, 255, 255, 0.34);
    border: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    vertical-align: middle;
    white-space: nowrap;
}

.table thead.table-light {
    --bs-table-bg: transparent;
    --bs-table-color: #475569;
    background-color: rgba(255, 255, 255, 0.34);
}

.table tbody {
    color: var(--text-primary);
}

.table tbody tr {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.table tbody tr:last-child {
    border-bottom: none;
}

/* Hover tint is applied to the cells (Bootstrap paints td backgrounds).
   It NEVER controls the visibility of the action buttons. */
.table tbody tr:hover,
.table tbody tr:hover > *,
.table.table-hover > tbody > tr:hover > * {
    background-color: rgba(79, 70, 229, 0.06) !important;
    box-shadow: none !important;
}

.table td {
    padding: 0.9rem var(--spacing-lg);
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
    background-color: transparent;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-sm thead th,
.table-sm td {
    padding: 0.6rem 0.9rem;
}

/* ============================================================
   TABLE ACTION BUTTONS — always visible
   ------------------------------------------------------------
   Action controls (View / Edit / Delete / icon buttons) must be
   visible on every row at the same time. Nothing in this panel
   may hide them behind tr:hover, opacity or visibility.
   ============================================================ */
.table td .btn,
.table td .btn-group,
.table td .dropdown,
.table td .table-actions,
.table td form,
.table tbody tr .btn,
.table tbody tr:not(:hover) td .btn,
.table tbody tr:hover td .btn {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.table td .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 10px;
}

/* Action group alignment inside the last column. */
.table td .table-actions,
.table td .d-flex {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

/* "View" / "Edit": a clearly bordered primary action in every state. */
.table .btn-outline-primary {
    background-color: rgba(79, 70, 229, 0.08) !important;
    border-color: rgba(79, 70, 229, 0.55) !important;
    color: #4338ca !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.10);
}

.table .btn-outline-primary:hover,
.table .btn-outline-primary:focus {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 5px 14px rgba(79, 70, 229, 0.28);
}

/* Delete: bold, solid red on every row (not only on hover).
   Covers both `btn-danger` and `btn-outline-danger` so the destructive
   action always reads the same across pages. */
.table .btn-danger,
.table .btn-outline-danger {
    background-color: #DC2626 !important;
    border-color: #DC2626 !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.22);
}

.table .btn-danger:hover,
.table .btn-danger:focus,
.table .btn-outline-danger:hover,
.table .btn-outline-danger:focus {
    background-color: #B91C1C !important;
    border-color: #B91C1C !important;
    color: #fff !important;
    box-shadow: 0 5px 14px rgba(185, 28, 28, 0.32);
}

/* Text-style action buttons (copy / toggle / inspect) stay visible. */
.btn-link {
    color: var(--primary-dark);
    background-color: transparent;
    border-color: transparent;
    text-decoration: none;
    font-weight: 600;
}

.btn-link:hover,
.btn-link:focus {
    color: var(--primary);
    text-decoration: underline;
}

/* Compact table buttons keep a comfortable hit area. */
.table .btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: var(--font-size-xs);
    line-height: 1.4;
}

/* Action Buttons
   IMPORTANT: never set `background` or `border` on the generic `.btn` rule.
   This stylesheet loads *after* Bootstrap, so a bare `.btn { background:
   none; border: 1px solid transparent; }` has the same specificity as every
   `.btn-*` variant and wipes out their background/border — leaving white
   text on white tables (invisible until hover). Only layout props here. */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Global guard: interactive controls are never hidden before hover.
   Disabled buttons keep Bootstrap's reduced-opacity cue for accessibility. */
.btn:not(:disabled):not(.disabled),
.btn-group,
.table-actions,
.action-buttons {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Visible keyboard focus on every action button. */
.btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 13px;
    border-radius: 8px;
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .card:hover,
    .card-hover:hover,
    .interactive-card:hover,
    .stat-card:hover,
    .stat-card:hover .stat-icon,
    .btn:hover {
        transform: none !important;
    }
}

.btn-primary {
    background-color: #4F46E5;
    background-image: linear-gradient(135deg, #4F46E5, #3B82F6);
    color: #ffffff;
    border-color: #4F46E5;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #4338ca;
    background-image: linear-gradient(135deg, #4338CA, #2563EB);
    border-color: #4338ca;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.38);
}

/* Solid variants — explicit defaults so text/icons are always visible on
   white cards/tables, even before hover and even if Bootstrap is blocked. */
.btn-danger {
    background-color: #DC2626;
    border-color: #DC2626;
    color: #fff;
}

.btn-danger:hover,
.btn-danger:focus {
    background-color: #B91C1C;
    border-color: #B91C1C;
    color: #fff;
}

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

.btn-success:hover,
.btn-success:focus {
    background-color: #065F46;
    border-color: #065F46;
    color: #fff;
}

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

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

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

.btn-info:hover,
.btn-info:focus {
    background-color: #1E40AF;
    border-color: #1E40AF;
    color: #fff;
}

.btn-secondary {
    background-color: #4B5563;
    border-color: #4B5563;
    color: #fff;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #374151;
    border-color: #374151;
    color: #fff;
}

.btn-dark {
    background-color: #1F2937;
    border-color: #1F2937;
    color: #fff;
}

.btn-light {
    background-color: var(--surface-variant);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline-light:hover {
    background-color: var(--surface-variant);
    border-color: var(--border);
    color: var(--text-primary);
}

/* Outline variants — visible colored border + colored text on the default
   (unhovered) state so actions never blend into a white card/table. */
.btn-outline-danger {
    background-color: transparent;
    border-color: #DC2626;
    color: #B91C1C;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: #DC2626;
    border-color: #DC2626;
    color: #fff;
}

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

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

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

.btn-outline-warning:hover,
.btn-outline-warning:focus {
    background-color: var(--warning);
    border-color: var(--warning);
    color: #1F2937;
}

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

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

.btn-outline-secondary {
    background-color: transparent;
    border-color: #9CA3AF;
    color: #4B5563;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: #6B7280;
    border-color: #6B7280;
    color: #fff;
}

.btn-outline-dark {
    background-color: transparent;
    border-color: #1F2937;
    color: #1F2937;
}

.btn-outline-dark:hover,
.btn-outline-dark:focus {
    background-color: #1F2937;
    border-color: #1F2937;
    color: #fff;
}

/* Form Controls — frosted inputs that sit inside the glass cards. */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.6);
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
                background-color 0.2s ease;
}

.form-select {
    cursor: pointer;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #4f46e5;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: rgba(255, 255, 255, 0.35);
    opacity: 0.8;
}

.form-control::placeholder,
textarea.form-control::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* Compact variants keep the same rounded language. */
.form-control-sm,
.form-select-sm {
    border-radius: 10px;
}

/* Labels + helper text. */
.form-label {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.form-text {
    color: #64748b;
}

/* Grouped inputs: only the outer corners stay rounded. */
.input-group-text {
    background-color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    color: #475569;
    font-weight: 600;
}

.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child),
.input-group > .input-group-text:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child),
.input-group > .input-group-text:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Checkboxes / radios. */
.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.7);
    transition: border-color 0.2s ease, box-shadow 0.2s ease,
                background-color 0.2s ease;
}

.form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}

.form-check-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-check-label {
    color: #374151;
    font-size: 0.9rem;
}

/* Pill tabs used for per-page sections (tasks, vendors, payments…). */
.nav-pills {
    gap: 0.4rem;
    flex-wrap: wrap;
}

.nav-pills .nav-link {
    padding: 0.55rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background-color: rgba(255, 255, 255, 0.38);
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-pills .nav-link:hover,
.nav-pills .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.78);
    color: #3730a3;
    transform: translateY(-1px);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background: linear-gradient(135deg, #4F46E5, #3B82F6);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

/* Utility Classes — text colors use the darker shades so they stay readable
   (WCAG AA) on white cards, tables and the light page background. */
.text-primary { color: var(--primary) !important; }
.text-secondary { color: #4B5563 !important; }
.text-success { color: var(--success-dark) !important; }
.text-warning { color: var(--warning-dark) !important; }
.text-danger { color: var(--error-dark) !important; }
.text-info { color: var(--info-dark) !important; }
.text-body { color: var(--text-primary) !important; }
.text-dark { color: #1F2937 !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary-light { background-color: var(--primary-light) !important; }
.bg-secondary-light { background-color: var(--secondary-light) !important; }
.bg-success-light { background-color: var(--success-light) !important; }
.bg-warning-light { background-color: var(--warning-light) !important; }
.bg-error-light { background-color: var(--error-light) !important; }
.bg-info-light { background-color: var(--info-light) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-lg) !important; }
.p-5 { padding: var(--spacing-xl) !important; }

.m-0 { margin: 0 !important; }
.m-1 { margin: var(--spacing-xs) !important; }
.m-2 { margin: var(--spacing-sm) !important; }
.m-3 { margin: var(--spacing-md) !important; }
.m-4 { margin: var(--spacing-lg) !important; }
.m-5 { margin: var(--spacing-xl) !important; }

.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.text-center { text-align: center !important; }
.font-weight-normal { font-weight: var(--font-weight-normal) !important; }
.font-weight-medium { font-weight: var(--font-weight-medium) !important; }
.font-weight-semibold { font-weight: var(--font-weight-semibold) !important; }
.font-weight-bold { font-weight: var(--font-weight-bold) !important; }
.font-size-xs { font-size: var(--font-size-xs) !important; }
.font-size-sm { font-size: var(--font-size-sm) !important; }
.font-size-base { font-size: var(--font-size-base) !important; }
.font-size-lg { font-size: var(--font-size-lg) !important; }
.font-size-xl { font-size: var(--font-size-xl) !important; }
.font-size-2xl { font-size: var(--font-size-2xl) !important; }

/* Responsive Utilities
   The mobile off-canvas drawer (position, transform, backdrop, toggle) lives
   in admin.css, which loads after this file, so it wins the cascade. */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .table-responsive .table {
        border: none;
    }
    
    .table-responsive .table thead {
        display: none;
    }
    
    .table-responsive .table,
    .table-responsive .table tbody,
    .table-responsive .table tr,
    .table-responsive .table td {
        display: block;
        width: 100%;
    }
    
    .table-responsive .table tr {
        margin-bottom: var(--spacing-md);
        background: rgba(255, 255, 255, 0.34);
        border: 1px solid rgba(255, 255, 255, 0.7);
        border-radius: 16px;
        box-shadow: 0 8px 22px -18px rgba(31, 38, 135, 0.4);
        overflow: hidden;
    }

    .table-responsive .table tr:last-child {
        border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    }

    .table-responsive .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--spacing-sm) var(--spacing-md);
        border-bottom: 1px solid rgba(0, 0, 0, 0.03);
        background-color: transparent;
    }
    
    .table-responsive .table td::before {
        font-weight: var(--font-weight-semibold);
        color: var(--text-primary);
    }
    
    .table-responsive .table td:last-child {
        border-bottom: none;
    }
}

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

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

/* Print Styles */
@media print {
    .admin-sidebar,
    .admin-topbar,
    .btn,
    .badge {
        display: none;
    }
    
    .admin-shell {
        flex-direction: column;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border);
    }
    
    body {
        background-color: white;
        color: black;
    }
}

/* Global Background Force */
body, .main-content, .admin-shell {
    background-color: #f4f7fe !important;
    background-image: radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.1) 0, transparent 50%), radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.12) 0, transparent 50%), radial-gradient(at 0% 100%, rgba(139, 92, 246, 0.08) 0, transparent 50%) !important;
    background-attachment: fixed !important;
}

/* Global Cards (Glassmorphism) Force */
.card, .table-card, .form-card, .glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.3)) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    border-bottom-color: rgba(0, 0, 0, 0.05) !important;
    border-right-color: rgba(0, 0, 0, 0.05) !important;
    box-shadow: 8px 8px 32px 0 rgba(31, 38, 135, 0.04), inset 2px 2px 5px rgba(255, 255, 255, 0.6) !important;
    border-radius: 24px !important;
}

/* Forms and Inputs Force */
.form-control, .form-select, input[type="text"], input[type="search"] {
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: rgba(255, 255, 255, 0.5) !important;
    transition: all 0.3s ease !important;
}
.form-control:focus, .form-select:focus {
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
    border-color: #4f46e5 !important;
}

/* Sidebar Active State Force */
.sidebar-nav .nav-link.active, .nav-item > .active {
    background: linear-gradient(135deg, #4F46E5, #3B82F6) !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35) !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    border: none !important;
}

/* Fix Sidebar Inactive Text Contrast
   ---------------------------------------------------------------
   NOTE: this admin panel's sidebar markup is
   `.admin-sidebar > .admin-nav > a.admin-link` (partials/sidebar.php).
   There is no `.sidebar-nav` / `.nav-link` / `.nav-item` in the
   sidebar, so the fix is scoped to the real selectors.

   The `.admin-modern.css` `.admin-link` rules would otherwise
   win the cascade here (this file is now loaded last) and repaint
   inactive links dark (#4B5563) on the dark rail. The `.admin-sidebar`
   descendant prefix raises specificity above those bare rules. */
.admin-sidebar .admin-link {
    color: #cbd5e1 !important; /* light slate — readable on the dark rail */
    transition: all 0.3s ease !important;
}

/* Pointer hover only. Wrapping the slide animation in `hover: hover` stops
   touch devices from latching a sticky hover state (and the translateX jump)
   after a tap. */
@media (hover: hover) and (pointer: fine) {
    .admin-sidebar .admin-link:hover {
        color: #ffffff !important; /* pure white on hover */
        background: rgba(255, 255, 255, 0.08) !important;
        transform: translateX(6px) !important;
    }
}

/* Keyboard focus feedback stays on every device, without the slide. */
.admin-sidebar .admin-link:focus-visible {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.admin-sidebar .admin-link i {
    color: inherit !important; /* icons follow the link text color */
}

/* Re-assert the active item's brand gradient — the load-order swap
   exposed an earlier `.admin-link.active` light-blue rule that would
   otherwise win and flatten the pill. */
.admin-sidebar .admin-link.active,
.admin-sidebar .admin-link.active:hover,
.admin-sidebar .admin-link.active:focus-visible {
    background: linear-gradient(135deg, #4F46E5, #3B82F6) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35) !important;
}

/* =====================================================================
   MOBILE OVERRIDES  (max-width: 768px)  — must stay LAST
   ---------------------------------------------------------------------
   This file now loads after admin.css, so the `!important` rules above sit
   on top of the mobile drawer defined in admin.css. This final block
   restores the off-canvas behaviour on small screens and keeps the
   dashboard from scrolling sideways.

   Real markup (partials/sidebar.php): `.admin-sidebar` drawer toggled with
   `.sidebar-open`; backdrop is `.admin-backdrop` (partials/footer.php adds
   `.show`); toggle/close are `.admin-menu-toggle` / `.sidebar-close`.
   ===================================================================== */
@media (max-width: 768px) {
    /* --- Off-canvas drawer: take it back out of the document flow --- */
    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 250px !important;
        max-width: 85vw;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1050 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease-in-out !important;
        visibility: hidden;
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-shadow: 0 20px 50px rgba(2, 6, 23, 0.45);
    }

    /* --- Open state (JS toggles `.sidebar-open`; `.show` kept for safety) --- */
    .admin-sidebar.sidebar-open,
    .admin-sidebar.show {
        transform: translateX(0) !important;
        visibility: visible !important;
    }

    /* --- Drawer controls + backdrop must be visible and tappable --- */
    .admin-menu-toggle,
    .sidebar-close {
        display: inline-flex !important;
    }
    .admin-brand {
        padding-right: 3.25rem;
    }
    .admin-backdrop {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        z-index: 1040 !important;
        background: rgba(15, 23, 42, 0.55);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .admin-backdrop.show {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* --- Single-column layout: no horizontal scrolling --- */
    .admin-shell {
        flex-direction: column !important;
    }
    .admin-main {
        width: 100% !important;
    }
    .admin-content {
        padding: 1rem !important;
        max-width: 100% !important;
        overflow-x: hidden;
    }

    .card,
    .table-card,
    .form-card,
    .glass-card,
    .stat-card {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem !important;
    }

    /* Grid children fill the row instead of forcing an intrinsic width. */
    .admin-content .row,
    .admin-content .row > [class*="col"] {
        max-width: 100% !important;
    }

    /* Charts / canvases and media never push the page wider than the screen. */
    canvas,
    .chart-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    img,
    table {
        max-width: 100%;
    }
}

/* =====================================================================
   SETTINGS TABLE — "App settings" floating glass rows
   ---------------------------------------------------------------------
   Scoped to `.settings-table` (settings.php) so the rest of the admin's
   tables keep their compact layout. The pill/row geometry is limited to
   >=769px; on small screens the stacked-card table rules above win.
   ===================================================================== */

/* KEY column: a developer-style key badge. */
.settings-table .settings-key {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;
    color: #4338ca !important;
    background: rgba(224, 231, 255, 0.7) !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    border: 1px solid #c7d2fe !important;
    font-size: 0.8125rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.9),
                0 2px 6px rgba(67, 56, 202, 0.08);
}

@media (min-width: 769px) {
    /* Separated rows: no shared borders, 12px vertical breathing room. */
    .settings-table {
        border-collapse: separate !important;
        border-spacing: 0 12px !important;
        background: transparent !important;
    }

    /* Room for the lifted row's shadow inside the scroll wrapper. */
    .settings-table-wrap {
        padding: 6px 4px 18px;
    }

    .settings-table thead th {
        padding: 16px !important;
        vertical-align: middle !important;
        border: none !important;
        background: transparent !important;
        color: #64748b !important;
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        box-shadow: none !important;
    }

    /* Each row is a floating glass pill. Radius lives on the row so the
       background and shadow share the same rounded clipping box. */
    .settings-table tbody tr {
        background: rgba(255, 255, 255, 0.5) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 15px rgba(31, 38, 135, 0.03) !important;
        transition: all 0.3s ease !important;
        position: relative;
    }

    /* Cells stay transparent so the row surface reads as one pill. */
    .settings-table tbody td {
        vertical-align: middle !important;
        padding: 16px !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    /* Safety radius on the edge cells (helps browsers that do not clip a
       table-row's background to its own border-radius). */
    .settings-table tbody td:first-child {
        border-radius: 12px 0 0 12px !important;
    }

    .settings-table tbody td:last-child {
        border-radius: 0 12px 12px 0 !important;
    }

    /* Beat the global purple row-hover tint from admin-modern.css. */
    .settings-table.table tbody tr:hover > td {
        background: transparent !important;
    }

    /* Value form: input and buttons share one centred axis.
       `nowrap` is required — a global `.table td .d-flex` rule forces
       flex-wrap, which would push the buttons under the input. */
    .settings-row-form {
        display: flex;
        flex-wrap: nowrap !important;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

    .settings-table .settings-row-form .form-control {
        flex: 1 1 140px;
        min-width: 110px;
        margin: 0;
    }

    .settings-table .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        border-radius: 10px !important;
        box-shadow: 0 3px 10px rgba(31, 38, 135, 0.08);
    }

    .settings-table .settings-delete {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        padding: 0 !important;
        font-size: 0.95rem;
    }
}

/* Gentle 3D lift — pointer devices only, so touch taps never latch it. */
@media (hover: hover) and (pointer: fine) and (min-width: 769px) {
    .settings-table tbody tr:hover {
        transform: translateY(-3px);
        background: rgba(255, 255, 255, 0.8) !important;
        box-shadow: 0 8px 25px rgba(31, 38, 135, 0.08) !important;
        z-index: 2;
    }
}

/* Mobile: very long keys wrap instead of overflowing the stacked card. */
@media (max-width: 768px) {
    .settings-table .settings-key {
        white-space: normal;
        overflow-wrap: anywhere;
        max-width: 100%;
    }
}

/* =====================================================================
   DASHBOARD — Recent Transactions table
   ---------------------------------------------------------------------
   Sits in the same `.glass-card` shell as the chart/withdrawals widgets.
   Rows are soft translucent pills so the ledger reads as part of the
   glass surface instead of a legacy table.
   ===================================================================== */
.txn-table-wrap {
    margin: -0.35rem 0 0;
}

.txn-table {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    background: transparent !important;
}

.txn-table thead th {
    padding: 2px 12px 6px !important;
    border: none !important;
    background: transparent !important;
    color: #64748b !important;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.txn-table tbody tr {
    background: rgba(255, 255, 255, 0.42) !important;
    border-radius: 14px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: background 0.2s ease, box-shadow 0.2s ease,
                transform 0.2s ease;
}

.txn-table tbody td {
    padding: 10px 12px !important;
    border: none !important;
    vertical-align: middle !important;
    background: transparent !important;
    box-shadow: none !important;
}

.txn-table tbody td:first-child {
    border-radius: 14px 0 0 14px !important;
}

.txn-table tbody td:last-child {
    border-radius: 0 14px 14px 0 !important;
}

/* Beat the global purple row-hover tint. */
.txn-table.table tbody tr:hover > td {
    background: transparent !important;
}

.txn-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    text-decoration: none;
}

.txn-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.txn-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.txn-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-user-ref {
    font-size: 0.68rem;
    font-weight: 500;
    color: #94a3b8;
    line-height: 1.3;
}

.txn-amount {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.txn-type {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.txn-type i {
    color: #6366f1;
    font-size: 0.85rem;
}

.txn-date {
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.txn-table .badge {
    padding: 0.35em 0.62em;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Translucent status chips read better on the glass surface than the
   fully saturated Bootstrap defaults, while keeping AA contrast. */
.txn-table .badge.text-bg-warning {
    background: rgba(245, 158, 11, 0.16) !important;
    border-color: rgba(245, 158, 11, 0.32);
    color: #b45309 !important;
}

.txn-table .badge.text-bg-success {
    background: rgba(16, 185, 129, 0.14) !important;
    border-color: rgba(16, 185, 129, 0.3);
    color: #047857 !important;
}

.txn-table .badge.text-bg-info {
    background: rgba(59, 130, 246, 0.14) !important;
    border-color: rgba(59, 130, 246, 0.3);
    color: #1d4ed8 !important;
}

.txn-table .badge.text-bg-danger {
    background: rgba(239, 68, 68, 0.14) !important;
    border-color: rgba(239, 68, 68, 0.3);
    color: #b91c1c !important;
}

/* Pending-tasks list: let long task titles wrap to two lines instead of
   truncating to an ellipsis. */
.pending-task-list .withdraw-name,
.pending-task-list .withdraw-meta {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.pending-task-list .withdraw-meta {
    line-height: 1.4;
}

.widget-sample-note {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: #7c8aa0;
}

@media (hover: hover) and (pointer: fine) {
    .txn-table tbody tr:hover {
        background: rgba(255, 255, 255, 0.72) !important;
        box-shadow: 0 6px 18px rgba(31, 38, 135, 0.07),
                    inset 0 1px 0 rgba(255, 255, 255, 0.95);
        transform: translateY(-1px);
    }
}

/* Small screens: drop the least-critical Date column so the ledger stays
   readable instead of scrolling sideways. */
@media (max-width: 575.98px) {
    .txn-table thead th,
    .txn-table tbody td {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .txn-col-date {
        display: none !important;
    }

    .txn-user-ref {
        display: none;
    }
}

/* =====================================================================
   ADMIN LOGIN — primary action + card typography
   ---------------------------------------------------------------------
   The button mirrors the sidebar's active gradient and glow. Scoped to
   `.login-card` so it does not disturb other primary buttons.
   ===================================================================== */
.login-card .btn-primary {
    padding: 0.72rem 1rem;
    border-radius: 12px;
    background-color: #4f46e5 !important;
    background-image: linear-gradient(135deg, #4F46E5, #3B82F6) !important;
    border-color: #4f46e5 !important;
    color: #ffffff !important;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-card .btn-primary:hover,
.login-card .btn-primary:focus {
    background-color: #4338ca !important;
    background-image: linear-gradient(135deg, #4338CA, #2563EB) !important;
    border-color: #4338ca !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(59, 130, 246, 0.45);
}

.login-card .btn-primary:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.28);
    outline-offset: 2px;
}

/* Keep the heading and helper text crisp on the translucent surface. */
.login-card h4 {
    color: #1e293b;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.login-card .text-muted {
    color: #64748b !important;
}

/* `.brand-mark` is a flex block, so `text-center` alone cannot centre it. */
.login-card .brand-mark {
    margin-left: auto;
    margin-right: auto;
}

/* =====================================================================
   GATEWAY CONFIGURATION — per-gateway glass cards
   ---------------------------------------------------------------------
   Each gateway is its own <form>, so submissions work natively without
   nesting a form inside a table row. The card reuses the global glass
   surface and lays its fields out with the Bootstrap row grid.
   ===================================================================== */

/* Keep the card's content above the decorative diagonal sheen. */
.gateway-card > * {
    position: relative;
    z-index: 1;
}

.gateway-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.gateway-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

/* Small neumorphic tile, matching the dashboard stat icons. */
.gateway-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background: linear-gradient(145deg, #ffffff, rgba(224, 231, 255, 0.72));
    box-shadow: 4px 4px 10px rgba(31, 38, 135, 0.08),
                -3px -3px 8px rgba(255, 255, 255, 0.8);
    color: #4f46e5;
    font-size: 1.15rem;
    line-height: 1;
}

.gateway-name {
    margin: 0;
    color: #1e293b;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.gateway-key {
    display: inline-block;
    margin-top: 0.15rem;
    padding: 0.08rem 0.45rem;
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 6px;
    background: rgba(79, 70, 229, 0.08);
    color: #4338ca;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Live / hidden status chip in the card header. */
.gateway-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.gateway-status.is-live {
    border: 1px solid rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.gateway-status.is-off {
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.gateway-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.gateway-empty-icon {
    color: #4f46e5;
    font-size: 1.6rem;
}

/* Compact uppercase labels keep the card scannable. */
.gateway-card .form-label {
    margin-bottom: 0.3rem;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gateway-card .form-control,
.gateway-card .form-select {
    min-height: 44px;
}

.gateway-sort {
    text-align: center;
}

.gateway-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.9rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.gateway-active {
    margin: 0;
}

.gateway-active .form-check-input {
    margin-top: 0;
    cursor: pointer;
}

.gateway-active .form-check-label {
    color: #334155;
    font-weight: 600;
    cursor: pointer;
}

.gateway-save {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    border-radius: 12px;
}

@media (max-width: 575.98px) {
    .gateway-card-head {
        align-items: flex-start;
    }

    .gateway-card-foot {
        align-items: stretch;
    }

    .gateway-save {
        justify-content: center;
        width: 100%;
    }
}

/* =====================================================================
   DARK THEME
   ---------------------------------------------------------------------
   Toggled by adding `.dark-theme` to <body>: applied with no flash in
   partials/header.php, then flipped + persisted by partials/footer.php
   (localStorage key `admin-theme`). This block is LAST in the last-loaded
   stylesheet, so `body.dark-theme …` selectors out-rank the light
   `!important` rules in admin.css / admin-modern.css.
   ===================================================================== */

/* Flip the shared tokens so every var()-based rule follows automatically. */
body.dark-theme {
    --background: #0F172A;
    --surface: #1E293B;
    --surface-variant: #252F3F;
    --surface-elevated: #1E293B;
    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --text-muted: #94A3B8;
    --border: #334155;
    --border-light: #1E293B;

    color: #E2E8F0 !important;
    background-color: #0F172A !important;
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.22) 0, transparent 55%),
        radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.16) 0, transparent 50%),
        radial-gradient(at 0% 100%, rgba(139, 92, 246, 0.18) 0, transparent 55%) !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
}

body.dark-theme .admin-shell,
body.dark-theme .admin-main,
body.dark-theme .admin-content { background: transparent !important; }

/* --- Topbar --- */
body.dark-theme .admin-topbar {
    background: rgba(15, 23, 42, 0.72) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14) !important;
    box-shadow: 0 8px 28px -18px rgba(0, 0, 0, 0.75) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .topbar-title { color: #F1F5F9 !important; }
body.dark-theme .admin-menu-toggle {
    background: rgba(30, 41, 59, 0.9) !important;
    border-color: rgba(148, 163, 184, 0.35) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .admin-menu-toggle:hover { background: rgba(51, 65, 85, 0.95) !important; }

/* The sidebar is already dark — just soften its edge on the dark page. */
body.dark-theme .admin-sidebar { border-right: 1px solid rgba(148, 163, 184, 0.12); }

/* --- Cards → dark glassmorphism --- */
body.dark-theme .card,
body.dark-theme .table-card,
body.dark-theme .form-card,
body.dark-theme .glass-card,
body.dark-theme .stat-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.80), rgba(15, 23, 42, 0.55)) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.30) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.35) !important;
    box-shadow: 8px 8px 32px 0 rgba(0, 0, 0, 0.35),
                inset 2px 2px 5px rgba(255, 255, 255, 0.05) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .card:hover {
    box-shadow: 12px 12px 38px 0 rgba(0, 0, 0, 0.45),
                inset 2px 2px 5px rgba(255, 255, 255, 0.08) !important;
}
body.dark-theme .card-hover:hover,
body.dark-theme .interactive-card:hover {
    box-shadow: 16px 18px 42px -12px rgba(0, 0, 0, 0.55),
                0 10px 24px -12px rgba(0, 0, 0, 0.45),
                inset 2px 2px 5px rgba(255, 255, 255, 0.10) !important;
}
body.dark-theme .stat-card:hover {
    box-shadow: 16px 18px 42px -12px rgba(0, 0, 0, 0.55),
                0 10px 24px -12px rgba(0, 0, 0, 0.45),
                inset 2px 2px 5px rgba(255, 255, 255, 0.10) !important;
}
body.dark-theme .glass-card:hover {
    box-shadow: 12px 12px 40px 0 rgba(0, 0, 0, 0.45),
                inset 2px 2px 5px rgba(255, 255, 255, 0.08) !important;
}
body.dark-theme .stat-card::after,
body.dark-theme .glass-card::after {
    background: radial-gradient(circle, rgba(148, 163, 184, 0.14) 0%, rgba(148, 163, 184, 0) 70%) !important;
}

body.dark-theme .card-header {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-bottom-color: rgba(148, 163, 184, 0.12) !important;
    color: #F1F5F9 !important;
}
body.dark-theme .card-footer {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border-top-color: rgba(148, 163, 184, 0.12) !important;
}
body.dark-theme .card-header.bg-white,
body.dark-theme .card-header.bg-transparent { background: transparent !important; }

/* --- Headings / labels / values --- */
body.dark-theme .card-title,
body.dark-theme .stat-value,
body.dark-theme .widget-title,
body.dark-theme .gateway-name,
body.dark-theme h1, body.dark-theme h2, body.dark-theme h3,
body.dark-theme h4, body.dark-theme h5, body.dark-theme h6 { color: #F1F5F9 !important; }
body.dark-theme .card-subtitle,
body.dark-theme .stat-label,
body.dark-theme .widget-sub,
body.dark-theme .form-text,
body.dark-theme .text-muted { color: #94A3B8 !important; }
body.dark-theme .text-secondary { color: #A7B4C6 !important; }
body.dark-theme .text-dark,
body.dark-theme .text-body { color: #E2E8F0 !important; }

/* --- Neumorphic icon orbs → dark glass --- */
body.dark-theme .stat-icon,
body.dark-theme .icon-orb,
body.dark-theme .icon-orb-sm,
body.dark-theme .withdraw-empty-icon,
body.dark-theme .gateway-icon {
    background: linear-gradient(145deg, #273449, #1b2536) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 5px 5px 12px rgba(0, 0, 0, 0.45),
                -3px -3px 10px rgba(255, 255, 255, 0.03) !important;
    color: #A5B4FC !important;
}
body.dark-theme .stat-card:hover .stat-icon {
    box-shadow: 6px 6px 14px rgba(0, 0, 0, 0.5),
                -4px -4px 12px rgba(255, 255, 255, 0.04) !important;
}

/* --- Tables --- */
body.dark-theme .table {
    color: #E2E8F0 !important;
    --bs-table-bg: transparent;
    --bs-table-color: #E2E8F0;
    --bs-table-border-color: rgba(148, 163, 184, 0.12);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-striped-color: #E2E8F0;
    --bs-table-active-bg: rgba(129, 140, 248, 0.14);
    --bs-table-active-color: #F1F5F9;
    --bs-table-hover-bg: rgba(129, 140, 248, 0.10);
    --bs-table-hover-color: #F1F5F9;
}
body.dark-theme .table thead,
body.dark-theme .table thead.table-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
    --bs-table-bg: transparent;
    --bs-table-color: #CBD5E1;
}
body.dark-theme .table thead th,
body.dark-theme .table thead.table-light th {
    color: #CBD5E1 !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-bottom-color: rgba(148, 163, 184, 0.14) !important;
}
body.dark-theme .table tbody tr { border-bottom-color: rgba(148, 163, 184, 0.10) !important; }
body.dark-theme .table td {
    color: #E2E8F0 !important;
    border-bottom-color: rgba(148, 163, 184, 0.10) !important;
}
body.dark-theme .table tbody tr:hover,
body.dark-theme .table tbody tr:hover > *,
body.dark-theme .table.table-hover > tbody > tr:hover > * {
    background-color: rgba(129, 140, 248, 0.10) !important;
}
body.dark-theme .table-responsive .table tr {
    background: rgba(30, 41, 59, 0.55) !important;
    border-color: rgba(148, 163, 184, 0.14) !important;
    box-shadow: 0 8px 22px -18px rgba(0, 0, 0, 0.7) !important;
}
body.dark-theme .table-responsive .table td { border-bottom-color: rgba(148, 163, 184, 0.10) !important; }
body.dark-theme .table-responsive .table td::before { color: #CBD5E1 !important; }

/* --- Forms --- */
body.dark-theme .form-control,
body.dark-theme .form-select,
body.dark-theme input[type="text"],
body.dark-theme input[type="search"],
body.dark-theme input[type="email"],
body.dark-theme input[type="password"],
body.dark-theme input[type="number"],
body.dark-theme textarea {
    background: rgba(15, 23, 42, 0.6) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    color: #E2E8F0 !important;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.35) !important;
}
body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background: rgba(15, 23, 42, 0.9) !important;
    border-color: #818CF8 !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25) !important;
}
body.dark-theme .form-control::placeholder,
body.dark-theme textarea.form-control::placeholder { color: #64748B !important; }
body.dark-theme .form-control:disabled,
body.dark-theme .form-select:disabled { background: rgba(15, 23, 42, 0.4) !important; }
body.dark-theme .form-label,
body.dark-theme .form-check-label,
body.dark-theme .gateway-card .form-label { color: #CBD5E1 !important; }
body.dark-theme .input-group-text {
    background: rgba(30, 41, 59, 0.8) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    color: #CBD5E1 !important;
}
body.dark-theme .form-check-input {
    background-color: rgba(15, 23, 42, 0.7) !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}
body.dark-theme .form-check-input:checked {
    background-color: #6366F1 !important;
    border-color: #6366F1 !important;
}

/* --- Pills / badges / helpers --- */
body.dark-theme .nav-pills .nav-link {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    color: #CBD5E1 !important;
}
body.dark-theme .nav-pills .nav-link:hover,
body.dark-theme .nav-pills .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #F1F5F9 !important;
}
body.dark-theme .bg-light { background-color: #334155 !important; color: #E2E8F0 !important; }
body.dark-theme .text-bg-light { background-color: #334155 !important; color: #E2E8F0 !important; }
body.dark-theme .border { border-color: rgba(148, 163, 184, 0.18) !important; }

/* --- Floating surfaces (modals / dropdowns / alerts) --- */
body.dark-theme .modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.94)) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .modal-header,
body.dark-theme .modal-footer { border-color: rgba(148, 163, 184, 0.14) !important; }
body.dark-theme .dropdown-menu {
    background: rgba(30, 41, 59, 0.96) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .dropdown-item { color: #E2E8F0 !important; }
body.dark-theme .dropdown-item:hover,
body.dark-theme .dropdown-item:focus { background: rgba(129, 140, 248, 0.14) !important; color: #fff !important; }
body.dark-theme .alert {
    border-color: rgba(148, 163, 184, 0.18) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .alert-danger { background: rgba(239, 68, 68, 0.16) !important; color: #FCA5A5 !important; }
body.dark-theme .alert-success { background: rgba(16, 185, 129, 0.16) !important; color: #6EE7B7 !important; }
body.dark-theme .alert-info { background: rgba(59, 130, 246, 0.16) !important; color: #93C5FD !important; }
body.dark-theme .alert-warning { background: rgba(245, 158, 11, 0.16) !important; color: #FCD34D !important; }

/* --- Dashboard rows (withdrawals / recent transactions) --- */
body.dark-theme .withdraw-item,
body.dark-theme .txn-table tbody tr {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(148, 163, 184, 0.14) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
body.dark-theme .withdraw-item:hover { background: rgba(255, 255, 255, 0.08) !important; }
body.dark-theme .withdraw-name,
body.dark-theme .txn-user-name,
body.dark-theme .withdraw-amount,
body.dark-theme .txn-amount { color: #F1F5F9 !important; }
body.dark-theme .withdraw-meta,
body.dark-theme .txn-user-ref,
body.dark-theme .txn-date,
body.dark-theme .widget-sample-note { color: #94A3B8 !important; }
body.dark-theme .txn-type { color: #CBD5E1 !important; }
body.dark-theme .widget-badge {
    background: rgba(129, 140, 248, 0.16) !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
    color: #C7D2FE !important;
}
body.dark-theme .widget-link { color: #A5B4FC !important; }
body.dark-theme .widget-link:hover { background: rgba(129, 140, 248, 0.16) !important; color: #E0E7FF !important; }
body.dark-theme .withdraw-view {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(129, 140, 248, 0.4) !important;
    color: #C7D2FE !important;
}

/* --- Settings table + gateway cards --- */
body.dark-theme .settings-table tbody tr {
    background: rgba(255, 255, 255, 0.04) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
}
body.dark-theme .settings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35) !important;
}
body.dark-theme .settings-table thead th { color: #94A3B8 !important; }
body.dark-theme .settings-key {
    background: rgba(99, 102, 241, 0.18) !important;
    border-color: rgba(129, 140, 248, 0.35) !important;
    color: #C7D2FE !important;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3) !important;
}
body.dark-theme .gateway-card-head,
body.dark-theme .gateway-card-foot { border-color: rgba(148, 163, 184, 0.14) !important; }
body.dark-theme .gateway-key {
    background: rgba(99, 102, 241, 0.18) !important;
    border-color: rgba(129, 140, 248, 0.3) !important;
    color: #C7D2FE !important;
}
body.dark-theme .gateway-active .form-check-label { color: #CBD5E1 !important; }

/* --- Login page --- */
body.dark-theme.login-body {
    background-color: #0F172A !important;
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.22) 0, transparent 55%),
        radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.16) 0, transparent 50%),
        radial-gradient(at 0% 100%, rgba(139, 92, 246, 0.18) 0, transparent 55%) !important;
}
body.dark-theme .login-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.6)) !important;
    border-top-color: rgba(255, 255, 255, 0.10) !important;
    border-left-color: rgba(255, 255, 255, 0.08) !important;
    border-right-color: rgba(0, 0, 0, 0.30) !important;
    border-bottom-color: rgba(0, 0, 0, 0.35) !important;
}
body.dark-theme .login-card h4 { color: #F1F5F9 !important; }
body.dark-theme .login-card .text-muted { color: #94A3B8 !important; }

/* --- Scrollbars --- */
body.dark-theme ::-webkit-scrollbar-track { background: #0F172A; }
body.dark-theme ::-webkit-scrollbar-thumb { background: #334155; }
body.dark-theme ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* =====================================================================
   THEME TOGGLE BUTTON
   ---------------------------------------------------------------------
   Sits in the shell topbar (.topbar-right) and, on the login page, as a
   floating button. Shows a moon in light mode and a sun in dark mode —
   only one <i> is visible per theme, so the correct icon paints instantly
   from the body class (no JS timing needed).
   ===================================================================== */
.topbar-right {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex: 0 0 auto;
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.theme-toggle:hover { background: #f1f5f9; border-color: #cbd5e1; transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.theme-toggle .icon-sun { display: none; }
body.dark-theme .theme-toggle {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.35);
    color: #E2E8F0;
}
body.dark-theme .theme-toggle:hover {
    background: rgba(51, 65, 85, 0.95);
    border-color: rgba(148, 163, 184, 0.55);
}
body.dark-theme .theme-toggle .icon-moon { display: none; }
body.dark-theme .theme-toggle .icon-sun { display: inline-block; }

/* Login page: floating toggle in the top-right corner. */
.theme-toggle-float {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
    box-shadow: 0 8px 22px -12px rgba(31, 38, 135, 0.5);
}

/* --- Dark-mode contrast helpers -------------------------------------------
   The light build intentionally uses *dark* shades (e.g. --success-dark) for
   text/border utilities. On the dark page those would fail contrast, so lift
   them to their light counterparts here. */
body.dark-theme .text-primary { color: #93C5FD !important; }
body.dark-theme .text-info { color: #93C5FD !important; }
body.dark-theme .text-success { color: #6EE7B7 !important; }
body.dark-theme .text-warning { color: #FCD34D !important; }
body.dark-theme .text-danger { color: #FCA5A5 !important; }

body.dark-theme .btn-link { color: #A5B4FC !important; }
body.dark-theme .btn-link:hover,
body.dark-theme .btn-link:focus { color: #C7D2FE !important; }

body.dark-theme .table .btn-outline-primary {
    background-color: rgba(99, 102, 241, 0.16) !important;
    border-color: rgba(129, 140, 248, 0.55) !important;
    color: #C7D2FE !important;
}
body.dark-theme .btn-outline-secondary {
    background-color: transparent !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    color: #CBD5E1 !important;
}
body.dark-theme .btn-outline-dark {
    background-color: transparent !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .btn-outline-light {
    background-color: transparent !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    color: #CBD5E1 !important;
}
body.dark-theme .btn-light {
    background-color: #334155 !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #E2E8F0 !important;
}

/* =====================================================================
   DARK THEME — READABILITY SAFETY NET
   ---------------------------------------------------------------------
   Last-resort overrides so no light-built component can leak dark text
   onto the dark page. Everything here is scoped to `body.dark-theme`
   and therefore only affects the dark palette.
   ===================================================================== */

/* --- Generic text tags ------------------------------------------------
   Force light text on the plain tags used across cards, tables, forms
   and modals. Utility/component classes below re-assert their own
   colours afterwards where a tag must stay dark (e.g. yellow badges). */
body.dark-theme p,
body.dark-theme span:not(.badge),
body.dark-theme li,
body.dark-theme dt,
body.dark-theme dd,
body.dark-theme small,
body.dark-theme strong,
body.dark-theme b,
body.dark-theme label,
body.dark-theme legend {
    color: #E2E8F0;
}

/* Badges and buttons own their foreground colour; never repaint their
   inner text with the generic tag rule. */
body.dark-theme .btn span,
body.dark-theme .badge span,
body.dark-theme .text-bg-warning span,
body.dark-theme .text-bg-success span,
body.dark-theme .text-bg-info span,
body.dark-theme .text-bg-danger span,
body.dark-theme .text-bg-light span { color: inherit !important; }

/* Cards and floating surfaces establish a readable base colour so any
   unstyled element inherits light text. */
body.dark-theme .card,
body.dark-theme .card-body,
body.dark-theme .card-header,
body.dark-theme .card-footer,
body.dark-theme .modal-content,
body.dark-theme .offcanvas,
body.dark-theme .toast,
body.dark-theme .popover,
body.dark-theme .accordion-item { color: #E2E8F0; }

/* --- Forms ------------------------------------------------------------
   Extend the existing control styles to every input type (date, time,
   url, tel, file, …) plus native dropdown options. */
body.dark-theme input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
body.dark-theme select,
body.dark-theme textarea {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    color: #E2E8F0 !important;
}
body.dark-theme option {
    background-color: #1E293B;
    color: #E2E8F0;
}
body.dark-theme .form-control:disabled,
body.dark-theme .form-select:disabled,
body.dark-theme input:disabled,
body.dark-theme select:disabled,
body.dark-theme textarea:disabled {
    color: #94A3B8 !important;
    -webkit-text-fill-color: #94A3B8;
    opacity: 1;
}
body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder { color: #64748B !important; opacity: 1; }
body.dark-theme input[type="date"]::-webkit-calendar-picker-indicator,
body.dark-theme input[type="time"]::-webkit-calendar-picker-indicator,
body.dark-theme input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.75;
}
body.dark-theme .form-label,
body.dark-theme label,
body.dark-theme .form-check-label,
body.dark-theme .form-text { color: #CBD5E1 !important; }

/* --- Tables ----------------------------------------------------------- */
body.dark-theme .table th { color: #E2E8F0 !important; }
body.dark-theme .table tbody th { color: #E2E8F0 !important; }
body.dark-theme .table-light,
body.dark-theme .table thead.table-light { --bs-table-bg: transparent; --bs-table-color: #CBD5E1; }
body.dark-theme .table .text-dark { color: #E2E8F0 !important; }

/* Transaction chips use dark ambers/greens/reds that vanish on the dark
   glass table. Lift them to their light counterparts. */
body.dark-theme .txn-table .badge.text-bg-warning {
    background: rgba(245, 158, 11, 0.20) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #FCD34D !important;
}
body.dark-theme .txn-table .badge.text-bg-success {
    background: rgba(16, 185, 129, 0.20) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #6EE7B7 !important;
}
body.dark-theme .txn-table .badge.text-bg-info {
    background: rgba(59, 130, 246, 0.20) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    color: #93C5FD !important;
}
body.dark-theme .txn-table .badge.text-bg-danger {
    background: rgba(239, 68, 68, 0.20) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #FCA5A5 !important;
}

/* --- Badge foreground rules ------------------------------------------
   Keep dark text on the saturated yellow chips (that combination stays
   high-contrast); all other badges already use white text. */
body.dark-theme .badge.bg-warning,
body.dark-theme .badge.text-bg-warning,
body.dark-theme .bg-warning.text-dark { color: #1F2937 !important; }

/* `.bg-light` is remapped to a dark slate chip in dark mode, so its
   text must follow the dark palette instead of Bootstrap's black. */
body.dark-theme .badge.bg-light,
body.dark-theme .badge.text-bg-light { color: #E2E8F0 !important; }

/* --- Text utilities --------------------------------------------------- */
body.dark-theme .text-body-secondary,
body.dark-theme .text-body-tertiary { color: #A7B4C6 !important; }
body.dark-theme .text-black,
body.dark-theme .text-black-50 { color: #E2E8F0 !important; }
body.dark-theme .text-reset { color: inherit !important; }
body.dark-theme .link-dark,
body.dark-theme .link-body-emphasis { color: #A5B4FC !important; }
body.dark-theme a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.badge) {
    color: #A5B4FC;
}
body.dark-theme a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.badge):hover {
    color: #C7D2FE;
}

/* --- Background helpers ----------------------------------------------- */
body.dark-theme .bg-white,
body.dark-theme .bg-body,
body.dark-theme .bg-body-secondary,
body.dark-theme .bg-body-tertiary {
    background-color: #1E293B !important;
    color: #E2E8F0 !important;
}

/* --- Modals / dropdowns / lists --------------------------------------- */
body.dark-theme .btn-close {
    filter: invert(1) grayscale(1) brightness(1.6);
    opacity: 0.8;
}
body.dark-theme .btn-close:hover { opacity: 1; }
body.dark-theme .modal-title { color: #F1F5F9 !important; }
body.dark-theme .dropdown-header { color: #94A3B8 !important; }
body.dark-theme .dropdown-divider { border-color: rgba(148, 163, 184, 0.18) !important; }

body.dark-theme .list-group-item {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .list-group-item.active {
    background-color: #4F46E5 !important;
    border-color: #4F46E5 !important;
    color: #FFFFFF !important;
}
body.dark-theme .list-group-item-action:hover,
body.dark-theme .list-group-item-action:focus {
    background-color: rgba(129, 140, 248, 0.14) !important;
    color: #F1F5F9 !important;
}

body.dark-theme .accordion-item {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
}
body.dark-theme .accordion-button {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #E2E8F0 !important;
}
body.dark-theme .accordion-button:not(.collapsed) {
    background-color: rgba(129, 140, 248, 0.16) !important;
    color: #E0E7FF !important;
}
body.dark-theme .accordion-button::after { filter: invert(1) brightness(2); }
body.dark-theme .accordion-body { color: #CBD5E1 !important; }

/* --- Pagination ------------------------------------------------------- */
body.dark-theme .page-link {
    background-color: #1E293B !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #C7D2FE !important;
}
body.dark-theme .page-link:hover,
body.dark-theme .page-link:focus {
    background-color: #334155 !important;
    color: #E0E7FF !important;
}
body.dark-theme .page-item.active .page-link {
    background-color: #6366F1 !important;
    border-color: #6366F1 !important;
    color: #FFFFFF !important;
}
body.dark-theme .page-item.disabled .page-link {
    background-color: rgba(30, 41, 59, 0.6) !important;
    border-color: rgba(148, 163, 184, 0.14) !important;
    color: #64748B !important;
}

/* --- Outline buttons on dark surfaces --------------------------------- */
body.dark-theme .btn-outline-success { color: #6EE7B7 !important; border-color: rgba(16, 185, 129, 0.55) !important; }
body.dark-theme .btn-outline-warning { color: #FCD34D !important; border-color: rgba(245, 158, 11, 0.55) !important; }
body.dark-theme .btn-outline-danger { color: #FCA5A5 !important; border-color: rgba(239, 68, 68, 0.55) !important; }
body.dark-theme .btn-outline-info { color: #93C5FD !important; border-color: rgba(59, 130, 246, 0.55) !important; }

/* --- Gateway + module widgets ----------------------------------------- */
body.dark-theme .gateway-status.is-live { color: #6EE7B7 !important; }
body.dark-theme .gateway-status.is-off { color: #FCA5A5 !important; }
body.dark-theme .gateway-empty-icon { color: #A5B4FC !important; }

/* `.module-icon` ships an inline style from settings.php, so the dark
   palette needs !important to repaint it. */
body.dark-theme .module-visibility-card .module-icon {
    background: rgba(99, 102, 241, 0.18) !important;
    color: #A5B4FC !important;
}

/* =====================================================================
   DARK THEME — AGGRESSIVE TABLE READABILITY OVERRIDES
   ---------------------------------------------------------------------
   Bootstrap still paints some table cells with `--bs-table-color` or
   hardcoded dark utility classes, and nested markup (names, amounts,
   dates, headings, spans) can inherit near-black. These last rules are
   intentionally blunt: every table surface and every element inside a
   responsive table gets light text, out-ranking the component rules
   above.
   ===================================================================== */

/* 1. Table shell + every cell + everything inside .table-responsive. */
body.dark-theme .table,
body.dark-theme .table th,
body.dark-theme .table td,
body.dark-theme .table thead th,
body.dark-theme .table thead.table-light th,
body.dark-theme .table tbody td,
body.dark-theme .table tbody tr,
body.dark-theme .table-responsive * {
    color: #F8FAFC !important;
}

/* 2. Nested markup inside table cells: headings, spans, paragraphs,
      links, muted/dark utilities and bold text. */
body.dark-theme .table th h1,
body.dark-theme .table th h2,
body.dark-theme .table th h3,
body.dark-theme .table th h4,
body.dark-theme .table th h5,
body.dark-theme .table th h6,
body.dark-theme .table td h1,
body.dark-theme .table td h2,
body.dark-theme .table td h3,
body.dark-theme .table td h4,
body.dark-theme .table td h5,
body.dark-theme .table td h6,
body.dark-theme .table td span,
body.dark-theme .table td p,
body.dark-theme .table td div,
body.dark-theme .table td small,
body.dark-theme .table td strong,
body.dark-theme .table td b,
body.dark-theme .table td a,
body.dark-theme .table td .text-dark,
body.dark-theme .table td .text-muted,
body.dark-theme .table td .text-body,
body.dark-theme .table td .fw-bold:not(.btn),
body.dark-theme .table th .fw-bold:not(.btn),
body.dark-theme .table td .fw-semibold:not(.btn),
body.dark-theme .table th .fw-semibold:not(.btn),
body.dark-theme .text-dark,
body.dark-theme .fw-bold:not(.btn) {
    color: #E2E8F0 !important;
}

/* 3. `.fw-bold` is global by request; keep semantic accents on elements
      that intentionally use a status colour outside tables. */
body.dark-theme .text-success.fw-bold { color: #6EE7B7 !important; }
body.dark-theme .text-danger.fw-bold { color: #FCA5A5 !important; }
body.dark-theme .text-warning.fw-bold { color: #FCD34D !important; }
body.dark-theme .text-info.fw-bold,
body.dark-theme .text-primary.fw-bold { color: #93C5FD !important; }

/* 4. Yellow warning buttons keep dark text (also protects them from the
      global `.fw-bold` rule). Hover/focus use white on the darker amber. */
body.dark-theme .btn-warning { color: #1F2937 !important; }
body.dark-theme .btn-warning:hover,
body.dark-theme .btn-warning:focus { color: #FFFFFF !important; }

/* 5. Chips with inherently light Bootstrap backgrounds (yellow/cyan)
      keep dark foregrounds so the aggressive white rule does not trade
      black-on-dark for white-on-yellow. `.txn-table` keeps its own
      translucent light-on-dark palette defined above. */
body.dark-theme .table:not(.txn-table) .badge.bg-warning,
body.dark-theme .table:not(.txn-table) .badge.text-bg-warning,
body.dark-theme .table:not(.txn-table) .badge.bg-info,
body.dark-theme .table:not(.txn-table) .badge.text-bg-info {
    color: #1F2937 !important;
}

/* =====================================================================
   DARK THEME — LIGHT SURFACE UTILITIES + SETTINGS MODULE CARDS
   ---------------------------------------------------------------------
   Settings > "Module Visibility" renders each toggle as a
   `.module-visibility-card` whose background is a hardcoded white
   gradient baked into an inline <style> in settings.php. The safety-net
   rule `span:not(.badge)` meanwhile lifts its label/hint spans to light
   text, so on the untouched white card the text turned invisible. The
   rules below repaint both the utility backgrounds and these custom
   cards to dark, contrasting surfaces.
   ===================================================================== */

/* Invert Bootstrap's light surface utilities to translucent dark. */
body.dark-theme .bg-white,
body.dark-theme .bg-light,
body.dark-theme .list-group-item {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #F8FAFC !important;
}

/* Re-assert chips: `.badge.bg-light` must stay a solid slate chip so its
   count stays readable (the generic rule above makes it near-transparent). */
body.dark-theme .badge.bg-light,
body.dark-theme .badge.text-bg-light {
    background-color: #334155 !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #E2E8F0 !important;
}

/* Module Visibility toggle cards: dark gradient surface + light labels. */
body.dark-theme .module-visibility-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.90), rgba(15, 23, 42, 0.70)) !important;
    border-color: rgba(148, 163, 184, 0.20) !important;
    color: #F8FAFC !important;
}
body.dark-theme .module-visibility-card:hover {
    border-color: rgba(96, 165, 250, 0.55) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45) !important;
}
body.dark-theme .module-visibility-card .module-meta,
body.dark-theme .module-visibility-card .module-name { color: #F8FAFC !important; }
body.dark-theme .module-visibility-card .module-hint { color: #94A3B8 !important; }

/* Switch track: keep the off-state visible on the dark card. */
body.dark-theme .module-visibility-card .module-slider {
    background: #475569 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.40) !important;
}







