/* ========================================
   DESIGN SYSTEM - CSS VARIABLES
   "Obsidian Glass" — Premium Dark Theme
   ======================================== */
:root {
    /* Base Colors — Deep, rich darks with cool undertone */
    --color-bg-base: #09090b;
    --color-bg-body: #0c0c10;
    --color-bg-elevated: #141418;
    --color-bg-surface: #1c1c22;
    --color-bg-subtle: #27272a;

    /* Text Colors — High contrast with warm whites */
    --color-text-primary: #fafafa;
    --color-text-secondary: #d4d4d8;
    --color-text-muted: #a1a1aa;
    --color-text-subtle: #71717a;

    /* Accent Colors — Indigo/Violet spectrum */
    --color-primary: #6366f1;
    --color-primary-light: #818cf8;
    --color-primary-dark: #4f46e5;
    --color-secondary: #a78bfa;
    --color-accent: #38bdf8;

    /* Status Colors */
    --color-success: #10b981;
    --color-success-light: #34d399;
    --color-success-dark: #059669;
    --color-warning: #f59e0b;
    --color-warning-light: #fbbf24;
    --color-danger: #ef4444;
    --color-danger-light: #f87171;
    --color-info: #06b6d4;

    /* Gradients — Subtle, premium feel */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-hero: linear-gradient(135deg, #141418 0%, #1c1c22 50%, #141418 100%);
    --gradient-card: linear-gradient(145deg, rgba(20, 20, 24, 0.95) 0%, rgba(28, 28, 34, 0.7) 100%);
    --gradient-card-hover: linear-gradient(145deg, rgba(28, 28, 34, 0.98) 0%, rgba(39, 39, 42, 0.8) 100%);
    --gradient-border: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.5));
    --gradient-glow: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    --gradient-mesh: radial-gradient(at 27% 37%, rgba(99, 102, 241, 0.06) 0px, transparent 50%),
                     radial-gradient(at 97% 21%, rgba(139, 92, 246, 0.04) 0px, transparent 50%),
                     radial-gradient(at 52% 99%, rgba(16, 185, 129, 0.04) 0px, transparent 50%);

    /* Glow Effects */
    --glow-primary: 0 0 40px rgba(99, 102, 241, 0.12);
    --glow-primary-strong: 0 0 60px rgba(99, 102, 241, 0.2);
    --glow-success: 0 0 40px rgba(16, 185, 129, 0.12);
    --glow-danger: 0 0 40px rgba(239, 68, 68, 0.12);
    --glow-accent: 0 0 40px rgba(56, 189, 248, 0.12);

    /* Borders — Subtle, using alpha for layering */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-light: rgba(255, 255, 255, 0.1);
    --border-color-focus: rgba(99, 102, 241, 0.5);

    /* Shadows — Deeper, more dramatic */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 8px 32px rgba(99, 102, 241, 0.08);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.15);

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius — Slightly softer */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.625rem;
    --radius-xl: 0.875rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.25rem;
    --radius-full: 9999px;

    /* Transitions — Snappier */
    --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-tooltip: 500;

    /* Bootstrap Overrides */
    --bs-body-color: #d4d4d8;
    --bs-secondary-color: #a1a1aa;
    --bs-tertiary-color: #d4d4d8;
}

/* ========================================
   ANIMATIONS LIBRARY
   ======================================== */

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

/* Scale Animations */
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes scaleOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8); }
    70% { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* Continuous Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: var(--glow-primary); }
    50% { box-shadow: var(--glow-primary-strong); }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25%); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Gradient Animation */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glow Pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.2),
                    0 0 40px rgba(99, 102, 241, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.3),
                    0 0 60px rgba(99, 102, 241, 0.2);
    }
}

/* Border Glow */
@keyframes borderGlow {
    0%, 100% { border-color: rgba(99, 102, 241, 0.3); }
    50% { border-color: rgba(99, 102, 241, 0.6); }
}

/* Counter Animation (for numbers) */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ripple Effect */
@keyframes ripple {
    0% { transform: scale(0); opacity: 0.5; }
    100% { transform: scale(4); opacity: 0; }
}

/* Shimmer Loading */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Animation Utility Classes */
.animate-fade-in { animation: fadeIn var(--transition-normal) ease-out forwards; }
.animate-slide-up { animation: slideUp var(--transition-normal) ease-out forwards; }
.animate-slide-down { animation: slideDown var(--transition-normal) ease-out forwards; }
.animate-slide-in-left { animation: slideInLeft var(--transition-normal) ease-out forwards; }
.animate-slide-in-right { animation: slideInRight var(--transition-normal) ease-out forwards; }
.animate-scale-in { animation: scaleIn var(--transition-normal) ease-out forwards; }
.animate-pop-in { animation: popIn var(--transition-bounce) forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounce 1s ease-in-out infinite; }
.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* Animation Delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Initial state for animations */
.animate-on-load {
    opacity: 0;
}

/* Transition Utilities */
.transition-all { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }
.transition-colors { transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast); }
.transition-transform { transition: transform var(--transition-normal); }
.transition-shadow { transition: box-shadow var(--transition-normal); }

/* Hover Transforms */
.hover-lift:hover { transform: translateY(-4px); }
.hover-scale:hover { transform: scale(1.02); }
.hover-glow:hover { box-shadow: var(--glow-primary); }

/* ========================================
   BASE STYLES
   ======================================== */

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--color-bg-body);
    color: var(--color-text-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    letter-spacing: -0.011em;
}

/* Global label styling for dark theme */
label,
.form-label,
.form-check-label {
    color: var(--color-text-secondary);
    font-weight: 500;
    font-size: 0.8125rem;
}

/* Bootstrap text-muted override for dark theme */
.text-muted {
    color: var(--color-text-muted) !important;
}

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

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

/* Additional text color utilities */
p {
    color: var(--color-text-secondary);
}

span {
    color: inherit;
}

a, .btn-link {
    color: var(--color-primary-light);
}

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

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

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

.btn-outline-danger {
    color: var(--color-danger-light);
    border-color: var(--color-danger);
}

.btn-outline-success {
    color: var(--color-success-light);
    border-color: var(--color-success);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 2px var(--color-bg-base), 0 0 0 4px rgba(99, 102, 241, 0.4);
}

.content {
    padding-top: 1.5rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #f87171;
}

.blazor-error-boundary {
    background: #7f1d1d;
    padding: 1rem 1rem 1rem 3.7rem;
    color: #fee2e2;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: var(--border-color-light);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ========================================
   LAYOUT - PAGE STRUCTURE
   ======================================== */

.page {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg-base);
    background-image: var(--gradient-mesh);
}

/* Sidebar Collapse Checkbox (hidden) */
.sidebar-collapse-checkbox {
    display: none;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--color-bg-elevated);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: width 0.25s ease;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-text-primary);
    transition: var(--transition-fast);
}

.sidebar-brand:hover {
    color: var(--color-text-primary);
    opacity: 0.9;
}

.sidebar-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand-icon .brand-icon-text {
    font-size: 0.875rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.sidebar-brand-name {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

.sidebar-brand-label {
    font-size: 0.6875rem;
    color: var(--color-text-subtle);
    margin-top: 0.15rem;
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.5rem;
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1;
}

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

.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--color-text-subtle);
    margin-top: 0.15rem;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--color-text-subtle);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.75rem;
}

.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
}

.sidebar-version {
    font-size: 0.65rem;
    color: var(--color-text-subtle);
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    transition: margin-left 0.25s ease;
}

/* App Header — Slim, minimal */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    height: 52px;
    padding: 0 1.5rem;
    background: rgba(12, 12, 16, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Desktop Sidebar Toggle */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-secondary);
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-secondary);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.header-breadcrumb-app {
    color: var(--color-text-subtle);
    font-weight: 500;
}

.header-breadcrumb-sep {
    font-size: 0.55rem;
    color: var(--color-text-subtle);
    opacity: 0.6;
}

.header-breadcrumb-page {
    color: var(--color-text-secondary);
    font-weight: 600;
}

.header-breadcrumb-link {
    text-decoration: none;
    transition: color var(--transition-fast);
}

.header-breadcrumb-link:hover {
    color: var(--color-primary-light);
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.95rem;
}

.header-icon-btn:hover {
    background: var(--color-bg-subtle);
    color: var(--color-primary-light);
    border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.header-env-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    color: var(--color-success-light);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.header-env-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

/* Legacy: keep old classes working */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-text-primary);
    transition: var(--transition-fast);
}

.topbar-brand:hover {
    color: var(--color-primary-light);
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    color: #fff;
    font-size: 0.9rem;
}

.brand-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand-logo {
    height: 36px;
    width: auto;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    color: #fff;
    font-size: 0.8rem;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--color-danger);
}

/* Content Area */
.content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1480px;
    width: 100%;
}

/* ========================================
   NAVIGATION - SIDEBAR NAV
   ======================================== */

.navbar-toggler {
    display: none;
}

.navbar-toggler-label {
    display: none;
    width: 100%;
    height: 3.25rem;
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
}

.toggler-icon,
.toggler-icon::before,
.toggler-icon::after {
    position: absolute;
    width: 20px;
    height: 1.5px;
    background: var(--color-text-secondary);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.toggler-icon {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.toggler-icon::before,
.toggler-icon::after {
    content: '';
    left: 0;
}

.toggler-icon::before { top: -7px; }
.toggler-icon::after { top: 7px; }

.navbar-toggler:checked + .navbar-toggler-label .toggler-icon {
    background: transparent;
}

.navbar-toggler:checked + .navbar-toggler-label .toggler-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.navbar-toggler:checked + .navbar-toggler-label .toggler-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.nav-scrollable::-webkit-scrollbar {
    width: 3px;
}

.nav-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color-light);
    border-radius: var(--radius-full);
}

.nav-section {
    padding: 0 0.625rem;
    margin-bottom: 0.25rem;
}

.nav-section-title {
    padding: 1rem 0.625rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-subtle);
}

/* Sidebar collapse transitions for text elements */
.sidebar-brand-text,
.nav-section-title,
.nav-text,
.sidebar-user-info {
    transition: opacity 0.2s ease, width 0.2s ease;
}

.nav-item {
    margin-bottom: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--color-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: height var(--transition-fast);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text-secondary);
}

.nav-link:hover .nav-icon-wrapper {
    color: var(--color-primary-light);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--color-text-primary);
}

.nav-link.active::before {
    height: 16px;
}

.nav-link.active .nav-icon-wrapper {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
}

.nav-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    flex-shrink: 0;
    color: var(--color-text-subtle);
    position: relative;
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.nav-icon-wrapper.admin {
    color: var(--color-secondary);
}

.nav-link.active .nav-icon-wrapper.admin {
    background: rgba(167, 139, 250, 0.15);
    color: var(--color-secondary);
}

.nav-icon {
    font-size: 0.8rem;
    line-height: 1;
}

.nav-text {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ========================================
   DATA TABLES - Enhanced
   ======================================== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.detail-card-body > .data-table {
    min-width: 900px;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 2px solid var(--border-color);
    padding: 0.85rem 1rem;
    text-align: left;
    vertical-align: middle;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    text-align: left;
    vertical-align: middle;
    color: var(--color-text-secondary);
    transition: var(--transition-fast);
}

/* ── Compact density ── */
.table-compact .data-table th {
    padding: 0.45rem 0.75rem;
    font-size: 0.65rem;
}

.table-compact .data-table td {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    line-height: 1.3;
}

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

.data-table .col-top-app {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.data-table tbody tr:hover td {
    color: var(--color-text-primary);
}

/* Badge for tables - Enhanced */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    background: var(--border-color);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.badge.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success-light);
}
.badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger-light);
}
.badge.warn {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}
.badge.info {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary-light);
}

/* Filter Bar */
.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

/* Page Title */
.page-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0 0 1.5rem;
    color: var(--color-text-primary);
}

.title-icon {
    color: var(--color-primary-light);
    font-size: 1rem;
    opacity: 0.8;
}

/* Card - Glassmorphism */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-elevated);
    box-shadow: var(--shadow-card);
    transition: var(--transition-normal);
}

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

.card-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-elevated);
    box-shadow: var(--shadow-card);
}

.card h4 {
    margin: 0 0 0.5rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

.card .metric {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.json-box {
    white-space: pre-wrap;
    background: var(--color-bg-base);
    color: var(--color-text-secondary);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    max-height: 420px;
    overflow: auto;
}

.app-icon {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-xl);
    object-fit: cover;
    margin-right: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--color-bg-base);
}

.app-icon-sm {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-xl);
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: var(--color-bg-base);
}

.form-control,
.form-select {
    background: var(--color-bg-base);
    border: 1px solid var(--border-color-light);
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    transition: var(--transition-fast);
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    background: var(--color-bg-base);
    border-color: var(--color-primary);
    color: var(--color-text-primary);
    box-shadow: 0 0 0 2px var(--color-bg-base), 0 0 0 4px rgba(99, 102, 241, 0.25);
    outline: none;
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly],
.form-select[readonly] {
    background: var(--color-bg-surface);
    color: var(--color-text-muted);
    opacity: 1;
}

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

/* Date/time picker icons - make them visible on dark backgrounds */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7) brightness(1.2);
    cursor: pointer;
}

/* Select dropdown arrow */
.form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-image: var(--bs-form-select-bg-img) !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* ========================================
   SIDEBAR COLLAPSED STATE (Desktop)
   ======================================== */
.sidebar-collapse-checkbox:checked ~ .sidebar {
    width: 68px;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-brand-text,
.sidebar-collapse-checkbox:checked ~ .sidebar .nav-section-title,
.sidebar-collapse-checkbox:checked ~ .sidebar .nav-text,
.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-user-info,
.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-user-name,
.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-user-role {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-brand {
    justify-content: center;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-user {
    justify-content: center;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-footer {
    padding: 0.75rem 0.25rem;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-header {
    padding: 1.25rem 0.5rem;
}

.sidebar-collapse-checkbox:checked ~ .sidebar .sidebar-logout-btn {
    display: none;
}

.sidebar-collapse-checkbox:checked ~ .main-content {
    margin-left: 68px;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
}

@media (max-width: 992px) {
    /* Sidebar becomes mobile menu */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        transition: var(--transition-slow);
        z-index: 1000;
    }

    .sidebar.open {
        left: 0;
    }

    .navbar-toggler-label {
        display: none;
    }

    .sidebar-toggle-btn {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

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

    .app-header {
        margin-left: 0;
    }

    .navbar-toggler:checked ~ .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .navbar-toggler:checked ~ .sidebar {
        left: 0;
    }

    .nav-scrollable {
        display: block;
    }

    .content {
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chart-card {
        min-height: 260px;
    }

    .map-card {
        height: 280px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-header-right {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.125rem;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .app-header {
        padding: 0 0.75rem;
        height: 48px;
    }

    .brand-text {
        display: none;
    }

    .user-name {
        display: none;
    }

    .content {
        padding: 0.75rem;
        overflow-x: hidden;
    }

    .header-breadcrumb-app {
        display: none;
    }

    .header-breadcrumb-sep {
        display: none;
    }

    .header-env-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .time-range-selector {
        flex-wrap: wrap;
    }

    .time-range-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .modal-dialog {
        padding: 0.5rem;
        max-width: calc(100vw - 1rem);
    }

    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* ========================================
   MODAL STYLES - Enhanced
   ======================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal-backdrop);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn var(--transition-fast) ease-out;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-modal);
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    animation: scaleIn var(--transition-normal) ease-out;
}

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

.modal-content {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition-fast);
}

.btn-close::before {
    content: "\00d7";
}

.btn-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--color-danger);
}

/* ========================================
   BUTTONS - Refined
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    letter-spacing: -0.01em;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    color: #fff;
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    color: #fff;
}

.btn-outline-primary {
    color: var(--color-primary-light);
    background: transparent;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.btn-outline-primary:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--color-primary);
    color: var(--color-primary-light);
}

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

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-text-secondary);
}

.btn-outline-danger {
    color: var(--color-danger-light);
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--color-danger);
}

.btn-outline-success {
    color: var(--color-success-light);
    background: transparent;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-outline-success:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--color-success);
}

.btn-danger {
    color: #fff;
    background: var(--color-danger);
    border: 1px solid var(--color-danger);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
}

.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 2px var(--color-bg-base), 0 0 0 4px rgba(99, 102, 241, 0.3);
    outline: none;
}

/* Button with loading spinner */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ========================================
   ENHANCED DASHBOARD STYLES
   ======================================== */

/* Skeleton Loading — reusable building blocks */
.skeleton-page {
    padding: 1rem 0;
    animation: fadeIn 0.3s ease;
}

.skeleton-page-header {
    height: 56px;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-lg);
}

.skeleton-filter-bar {
    height: 52px;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-lg);
}

.skeleton-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-summary-card {
    height: 100px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-lg);
}

.skeleton-table {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-table-row {
    height: 48px;
    margin-bottom: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-table-row:first-child {
    height: 44px;
    opacity: 0.7;
}

.skeleton-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.skeleton-card {
    height: 160px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-lg);
}

/* Overview Skeleton (unchanged layout) */
.skeleton-dashboard {
    padding: 1rem 0;
}

.skeleton-header,
.skeleton-hero,
.skeleton-stat,
.skeleton-chart {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 1rem;
}

.skeleton-header {
    height: 80px;
    margin-bottom: 1.5rem;
}

.skeleton-hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-hero {
    height: 140px;
}

.skeleton-stats-grid {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-stat {
    flex: 1;
    height: 100px;
}

.skeleton-charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.skeleton-chart {
    height: 300px;
}

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

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    animation: slideUp 0.4s ease-out;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--color-text-primary);
    margin: 0;
    letter-spacing: -0.03em;
}

.dashboard-title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.dashboard-subtitle {
    color: var(--color-text-subtle);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    margin-left: 56px;
}

.dashboard-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    color: var(--color-success-light);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.last-update {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text-subtle);
    font-size: 0.75rem;
}

/* Revenue Hero Card */
.revenue-hero {
    position: relative;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
    animation-delay: 0.05s;
    animation-fill-mode: both;
}

.revenue-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-glow);
    pointer-events: none;
}

.revenue-hero-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle at 70% 50%, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.revenue-hero-content {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 200px 1fr;
    gap: 2.5rem;
    align-items: center;
}

.revenue-hero-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.revenue-hero-label i {
    color: var(--color-success);
}

.revenue-hero-value {
    font-size: 3.75rem;
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countUp 0.8s ease-out;
}

.revenue-hero-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.revenue-hero-trend.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success-light);
}

.revenue-hero-trend.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger-light);
}

.revenue-hero-trend .trend-label {
    color: var(--color-text-subtle);
    font-weight: 400;
}

.revenue-hero-chart {
    height: 100px;
}

.revenue-hero-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.revenue-hero-breakdown {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

.breakdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.breakdown-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.breakdown-circle.subscribed { background: var(--color-success); }
.breakdown-circle.renewals { background: var(--color-primary); }
.breakdown-circle.onetime { background: var(--color-secondary); }

.breakdown-info {
    display: flex;
    flex-direction: column;
}

.breakdown-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.breakdown-label {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
}

/* Stats Cards with Progress Rings */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: slideUp 0.4s ease-out;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.25s; }
.stat-card:nth-child(5) { animation-delay: 0.3s; }

.stat-card.glass {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

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

.stat-card.subscribed:hover { border-color: rgba(16, 185, 129, 0.25); }
.stat-card.renewals:hover { border-color: rgba(99, 102, 241, 0.25); }
.stat-card.downloads:hover { border-color: rgba(6, 182, 212, 0.25); }
.stat-card.refunds:hover { border-color: rgba(245, 158, 11, 0.25); }
.stat-card.expired:hover { border-color: rgba(239, 68, 68, 0.25); }

.stat-card-icon {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.stat-card-icon .progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.stat-card-icon .progress-ring circle {
    transition: stroke-dasharray 1s ease-out;
}

.stat-card-icon i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.15rem;
    transition: var(--transition-fast);
}

.stat-card:hover .stat-card-icon i {
    transform: translate(-50%, -50%) scale(1.1);
}

.stat-card.subscribed .stat-card-icon i { color: var(--color-success); }
.stat-card.renewals .stat-card-icon i { color: var(--color-primary); }
.stat-card.downloads .stat-card-icon i { color: var(--color-info); }
.stat-card.refunds .stat-card-icon i { color: var(--color-warning); }
.stat-card.expired .stat-card-icon i { color: var(--color-danger); }

.stat-card-content {
    flex: 1;
    min-width: 0;
}

.stat-card-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

.stat-card-sub {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
    margin-top: 0.4rem;
}

.stat-card-sub .trend-up {
    color: var(--color-success-light);
    font-weight: 600;
}
.stat-card-sub .trend-down {
    color: var(--color-danger-light);
    font-weight: 600;
}

/* Heatmap Section - Enhanced */
.heatmap-section {
    margin-bottom: 2rem;
    animation: slideUp 0.5s ease-out;
    animation-delay: 0.4s;
    animation-fill-mode: both;
}

.section-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header-inline h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.section-header-inline h2 i {
    color: var(--color-warning);
}

.section-badge {
    padding: 0.4rem 0.85rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary-light);
}

.section-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
}

.section-link:hover {
    color: var(--color-primary-light);
    gap: 0.75rem;
}

.heatmap-container {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(30, 1fr);
    gap: 5px;
    margin-bottom: 1rem;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.heatmap-cell:hover {
    transform: scale(1.4);
    z-index: 1;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.heatmap-cell.level-0 { background: var(--border-color); }
.heatmap-cell.level-1 { background: #166534; }
.heatmap-cell.level-2 { background: var(--color-success); }
.heatmap-cell.level-3 { background: var(--color-success-light); }
.heatmap-cell.level-4 { background: #86efac; }

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--color-text-subtle);
}

.heatmap-legend .heatmap-cell {
    width: 14px;
    height: 14px;
}

.heatmap-legend .heatmap-cell:hover {
    transform: none;
    box-shadow: none;
}

/* Apps Showcase - Enhanced */
.apps-showcase {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.app-showcase-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--gradient-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-normal);
    overflow: hidden;
}

.app-showcase-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.app-showcase-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
}

.app-showcase-card:hover::before {
    transform: scaleX(1);
}

.app-showcase-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.app-showcase-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 1px solid var(--border-color-light);
    transition: var(--transition-fast);
}

.app-showcase-card:hover .app-showcase-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.app-showcase-icon-placeholder {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--border-color), var(--border-color-light));
    border-radius: var(--radius-lg);
    color: var(--color-text-subtle);
    font-size: 1.25rem;
}

.app-showcase-info {
    flex: 1;
    min-width: 0;
}

.app-showcase-name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-showcase-id {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-subtle);
}

.app-showcase-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: 700;
}

.app-showcase-badge.positive {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success-light);
}

.app-showcase-badge.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger-light);
}

.app-showcase-chart {
    height: 60px;
    margin-bottom: 1rem;
}

.app-showcase-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.app-showcase-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.app-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition-fast);
}

.app-metric:hover {
    background: rgba(255, 255, 255, 0.06);
}

.app-metric.highlight {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.app-metric-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.app-metric.highlight .app-metric-value {
    color: var(--color-success-light);
}

.app-metric-label {
    font-size: 0.6rem;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Charts Section - Enhanced */
.charts-section {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.charts-trio {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition-normal);
}

.chart-card:hover {
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-md);
}

.chart-card.primary {
    border-color: rgba(16, 185, 129, 0.2);
}

.chart-card.primary:hover {
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.12);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.chart-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.chart-card-title i {
    color: var(--color-primary);
    font-size: 0.85rem;
}

.chart-card.primary .chart-card-title i {
    color: var(--color-success);
}

.chart-card-actions {
    display: flex;
    gap: 0.35rem;
}

.chart-period-btn {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    color: var(--color-text-subtle);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.chart-period-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-text-muted);
}

.chart-period-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.chart-card-body {
    padding: 1.25rem;
    height: 260px;
    overflow: hidden;
}

.chart-card-body.large {
    height: 320px;
}

.chart-card-body.donut {
    height: 240px;
}

.chart-card-body canvas {
    max-height: 100%;
    max-width: 100%;
}

.chart-card-footer {
    display: flex;
    justify-content: space-around;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.chart-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.chart-stat-label {
    font-size: 0.7rem;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.chart-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.chart-stat-value.highlight {
    color: var(--color-success);
}

/* Activity Section - Enhanced */
.activity-section {
    margin-bottom: 2rem;
}

.activity-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.activity-column {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition-normal);
}

.activity-column:hover {
    border-color: var(--border-color-light);
}

.activity-column-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: rgba(255, 255, 255, 0.02);
}

.activity-column-header i {
    color: var(--color-primary);
}

.activity-count {
    margin-left: auto;
    padding: 0.25rem 0.6rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    color: var(--color-primary-light);
}

.activity-feed {
    max-height: 380px;
    overflow-y: auto;
}

.activity-feed::-webkit-scrollbar {
    width: 4px;
}

.activity-feed::-webkit-scrollbar-track {
    background: transparent;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

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

.feed-item:hover {
    background: rgba(99, 102, 241, 0.04);
}

.feed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.feed-item:hover .feed-icon {
    transform: scale(1.1);
}

.feed-item.success .feed-icon { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.feed-item.info .feed-icon { background: rgba(99, 102, 241, 0.12); color: var(--color-primary); }
.feed-item.warning .feed-icon { background: rgba(249, 115, 22, 0.15); color: var(--color-warning); }
.feed-item.danger .feed-icon { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.feed-item.purple .feed-icon { background: rgba(168, 85, 247, 0.15); color: var(--color-secondary); }
.feed-item.download .feed-icon { background: rgba(6, 182, 212, 0.15); color: var(--color-info); }
.feed-item.default .feed-icon { background: var(--border-color); color: var(--color-text-muted); }

.feed-content { flex: 1; min-width: 0; }

.feed-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-primary);
}

.feed-subtype {
    font-size: 0.65rem;
    color: var(--color-text-subtle);
    background: var(--border-color);
    padding: 0.18rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.feed-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--color-text-subtle);
}

.feed-app { color: var(--color-text-muted); }
.feed-revenue { color: var(--color-success-light); font-weight: 600; }

.feed-location {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.feed-location i { font-size: 0.6rem; color: var(--color-warning); }

.feed-time {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--color-text-subtle);
    white-space: nowrap;
}

.activity-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem;
    border-top: 1px solid var(--border-color);
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
    background: rgba(255, 255, 255, 0.02);
}

.activity-view-all:hover {
    background: rgba(99, 102, 241, 0.06);
    color: var(--color-primary-light);
    gap: 0.75rem;
}
.map-section {
    margin-bottom: 2rem;
}

.world-map-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.world-map-canvas {
    height: 400px;
    background: var(--color-bg-base);
}

.map-sidebar {
    padding: 1.5rem;
    background: var(--color-bg-surface);
    border-left: 1px solid var(--border-color);
}

.map-sidebar h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem;
}

.country-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.country-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}

.country-item.empty {
    flex-direction: column;
    color: var(--color-text-subtle);
    font-size: 0.8rem;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.country-item.empty i {
    font-size: 1.5rem;
    opacity: 0.5;
}

.country-flag {
    font-size: 1.25rem;
}

.country-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.country-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-success);
}

.map-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.map-stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}

.map-stat-item i {
    color: var(--color-primary);
    font-size: 1rem;
}

.map-stat-item .map-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.map-stat-item .map-stat-label {
    font-size: 0.7rem;
    color: var(--color-text-subtle);
}

/* Pulse Marker for Map */
.pulse-marker {
    position: relative;
}

.pulse-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-success);
    border-radius: 50%;
    animation: pulse-ring 1.5s ease-out infinite;
}

.pulse-core {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 10px;
    height: 10px;
    background: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Insights Section */
.insights-section {
    margin-bottom: 2rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid;
}

.insight-card.positive {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.15);
}

.insight-card.warning {
    background: rgba(245, 158, 11, 0.04);
    border-color: rgba(245, 158, 11, 0.15);
}

.insight-card.danger {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.15);
}

.insight-card.info {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}

.insight-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1rem;
    flex-shrink: 0;
}

.insight-card.positive .insight-icon { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.insight-card.warning .insight-icon { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }
.insight-card.danger .insight-icon { background: rgba(239, 68, 68, 0.12); color: var(--color-danger); }
.insight-card.info .insight-icon { background: rgba(99, 102, 241, 0.12); color: var(--color-primary); }

.insight-content { flex: 1; }

.insight-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    margin-bottom: 0.35rem;
}

.insight-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 1400px) {
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .apps-showcase {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .revenue-hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .revenue-hero-chart {
        height: 80px;
    }
    
    .revenue-hero-breakdown {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .charts-trio {
        grid-template-columns: 1fr 1fr;
    }
    
    .charts-trio .chart-card:last-child {
        grid-column: span 2;
    }
    
    .world-map-container {
        grid-template-columns: 1fr;
    }
    
    .map-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .country-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .country-item {
        flex: 1;
        min-width: 140px;
    }
    
    .map-stats {
        flex-direction: row;
    }
    
    .map-stat-item {
        flex: 1;
    }
}

@media (max-width: 992px) {
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .heatmap-grid {
        grid-template-columns: repeat(15, 1fr);
    }
    
    .apps-showcase {
        grid-template-columns: 1fr;
    }
    
    .charts-trio {
        grid-template-columns: 1fr;
    }
    
    .charts-trio .chart-card:last-child {
        grid-column: span 1;
    }
    
    .activity-columns {
        grid-template-columns: 1fr;
    }
    
    .skeleton-hero-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .skeleton-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .revenue-hero {
        padding: 1.25rem;
    }
    
    .revenue-hero-value {
        font-size: 2.5rem;
    }
    
    .heatmap-grid {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .chart-card-body {
        height: 200px;
    }
    
    .world-map-canvas {
        height: 280px;
    }
    
    .skeleton-hero-grid,
    .skeleton-stats-grid {
        flex-direction: column;
    }
    
    .skeleton-stats-grid {
        display: flex;
    }
}

/* ========================================
   RICH TOOLTIPS
   ======================================== */

[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
    z-index: var(--z-tooltip);
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 0.5rem 0.85rem;
    background: rgba(9, 9, 11, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

[data-tooltip]::after {
    content: '';
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(9, 9, 11, 0.95);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

[data-tooltip]:hover::before {
    transform: translateX(-50%) translateY(0);
}

/* Tooltip Positions */
[data-tooltip-pos="bottom"]::before {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: rgba(9, 9, 11, 0.95);
}

[data-tooltip-pos="bottom"]:hover::before {
    transform: translateX(-50%) translateY(0);
}

[data-tooltip-pos="left"]::before {
    bottom: auto;
    left: auto;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
}

[data-tooltip-pos="left"]::after {
    bottom: auto;
    left: auto;
    right: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border-top-color: transparent;
    border-left-color: rgba(9, 9, 11, 0.95);
}

[data-tooltip-pos="left"]:hover::before {
    transform: translateY(-50%) translateX(0);
}

[data-tooltip-pos="right"]::before {
    bottom: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
}

[data-tooltip-pos="right"]::after {
    bottom: auto;
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border-top-color: transparent;
    border-right-color: rgba(9, 9, 11, 0.95);
}

[data-tooltip-pos="right"]:hover::before {
    transform: translateY(-50%) translateX(0);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(9, 9, 11, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    color: var(--color-text-primary);
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

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

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

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    font-size: 0.9rem;
}

.toast.success .toast-icon {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.toast.info .toast-icon {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
}

.toast.warning .toast-icon {
    background: rgba(249, 115, 22, 0.15);
    color: var(--color-warning);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-subtle);
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-left: auto;
}

.toast-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    animation: toastProgress 5s linear forwards;
}

.toast.success .toast-progress { background: var(--color-success); }
.toast.warning .toast-progress { background: var(--color-warning); }
.toast.error .toast-progress { background: var(--color-danger); }

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ========================================
   ANIMATED COUNTER
   ======================================== */

.counter-animate {
    display: inline-block;
}

.counter-animate.counting {
    animation: counterPulse 0.1s ease-out;
}

@keyframes counterPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ========================================
   DASHBOARD GRID LAYOUT
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid-3 { grid-template-columns: 1fr; }
    .dashboard-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ========================================
   SECTION TITLE
   ======================================== */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
    margin: 1.75rem 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title i {
    color: var(--color-primary-light);
    font-size: 0.95rem;
}

.section-title .section-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-primary-light);
    border-radius: var(--radius-full);
}

/* ========================================
   PAGE HEADER - Enhanced with subtitle
   ======================================== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    animation: slideUp 0.5s ease-out;
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.page-header .page-title {
    margin: 0;
}

.page-subtitle {
    color: var(--color-text-subtle);
    font-size: 0.9rem;
    margin-left: 2.5rem;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========================================
   DETAIL CARD - For EventDetail etc.
   ======================================== */
.detail-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    animation: slideUp 0.5s ease-out;
}

.detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.detail-card-header h2 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.detail-card-header h2 i {
    font-size: 0.95rem;
    color: var(--color-primary-light);
}

.detail-card-body {
    padding: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.detail-field.full-width {
    grid-column: span 2;
}

.detail-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-subtle);
}

.detail-field-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-primary);
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    word-break: break-all;
}

.detail-field-value.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-field.full-width { grid-column: span 1; }
}

/* ========================================
   ACTION BAR (for button groups)
   ======================================== */
.action-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.action-bar .separator {
    width: 1px;
    height: 24px;
    background: var(--border-color-light);
    margin: 0 0.35rem;
}

/* ========================================
   STATUS INDICATOR
   ======================================== */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-indicator.ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success-light);
}

.status-indicator.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger-light);
}

.status-indicator.warn {
    background: rgba(249, 115, 22, 0.15);
    color: var(--color-warning-light);
}

.status-indicator.new {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary-light);
}

.status-indicator i {
    font-size: 0.7rem;
}

/* ========================================
   APP CARDS - Grid Layout for Apps page
   ======================================== */
.app-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.app-card-link {
    text-decoration: none;
    color: inherit;
}

.app-card-link:hover {
    color: inherit;
}

.app-detail-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--gradient-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: all var(--transition-normal);
    overflow: hidden;
}

.app-detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.app-detail-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    transform: translateY(-6px);
}

.app-detail-card:hover::before {
    transform: scaleX(1);
}

.app-detail-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-detail-card .app-icon-card {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-xl);
    object-fit: cover;
    border: 2px solid var(--border-color-light);
    background: var(--color-bg-base);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.app-detail-card:hover .app-icon-card {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.app-detail-card-info {
    flex: 1;
    min-width: 0;
}

.app-detail-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.2rem;
}

.app-detail-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-subtle);
}

.app-detail-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.app-detail-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition-fast);
}

.app-detail-stat:hover {
    background: rgba(255, 255, 255, 0.06);
}

.app-detail-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.app-detail-stat-label {
    font-size: 0.65rem;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-detail-stat.highlight {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.app-detail-stat.highlight .app-detail-stat-value {
    color: var(--color-success-light);
}

/* ========================================
   HEALTH CARDS for Admin page
   ======================================== */
.health-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--gradient-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.health-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.health-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-xl);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.health-card-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.health-card-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.health-card-icon.info {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
}

.health-card-icon.warning {
    background: rgba(249, 115, 22, 0.15);
    color: var(--color-warning);
}

.health-card-content {
    flex: 1;
    min-width: 0;
}

.health-card-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.health-card-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

/* ========================================
   USER TABLE with Avatars
   ======================================== */
.user-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-row-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 50%;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-row-info {
    flex: 1;
    min-width: 0;
}

.user-row-email {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-primary);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
}

.role-badge.viewer {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary-light);
}

/* ========================================
   TABS - Enhanced (for ServerApi etc.)
   ======================================== */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
    padding: 0.5rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--color-text-secondary);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border-color: transparent;
}

.tab-btn i {
    font-size: 0.8rem;
}

/* ========================================
   TOOL CARD for Tools page
   ======================================== */
.tool-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: var(--transition-normal);
    margin-bottom: 1.5rem;
}

.tool-card:hover {
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-md);
}

.tool-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.tool-card-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    font-size: 1rem;
}

.tool-card-header-icon.primary {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
}

.tool-card-header-icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--color-secondary);
}

.tool-card-header-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.tool-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.tool-card-header p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--color-text-subtle);
}

.tool-card-body {
    padding: 1.5rem;
}

/* ========================================
   FORM ROW layout
   ======================================== */
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ========================================
   RESULT BOX (for API results)
   ======================================== */
.result-box {
    background: var(--color-bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1rem;
}

.result-box h4 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* ========================================
   DETAIL TABLE (for ServerApi results)
   ======================================== */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    width: 200px;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.detail-table td {
    padding: 0.6rem 0.85rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-table tr:last-child th,
.detail-table tr:last-child td {
    border-bottom: none;
}

/* ========================================
   CODE BLOCK
   ======================================== */
.code-block {
    background: var(--color-bg-base);
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    border: 1px solid var(--border-color);
    color: var(--color-text-secondary);
}

code {
    background: var(--color-bg-base);
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    color: var(--color-text-secondary);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--color-text-subtle);
}

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

.empty-state p {
    color: var(--color-text-subtle);
    font-size: 0.9rem;
}

/* ========================================
   BACK LINK
   ======================================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 1.25rem;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--color-primary-light);
    gap: 0.65rem;
}

.back-link i {
    font-size: 0.75rem;
}

/* ========================================
   PAGINATION - Enhanced
   ======================================== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.pagination-info strong {
    color: var(--color-text-primary);
}

/* ========================================
   MAP CARD
   ======================================== */
.map-card {
    height: 350px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ========================================
   CHECKLIST
   ======================================== */
.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist li {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.checklist li:last-child {
    border-bottom: none;
}

.checklist li strong {
    color: var(--color-text-primary);
}

/* ========================================
   CHECKBOX LABEL
   ======================================== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-secondary);
}

/* ========================================
   RANKING BADGE OVERRIDES
   ======================================== */
.badge.bg-success {
    background: rgba(34, 197, 94, 0.2) !important;
    color: var(--color-success-light) !important;
    font-weight: 700;
}

.badge.bg-primary {
    background: rgba(99, 102, 241, 0.15) !important;
    color: var(--color-primary-light) !important;
}

.badge.bg-info {
    background: rgba(6, 182, 212, 0.2) !important;
    color: var(--color-info) !important;
}

.badge.bg-warning {
    background: rgba(249, 115, 22, 0.2) !important;
    color: var(--color-warning-light) !important;
}

.badge.bg-secondary {
    background: rgba(100, 116, 139, 0.2) !important;
    color: var(--color-text-muted) !important;
}

.badge.bg-warning.text-dark {
    color: var(--color-warning-light) !important;
}

/* ========================================
   SPINNER OVERRIDES (dark theme)
   ======================================== */
.spinner-border {
    color: var(--color-primary-light);
}

.btn-primary .spinner-border,
.btn-danger .spinner-border {
    color: #fff;
}

/* ========================================
   STAT CARD (simple version for Rankings)
   ======================================== */
.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-subtle);
    margin-bottom: 0.35rem;
}

.stat-card .stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

/* ========================================
   BREADCRUMB TRAIL
   ======================================== */
.breadcrumb-trail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-subtle);
}

.breadcrumb-trail a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb-trail a:hover {
    color: var(--color-primary-light);
}

.breadcrumb-trail .separator {
    font-size: 0.7rem;
    color: var(--color-text-subtle);
}

.breadcrumb-trail .current {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* ========================================
   CHART-CARD - Styled container for charts
   ======================================== */
.chart-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: var(--transition-normal);
}

.chart-card:hover {
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-md);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.chart-card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.chart-card-header h3 i {
    font-size: 0.85rem;
    color: var(--color-primary-light);
}

.chart-period {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.7rem;
    background: rgba(99, 102, 241, 0.08);
    color: var(--color-primary-light);
    border-radius: var(--radius-full);
}

.chart-card-body {
    padding: 1.25rem;
    height: 280px;
    position: relative;
}

.chart-card-body canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   CARD PANEL - Generic section container
   ======================================== */
.card-panel {
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition-normal);
    margin-bottom: 1.5rem;
}

.card-panel:hover {
    border-color: var(--border-color-light);
}

.card-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 1rem;
}

/* ========================================
   ALERT STYLES - Dark Theme
   ======================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: var(--color-success-light);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--color-danger-light);
}

.alert-warning {
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.25);
    color: var(--color-warning-light);
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--color-primary-light);
}

/* ========================================
   SUBSCRIPTION / STATUS BADGES
   ======================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-1,
.status-valid {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success-light);
}

.status-2,
.status-invalid {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger-light);
}

.status-3 {
    background: rgba(249, 115, 22, 0.15);
    color: var(--color-warning-light);
}

.status-4 {
    background: rgba(234, 179, 8, 0.15);
    color: #fbbf24;
}

.status-5 {
    background: rgba(100, 116, 139, 0.15);
    color: var(--color-text-muted);
}

/* ========================================
   SUBSCRIPTION GROUP
   ======================================== */
.subscription-group {
    margin: 1rem 0;
    padding: 1.25rem;
    background: var(--color-bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.subscription-group h5 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-secondary);
}

/* ========================================
   ORDER TRANSACTION
   ======================================== */
.order-transaction {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.order-transaction strong {
    color: var(--color-text-primary);
}

/* ========================================
   TOKEN / TEXTAREA CONTAINERS
   ======================================== */
.token-container textarea {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.token-container small {
    margin-top: 0.5rem;
    display: block;
}

/* ========================================
   MISC UTILITY CLASSES
   ======================================== */
.ml-2 { margin-left: 0.5rem; }

.text-truncate {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

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

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

label {
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* ── Trend indicators ─────────────────────────────────────────── */
.trend-up {
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.trend-down {
    color: var(--color-danger);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.trend-same {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}
.trend-new {
    color: var(--color-warning);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.trend-lost {
    color: var(--color-danger);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.trend-up i, .trend-down i, .trend-same i, .trend-new i, .trend-lost i {
    margin-right: 0.25rem;
}

/* ── Top app links ────────────────────────────────────────────── */
.top-app-link {
    color: var(--color-primary-light);
    text-decoration: none;
    transition: color 0.15s ease;
}
.top-app-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ── Icon button (search URL etc.) ────────────────────────────── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-sm, 0.375rem);
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    font-size: 0.75rem;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-icon:hover {
    color: var(--color-primary-light);
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
}
/* ========================================
   TABLE RESPONSIVE & STICKY ACTIONS
   ======================================== */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.data-table .col-actions {
    position: sticky;
    right: 0;
    background: var(--color-bg-surface);
    min-width: 100px;
    z-index: 2;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.15);
}

.data-table thead .col-actions {
    background: var(--color-bg-elevated);
}

.data-table td:last-child,
.data-table th:last-child {
    white-space: nowrap;
}

/* ========================================
   TIME RANGE SELECTOR
   ======================================== */
.time-range-selector {
    display: inline-flex;
    gap: 2px;
    background: var(--color-bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3px;
}

.time-range-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.time-range-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-subtle);
}

.time-range-btn.active {
    color: #fff;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   GLOBAL MOBILE RESPONSIVE FIXES
   ======================================== */

@media (max-width: 768px) {
    /* Global overflow containment */
    .page {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .main-content {
        overflow-x: hidden;
    }

    /* Content area */
    .content {
        padding: 0.75rem;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Revenue Hero */
    .revenue-hero {
        padding: 1rem;
    }

    .revenue-hero-content {
        gap: 1.25rem;
    }

    .revenue-hero-value {
        font-size: 2rem;
    }

    .revenue-hero-breakdown {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Dashboard Header */
    .dashboard-header-right {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .dashboard-title {
        font-size: 1.25rem;
    }

    .dashboard-title-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .dashboard-subtitle {
        margin-left: 0;
        font-size: 0.75rem;
    }

    /* Charts */
    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-card-body {
        height: 200px;
        padding: 0.75rem;
        overflow: hidden;
    }

    .chart-card-body.large {
        height: 220px;
    }

    .chart-card-body.donut {
        height: 180px;
    }

    .chart-card-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .chart-card-footer {
        flex-wrap: wrap;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .chart-card-actions {
        flex-wrap: wrap;
    }

    .chart-period-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.65rem;
    }

    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .dashboard-grid-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .dashboard-grid-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Map */
    .world-map-container {
        grid-template-columns: 1fr;
    }

    .world-map-canvas {
        height: 250px;
    }

    .map-card {
        height: 250px;
    }

    .map-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 1rem;
    }

    .country-list {
        flex-direction: column;
    }

    .country-item {
        min-width: auto;
    }

    .map-stats {
        flex-direction: column;
    }

    /* Heatmap */
    .heatmap-container {
        padding: 1rem;
        overflow-x: auto;
    }

    .heatmap-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 3px;
        min-width: 200px;
    }

    /* Page Header */
    .page-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .page-header-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .page-subtitle {
        margin-left: 0;
    }

    /* Tables — Remove min-width, allow wrapping */
    .detail-card-body > .data-table {
        min-width: auto;
    }

    .data-table {
        white-space: normal;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }

    .data-table th {
        font-size: 0.65rem;
    }

    /* Detail Card */
    .detail-card-body {
        padding: 0.75rem;
    }

    .detail-card-header {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .detail-card-header h2 {
        font-size: 0.95rem;
    }

    /* Filter bar */
    .filter-bar {
        grid-template-columns: 1fr;
        padding: 0.75rem;
    }

    /* Pagination */
    .pagination-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    /* Section Title */
    .section-title {
        font-size: 0.95rem;
        margin: 1.25rem 0 0.75rem;
    }

    /* Section Title Bar with ColumnSelector */
    .section-title-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Insights */
    .insights-grid {
        grid-template-columns: 1fr;
    }

    /* Revenue Hero breakdown on very small */
    .breakdown-item {
        flex-direction: row;
        gap: 0.5rem;
    }

    /* Live indicator and last update */
    .live-indicator,
    .last-update {
        font-size: 0.6rem;
    }

    /* Skeleton */
    .skeleton-hero-grid {
        grid-template-columns: 1fr;
    }

    .skeleton-stats-grid,
    .skeleton-charts-grid {
        grid-template-columns: 1fr;
    }

    /* Stat card compact */
    .stat-card {
        padding: 0.85rem;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .revenue-hero-value {
        font-size: 1.75rem;
    }

    .page-title {
        font-size: 1rem;
    }

    .content {
        padding: 0.5rem;
    }

    .chart-card-body {
        height: 180px;
    }
}

/* ========================================
   SECTION TITLE BAR
   ======================================== */
.section-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================
   COLUMN SELECTOR
   ======================================== */
.column-selector {
    position: relative;
    display: inline-block;
}

.column-selector-toggle {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.column-selector-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.column-selector-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

.column-selector-header {
    padding: 0.5rem 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-subtle);
    border-bottom: 1px solid var(--border-color);
}

.column-selector-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.column-selector-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.column-selector-item input[type="checkbox"] {
    accent-color: var(--color-primary);
}

.column-selector-item .drag-handle {
    color: var(--color-text-subtle);
    font-size: 0.7rem;
    cursor: grab;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.column-selector-item:hover .drag-handle {
    opacity: 1;
}

.column-selector-item.dragging {
    opacity: 0.4;
}

.column-selector-item.drag-over {
    border-top: 2px solid var(--color-primary);
}

.column-selector-footer {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

/* ========================================
   MOBILE FILTER BAR
   ======================================== */
body:has(.filter-bar--open) {
    overflow: hidden;
}

.filter-bar-wrapper {
    position: relative;
}

.filter-bar-mobile-toggle {
    display: none;
    margin-bottom: 0.75rem;
}

.filter-bar-close {
    display: none;
}

@media (max-width: 768px) {
    .filter-bar-mobile-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
    }

    .filter-bar-mobile-toggle .badge {
        background: var(--color-primary);
        color: #fff;
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
        border-radius: var(--radius-full);
    }

    .filter-bar-wrapper .filter-bar {
        display: none;
    }

    .filter-bar-wrapper .filter-bar.filter-bar--open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1100;
        background: var(--color-bg-base);
        padding: 1.5rem;
        overflow-y: auto;
        gap: 0.75rem;
        animation: slideUp 0.2s ease-out;
    }

    .filter-bar-wrapper .filter-bar.filter-bar--open::before {
        content: "Filter";
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--color-text-primary);
        margin-bottom: 0.5rem;
    }

    .filter-bar--open .filter-bar-close {
        display: inline-flex;
        align-self: flex-end;
        margin-bottom: 0.5rem;
    }

    .filter-bar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1099;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
    }

/* ========================================
   TOAST / SNACKBAR SYSTEM
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    max-width: 400px;
}

.toast-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    animation: toastIn 0.3s ease-out;
    min-width: 300px;
}

.toast-item.toast-hide {
    animation: toastOut 0.3s ease-in forwards;
}

.toast-icon {
    font-size: 1.1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-danger); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-primary-light); }

.toast-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.toast-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.toast-message {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-subtle);
    cursor: pointer;
    padding: 0.125rem;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

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

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

/* ═══════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════ */

/* ── Spacing ── */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }
.mt-8 { margin-top: 2rem !important; }
.mt-10 { margin-top: 2.5rem !important; }
.mr-4 { margin-right: 1rem !important; }
.p-0 { padding: 0 !important; }
.p-4 { padding: 1rem !important; }

/* ── Typography ── */
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.8rem !important; }
.text-base { font-size: 0.85rem !important; }
.fw-semibold { font-weight: 600 !important; }
.text-right { text-align: right !important; }

/* ── Flexbox helpers ── */
.justify-end { justify-content: flex-end !important; }
.flex-row { display: flex; flex-direction: row; }
.flex-wrap { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }

/* ── Misc ── */
.cursor-pointer { cursor: pointer !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}