/**
 * Hmf Leads - HubSpot-Grade CRM Design System & Responsive Framework
 * Part 1: Design Tokens, Layouts, Responsive Tables, KPI Stat Cards & Navigation
 */

:root {
    /* Brand Dark & Emerald Tokens */
    --crm-bg: #07110B;
    --crm-surface: #0C1A11;
    --crm-surface-elevated: #112619;
    --crm-surface-card: #0E2014;
    --crm-surface-hover: #163020;
    
    --crm-border: rgba(0, 210, 106, 0.22);
    --crm-border-subtle: rgba(255, 255, 255, 0.08);
    --crm-border-hover: rgba(0, 210, 106, 0.55);
    --crm-border-active: #00D26A;

    --crm-primary: #00D26A;
    --crm-primary-hover: #00E872;
    --crm-primary-active: #00BD5E;
    --crm-primary-light: rgba(0, 210, 106, 0.12);
    --crm-primary-glow: 0 0 16px rgba(0, 210, 106, 0.35);

    --crm-text-primary: #FFFFFF;
    --crm-text-secondary: rgba(255, 255, 255, 0.78);
    --crm-text-muted: rgba(255, 255, 255, 0.52);

    /* Semantic Status Colors */
    --crm-success: #00D26A;
    --crm-success-bg: rgba(0, 210, 106, 0.12);
    --crm-warning: #F59E0B;
    --crm-warning-bg: rgba(245, 158, 11, 0.14);
    --crm-danger: #EF4444;
    --crm-danger-bg: rgba(239, 68, 68, 0.14);
    --crm-info: #3B82F6;
    --crm-info-bg: rgba(59, 130, 246, 0.14);
    --crm-purple: #8B5CF6;
    --crm-purple-bg: rgba(139, 92, 246, 0.14);

    /* Spacing & Radii */
    --crm-radius-xs: 4px;
    --crm-radius-sm: 8px;
    --crm-radius-md: 12px;
    --crm-radius-lg: 16px;
    --crm-radius-xl: 22px;
    --crm-radius-full: 9999px;

    /* Shadows */
    --crm-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --crm-shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
    --crm-shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.65);
    --crm-shadow-emerald: 0 8px 24px rgba(0, 210, 106, 0.25);

    /* Z-Index Hierarchy */
    --crm-z-dropdown: 1050;
    --crm-z-sticky: 1020;
    --crm-z-mobile-nav: 1060;
    --crm-z-modal: 1070;
    --crm-z-tooltip: 1080;
}

/* ====================================================================
   1. GLOBAL PAGE & CONTAINER FIXES (Horizontal Overflow & Bottom Padding)
   ==================================================================== */
.crm-page-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-bottom: 95px !important;
}

@media (max-width: 767px) {
    .crm-page-wrapper {
        padding-bottom: 125px !important; /* Space for mobile bottom bar + chat */
    }
}

/* ====================================================================
   2. SCROLL TO TOP & CHAT WIDGET INTERACTION FIX (Bug 4)
   ==================================================================== */
/* Hide scroll-to-top by default until user scrolls > 200px */
.scroll-top,
a.scroll-top {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(0.6) translateY(10px) !important;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.28s !important;
    bottom: 96px !important;
    right: 25px !important;
    z-index: 9995 !important;
}

.scroll-top.show,
a.scroll-top.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: scale(1) translateY(0) !important;
}

@media (max-width: 767px) {
    .scroll-top,
    a.scroll-top {
        bottom: 85px !important;
        right: 18px !important;
        width: 42px !important;
        height: 42px !important;
        font-size: 15px !important;
    }
    .hmf-chat-widget-wrapper {
        bottom: 20px !important;
        right: 18px !important;
    }
    .hmf-chat-trigger-btn {
        width: 50px !important;
        height: 50px !important;
    }
}

/* ====================================================================
   3. MOBILE ACCORDION NAVBAR FIX (Overlapping Blog/Contact Fix)
   ==================================================================== */
@media (max-width: 1199px) {
    .offcanvas .dropdown-menu,
    .nav-menu .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-top: 6px !important;
        margin-bottom: 12px !important;
        border: 1px solid rgba(0, 210, 106, 0.25) !important;
        background: rgba(10, 22, 14, 0.96) !important;
        box-shadow: none !important;
        display: none;
    }
    .offcanvas .dropdown-menu.show,
    .nav-menu .dropdown-menu.show {
        display: block !important;
    }
}

/* ====================================================================
   4. SHARED CRM NAVIGATION BAR (Desktop Sub-nav + Mobile Bottom Bar)
   ==================================================================== */
.crm-global-nav {
    background: rgba(12, 26, 17, 0.95);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 8px 12px;
    margin-bottom: 22px;
    backdrop-filter: blur(12px);
    box-shadow: var(--crm-shadow-sm);
}

.crm-nav-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.crm-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--crm-radius-sm);
    color: var(--crm-text-secondary);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.crm-nav-link:hover {
    color: var(--crm-primary);
    background: rgba(0, 210, 106, 0.08);
}

.crm-nav-link.active {
    color: #05150A !important;
    background: var(--crm-primary) !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 210, 106, 0.4);
}

.crm-nav-link i {
    font-size: 17px;
    line-height: 1;
}

.crm-nav-link .badge-lock {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--crm-radius-full);
    background: rgba(245, 158, 11, 0.2);
    color: var(--crm-warning);
    margin-left: 2px;
}

/* Mobile Sticky Bottom Tab Bar (HubSpot-Style 1-thumb CRM switch) */
.crm-mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(8, 18, 12, 0.97);
    border-top: 1px solid var(--crm-border);
    backdrop-filter: blur(16px);
    z-index: var(--crm-z-mobile-nav);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.7);
}

@media (max-width: 767px) {
    .crm-mobile-bottom-bar {
        display: flex;
        align-items: center;
        justify-content: space-around;
    }
}

.crm-mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--crm-text-muted);
    font-size: 10.5px;
    font-weight: 600;
    padding: 4px 6px;
    border-radius: var(--crm-radius-sm);
    transition: all 0.2s ease;
    min-width: 52px;
}

.crm-mobile-tab-item i {
    font-size: 19px;
    margin-bottom: 2px;
    line-height: 1;
}

.crm-mobile-tab-item:hover,
.crm-mobile-tab-item.active {
    color: var(--crm-primary);
}

.crm-mobile-tab-item.active i {
    transform: scale(1.15);
    filter: drop-shadow(0 0 6px rgba(0, 210, 106, 0.6));
}

/* ====================================================================
   5. REUSABLE PAGE HEADER COMPONENT
   ==================================================================== */
.crm-page-header {
    background: linear-gradient(135deg, rgba(12, 26, 17, 0.85) 0%, rgba(7, 17, 11, 0.95) 100%);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 18px 22px;
    margin-bottom: 22px;
    position: relative;
    overflow: visible !important; /* Critical: allow action dropdown menus to display without clipping */
    z-index: 30;
}

.crm-page-header::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 100%;
    border-top-right-radius: var(--crm-radius-lg);
    border-bottom-right-radius: var(--crm-radius-lg);
    background: radial-gradient(circle at right top, rgba(0, 210, 106, 0.12), transparent 70%);
    pointer-events: none;
}

.crm-header-title {
    font-size: 22px;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-header-subtitle {
    font-size: 13.5px;
    color: var(--crm-text-secondary);
    margin: 4px 0 0;
    line-height: 1.45;
}

.crm-plan-pill {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 3px 10px;
    border-radius: var(--crm-radius-full);
    border: 1px solid rgba(0, 210, 106, 0.5);
    background: rgba(0, 210, 106, 0.12);
    color: var(--crm-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ====================================================================
   6. ENTERPRISE KPI STAT CARDS (Fix for Bug 2 & 17px Squeezing)
   ==================================================================== */
.crm-stat-card {
    background: rgba(12, 26, 17, 0.95);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-md);
    padding: 16px 18px;
    position: relative;
    box-shadow: var(--crm-shadow-sm);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

.crm-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.crm-stat-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--crm-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: normal;
    word-break: normal;
    line-height: 1.35;
    flex: 1;
}

.crm-stat-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: var(--crm-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.crm-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.15;
    margin: 0 0 4px;
    letter-spacing: -0.5px;
}

.crm-stat-meta {
    font-size: 12px;
    color: var(--crm-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Accessible Tooltip Trigger (Fix for Bug 3 & 17px Collapse) */
.crm-info-tip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--crm-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.crm-info-tip:hover,
.crm-info-tip:focus {
    background: var(--crm-primary);
    color: #05150A;
    border-color: var(--crm-primary);
}

/* ====================================================================
   7. RESPONSIVE DATA TABLE & MOBILE CARD LIST (Fix for Bug 1)
   ==================================================================== */
/* Prevent 1-letter column collapse globally */
.crm-table-container {
    background: rgba(12, 26, 17, 0.95);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    box-shadow: var(--crm-shadow-sm);
    overflow: hidden;
}

.crm-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    min-width: 780px; /* Crucial: guarantees columns never crush below readable min */
}

.crm-table th {
    background: rgba(8, 18, 12, 0.95);
    color: var(--crm-text-muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--crm-border);
    white-space: nowrap; /* No wrapping headers into 1-letter columns */
    position: sticky;
    top: 0;
    z-index: 2;
}

.crm-table td {
    padding: 13px 16px;
    color: var(--crm-text-secondary);
    font-size: 13.5px;
    border-bottom: 1px solid var(--crm-border-subtle);
    vertical-align: middle;
}

.crm-table tr:hover td {
    background: rgba(0, 210, 106, 0.04);
}

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

/* Truncation helper with ellipsis */
.crm-truncate {
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.crm-nowrap {
    white-space: nowrap !important;
}

/* Status Pills */
.crm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--crm-radius-full);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.4;
    text-transform: capitalize;
}

.crm-status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.crm-status-new {
    background: rgba(59, 130, 246, 0.16);
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.crm-status-new::before { background: #3B82F6; }

.crm-status-contacted {
    background: rgba(245, 158, 11, 0.16);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.crm-status-contacted::before { background: #F59E0B; }

.crm-status-interested,
.crm-status-qualified {
    background: rgba(139, 92, 246, 0.16);
    color: #A78BFA;
    border: 1px solid rgba(139, 92, 246, 0.35);
}
.crm-status-interested::before,
.crm-status-qualified::before { background: #8B5CF6; }

.crm-status-converted,
.crm-status-won {
    background: rgba(0, 210, 106, 0.16);
    color: #00E872;
    border: 1px solid rgba(0, 210, 106, 0.4);
}
.crm-status-converted::before,
.crm-status-won::before { background: #00D26A; }

.crm-status-lost {
    background: rgba(239, 68, 68, 0.16);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.crm-status-lost::before { background: #EF4444; }

/* Mobile Card View (shown < 768px when tables would be too wide) */
.crm-mobile-card {
    background: rgba(12, 26, 17, 0.95);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-md);
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--crm-shadow-sm);
    transition: border-color 0.2s ease;
}

.crm-mobile-card:hover {
    border-color: var(--crm-border-hover);
}

.crm-mobile-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.crm-mobile-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    line-height: 1.3;
}

.crm-mobile-card-subtitle {
    font-size: 12px;
    color: var(--crm-text-muted);
    margin: 2px 0 0;
}

.crm-mobile-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--crm-text-secondary);
    padding: 8px 0;
    border-top: 1px solid var(--crm-border-subtle);
    border-bottom: 1px solid var(--crm-border-subtle);
    margin: 8px 0;
}

.crm-mobile-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.crm-mobile-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

/* ====================================================================
   8. FILTER & SEARCH TOOLBAR
   ==================================================================== */
.crm-filter-bar {
    background: rgba(12, 26, 17, 0.95);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.crm-search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.crm-search-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--crm-text-muted);
    font-size: 16px;
}

.crm-search-input {
    width: 100%;
    padding: 9px 14px 9px 40px;
    background: rgba(7, 17, 11, 0.85);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    color: #FFFFFF;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
}

.crm-search-input:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 3px rgba(0, 210, 106, 0.2);
    background: rgba(7, 17, 11, 0.98);
}

.crm-filter-select {
    padding: 9px 34px 9px 14px;
    background: rgba(7, 17, 11, 0.85);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-sm);
    color: #FFFFFF;
    font-size: 13.5px;
    outline: none;
    cursor: pointer;
    min-width: 150px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300D26A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.crm-filter-select option {
    background: #0C1A11;
    color: #FFFFFF;
}

/* ====================================================================
   9. EMPTY STATE COMPONENT
   ==================================================================== */
.crm-empty-state {
    text-align: center;
    padding: 48px 24px;
    background: rgba(12, 26, 17, 0.65);
    border: 1px dashed var(--crm-border);
    border-radius: var(--crm-radius-lg);
}

.crm-empty-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(0, 210, 106, 0.1);
    color: var(--crm-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
    box-shadow: 0 0 24px rgba(0, 210, 106, 0.15);
}

.crm-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 8px;
}

.crm-empty-desc {
    font-size: 13.5px;
    color: var(--crm-text-secondary);
    max-width: 440px;
    margin: 0 auto 20px;
    line-height: 1.5;
}

/* ====================================================================
   10. BUTTONS & ACTIONS
   ==================================================================== */
.crm-btn-primary {
    background: var(--crm-primary);
    color: #05150A !important;
    font-weight: 700;
    font-size: 13px;
    padding: 0 16px;
    height: 38px;
    border-radius: var(--crm-radius-sm);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 210, 106, 0.3);
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.crm-btn-primary:hover {
    background: var(--crm-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 210, 106, 0.45);
    color: #05150A !important;
}

.crm-btn-outline {
    background: transparent;
    color: var(--crm-text-primary) !important;
    font-weight: 600;
    font-size: 13px;
    padding: 0 14px;
    height: 38px;
    border-radius: var(--crm-radius-sm);
    border: 1px solid var(--crm-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.crm-btn-outline:hover {
    border-color: var(--crm-primary);
    color: var(--crm-primary) !important;
    background: rgba(0, 210, 106, 0.08);
}

/* ====================================================================
   STAGE / STATUS DROPDOWN COMPONENT (HIGH CONTRAST & ACCESSIBILITY)
   ==================================================================== */
.status-dropdown-wrapper .dropdown-menu {
    background: #0C1F16 !important;
    border: 1px solid rgba(0, 255, 136, 0.35) !important;
    border-radius: 10px !important;
    padding: 6px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 15px rgba(0, 255, 136, 0.1) !important;
    min-width: 175px !important;
    z-index: 1080 !important;
}

.status-dropdown-wrapper .dropdown-item {
    padding: 7px 12px !important;
    border-radius: 6px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    color: #E2E8F0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    background: transparent !important;
    transition: all 150ms ease !important;
}

.status-dropdown-wrapper .dropdown-item:hover,
.status-dropdown-wrapper .dropdown-item:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #FFFFFF !important;
}

.status-dropdown-wrapper .dropdown-item.active,
.status-dropdown-wrapper .dropdown-item:active {
    background: rgba(0, 255, 136, 0.18) !important;
    color: #00FF88 !important;
    font-weight: 700 !important;
}

.status-dropdown-wrapper .stage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dropdown-wrapper .stage-check {
    margin-left: auto;
    font-size: 13px;
    color: #00FF88;
    display: none;
}

.status-dropdown-wrapper .dropdown-item.active .stage-check {
    display: inline-block !important;
}

/* ====================================================================
   LEADS TABLE ACTIONS (DETAILS, AI EMAIL, DELETE)
   ==================================================================== */
.btn-crm-details {
    height: 34px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    background: rgba(0, 210, 106, 0.12) !important;
    color: #00D26A !important;
    border: 1px solid rgba(0, 210, 106, 0.35) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    transition: all 180ms ease !important;
    line-height: 1 !important;
}
.btn-crm-details:hover {
    background: rgba(0, 210, 106, 0.22) !important;
    color: #FFFFFF !important;
    border-color: #00FF88 !important;
    transform: translateY(-1px);
}

.btn-crm-icon-action {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 180ms ease !important;
    line-height: 1 !important;
}

.btn-crm-ai-email {
    font-size: 17px !important;
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60A5FA !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
}
.btn-crm-ai-email:hover {
    background: rgba(59, 130, 246, 0.3) !important;
    color: #FFFFFF !important;
    border-color: #93C5FD !important;
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4) !important;
}

.btn-crm-delete {
    font-size: 16px !important;
    background: rgba(239, 68, 68, 0.12) !important;
    color: #EF4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.38) !important;
}
.btn-crm-delete:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #FFFFFF !important;
    border-color: #F87171 !important;
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4) !important;
}

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

/* Quick copy tooltip helper */
.crm-copy-btn {
    cursor: pointer;
    color: var(--crm-text-muted);
    transition: color 0.15s ease;
}
.crm-copy-btn:hover {
    color: var(--crm-primary);
}

/* ====================================================================
   11. AUTOMATION WORKFLOW BUILDER STYLES (WHEN -> IF -> THEN)
   ==================================================================== */
.crm-workflow-card {
    background: rgba(12, 26, 17, 0.95);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--crm-shadow-sm);
    transition: all 0.25s ease;
}

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

.crm-workflow-card.active {
    border-left: 4px solid var(--crm-primary);
}

.crm-workflow-nodes {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 14px 0;
}

.crm-workflow-node {
    background: rgba(7, 17, 11, 0.9);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-md);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
}

.crm-node-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--crm-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.crm-node-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--crm-text-muted);
}

.crm-node-desc {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
}

.crm-workflow-arrow {
    color: var(--crm-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.crm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.crm-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .crm-slider {
    background-color: var(--crm-primary);
}

input:checked + .crm-slider:before {
    transform: translateX(20px);
    background-color: #05150A;
}
