/* ===================================
   Theme Overrides & Light Mode
   =================================== */

/* Enhanced Dark Theme Colors */
:root {
    /* Primary brand colors - enhanced contrast */
    --primary: #00d26a !important;
    --primary-dark: #00a855;
    --primary-light: #00ff80;
    --accent: #00d26a;
    --accent-hover: #00b85c;
    --accent-glow: rgba(0, 210, 106, 0.25);
    --accent-color: #00d26a;

    /* Secondary palette */
    --purple: #8b5cf6;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --orange: #f59e0b;

    /* Dark theme colors - deeper blacks */
    --bg-primary: #030303;
    --bg-secondary: #080808;
    --bg-tertiary: #0d0d0d;
    --bg-card: #0a0a0a;
    --bg-card-hover: #121212;
    --bg-glass: rgba(8, 8, 8, 0.98);
    --bg-input: #060606;

    /* Text colors - better contrast */
    --text-primary: #ffffff;
    --text-secondary: #c0c0c0;
    --text-muted: #808080;
    --text-inverse: #000000;

    /* Borders - more visible */
    --border-color: #1f1f1f;
    --border-hover: #2f2f2f;

    /* Status colors - vibrant */
    --success: #00d26a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Shadows - deeper */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px rgba(0, 210, 106, 0.25);
}

/* Light Theme - HIGH CONTRAST */
[data-theme="light"],
.light-theme {
    --bg-primary: #f5f5f5 !important;
    --bg-secondary: #ffffff !important;
    --bg-tertiary: #e8e8e8 !important;
    --bg-card: #ffffff !important;
    --bg-card-hover: #f0f0f0 !important;
    --bg-glass: rgba(255, 255, 255, 0.98) !important;
    --bg-input: #ffffff !important;

    /* Text colors - BLACK FOR HIGH CONTRAST */
    --text-primary: #000000 !important;
    --text-secondary: #222222 !important;
    --text-muted: #555555 !important;
    --text-inverse: #ffffff !important;

    /* Borders - visible */
    --border-color: #bbbbbb !important;
    --border-hover: #888888 !important;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.2) !important;
    --shadow-glow: 0 0 40px rgba(0, 210, 106, 0.15) !important;
}

/* Light theme body */
[data-theme="light"] body,
.light-theme body {
    background: #f5f5f5 !important;
    color: #000000 !important;
}

/* Sidebar in light mode */
[data-theme="light"] .sidebar,
.light-theme .sidebar {
    background: #ffffff !important;
    border-right: 1px solid #cccccc !important;
}

/* Navigation items */
[data-theme="light"] .nav-item,
.light-theme .nav-item {
    color: #222222 !important;
}

[data-theme="light"] .nav-item:hover,
.light-theme .nav-item:hover {
    background: rgba(0, 210, 106, 0.08) !important;
}

[data-theme="light"] .nav-item.active,
.light-theme .nav-item.active {
    background: rgba(0, 210, 106, 0.15) !important;
    color: #008844 !important;
}

[data-theme="light"] .nav-item span,
.light-theme .nav-item span {
    color: inherit !important;
}

/* Cards */
[data-theme="light"] .card,
.light-theme .card {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
}

/* Labels and text */
[data-theme="light"] label,
[data-theme="light"] .form-label,
[data-theme="light"] .card-title,
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6,
.light-theme label,
.light-theme .form-label,
.light-theme .card-title,
.light-theme h1,
.light-theme h2,
.light-theme h3,
.light-theme h4,
.light-theme h5,
.light-theme h6 {
    color: #000000 !important;
}

/* Inputs */
[data-theme="light"] .form-control,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea,
.light-theme .form-control,
.light-theme input,
.light-theme select,
.light-theme textarea {
    background: #ffffff !important;
    border: 1px solid #aaaaaa !important;
    color: #000000 !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder,
.light-theme input::placeholder,
.light-theme textarea::placeholder {
    color: #666666 !important;
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] input:focus,
.light-theme .form-control:focus,
.light-theme input:focus {
    border-color: #00d26a !important;
    box-shadow: 0 0 0 3px rgba(0, 210, 106, 0.2) !important;
}

/* Main content */
[data-theme="light"] .main-content,
.light-theme .main-content {
    background: #f5f5f5 !important;
}

/* Section headers */
[data-theme="light"] .section-header,
.light-theme .section-header {
    color: #000000 !important;
}

/* Paragraphs and descriptions */
[data-theme="light"] p,
[data-theme="light"] .description,
[data-theme="light"] small,
.light-theme p,
.light-theme .description,
.light-theme small {
    color: #333333 !important;
}

/* User info */
[data-theme="light"] .user-info,
.light-theme .user-info {
    background: #f0f0f0 !important;
    border-top: 1px solid #cccccc !important;
}

[data-theme="light"] .user-name,
.light-theme .user-name {
    color: #000000 !important;
}

[data-theme="light"] .user-email,
.light-theme .user-email {
    color: #444444 !important;
}

/* Logo text */
[data-theme="light"] .logo-text,
.light-theme .logo-text {
    background: linear-gradient(135deg, #00a855, #008844) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
}

/* Sun icon for dark mode */
.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

/* Moon icon for light mode */
[data-theme="light"] .theme-toggle,
.light-theme .theme-toggle {
    background: #ffffff !important;
    border-color: #cccccc !important;
    color: #000000 !important;
}

[data-theme="light"] .theme-toggle .sun-icon,
.light-theme .theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .moon-icon,
.light-theme .theme-toggle .moon-icon {
    display: block;
}

/* Enhanced card styles */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

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

/* Enhanced button glow */
.btn-primary {
    box-shadow: 0 0 20px rgba(0, 210, 106, 0.2);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(0, 210, 106, 0.4);
    transform: translateY(-2px);
}

/* Status dot colors */
.status-dot.connected {
    background: #00d26a;
    box-shadow: 0 0 10px rgba(0, 210, 106, 0.5);
}

.status-dot.disconnected {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.status-dot.connecting {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

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

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Toast improvements */
.toast.success {
    background: linear-gradient(135deg, rgba(0, 210, 106, 0.95), rgba(0, 168, 85, 0.95));
}

.toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
}

.toast.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
}

.toast.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.95));
}

/* Smooth transitions for theme change */
body,
.sidebar,
.main-content,
.card,
.nav-item,
input,
select,
textarea,
button {
    transition: background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Disabled nav item */
.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-item.disabled:hover {
    background: transparent !important;
}

/* Badge Em Breve */
.badge-soon {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal/Popup Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-btn {
    background: linear-gradient(135deg, #00d26a, #00a855);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 210, 106, 0.3);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Agent Section Placeholder Styles */
.coming-soon-banner {
    display: inline-block;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 1rem;
}

.agent-placeholder-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
    pointer-events: none;
    user-select: none;
}

.placeholder-card {
    background: rgba(30, 30, 30, 0.6);
    border: 1px solid rgba(50, 50, 50, 0.5);
    border-radius: 16px;
    padding: 1.5rem;
    opacity: 0.5;
}

.placeholder-card.wide {
    grid-column: span 2;
}

.placeholder-card.tall {
    grid-row: span 2;
}

.placeholder-header {
    height: 24px;
    width: 60%;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.placeholder-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.placeholder-line {
    height: 12px;
    background: rgba(50, 50, 50, 0.8);
    border-radius: 4px;
}

.placeholder-line.long {
    width: 100%;
}

.placeholder-line.medium {
    width: 75%;
}

.placeholder-line.short {
    width: 50%;
}

.placeholder-textarea {
    height: 120px;
    background: rgba(40, 40, 40, 0.8);
    border-radius: 8px;
}

.placeholder-footer {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.placeholder-btn {
    height: 36px;
    width: 120px;
    background: rgba(60, 60, 60, 0.8);
    border-radius: 8px;
}

.placeholder-btn.small {
    width: 80px;
}

.placeholder-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.placeholder-stat-box {
    height: 80px;
    background: rgba(40, 40, 40, 0.8);
    border-radius: 12px;
}

.placeholder-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.placeholder-list-item {
    height: 48px;
    background: rgba(45, 45, 45, 0.8);
    border-radius: 8px;
}

/* Light theme placeholders */
[data-theme="light"] .placeholder-card {
    background: rgba(200, 200, 200, 0.4);
    border-color: rgba(180, 180, 180, 0.5);
}

[data-theme="light"] .placeholder-header,
[data-theme="light"] .placeholder-line,
[data-theme="light"] .placeholder-textarea,
[data-theme="light"] .placeholder-btn,
[data-theme="light"] .placeholder-stat-box,
[data-theme="light"] .placeholder-list-item {
    background: rgba(180, 180, 180, 0.6);
}

@media (max-width: 768px) {
    .agent-placeholder-grid {
        grid-template-columns: 1fr;
    }

    .placeholder-card.wide {
        grid-column: span 1;
    }

    .placeholder-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Improved Modal Sizes */
.modal-content.modal-lg {
    max-width: 900px !important;
    width: 95% !important;
}

.modal-lg .modal-body {
    flex: 1 !important;
    min-height: 0;
    max-height: none !important;
    padding: 24px !important;
    overflow-y: auto;
}

.modal-lg .modal-header {
    padding: 20px 24px !important;
}

.modal-lg .modal-header h3 {
    font-size: 1.5rem !important;
}

.modal-lg .modal-footer {
    padding: 16px 24px !important;
}

/* Contact Selection Modal Improvements */
.modal-selection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 16px 20px !important;
    background: linear-gradient(135deg, rgba(0, 210, 106, 0.08), rgba(0, 210, 106, 0.02));
    border: 1px solid rgba(0, 210, 106, 0.2);
    border-radius: 16px;
    margin-bottom: 24px !important;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.modal-selection-actions .btn {
    padding: 10px 18px !important;
    font-size: 0.85rem !important;
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.modal-selection-actions .btn:hover {
    transform: translateY(-2px);
}

.modal-selection-actions .btn-select-all {
    background: rgba(0, 210, 106, 0.15);
    color: var(--accent);
    border: 1px solid rgba(0, 210, 106, 0.3);
}

.modal-selection-actions .btn-select-all:hover {
    background: rgba(0, 210, 106, 0.25);
    border-color: var(--accent);
}

.modal-selection-actions .btn-clear {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.modal-selection-actions .btn-clear:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.modal-contacts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding-bottom: 20px;
}

.modal-contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px !important;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.modal-contact-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    transition: background 0.25s ease;
}

.modal-contact-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.modal-contact-item:has(input:checked) {
    background: rgba(0, 210, 106, 0.08);
    border-color: var(--accent);
}

.modal-contact-item:has(input:checked)::before {
    background: var(--accent);
}

.modal-contact-item .contact-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 210, 106, 0.2), rgba(0, 168, 85, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
}

.modal-contact-item .contact-checkbox {
    width: 22px;
    height: 22px;
    min-width: 22px;
    accent-color: var(--accent);
    cursor: pointer;
    border-radius: 6px;
}

.modal-contact-item .contact-info {
    flex: 1;
    min-width: 0;
}

.modal-contact-item .contact-info strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-contact-item .contact-info small {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-contact-item .contact-info small svg {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

/* Selection count badge - enhanced */
.selection-count {
    background: linear-gradient(135deg, var(--accent), #00a855);
    color: white;
    padding: 8px 16px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(0, 210, 106, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.selection-count .count-number {
    font-size: 1.1rem;
}

/* Modal footer - enhanced with prominent confirm button */
.modal-lg .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px !important;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 16px 16px;
}

.modal-footer .btn {
    padding: 14px 28px !important;
    font-size: 1rem !important;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.25s ease;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--accent), #00a855);
    box-shadow: 0 4px 16px rgba(0, 210, 106, 0.35);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 210, 106, 0.45);
}

.modal-footer .btn-primary svg {
    width: 18px;
    height: 18px;
}

.modal-footer .btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.modal-footer .btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

/* Footer with actions - two column layout */
.modal-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.modal-footer-actions .footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-footer-actions .footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-footer-actions .btn-select-all,
.modal-footer-actions .btn-clear {
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
}

.modal-footer-actions .selection-count {
    background: linear-gradient(135deg, rgba(0, 210, 106, 0.15), rgba(0, 168, 85, 0.1));
    color: var(--accent);
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-footer-actions .selection-count .count-number {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .modal-contacts-list {
        grid-template-columns: 1fr;
    }

    .modal-content.modal-lg {
        max-width: 100% !important;
    }

    .modal-selection-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .selection-count {
        margin-left: 0;
        justify-content: center;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================
   Agent Section Styles
   ============================ */

.agent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .agent-grid {
        grid-template-columns: 1fr;
    }
}

.agent-config-card,
.agent-logs-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.card-header-with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-header-with-toggle h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.agent-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

.status-dot.inactive {
    background: var(--text-muted);
}

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

.agent-logs-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.agent-logs-container {
    max-height: 400px;
    overflow-y: auto;
}

.empty-logs {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-logs svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-logs p {
    margin: 0 0 8px 0;
    font-weight: 500;
}

.empty-logs small {
    font-size: 0.85rem;
}

.agent-log-item {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.agent-log-item .contact {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.agent-log-item .message,
.agent-log-item .response {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.agent-log-item .message {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.agent-log-item .response {
    background: rgba(0, 210, 106, 0.1);
    color: var(--text-primary);
}

.agent-log-item .time {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 8px;
}

/* Archetype Preview Styles */
.archetype-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.archetype-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.archetype-badge {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.niche-badge,
.tone-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.niche-badge {
    background: linear-gradient(135deg, var(--accent), #00a86b);
    color: white;
}

.tone-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.archetype-details {
    font-size: 0.9rem;
}

.archetype-details p {
    margin: 4px 0;
    color: var(--text-secondary);
}

.archetype-details strong {
    color: var(--text-primary);
}

.prompt-preview {
    margin-top: 12px;
}

.prompt-preview summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--accent);
    padding: 8px 0;
}

.prompt-preview summary:hover {
    text-decoration: underline;
}

.prompt-preview pre {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-secondary);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Escalation Section Styles */
.escalation-section {
    margin-top: 24px;
}

.escalation-section .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.metrics-badges {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.badge-info {
    background: rgba(0, 188, 212, 0.2);
    color: #00bcd4;
}

.escalated-list {
    min-height: 100px;
}

.escalated-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.escalated-item:last-child {
    border-bottom: none;
}

.escalated-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.escalated-meta {
    flex: 1;
    color: var(--text-muted);
}

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

/* ============================
   Mobile Experience Improvements
   ============================ */

/* Better tablet sidebar - show partial text */
@media (max-width: 992px) and (min-width: 769px) {
    .sidebar {
        width: 72px !important;
    }

    .nav-item {
        position: relative;
    }

    .nav-item::after {
        content: attr(data-tooltip);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        background: var(--bg-card);
        color: var(--text-primary);
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 0.85rem;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border-color);
        z-index: 100;
    }

    .nav-item:hover::after {
        opacity: 1;
        visibility: visible;
        left: calc(100% + 10px);
    }
}

/* Mobile improvements */
@media (max-width: 768px) {

    /* Fix content overflow */
    .main-content {
        padding: 72px 12px 24px !important;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* Section header improvements */
    .section-header h1,
    .page-header h1 {
        font-size: 1.4rem !important;
        line-height: 1.3;
        word-wrap: break-word;
    }

    .section-header p,
    .page-header p {
        font-size: 0.85rem !important;
        word-wrap: break-word;
    }

    /* QR Code better sizing */
    .qr-box {
        width: 100% !important;
        max-width: 240px !important;
        margin: 0 auto;
    }

    .qr-box img,
    .qr-box canvas {
        width: 100% !important;
        height: auto !important;
    }

    /* Connection card improvements */
    .connection-card {
        padding: 16px !important;
        overflow: hidden;
    }

    /* Connection info better text wrap */
    .connection-info {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .connection-info h2 {
        font-size: 1.3rem !important;
    }

    .connection-info p,
    .connection-info li {
        font-size: 0.9rem !important;
        line-height: 1.5;
    }

    /* Steps list improvements */
    .connection-steps {
        padding-left: 20px !important;
    }

    .connection-steps li {
        margin-bottom: 8px;
        word-wrap: break-word;
    }

    /* Buttons full width and not cut */
    .connection-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100%;
    }

    .connection-actions .btn {
        width: 100% !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Card content not overflow */
    .card {
        overflow: hidden;
        max-width: 100%;
    }

    .card-body {
        overflow-x: auto;
    }

    /* Form improvements */
    .form-group {
        width: 100%;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100% !important;
        max-width: 100%;
    }

    /* Table scroll on mobile */
    .table-responsive,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Better touch targets */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Nav items in sidebar when open */
    .sidebar.open .nav-item {
        min-height: 48px;
    }

    /* User info at bottom of sidebar */
    .sidebar.open .user-info {
        padding: 16px !important;
    }

    .sidebar.open .user-avatar {
        width: 36px;
        height: 36px;
    }

    /* Import box mobile */
    .import-box {
        padding: 20px 12px !important;
    }

    /* Delay config grid */
    .delay-config-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stats cards */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .stat-card {
        padding: 14px !important;
    }

    /* Theme toggle position for mobile */
    .theme-toggle {
        bottom: 16px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .main-content {
        padding: 68px 8px 20px !important;
    }

    .qr-box {
        max-width: 200px !important;
    }

    .btn {
        font-size: 0.8rem !important;
        padding: 10px 12px !important;
    }

    .section-header h1 {
        font-size: 1.2rem !important;
    }
}

/* Pairing Code Styles */
.pairing-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
    font-family: 'Courier New', monospace;
}

.code-digit {
    width: 40px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.code-separator {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin: 0 4px;
}

.modal-message {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.5;
}

.help-text {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 480px) {
    .code-digit {
        width: 32px;
        height: 40px;
        font-size: 1.2rem;
        gap: 4px;
    }

    .pairing-code-display {
        gap: 4px;
    }
}

/* ============================
   Mobile Fixes - Avatar and Sidebar
   ============================ */

/* Fix sidebar in mobile - hidden by default */
@media (max-width: 768px) {

    /* Hide sidebar completely on mobile when closed */
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px !important;
        transform: translateX(-100%) !important;
        z-index: 1000;
        overflow: hidden;
    }

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

    /* Fix user avatar overflow */
    .sidebar .user-info,
    .user-info {
        position: relative;
        overflow: hidden !important;
    }

    .user-avatar,
    .sidebar .user-avatar {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        border-radius: 50% !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
    }

    .user-avatar img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 70px 12px 80px !important;
    }

    /* Cards full width */
    .card {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 12px;
    }

    /* Form inputs full width */
    input,
    select,
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Stats grid */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 12px !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
    }

    .stat-label {
        font-size: 0.75rem !important;
    }

    /* Table responsive */
    .contacts-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Header actions */
    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .header-actions {
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* Buttons in header */
    .header-actions .btn {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }

    /* Import card */
    .import-card {
        padding: 16px !important;
    }

    .upload-area {
        padding: 20px 12px !important;
    }

    .upload-area svg {
        width: 32px !important;
        height: 32px !important;
    }

    /* Section header */
    .section-header {
        margin-bottom: 16px !important;
    }

    .section-header h1 {
        font-size: 1.3rem !important;
    }

    /* Theme toggle fixed position */
    .theme-toggle {
        position: fixed !important;
        bottom: 16px !important;
        right: 16px !important;
        z-index: 999 !important;
    }

    /* Sidebar footer with user - hide on collapsed */
    .sidebar-footer {
        overflow: hidden !important;
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

/* Mobile sidebar when open - show full width with names */
@media (max-width: 768px) {
    .sidebar.open {
        width: 280px !important;
    }

    .sidebar.open .nav-item span {
        display: inline !important;
        opacity: 1 !important;
    }

    .sidebar.open .logo-text {
        display: inline !important;
        opacity: 1 !important;
    }

    .sidebar.open .sidebar-header {
        padding: 20px !important;
    }

    .sidebar.open .nav-menu {
        padding: 0 16px !important;
    }

    .sidebar.open .nav-item {
        padding: 12px 16px !important;
        gap: 12px !important;
    }

    .sidebar.open .sidebar-footer {
        padding: 16px !important;
    }

    .sidebar.open .user-info {
        display: flex !important;
        gap: 12px !important;
    }

    .sidebar.open .user-details {
        display: block !important;
    }
}

/* Fix connection status and agent badge on mobile */
@media (max-width: 768px) {

    /* Connection status - only show dot when sidebar closed */
    .sidebar .connection-status {
        justify-content: center;
    }

    .sidebar .status-text {
        display: none;
    }

    .sidebar.open .status-text {
        display: inline !important;
    }

    .sidebar.open .connection-status {
        justify-content: flex-start !important;
        gap: 10px;
    }

    /* Agent badge fix */
    .sidebar .badge-soon {
        display: none;
    }

    .sidebar.open .badge-soon {
        display: inline-flex !important;
        font-size: 0.65rem;
        padding: 2px 6px;
        background: var(--warning, #f0ad4e);
        color: #000;
        border-radius: 4px;
        font-weight: 600;
    }

    /* Status dot always visible */
    .status-dot {
        width: 10px !important;
        height: 10px !important;
        min-width: 10px !important;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .status-dot.disconnected {
        background: #f0ad4e !important;
    }

    .status-dot.connected {
        background: #28a745 !important;
    }

    .status-dot.connecting {
        background: #17a2b8 !important;
    }
}

/* ============================
   Desktop Responsive Breakpoints
   ============================ */

/* Large tablets and small desktops (1024px - 1200px) */
@media (max-width: 1200px) and (min-width: 769px) {
    .main-content {
        padding: 20px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .card {
        padding: 20px;
    }

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

    .header-actions {
        gap: 8px;
    }

    .header-actions .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* Tablet breakpoint (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {

    /* Collapse sidebar to icons only */
    .sidebar {
        width: 70px !important;
    }

    .sidebar .logo-text,
    .sidebar .nav-item span,
    .sidebar .user-details,
    .sidebar .status-text {
        display: none !important;
    }

    .sidebar .logo {
        justify-content: center;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 12px !important;
    }

    .sidebar .nav-item svg {
        margin: 0 !important;
    }

    .sidebar .sidebar-footer {
        padding: 16px 8px;
    }

    .sidebar .connection-status {
        justify-content: center;
    }

    .sidebar .user-avatar {
        margin: 0 auto;
    }

    .main-content {
        margin-left: 70px !important;
    }

    /* Table responsive */
    .contacts-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .contacts-table {
        min-width: 600px;
    }

    /* Stats grid 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Cards stack better */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* Prevent content overflow on any screen */
.main-content {
    min-width: 0;
    overflow-x: hidden;
}

.card {
    min-width: 0;
    overflow: hidden;
}

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

/* Smooth sidebar transition */
.sidebar {
    transition: width 0.3s ease, transform 0.3s ease;
}

.main-content {
    transition: margin-left 0.3s ease;
}

/* ===================================
   Navigation Divider & Admin Links
   =================================== */

.nav-divider {
    height: 1px;
    background: var(--border-color, #1f1f1f);
    margin: 12px 16px;
}

.nav-admin {
    padding: 0 8px;
    margin-top: 8px;
}

.nav-admin .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary, #a0a0a0);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav-admin .nav-item:hover {
    background: var(--bg-tertiary, #1a1a25);
    color: var(--primary, #00d26a);
}

.nav-admin .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-admin .nav-item span {
    white-space: nowrap;
}