:root {
    /* Colors */
    --bg-body: #f9fafb;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;

    --text-primary: #343A3D;
    --text-secondary: #5f666a;
    --text-muted: #9ca3af;


    --primary-color: #00a884;
    --primary-hover: #008f6f;
    --accent-green: #00a884;
    --accent-blue: #169475;
    --accent-pink: #10b981;

    --secondary-color: #3b82f6;
    --secondary-hover: #2563eb;

    --border-light: #e5e7eb;
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* Spacing */
    --sidebar-width: 240px;
    --header-height: 80px;
    --br: 16px;
    /* border-radius */
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 0.75rem !important;
    transition: width 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.logo {
    display: flex;
    align-items: center;

    justify-content: flex-start;
    padding-left: 10px !important;
    padding-top: 5px !important;
    padding-bottom: 15px !important;
    color: var(--primary-color);
}

.logo i {
    font-size: 2.4rem;
    /* Increased from 2rem */
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px !important;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: #f1faff;
    /* Light primary tint */
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 165, 133, 0.3);
}

.nav-link i {
    font-size: 1.25rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.user-info h4 {
    font-size: 0.9rem;
}

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

.sidebar-footer {
    margin-top: auto;
    position: relative;
    /* For absolute positioning of menu */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #f3f4f6;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
}

.user-profile:hover {
    background-color: #e5e7eb;
}

.user-menu-dropdown {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 5px;
    z-index: 100;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.user-menu-dropdown.active {
    display: flex;
    animation: slideUp 0.2s ease;
}

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

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

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
    /* Darker tint for visibility on white */
    color: var(--primary-color);
}

.menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

.status-dot-menu {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.status-dot-menu.connected {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}


/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-light);
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}



/* ------------------------------------------------------------------ */
/* AUTOMATION STYLES */
/* ------------------------------------------------------------------ */

/* Type Selector in Modal */
.type-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.type-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-secondary);
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    width: 100%;
}

.type-btn i {
    font-size: 1.5rem;
    margin-bottom: 2px;
    transition: transform 0.3s ease;
}

.type-btn span {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.type-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-2px);
}

.type-btn.active {
    background: rgba(13, 165, 133, 0.1);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 20px rgba(13, 165, 133, 0.3);
}

.type-btn.active i {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Specific accent colors for active states */
.type-btn[data-type="message"].active {
    border-color: var(--primary-color);
    background: rgba(13, 165, 133, 0.1);
}

.type-btn[data-type="audio"].active {
    border-color: var(--accent-green);
    background: rgba(0, 230, 118, 0.1);
}

.type-btn[data-type="media"].active {
    border-color: var(--accent-blue);
    background: rgba(41, 121, 255, 0.1);
}

.type-btn[data-type="doc"].active {
    border-color: #f59e0b;
    /* Orange/Amber for docs */
    background: rgba(245, 158, 11, 0.1);
}

.type-btn[data-type="message"].active i {
    color: var(--primary-color);
}

.type-btn[data-type="audio"].active i {
    color: var(--accent-green);
}

.type-btn[data-type="media"].active i {
    color: var(--accent-blue);
}

.type-btn[data-type="doc"].active i {
    color: #f59e0b;
}

/* Funnel Timeline Styles */
.funnel-timeline {
    display: flex;
    flex-direction: column !important;
    /* Force vertical stack */
    flex-wrap: nowrap !important;
    gap: 15px;
    padding-bottom: 50px;
    margin-top: 20px;
    width: 100%;
    flex: 1;
    overflow-y: auto;
}

/* Custom Scrollbar for timeline */
.funnel-timeline::-webkit-scrollbar {
    width: 6px;
}

.funnel-timeline::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.funnel-item {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: stretch;
    /* Stretch so line goes all the way down */
    position: relative;
    margin-bottom: 0;
    /* Tight packing, spacing handled by gap in container if any, or internal padding */

    min-height: 60px;
    flex-shrink: 0;
}

/* Handle Style */
.funnel-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #2e2f45;
    /* Dark handle background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #94a3b8;
    cursor: grab;
    transition: all 0.2s;
    z-index: 2;
    /* Above line */
}

/* Zap Card Dark Theme */
.zap-card-dark {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.zap-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-light);
}

.zap-card-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.zap-icon-wrapper {
    position: relative;

    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zap-card-icon {
    font-size: 1.5rem;
    z-index: 2;
}

.zap-icon-dots {
    position: absolute;
    bottom: -5px;
    display: flex;
    gap: 2px;
}

.zap-dot {
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.zap-header-text-group {
    display: flex;
    flex-direction: column;
}

.zap-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.zap-card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.zap-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zap-btn-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-secondary);
}

.zap-btn-circle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.zap-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.zap-card-body {
    padding: 15px;
    display: none;
    /* Collapsed by default via JS or CSS? JS sets block */
}

/* Audio Player Specifics */
.zap-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
}

.zap-progress-container {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    margin: 0 10px;
}

.zap-progress-fill {
    height: 100%;
    background: var(--accent-green);
    width: 0%;
    border-radius: 2px;
}

.zap-time-display {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.zap-media-preview img,
.zap-media-preview video {
    max-width: 100%;
    border-radius: 8px;
    max-height: 200px;
    object-fit: contain;
}



.funnel-item:hover .funnel-handle {
    opacity: 1;
}

/* Timeline Spine Container */
.timeline-spine {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    margin-right: 15px;
    position: relative;
    height: auto;
    align-self: stretch;
}

/* The Vertical Line - Running behind everything */
.timeline-line {
    position: absolute;
    top: 0;
    bottom: -15px;
    /* Extend slightly to gap */
    width: 2px;
    background: var(--border-light);
    z-index: 1;
}

/* Hide line on the absolute last item */
#flow-list-container .funnel-item:last-child .timeline-line,
#automation-list .funnel-item:last-child .timeline-line {
    bottom: 50%;
    /* Stop at center of last item */
}

/* Inner Card (The actual visible box) */
.funnel-inner-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.funnel-inner-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Connecting Line Idea - Optional */
.funnel-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40px;
    width: 2px;
    background: var(--border-light);
    z-index: 0;
    display: none;
    /* Hide for now */
}


.funnel-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    z-index: 1;
}

.funnel-icon.msg {
    background: rgba(13, 165, 133, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(13, 165, 133, 0.2);
}

.funnel-icon.audio {
    background: rgba(41, 121, 255, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(41, 121, 255, 0.2);
}

.funnel-icon.media {
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.funnel-content {
    flex: 1;
    z-index: 1;
}

.funnel-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 4px;
}

.funnel-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 15px;
    align-items: center;
}

.funnel-actions {
    display: flex;
    gap: 8px;
    z-index: 1;
}

.icon-btn-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.icon-btn-sm.danger:hover {

    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-pink);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Admin Modal Close Icon --- */
.close-modal-icon {
    position: absolute;
    top: 10px;
    right: 15px;
    /* Moved slightly out */
    font-size: 1.5rem;
    /* Slightly smaller to fit better */
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    z-index: 20;
    /* Ensure above header elements */
    background: rgba(0, 0, 0, 0.05);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal-icon:hover {
    color: var(--accent-pink);
    background: rgba(245, 0, 87, 0.1);
}

/* --- Bottom Close Button --- */
.btn-modal-close-bottom {
    background: #e2e8f0;
    color: #475569;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-modal-close-bottom:hover {
    background: #cbd5e1;
    color: #334155;
}

/* --- Badge Current --- */
.badge-current {
    background: rgba(13, 165, 133, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    vertical-align: middle;
    display: inline-block;
    border: 1px solid rgba(13, 165, 133, 0.2);
}

/* --- Flow Editor Aesthetics --- */
.canvas-node {
    background: #1e1e28 !important;
    /* Premium Dark Card */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    color: #ffffff;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    /* overflow: hidden; -- REMOVED to allow sockets to be halfway out */
    z-index: 1;

    position: absolute !important;
}

.canvas-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.canvas-node.selected {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(13, 165, 133, 0.5), 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.node-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px !important;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 16px 16px 0 0;
}

.node-body {
    padding: 16px !important;
    font-size: 0.9rem;
    color: #cbd5e1;
    /* Lighter text for readability */
}

/* Improve buttons inside nodes */
.node-body button {
    border-radius: 8px !important;
    font-weight: 500;
    transition: filter 0.2s;
}

.node-body button:hover {
    filter: brightness(1.1);
}

/* Node Footer */
.node-footer {
    padding: 8px 16px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.2);
}

/* Modal Inputs Enhancement */
#auto-item-form .form-group {
    margin-bottom: 20px;
}

#auto-item-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#auto-item-form .form-control {
    background: #ffffff;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    transition: border-color 0.2s;
}

#auto-item-form .form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    background: #ffffff;
}

/* Views Container (Wrapper) */
.views-container {
    flex: 1;
    overflow: hidden;
    /* Each view handles its own scroll */
    position: relative;
    background: var(--bg-body);
    /* Ensure background covers */
}

/* Base View Styles */
.view {
    display: none;
    width: 100%;
    height: 100%;
    /* Default: simple views have padding and scroll */
    padding: 2rem;
    overflow-y: auto;
    /* Allows vertical scrolling */
}

.view.active {
    display: flex;
    /* Changed to flex to support full-height layouts */
    flex-direction: column;
}

/* Specific View Overrides */

/* Dashboard needs normal block flow for grid */
#dashboard-view {
    display: none;
    /* Reset for non-active */
}

#dashboard-view.active {
    display: block;
}

/* Messages needs fixed height for split view (no outer scroll) */
#messages-view {
    overflow: hidden;
    /* Disable outer scroll */
    padding: 2rem;
    /* Keep padding */
}

/* Ensure grid takes full height minus padding? 
   Grid is 100% height. If parent has padding, child 100% might overflow box-sizing? 
   No, box-sizing: border-box handles padding. 
   So .view height 100% with padding 2rem means content box is smaller. 
   Child height 100% fills that content box. Correct.
*/

/* Audios View */
#audios-view.active {
    display: block;
    /* Flow layout */
}

/* Automations View */
#automations-view.active {
    display: block;
    /* Flow layout */
}

/* ------------------------------------------------------------- 
   Split View Layout 
---------------------------------------------------------------- */

/* ------------------------------------------------------------- 
   Split View Layout 
---------------------------------------------------------------- */
.msg-layout {
    display: grid;
    grid-template-columns: 530px 1fr;
    gap: 20px;
    height: 100%;
    flex: 1;
    min-height: 0; /* Important for grid inside flex */
}

/* Sidebar List */
.msg-sidebar {
    display: flex;
    flex-direction: column;

    height: 100%;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--br);
}

.msg-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.msg-sidebar-footer .btn-primary {
    width: 100%;
    padding: 12px;
    font-weight: 600;
    gap: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-search-bar {
    display: flex;

    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.msg-search-bar input {
    flex: 1;
    min-width: 0;

    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: #ffffff;
    color: var(--text-primary);

    font-size: 0.95rem;
}

.msg-search-bar .sort-select {
    width: auto;
    max-width: 150px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background-color: var(--bg-card);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.msg-search-bar .filter-trigger-btn {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-search-bar .filter-trigger-btn:hover {
    background: var(--bg-card-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.msg-list-container {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;

    border-radius: 0px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar for list */
.msg-list-container::-webkit-scrollbar {
    width: 6px;
}

.msg-list-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.msg-list-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.msg-list-item:hover {
    background: #f3f4f6;
}

.msg-list-item.active {
    background: rgba(13, 165, 133, 0.15);
    border-left: 3px solid var(--primary-color);
}

.list-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary) !important;
}

.list-item-preview {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Detail Panel */
.msg-detail-panel {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    padding: 2rem;
    display: flex;
    flex-direction: column;

    height: auto;
    max-height: 100%;
    align-self: start;
    overflow-y: auto;
    overflow-x: hidden;
}

.msg-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.msg-detail-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #a0a0b0;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.action-btn.delete:hover {
    background: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
}

.action-btn.duplicate:hover {
    background: rgba(41, 121, 255, 0.15);
    color: #2979ff;
}

.action-btn.edit:hover {
    background: rgba(13, 165, 133, 0.15);
    color: var(--primary-color);
}

.action-btn.favorite:hover {
    background: rgba(245, 0, 87, 0.15);
    color: var(--accent-pink);
}

.msg-bubble-large {
    background: rgba(114, 76, 254, 0.1);
    padding: 20px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    color: #e0e0e0;
    border-left: 44px solid var(--primary-color);
}

/* Connect View (Modal/Overlay simulation) */
.qr-container {
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    text-align: center;
}

#state-disconnected {
    display: flex;
    flex-direction: column;
}

.qr-container h2 {
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: 700;
}

.qr-code-box {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    /* Ensure space for QR */
}

.steps-list {
    margin-top: 30px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 25px;
    border-top: 1px solid var(--border-light);
}

.step {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.step::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* Modal */
/* Modal Overlay - Optimized */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    /* Slightly darker, no blur */
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: none;
    /* Removed heavy blur */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    /* Simple opacity transition */
}

.modal-overlay[style*="display: flex"] {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;

    width: 95%;
    max-width: 500px;
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal-x {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 2000;
    transition: all 0.2s;
}

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

.confirmation-content {
    text-align: center;
    max-width: 450px;
    border-radius: 24px;
    padding: 40px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.confirmation-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1e293b;
}

.confirmation-content p {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 30px;
    line-height: 1.5;
}

.confirmation-content .modal-actions {
    justify-content: center;
    gap: 15px;
}

.confirmation-content .btn-primary {
    padding: 12px 35px;
    border-radius: 12px;
    font-weight: 600;
    min-width: 140px;
    background: #0DA585;
    box-shadow: 0 4px 15px rgba(13, 165, 133, 0.2);
}

.confirmation-content .btn-secondary {
    padding: 12px 35px;
    border-radius: 12px;
    font-weight: 600;
    min-width: 140px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;

    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: #ffffff;
    /* Darker input bg */
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 165, 133, 0.1);
    background: #ffffff;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* ------------------------------------------------------------- 
   Dashboard Overview Styles 
---------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--br);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    background: var(--bg-card-hover);
}

.icon-box {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.icon-box.purple {
    background: rgba(114, 76, 254, 0.15);
    color: var(--primary-color);
}

.icon-box.blue {
    background: rgba(41, 121, 255, 0.15);
    color: var(--accent-blue);
}

.icon-box.pink {
    background: rgba(245, 0, 87, 0.15);
    color: var(--accent-pink);
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
}

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

.stat-info .trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}

.stat-info .trend.up {
    color: var(--accent-green);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--br);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

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

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-text {
    background: none;
    color: var(--primary-color);
    font-weight: 500;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.activity-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
}

.dot.green {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

/* ------------------------------------------------------------- 
   Audio Modal & Player Styles 
---------------------------------------------------------------- */

/* Dropzone */
.dropzone {
    border: 2px dashed rgba(114, 76, 254, 0.5);
    background: rgba(114, 76, 254, 0.05);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.dropzone:hover {
    background: rgba(114, 76, 254, 0.1);
    border-color: var(--primary-color);
}

/* Dropzone Split Layout (Edit Mode) */
.dropzone-split {
    display: flex;
    padding: 0 !important;
    overflow: hidden;
    text-align: left;
    height: 140px;
    align-items: stretch;
}

.dropzone-split .preview-side {
    width: 40%;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-right: 1px solid rgba(114, 76, 254, 0.3);
}

.dropzone-split .preview-side img,
.dropzone-split .preview-side video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropzone-split .instruction-side {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2c2c35;
    transition: .4s;
    border-radius: 24px;
}

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

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

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

/* Audio Player Glass Bar */
.audio-player-glass {
    background: #f1f5f9;
    border: 1px solid var(--border-light);
    border-radius: 50px;
    /* Pill shape */
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.btn-play-pause {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    padding-left: 4px;
    /* Optical center for play icon */
    transition: background 0.2s;
}

.btn-play-pause:hover {
    background: var(--primary-hover);
}

.playback-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 80px;
}

.speed-badge {
    font-size: 0.7rem;
    background: var(--bg-body);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
}

.time-display {
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--text-secondary);
}

/* Seek Slider */
.seek-slider {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 10px rgba(13, 165, 133, 0.2);
    cursor: pointer;
    transition: transform 0.1s;
}

.seek-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* QR Placeholder Fix */
.qr-code-box {
    width: 280px;
    height: 280px;
    margin: 30px auto;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot.orange {
    background: #ff9800;
    box-shadow: 0 0 10px #ff9800;
}

.activity-item .content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-item .title {
    font-size: 0.95rem;
    font-weight: 500;
}

.activity-item .time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Premium Input Modal --- */
#modal-input .modal-content {
    background: #1e1e28;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 30px;
    max-width: 450px !important;
}

#modal-input h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px !important;
    text-align: center;
}

#modal-input label {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 8px;
    display: block;
}

#modal-input input.form-control {
    background: #151520;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 1rem;
    width: 100%;
    outline: none;
    transition: all 0.2s;
}

#modal-input input.form-control:focus {
    border-color: var(--primary-color);
    background: #1a1a25;
    box-shadow: 0 0 0 3px rgba(13, 165, 133, 0.2);
}

#modal-input .modal-actions {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#modal-input .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
}

#modal-input .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

#modal-input .btn-primary {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(13, 165, 133, 0.3);
}

/* Connection Status Card */
.connection-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
    text-align: center;
    padding: 20px 0;
}

.connection-status i {
    font-size: 4rem;
    transition: color 0.3s;
}

.connection-status .status-text {
    font-size: 1.2rem;
    font-weight: 600;
}

.connection-status .device-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pulse-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid;
    opacity: 0;
}

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

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* QR Code Container styles */
.qr-container {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
}

.qr-code-box {
    width: 280px;
    height: 280px;
    margin: 30px auto;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-placeholder {
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.qr-placeholder i {
    font-size: 2rem;
    color: var(--primary-color);
}

.steps-list {
    text-align: left;
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    padding-left: 10px;
    border-left: 2px solid var(--border-light);
}

/* ------------------------------------------------------------------
   Custom Searchable Dropdown & Media Preview
   ------------------------------------------------------------------ */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.05);
    /* Match .form-control */
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    /* Match inputs */
}

.custom-select-trigger:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    /* Solid dark for readability */
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-top: 5px;
    z-index: 1005;
    /* Above modal */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    /* JS toggles 'active' class */
    flex-direction: column;
    overflow: hidden;
}

.custom-select-dropdown.active {
    display: flex;
    animation: fadeIn 0.1s ease-out;
}

.custom-select-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.custom-select-search input {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    font-size: 0.9rem;
}

.custom-select-list {
    max-height: 200px;
    overflow-y: auto;
}

.custom-select-list::-webkit-scrollbar {
    width: 6px;
}

.custom-select-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.custom-option {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    /* Space between text and icon */
    align-items: center;
    transition: background 0.1s;
    color: var(--text-secondary);
}

.custom-option:hover {
    background-color: rgba(114, 76, 254, 0.1);
    /* Primary tint */
    color: white;
}

.custom-option.selected {
    background-color: var(--primary-color);
    color: white;
}

/* Eye Icon in list */
.preview-icon {
    opacity: 0.5;
    transition: opacity 0.2s;
    font-size: 1.2rem;
    padding: 2px;
}

.preview-icon:hover {
    opacity: 1;
    color: var(--accent-blue);
    transform: scale(1.1);
}

/* ------------------------------------------------------------------
   Media Preview Tooltip
   ------------------------------------------------------------------ */
.media-preview-tooltip {
    position: fixed;
    /* Fixed to viewport to avoid overflow clipping */
    display: none;
    border-radius: 12px;
    background: #181820;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-light);
    z-index: 9999;
    /* Highest priority */
    padding: 0;
    overflow: hidden;
    width: 250px;
    pointer-events: none;
    /* Let mouse pass through so it doesn't flicker on hover logic */
}

.media-preview-tooltip.active {
    display: block;
    animation: slideIn 0.2s ease;
}

#media-preview-content img,
#media-preview-content video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
    object-fit: cover;
}

.preview-caption {
    padding: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--border-light);
}

.preview-caption strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 2px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* ------------------------------------------------------------------
   Triggers & Toggle
   ------------------------------------------------------------------ */
.tag-chip {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tag-chip span {
    font-weight: bold;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-chip span:hover {
    opacity: 1;
    color: #ffcccc;
}

#btn-add-condition {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

#btn-add-condition:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 165, 133, 0.2);
}

.list-item-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

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

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

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: #10b981;
    border-color: #10b981;
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ------------------------------------------------------------------ */
/* TRIGGER CARD STYLES */
/* ------------------------------------------------------------------ */

.trigger-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* For active border strip */
    min-height: 80px;
    /* Consistent height */
}

/* Hover State */
.trigger-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Active Selection State (Clicking the card) */
.trigger-card.active {
    border-color: var(--primary-color);
    background: rgba(114, 76, 254, 0.05);
}

/* Active Status Strip (Left Border) */
.trigger-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--text-muted);
    /* Inactive color */
    opacity: 0.5;
    transition: background 0.3s;
}

/* Active Trigger (Toggle ON) - Purple Strip */
.trigger-card:not(.inactive)::before {
    background: var(--primary-color);
    opacity: 1;
}

/* Inactive Trigger Styling */
.trigger-card.inactive {
    opacity: 0.7;
    border-style: dashed;
}

.trigger-card.inactive .trigger-title {
    color: var(--text-muted);
}


/* Drag Handle */
.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    display: flex;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.trigger-card:hover .drag-handle {
    opacity: 1;
}

/* Content Area */
.trigger-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trigger-title {
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
}

.trigger-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Actions Area */
.trigger-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}


/* Toggle Switch Small */
.switch-sm {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

.switch-sm .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3f3f46;
    /* Dark gray for inactive */
    transition: .4s;
    border-radius: 20px;
    /* Round */
}

.switch-sm .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch-sm input:checked+.slider {
    background-color: #10b981;
}

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

/* Icon Buttons */
.icon-toggle-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-fav-icon {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.2s;
}

.btn-fav-icon:hover {
    color: var(--accent-pink);
}

/* Detail Panel Enhancements */
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
}

.detail-card h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ------------------------------------------------------------------
   BACKUP MANAGER STYLES
   ------------------------------------------------------------------ */

/* Removed duplicate/outdated backup styles - see section around line 3800 */

.info-alert {
    background: rgba(30, 30, 45, 0.5);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #A5B4FC;
}

.warning-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-red);
    color: #FCA5A5;
    padding: 10px 15px;
    border-radius: 30px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: center;
    display: inline-block;
    width: 100%;
}

.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(114, 76, 254, 0.05);
}

.dropzone p {
    color: var(--text-secondary);
    margin: 5px 0;
}

/* ------------------------------------------------------------------
   FLOW BUILDER UI STYLES
   ------------------------------------------------------------------ */

/* Layout */
.flow-builder-layout {
    display: flex;
    height: calc(100vh - 120px);
    /* Adjust based on header */
    background: #121216;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-light);
}

/* Sidebar */
.flow-sidebar {
    width: 280px;
    background: #181920;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}

.flow-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-light);
}

.flow-selector {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.flow-instruction {
    padding: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.nodes-category {
    padding: 10px 20px;
}

.nodes-category h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.nodes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}



.node-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: grab;
    transition: all 0.2s;
}

.node-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.node-item i {
    font-size: 1.5rem;
}

.node-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Color Coding for Palette */
.node-item.control i {
    color: #f59e0b;
}

.node-item.action i {
    color: #8b5cf6;
}


/* Canvas */
.flow-canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: #0f0f13;
    cursor: grab;
}

.canvas-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    pointer-events: none;
}

/* Canvas Overlays (Toolbars) */
.canvas-top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

.canvas-top-bar>* {
    pointer-events: auto;
}

.canvas-actions {
    display: flex;
    gap: 8px;
}

.btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.btn-circle.danger {
    background: #fee2e2;
    color: #ef4444;
}

.btn-circle:hover {
    transform: scale(1.1);
}


.canvas-bottom-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 10;
    pointer-events: none;
}

.canvas-bottom-bar>* {
    pointer-events: auto;
}

.zoom-controls {
    display: flex;
    background: #181920;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
    align-items: center;
}

.btn-square {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-square:hover {
    background: rgba(255, 255, 255, 0.1);
}

.divider {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 4px;
}

.btn-capsule {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-capsule.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.publish-controls {
    display: flex;
    gap: 12px;
}

.btn-pill-primary {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-pill-secondary {
    background: #2a2a35;
    color: #ffdce0;
    /* reddish tint */
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 500;
    cursor: pointer;
}

.btn-pill-highlight {
    background: #d9f99d;
    /* Lime/Greenish */
    color: #1a2e05;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(217, 249, 157, 0.3);
}

/* --------------------
   MOCKED NODES ON CANVAS
   -------------------- */
.flow-nodes-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 600px;
    /* This container would "zoom/pan" in a real implementation */
}

/* Common Node Styles */
.canvas-node {
    position: absolute;
    background: #ffffff;
    border-radius: 12px;
    width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid transparent;
    /* Default border */
    display: flex;
    flex-direction: column;
}

.canvas-node.selected {
    border-color: var(--primary-color);
}

/* Start Node */
.node-start {
    top: 50px;
    left: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #18181b;
    border-radius: 16px !important;

    overflow: visible !important;
}

/* Header strip */
.node-header {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Body */
.node-body {
    padding: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Connection Points (Dots) - Increased for better UX */
.node-out-point {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #10b981;
    /* Green */
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: crosshair;
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    opacity: 1;
    /* Always visible */
    pointer-events: auto;
}

.node-out-point:hover {
    transform: translateY(-50%) scale(1.3);
    background: #059669;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}


.node-footer {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    cursor: crosshair;
    transition: background 0.2s;
}

.node-footer:hover {
    background: rgba(16, 185, 129, 0.1);
}

.node-footer:hover .node-out-point {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
    background: #059669;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
    pointer-events: auto;
}

.node-in-point {
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    border: 3px solid #6b7280;

    opacity: 0;
    /* Hidden by default */
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 1;
    /* Always visible */
    pointer-events: auto;
}

.node-in-point:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(13, 165, 133, 0.3);
}

/* Specific Node Colors (Header Accents) */
.node-wait .node-header {
    color: #f59e0b;
}

.node-text .node-header {
    color: #a78bfa;
}

/* SVG Canvas for lines */
/* SVG Canvas for lines */
.connections-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5000px;
    height: 5000px;
    pointer-events: none;
    z-index: 0;
    /* Behind nodes */
}

/* ------------------------------------------------------------------
   START NODE SPECIFIC STYLES (RE-APPLIED)
   ------------------------------------------------------------------ */
.node-start {
    width: 380px !important;
    /* Wider for details */
    background: #18181b;
    border: 1px solid #27272a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.start-header {
    background: #202022;
    padding: 12px 15px;
    border-bottom: 1px solid #27272a;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 12px 12px 0 0;
}

.start-header i {
    color: #10b981;
    font-size: 1.4rem;
}

.start-header span {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
}

.start-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #18181b;
}

/* Config Sections */
.config-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Gap between box and label */
    color: #e4e4e7;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-line input[type="checkbox"] {
    accent-color: #fff;
    /* White check */
    width: 16px;
    height: 16px;
    cursor: pointer;
    background: #27272a;
    border: 1px solid #52525b;
    appearance: auto;
    /* Ensure browser default logic works first, then style */
}

.trigger-box {
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 0;
    /* Important: reset padding */
    background: transparent;
    overflow: hidden;
    /* For inner borders */
}

.trigger-select {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 12px;
    border-bottom: 1px solid #3f3f46;
    color: #d4d4d8;
    font-size: 0.9rem;
    cursor: pointer;
}

.trigger-select i.bx-trash {
    color: #ef4444;
    cursor: pointer;
    opacity: 0.8;
}

.trigger-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: #71717a;
    padding: 12px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: none;
    height: 70px;
    display: block;
    /* No whitespace issues */
}

.btn-soft-add {
    background: #27272a;
    color: #a1a1aa;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    width: 100%;
    padding: 8px;
    font-size: 0.85rem;
    margin-top: 5px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-soft-add:hover {
    background: #3f3f46;
    color: #fff;
    border-color: #52525b;
}

/* Permission Box */
.permission-box {
    background: #202022;
    border-radius: 8px;
    padding: 12px;
    margin-top: 5px;
    border: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.perm-title {
    color: #71717a;
    font-size: 0.85rem;
    font-weight: 500;
}

.perm-toggles {
    display: flex;
    gap: 20px;
    align-items: center;
    color: #e4e4e7;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.perm-help {
    font-size: 0.75rem;
    color: #71717a;
    text-align: center;
    line-height: 1.4;
    margin: 0;
    width: 100%;
}


/* Schedules */
.week-days {
    display: flex !important;
    flex-direction: row;
    justify-content: space-between;
    gap: 5px;
    margin-top: 8px;
    width: 100%;
}

.day-circle {
    width: 36px;
    height: 36px;
    border: 2px solid #3f3f46;
    /* Thicker border */
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a1a1aa;
    cursor: pointer;
    transition: all 0.2s;
}

.day-circle.active {
    background: transparent;
    color: #fff;
    border-color: #fff;
    /* White border for active */
}

.time-range-box {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.time-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.time-input-group label {
    font-size: 0.85rem;
    color: #71717a;
}

.time-input-group input {
    background: transparent;
    border: 1px solid #3f3f46;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    width: 100%;
}

/* Footer */
.node-footer {
    padding: 12px 15px;
    background: #18181b;
    /* Match body */
    border-top: none;
    /* Seamless */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    position: relative;
    border-radius: 0 0 16px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.node-footer:hover {
    background: #202022;
}

.node-footer span {
    font-size: 0.85rem;
    color: #10b981;
    /* Green text */
    font-weight: 500;
}

.node-footer .node-out-point {

    position: relative;
    right: 0;
    top: 0;
    transform: none;
    border-color: #18181b;
    /* Match bg */
}

/* Specific adjustment for Start Node out-point to be halfway out */
.node-start .node-footer .node-out-point {
    position: absolute !important;
    right: -10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    border-color: #fff !important;
}

/* ------------------------------------------------------------------
   MODAL STYLING FOR ADD NODE
   ------------------------------------------------------------------ */
.flow-items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.flow-item-card {
    background: #1e1e2d;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 120px;
}

.flow-item-card:hover {
    background: #27273a;
    border-color: #6366f1;
    /* Accent Color */
    transform: translateY(-2px);
}

.flow-item-card i {
    font-size: 2rem;
    margin-bottom: 5px;
}

.flow-item-card span {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    color: #e4e4e7;
    line-height: 1.2;
}

/* Specific button in Delay Config */
#modal-flow-config-delay .btn-primary {
    transition: background 0.2s;
}

/* ------------------------------------------------------------------
   NODE TOOLBAR (HOVER ACTIONS)
   ------------------------------------------------------------------ */
.node-toolbar {
    position: absolute;
    top: -50px;
    /* Moved up slightly */
    right: 0;
    display: flex;
    gap: 8px;
    background: #2e2e42;
    /* Solid dark */
    padding: 6px 12px;
    border-radius: 24px;
    /* Pill shape container */
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transition-delay: 0.2s;
    /* Delay hiding to allow mouse travel */
    transform: translateY(10px);
    z-index: 100;
}

/* Bridge the gap so mouse doesn't leave hover area */
.node-toolbar::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 20px;
    /* Covers the gap to the node */
    background: transparent;
}

.canvas-node:hover .node-toolbar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
    /* Show instantly */
}

.toolbar-btn {
    background: #3f3f46;
    border: none;
    color: #fff;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    /* Pill shape buttons */
    transition: all 0.2s;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toolbar-btn:hover {
    background: #52525b;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toolbar-btn.danger {
    background: #ef4444;
    /* Red */
    color: white;
}

.toolbar-btn.danger:hover {
    background: #dc2626;
    /* Darker Red */
}

/* Connection Delete Button */
.connection-delete-btn {
    transition: r 0.2s ease;
}

.connection-delete-btn:hover {
    r: 12;
    /* Grow on hover */
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.5));
}

/* ------------------------------------------------------------------
   Text Node Content Preview
   ------------------------------------------------------------------ */
.text-content-preview {
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.text-content-preview:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

/* ------------------------------------------------------------------
   CUSTOM SCROLLBAR & GENERAL REFINEMENTS
   ------------------------------------------------------------------ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Refined Back Button */
.btn-text-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
}

.btn-text-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(-2px);
}

.empty-state-small {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-light);
    border-radius: 12px;
    margin-top: 20px;
    min-height: 150px;
    position: relative;
    overflow: hidden;
}

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.12) 50%, 
        rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.8s infinite ease-in-out;
    border-radius: 12px;
}

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

.skeleton-item {
    height: 60px;
    width: 100%;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Disconnected Overlay */
.disconnected-overlay {
    display: none !important;
}

.disconnected-overlay i {
    font-size: 3rem;
    color: var(--accent-red);
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.3));
}

.disconnected-overlay p {
    font-size: 0.9rem;
    color: #e2e8f0; /* Better contrast on dark bg */
    margin: 0;
    line-height: 1.5;
}

/* Button removed per user request */
.disconnected-overlay .btn-connect-sm,
.disconnected-overlay .btn-primary {
    display: none !important;
}

/* ------------------------------------------------------------------ */
/* FLOW LIST IMPROVEMENTS */
/* ------------------------------------------------------------------ */

.flow-card-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Toggle Switch (Small) */
.toggle-switch-sm {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

.toggle-slider-sm {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background-color: #1e1e2d; /* Darker off state */
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider-sm:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch-sm input:checked+.toggle-slider-sm {
    background-color: var(--accent-green);
}

.toggle-switch-sm input:focus+.toggle-slider-sm {
    box-shadow: 0 0 1px var(--accent-green);
}

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

/* Rounded Action Buttons */
.btn-flow-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* Circle */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-flow-action:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-flow-action.edit:hover {
    color: var(--accent-blue);
    background: rgba(41, 121, 255, 0.1);
    border-color: rgba(41, 121, 255, 0.2);
}

.btn-flow-action.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Fix Date Picker Styling - Premium Dark Mode */
.date-filter-container {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.date-filter-container:hover {
    border-color: rgba(114, 76, 254, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.date-filter-container i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.date-filter-container input[type="date"] {
    background: transparent;
    color: var(--text-primary);
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    color-scheme: dark;
}

/* Custom Calendar Icon Styling for Webkit */
.date-filter-container input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.date-filter-container input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Fix for Search Bar Layout Overflow - Sort Dropdown */
.msg-search-bar input {
    flex: 1;
    min-width: 0;
    /* Important for shrinking */
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sort-select {
    padding: 9px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background-color: #ffffff;
    /* Fallback */
    background: #f9fafb;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 25px;
    max-width: 120px;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 0;
}

/* ------------------------------------------------------------------ */
/* BACKUP VIEW STYLES - PREMIUM UPGRADE */
/* ------------------------------------------------------------------ */

/* 1. Backup Tabs */
.backup-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 15px;
}

.backup-tab {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.backup-tab:hover {
    background: rgba(13, 165, 133, 0.05);
    color: var(--primary-color);
}

.backup-tab.active {
    background: rgba(13, 165, 133, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(13, 165, 133, 0.15);
}

.backup-tab i {
    font-size: 1.3rem;
}

/* 2. Backup Content Area */
.backup-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* 3. Backup Cards (Main Containers) */
.backup-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.backup-card.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.backup-card.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    background: linear-gradient(145deg, #ffffff, #f9fafb);
}

/* 4. Large Generate Button */
.btn-generate-large {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 18px 40px;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 25px rgba(13, 165, 133, 0.4);
}

.btn-generate-large i {
    font-size: 1.8rem;
}

.btn-generate-large:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(13, 165, 133, 0.5);
    background: var(--primary-hover);
}

.btn-generate-large:active {
    transform: translateY(2px);
}

/* 5. Info Box - Premium Style */
.info-box {
    background: rgba(13, 165, 133, 0.04);
    border: 1px solid rgba(13, 165, 133, 0.1);
    border-left: 5px solid var(--primary-color);
    border-radius: 12px;

    padding: 25px;
    margin-top: 30px;
}

/* 6. Backup Action Cards */
.backup-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.backup-action-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.backup-action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.backup-card-icon {
    width: 60px;
    height: 60px;
    background: rgba(13, 165, 133, 0.1);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 5px;
}

.backup-card-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary-color);
}

.backup-action-card h4 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.backup-action-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    min-height: 40px;
}

.btn-card-action {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.btn-card-action.primary:hover {
    background: var(--primary-hover);
}

.btn-card-action.secondary {
    background: var(--secondary-color);
    color: #fff;
}

.info-box p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.info-header i {
    font-size: 1.2rem;
}

.info-alert {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-alert::before {
    content: '\eb31';
    /* boxicons warning */
    font-family: 'boxicons';
    font-size: 1.4rem;
    color: #ffd700;
}

/* 6. Data Table - Modern & Clean */
.table-container {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.data-table th {
    background: #f8f9fa;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 18px 20px;
    text-align: left;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-light);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

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

/* Actions in table */
.data-table .actions {
    display: flex;
    gap: 10px;
}

/* 7. Dropzone - Improved */
.dropzone {
    border: 2px dashed var(--border-light);
    background: #fafafa;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(13, 165, 133, 0.03);
    transform: scale(1.01);
}

.dropzone p.sub-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Toggle Switch Enhancement overlay */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

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

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.slider:before {
    -webkit-transform: translateX(24px);
    -ms-transform: translateX(24px);
    transform: translateX(24px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}


/* Fix Message Preview Visibility */
.msg-bubble-large {
    background-color: rgba(13, 165, 133, 0.1) !important;
    color: var(--text-primary) !important;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(13, 165, 133, 0.2);
    font-size: 1rem;
    line-height: 1.5;
}

/* Fix Admin Modal Close Icon Position */
.close-modal-icon {
    top: 15px !important;
    right: 15px !important;
    background: rgba(0, 0, 0, 0.05);
    /* Make it a circular button */
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal-icon:hover {
    background: rgba(245, 0, 87, 0.1);
}


/* - - - REVERT TO PREMIUM LIGHT THEME (Flow Editor) - - - */
/* Sidebar - Light */
.flow-sidebar {
    background: #ffffff !important;
    border-right: 1px solid var(--border-light) !important;
}

.flow-sidebar-header,
.flow-instruction,
.nodes-category h3,
.node-item span {
    color: var(--text-primary) !important;
}

.flow-selector {
    color: var(--text-primary) !important;
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid transparent !important;
}

.flow-selector:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

#btn-back-to-list {
    color: var(--text-secondary) !important;
}

#btn-back-to-list:hover {
    color: var(--primary-color) !important;
}

.flow-instruction {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px dashed rgba(0, 0, 0, 0.1) !important;
    color: var(--text-secondary) !important;
}

/* Node Tiles - Light */
.node-item {
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02) !important;
}

.node-item i {
    color: var(--text-secondary) !important;
}

.node-item span {
    color: #334155 !important;
}

.node-item:hover {
    background: #f8fafc !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

/* Canvas - Light */
.flow-canvas {
    background: #f1f5f9 !important;
    /* Slate-100 */
}

.canvas-grid-bg {
    background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px) !important;
    opacity: 0.8 !important;
}

/* Controls - Light */
.zoom-controls {
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.zoom-controls button {
    color: var(--text-secondary) !important;
}

.zoom-controls button:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--primary-color) !important;
}

#btn-discard-flow {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #64748b !important;
    border: 1px solid #cbd5e1 !important;
    backdrop-filter: blur(4px) !important;
}

#btn-discard-flow:hover {
    background: #fff !important;
    color: #0F172A !important;
    border-color: #94a3b8 !important;
}

/* ------------------------------------------------------------- 
   CRM KANBAN 
---------------------------------------------------------------- */
.kanban-board {
    display: flex;
    overflow-x: auto;
    height: calc(100vh - 180px);
    gap: 20px;
    padding: 20px;
    padding-bottom: 25px;
    align-items: stretch;
    /* Columns fill board height */
    background: #e2e8f0;
    /* Darker background to show board boundaries */
    border-radius: 16px;
    cursor: grab;
    user-select: none;
}

.kanban-board.active {
    cursor: grabbing;
    background: #cbd5e1;
    /* Even darker when active */
}

/* Custom Scrollbar for horizontal scrolling */
.kanban-board::-webkit-scrollbar {
    height: 10px;
}

.kanban-board::-webkit-scrollbar-track {
    background: transparent;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.kanban-column {
    min-width: 300px;
    width: 300px;
    background: #f3f4f6;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.kanban-header {
    padding: 15px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.kanban-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background 0.3s, border-color 0.3s;
    border: 2px solid transparent;
    border-radius: 0 0 12px 12px;
}

.kanban-column.drag-over {
    background: rgba(13, 165, 133, 0.12) !important;
    /* Stronger highlight */
    border-color: var(--primary-color);
    border-style: dashed;
    border-width: 2px;
}

.kanban-column.drag-over .kanban-body {
    background: rgba(255, 255, 255, 0.4);
    /* Highlight the body area */
}

/* Card */
.kanban-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.kanban-card.dragging {
    opacity: 0.5;
    /* Visual feedback for original spot */
    transform: scale(1.05) rotate(2deg);
    /* Lifted and tilted effect */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
    z-index: 1000;
}

.kanban-card:active {
    cursor: grabbing;
}

.card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    position: relative;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.btn-duplicate-card:hover {
    color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.1) !important;
    border-radius: 4px;
}

.btn-remove-label:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
    border-radius: 4px;
}

.card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.card-info {
    flex: 1;
    overflow: hidden;
}

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

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

.card-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    line-height: 1.3;
}

/* Unlabelled Column Special Style */
.kanban-column.unlabelled {
    background: #e2e8f0;
    border: 1px dashed #cbd5e1;
}

.kanban-column.unlabelled .kanban-header {
    background: #e2e8f0;
}

/* ------------------------------------------------------------------ */
/* AUTOMATION TIMELINE & DRAG-AND-DROP */
/* ------------------------------------------------------------------ */
.funnel-timeline {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    /* Gap is managed by spine logic */
}

.funnel-item {
    display: flex;

    gap: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    padding-bottom: 8px;
}

.funnel-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.funnel-item.drag-over {
    background: rgba(67, 56, 202, 0.05);
    /* subtle primary color tint */
    border-radius: 16px;
    transform: scale(1.01);
}

.funnel-item.drag-over::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--primary-color);
    z-index: 10;
}

/* Updated Funnel Handle - Centered Square with higher z-index */
.funnel-handle {
    width: 32px;
    height: 32px;
    background: #2e2f45;
    /* Dark background as in screenshot */
    border-radius: 10px;
    /* Slightly more square/rounded but structured */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: grab;
    z-index: 10;
    position: relative;
    /* Sits over the line */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
}

.funnel-handle:hover {
    background: #3f3f5a;
}

/* ------------------------------------------------------------------ */
/* NEW AUTOMATION CARD STYLES (DARK) */
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* NEW AUTOMATION CARD STYLES (PREMIUM DARK) */
/* ------------------------------------------------------------------ */
.zap-card-dark {
    flex: 1;
    background: #1e1e2d;

    border-radius: 16px;
    padding: 8px 16px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.zap-card-dark:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.zap-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);

    padding-bottom: 6px;
    margin-bottom: 6px;
}

.zap-card-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.zap-icon-wrapper {
    position: relative;

    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.zap-card-icon {
    font-size: 1.6rem;
}

/* Dots decoration */
.zap-icon-dots {
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0.2;
}

.zap-dot {
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
}

.zap-card-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #f3f4f6;
    margin-bottom: 4px;
}

.zap-card-meta {
    font-size: 0.8rem;
    color: #94a3b8;
    /* Slate-400 */
    display: flex;
    align-items: center;
    gap: 6px;
}

.zap-card-actions {
    display: flex;
    gap: 8px;
}

.zap-btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    /* Squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
}

.zap-btn-circle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
}

.zap-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.zap-btn-secondary:hover {
    background: rgba(59, 130, 246, 0.15);
    /* Blue tint */
    color: #60a5fa;
}

.zap-btn-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Body Content */
.zap-card-body {
    display: none;
    /* Hidden by default toggled via JS */
    animation: slideDown 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

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

.zap-msg-content {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #8b5cf6;
    /* Purple accent */
    border-radius: 0 8px 8px 0;
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Audio Specifics */
.zap-audio-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #94a3b8;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.zap-audio-setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zap-audio-player {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.play-btn-card {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #06b6d4;
    /* Cyan */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.3);
}

.play-btn-card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(6, 182, 212, 0.4);
}

.play-btn-card:active {
    transform: scale(0.95);
}

.zap-speed-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.zap-speed-badge:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zap-time-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #94a3b8;
    min-width: 45px;
    text-align: center;
}

.zap-progress-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: #06b6d4;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Media Specifics */
.zap-media-preview {
    margin-top: 15px;
    padding: 10px;
    background: #000;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.zap-media-img,
.zap-media-vid {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.zap-media-caption {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    border-left: 2px solid #10b981;
    /* Green accent */
}

/* --- Bulk Selection & Deletion Styles --- */
.selection-toolbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.selection-toolbar.active {
    display: flex;
}

.selection-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-delete-selected {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    display: none;
}

.btn-delete-selected.active {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-delete-selected:hover {
    background: #ef4444;
    color: white;
}

.msg-list-item {
    position: relative;
    padding: 10px 16px 10px 45px !important;
    /* Reduced vertical padding */
}

.item-checkbox-container {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.trigger-card {
    position: relative;
    padding: 10px 16px 10px 55px !important;
    /* Reduced vertical padding */
    margin-bottom: 4px !important;
    /* Reduced margin between cards */
}

.trigger-card .item-checkbox-container {
    left: 32px;
}

/* Label Selector Modal */
.crm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.crm-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.crm-modal-header {
    padding: 18px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crm-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.crm-modal-close {
    font-size: 1.5rem;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.crm-modal-body {
    padding: 20px;
    max-height: 350px;
    overflow-y: auto;
}

.label-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.label-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.label-option:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.label-option i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.label-option-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

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

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

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 800;
    padding: 12px 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    font-size: 1.1rem; /* Increased */
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}



.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #eee;
    gap: 1px;
    border: 11px solid #eee;
    border-radius: 20px;
    background: #ffffff !important;
}

.calendar-day {
    padding: 9px 4px;
    background: #fff;
    min-height: 80px; /* Increased to ensure non-collapse */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    border: 1px solid #eee;
    border-radius: 10px;
}

.calendar-day:hover {
    background: #f8fafc;
}

.calendar-day.other-month {
    background: #f9fafb;
    color: #cbd5e1;
    cursor: default;
}

.calendar-day.today {
    background: #f0fdf4;
}

.calendar-day.today .day-number {
    background: var(--primary-color);
    color: #fff;
    width: 21px;
    height: 21px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
}

.calendar-day.selected {
    background: #f1f5f9;
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

.day-number {
    font-size: 1.4rem; /* Significantly Increased */
    font-weight: 900; /* Bolder */
    color: var(--text-primary);
}



.followup-indicator {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    margin-top: auto;
}

.followup-count-badge {
    font-size: 0.9rem; /* Increased */
    background: #10b911;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    margin-top: 5px;
    font-weight: 900; /* Bolder */
    box-shadow: 0 2px 5px rgba(16, 185, 17, 0.4);
    z-index: 2;
}



/* Follow-up Item Styles */
.followup-item-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s;
    position: relative;
}

.followup-item-card:hover {
    transform: translateY(-2px);

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.followup-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.followup-contact-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.followup-contact-phone {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.followup-reason {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    font-style: italic;
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
}

.followup-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.btn-delete-followup {
    color: #ef4444;
    background: #fee2e2;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-delete-followup:hover {
    background: #fecaca;
    transform: scale(1.05);
}

.btn-whatsapp-followup {
    color: #0DA585;
    background: rgba(13, 165, 133, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    border: 1px solid rgba(13, 165, 133, 0.2);
}

.btn-whatsapp-followup:hover {
    background: rgba(13, 165, 133, 0.2);
    transform: scale(1.05);
    color: #137D52;
}

#btn-updates-nav:hover {

    background: rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-2px);
    color: var(--primary-color) !important;
}

.notification-dot {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {

    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

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

/* ==================================================================
   AGENTE IA DASHBOARD REDESIGN
   ================================================================== */
.ia-dashboard-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 30px;
    gap: 30px;
}

.ia-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ia-dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Toolkits Grid */
.ia-toolkits-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.ia-toolkit-card {
    padding: 20px;
    height: 250px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
}

.ia-toolkit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ia-toolkit-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.btn-add-toolkit {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-toolkit:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.ia-toolkit-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
}

.toolkit-item {
    background: #0aa672;
    border-bottom: 2px solid #107c58;
    border-right: 2px solid #107c58;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.toolkit-item span {
    color: #ffffff;
    font-weight: 500;
}

.toolkit-item i {
    cursor: pointer;
    color: #ff0000;
    opacity: 0.7;
    font-size: 1.1rem;
}

.toolkit-item i:hover {
    opacity: 1;
}

.empty-toolkit {
    margin: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Product Details */
.ia-product-details-container {
    padding: 25px;
    border-radius: 24px;
}

/* Settings Row */
.ia-settings-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
}

.ia-behavior-settings {
    padding: 25px;
    border-radius: 24px;
}

.ia-behavior-settings h4 {
    margin-top: 0;
    margin-bottom: 20px;
}

.form-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.form-group-row label {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Interaction Preview */
.ia-interaction-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ia-preview-card {
    width: 250px;
    padding: 30px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.ia-preview-bot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.preview-bot-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 0, 128, 0.1);
    color: #ff0080;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 10px 20px rgba(255, 0, 128, 0.2);
}

.ia-preview-arrow {
    color: var(--text-muted);
    font-size: 1.5rem;
    animation: bounceDown 2s infinite;
}

@keyframes bounceDown {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(5px);
    }

    60% {
        transform: translateY(3px);
    }
}

.ia-preview-user {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 15px 30px;
    border-radius: 15px;
    font-weight: 600;
}

/* --- AI AGENT EDITOR (PREMIUM OVERHAUL) --- */
.ia-dashboard-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f1f5f9;
    /* Light elegant gray */
    font-family: "Outfit", sans-serif;
}

.ia-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    margin-bottom: 0px;
}

.ia-dashboard-header h2 {
    color: #1e293b;
    font-weight: 700;
}

.btn-ia-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-ia-back:hover {
    background: #f8fafc;
    color: var(--primary-color);
    transform: translateX(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#btn-save-ia-agent {
    background: linear-gradient(135deg, #0DA585 0%, #0b876c 100%);
    box-shadow: 0 4px 15px rgba(13, 165, 133, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

#btn-save-ia-agent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 165, 133, 0.4);
}

.ia-dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.ia-toolkits-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 9px;
}

.ia-toolkit-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    min-height: 450px;
}

.ia-toolkit-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.ia-toolkit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ia-toolkit-header h4 {
    margin: 0;
    color: #334155;
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ia-toolkit-header h4 i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.btn-add-toolkit {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-toolkit:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.ia-toolkit-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 350px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    overflow-y: auto;
}

.empty-toolkit {
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
    margin: auto;
}

/* Product Details textarea */
.ia-product-details-container {
    background: #1e293b;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #334155;
}

.ia-product-details-container h4 {
    color: #f8fafc;
    font-size: 1.15rem;
    font-weight: 600;
}

.ia-product-details-container h4 i {
    color: #38bdf8;
}

#ia-agent-knowledge {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

#ia-agent-knowledge:focus {
    outline: none;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Bottom Settings Row */
.ia-settings-row {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.ia-behavior-settings {
    flex: 1;
    min-width: 300px;
    background: #ffffff;
    border-radius: 20px;
    padding: 25px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ia-behavior-settings h4 {
    color: #334155;
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ia-behavior-settings h4 i {
    color: #8b5cf6;
}

.form-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
}

.form-group-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.form-group-row label {
    font-weight: 500;
    color: #475569;
    font-size: 0.95rem;
}

.form-group-row input[type="number"] {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 12px !important;
    transition: all 0.2s;
}

.form-group-row input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(13, 165, 133, 0.2) !important;
}

.form-group-row span {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Label Filter Selector */
.ia-labels-filter-container {
    flex: 1;
    min-width: 300px;
    background: #ffffff;
    border-radius: 20px;
    padding: 25px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.ia-labels-filter-container h4 {
    color: #334155;
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ia-labels-filter-container h4 i {
    color: #f59e0b;
}

.ia-labels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.ia-label-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.ia-label-item:hover {
    border-color: var(--primary-color);
    background: #f0fdfa;
}

.ia-label-item.selected {
    border-color: var(--primary-color);
    background: #f0fdfa;
    box-shadow: 0 0 0 2px rgba(13, 165, 133, 0.1);
}

.ia-label-item input {
    cursor: pointer;
}

.ia-label-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading-labels {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #94a3b8;
    padding: 20px;
    font-size: 0.9rem;
}

/* --- SELECTION MODAL STYLES --- */
.selection-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0 !important;
    position: relative;
    padding-left: 45px !important;
    background: white !important;
    display: flex;
    align-items: center;
    color: #334155;
}

.selection-item:hover {
    background: #f8fafc !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.selection-item.selected {
    background: #f0fdfa !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(13, 165, 133, 0.1);
}

.selection-item::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    transition: all 0.2s;
}

.selection-item.selected::before {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.selection-item.selected::after {
    content: '✓';
    position: absolute;
    left: 19px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

#selection-modal-search:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(13, 165, 133, 0.1) !important;
    outline: none;
}
/* AI Agent Notification Styles */
.form-group-row-notification {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#ia-agent-notification-number {
    width: 100%;
    padding: 9px;
    border-radius: 8px;
    background: rgb(255 255 255 / 30%);
    border: 2px solid rgb(0 0 0 / 56%);
    color: #000000;
    font-size: 1rem;
    margin-top: 10px;
    text-align: center;
}

/* --- NEW TOOLBAR & CATEGORY DESIGN --- */
.msg-search-bar {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 10px 15px !important;
    margin-bottom: 0px !important;
}

.msg-search-bar input[type="text"] {
    flex: 1;
    border: 1px solid #e9edef;
    border-radius: 10px;
    padding: 12px 16px;
    background: #fff;
    font-size: 0.95rem;
    outline: none !important;
    transition: all 0.2s;
    color: var(--text-primary);
}

.msg-search-bar input[type="text"]:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.btn-filter {
    background: #fff !important;
    color: #111b21 !important;
    border: 2px solid #111b21 !important;
    padding: 8px 16px !important;
    border-radius: 10px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.2s;
    height: 40px;
}

.btn-filter:hover {
    background: #f0f2f5 !important;
}

.btn-add {
    background: var(--primary-color) !important;
    color: #fff !important;
    padding: 8px 20px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    height: 40px;
    white-space: nowrap;
}

.btn-add:hover {
    background: var(--primary-hover) !important;
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.funnel-container {
    display: flex;
    gap: 12px;
    padding: 4px 0 !important;
    overflow-x: auto;
    scrollbar-width: none;
    align-items: center;
    justify-content: center;
}
.funnel-container::-webkit-scrollbar { display: none; }

.funnel-tag {
    background: #f0f2f5;
    color: #54656f;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: none;
}

.funnel-tag:hover {
    background: #e9edef;
}

.funnel-tag.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(0, 168, 132, 0.3);
}

.manage-categories-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
}

.btn-manage-categories {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-manage-categories i {
    font-size: 1rem;
}

.btn-manage-categories:hover {
    text-decoration: underline;
}

/* Custom Dropdown for Filter */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    border-radius: 16px;
    overflow: hidden;
    padding: 8px 0;
}

.dropdown-content.show {
    display: block;
    animation: fadeInScale 0.15s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
    color: #3b4a54;
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    transition: background 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f0f2f5;
}

.dropdown-item.active {
    color: var(--primary-color);
    font-weight: 600;
}



/* Custom Sort Trigger & Dropdown Styles */
.sort-trigger-btn {
    border: 1px solid var(--primary-color) !important;
    background: #ffffff !important;
    color: var(--text-primary) !important;
}

.sort-trigger-btn:hover {
    background: var(--bg-card-hover) !important;
}

.sort-dropdown-container {
    position: relative;
    display: inline-flex;
}

.sort-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 160px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
    padding: 8px 0;
}

.sort-dropdown.active {
    display: block;
    animation: dropdownSlide 0.2s ease-out;
}

.sort-option {
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-option:hover {
    background: var(--bg-card-hover);
    color: var(--primary-color);
}

.sort-option.active {
    color: var(--primary-color);
    font-weight: 600;
    background: rgba(13, 165, 133, 0.05);
}

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

.filter-trigger-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--text-primary);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-trigger-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.filter-trigger-btn i {
    font-size: 1.2rem;
}

/* --- FUNNEL CATEGORY FILTERS (Pill Style) --- */
.funnel-dropdown {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0px 0 0 0;
    position: static;
    box-shadow: none;
    z-index: 10;
}



.funnel-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border: 1px solid transparent;
}

.funnel-tag:hover {
    background: #e2e8f0;
}

.funnel-tag.active {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.funnel-tag-remove {
    display: none;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 10px;
    transition: all 0.2s;
}

.funnel-tag.active .funnel-tag-remove {
    display: inline-flex;
}

.funnel-tag-remove:hover {
    background: rgba(255, 255, 255, 0.4);
}

.funnel-dropdown > div:last-child {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    border-top: none !important;
    margin-top: 0px !important;
}

.funnel-dropdown > div:last-child .btn-text {
    color: var(--primary-color) !important;
    font-weight: 600 !important;
    padding-top: 12px;
    padding-bottom: 7px;
}

/* --- Bulk Selection & Deletion Styles (Ported from AZS) --- */
.selection-toolbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.selection-toolbar.active {
    display: flex;
}

.selection-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-delete-selected {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    display: none;
}

.btn-delete-selected.active {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-delete-selected:hover {
    background: #ef4444;
    color: white;
}

.msg-list-item {
    position: relative;
    padding: 10px 16px 10px 45px !important;
}

.item-checkbox-container {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}
