/* ==========================================================================
   ADS MANAGER EXECUTIVE PRO DESIGN SYSTEM (v2.0)
   Tailored for Modern SaaS Aesthetics (Stripe / Supabase / Tailwind Inspired)
   ========================================================================== */

:root {
    /* Brand Accent Colors */
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-dark: #3730a3;
    --brand-light: #6366f1;
    --brand-subtle: #eef2ff;
    --brand-glow: rgba(79, 70, 229, 0.28);

    /* Semantic Palette */
    --success: #10b981;
    --success-subtle: #ecfdf5;
    --success-border: #a7f3d0;
    --danger: #ef4444;
    --danger-subtle: #fef2f2;
    --danger-border: #fecaca;
    --warning: #f59e0b;
    --warning-subtle: #fffbeb;
    --warning-border: #fde68a;
    --info: #0284c7;
    --info-subtle: #f0f9ff;
    --info-border: #bae6fd;

    /* Neutrals & Layout */
    --bg-canvas: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-border-subtle: #f1f5f9;
    --sidebar-w: 252px;
    --sidebar-bg: linear-gradient(180deg, #090d16 0%, #111827 100%);
    
    /* Typography */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    /* Shadows */
    --shadow-2xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 5px -1px rgba(15, 23, 42, 0.06), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 25px -4px rgba(15, 23, 42, 0.1), 0 4px 10px -4px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 40px -8px rgba(15, 23, 42, 0.16);
    --shadow-modal: 0 25px 60px -12px rgba(15, 23, 42, 0.28);
}

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

body {
    background-color: var(--bg-canvas);
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-canvas);
}

/* ==========================================================================
   SIDEBAR COMPONENT
   ========================================================================== */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

.sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-icon-box {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.42);
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.68rem;
    font-weight: 700;
    color: #818cf8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 1px;
}

.sidebar-section-label {
    padding: 18px 20px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.sidebar-nav {
    padding: 6px 12px 16px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav .nav-link {
    color: #94a3b8;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: #94a3b8;
    transition: color 0.18s ease;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    transform: translateX(2px);
}

.sidebar-nav .nav-link:hover i {
    color: #ffffff;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.38);
}

.sidebar-nav .nav-link.active i {
    color: #ffffff;
}

.sidebar-nav .active-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
    margin-left: auto;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.25);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.user-avatar-badge {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.22);
    color: #a5b4fc;
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.2;
}

.user-role {
    font-size: 0.68rem;
    color: #94a3b8;
    line-height: 1.2;
    margin-top: 2px;
}

.btn-sidebar-logout {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.18s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-sidebar-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   MAIN CONTENT & TOPBAR
   ========================================================================== */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 28px 36px 64px;
    width: calc(100% - var(--sidebar-w));
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.topbar h1 {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ==========================================================================
   EXECUTIVE BUTTON SUITE (ALL BUTTONS REDESIGN)
   ========================================================================== */

/* Base Button Overrides */
.btn {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    border-radius: 9px;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    line-height: 1.4;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3.5px var(--brand-glow) !important;
}

/* 1. Primary Button */
.btn-primary {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%) !important;
    border: 1px solid #3730a3 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #4338ca 0%, #3730a3 100%) !important;
    border-color: #312e81 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* 2. Secondary & Outline Buttons */
.btn-secondary,
.btn-outline-secondary,
.btn-light {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #374151 !important;
    box-shadow: var(--shadow-2xs) !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-light:hover {
    background: #f8fafc !important;
    border-color: #9ca3af !important;
    color: #0f172a !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs) !important;
}

/* 3. Danger Button */
.btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%) !important;
    border: 1px solid #b91c1c !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.btn-danger:hover {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%) !important;
    border-color: #991b1b !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* 4. Success Button */
.btn-success {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
    border: 1px solid #047857 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.btn-success:hover {
    background: linear-gradient(180deg, #059669 0%, #047857 100%) !important;
    border-color: #065f46 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* Button Sizing */
.btn-sm {
    padding: 0.38rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    border-radius: 11px;
}

/* 5. Modern Action Icons & Pills */
.btn-action-icon {
    width: 33px !important;
    height: 33px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    flex-shrink: 0;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xs);
    text-decoration: none;
}

.btn-action-edit:hover {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
}

.btn-action-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 0.8125rem;
    line-height: 1.2;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xs);
    text-decoration: none;
}

.btn-action-delete:hover {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.28);
    transform: translateY(-1px);
}

.btn-action-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xs);
    text-decoration: none;
}

.btn-action-settings:hover {
    background-color: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
    transform: translateY(-1px);
}

.btn-action-custom-ads {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f0fdf4;
    color: #0d9488;
    border: 1px solid #99f6e4;
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xs);
    text-decoration: none;
}

.btn-action-custom-ads:hover {
    background-color: #0d9488;
    color: #ffffff;
    border-color: #0d9488;
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.28);
    transform: translateY(-1px);
}

.btn-action-power-active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 0.8125rem;
    line-height: 1.2;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xs);
}

.btn-action-power-active:hover {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.22);
    transform: translateY(-1px);
}

.btn-action-power-inactive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 0.8125rem;
    line-height: 1.2;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xs);
}

.btn-action-power-inactive:hover {
    background-color: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.22);
    transform: translateY(-1px);
}

/* ==========================================================================
   CARDS & STATS SYSTEM
   ========================================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--card-border-subtle);
    padding: 16px 22px;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

/* Stat Cards */
.stat-card {
    border-radius: 14px;
    padding: 22px 24px;
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.22);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

.stat-card.alt1 {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.22);
}
.stat-card.alt1:hover {
    box-shadow: 0 10px 25px rgba(2, 132, 199, 0.3);
}

.stat-card.alt2 {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.22);
}
.stat-card.alt2:hover {
    box-shadow: 0 10px 25px rgba(5, 150, 105, 0.3);
}

.stat-card.alt3 {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.22);
}
.stat-card.alt3:hover {
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.3);
}

.stat-card.alt4 {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    box-shadow: 0 6px 18px rgba(51, 65, 85, 0.22);
}
.stat-card.alt4:hover {
    box-shadow: 0 10px 25px rgba(51, 65, 85, 0.3);
}

.stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.92;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   SEGMENTED CONTROLS & FILTER PILLS
   ========================================================================== */
.filter-segmented-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: var(--shadow-2xs);
    flex-wrap: wrap;
}

.filter-pill-item {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    border-radius: 8px;
    padding: 5px 12px;
    text-decoration: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

button.filter-pill-item {
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
}

.filter-pill-item:hover,
button.filter-pill-item:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.filter-pill-item.active,
button.filter-pill-item.active {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.28);
}

.filter-pill-item.active i,
button.filter-pill-item.active i {
    color: #ffffff !important;
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 13px 18px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    font-size: 0.875rem;
}

.table tbody tr {
    transition: background-color 0.14s ease;
}

.table tbody tr:hover {
    background-color: #f8fafc !important;
}

/* Status Badges */
.badge-status-active {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.badge-status-inactive {
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* ==========================================================================
   SETTINGS TABS & CARDS
   ========================================================================== */
.settings-nav .nav-link {
    color: #475569;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px 14px;
    margin-bottom: 4px;
    text-align: left;
    transition: all 0.16s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.settings-nav .nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.settings-nav .nav-link.active {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

/* Provider Selector Chips */
.provider-selector {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 14px 16px;
}

.provider-selector .chip-preview {
    min-height: 38px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.provider-selector .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 4px 10px 4px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-2xs);
}

.provider-selector .chip .order-btn {
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    color: #4f46e5;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.2;
}

.provider-selector .chip .order-btn:hover {
    background: #e0e7ff;
}

.provider-selector .chip .remove-btn {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.provider-selector .chip .remove-btn:hover {
    color: #ef4444;
}

/* Custom Ads Grid Cards */
.custom-ad-card {
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    background: #ffffff;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.custom-ad-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}

.custom-ad-footer {
    background: #f8fafc;
    border-top: 1px solid #f1f5f9 !important;
    padding: 11px 16px;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}

/* Reorder Pill */
.reorder-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    box-shadow: var(--shadow-2xs);
}

.reorder-btn {
    border: none;
    background: transparent;
    color: #64748b;
    padding: 5px 8px;
    font-size: 0.75rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.reorder-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #0f172a;
}

.reorder-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ==========================================================================
   MODERN FORM CONTROLS & DROPDOWNS
   ========================================================================== */
.form-control {
    border-radius: 9px;
    border: 1px solid #cbd5e1;
    font-size: 0.875rem;
    padding: 8px 12px;
    color: #1e293b;
    background-color: #ffffff;
    box-shadow: var(--shadow-2xs);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.15);
    outline: none;
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.525rem 2.5rem 0.525rem 0.875rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    color: #1e293b;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 13px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    box-shadow: var(--shadow-2xs);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-select:hover:not(:disabled) {
    border-color: #94a3b8;
    background-color: #fcfdfd;
    box-shadow: var(--shadow-xs);
}

.form-select:focus {
    border-color: #6366f1;
    outline: 0;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.15);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234f46e5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-select:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.75;
}

.form-select-sm {
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
    padding-left: 0.75rem;
    padding-right: 2.15rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    border-radius: 8px;
    background-position: right 0.7rem center;
    background-size: 11px 8px;
}

.form-label {
    font-weight: 600;
    font-size: 0.825rem;
    color: #334155;
    margin-bottom: 6px;
}

/* Switches */
.form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.form-check-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   MODALS & BACKDROPS
   ========================================================================== */
.modal-backdrop.show {
    opacity: 0.5;
    backdrop-filter: blur(4px);
}

.modal-content {
    border-radius: 16px;
    border: none;
    overflow: hidden;
    box-shadow: var(--shadow-modal);
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid #f1f5f9;
    background-color: #f8fafc;
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #090d16 0%, #1e1b4b 50%, #0f172a 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-wrap::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    padding: 42px 36px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.login-brand-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.6rem;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
    margin: 0 auto 18px;
}

/* ==========================================================================
   APP ICON & HELPERS
   ========================================================================== */
.app-icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    background-color: #f8fafc;
    flex-shrink: 0;
}

.app-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-icon-fallback {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fractional Spacing Utilities */
.gap-1\.5 { gap: 0.375rem !important; }
.gap-2\.5 { gap: 0.75rem !important; }
.gap-3\.5 { gap: 1.25rem !important; }

/* Responsive adjustments */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px 18px 50px;
    }
}

/* Drag & Drop Field Cards in Ad Networks & Switches */
.field-card-item {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.field-card-draggable {
    border-radius: 9px;
    padding: 6px;
    margin-bottom: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.field-card-draggable:hover {
    background-color: #f8fafc;
}

.drag-handle {
    cursor: grab;
    user-select: none;
    padding: 3px 6px;
    border-radius: 6px;
    color: #94a3b8;
    transition: color 0.15s ease, background 0.15s ease;
}

.drag-handle:hover {
    color: var(--brand) !important;
    background: #eef2ff;
}

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

.field-sortable-ghost {
    opacity: 0.35 !important;
    background: #eef2ff !important;
    border: 2px dashed #6366f1 !important;
    border-radius: 10px;
}

.field-sortable-chosen {
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14) !important;
    background: #ffffff !important;
    border-radius: 10px;
}

.field-sortable-drag {
    opacity: 0.95 !important;
    transform: scale(1.02);
}

.shadow-2xs {
    box-shadow: var(--shadow-2xs) !important;
}

/* Google Play Console Badge & Indigo Utilities */
.badge-console {
    background-color: #eef2ff !important;
    color: #4338ca !important;
    border: 1px solid #c7d2fe !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 3px 9px !important;
    border-radius: 9999px !important;
    font-size: 0.73rem !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
    text-decoration: none !important;
}
.badge-console i {
    color: #4f46e5 !important;
    font-size: 0.82rem !important;
}
.badge-console:hover {
    background-color: #e0e7ff !important;
    color: #3730a3 !important;
    border-color: #a5b4fc !important;
}

.bg-indigo-subtle {
    background-color: #eef2ff !important;
}
.text-indigo {
    color: #4338ca !important;
}
.border-indigo-subtle {
    border-color: #c7d2fe !important;
}

/* ==========================================================================
   EXECUTIVE KPI CARDS (Dashboard & Consoles)
   ========================================================================== */
.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.03);
    border-color: #cbd5e1;
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.kpi-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.kpi-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.kpi-card:hover .kpi-icon-badge {
    transform: scale(1.08);
}

.kpi-icon-indigo {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

.kpi-icon-sky {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.kpi-icon-amber {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.kpi-icon-emerald {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.kpi-icon-orange {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fed7aa;
}

.kpi-icon-rose {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.kpi-icon-teal {
    background: #f0fdf4;
    color: #0d9488;
    border: 1px solid #99f6e4;
}

.kpi-icon-purple {
    background: #faf5ff;
    color: #9333ea;
    border: 1px solid #e9d5ff;
}

.text-teal {
    color: #0d9488 !important;
}

.text-orange {
    color: #ea580c !important;
}

.badge-orange-subtle {
    background-color: #fff7ed !important;
    color: #c2410c !important;
    border: 1px solid #fed7aa !important;
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.kpi-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 4px;
}

/* Console Table Elements */
.console-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
    transition: transform 0.18s ease;
}

.table tr:hover .console-avatar {
    transform: scale(1.05);
}

/* Expandable Network Placement Cards */
.network-accordion-card {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.network-accordion-card:hover {
    border-color: #cbd5e1 !important;
}

.network-card-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.network-card-header:hover,
.waterfall-card-header:hover {
    background-color: #f8fafc !important;
}

.network-card-header .collapse-chevron,
.waterfall-card-header .collapse-chevron {
    display: inline-block;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.82rem;
}

.network-card-header.collapsed .collapse-chevron,
.waterfall-card-header.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.network-card-header:not(.collapsed) .collapse-chevron,
.waterfall-card-header:not(.collapsed) .collapse-chevron {
    transform: rotate(0deg);
}

.waterfall-card-header {
    cursor: pointer;
    user-select: none;
}

.waterfall-accordion-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.waterfall-accordion-card:hover {
    border-color: #cbd5e1 !important;
}

/* ==========================================================================
   USER ANALYTICS EXECUTIVE 4-COLUMN CARDS
   ========================================================================== */
.user-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.user-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.03);
    border-color: #cbd5e1;
}

.user-hero-metric {
    padding: 6px 0 10px 0;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-hero-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.user-hero-caption {
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
}

.kpi-dual-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 4px 0 10px 0;
    min-height: 80px;
}

.kpi-dual-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.15s ease;
}

.kpi-dual-box:hover {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.kpi-dual-box.border-start-primary {
    border-left: 3px solid #0284c7 !important;
}

.kpi-dual-box.border-start-success {
    border-left: 3px solid #10b981 !important;
}

.kpi-dual-box.border-start-indigo {
    border-left: 3px solid #4f46e5 !important;
}

.kpi-dual-box.border-start-orange {
    border-left: 3px solid #ea580c !important;
}

.kpi-dual-box.border-start-rose {
    border-left: 3px solid #e11d48 !important;
}

.kpi-dual-box.border-start-teal {
    border-left: 3px solid #0d9488 !important;
}

.kpi-dual-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.kpi-dual-val {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.bg-amber-subtle {
    background-color: #fffbeb !important;
}

.text-amber {
    color: #d97706 !important;
}

.border-amber-subtle {
    border-color: #fde68a !important;
}

.bg-indigo-subtle {
    background-color: #eef2ff !important;
}

.text-indigo {
    color: #4f46e5 !important;
}

.border-indigo-subtle {
    border-color: #c7d2fe !important;
}

.bg-rose-subtle {
    background-color: #fff1f2 !important;
}

.text-rose {
    color: #e11d48 !important;
}

.border-rose-subtle {
    border-color: #fecdd3 !important;
}

.bg-teal-subtle {
    background-color: #f0fdf4 !important;
}

.border-teal-subtle {
    border-color: #99f6e4 !important;
}

/* ==========================================================================
   SPA Router & Real-Time Transitions
   ========================================================================== */
#spa-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    z-index: 999999;
    background: linear-gradient(90deg, #4f46e5 0%, #06b6d4 50%, #10b981 100%);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.8), 0 0 5px rgba(6, 182, 212, 0.6);
    transition: width 0.22s ease, opacity 0.3s ease;
    pointer-events: none;
    opacity: 0;
}

.main-content {
    transition: opacity 0.14s ease-out;
}

.main-content.spa-transitioning {
    opacity: 0.35;
    pointer-events: none;
}

@keyframes rowPulse {
    0% { background-color: rgba(99, 102, 241, 0.22); }
    100% { background-color: transparent; }
}

.row-highlight {
    animation: rowPulse 2s ease-out;
}

/* ==========================================================================
   AD ANALYTICS EXECUTIVE PRO STYLING
   ========================================================================== */
.ad-hero-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    position: relative;
}

.ad-funnel-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    padding: 20px 24px;
}

.ad-funnel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    position: relative;
}

@media (max-width: 991px) {
    .ad-funnel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .ad-funnel-grid {
        grid-template-columns: 1fr;
    }
}

.ad-funnel-step {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ad-funnel-step:hover {
    border-color: #cbd5e1;
    background: #ffffff;
    box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.ad-funnel-step.step-hero {
    background: #ffffff;
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.06);
}

.ad-funnel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ad-funnel-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.ad-funnel-num {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.ad-funnel-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.table-modern {
    --bs-table-hover-bg: #f8fafc;
}

.table-modern th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.table-modern td {
    padding-top: 13px;
    padding-bottom: 13px;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
}

.table-modern tfoot td {
    border-top: 2px solid #e2e8f0;
    background: #f8fafc;
    font-weight: 700;
}

