/* ========================================
   LHK Ads Publisher Dashboard - Design System
   Premium Dark Theme with Glassmorphism
   ======================================== */

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

/* ── CSS Custom Properties ── */
:root {
    /* Base Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1323;
    --bg-card: #141830;
    --bg-card-hover: #1a1f3d;
    --bg-sidebar: #0c1020;
    --bg-input: #181d35;

    /* Accent Colors */
    --accent-purple: #7c3aed;
    --accent-purple-light: #a78bfa;
    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-green-light: #34d399;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;

    /* Text Colors */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;

    /* Gradient */
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    --gradient-card: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-amber: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
    --gradient-sidebar: linear-gradient(180deg, #0c1020 0%, #0a0e1a 100%);

    /* Border */
    --border-color: rgba(148, 163, 184, 0.08);
    --border-color-hover: rgba(124, 58, 237, 0.3);

    /* Glass */
    --glass-bg: rgba(20, 24, 48, 0.7);
    --glass-border: rgba(148, 163, 184, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-purple: 0 4px 24px rgba(124, 58, 237, 0.2);
    --shadow-blue: 0 4px 24px rgba(59, 130, 246, 0.2);

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 68px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ── Reset & Base ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--accent-blue-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-purple-light);
}

img {
    max-width: 100%;
    height: auto;
}

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

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

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

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


/* ── Layout ── */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    overflow-x: hidden;
    max-width: 100vw;
}

.page-content {
    padding: 24px 32px;
    max-width: 1600px;
    overflow-x: hidden;
    box-sizing: border-box;
}


/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--gradient-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    min-height: 68px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
}

.sidebar-brand .brand-text span {
    color: var(--accent-purple-light);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    padding: 8px 24px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    white-space: nowrap;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.06);
    border-left-color: rgba(124, 58, 237, 0.3);
}

.nav-link.active {
    color: var(--accent-purple-light);
    background: rgba(124, 58, 237, 0.1);
    border-left-color: var(--accent-purple);
}

.nav-link .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.nav-link .nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

.nav-link .nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: white;
}

/* Submenu */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.nav-submenu.open {
    max-height: 300px;
}

.nav-submenu .nav-link {
    padding-left: 56px;
    font-size: 13px;
}

.nav-toggle-arrow {
    margin-left: auto;
    transition: transform var(--transition-normal);
    font-size: 12px;
}

.nav-item.open .nav-toggle-arrow {
    transform: rotate(90deg);
}

/* Sidebar Impersonation Card */
.sidebar-impersonation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 16px 0;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(239, 68, 68, 0.06) 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-sm);
}

.sidebar-impersonation-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-amber);
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-impersonation-info {
    flex: 1;
    min-width: 0;
}

.sidebar-impersonation-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-amber);
    font-weight: 600;
    line-height: 1;
    margin-bottom: 2px;
}

.sidebar-impersonation-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-impersonation-back {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.sidebar-impersonation-back:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user .user-role {
    font-size: 11px;
    color: var(--text-muted);
}


/* ========================================
   HEADER / TOPBAR
   ======================================== */
.topbar {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 900;
    box-sizing: border-box;
    width: 100%;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left .page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
}

.topbar-left .breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-left .breadcrumb a {
    color: var(--text-secondary);
}

.topbar-left .breadcrumb .separator {
    font-size: 10px;
}

.hamburger-btn {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.hamburger-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.topbar-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.topbar-user:hover {
    background: var(--bg-card);
}

.topbar-user .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
}

.topbar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.user-dropdown-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(124, 58, 237, 0.3);
}

.user-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.user-dropdown-item:hover {
    background: rgba(148, 163, 184, 0.08);
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.user-dropdown-logout {
    color: var(--accent-red, #ef4444);
}

.user-dropdown-logout i {
    color: var(--accent-red, #ef4444);
}

.user-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.08);
}

/* Avatar with uploaded photo */
.topbar-user .user-avatar img,
.sidebar-user .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Dropdown chevron rotation */
.topbar-user-wrapper.dropdown-open .topbar-user .fa-chevron-down {
    transform: rotate(180deg);
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    overflow: hidden;
}

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

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.card-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
}

.card-body {
    padding: 20px 24px 24px;
}

/* ApexCharts tooltip z-index fix */
.apexcharts-tooltip {
    z-index: 2147483647 !important;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}


/* ── Stat Cards ── */
.stat-card {
    position: relative;
    padding: 24px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-purple);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.purple::before {
    background: var(--gradient-primary);
}

.stat-card.green::before {
    background: var(--gradient-green);
}

.stat-card.amber::before {
    background: var(--gradient-amber);
}

.stat-card.blue::before {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

.stat-card.red::before {
    background: var(--gradient-red);
}

.stat-card.pink::before {
    background: linear-gradient(135deg, #ec4899, #a855f7);
}

.stat-card.cyan::before {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-card .stat-icon.purple {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-purple-light);
}

.stat-card .stat-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.stat-card .stat-icon.amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.stat-card .stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.stat-card .stat-icon.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.stat-card .stat-icon.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.stat-card .stat-icon.pink {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}

.stat-card .stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.stat-card .stat-change.up {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.stat-card .stat-change.down {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}


/* ========================================
   GRID SYSTEM
   ======================================== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 3;
}

/* ── Toggle Switch ── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary, #334155);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent-purple, #7c3aed);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.4);
}

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


/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.35);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.btn-success {
    background: var(--gradient-green);
    color: white;
}

.btn-danger {
    background: var(--gradient-red);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-icon {
    padding: 10px;
    width: 40px;
    height: 40px;
}


/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

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

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-purple);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}


/* ========================================
   TABLES
   ======================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}


/* ========================================
   REPORT PAGE LAYOUT
   ======================================== */
.report-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

.report-builder-col {
    min-width: 0;
}

.report-result-col {
    min-width: 0;
    overflow-x: auto;
}

.report-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.report-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-purple);
    cursor: pointer;
}

.report-checkbox span {
    user-select: none;
}


/* ========================================
   TYPEAHEAD / AUTOCOMPLETE COMPONENT
   ======================================== */
.typeahead-container {
    position: relative;
}

.typeahead-input {
    width: 100%;
}

.typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.typeahead-dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.typeahead-dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--accent-purple-light);
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.selected-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-purple-light);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.selected-item span:first-child {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-item {
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-red);
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    line-height: 1;
    padding: 0 2px;
}

.remove-item:hover {
    opacity: 1;
}


/* ========================================
   AD NETWORK DETAILS LAYOUT
   ======================================== */
.network-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: rgba(15, 19, 35, 0.5);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.04);
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.table-actions {
    display: flex;
    gap: 6px;
}

/* ── DataTable Toolbar ── */
.dt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

.dt-toolbar-left,
.dt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dt-toolbar label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.dt-toolbar select {
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
}

.dt-search {
    padding: 7px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    width: 200px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.dt-search:focus {
    border-color: var(--primary);
}

.dt-search::placeholder {
    color: var(--text-muted);
}

/* ── Sortable Headers ── */
.data-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

.data-table thead th.sortable:hover {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.08);
}

.data-table thead th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.3;
}

.data-table thead th.sortable.sort-asc::after {
    content: '↑';
    opacity: 0.9;
    color: var(--primary);
}

.data-table thead th.sortable.sort-desc::after {
    content: '↓';
    opacity: 0.9;
    color: var(--primary);
}

/* ── Pagination ── */
.dt-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
}

.dt-pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

.dt-pagination-buttons {
    display: flex;
    gap: 4px;
}

.dt-pagination-buttons button {
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 34px;
    text-align: center;
}

.dt-pagination-buttons button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.dt-pagination-buttons button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

.dt-pagination-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
}

.badge-purple {
    background: rgba(124, 58, 237, 0.12);
    color: var(--accent-purple-light);
}

.badge-neutral {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
}


/* ========================================
   TABS
   ======================================== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent-purple-light);
    border-bottom-color: var(--accent-purple);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}


/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}


/* ========================================
   ALERTS
   ======================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}


/* ========================================
   CHAT / SUPPORT
   ======================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 80px);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
}

.chat-bubble.sent {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble.received {
    align-self: flex-start;
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble .chat-time {
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.7;
}

.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input-area .form-control {
    flex: 1;
}


/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

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

.text-secondary {
    color: var(--text-secondary);
}

.text-white {
    color: var(--text-white);
}

.text-purple {
    color: var(--accent-purple-light);
}

.text-green {
    color: var(--accent-green);
}

.text-amber {
    color: var(--accent-amber);
}

.text-red {
    color: var(--accent-red);
}

.text-blue {
    color: var(--accent-blue);
}

.font-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.font-bold {
    font-weight: 700;
}

.text-xs {
    font-size: 12px;
}

.text-sm {
    font-size: 13px;
}

.text-lg {
    font-size: 16px;
}

.font-semibold {
    font-weight: 600;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-24 {
    gap: 24px;
}

.mt-4 {
    margin-top: 4px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mt-32 {
    margin-top: 32px;
}

.mb-4 {
    margin-bottom: 4px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.p-24 {
    padding: 24px;
}

.p-16 {
    padding: 16px;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none;
}

.overflow-hidden {
    overflow: hidden;
}

.rounded {
    border-radius: var(--radius-md);
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}


/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

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

    100% {
        background-position: 200% 0;
    }
}

.animate-in {
    animation: slideUp 0.5s ease both;
}

.animate-in:nth-child(1) {
    animation-delay: 0.05s;
}

.animate-in:nth-child(2) {
    animation-delay: 0.1s;
}

.animate-in:nth-child(3) {
    animation-delay: 0.15s;
}

.animate-in:nth-child(4) {
    animation-delay: 0.2s;
}

.animate-in:nth-child(5) {
    animation-delay: 0.25s;
}

.animate-in:nth-child(6) {
    animation-delay: 0.3s;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}


/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger-btn {
        display: flex;
    }

    .page-content {
        padding: 16px 20px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .col-span-2,
    .col-span-3 {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-user .user-name {
        display: none;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .tabs {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: 12px;
    }

    .card-body {
        padding: 16px;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}


/* ========================================
   PAGE-SPECIFIC: Login
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    bottom: -200px;
    left: -100px;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    position: relative;
    z-index: 1;
}

.login-card .brand-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .brand-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    color: white;
    margin-bottom: 12px;
}

.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
    text-align: center;
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--accent-purple-light);
    font-weight: 500;
}


/* ========================================
   REVENUE-SPECIFIC STYLES
   ======================================== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 20px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.filter-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 180px;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px;
    background: rgba(124, 58, 237, 0.04);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.summary-item {
    text-align: center;
}

.summary-item .summary-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-item .summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
}

/* Revenue tag colors for donut chart legend */
.revenue-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.revenue-tag .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ========================================
   PROFILE PAGE
   ======================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px;
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
    border: 3px solid rgba(124, 58, 237, 0.3);
}

.profile-info h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
}

.profile-info .profile-role {
    font-size: 13px;
    color: var(--text-muted);
}

.profile-info .profile-email {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ========================================
   CHART PLACEHOLDER
   ======================================== */
.chart-placeholder {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 30px,
            rgba(124, 58, 237, 0.03) 30px,
            rgba(124, 58, 237, 0.03) 31px);
}

/* Simulated bar chart */
.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
}

.mini-chart .bar {
    width: 4px;
    border-radius: 2px;
    background: var(--accent-purple);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.mini-chart:hover .bar {
    opacity: 1;
}

/* ========================================
   IMPERSONATION BANNER
   ======================================== */
.impersonation-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(239, 68, 68, 0.08) 100%);
    border-bottom: 2px solid rgba(245, 158, 11, 0.4);
    padding: 10px 24px;
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.impersonation-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.impersonation-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--accent-amber);
}

.impersonation-banner-left i {
    font-size: 18px;
    color: var(--accent-amber);
}

.impersonation-banner-left strong {
    color: var(--text-white);
}

.impersonation-admin-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
}

.impersonation-stop-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.impersonation-stop-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    transform: translateY(-1px);
}


/* ========================================
   NOTIFICATION DROPDOWN
   ======================================== */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    margin-top: 8px;
}

.notification-dropdown.show {
    display: block;
    animation: slideUp 0.2s ease;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.notification-item:hover {
    background: rgba(124, 58, 237, 0.04);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.notification-text {
    flex: 1;
}

.notification-text p {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-text .notification-time {
    font-size: 11px;
    color: var(--text-muted);
}


/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
.theme-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    padding: 0 4px;
}

.theme-toggle:hover {
    border-color: var(--border-color-hover);
}

.theme-toggle .toggle-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
}

.theme-toggle .toggle-thumb {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient-primary);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
    transition: transform var(--transition-normal);
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
}

body.light-mode .theme-toggle .toggle-thumb {
    transform: translateY(-50%) translateX(24px);
    background: linear-gradient(135deg, #f59e0b, #f97316);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.theme-toggle .toggle-icon {
    font-size: 12px;
    z-index: 1;
    line-height: 1;
}


/* ========================================
   LIGHT MODE
   ======================================== */

/* Smooth color transition on theme switch */
body,
body .sidebar,
body .topbar,
body .card,
body .stat-card,
body .form-control,
body .filter-bar,
body .modal,
body .alert,
body .badge,
body .btn,
body .chat-bubble,
body .notification-dropdown,
body .login-card,
body .login-page,
body .profile-header {
    transition:
        background-color 0.35s ease,
        border-color 0.35s ease,
        color 0.35s ease,
        box-shadow 0.35s ease;
}

body.light-mode {
    /* Base Colors */
    --bg-primary: #f4f6fb;
    --bg-secondary: #edf0f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fc;
    --bg-sidebar: #ffffff;
    --bg-input: #f0f2f7;

    /* Accent Colors — slightly deeper for contrast on light */
    --accent-purple: #6d28d9;
    --accent-purple-light: #7c3aed;
    --accent-blue: #2563eb;
    --accent-blue-light: #3b82f6;
    --accent-cyan: #0891b2;
    --accent-green: #059669;
    --accent-green-light: #10b981;
    --accent-amber: #d97706;
    --accent-red: #dc2626;
    --accent-pink: #db2777;
    --accent-orange: #ea580c;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #0f172a;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    --gradient-card: linear-gradient(135deg, rgba(124, 58, 237, 0.04) 0%, rgba(59, 130, 246, 0.04) 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-amber: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
    --gradient-sidebar: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);

    /* Borders */
    --border-color: rgba(148, 163, 184, 0.2);
    --border-color-hover: rgba(124, 58, 237, 0.35);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(148, 163, 184, 0.15);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-purple: 0 4px 24px rgba(124, 58, 237, 0.08);
    --shadow-blue: 0 4px 24px rgba(59, 130, 246, 0.08);
}

/* ── Light mode scrollbar ── */
body.light-mode ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ── Sidebar Light ── */
body.light-mode .sidebar {
    border-right-color: rgba(148, 163, 184, 0.2);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

body.light-mode .sidebar-brand {
    border-bottom-color: rgba(148, 163, 184, 0.15);
}

body.light-mode .nav-link {
    color: var(--text-secondary);
}

body.light-mode .nav-link:hover {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.04);
    border-left-color: rgba(124, 58, 237, 0.25);
}

body.light-mode .nav-link.active {
    color: var(--accent-purple);
    background: rgba(124, 58, 237, 0.06);
    border-left-color: var(--accent-purple);
}

body.light-mode .sidebar-footer {
    border-top-color: rgba(148, 163, 184, 0.15);
}

/* ── Topbar Light ── */
body.light-mode .topbar {
    background: rgba(255, 255, 255, 0.88);
    border-bottom-color: rgba(148, 163, 184, 0.15);
}

body.light-mode .topbar-btn:hover {
    background: #f1f5f9;
}

body.light-mode .topbar-user:hover {
    background: #f1f5f9;
}

body.light-mode .user-dropdown {
    background: #fff;
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

body.light-mode .user-dropdown-item:hover {
    background: #f1f5f9;
}

/* ── Cards Light ── */
body.light-mode .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-mode .card:hover {
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.06);
}

body.light-mode .stat-card {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

body.light-mode .stat-card:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.08);
}

/* ── Table Light ── */
body.light-mode .data-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    border-bottom-color: rgba(148, 163, 184, 0.2);
}

body.light-mode .data-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.02);
}

body.light-mode .data-table tbody td {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

body.light-mode .dt-toolbar {
    border-bottom-color: rgba(148, 163, 184, 0.15);
}

body.light-mode .dt-search,
body.light-mode .dt-toolbar select {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.3);
}

body.light-mode .dt-pagination {
    border-top-color: rgba(148, 163, 184, 0.15);
}

body.light-mode .dt-pagination-buttons button {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.3);
}

body.light-mode .data-table thead th.sortable:hover {
    background: rgba(124, 58, 237, 0.04);
}

/* ── Badges Light — keep text readable ── */
body.light-mode .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

body.light-mode .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

body.light-mode .badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

body.light-mode .badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

body.light-mode .badge-purple {
    background: rgba(124, 58, 237, 0.1);
    color: #6d28d9;
}

body.light-mode .badge-neutral {
    background: rgba(148, 163, 184, 0.12);
    color: #64748b;
}

/* ── Stat Icon Light — slightly stronger backgrounds ── */
body.light-mode .stat-card .stat-icon.purple {
    background: rgba(124, 58, 237, 0.1);
}

body.light-mode .stat-card .stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
}

body.light-mode .stat-card .stat-icon.amber {
    background: rgba(245, 158, 11, 0.1);
}

body.light-mode .stat-card .stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
}

body.light-mode .stat-card .stat-icon.red {
    background: rgba(239, 68, 68, 0.1);
}

body.light-mode .stat-card .stat-icon.cyan {
    background: rgba(6, 182, 212, 0.1);
}

body.light-mode .stat-card .stat-icon.pink {
    background: rgba(236, 72, 153, 0.1);
}

/* ── Input / Filter Light ── */
body.light-mode .form-control {
    background: #f8f9fc;
    border-color: rgba(148, 163, 184, 0.25);
    color: var(--text-primary);
}

body.light-mode .form-control:focus {
    background: #ffffff;
    border-color: var(--accent-purple);
}

body.light-mode .filter-bar {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Buttons Light ── */
body.light-mode .btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.25);
}

body.light-mode .btn-secondary:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

body.light-mode .btn-ghost:hover {
    background: #f1f5f9;
}

/* ── Chat Light ── */
body.light-mode .chat-bubble.received {
    background: #f1f5f9;
    color: var(--text-primary);
}

body.light-mode .chat-input-area {
    border-top-color: rgba(148, 163, 184, 0.15);
}

/* ── Modal Light ── */
body.light-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}

body.light-mode .modal {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ── Notifications Light ── */
body.light-mode .notification-dropdown {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.light-mode .notification-item:hover {
    background: #f8fafc;
}

/* ── Login Page Light ── */
body.light-mode .login-page {
    background: #f4f6fb;
}

body.light-mode .login-page::before {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.06) 0%, transparent 70%);
}

body.light-mode .login-page::after {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.04) 0%, transparent 70%);
}

body.light-mode .login-card {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ── Sidebar Overlay Light ── */
body.light-mode .sidebar-overlay.show {
    background: rgba(0, 0, 0, 0.2);
}

/* ── Alert Light ── */
body.light-mode .alert-warning {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.15);
}

body.light-mode .alert-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
}

body.light-mode .alert-success {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.15);
}

body.light-mode .alert-info {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.15);
}

/* ── Profile Header Light ── */
body.light-mode .profile-header {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.03) 0%, rgba(59, 130, 246, 0.03) 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Divider Light ── */
body.light-mode .divider {
    border-top-color: rgba(148, 163, 184, 0.15);
}

/* ── Tabs Light ── */
body.light-mode .tabs {
    border-bottom-color: rgba(148, 163, 184, 0.15);
}

body.light-mode .tab-btn.active {
    color: var(--accent-purple);
}

/* ── Skeleton loader Light ── */
body.light-mode .skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
}

/* ── Theme toggle styling ── */
body.light-mode .theme-toggle {
    background: #f1f5f9;
    border-color: rgba(148, 163, 184, 0.25);
}

/* ── ApexCharts tooltip overrides for light mode ── */
body.light-mode .apexcharts-tooltip {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .apexcharts-tooltip-title {
    background: #f8fafc !important;
    border-bottom-color: #e2e8f0 !important;
    color: #1e293b !important;
}

body.light-mode .apexcharts-xaxistooltip,
body.light-mode .apexcharts-yaxistooltip {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

body.light-mode .apexcharts-legend-text {
    color: #475569 !important;
}

body.light-mode .apexcharts-text {
    fill: #64748b !important;
}

body.light-mode .apexcharts-gridline {
    stroke: rgba(148, 163, 184, 0.12) !important;
}


/* ========================================
   LOADING INDICATORS & SKELETONS
   ======================================== */
.lhk-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
    animation: fadeIn 0.2s ease;
}

.lhk-loader-overlay.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.lhk-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.lhk-loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(124, 58, 237, 0.15);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-card-hover) 25%,
            rgba(124, 58, 237, 0.08) 50%,
            var(--bg-card-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-circle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
}

.skeleton-text-lg {
    height: 28px;
    margin-bottom: 8px;
}

.skeleton-card {
    min-height: 120px;
}

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

    100% {
        background-position: 200% 0;
    }
}


/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.lhk-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    z-index: 10000;
    max-width: 420px;
    transform: translateY(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lhk-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.lhk-toast-success {
    border-left: 4px solid var(--accent-green);
}

.lhk-toast-success i:first-child {
    color: var(--accent-green);
}

.lhk-toast-error {
    border-left: 4px solid var(--accent-red);
}

.lhk-toast-error i:first-child {
    color: var(--accent-red);
}

.lhk-toast-warning {
    border-left: 4px solid var(--accent-amber);
}

.lhk-toast-warning i:first-child {
    color: var(--accent-amber);
}

.lhk-toast-info {
    border-left: 4px solid var(--accent-blue);
}

.lhk-toast-info i:first-child {
    color: var(--accent-blue);
}


/* ========================================
   AUTH PAGES
   ======================================== */
/* Enhanced Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
        linear-gradient(180deg, var(--bg-primary) 0%, rgba(15, 23, 42, 0.4) 100%);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(20, 24, 48, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow:
        0 24px 48px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(124, 58, 237, 0.1);
    position: relative;
    z-index: 10;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 32px 64px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(124, 58, 237, 0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.auth-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form .form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.auth-form .form-control {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.auth-form .form-control:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    outline: none;
}

.btn-full {
    width: 100%;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    background: var(--gradient-primary);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-full:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

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

.auth-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-purple-light);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #fff;
    text-decoration: underline;
}


/* ========================================
   PROFILE HEADER
   ======================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    position: relative;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
}

.profile-role {
    font-size: 13px;
    color: var(--accent-purple-light);
    font-weight: 500;
}

.profile-email {
    font-size: 13px;
    color: var(--text-muted);
}


/* ========================================
   ALERT STYLES (enhanced)
   ======================================== */
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--accent-blue);
    color: var(--accent-blue-light);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--accent-green);
    color: var(--accent-green-light);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--accent-red);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Light mode overrides for new elements */
body.light-mode .lhk-loader-overlay {
    background: rgba(255, 255, 255, 0.75);
}

body.light-mode .lhk-toast {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

body.light-mode .auth-container {
    background: #f8fafc;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.06) 0%, transparent 40%),
        linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

body.light-mode .auth-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow:
        0 24px 48px -12px rgba(100, 116, 139, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.6);
}

body.light-mode .auth-header h1 {
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode .auth-form .form-control {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

body.light-mode .auth-form .form-control:focus {
    background: #ffffff;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

body.light-mode .profile-header {
    background: #ffffff;
    border-color: #e2e8f0;
}


/* ========================================
   🎯 COMMAND PALETTE (Ctrl+K)
   ======================================== */
.cmd-palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.cmd-palette-overlay.show {
    opacity: 1;
    visibility: visible;
}

.cmd-palette {
    width: 100%;
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transform: scale(0.95) translateY(-20px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cmd-palette-overlay.show .cmd-palette {
    transform: scale(1) translateY(0);
}

.cmd-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.cmd-palette-input-wrap i {
    color: var(--text-muted);
    font-size: 16px;
}

.cmd-palette-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-white);
    font-size: 16px;
    font-family: inherit;
}

.cmd-palette-input::placeholder {
    color: var(--text-muted);
}

.cmd-palette-kbd {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: monospace;
}

.cmd-palette-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}

.cmd-palette-results::-webkit-scrollbar {
    width: 4px;
}

.cmd-palette-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.cmd-palette-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 12px 4px;
    font-weight: 600;
}

.cmd-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.15s ease;
}

.cmd-palette-item:hover,
.cmd-palette-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--text-white);
}

.cmd-palette-item i {
    width: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--accent-purple);
}

.cmd-palette-item .cmd-shortcut {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.cmd-palette-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted);
}

.cmd-palette-footer kbd {
    display: inline-block;
    padding: 1px 5px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 10px;
    font-family: monospace;
    margin-right: 4px;
}


/* ========================================
   ⬆️ SCROLL TO TOP BUTTON
   ======================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 80px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
}


/* ========================================
   ⏱️ SESSION TIMEOUT WARNING
   ======================================== */
.session-warning-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.session-warning-overlay.show {
    opacity: 1;
    visibility: visible;
}

.session-warning-card {
    background: var(--bg-card);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.session-warning-card .warning-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--accent-red);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }
}

.session-warning-card h3 {
    color: var(--text-white);
    font-size: 18px;
    margin-bottom: 8px;
}

.session-warning-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.session-warning-card .countdown {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent-red);
    font-variant-numeric: tabular-nums;
    margin-bottom: 24px;
}


/* ========================================
   ⌨️ KEYBOARD SHORTCUTS OVERLAY
   ======================================== */
.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.shortcuts-overlay.show {
    opacity: 1;
    visibility: visible;
}

.shortcuts-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 540px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.4);
}

.shortcuts-card h3 {
    color: var(--text-white);
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shortcuts-card h3 i {
    color: var(--accent-purple);
}

.shortcut-group {
    margin-bottom: 20px;
}

.shortcut-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.shortcut-keys {
    display: flex;
    gap: 4px;
}

.shortcut-keys kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 8px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-primary);
    font-weight: 500;
}


/* ========================================
   📶 CONNECTIVITY BAR
   ======================================== */
.connectivity-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    z-index: 100001;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.connectivity-bar.show {
    transform: translateY(0);
}

.connectivity-bar.offline {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.connectivity-bar.online {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}


/* ========================================
   🔢 ANIMATED NUMBER COUNTER
   ======================================== */
.count-up {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}


/* ========================================
   LIGHT MODE: Feature overrides
   ======================================== */
body.light-mode .cmd-palette {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode .cmd-palette-input {
    color: #1e293b;
}

body.light-mode .cmd-palette-item:hover,
body.light-mode .cmd-palette-item.active {
    background: rgba(124, 58, 237, 0.06);
}

body.light-mode .session-warning-card {
    background: #ffffff;
    border-color: rgba(239, 68, 68, 0.2);
}

body.light-mode .shortcuts-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode .shortcut-keys kbd {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}

/* ── Logo Toggling ── */
.app-logo {
    display: none;
    height: auto;
    width: auto;
    max-height: 100%;
}

/* Default (Dark Mode) - Show logo-dark (white text) */
.app-logo.dark-ver {
    display: block;
}

/* Light Mode Override - Show logo (black text) */
body.light-mode .app-logo.dark-ver {
    display: none;
}

body.light-mode .app-logo.light-ver {
    display: block;
}


/* ========================================
   SIDEBAR OVERLAY (mobile backdrop)
   ======================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}


/* ========================================
   FILTER BAR (date pickers, dropdowns row)
   ======================================== */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input[type="date"],
.filter-bar .btn {
    min-height: 38px;
}


/* ========================================
   BOOTSTRAP-LIKE ROW / COL GRID
   Used in payment-settings and admin pages
   ======================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.row.g-3 {
    gap: 16px;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-md-6 {
    flex: 0 0 calc(50% - 8px);
    max-width: calc(50% - 8px);
}

.col-lg-8 {
    flex: 0 0 calc(66.67% - 8px);
    max-width: calc(66.67% - 8px);
}

.col-lg-4 {
    flex: 0 0 calc(33.33% - 8px);
    max-width: calc(33.33% - 8px);
}

.d-flex {
    display: flex;
}

.gap-3 {
    gap: 12px;
}

.pt-4 {
    padding-top: 16px;
}

.border-t {
    border-top: 1px solid var(--border-color);
}

.border-gray-700 {
    border-color: var(--border-color);
}

.uppercase {
    text-transform: uppercase;
}

.required::after {
    content: ' *';
    color: var(--accent-red);
}


/* ========================================
   PROFILE PAGE COMPONENTS
   ======================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
}

.profile-role {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-email {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}


/* ========================================
   TABS COMPONENT
   ======================================== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-purple-light);
    border-bottom-color: var(--accent-purple);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* ========================================
   NOTIFICATION DROPDOWN
   ======================================== */
.notification-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.notification-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-card-hover);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-text p {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
}


/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* ── Large screens (≤ 1200px) ── */
@media (max-width: 1200px) {
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ── Tablets & small laptops (≤ 1024px) ── */
@media (max-width: 1024px) {

    /* Sidebar: off-canvas on tablet */
    .sidebar {
        transform: translateX(-100%);
        z-index: 999;
        transition: transform var(--transition-slow);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 20px 20px;
    }

    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .col-span-2 {
        grid-column: span 1;
    }

    .col-span-3 {
        grid-column: span 1;
    }

    /* Show hamburger on tablet */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Topbar: reduce padding, shrink search */
    .topbar {
        padding: 0 16px;
    }

    .topbar .topbar-btn[onclick="openCmdPalette()"] {
        min-width: auto !important;
        padding: 8px 10px !important;
    }

    .topbar .topbar-btn[onclick="openCmdPalette()"] span {
        display: none;
    }

    .topbar .topbar-btn[onclick="openCmdPalette()"] kbd {
        display: none;
    }

    /* Row/Col: stack on tablet */
    .col-lg-8,
    .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Report layout: stack on tablet */
    .report-layout {
        grid-template-columns: 1fr;
    }
}


/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    /* Prevent horizontal overflow globally */
    body {
        overflow-x: hidden;
    }

    /* Impersonation banner: compact on mobile */
    .impersonation-banner {
        padding: 8px 12px;
    }

    .impersonation-banner-left {
        font-size: 12px;
        gap: 6px;
    }

    .impersonation-admin-hint {
        display: none;
    }

    .impersonation-stop-btn {
        font-size: 11px;
        padding: 5px 10px;
    }

    .main-content {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .page-content {
        padding: 16px 14px;
        overflow-x: hidden;
    }

    /* Force ALL inline grid-template-columns to stack */
    .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns: 2fr"],
    div[style*="grid-template-columns: 300px"],
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Support page: stack panels vertically */
    div[style*="height: calc(100vh"] {
        height: auto !important;
        min-height: 0 !important;
    }

    /* Grids: collapse to dual column */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid {
        gap: 14px;
    }

    /* Report layout: stack */
    .report-layout {
        grid-template-columns: 1fr;
    }

    /* Network detail header */
    .network-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Row / Col: full width */
    .row {
        flex-direction: column;
    }

    .col-md-6,
    .col-lg-8,
    .col-lg-4,
    .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Form rows: single column */
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr;
    }

    /* Cards */
    .card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .card-header h3 {
        font-size: 15px;
    }

    .card-body {
        padding: 14px 16px;
    }

    /* Stat cards */
    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .stat-card .stat-label {
        font-size: 11px;
    }

    /* Profile header */
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 20px 16px;
    }

    .profile-info {
        text-align: center;
    }

    .profile-info h2 {
        font-size: 18px;
    }

    /* Tabs: scrollable */
    .tabs {
        gap: 0;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 12px;
    }

    /* Topbar adjustments */
    .topbar {
        padding: 0 10px;
        gap: 8px;
    }

    .topbar-left {
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    .page-title {
        font-size: 15px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-right {
        gap: 2px;
        flex-shrink: 0;
    }

    .topbar-user .user-name {
        display: none;
    }

    .topbar-user {
        padding: 4px 6px 4px 4px;
    }

    .topbar-user .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .topbar-btn {
        padding: 6px;
        font-size: 15px;
    }

    /* Hide search button entirely on mobile */
    .topbar .topbar-btn[onclick="openCmdPalette()"] {
        display: none;
    }

    /* Notification dropdown: prevent cutoff */
    .notification-wrapper {
        position: static;
    }

    .notification-dropdown {
        position: fixed;
        top: var(--header-height);
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 70vh;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }

    /* Theme toggle */
    .theme-toggle {
        transform: scale(0.8);
    }

    /* Filter bar: stack vertically */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar select,
    .filter-bar input[type="date"] {
        width: 100%;
    }

    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }

    .filter-bar .form-group {
        width: 100%;
    }

    /* DataTable toolbar */
    .dt-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
    }

    .dt-toolbar-left,
    .dt-toolbar-right {
        width: 100%;
    }

    .dt-search {
        width: 100%;
    }

    /* Pagination */
    .dt-pagination {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .dt-pagination-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Tables: horizontal scroll + smaller text */
    .data-table {
        font-size: 12px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    /* Modals: almost full screen */
    .modal {
        width: 95%;
        max-height: 85vh;
        border-radius: var(--radius-lg);
    }

    .modal-header {
        padding: 16px 16px 0;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    /* Notification dropdown */
    .notification-dropdown {
        right: -60px;
        width: 300px;
    }

    /* Dashboard greeting banner */
    .flex.items-center.justify-between.mb-24[style*="padding"] {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 14px;
    }

    /* Chart containers */
    .chart-container {
        min-height: 250px;
    }

    /* Command palette */
    .cmd-palette {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    /* Session warning */
    .session-warning-card {
        width: 92%;
        padding: 20px;
    }

    /* Badges inside table */
    .data-table .badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Agreement page grid */
    div[style*="display:grid"][style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Flex that should wrap */
    .flex.items-center.justify-between {
        flex-wrap: wrap;
        gap: 12px;
    }
}


/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {
    .page-content {
        padding: 12px 10px;
    }

    /* Grids: single column */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        grid-template-columns: 1fr;
    }

    .grid {
        gap: 12px;
    }

    /* Stat cards */
    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    /* Topbar */
    .page-title {
        font-size: 14px;
        max-width: 100px;
    }

    .topbar {
        padding: 0 8px;
    }

    /* Card headers */
    .card-header {
        padding: 12px 14px;
    }

    .card-body {
        padding: 12px 14px;
    }

    .card-header h3 {
        font-size: 14px;
    }

    /* Tables even smaller */
    .data-table {
        font-size: 11px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 6px 8px;
    }

    /* Buttons */
    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Modals: full width bottom sheet */
    .modal {
        width: 100%;
        max-height: 90vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin-top: auto;
    }

    .modal-overlay.show {
        align-items: flex-end;
    }

    /* Pagination buttons smaller */
    .dt-pagination-buttons button {
        padding: 5px 8px;
        font-size: 11px;
        min-width: 28px;
    }

    /* Notification dropdown full width */
    .notification-dropdown {
        position: fixed;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 70vh;
    }

    /* Support chat */
    .chat-messages {
        max-height: 300px;
    }

    /* Sidebar brand logo */
    .sidebar-brand img {
        max-height: 32px;
    }

    /* Form controls */
    .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }

    select.form-control {
        font-size: 14px;
    }

    /* Profile */
    .profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 18px;
    }

    .profile-info h2 {
        font-size: 16px;
    }

    /* Tabs */
    .tab-btn {
        padding: 8px 12px;
        font-size: 11px;
    }
}


/* ── Touch-friendly: ensure minimum tap targets ── */
@media (hover: none) and (pointer: coarse) {
    .nav-link {
        min-height: 44px;
    }

    .btn {
        min-height: 40px;
    }

    .topbar-btn {
        min-height: 40px;
        min-width: 40px;
    }

    .data-table tbody td {
        padding: 10px 12px;
    }

    .dt-pagination-buttons button {
        min-height: 36px;
        min-width: 36px;
    }
}


/* ── Print: hide sidebar, topbar, and non-essential UI ── */
@media print {

    .sidebar,
    .sidebar-overlay,
    .topbar,
    .dt-toolbar,
    .dt-pagination,
    .filter-bar .btn,
    .hamburger-btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0;
    }

    .card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}