/* Design Variables & Theme */
:root {
    --bg-app: #f1f5f9;
    --bg-sidebar: #e2e8f0;
    --bg-chat: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.75);
    --bg-bubble-user: #2563eb;
    --bg-bubble-ai: #f1f5f9;
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --accent-light: #3b82f6;
    --border: rgba(37, 99, 235, 0.12);
    --border-hover: rgba(37, 99, 235, 0.24);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --scrollbar-thumb: rgba(37, 99, 235, 0.15);
    --sidebar-width: 300px;
    --drawer-width: 420px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-blur: blur(16px);
    
    /* Adaptable styles */
    --bg-input: #ffffff;
    --bg-card: #ffffff;
    --bg-table-header: #f8fafc;
    --hover-overlay: rgba(0, 0, 0, 0.04);
    --bg-modal: #ffffff;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
    --bg-app: #0b0f19;
    --bg-sidebar: #0f172a;
    --bg-chat: #090d16;
    --bg-glass: rgba(15, 23, 42, 0.65);
    --bg-bubble-user: #2563eb;
    --bg-bubble-ai: #1e293b;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --accent-light: #60a5fa;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    
    /* Adaptable styles */
    --bg-input: rgba(15, 23, 42, 0.6);
    --bg-card: rgba(15, 23, 42, 0.4);
    --bg-table-header: rgba(15, 23, 42, 0.3);
    --hover-overlay: rgba(255, 255, 255, 0.04);
    --bg-modal: #0f172a;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, .logo-text h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Main Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.logo-text h2 {
    font-size: 20px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.sub-logo {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-top: -2px;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-glow);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--accent-light);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 8px;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1px solid transparent;
    group: relative;
}

.session-item:hover {
    background-color: var(--hover-overlay);
    color: var(--text-primary);
}

.session-item.active {
    background-color: var(--accent-glow);
    color: var(--text-primary);
    border-color: var(--border-hover);
    font-weight: 500;
}

.session-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.session-icon {
    color: var(--text-muted);
    font-size: 14px;
}

.session-item.active .session-icon {
    color: var(--accent-light);
}

.session-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-actions {
    display: none;
    align-items: center;
    gap: 6px;
}

.session-item:hover .session-actions {
    display: flex;
}

.session-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.session-action-btn:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.15);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
    display: inline-block;
}

.status-indicator .dot.active {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.system-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
}

/* Chat Container Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat);
    height: 100%;
    position: relative;
}

.chat-header {
    height: 75px;
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    z-index: 5;
}

.chat-header h1 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.session-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

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

.action-btn {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background-color: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.mobile-toggle {
    display: none;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Welcome Screen */
.welcome-screen {
    max-width: 720px;
    margin: 40px auto auto auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--accent-glow);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--accent-light);
    margin-bottom: 24px;
}

.welcome-screen h2 {
    font-size: 28px;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.welcome-screen p {
    color: var(--text-secondary);
    max-width: 540px;
    margin-bottom: 40px;
    font-size: 15px;
    line-height: 1.6;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 680px;
}

.suggestion-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-card:hover {
    background-color: var(--accent-glow);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.suggestion-icon {
    color: var(--accent-light);
    font-size: 16px;
    display: inline-block;
    margin-bottom: 8px;
}

.suggestion-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.suggestion-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Log & Bubbles */
.chat-log {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message-wrapper {
    display: flex;
    gap: 16px;
    width: 100%;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-wrapper.user {
    justify-content: flex-end;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.message-wrapper.user .avatar {
    order: 2;
    background: var(--bg-bubble-user);
}

.message-wrapper.ai .avatar {
    background: var(--bg-bubble-ai);
    border: 1px solid var(--border);
}

.message-bubble {
    max-width: calc(100% - 70px);
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.message-wrapper.user .message-bubble {
    background: var(--bg-bubble-user);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.message-wrapper.ai .message-bubble {
    background: var(--bg-bubble-ai);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

/* Source Citation Trigger Inside Bubble */
.source-citation-bar {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sources-trigger {
    background: var(--accent-glow);
    border: 1px solid var(--border);
    color: var(--accent-light);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sources-trigger:hover {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Typing Indicator Styling */
.typing-indicator {
    align-self: flex-start;
    background: var(--bg-bubble-ai);
    border: 1px solid var(--border);
    padding: 14px 20px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 52px;
    margin-top: -12px;
    width: 60px;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.3s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.3s; }

/* Input Area Styles */
.input-area {
    padding: 0 32px 24px 32px;
    background-color: var(--bg-chat);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.chat-form {
    max-width: 800px;
    width: 100%;
    display: flex;
    align-items: flex-end;
    background-color: var(--bg-glass);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    padding: 8px 8px 8px 16px;
    border-radius: 14px;
    transition: var(--transition);
}

.chat-form:focus-within {
    border-color: var(--border-hover);
    box-shadow: 0 0 15px var(--accent-glow);
}

.input-wrapper {
    flex: 1;
    margin-bottom: 2px;
}

.chat-form textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    padding: 6px 0;
}

.chat-form textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-bubble-user);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px var(--accent-glow);
}

.input-note {
    font-size: 11px;
    color: var(--text-muted);
}

/* Sources Slide-out Panel (Drawer) */
.sources-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--drawer-width);
    height: 100%;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.sources-drawer.open {
    transform: translateX(0);
}

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

.drawer-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-drawer {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.close-drawer:hover {
    color: var(--text-primary);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.source-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-meta {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-light);
    display: flex;
    justify-content: space-between;
}

.source-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
    white-space: pre-wrap;
}

/* Drawer Backdrop Overlay */
.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

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

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

/* Responsive Rules */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
    }

    .chat-header {
        padding: 0 16px;
        height: 60px;
    }

    .chat-header h1 {
        font-size: 15px;
    }

    .session-subtitle {
        font-size: 11px;
    }

    .action-btn span {
        display: none; /* hide text labels, show only icons on mobile */
    }

    .action-btn {
        padding: 8px 10px;
    }

    .messages-area {
        padding: 12px;
    }

    .welcome-screen {
        margin: 16px auto;
        padding: 0 4px;
    }

    .welcome-screen h2 {
        font-size: 20px;
    }

    .welcome-screen p {
        font-size: 13px;
    }

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

    .suggestion-card {
        padding: 12px;
    }

    .suggestion-card h3 {
        font-size: 13px;
    }

    .suggestion-card p {
        font-size: 11px;
    }

    .input-area {
        padding: 0 12px 12px 12px;
    }

    .chat-form {
        gap: 8px;
    }

    #query-input {
        font-size: 14px;
        padding: 10px 14px;
    }

    .sources-drawer {
        width: 100%;
    }

    /* CRM Dashboard Mobile */
    .crm-container {
        overflow-x: hidden;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .stat-card {
        padding: 14px 16px;
    }

    .crm-tabs {
        gap: 6px;
        padding: 0 12px;
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .crm-filter-bar {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
        margin: 0 12px 8px 12px;
    }

    .filter-group {
        min-width: unset;
        width: 100%;
    }

    .btn-clear-filter {
        width: 100%;
        justify-content: center;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-table {
        min-width: 560px; /* force horizontal scroll instead of wrapping */
    }

    .dashboard-table th,
    .dashboard-table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Booking Modal Mobile */
    .booking-modal {
        width: 96%;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 16px;
    }

    .booking-modal-form {
        padding: 16px;
        gap: 12px;
    }

    .booking-modal-header {
        padding: 16px;
    }

    .form-group-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .btn-cancel,
    .btn-submit {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* ElevenLabs widget: smaller, sits bottom-right above phone nav bar */
    #elevenlabs-widget-wrapper {
        bottom: 16px !important;
        right: 16px !important;
        width: 48px !important;
        height: 48px !important;
    }

    #elevenlabs-widget-wrapper elevenlabs-convai {
        width: 48px !important;
        height: 48px !important;
        transform: scale(0.8);
    }
}

/* Prospecting Agent UI Components */
.prospect-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin: 10px 0;
    width: 100%;
    max-width: 680px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: var(--glass-blur);
}

.prospect-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.prospect-card-header i {
    font-size: 18px;
}

.prospect-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.prospect-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition);
}

.prospect-step.pending {
    color: var(--text-muted);
}

.prospect-step.active {
    color: var(--accent-light);
    font-weight: 500;
}

.prospect-step.completed {
    color: #10b981;
}

.prospect-step .step-icon {
    width: 20px;
    display: flex;
    justify-content: center;
    font-size: 14px;
}

.prospect-step.completed .step-icon {
    color: #10b981;
}

.prospect-results {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
    animation: fadeIn 0.3s ease;
}

.prospect-results h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.leads-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-input);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.leads-table th, .leads-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.leads-table th {
    background-color: var(--bg-table-header);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
}

.leads-table td {
    color: var(--text-secondary);
}

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

.leads-table a {
    color: var(--accent-light);
    text-decoration: none;
}

.leads-table a:hover {
    text-decoration: underline;
}

.draft-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.draft-badge.none {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CRM Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--hover-overlay);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    border-color: var(--border-hover);
    color: var(--accent-light);
}

/* Main Content Panel */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: 100%;
}

/* CRM Container & Content */
.crm-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-app);
    height: 100%;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.crm-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Stats Row & Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-glow);
    color: var(--accent-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

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

.stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* CRM Tabs */
.crm-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: -1px;
}

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

.tab-btn.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

/* CRM Dashboard Tables */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.dashboard-table th, .dashboard-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.dashboard-table th {
    background: var(--bg-table-header);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-table td {
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-table a {
    color: var(--accent-light);
    text-decoration: none;
}

.dashboard-table a:hover {
    text-decoration: underline;
}

.dashboard-table tr:hover td {
    background: var(--hover-overlay);
}

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

.actions-header {
    text-align: right;
}

.dashboard-table td:last-child {
    text-align: right;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
}

/* CRM Actions Buttons & Badges */
.btn-action-schedule {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action-schedule:hover {
    background: #10b981;
    color: white;
}

.btn-action-draft {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #3b82f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action-draft:hover {
    background: #3b82f6;
    color: white;
}

.btn-action-delete {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 6px;
}

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

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-badge.done {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Booking Scheduling Dialog Modal */
.booking-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s;
}

.booking-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.booking-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 540px;
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 16px;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s;
    overflow: hidden;
}

.booking-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.booking-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.booking-modal-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

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

.booking-modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--border-hover);
    box-shadow: 0 0 10px var(--accent-glow);
}

.form-input.read-only {
    background: var(--bg-app);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-group-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.btn-submit {
    background: var(--bg-bubble-user);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px var(--accent-glow);
}

@media (max-width: 992px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .form-group-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* CRM Filter Bar */
.crm-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
    flex: 1;
}

.filter-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-clear-filter {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
}

.btn-clear-filter:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

/* ================================================
   ElevenLabs Voice Widget
   - Default floating orb is hidden
   - Our sidebar "Voice Agent" button is the only trigger
   ================================================ */

/* Hide the widget's default floating button entirely */
#elevenlabs-convai-widget {
    position: fixed !important;
    bottom: -999px !important;   /* push off-screen */
    right: -999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important; /* allow dialog to expand normally */
    pointer-events: auto !important;
    z-index: 9998;
}

/* Voice Agent sidebar nav button styling */
#nav-voice-agent {
    position: relative;
}

#nav-voice-agent i {
    color: #10b981;
}

/* Pulsing green live dot */
@keyframes mic-pulse {
    0%, 100% { opacity: 1;  transform: scale(1);   }
    50%       { opacity: 0.5; transform: scale(1.4); }
}

#nav-voice-agent::after {
    content: "";
    position: absolute;
    top: 10px;
    right: 12px;
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    animation: mic-pulse 2s ease-in-out infinite;
}
