/* Modern CSS Reset & Vars */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #121829;
    --bg-glass: rgba(18, 24, 41, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(249, 115, 22, 0.15);
    
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --color-cyan: #f97316;     /* Orange primary */
    --color-blue: #ea580c;     /* Darker orange secondary */
    --color-green: #10b981;
    --color-yellow: #f59e0b;
    --color-red: #ef4444;
    --color-purple: #8b5cf6;
    
    --glow-cyan: 0 0 20px rgba(249, 115, 22, 0.4);
    --glow-green: 0 0 20px rgba(16, 105, 129, 0.4);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Glassmorphism utility */
.glass-effect {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-premium);
}

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

@keyframes slideUp {
    from { transform: translate(-50%, -40%) scale(0.95); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}
.stat-card.animate-fade-in:nth-child(1) { animation-delay: 0.05s; }
.stat-card.animate-fade-in:nth-child(2) { animation-delay: 0.1s; }
.stat-card.animate-fade-in:nth-child(3) { animation-delay: 0.15s; }
.stat-card.animate-fade-in:nth-child(4) { animation-delay: 0.2s; }

/* Helpers */
.hidden { display: none !important; }
.text-cyan { color: var(--color-cyan); }
.text-green { color: var(--color-green); }
.text-yellow { color: var(--color-yellow); }
.text-red { color: var(--color-red); }
.text-purple { color: var(--color-purple); }

.cyan-bg { background: rgba(249, 115, 22, 0.1); }
.green-bg { background: rgba(16, 185, 129, 0.1); }
.yellow-bg { background: rgba(245, 158, 11, 0.1); }
.purple-bg { background: rgba(139, 92, 246, 0.1); }

/* Badges */
.badge {
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.user-role-badge {
    background: var(--color-cyan);
    color: white;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}
.count-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    vertical-align: middle;
}
.red-badge { background-color: var(--color-red); color: white; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.primary-btn {
    background: var(--color-cyan);
    color: white;
}
.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: none;
}
.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass);
    color: var(--text-primary);
}
.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.btn-full { width: 100%; }
.glow-btn {
    position: relative;
    overflow: hidden;
}
.glow-btn::after {
    display: none;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    width: 90%;
    max-width: 450px;
    padding: 30px;
    border-radius: 16px;
    position: relative;
}
.auth-modal .modal-content {
    border: 1px solid var(--color-cyan);
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.15);
}
.modal.active .modal-content.animate-slide-up {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Auth specific style */
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}
.logo-icon {
    width: 28px;
    height: 28px;
}
.glow-cyan { filter: drop-shadow(0 0 8px var(--color-cyan)); }
.accent-text {
    color: var(--color-cyan);
}
.auth-header h2 {
    font-size: 1.25rem;
    margin-bottom: 6px;
}
.auth-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}
.input-group {
    margin-bottom: 18px;
}
.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper i {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}
.input-wrapper input, .glass-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 12px 10px 40px;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.glass-input {
    padding-left: 14px;
}
.input-wrapper input:focus, .glass-input:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.08);
}
.error-message {
    color: var(--color-red);
    font-size: 0.8rem;
    margin-bottom: 12px;
    text-align: center;
}

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

.main-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100%;
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    z-index: 10;
}
.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-header .logo {
    justify-content: flex-start;
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.04);
}
.nav-item.active {
    color: var(--color-cyan);
    background: rgba(249, 115, 22, 0.08);
    border-left: 3px solid var(--color-cyan);
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-cyan);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.user-details {
    display: flex;
    flex-direction: column;
}
.user-details .username {
    font-size: 0.85rem;
    font-weight: 600;
}
.user-details .role-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.logout-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.logout-btn:hover {
    color: var(--color-red);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: none;
}
.logout-btn i {
    width: 18px;
    height: 18px;
}

/* Content Area */
.content-area {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}
.content-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.current-time {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
}
.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-content {
    display: none;
    height: 100%;
}
.tab-content.active {
    display: block;
}

/* Overview Tab Specific Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    padding: 20px;
    border-radius: 12px;
    transition: all 0.3s;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-cyan);
}
.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.stat-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon-wrapper i {
    width: 20px;
    height: 20px;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.stat-footer {
    font-size: 0.75rem;
}

.dashboard-content-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    min-height: 350px;
}
.panel {
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
}
.view-all-link {
    color: var(--color-cyan);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}
.view-all-link:hover {
    text-decoration: underline;
}
.panel-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}
.empty-state {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 40px 0;
}

/* Chat Workspace Tab Specific Layout */
.chat-workspace {
    display: flex;
    height: calc(100vh - 150px);
    gap: 20px;
}
.chat-sessions-sidebar {
    width: 320px;
    flex-shrink: 0;
    height: 100%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sessions-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
}
.sessions-sidebar-header h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}
.session-filters {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    padding: 3px;
    border-radius: 6px;
}
.session-filters .filter-btn, .signals-filters .filter-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.session-filters .filter-btn.active, .signals-filters .filter-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-cyan);
}
.sessions-list {
    flex: 1;
    overflow-y: auto;
}
.session-item {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all 0.2s;
}
.session-item:hover {
    background: rgba(255, 255, 255, 0.02);
}
.session-item.active {
    background: rgba(249, 115, 22, 0.04);
    border-left: 3px solid var(--color-cyan);
}
.session-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.session-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}
.session-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.session-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}
.session-role-indicator {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}
.session-lead-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.escalated-badge {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.sessions-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-glass);
}

/* Chat Window */
.chat-window {
    flex: 1;
    height: 100%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-window-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.active-chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.active-chat-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
}
.active-chat-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.chat-actions {
    display: flex;
    gap: 8px;
}
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}
.welcome-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}
.chat-welcome h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.chat-welcome p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 400px;
}
.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.msg-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}
.msg-bubble.user-msg {
    align-self: flex-end;
    background: var(--color-blue);
    color: white;
    border-bottom-right-radius: 2px;
}
.msg-bubble.ai-msg {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass);
}
.chat-input-area form {
    display: flex;
    gap: 10px;
}
.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}
.chat-input-area input:focus {
    outline: none;
    border-color: var(--color-cyan);
}
.chat-send-btn {
    background: var(--color-cyan);
    color: #000;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

/* CRM Leads Tab Specific */
.crm-container {
    border-radius: 12px;
    overflow: hidden;
}
.crm-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.crm-stats {
    display: flex;
    gap: 16px;
}
.crm-stat {
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 6px;
}
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}
.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}
.crm-table th, .crm-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-glass);
}
.crm-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.01);
}
.crm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}
.lead-status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}
.lead-status-new { background: rgba(249, 115, 22, 0.15); color: var(--color-cyan); }
.lead-status-contacted { background: rgba(245, 158, 11, 0.15); color: var(--color-yellow); }
.lead-status-won { background: rgba(16, 185, 129, 0.15); color: var(--color-green); }
.lead-status-lost { background: rgba(239, 68, 68, 0.15); color: var(--color-red); }

/* Document KB Tab Specific */
.kb-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
}
.file-drop-area {
    border: 2px dashed var(--border-glass);
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.file-drop-area:hover, .file-drop-area.dragover {
    border-color: var(--color-cyan);
    background: rgba(249, 115, 22, 0.02);
}
.upload-icon {
    width: 44px;
    height: 44px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.file-drop-area p {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.file-info-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.file-selected-name {
    font-size: 0.8rem;
    color: var(--color-cyan);
    margin-bottom: 12px;
    text-align: center;
    font-weight: 500;
}
.upload-status {
    font-size: 0.8rem;
    margin-bottom: 12px;
    text-align: center;
}
.category-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    padding: 3px;
    border-radius: 6px;
}
.category-tabs .cat-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.category-tabs .cat-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-cyan);
}
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
}
.doc-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.doc-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.doc-details h4 {
    font-size: 0.85rem;
    font-weight: 500;
}
.doc-details span {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.doc-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
.doc-delete-btn:hover {
    color: var(--color-red);
    background: rgba(239, 68, 68, 0.1);
}

/* Signals Tab Specific */
.signals-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.signals-header-bar h3 { font-size: 1.1rem; margin-bottom: 4px; }
.signals-header-bar p { font-size: 0.85rem; color: var(--text-muted); }
.signals-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.signals-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.signal-card {
    padding: 20px;
    border-radius: 12px;
    display: flex;
    gap: 16px;
    transition: all 0.3s;
}
.signal-card.level-critical {
    border-left: 4px solid var(--color-red);
    background: rgba(239, 68, 68, 0.04);
}
.signal-card.level-warning {
    border-left: 4px solid var(--color-yellow);
    background: rgba(245, 158, 11, 0.04);
}
.signal-card.level-info {
    border-left: 4px solid var(--color-cyan);
    background: rgba(249, 115, 22, 0.03);
}
.signal-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.signal-content {
    flex: 1;
}
.signal-title-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}
.signal-title-row h4 {
    font-size: 0.95rem;
    font-weight: 600;
}
.signal-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.signal-message {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.signal-action-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-glass);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.signal-action-box strong {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.signal-action-box p {
    font-size: 0.8rem;
    color: #cbd5e1;
}
.signal-actions-buttons {
    display: flex;
    gap: 8px;
}

/* Modal styling for inputs */
.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.15rem; }

/* Emulator widget toggler */
.widget-preview-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99;
    padding: 12px 18px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    border-color: var(--color-cyan);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.15);
}
.widget-preview-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
}

.widget-emulator-container {
    position: fixed;
    top: 5vh;
    left: 5vw;
    width: 90vw;
    height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.6);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.widget-emulator-header {
    padding: 12px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}
.widget-emulator-header button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}
.widget-emulator-frame-wrapper {
    flex: 1;
    position: relative;
    display: flex;
}
.mock-website {
    flex: 1;
    background: #0f172a;
    padding: 40px;
    display: flex;
    flex-direction: column;
}
.mock-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 40px;
}
.mock-logo { font-size: 1.3rem; font-weight: 700; color: white;}
.mock-links span { margin-left: 20px; color: #94a3b8; font-size: 0.85rem; cursor: pointer; }
.mock-hero {
    max-width: 500px;
    margin-top: 100px;
}
.mock-hero h1 { font-size: 2.5rem; color: white; margin-bottom: 16px; }
.mock-hero p { color: #94a3b8; margin-bottom: 24px; font-size: 0.95rem; line-height: 1.5; }
.mock-btn { background: var(--color-blue); color: white; border: none; padding: 12px 24px; border-radius: 6px; font-size: 0.9rem; cursor: pointer; }

.widget-iframe {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

/* Translation UI Styles */
.btn-translate-bubble {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
}

.btn-translate-bubble:hover {
    color: var(--color-cyan);
    background: rgba(255, 255, 255, 0.08);
    opacity: 1;
    transform: scale(1.1);
}

.btn-translate-bubble:active {
    transform: scale(0.95);
}

.msg-translation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: var(--color-cyan);
    font-style: italic;
    line-height: 1.4;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.2);
    animation: fadeIn 0.3s ease-out;
}

/* --- UI Refactoring Custom Helper Utilities --- */

/* Animation Delay Helpers */
.delay-1 { animation-delay: 0.05s !important; }
.delay-2 { animation-delay: 0.1s !important; }
.delay-3 { animation-delay: 0.15s !important; }
.delay-4 { animation-delay: 0.2s !important; }
.delay-5 { animation-delay: 0.25s !important; }
.delay-6 { animation-delay: 0.3s !important; }

/* Margin & Padding Utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-16 { margin-top: 16px !important; }
.p-0 { padding: 0 !important; }

/* Height Sizing Utilities */
.h-110 { height: 110px !important; }
.h-160 { height: 160px !important; }
.h-450 { height: 450px !important; }
.max-h-480 { max-height: 480px !important; overflow-y: auto !important; }

/* Flexbox utilities */
.d-flex { display: flex !important; }
.flex-col { display: flex !important; flex-direction: column !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-4 { gap: 4px !important; }
.gap-6 { gap: 6px !important; }
.gap-8 { gap: 8px !important; }
.gap-12 { gap: 12px !important; }
.gap-20 { gap: 20px !important; }

/* Button Sizes */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
}
.btn-xs {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
}

/* Console Box / Text Viewer */
.console-box {
    font-family: monospace !important;
    white-space: pre-wrap !important;
    overflow-y: auto !important;
    text-align: left !important;
    direction: ltr !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.02) !important;
    padding: 12px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-glass) !important;
    color: #cbd5e1 !important;
}

/* Icon size helpers */
.icon-xs {
    width: 12px !important;
    height: 12px !important;
}
.icon-sm {
    width: 16px !important;
    height: 16px !important;
}

/* Element Specific Custom Sizing */
.max-w-320 {
    max-width: 320px !important;
}
.d-block {
    display: block !important;
}
.rtl {
    direction: rtl !important;
    text-align: right !important;
}
.cursor-pointer {
    cursor: pointer !important;
}

/* Message Bubble Header & Metadata */
.msg-bubble-meta {
    font-weight: 500 !important;
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    margin-bottom: 4px !important;
}
.msg-bubble-header {
    font-weight: 500 !important;
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    margin-bottom: 4px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Lead & Transaction helpers */
.lead-notes-preview {
    font-size: 0.8rem !important;
    color: #cbd5e1 !important;
    max-width: 250px !important;
}
.lead-status-select, .select-status {
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
    width: 110px !important;
}
.tx-meta {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
}
.wa-msg-cell {
    max-width: 400px !important;
    font-size: 0.85rem !important;
    color: #e2e8f0 !important;
    line-height: 1.4 !important;
}

/* Layout Custom helpers */
.finance-layout {
    display: grid !important;
    grid-template-columns: 320px 1fr !important;
    gap: 20px !important;
}
.modal-lg {
    max-width: 700px !important;
}
.system-wrapper {
    align-self: center !important;
    max-width: 90% !important;
}

/* New Horizontal Layout & Page Layouts */
.top-header {
    height: 100vh;
    width: 240px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 24px 16px;
    border-bottom: none;
    border-right: 1px solid var(--border-glass);
    z-index: 100;
    box-sizing: border-box;
}

.top-header .logo {
    margin-bottom: 24px;
    padding-left: 8px;
}

.horizontal-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    flex: 1;
    margin-top: 12px;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.nav-tab i {
    width: 18px;
    height: 18px;
}

.nav-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
    color: var(--color-cyan);
    background: rgba(249, 115, 22, 0.08);
    box-shadow: none;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.header-right {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
    gap: 10px;
}

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

.main-layout {
    display: flex;
    flex-direction: row !important;
    width: 100%;
    height: 100vh;
}

.main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
}

.page-content {
    display: none;
    height: 100%;
    width: 100%;
    padding: 24px;
}

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

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: 100%;
    overflow: hidden;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

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

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.mb-16 {
    margin-bottom: 16px;
}

.p-0 {
    padding: 0 !important;
}

.border-none {
    border: none !important;
}

.p-12 {
    padding: 12px !important;
}

/* Console Log Body */
.console-log-body {
    background: #030712 !important;
    border: 1px solid #1f2937 !important;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 0.85rem !important;
    color: #00ffcc !important;
    text-shadow: 0 0 2px #00ffcc;
    overflow-y: auto !important;
    padding: 16px !important;
    line-height: 1.6 !important;
}

.console-log-line {
    margin-bottom: 8px;
    word-break: break-word;
    border-bottom: 1px dashed rgba(0, 255, 204, 0.1);
    padding-bottom: 6px;
}

.console-time {
    color: #9ca3af;
    margin-right: 8px;
    font-weight: bold;
}

.console-session {
    color: #f59e0b;
    margin-right: 8px;
    font-weight: bold;
}

.console-system {
    color: #a78bfa;
    font-weight: bold;
}

.console-file-log {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.console-voice-log {
    color: #ec4899;
    background: rgba(236, 72, 153, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

/* Live indicator */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid var(--border-glass);
}

.live-indicator .dot {
    font-size: 0.9rem;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Sub-tabs styles */
.sub-tabs-bar {
    display: flex;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-glass);
}

.sub-tab {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.sub-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.02);
}

.sub-tab.active {
    color: var(--color-cyan);
    border-bottom-color: var(--color-cyan);
    background: rgba(255, 255, 255, 0.04);
}

.subtab-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

.subtab-content.active {
    display: flex;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
}

.description-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 70%;
}

/* CRUD Items */
.crud-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
}

.crud-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crud-item:hover {
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.crud-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-cyan);
}

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

.crud-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}

#instructions-list-container .crud-text,
#services-list-container .crud-text {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#instructions-list-container .crud-item.expanded .crud-text,
#services-list-container .crud-item.expanded .crud-text {
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-glass);
}

.accordion-chevron {
    transition: transform 0.2s;
}

.crud-item.expanded .accordion-chevron {
    transform: rotate(90deg);
    color: var(--color-cyan);
}

.crud-variations {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 6px;
    border-left: 3px solid var(--color-blue);
    margin-top: 4px;
}

.textarea-input {
    resize: vertical;
}

.h-100 { height: 100px !important; }
.h-150 { height: 150px !important; }
.h-200 { height: 200px !important; }

/* Omnichannel Filters */
.messenger-filter-bar {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-glass);
    padding: 8px;
    gap: 6px;
}

.msg-filter-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.msg-filter-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: white;
}

.msg-filter-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass);
    font-weight: 600;
}

.msg-filter-btn.active.text-green {
    color: var(--color-green) !important;
    border-color: rgba(16, 185, 129, 0.2);
}

.msg-filter-btn.active.text-purple {
    color: var(--color-purple) !important;
    border-color: rgba(139, 92, 246, 0.2);
}

.msg-filter-btn.active.text-blue {
    color: var(--color-blue) !important;
    border-color: rgba(79, 70, 229, 0.2);
}

.lead-channel-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}

.lead-channel-whatsapp { color: var(--color-green); }
.lead-channel-instagram { color: var(--color-purple); }
.lead-channel-facebook { color: var(--color-blue); }

.file-download-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(56, 189, 248, 0.15) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    color: #e0f2fe !important;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 6px;
    text-decoration: none;
}

.file-download-bubble:hover {
    background: rgba(56, 189, 248, 0.25) !important;
}

.voice-transcription-tag {
    font-size: 0.75rem;
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #fce7f3;
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 4px;
    font-style: italic;
}


/* --- AI Action Log Console Custom Styles --- */
.console-action-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 6px;
}
.badge-type-message_received { background: rgba(16, 185, 129, 0.15); color: var(--color-green); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-type-message_analysis { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-type-faq_match { background: rgba(245, 158, 11, 0.15); color: var(--color-yellow); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-type-voice_transcription { background: rgba(236, 72, 153, 0.15); color: #ec4899; border: 1px solid rgba(236, 72, 153, 0.3); }
.badge-type-media_download { background: rgba(99, 102, 241, 0.15); color: #6366f1; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-type-gemini_call { background: rgba(139, 92, 246, 0.15); color: var(--color-purple); border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-type-google_search { background: rgba(56, 189, 248, 0.15); color: var(--color-cyan); border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-type-lead_update { background: rgba(249, 115, 22, 0.15); color: var(--color-cyan); border: 1px solid rgba(249, 115, 22, 0.3); }

.action-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}
.action-status-dot.status-success { background-color: var(--color-green); box-shadow: 0 0 8px var(--color-green); }
.action-status-dot.status-info { background-color: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.action-status-dot.status-warning { background-color: var(--color-yellow); box-shadow: 0 0 8px var(--color-yellow); }
.action-status-dot.status-error { background-color: var(--color-red); box-shadow: 0 0 8px var(--color-red); }
.action-status-dot.status-progress { 
    background-color: var(--color-cyan); 
    box-shadow: 0 0 8px var(--color-cyan);
    animation: pulseGlow 1.2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

.console-log-line {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    transition: background-color 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex-wrap: wrap;
}
.console-log-line:hover {
    background: rgba(255, 255, 255, 0.01);
}

.console-time {
    color: var(--text-muted);
    margin-right: 4px;
}

.console-session {
    color: #38bdf8;
    margin-right: 4px;
}

/* --- Leads Page & Grid Layout --- */
.leads-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.leads-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.leads-filters-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.leads-filters-bar .filter-group.search-group {
    flex: 1;
    min-width: 220px;
}

.leads-filters-bar label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.glass-input-sm {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 8px 10px 8px 36px;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.glass-input-sm:focus {
    outline: none;
    border-color: var(--color-cyan);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.glass-select-sm {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 8px 10px;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.glass-select-sm:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: none;
}

.glass-select-sm option {
    background-color: var(--bg-secondary);
    color: white;
}

.leads-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    align-items: start;
    gap: 20px;
    overflow-y: auto;
    padding: 4px 4px 40px 4px;
}

/* --- Lead Card Layout --- */
.lead-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.lead-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--color-blue);
}

.lead-card.card-status-new::after { background: var(--color-cyan); }
.lead-card.card-status-contacted::after { background: var(--color-yellow); }
.lead-card.card-status-won::after { background: var(--color-green); }
.lead-card.card-status-lost::after { background: var(--color-red); }

.lead-card:hover {
    transform: translateY(-4px);
    border-color: rgba(249, 115, 22, 0.3);
    box-shadow: 0 12px 24px -10px rgba(249, 115, 22, 0.15), var(--shadow-premium);
}

.lead-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.lead-card-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.lead-card-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.lead-card-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.lead-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 12px 0;
}

.lead-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    line-height: 1.4;
}

.lead-detail-label {
    color: var(--text-muted);
}

.lead-detail-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-card-notes {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(255, 255, 255, 0.01);
    padding: 8px;
    border-radius: 6px;
    border-left: 2px solid var(--border-glass);
    max-height: 80px;
    overflow-y: auto;
}

.lead-card-footer {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.lead-card-footer .btn {
    flex: 1;
    font-size: 0.78rem;
    padding: 8px 12px;
}

/* Character Tags */
.char-tag-good { color: var(--color-green); background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); border-radius: 4px; padding: 1px 4px; }
.char-tag-bad { color: var(--color-yellow); background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); border-radius: 4px; padding: 1px 4px; }
.char-tag-stop { color: var(--color-red); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 4px; padding: 1px 4px; }

/* Status Badges */
.lead-status-new { background: rgba(249, 115, 22, 0.15) !important; color: var(--color-cyan) !important; border: 1px solid rgba(249, 115, 22, 0.3) !important; }
.lead-status-contacted { background: rgba(245, 158, 11, 0.15) !important; color: var(--color-yellow) !important; border: 1px solid rgba(245, 158, 11, 0.3) !important; }
.lead-status-won { background: rgba(16, 185, 129, 0.15) !important; color: var(--color-green) !important; border: 1px solid rgba(16, 185, 129, 0.3) !important; }
.lead-status-lost { background: rgba(239, 68, 68, 0.15) !important; color: var(--color-red) !important; border: 1px solid rgba(239, 68, 68, 0.3) !important; }

/* --- Lead Modal Form Elements --- */
.lead-modal-content {
    max-width: 600px !important;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.glass-input-modal, .glass-select-modal {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 14px;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.glass-input-modal:focus, .glass-select-modal:focus {
    outline: none;
    border-color: var(--color-cyan);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
}

.glass-select-modal option {
    background: var(--bg-secondary);
    color: white;
}


/* Settings Page Styling */
.waha-session-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.waha-session-card:hover {
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.session-status-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-waha-connected { background: rgba(16, 185, 129, 0.15); color: var(--color-green); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-waha-scan_qr { background: rgba(245, 158, 11, 0.15); color: var(--color-yellow); border: 1px solid rgba(245, 158, 11, 0.3); }
.status-waha-stopped { background: rgba(239, 68, 68, 0.15); color: var(--color-red); border: 1px solid rgba(239, 68, 68, 0.3); }
.status-waha-unknown { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); border: 1px solid var(--border-glass); }

.qr-code-img {
    width: 240px;
    height: 240px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Analytics Distribution Bars */
.analytics-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.analytics-bar-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.analytics-bar-track {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease-out;
}

/* Audio Messages Playback */
.voice-player-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.voice-audio-element {
    height: 32px;
    outline: none;
    max-width: 220px;
}

/* AI Active channel badge styling */
.lead-channel-ai {
    color: var(--color-cyan) !important;
}

/* Switch styling for AI Active toggle */
.switch-container input[type="checkbox"] {
    position: relative;
    width: 32px;
    height: 18px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    border-radius: 9px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    transition: 0.3s;
    border: 1px solid var(--border-glass);
}
.switch-container input[type="checkbox"]:checked {
    background: var(--color-cyan);
}
.switch-container input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    top: 1px;
    left: 1px;
    background: white;
    transition: 0.3s;
}
.switch-container input[type="checkbox"]:checked::before {
    left: 15px;
}

.h-80 {
    height: 80px !important;
}


/* Slide-out Sidebar Right */
.chat-sidebar-right {
    width: 300px;
    height: 100%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(16px);
}
.chat-sidebar-right.hidden {
    display: none;
}
.sidebar-right-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-right-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}
.sidebar-right-header .close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.sidebar-right-header .close-btn:hover {
    color: var(--color-red);
}
.sidebar-right-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.info-section {
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 16px;
    margin-bottom: 16px;
}
.info-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}
.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-cyan);
    margin-bottom: 12px;
    font-weight: 700;
}
.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}
.info-label {
    color: var(--text-muted);
}
.info-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notes-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
    border-radius: 6px;
    margin-top: 6px;
    white-space: pre-wrap;
    max-height: 80px;
    overflow-y: auto;
}
.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
    transition: all 0.2s;
}
.file-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.file-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 200px;
}
.file-item-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.file-item-action {
    color: var(--color-cyan);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.file-item-action:hover {
    color: var(--color-blue);
    transform: scale(1.1);
}

/* Chat Attachment Button */
.chat-attach-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 6px;
}
.chat-attach-btn:hover {
    color: var(--color-cyan);
    background: rgba(255, 255, 255, 0.05);
}

/* Documents page styles */
#docs-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-content: start;
}
.doc-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;
    transition: all 0.2s;
    min-height: 165px;
    height: auto;
    box-sizing: border-box;
}
.doc-card:hover {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}
.doc-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    min-width: 0;
}
.doc-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.doc-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.doc-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}
.doc-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.doc-btn-view:hover {
    color: var(--color-cyan);
    background: rgba(249, 115, 22, 0.1);
}
.doc-btn-delete:hover {
    color: var(--color-red);
    background: rgba(239, 68, 68, 0.1);
}

/* Sidebar and settings styling additions */
.nav-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
}

.nav-tab.logout-btn-item {
    color: #ef4444;
}

.nav-tab.logout-btn-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* Settings sub-tabs and section styles */
.settings-sub-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    margin-left: auto;
}

.settings-sub-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.settings-sub-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
}

.settings-sub-tab.active {
    color: var(--color-cyan);
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.settings-section {
    display: none;
    width: 100%;
}

.settings-section.active {
    display: block;
}

.settings-section.hidden {
    display: none;
}

/* Collapsible Sidebar styles */
.top-header {
    transition: width 0.3s ease, padding 0.3s ease;
}

.top-header.collapsed {
    width: 70px;
    padding: 24px 8px;
}

.top-header.collapsed .nav-section-title {
    display: none !important;
}

.top-header.collapsed .nav-tab span {
    display: none !important;
}

.top-header.collapsed .nav-tab {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.top-header.collapsed .logo-full {
    display: none !important;
}

.top-header.collapsed .logo-compact {
    display: block !important;
}

.top-header.collapsed #sidebar-collapse-btn {
    margin: 0 auto;
}

/* Mobile responsive elements styles */
.mobile-top-bar {
    display: none;
    height: 60px;
    background: rgba(18, 18, 18, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
}

.mobile-top-bar #mobile-hamburger-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-cyan);
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    height: 65px;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

/* Override bottom-nav tabs display for mobile bar */
.mobile-bottom-nav .nav-tab {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 8px 0;
    width: 30%;
    color: var(--text-muted);
    cursor: pointer;
}

.mobile-bottom-nav .nav-tab i {
    width: 20px;
    height: 20px;
}

.mobile-bottom-nav .nav-tab.active {
    background: transparent;
    border: none;
    color: var(--color-cyan);
    box-shadow: none;
}

/* Slide-out drawer menu */
.mobile-hamburger-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    z-index: 1001;
    transition: left 0.3s ease;
    box-sizing: border-box;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-hamburger-drawer.open {
    left: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 12px;
}

.drawer-header span {
    font-weight: 600;
    color: var(--color-cyan);
}

.drawer-header #close-drawer-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.drawer-overlay.active {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .top-header {
        display: none !important;
    }
    
    .mobile-top-bar {
        display: flex;
    }
    
    .mobile-bottom-nav {
        display: flex;
    }
    
    .main-layout {
        flex-direction: column !important;
        height: auto;
    }
    
    .main-content {
        height: calc(100vh - 60px);
        padding-bottom: 90px; /* Space for floating bottom-nav */
        overflow-y: auto;
    }
    
    /* Ensure content pages adjust to full width */
    .dashboard-content-split {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    /* Mobile Chat View layout */
    .chat-workspace {
        position: relative !important;
        overflow: hidden !important;
        height: calc(100vh - 170px) !important;
        width: 100% !important;
        display: block !important;
    }
    
    .chat-sessions-sidebar {
        position: absolute !important;
        top: 0 !important;
        left: -105% !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 50 !important;
        background: rgba(18, 18, 18, 0.98) !important;
        backdrop-filter: blur(25px) !important;
        transition: left 0.3s ease !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }
    
    .chat-workspace.show-sidebar .chat-sessions-sidebar {
        left: 0 !important;
    }
    
    .chat-window {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 0 !important;
    }
    
    .chat-sidebar-right {
        position: absolute !important;
        top: 0 !important;
        right: -105% !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 60 !important;
        background: rgba(18, 18, 18, 0.98) !important;
        backdrop-filter: blur(25px) !important;
        transition: right 0.3s ease !important;
        border-radius: 0 !important;
    }
    
    .chat-sidebar-right.active, .chat-sidebar-right:not(.hidden) {
        right: 0 !important;
        display: flex !important;
    }

    .mobile-only {
        display: inline-flex !important;
    }
}

/* Document & Spreadsheet Previews styling */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    text-align: left;
}
.preview-table th {
    background: rgba(6, 182, 212, 0.15); /* cyan theme matching */
    color: var(--color-cyan);
    padding: 10px 12px;
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}
.preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.preview-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.sheet-preview-container {
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.15);
}
.sheet-preview-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.pdf-reader-view, .docx-reader-view {
    background: rgba(0, 0, 0, 0.25);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

.pdf-paragraph, .docx-paragraph {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 14px;
    text-align: justify;
}

.docx-heading {
    font-size: 1.15rem;
    color: var(--color-cyan);
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.3); opacity: 0.4; }
    40% { transform: scale(1.0); opacity: 1; }
}

.typing-dot {
    animation: bounce 1.3s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

/* Spinner Animation & Monospace Code Blocks for Capabilities Panel */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-cyan);
    animation: spin 1s linear infinite;
}

#client-tools-list pre::-webkit-scrollbar,
#internal-tools-list pre::-webkit-scrollbar,
.crud-text::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

#client-tools-list pre::-webkit-scrollbar-thumb,
#internal-tools-list pre::-webkit-scrollbar-thumb,
.crud-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#client-tools-list pre::-webkit-scrollbar-thumb:hover,
#internal-tools-list pre::-webkit-scrollbar-thumb:hover,
.crud-text::-webkit-scrollbar-thumb:hover {
    background: rgba(165, 243, 252, 0.3);
}

.tool-function-block pre {
    border-left: 3px solid var(--color-cyan);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}



