/* Dashboard Card Loading States */
.card {
    position: relative;
    overflow: hidden;
}

.card.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin-left: -15px;
    margin-top: -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Summary Bar Loading */
.total-summary-bar.loading .summary-item .value {
    color: transparent;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    min-width: 60px;
}

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

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

/* Hide Global Loader */
.global-loader.force-hidden {
    display: none !important;
}

:root {
    --brand-primary: #0ea5e9;
    --brand-secondary: #6366f1;
    --brand-accent: #f43f5e;

    --bg-main: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-card: rgba(255, 255, 255, 0.85);

    --text-primary: #0f172a;
    --text-muted: #475569;
    --text-on-brand: #ffffff;

    --border-soft: rgba(226, 232, 240, 0.4);
    --border-premium: rgba(255, 255, 255, 0.6);

    /* Effects & Shadows */
    --glass-blur: 24px;
    --shadow-soft: 0 10px 15px -3px rgba(15, 23, 42, 0.03), 0 4px 6px -2px rgba(15, 23, 42, 0.01);
    --shadow-premium: 0 25px 50px -12px rgba(15, 23, 42, 0.1), 0 0 1px 1px rgba(255, 255, 255, 0.7);
    --inner-glow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);

    /* Spacing & Radii */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;

    --sidebar-bg: #ffffff;
    --border-color: #e2e8f0;
    --accent-primary: #3b82f6;
    --text-secondary: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.6;
    font-feature-settings: 'kern' 1, 'liga' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Layout --- */
.app-container {
    display: flex;
    flex-direction: column;
}

/* ── Sidebar ── mobile-first ────────────────────────────────── */
.sidebar-slim {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 2000;
    /* Mobile: slide off-screen by default */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    /* Prevent stagger/entry animations from overriding the transform */
    animation: none !important;
    opacity: 1 !important;
}

/* Sidebar open (mobile toggle) */
.sidebar-slim.open {
    transform: translateX(0);
}

/* ── Sidebar overlay ─────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1999;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    animation: overlayIn 0.25s ease both;
}
@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Mobile hamburger ────────────────────────────────────────── */
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.mobile-menu-toggle:hover {
    background: #f0f9ff;
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.mobile-menu-toggle i,
.mobile-menu-toggle svg {
    width: 20px; height: 20px;
    pointer-events: none;
}

/* Main content — full width on mobile */
.main-content-flow {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-left: 0;   /* no sidebar offset on mobile */
}

/* ── Desktop (≥ 768px): always-visible sidebar ───────────────── */
@media (min-width: 768px) {
    .sidebar-slim {
        transform: translateX(0) !important; /* always visible */
        width: 250px;
    }

    .mobile-menu-toggle {
        display: none !important;            /* hide hamburger */
    }

    .sidebar-overlay {
        display: none !important;            /* never needed */
    }

    .main-content-flow {
        margin-left: 250px;                  /* push content right */
    }
}


.sidebar-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.logo-circle {
    width: 40px;
    height: 40px;
    background: #1e293b;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 24px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin: 4px 12px;
    border-radius: var(--radius-sm);
}

.nav-item:hover {
    background: rgba(14, 165, 233, 0.05);
    color: var(--brand-primary);
    transform: translateX(4px);
}

.nav-item.active {
    color: var(--brand-primary);
    background: rgba(14, 165, 233, 0.1);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.1);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--brand-primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 10px rgba(14, 165, 233, 0.5);
}

/* Sidebar Close Button */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(244, 63, 94, 0.1);
    color: var(--brand-accent);
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2010;
}

.sidebar-close-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    transform: rotate(90deg);
}

/* ── Sidebar bottom area ───────────────────────────────────── */
.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 10px 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
}

.sidebar-username {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #0284c7;
}

/* ── Logout button ─────────────────────────────────────────── */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.sidebar-logout-btn:hover {
    background: rgba(244, 63, 94, 0.08);
    color: #f43f5e;
    transform: translateX(3px);
}

.sidebar-logout-btn:active {
    transform: translateX(0);
    background: rgba(244, 63, 94, 0.14);
}

.sidebar-logout-btn i,
.sidebar-logout-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-width: 2px;
    color: inherit;
}


/* Main Content */
.main-content-flow {
    flex: 1;
    min-width: 0;
}

/* --- Header --- */
.main-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1001;
    padding: 12px 20px;
}

.header-content-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    flex-wrap: wrap;
}

.header-breadcrumb h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Premium Filter Pill */
.filter-pill {
    display: flex !important;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 50px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-pill:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
    transform: translateY(-1px);
}

.filter-pill.has-value {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: var(--brand-primary);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.12);
}

.pill-icon {
    width: 14px;
    height: 14px;
    color: var(--brand-primary);
    opacity: 0.9;
}

.pill-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-right: 4px;
}

.header-search-premium {
    margin-left: auto;
    width: 280px;
}

.search-input-wrapper-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    padding: 0 12px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
    width: 100%;
    height: 38px;
}

.search-input-wrapper-v2:focus-within {
    background: #ffffff;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.08);
}

.search-input-wrapper-v2 i {
    color: #94a3b8;
    width: 18px;
    height: 18px;
    stroke-width: 2.5px;
}

.search-input-wrapper-v2 input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-pill .dropdown-trigger {
    border: none;
    background: transparent;
    padding: 0;
    min-width: 0;
    height: auto;
    gap: 4px;
    display: flex;
    align-items: center;
}

.filter-pill .selected-value {
    font-size: 12px;
    font-weight: 600;
    color: #1e3a5f;
    margin-left: 2px;
}

/* --- Components --- */
.dashboard-scrollable {
    padding-bottom: 40px;
}

.total-summary-bar {
    background: #5a6169;
    margin: 20px 30px;
    border-radius: 16px;
    padding: 28px 36px;
    color: white;
    /* box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3); */
    position: relative;
    overflow: hidden;
}

/* .total-summary-bar::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
} */

/* .total-summary-bar::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 30%;
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
} */

.summary-title {
    font-size: 0.8rem;
    margin-bottom: 20px;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    position: relative;
    z-index: 2;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.summary-item .label {
    font-size: 0.72rem;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}


/* Custom Dropdown (Premium Filter Style) */

.custom-dropdown {
    position: relative;
    display: inline-block;
    user-select: none;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #d1d5db;
    padding: 6px 14px;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    min-width: 220px;
    transition: border-color 0.2s;
}

.dropdown-trigger:hover {
    border-color: #94a3b8;
}

.dropdown-trigger i {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.dropdown-trigger .arrow {
    margin-left: auto;
    color: #3b82f6;
    width: 14px;
    height: 14px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    width: 280px;
    z-index: 1000;
    display: none;
    padding: 5px 0;
}

.custom-dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 10px 15px;
    font-size: 12px;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f8fafc;
}

.dropdown-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

/* Grid Sections */
.dashboard-main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

@media (min-width: 1280px) {
    .dashboard-main-container {
        flex-direction: row;
        align-items: stretch;
    }

    .dashboard-scrollable {
        flex: 1;
        min-width: 0;
    }
}

.performance-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 15px;
}

.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow 0.2s ease;
}

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

.card-header-plain h3,
.side-title {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.card-header-plain {
    margin-bottom: 4px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.metrics-perf-grid {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 20px;
    border-bottom: 2px solid #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
}

.metric-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    min-height: 120px;
}

.metric-cell:last-child {
    border-bottom: none;
}

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.help-icon {
    width: 14px;
    height: 14px;
    color: #94a3b8;
    vertical-align: middle;
    margin-right: 4px;
}

.m-label {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
}

.m-value {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.m-trend {
    font-size: 12px;
    font-weight: 500;
}

.m-trend.up,
.sub-val.up {
    color: #10b981;
}

.m-trend.down,
.sub-val.down {
    color: #f43f5e;
}

.spark-container {
    width: 140px;
    height: 60px;
    margin-left: 20px;
}

/* App Table */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-right-title,
.header-left-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 7px;
}

.btn-tab-outline {
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    font-size: 0.85rem;
    color: #374151;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-tab-outline:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
}

.card-body-scrollable {
    overflow-y: auto;
    max-height: 350px;
    /* Limits to ~4-5 apps depending on row height */
    padding-right: 8px;
}

/* Premium Slim Scrollbar */
.card-body-scrollable::-webkit-scrollbar {
    width: 6px;
}

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

.card-body-scrollable::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.card-body-scrollable::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.app-table {
    width: 100%;
    border-spacing: 0;
}

.app-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.app-icon.cal {
    background: #10b981;
}

.app-icon.msg {
    background: #3b82f6;
}

.app-icon.rec {
    background: #ef4444;
}

.app-icon.gal {
    background: #f59e0b;
}

.app-icon.clk {
    background: #6366f1;
}

.app-table th {
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    padding-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.app-table td {
    padding: 16px 0;
    border-top: 1px solid #f3f4f6;
    font-size: 0.92rem;
    color: #1e293b;
}

.val-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.val {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.sub-val {
    font-size: 12px;
    font-weight: 600;
    margin-top: 1px;
}

.app-table td:first-child {
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.8rem;
}

.main-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.01em;
}

.main-name [data-lucide="external-link"] {
    width: 14px;
    height: 14px;
    color: #94a3b8;
    stroke-width: 2.5;
}

.sub-name {
    font-size: 0.8rem;
    color: #6b7280;
}

.app-table td {
    border-top: 1px solid #f1f5f9;
}

.app-table tr:hover {
    background-color: #f8fafc;
}

/* --- Footer --- */
.card-footer-left {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.card-footer-left a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px ;
}

/* --- Second Grid & New Cards --- */
.second-grid {
    margin-top: 30px;
}

.key-metrics-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.km-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 14px;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    margin-bottom: 6px;
}

.km-row:last-child {
    margin-bottom: 0;
}

.km-row:hover {
    background: #f8fafc;
}

/* Per-row left accent strip */
.km-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 50%;
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.km-row:hover::before {
    opacity: 1;
}

/* BLUE row (eCPM) */
.km-row:nth-child(1) {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, rgba(99, 102, 241, 0.04) 100%);
}

.km-row:nth-child(1)::before {
    background: linear-gradient(180deg, #3b82f6, #6366f1);
    opacity: 1;
}

.km-row:nth-child(1):hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
}

/* GREEN row (Active Apps) */
.km-row:nth-child(2) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(5, 150, 105, 0.04) 100%);
}

.km-row:nth-child(2)::before {
    background: linear-gradient(180deg, #10b981, #059669);
    opacity: 1;
}

.km-row:nth-child(2):hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.08) 100%);
}

/* ORANGE row (Ad Units) */
.km-row:nth-child(3) {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06) 0%, rgba(234, 88, 12, 0.04) 100%);
}

.km-row:nth-child(3)::before {
    background: linear-gradient(180deg, #f59e0b, #ea580c);
    opacity: 1;
}

.km-row:nth-child(3):hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(234, 88, 12, 0.08) 100%);
}

.km-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.km-icon i {
    width: 20px;
    height: 20px;
    color: white;
    position: relative;
    z-index: 1;
}

/* Gradient icons with glow */
.km-icon.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.km-icon.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.km-icon.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.km-details {
    flex: 1;
}

.km-name {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.km-desc {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

.km-chart {
    width: 120px;
    height: 35px;
}

.km-activity-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.km-activity-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.2s;
}

.km-activity-dots .dot.active {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
    }
}

.km-spacer {
    flex: 1;
}

.km-stats {
    text-align: right;
    min-width: 90px;
    flex-shrink: 0;
}

.km-val {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.km-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

.km-util {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

/* ---- Trend Coloring Classes ---- */
.km-trend.up {
    color: #10b981 !important;
}

.km-trend.down {
    color: #ef4444 !important;
}

/* Drill Down Shortcuts (Feature 13) */

/* Drill Down Shortcuts (Feature 13) */
.drill-down-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    color: #94a3b8;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    margin-left: 8px;
    text-decoration: none;
    vertical-align: middle;
}

.drill-down-link:hover {
    color: #3b82f6;
    background: #fff;
    border-color: #3b82f6;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.drill-down-link i {
    width: 12px;
    height: 12px;
}

/* Distribution Analytics */


/* Distribution Analytics */
.header-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 3px;
}

/* Card header: title left, controls right — true flex row */
.dist-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.dist-title-block {
    flex-shrink: 0;
}

/* Right-side controls: Segmented control + view toggle */
.dist-header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.distribution-tabs {
    display: flex;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 10px;
    gap: 2px;
    position: relative;
    user-select: none;
}

.dist-tab {
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
    font-family: 'Inter', sans-serif;
}

.dist-tab:hover {
    color: #334155;
}

.dist-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    /* Floating effect */
}

/* Rank indicators with high-fidelity glows */
.rank-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    font-family: 'Inter', sans-serif;
}

.rank-1 {
    background: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.45);
}

.rank-2 {
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}

.rank-3 {
    background: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
}

.rank-other {
    background: #94a3b8;
}

/* Micro-animations and high-fidelity rows */
.dist-item-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.dist-item-row:hover {
    background: #f8fafc;
    transform: translateX(4px);
    box-shadow: inset 2px 0 0 #3b82f6;
}

.dist-val-primary {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    font-family: 'Inter', sans-serif;
}

.dist-val-secondary {
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.dist-progress-box {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dist-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* View Toggle Buttons */
.dist-view-toggle {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn i {
    width: 14px;
    height: 14px;
}

.view-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.view-btn.active {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Scrollable body */
.distribution-body {
    overflow-y: auto;
    max-height: 300px;
    padding-right: 4px;
}

/* When AG Grid table view is active — let grid control its own scroll */
.distribution-body.dist-body-table-mode {
    overflow: visible;
    max-height: none;
    padding-right: 0;
}

.distribution-body::-webkit-scrollbar {
    width: 4px;
}

.distribution-body::-webkit-scrollbar-track {
    background: transparent;
}

.distribution-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* ---- Scrollable LIST view ---- */
.dist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    transition: background 0.15s;
}

.dist-item:hover {
    background: #f1f5f9;
}

.dist-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.dist-label {
    width: 100px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    font-family: 'Inter', 'Outfit', sans-serif !important;
    text-transform: CAPITALIZE;
}

.dist-progress-box {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.dist-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.dist-val-box {
    text-align: right;
    min-width: 80px;
    flex-shrink: 0;
}

.dist-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
}

.dist-pct {
    font-size: 0.68rem;
    font-weight: 600;
}

.dist-pct.up {
    color: #10b981;
}

.dist-pct.down {
    color: #ef4444;
}

/* ---- AG Grid tabular view ---- */
.dist-ag-grid {
    width: 100%;
    height: 340px;
    font-family: 'Inter', sans-serif;
}

/* AG Grid custom overrides */
#distribution-ag-grid .ag-root-wrapper {
    border: none;
    border-radius: 0;
}

#distribution-ag-grid .ag-header {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

#distribution-ag-grid .ag-header-cell-text {
    font-size: 0.68rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-family: 'Inter', sans-serif;
}

#distribution-ag-grid .ag-header-cell {
    padding: 0 12px;
}

#distribution-ag-grid .ag-row {
    border-bottom: 1px solid #f1f5f9;
}

#distribution-ag-grid .ag-row-even {
    background: #ffffff;
}

#distribution-ag-grid .ag-row-odd {
    background: #fafbfc;
}

#distribution-ag-grid .ag-row:hover {
    background: #f1f5f9 !important;
}

#distribution-ag-grid .ag-cell {
    display: flex;
    align-items: center;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

@media (min-width: 1024px) {
    .performance-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        padding: 0 30px;
    }

    .second-grid {
        margin-top: 30px;
    }

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

.full-width-section {
    padding: 0 15px;
    margin-top: 15px;
}

.app-icon-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.app-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Media Queries (Tablet/Desktop) --- */
@media (min-width: 768px) {
    .sidebar-slim {
        width: 80px;
        transform: translateX(0);
        align-items: center;
    }

    .sidebar-slim.active {
        width: 250px;
    }

    .sidebar-slim.active .nav-item span {
        display: inline;
    }

    .sidebar-slim .nav-item span {
        display: none;
    }

    .main-content-flow {
        margin-left: 80px;
    }

    .main-header {
        flex-direction: row;
        justify-content: space-between;
        padding: 15px 30px;
    }

    .mobile-menu-toggle {
        display: none;
    }

    .header-search {
        width: 400px;
    }

    .total-summary-bar {
        margin: 20px 30px;
        padding: 28px 48px;
    }

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

    .summary-item {
        border-right: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 0;
        background: transparent;
        border: none;
        /* border-right: 1px solid rgba(255, 255, 255, 0.2); */
        padding: 0;
    }

    .summary-item:last-child {
        border-right: none;
    }

    .performance-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        padding: 0 30px;
        align-items: stretch;
        margin-bottom: 24px;
    }

    .metrics-perf-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metric-cell:nth-child(odd) {
        border-right: 1px solid #f1f5f9;
    }

    .metric-cell:nth-last-child(-n+2) {
        border-bottom: none;
    }

    .performance-grid>div {
        width: 100%;
        min-width: 0;
        /* Prevents flex items from overflowing */
    }

    .metrics-spark-grid {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 30px;
        row-gap: 30px;
    }

    .full-width-section {
        padding: 24px 30px;
    }
}

/* Tooltip & Utilities */
.jvm-zoom-btn {
    background: #3b82f6 !important;
    border: none !important;
    border-radius: 6px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    font-size: 16px !important;
    line-height: 1 !important;
    left: 20px !important;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -1px rgba(59, 130, 246, 0.1) !important;
    transition: all 0.2s !important;
}

.jvm-zoom-btn:hover {
    background: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3) !important;
}

.jvm-zoom-btn.jvm-zoomout {
    top: 55px !important;
}

.jvm-zoom-btn.jvm-zoomin {
    top: 20px !important;
}

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

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

@media (max-width: 1024px) {
    .main-header {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .header-filters {
        flex-wrap: wrap;
        gap: 12px;
    }

    .pill-filter {
        flex: 1 1 auto;
        min-width: 140px;
        justify-content: space-between;
    }

    .header-search {
        width: 100%;
    }

    .performance-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }

    .total-summary-bar {
        margin: 15px;
        padding: 24px;
    }

    .summary-metrics {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

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

    .sidebar-slim.active {
        transform: translateX(0);
    }

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

    .sidebar-close-btn {
        display: flex !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .main-header {
        flex-direction: row;
        align-items: center;
        gap: 15px;
        padding: 12px 20px;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(12px);
    }

    .summary-metrics {
        grid-template-columns: 1fr;
    }

    .dist-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dist-header-controls {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .distribution-tabs {
        overflow-x: auto;
        width: 100%;
        padding-bottom: 5px;
    }

    .dist-tab {
        padding: 6px 10px;
    }

    .bottom-grid-section {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }
}

/* ✅ NEW: Mid screen fix (1025px - 1350px) */
@media (min-width: 1025px) and (max-width: 1350px) {
    .main-header {
        padding: 15px;
        /* flex-direction: column; */
        align-items: stretch;
        gap: 15px;
    }

    .header-filters {
        flex-wrap: wrap;
        gap: 12px;
    }

    .pill-filter {
        flex: 1 1 auto;
        min-width: 140px;
        justify-content: space-between;
    }

    .header-search {
        width: 100%;
    }

    .performance-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }

    .total-summary-bar {
        margin: 15px;
        padding: 24px;
    }

    /* .summary-metrics {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    } */
}

@media (min-width: 1350px) {
    .performance-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

.card-footer-left {
    display: flex;
    justify-content: flex-start;
    padding-top: 20px;
}

.card-footer-left a {
    color: #2563eb;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
}

.card-footer-left a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.bottom-grid-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0 30px;
    margin-bottom: 30px;
}

@media (min-width: 1024px) {
    .bottom-grid-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }
}

.country-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.country-info .flag {
    font-size: 1.2rem;
}

.country-name {
    font-size: 0.95rem;
    color: #374151;
    font-weight: 500;
}

.country-table td {
    padding: 14px 0;
}

/* Map Styles */
#world-map {
    height: 380px;
    width: 100%;
}

.map-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 15px 10px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    /* Darker text for country name */
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-count {
    color: #94a3b8;
    /* Light grey for numeric value */
    margin-left: 2px;
    font-weight: 400;
}

@media (min-width: 768px) {
    #world-map {
        height: 400px;
    }
}

/* jsVectorMap Zoom Buttons Styling */
.jvm-zoom-btn {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}

.jvm-zoom-btn:hover {
    background: #629dd8 !important;
    border-color: #cbd5e1 !important;
}

/* Map region fill colors — controlled by jsVectorMap regionStyle in script.js */
/* Do NOT use !important here as it blocks the series heat scale */
.jvm-region {
    cursor: pointer;
}

.jvm-region.jvm-region-selected {
    fill: #1d4ed8 !important;
}

/* Countries with data get the heat gradient applied by jVectorMap series */

/* Table Search & Grid UI */
.table-search-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-search-inline:focus-within {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* AG Grid Theme Customization */
.ag-theme-alpine {
    --ag-header-background-color: #ffffff;
    --ag-header-foreground-color: #64748b;
    --ag-header-column-separator-display: none;
    --ag-border-color: #f1f5f9;
    --ag-row-hover-color: #f8fafc;
    --ag-selected-row-background-color: #eff6ff;
    --ag-font-size: 13.5px;
    --ag-font-family: 'Inter', sans-serif;
    border: none !important;
    border-radius: 12px !important;
    overflow: hidden !important;
}

.ag-theme-alpine .ag-root-wrapper {
    border: none !important;
    border-radius: 0 !important;
}

.ag-theme-alpine .ag-header {
    border-bottom: 1.5px solid #f1f5f9;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ag-theme-alpine .ag-row {
    border-bottom-color: #f1f5f9;
}

.ag-theme-alpine .ag-cell {
    display: flex;
    align-items: center;
    color: #1e293b;
}

.ag-theme-alpine .ag-header-cell-label {
    justify-content: flex-start;
}

.ag-theme-alpine .ag-header-cell.text-right .ag-header-cell-label {
    flex-direction: row-reverse;
}

.card-body-grid {
    padding: 0;
    overflow: hidden;
    border-radius: 0;
}

.table-search-inline input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: #475569;
    width: 150px;
}

.table-search-inline i {
    width: 14px;
    height: 14px;
    color: #94a3b8;
}

th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

th.sortable:hover {
    color: #3b82f6;
}

th.sortable i {
    width: 14px;
    height: 14px;
    margin-left: 4px;
    opacity: 0.5;
}

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


/* ========================= */
/* Country Grid Custom Style */
/* ========================= */



.app-link-wrapper {
    display: flex;
    /* flex preserve */
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    color: inherit !important;
    /* blue remove */
}

.app-link-wrapper:hover {
    text-decoration: none !important;
}

.app-link-wrapper .main-name {
    color: #6b7280;
    /* gray */
}

.app-link-wrapper i {
    width: 14px;
    height: 14px;
    margin-left: 6px;
    color: #94a3b8;
}



/* GLOBAL LOADER */
/* PREMIUM LOADER */

.global-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.global-loader.hidden {
    display: none;
}

.loader-content {
    text-align: center;
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.loader-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    from {
        transform: translateY(0);
        opacity: 0.6;
    }

    to {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Animations */
@keyframes fadeInLift {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.stagger-entry {
    animation: fadeInLift 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

/* Sidebar Insights */
.sidebar-insights {
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-soft);
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

@media (min-width: 1280px) {
    .sidebar-insights {
        width: 320px;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

.insights-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-dot.warning {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.network-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trend-mini-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.trend-badge {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

.trend-badge.down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.alert-box-premium {
    padding: 20px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: var(--radius-md);
    position: relative;
}

.btn-mini-action {
    width: 100%;
    padding: 10px;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mini-action:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* --- Premium Flatpickr "UI-Full" Theme --- */
.flatpickr-calendar {
    background: #ffffff !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-family: 'Outfit', sans-serif !important;
    width: 300px !important;
    /* Slightly larger for better spacing */
    padding: 5px !important;
}

.flatpickr-calendar.multiMonth {
    width: 660px !important;
    /* Increased from 610px to accommodate two full months comfortably */
}

.flatpickr-calendar.multiMonth .flatpickr-innerContainer {
    padding: 0 15px !important;
}

.flatpickr-months {
    padding: 5px 5px !important;
}

.flatpickr-month {
    color: #1e293b !important;
    fill: #1e293b !important;
    height: 40px !important;
}

.flatpickr-current-month {
    font-size: 14px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 0 !important;
}

.flatpickr-weekday {
    color: #94a3b8 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    text-transform: none !important;
}

.flatpickr-day {
    /* border-radius: 50% !important; */
    color: #334155 !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    height: 36px !important;
    width: 36px !important;
    line-height: 34px !important;
    /* Centering text in ring */
    margin: 2px !important;
    border: 2px solid transparent !important;
    transition: all 0.2s ease !important;
}

.flatpickr-day.today {
    color: #ef4444 !important;
    border-color: transparent !important;
    font-weight: 800 !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: transparent !important;
    border: 1px solid #5c687a !important;
    color: #5c687a !important;
    font-weight: 600 !important;
}

.flatpickr-day.inRange {
    background: rgba(59, 130, 246, 0.08) !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border-color: transparent !important;
}

.flatpickr-day:hover {
    background: #f1f5f9 !important;
    border-color: transparent !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: #94a3b8 !important;
    padding: 13px !important;
    top: 0px !important;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: #3b82f6 !important;
}

/* Fix for right-side calendar overlap */
.flatpickr-calendar.multiMonth .flatpickr-days {
    padding-right: 5px !important;
}

/* --- Responsive Header --- */
@media (max-width: 1024px) {
    .header-content-wrapper {
        gap: 12px;
    }

    .header-search {
        width: 100%;
        margin-left: 0;
        order: 3;
    }

    .header-filters {
        border-radius: 0;
        order: 2;
    }

    .header-breadcrumb {
        order: 1;
    }
}

/* =================================================================
   Mobile responsive - index.html dashboard (< 768px)
   ================================================================= */
@media (max-width: 767px) {

    .main-header {
        padding: 10px 12px;
    }

    .header-content-wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-filters {
        order: 2;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .header-search-premium {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .total-summary-bar {
        margin: 12px;
        padding: 18px 16px;
        border-radius: 12px;
    }

    .summary-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .performance-grid,
    .performance-grid.second-grid,
    .bottom-grid-section {
        flex-direction: column !important;
        padding: 0 12px;
        gap: 12px;
    }

    .ad-performance-card,
    .app-performance-card,
    .key-metrics-card,
    .distribution-card,
    .map-card,
    .country-performance-card {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .card { padding: 16px; }

    .metric-cell {
        padding: 14px 16px;
        min-height: 80px;
    }

    .m-value { font-size: 1rem; }

    .spark-container {
        width: 80px;
        height: 40px;
        margin-left: 10px;
    }

    .distribution-tabs {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }

    #world-map { height: 200px; }

    #countryGrid { height: 260px !important; }
}