:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-message-user: #1a1a2e;
    --bg-message-agent: #0f3460;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --accent-whatsapp: #25d366;
    --accent-phone: #f97316;
    --accent-sms: #8b5cf6;
    --accent-email: #3b82f6;
    --accent-chatbot: #ec4899;
    --border-color: #2a2a3a;
    --bg-dropdown: #1a1a2e;
    --bg-dropdown-hover: #2a2a4a;
    --sidebar-width: 240px;
    --context-sidebar-width: 280px;
    --header-height: 64px;
    --input-height: 74px;
}

/* New Layout Styles */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-footer {
    padding: 16px 16px 0 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.sidebar-nav .nav__button {
    width: 100%;
    height: 48px;
    padding: 0 24px;
    justify-content: flex-start;
    gap: 12px;
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 4px;
}

.sidebar-nav .nav__button--active {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    color: var(--text-primary);
}

.sidebar-nav .nav__button svg {
    flex-shrink: 0;
}

.nav-label {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.sidebar-footer {
    padding: 12px 16px;
    background: transparent;
}

.company-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manager-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}

.manager-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.company-balance-wrapper {
    display: none;
}

.logout-btn-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

.context-sidebar {
    width: var(--context-sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 90;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

.content-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Override existing container styles to fit the new layout */
.chat-container, .usage-container, .api-container, .config-container, .calendar-container {
    height: 100% !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 24px !important;
    position: relative !important;
    overflow: hidden;
}

/* Special handling for Messages/Simulation to use 3 columns */
.messages-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Specific Sidebar Styles for 3-column layout */
#liveContainer .users-sidebar {
    display: flex !important;
    position: static !important;
    width: var(--sidebar-width) !important;
    background: var(--bg-secondary) !important;
    border-right: 1px solid var(--border-color) !important;
    flex-shrink: 0 !important;
}

#liveContainer .messages-main {
    margin-left: 0 !important;
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

#configContainer .config-sidebar {
    display: flex !important;
    position: static !important;
    width: var(--sidebar-width) !important;
    background: var(--bg-secondary) !important;
    border-right: 1px solid var(--border-color) !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}

#configContainer .config-form {
    margin-left: 0 !important;
    flex: 1;
}

/* Adjust fixed elements */
.chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0 !important;
    width: 100% !important;
    padding: 15px 24px;
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    z-index: 10;
    height: var(--input-height);
    display: flex;
    align-items: center;
    gap: 12px;
}

#liveMessages .chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0 !important;
    width: 100% !important;
}


#liveIndicator {
    left: var(--sidebar-width) !important;
}


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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    transition: background 0.3s ease;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nav { display: none; }
.nav-left { display: none; }
.nav-logo { display: none; }
.nav-right { display: none; }
.nav__button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav__button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav__button--active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.1);
    border-bottom-color: #3b82f6;
}

/* Authentication Styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0f0f23 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.auth-container {
    background: rgba(26, 26, 38, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    margin-top: 20px;
    margin-bottom: 20px;
    overflow-y: auto;
}

/* Responsive adjustments */
@media (max-height: 700px) {
    .auth-overlay {
        padding: 10px;
        align-items: flex-start;
    }

    .auth-container {
        padding: 20px;
        margin-top: 10px;
        margin-bottom: 10px;
        max-height: calc(100vh - 20px);
    }

    .auth-header {
        margin-bottom: 20px;
    }

    .auth-header h1 {
        font-size: 28px;
    }

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

    .auth-form h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .auth-overlay {
        padding: 10px;
    }

    .auth-container {
        padding: 20px;
        max-width: calc(100vw - 20px);
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .logout-text {
        display: none;
    }

    .logout-btn {
        padding: 8px;
    }

    .auth-header h1 {
        font-size: 24px;
    }

    .auth-form h2 {
        font-size: 18px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .auth-btn {
        padding: 12px;
        margin-top: 15px;
    }

    .auth-switch {
        margin-top: 15px;
        padding-top: 15px;
    }

    .form-help {
        font-size: 11px;
        margin-top: 3px;
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
}

.auth-form h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 500;
    margin: 0 0 20px 0;
    text-align: center;
}

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

.form-group label {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #3b82f6;
    background: rgba(0, 0, 0, 0.5);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

/* Make textareas more compact on small screens */
@media (max-height: 700px) {
    .form-group textarea {
        min-height: 50px;
    }
}

.form-help {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

/* Custom toggle switch styles */
.checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0;
    padding: 8px 0;
    min-height: 18px;
    line-height: 18px;
    -webkit-tap-highlight-color: transparent;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    align-self: center;
}

.switch:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.checkbox-label input[type="checkbox"]:checked ~ .switch {
    background-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.checkbox-label input[type="checkbox"]:checked ~ .switch:before {
    transform: translateX(14px);
    background-color: white;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.auth-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-switch p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.auth-switch a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 20px;
    color: #ef4444;
    font-size: 14px;
    text-align: center;
}

/* Company Selection Styles */
.company-selection {
    display: grid;
    gap: 16px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.company-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.company-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.05);
}

.company-card h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.company-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.select-company-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.select-company-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
}

.select-company-btn:active {
    transform: translateY(0);
}

.select-company-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Company Info in Navigation */
.company-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.company-name {
    color: var(--text-primary);
    font-weight: 500;
}

.company-balance {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.company-selector {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.company-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.company-selector:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

.company-selector option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.config-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 12px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

/* Company Management Styles */
.company-management-container {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 100;
    overflow-y: auto;
    height: 100%;
}

/* Common Header Styles */
.content-header {
    text-align: left;
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
}

.content-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.content-header p {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

.company-management-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.company-management-header {
    display: none;
}

.company-management-actions {
    margin-bottom: 30px;
}

.companies-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
}

.companies-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 16px;
}

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.no-companies {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 16px;
}

.company-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
}

.company-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.company-card--selected {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.05);
}

.company-card--selected:hover {
    border-color: rgba(34, 197, 94, 0.7);
    background: rgba(34, 197, 94, 0.08);
    transform: translateY(-2px);
}

.company-card h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.company-card .company-role {
    display: inline-block;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.company-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.company-card .company-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.company-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.company-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.company-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.logout-btn:active {
    transform: translateY(0);
}

.logout-btn svg {
    flex-shrink: 0;
}

.logout-text {
    font-size: 13px;
    font-weight: 500;
}

/* Config Interface Styles */
.config-container {
    flex: 1;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 !important;
    box-sizing: border-box;
    height: 100%;
    overflow: hidden;
}

.config-layout {
    display: flex;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    height: 100%;
}

.config-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.config-sidebar-title {
    padding: 0 24px;
    height: 81px; /* Match sidebar-logo height */
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    margin: 0;
}

.config-nav {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.config-nav-item {
    display: block;
    width: 100%;
    padding: 10px 24px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.config-nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.config-nav-item--active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
    border-left-color: #3b82f6;
}

.config-header {
    display: none;
}

.company-management-header {
    display: none;
}

.config-form {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    box-sizing: border-box;
    background: var(--bg-primary);
}

#configForm {
    display: block;
}

.config-page {
    width: 100%;
}

.config-section {
    margin-bottom: 25px;
}

.config-section:last-child {
    margin-bottom: 0;
}

.config-section h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.config-subsection {
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.config-subsection h4 {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-subsection h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: #3b82f6;
    border-radius: 2px;
}

.danger-zone {
    margin-top: 48px;
    padding: 24px;
    background: rgba(239, 68, 68, 0.03);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
}

.danger-zone h3 {
    color: #ef4444;
    border-bottom-color: rgba(239, 68, 68, 0.1);
}

.config-advanced-wrap {
    margin-top: 32px;
    padding-top: 0;
}

.config-advanced-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    /* Mismo padding arriba y abajo del título Advanced que el borde superior/inferior de la caja */
    padding: 16px 20px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Title row only: opens/closes section (not a “button” look) */
.config-advanced-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0;
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-align: left;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.config-advanced-trigger:hover {
    color: var(--text-primary);
}

.config-advanced-trigger:hover .config-advanced-trigger__chevron {
    opacity: 0.85;
}

.config-advanced-trigger:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 4px;
    border-radius: 4px;
}

.config-advanced-trigger[aria-expanded="true"] .config-advanced-trigger__chevron {
    transform: rotate(180deg);
}

.config-advanced-trigger__text {
    flex: 1;
}

.config-advanced-trigger__chevron {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 12px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    opacity: 0.55;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.config-advanced-panel {
    margin-top: 14px;
    padding-top: 4px;
}

.config-advanced-panel[hidden] {
    display: none !important;
}

.config-advanced-panel__inner.danger-zone {
    margin-top: 0;
}

.config-advanced-danger-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #ef4444;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

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

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .config-container {
        padding: 15px;
        height: calc(100vh - var(--nav-height));
        overflow-y: auto;
    }

    .config-layout {
        flex-direction: column;
    }

    .config-sidebar {
        width: 100%;
        padding: 16px 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .config-sidebar-title {
        padding: 0 20px 12px;
    }

    .config-nav {
        flex-direction: row;
        padding: 0 20px;
        gap: 4px;
    }

    .config-nav-item {
        flex: 1;
        padding: 10px 16px;
        text-align: center;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .config-nav-item--active {
        border-left: none;
        border-bottom-color: #3b82f6;
    }

    .config-form {
        padding: 20px;
    }

    .config-section {
        margin-bottom: 20px;
    }
}

/* API Key & Docs page (reuses config layout) */
.api-container {
    flex: 1;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 !important;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

.api-form {
    background: var(--bg-primary);
    border: none;
    border-radius: 0;
    padding: 32px;
    min-height: 100%;
    box-sizing: border-box;
}

.api-key-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.api-key-input {
    flex: 1;
    padding: 12px 14px;
    font-size: 14px;
    font-family: monospace;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.api-key-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
}

.api-copy-btn {
    flex-shrink: 0;
}

.api-key-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Password input with show/hide functionality */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 40px !important;
}

.btn-show-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s ease;
    z-index: 2;
}

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

.btn-show-password svg {
    width: 18px;
    height: 18px;
}

.api-docs {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.api-docs p {
    margin: 0 0 12px 0;
}

.api-docs ul {
    margin: 0 0 12px 0;
    padding-left: 20px;
}

.api-docs li {
    margin-bottom: 6px;
}

.api-docs code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

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

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chat-container {
    flex: 1;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: background 0.3s ease;
}

.messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    padding-bottom: calc(var(--input-height) + 24px);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* When in manual simulation mode, let child handle scrolling */
.messages:has(.manual-header) {
    padding: 0;
    gap: 0;
    overflow: visible;
    min-height: 0;
    padding-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 16px;
    position: relative;
    animation: slideIn 0.3s ease-out;
    flex-shrink: 0;
}

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

.message--user {
    align-self: flex-end;
    background: var(--bg-message-user);
    border-bottom-right-radius: 4px;
}

.message--agent {
    align-self: flex-start;
    background: var(--bg-message-agent);
    border-bottom-left-radius: 4px;
}

.message--system {
    align-self: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-style: italic;
    max-width: 80%;
    text-align: center;
}

.message__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.message__channel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message__channel--whatsapp {
    background: rgba(37, 211, 102, 0.15);
    color: var(--accent-whatsapp);
}

.message__channel--phone {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-phone);
}

.message__channel--sms {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-sms);
}

.message__channel--email {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-email);
}

.message__channel--chatbot {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-chatbot);
}

.message__time {
    color: var(--text-secondary);
    font-size: 11px;
}

.message__content {
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message__icon {
    width: 14px;
    height: 14px;
}

.message__audio-indicator {
    margin-left: 4px;
    opacity: 0.7;
    font-size: 12px;
}

.message__audio-indicator:hover {
    opacity: 1;
}

/* Manual Simulation Styles */
.manual-header {
    height: 81px;
    padding: 0 20px;
    background: var(--bg-secondary);
    flex-shrink: 0;
    flex-grow: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Messages Layout with Sidebar */
.messages-layout {
    display: flex;
    height: 100%;
}

.users-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 24px;
    height: 81px; /* Match sidebar-logo height */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.sidebar-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.user-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0;
}

.user-item {
    position: relative;
    display: block;
    margin-bottom: 2px;
    min-width: 100%;
}

.user-list .user-btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: none;
    background: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-item:hover .user-btn {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.user-item.active .user-btn {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
    border-left-color: #3b82f6;
}

.user-icon {
    margin-right: 12px;
    font-size: 16px;
    flex-shrink: 0;
}

.user-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-item--all .user-btn {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.user-info-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.user-item:hover .user-info-btn {
    opacity: 1;
}

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

.user-info-btn svg {
    transition: transform 0.2s ease;
}

.user-info-btn:hover svg {
    transform: scale(1.1);
}

.messages-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.channel-selector {
    display: flex;
    gap: 4px;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0;
}

.channel-selector::-webkit-scrollbar {
    display: none;
}

.channel-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.channel-btn.active {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-weight: 600;
}

.channel-btn-all {
    font-weight: 600 !important;
}

.channel-btn-ask-agent {
    background: rgba(168, 85, 247, 0.1) !important;
    border: 1px solid rgba(168, 85, 247, 0.3) !important;
    color: #a855f7 !important;
    font-weight: 600 !important;
}

.channel-btn-ask-agent:hover {
    background: rgba(168, 85, 247, 0.15) !important;
    border-color: rgba(168, 85, 247, 0.5) !important;
    color: #c084fc !important;
}

.channel-btn-ask-agent.active {
    background: rgba(168, 85, 247, 0.15) !important;
    border-color: rgba(168, 85, 247, 0.6) !important;
    color: #c084fc !important;
}

/* Outbound call button - shown when user selected and both have phones */
.btn-outbound-call {
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3) 0%, rgba(22, 163, 74, 0.3) 100%);
    border: 1px solid rgba(34, 197, 94, 0.5);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-outbound-call:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.45) 0%, rgba(22, 163, 74, 0.45) 100%);
    border-color: rgba(34, 197, 94, 0.8);
}

/* Call button inside User Information modal */
.info-section.info-actions {
    margin-bottom: 16px;
}
.btn-outbound-call.btn-call-in-modal {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Outbound call modal */
.outbound-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    margin-top: 6px;
}
.info-section-label {
    display: block;
    color: rgba(100, 200, 255, 0.9);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.outbound-call-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}
.outbound-call-actions .btn-save {
    background: #22c55e;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}
.outbound-call-actions .btn-save:hover {
    background: #16a34a;
}
.outbound-call-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
}
.outbound-call-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.manual-messages {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 100%;
    padding: 15px 10px;
    padding-bottom: calc(var(--input-height) + 40px);
}

/* In live view (Messages page), add comfortable bottom padding */
#liveMessages .manual-messages {
    padding-bottom: 20px;
}

/* When Ask Agent channel is active, reduce padding - must override the 70px padding-bottom */
#liveMessages .messages-main.ask-agent-active .manual-messages {
    padding: 15px 10px 15px 10px !important;
    padding-bottom: 15px !important;
}

/* Ask Agent input container - not fixed, inside messages-main */
.messages-main .ask-agent-input {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    flex-shrink: 0;
    margin-top: auto;
    padding: 8px 20px !important;
}

/* Compact live input container */
.live-input-container {
    height: 50px !important;
    padding: 10px 10px !important;
}

.live-input-container .live-indicator-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 400;
    flex: 1;
}

.live-input-container .live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.live-input-container .download-prompt-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.live-input-container .download-prompt-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Chat Input Styles */
.chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0 !important;
    width: 100% !important;
    padding: 15px 24px;
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    z-index: 10;
    height: var(--input-height);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
    width: 100%;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.chat-input:focus {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.8);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #25d366;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #128c7e;
    transform: scale(1.05);
}

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

/* Download Prompt Button */
.download-prompt-btn {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.download-prompt-btn:hover {
    background: rgba(59, 130, 246, 0.6);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.download-prompt-btn:active {
    transform: scale(0.95);
}

.download-prompt-btn svg {
    width: 20px;
    height: 20px;
}

/* Audio Button */
.audio-btn {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-btn:hover {
    background: rgba(239, 68, 68, 0.6);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

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

.audio-btn.recording {
    background: rgba(239, 68, 68, 0.9);
    border-color: #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.audio-btn svg {
    width: 20px;
    height: 20px;
}

.no-input-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-style: italic;
    padding: 12px;
}

/* Scrollbar styling */
.messages::-webkit-scrollbar,
.manual-messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track,
.manual-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb,
.manual-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover,
.manual-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Live mode styles */
.no-messages {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-style: italic;
    opacity: 0.7;
}

.live-indicator-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 12px 20px;
}

.live-dot {
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

#liveIndicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Config Emails Display */
.config-emails-display {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    min-height: 44px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.config-emails-display .no-emails {
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

.config-email-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.config-email-tag svg {
    width: 14px;
    height: 14px;
    fill: #ea4335;
}

/* Gmail Integration Styles */
.config-section-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.gmail-accounts-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    min-height: 60px;
}

.gmail-accounts-loading {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 20px;
    text-align: center;
}

.gmail-accounts-list {
    padding: 0;
}

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

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

.gmail-account-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gmail-account-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ea4335 0%, #fbbc04 50%, #34a853 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.gmail-account-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gmail-account-email {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

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

.gmail-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.gmail-status-dot.active {
    background: #22c55e;
}

.gmail-account-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-gmail-action {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-gmail-action:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-gmail-action.danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-gmail-action.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-gmail-connect {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #ea4335 0%, #4285f4 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-gmail-connect:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.btn-gmail-connect:active {
    transform: translateY(0);
}

.gmail-icon {
    width: 20px;
    height: 20px;
}

.gmail-empty-state {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.gmail-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.gmail-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ============================================
   CALENDAR STYLES
   ============================================ */

.calendar-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 24px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.calendar-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: var(--bg-message-user);
    border-color: var(--accent-email);
}

.calendar-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 180px;
    text-align: center;
}

.calendar-actions {
    display: flex;
    gap: 12px;
}

.calendar-today-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-today-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-email);
}

.calendar-sync-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent-email);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-sync-btn:hover {
    filter: brightness(1.1);
}

.calendar-sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.calendar-sync-btn.syncing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Calendar Connection Status */
.calendar-connection-status {
    margin-bottom: 24px;
}

.calendar-not-connected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
}

.calendar-not-connected svg {
    color: var(--text-secondary);
    margin-bottom: 16px;
    opacity: 0.6;
}

.calendar-not-connected h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.calendar-not-connected p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-calendar-connect {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #4285f4 0%, #34a853 50%, #fbbc05 75%, #ea4335 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-calendar-connect:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.btn-calendar-connect svg {
    width: 20px;
    height: 20px;
}

.calendar-connected-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(52, 168, 83, 0.1);
    border: 1px solid rgba(52, 168, 83, 0.3);
    border-radius: 8px;
}

.calendar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
}

.calendar-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.calendar-loading p {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.connected-account {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #34a853;
}

.connected-account::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #34a853;
    border-radius: 50%;
}

.btn-disconnect-calendar {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 4px;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-disconnect-calendar:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Calendar Grid */
.calendar-main-wrapper {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.calendar-grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    min-width: 0;
}

.calendar-weekdays {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-message-user);
    border-bottom: 1px solid var(--border-color);
}

.weekday {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-grid {
    width: 100%;
    height: 500px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.calendar-day {
    background: var(--bg-secondary);
    padding: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    background: var(--bg-message-user);
}

.calendar-day.other-month {
    opacity: 0.4;
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.1);
}

.calendar-day.today .day-number {
    background: var(--accent-email);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day.selected {
    background: rgba(59, 130, 246, 0.15);
    outline: 2px solid var(--accent-email);
    outline-offset: -2px;
}

.day-number {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.day-event {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.day-event.all-day {
    background: var(--accent-email);
}

.day-event.timed {
    background: var(--accent-whatsapp);
}

.day-event-more {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 6px;
}

/* Events Panel */
.calendar-events-panel {
    width: 350px;
    min-width: 350px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100vh - var(--nav-height) - 200px);
}

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

.events-panel-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.events-panel-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.events-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.event-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 4px solid var(--accent-email);
}

.event-time-container {
    min-width: 100px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-time {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-email);
    white-space: nowrap;
}

.event-duration {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

.event-details {
    flex: 1;
}

.event-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.event-location {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.event-location svg {
    width: 12px;
    height: 12px;
}

.no-events {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* WhatsApp Phone Numbers List */
.whatsapp-templates-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.whatsapp-templates-loading {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 16px;
    text-align: center;
}

.whatsapp-templates-list {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    max-height: 500px;
}

.whatsapp-templates-list::-webkit-scrollbar {
    width: 6px;
}

.whatsapp-templates-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.whatsapp-templates-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

.whatsapp-template-card {
    margin-bottom: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.whatsapp-template-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.whatsapp-template-card:last-child {
    margin-bottom: 0;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 12px;
}

.template-title-section {
    flex: 1;
    min-width: 0;
}

.template-name {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.template-language {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.template-content {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.template-component {
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.template-component:last-child {
    margin-bottom: 0;
}

.component-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 8px;
}

.component-value {
    color: var(--text-primary);
    font-size: 12px;
    word-break: break-word;
    white-space: pre-wrap;
}

.template-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.template-category {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.no-templates-message {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 20px;
    text-align: center;
    font-style: italic;
}

.whatsapp-phones-list {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    min-height: 60px;
    max-height: 400px;
    overflow-y: auto;
}

.no-phones-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 20px 0;
}

.whatsapp-phone-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.whatsapp-phone-item:hover {
    border-color: #25d366;
}

.whatsapp-phone-item:last-child {
    margin-bottom: 0;
}

.whatsapp-phone-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #25d366 0%, #4caf50 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.whatsapp-phone-info {
    flex: 1;
    min-width: 0;
}

.whatsapp-phone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.whatsapp-phone-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.whatsapp-phone-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.whatsapp-phone-status.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.whatsapp-phone-status.inactive {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.whatsapp-phone-number {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
}

.whatsapp-phone-id {
    color: var(--text-secondary);
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.whatsapp-phone-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}

.btn-phone-action {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-phone-action:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-phone-action.edit:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}

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

.btn-add-phone {
    background: linear-gradient(135deg, #25d366 0%, #4caf50 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-add-phone:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-add-phone svg {
    width: 16px;
    height: 16px;
}

/* WhatsApp Phone Form Modal */
.whatsapp-phone-form {
    background: var(--bg-tertiary);
    border: 2px solid #25d366;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}

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

.whatsapp-phone-form h4 {
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.whatsapp-phone-form .form-group {
    margin-bottom: 12px;
}

.whatsapp-phone-form .form-group:last-of-type {
    margin-bottom: 16px;
}

.whatsapp-phone-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.whatsapp-phone-form input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s ease;
}

.whatsapp-phone-form input:focus {
    outline: none;
    border-color: #25d366;
    background: var(--bg-primary);
}

/* WhatsApp Active Toggle Switch */
.whatsapp-active-group {
    margin-top: 4px;
    margin-bottom: 16px;
}

.whatsapp-active-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.whatsapp-active-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.whatsapp-active-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #4a4a4a;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.whatsapp-active-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.whatsapp-active-checkbox:checked + .whatsapp-active-switch {
    background: #25d366;
}

.whatsapp-active-checkbox:checked + .whatsapp-active-switch::after {
    left: 23px;
}

.whatsapp-active-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.whatsapp-phone-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.whatsapp-phone-form-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.whatsapp-phone-form-actions .btn-save {
    background: #25d366;
    color: white;
    border: none;
}

.whatsapp-phone-form-actions .btn-save:hover {
    background: #22c55e;
}

.whatsapp-phone-form-actions .btn-cancel {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.whatsapp-phone-form-actions .btn-cancel:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* WhatsApp Verification Status */
.whatsapp-verification-status {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Verification Button */
.btn-phone-action.verify {
    background: #3b82f6;
}

.btn-phone-action.verify:hover {
    background: #2563eb;
}

/* Verification Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.verification-phone-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: center;
}

.verification-phone-info strong {
    display: block;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.verification-phone-info div {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.verification-phone-info small {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.verification-step {
    margin-bottom: 20px;
}

.verification-step h4 {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.verification-step p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.verification-method-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-verification-method {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-verification-method:hover {
    background: var(--bg-primary);
    border-color: #25d366;
}

.btn-verification-method svg {
    color: #25d366;
}

.verification-loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: #25d366;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.verification-loading p {
    color: var(--text-secondary);
    font-size: 14px;
}

.verification-result {
    text-align: center;
    padding: 40px 20px;
}

.verification-result svg {
    margin: 0 auto 16px;
}

.verification-result h4 {
    font-size: 18px;
    margin-bottom: 12px;
}

.verification-result.success h4 {
    color: #10b981;
}

.verification-result.error h4 {
    color: #ef4444;
}

.verification-result p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.verification-result button {
    margin: 0 8px;
}

/* MCP Tools Checkboxes */
.config-mcp-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.config-mcp-tools .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.config-mcp-tools .checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.config-mcp-tools .mcp-tool-checkbox {
    position: relative;
    opacity: 1;
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #3b82f6;
}

/* Usage Stats Styles */
.usage-container {
    flex: 1;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 !important;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

.usage-content {
    background: var(--bg-primary);
    border: none;
    border-radius: 0;
    padding: 32px;
    min-height: 100%;
}

.usage-summary-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .usage-summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.usage-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.usage-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.usage-card-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.usage-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    align-items: flex-end;
}

.usage-filters .form-group {
    margin-bottom: 0;
    flex: 1;
    max-width: 300px;
}

.usage-table-wrapper {
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.usage-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.usage-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.usage-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Estilos para filas anidadas en Usage */
.usage-row-sub {
    background: rgba(255, 255, 255, 0.02) !important;
}

.usage-row-sub-2 {
    background: rgba(255, 255, 255, 0.01) !important;
}

.usage-row-main {
    transition: background 0.2s;
}

.usage-row-main:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.usage-row-sub:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.toggle-icon {
    color: var(--text-secondary);
    opacity: 0.7;
}

.usage-row-main:hover .toggle-icon {
    color: var(--text-primary);
    opacity: 1;
}

.usage-indent-1 {
    padding-left: 32px !important;
}

.usage-indent-2 {
    padding-left: 54px !important;
}

.usage-table {
    table-layout: fixed;
    width: 100%;
}

.usage-table th, .usage-table td {
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.usage-model-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.usage-model-tag--ai { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.usage-model-tag--orch { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.usage-model-tag--real { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.usage-model-tag--voice { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.usage-token-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: monospace;
}

.usage-token-in { color: #60a5fa; }
.usage-token-out { color: #f472b6; }
.usage-token-cached { color: #9ca3af; font-size: 11px; }

.usage-sections {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.usage-section h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Timezone Picker Styles */
.timezone-picker-container {
    position: relative;
    width: 100%;
}

.timezone-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.timezone-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    transition: background 0.2s;
}

.timezone-option:hover {
    background: var(--bg-dropdown-hover);
}

.timezone-option.selected {
    background: rgba(59, 130, 246, 0.2);
    border-left: 3px solid #3b82f6;
}

.timezone-option .tz-offset {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 12px;
}

/* Custom Scrollbar for Timezone Dropdown */
.timezone-dropdown::-webkit-scrollbar {
    width: 8px;
}

.timezone-dropdown::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.timezone-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.timezone-dropdown::-webkit-scrollbar-thumb:hover {
    background: #4a4a5a;
}

/* User saved data: custom rows in edit mode — align inputs; view mode matches built-in (top) */
.user-attr-to-save-table tr.user-attr-row--custom-editing td:nth-child(2),
.user-attr-to-save-table tr.user-attr-row--custom-editing td.user-attr-desc-cell,
.user-attr-to-save-table tr.user-attr-row--add td:first-child {
    vertical-align: middle;
}

.user-attr-to-save-table tr.user-attr-row--custom-editing td:first-child {
    vertical-align: middle;
}

.user-attr-to-save-table tr.user-attr-row--custom:not(.user-attr-row--custom-editing) td:nth-child(2),
.user-attr-to-save-table tr.user-attr-row--custom:not(.user-attr-row--custom-editing) td.user-attr-desc-cell {
    vertical-align: top;
}

.user-attr-to-save-table input.user-saved-data-code,
.user-attr-to-save-table textarea.user-saved-data-desc {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.user-attr-to-save-table input.user-saved-data-code {
    height: 48px;
    min-height: 48px;
}

.user-attr-to-save-table textarea.user-saved-data-desc {
    display: block;
    height: 48px;
    min-height: 48px;
    min-width: 12em;
    overflow-x: auto;
    overflow-y: auto;
    white-space: pre;
    resize: vertical;
}

.user-attr-to-save-table input.user-saved-data-code:focus,
.user-attr-to-save-table textarea.user-saved-data-desc:focus {
    border-color: #3b82f6;
    background: rgba(0, 0, 0, 0.5);
}

.user-attr-to-save-table input.user-saved-data-code::placeholder,
.user-attr-to-save-table textarea.user-saved-data-desc::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
