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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #43d674 0%, #2bd5eb 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.6s ease-out;
}

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

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

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

.login-header i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-password-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

.login-password-wrap input {
    flex: 1;
    padding-right: 44px;
}

.login-password-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
    transition: color 0.2s ease, background 0.2s ease;
}

.login-password-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.login-passkeys-btn {
    width: 100%;
    margin-top: 12px;
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-passkeys-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.08);
    transform: translateY(-1px);
}

.login-passkeys-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background: #fdf2f2;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: #3498db;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    list-style: none;
    padding: 20px 0;
}

.menu-item {
    margin-bottom: 5px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.menu-link:hover {
    background: #34495e;
    color: white;
}

.menu-item.active .menu-link {
    background: #3498db;
    color: white;
    border-left-color: #2980b9;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.logout-btn {
    width: 100%;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: #c0392b;
}

/* Main Content */
.main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.main-header {
    flex-shrink: 0;
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.main-header h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
}

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

.header-bot-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-bot-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.header-bot-select {
    min-width: 140px;
    max-width: 180px;
    padding: 6px 10px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}

.header-user-menu-wrap {
    position: relative;
}

.header-user-btn {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    color: #2c3e50;
}

.header-user-btn:hover {
    background: #f5f5f5;
}

.header-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;
}

.header-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #2c3e50;
    text-align: left;
}

.header-user-dropdown-item:hover {
    background: #f5f5f5;
}

.header-user-dropdown-item i {
    width: 18px;
    text-align: center;
}

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

.username {
    font-size: 0.95rem;
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.logout-btn-header {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.3s ease;
    white-space: nowrap;
    min-height: 36px;
}

.logout-btn-header:hover {
    background: #c0392b;
}

.logout-btn-header .logout-text {
    display: inline;
}

.logout-btn-header i {
    font-size: 0.85rem;
}

.client-combobox {
    position: relative;
    min-width: 320px;
}

.bot-filter-container {
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.client-combobox-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    display: block;
}

.client-combobox-inputwrap {
    position: relative;
    display: flex;
    align-items: center;
}

.client-combobox-input {
    width: 100%;
    padding: 10px 74px 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.client-combobox-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.client-combobox-clear,
.client-combobox-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.client-combobox-clear {
    right: 40px;
}

.client-combobox-toggle {
    right: 6px;
}

.client-combobox-clear:hover,
.client-combobox-toggle:hover {
    background-color: #f1f3f5;
    color: #2c3e50;
}

.client-combobox-toggle i.fa-chevron-down {
    transition: transform 0.2s ease;
}

.client-combobox-toggle i.fa-chevron-down.rotated {
    transform: rotate(180deg);
}

.client-combobox-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 2000;
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.client-combobox-meta {
    padding: 10px 12px;
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.client-combobox-option {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #2c3e50;
    transition: background-color 0.12s ease;
}

.client-combobox-option:hover {
    background: #f3f4f6;
}

.client-combobox-option.active {
    background: rgba(102, 126, 234, 0.12);
}

.content-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow: hidden;
}

.chats-view.section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chats-view .chats-layout {
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.content-area > .section:not(.chats-view) {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.section-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

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

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn:disabled,
.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.btn:disabled:hover,
.btn-secondary:disabled:hover {
    transform: none;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.btn-info {
    background: #3498db;
    color: white;
}

.btn-info:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Bot Cards */
.bots-list {
    padding: 20px 30px;
}

.bot-card {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}


.bot-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: white;
    transition: background-color 0.2s ease;
}

.bot-header:hover {
    background: #f8f9fa;
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.bot-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.bot-id {
    font-size: 0.9rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.bot-status {
    display: flex;
    align-items: center;
    gap: 8px;

    .connected-status-container {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 120px;
    }
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    top: 0;
    /* Asegurar que esté alineado verticalmente */
}

.status-indicator.connected {
    background: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}

.status-indicator.disconnected {
    background: #e74c3c;
}

.status-indicator.connecting {
    background: #f39c12;
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
    /* Evitar que el texto se rompa en líneas */
    min-width: 80px;
    /* Ancho mínimo para el texto */
}

.bot-header i.fa-chevron-down {
    font-size: 14px;
    color: #6c757d;
    transition: transform 0.3s ease;
    margin-left: 16px;
}

.bot-header i.fa-chevron-down.rotated {
    transform: rotate(180deg);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.bot-details h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.bot-details p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.bot-content {
    background: white;
    border-top: 1px solid #e1e5e9;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.bot-card.expanded .bot-content {
    max-height: 600px;
    padding: 24px;
}

.bot-details {
    margin-bottom: 24px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.detail-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.detail-icon i {
    font-size: 16px;
    color: #6c757d;
}

.detail-icon i.connected {
    color: #27ae60;
}

.detail-icon i.disconnected {
    color: #e74c3c;
}

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

.detail-info .label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-info .value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    word-break: break-word;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.action-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 4px;
}

.action-group-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.bot-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Modal */
[x-cloak] {
    display: none !important;
}

body:not(.app-shell-ready) .modal {
    display: none !important;
}

#app-boot-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8faf9;
}

body.app-shell-ready #app-boot-screen {
    display: none;
}

.app-boot-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #25D366;
    border-radius: 50%;
    animation: app-boot-spin 0.75s linear infinite;
}

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

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.qr-container {
    margin-bottom: 20px;
}

.qr-loading {
    padding: 40px;
    color: #7f8c8d;
}

.qr-loading i {
    font-size: 2rem;
    margin-bottom: 15px;
}

.qr-no-qr-message {
    text-align: center;
    max-width: 320px;
    padding: 16px 0;
}

.qr-no-qr-message i {
    font-size: 1.5rem;
    color: #3498db;
    margin-bottom: 12px;
}

.qr-no-qr-message p {
    margin: 0 0 12px;
    color: #555;
    line-height: 1.4;
}

.qr-code {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pairing-code-display {
    text-align: center;
    padding: 30px 20px;
    margin: 20px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.pairing-code-text {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 6px;
    color: #007bff;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.pairing-mode-toggle {
    margin-bottom: 10px;
    display: block;
    text-align: center;
    cursor: pointer;
    color: #007bff;
    text-decoration: underline;
    font-size: 14px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pairing-mode-toggle:hover {
    background-color: #f8f9fa;
    text-decoration: none;
}

.qr-instructions {
    text-align: left;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.qr-instructions p {
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9rem;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: #3498db;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 15px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Notification Styles */
.notification {
    position: relative;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
    color: white;
    font-weight: 500;
    min-width: 300px;
}

.notification-success {
    background: #27ae60;
    color: white;
}

.notification-error {
    background: #e74c3c;
    color: white;
}

.notification-info {
    background: #3498db;
    color: white;
}

.notification-warning {
    background: #f39c12;
    color: white;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .user-info {
        width: 100%;
        justify-content: flex-end;
    }

    .username {
        max-width: 150px;
        font-size: 0.9rem;
    }

    .logout-btn-header {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .bot-filter-container {
        padding: 15px 20px;
    }

    .client-combobox {
        min-width: 0;
        width: 100%;
    }

    .client-combobox-dropdown {
        max-height: 45vh;
        overflow-y: auto;
    }

    .main-header {
        padding: 15px 20px;
    }

    .content-area {
        padding: 20px;
    }

    .section-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .bot-header {
        padding: 15px;
    }

    .action-buttons {
        gap: 16px;
    }

    .action-group-buttons {
        flex-wrap: wrap;
    }

    .details-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .detail-item {
        padding: 12px;
    }

    .bot-content {
        padding: 16px !important;
    }

    .bot-card.expanded .bot-content {
        max-height: 2000px;
        /* Large enough to show all content on mobile */
        overflow-y: visible;
        /* Allow content to expand fully */
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }

    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .main-header {
        padding: 12px 15px;
    }

    .main-header h1 {
        font-size: 1.4rem;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .username {
        max-width: 120px;
        font-size: 0.85rem;
    }

    .logout-btn-header {
        padding: 10px 14px;
        min-height: 44px;
        width: auto;
    }

    .logout-btn-header .logout-text {
        display: inline;
    }

    .bot-filter-container {
        padding: 12px 15px;
    }

    .bot-header {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .bot-info {
        width: 100%;
        justify-content: space-between;
    }

    .bot-status {
        margin-top: 8px;
        min-width: 100px;
        /* Reducir en móviles */
    }

    .status-text {
        min-width: 70px;
        /* Reducir en móviles */
        font-size: 0.8rem;
    }

    .detail-item {
        padding: 10px;
    }

    .detail-icon {
        width: 32px;
        height: 32px;
    }

    .detail-icon i {
        font-size: 14px;
    }

    .bot-card.expanded .bot-content {
        max-height: 2000px;
        /* Large enough to show all content on small mobile */
        overflow-y: visible;
        /* Allow content to expand fully */
    }

    .action-buttons {
        gap: 16px;
    }

    .action-group-buttons {
        flex-direction: column;
    }

    .action-group-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        width: 100%;
    }

    .client-combobox-input {
        padding-right: 74px;
        font-size: 14px;
    }

    .client-combobox-dropdown {
        left: 0;
        right: 0;
    }

    .bot-stats {
        grid-template-columns: 1fr;
    }
}

/* New Modal Styles */
.form-help {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

.warning-box {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.warning-box-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.warning-box i {
    color: #f39c12;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.warning-box h4 {
    color: #856404;
    margin: 0;
    font-size: 1.1rem;
}

.warning-box p {
    color: #856404;
    margin: 0;
    line-height: 1.5;
}

.warning-box ul {
    color: #856404;
    margin: 0;
    padding-left: 20px;
    line-height: 1.6;
    text-align: left;
}

.warning-box li {
    margin-bottom: 8px;
}

.warning-box li:last-child {
    margin-bottom: 0;
}

.danger-box {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.danger-box h4 {
    color: #721c24;
    margin-bottom: 10px;
}

.danger-box p {
    color: #721c24;
    margin-bottom: 10px;
}

.danger-box ul {
    color: #721c24;
    text-align: left;
    width: fit-content;
    margin: auto;
}

.danger-box li {
    margin-bottom: 5px;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-1px);
}

.btn-danger:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Form Group Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #43d674;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Error Message Styles */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
}

/* Notification Styles - Updated for container-based system */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

#notification-container .notification,
.notification {
    position: relative;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.notification.success,
.notification-success {
    background-color: #28a745;
}

.notification.error,
.notification-error {
    background-color: #dc3545;
}

.notification.info,
.notification-info {
    background-color: #17a2b8;
}

.notification.warning,
.notification-warning {
    background-color: #f39c12;
    color: white;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

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

/* Queue Info Styles */
.queue-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.queue-info .value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.queue-info .timestamp {
    font-size: 12px;
    color: #6c757d;
}

.btn-icon {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.btn-icon:hover {
    background-color: #e9ecef;
    color: #495057;
}

/* Queue Details Modal Styles */
.queue-details-modal {
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.queue-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

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

.summary-item .label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item .value {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.summary-item .value.sent {
    color: #28a745;
}

.summary-item .value.failed {
    color: #dc3545;
}

.summary-item .value.completed {
    color: #28a745;
}

.summary-item .value.processing {
    color: #ffc107;
}

.summary-item .value.pending {
    color: #6c757d;
}

.summary-item .value.cancelled {
    color: #6c757d;
}

.summary-item .value.failed {
    color: #dc3545;
}

.messages-list {
    margin-top: 24px;
}

.messages-list h4 {
    margin-bottom: 16px;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.messages-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
}

.message-item {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

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

.message-item:hover {
    background-color: #f8f9fa;
}

.message-item.sent {
    border-left: 4px solid #28a745;
}

.message-item.failed {
    border-left: 4px solid #dc3545;
}

.message-item.pending {
    border-left: 4px solid #ffc107;
}

.message-item.cancelled {
    border-left: 4px solid #adb5bd;
    opacity: 0.85;
}

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

.message-recipient {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.message-recipient .contact-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.message-recipient__phone {
    font-size: 12px;
    color: #6b7280;
}

.phone-number {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.sent {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.failed {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

.message-content {
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
}

.message-id {
    font-family: 'Courier New', monospace;
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
}

.message-item .error-message {
    margin-top: 8px;
    padding: 8px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 4px;
    font-size: 12px;
    border-left: 3px solid #dc3545;
}

/* Country Selector Styles */
.phone-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.phone-input-field {
    width: 100%;
    padding: 12px 16px 12px 72px !important;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    color: #2c3e50;
    transition: all 0.3s ease;
    background-color: white;
}

.phone-input-field:focus {
    outline: none;
    border-color: #43d674;
    box-shadow: 0 0 0 3px rgba(67, 214, 116, 0.1);
}

.phone-input-field:hover {
    border-color: #43d674;
}

.country-selector {
    position: absolute;
    left: 2px;
    top: 2px;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 80px;
    height: 40px;
}

.country-selector select {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 11;
}

/* Show country options in dropdown */
.country-selector select option {
    display: block;
    padding: 8px 12px;
    background: white;
    color: #2c3e50;
    font-size: 14px;
    border: 1px solid #e1e5e9;
}

.country-selector select:focus {
    outline: none;
}

.country-display {
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px 0 0 5px;
    padding: 4px 8px;
    height: 100%;
    min-height: 40px;
    box-sizing: border-box;
}

.country-flag {
    font-size: 16px;
    line-height: 1;
}

.country-code {
    font-size: 12px;
    font-weight: 700;
    color: #2c3e50;
    min-width: 30px;
}

.country-selector:hover .country-display {
    background-color: #e9ecef;
    border-color: #dee2e6;
}


/* Responsive adjustments for queue details modal */
@media (max-width: 768px) {
    .queue-details-modal {
        width: 95%;
        margin: 10px;
    }

    .queue-summary {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }

    .messages-container {
        max-height: 300px;
    }

    .message-item {
        padding: 12px;
    }

    .message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .message-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .phone-input-field {
        padding-left: 70px;
    }

    .country-selector {
        left: 0;
    }

    .country-selector select {
        font-size: 11px;
        min-width: 40px;
        padding-right: 18px;
    }
}

/* Numbers Modal Styles */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 2px;
}

.badge-silenced {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.badge-blocked {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #dc2626;
}

.badge-inactive {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #dc2626;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 8px;
}

/* Role badges */
.badge-role-admin {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e74c3c;
    color: white;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.badge-role-cliente {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #3498db;
    color: white;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.numbers-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #64748b;
}

.summary-item i {
    font-size: 1rem;
}

.summary-item i.fa-volume-mute {
    color: #f59e0b;
}

.summary-item i.fa-ban {
    color: #dc2626;
}

.numbers-table {
    margin-top: 1rem;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.numbers-table table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.numbers-table th,
.numbers-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.numbers-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.numbers-table td {
    font-size: 0.875rem;
    color: #4b5563;
}

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

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

.moderated-contact-cell {
    line-height: 1.35;
}

.moderated-contact-primary {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
}

.moderated-contact-secondary {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.actions {
    white-space: nowrap;
}

.actions .btn {
    margin: 0 2px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6b7280;
    font-style: italic;
}

.loading-state {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.loading-state i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Detail actions button */
.detail-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.detail-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-width: auto;
}

/* Badge spacing in detail item */
.detail-item .value .badge {
    margin-right: 0.25rem;
}

.detail-item .value .badge:last-child {
    margin-right: 0;
}

/* Preferences Modal Styles */
.preferences-section {
    margin-bottom: 24px;
}

.preferences-section h4 {
    margin-bottom: 16px;
    color: #2c3e50;
    padding-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.preferences-section h4 i {
    margin-right: 8px;
}

.preferences-section-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 0 0;
    padding: 8px 4px 12px 4px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    background: transparent;
    border: none;
    border-bottom: 2px solid #3498db;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s ease;
    border-radius: 4px 4px 0 0;
}

.preferences-section-toggle:hover {
    background-color: rgba(52, 152, 219, 0.06);
}

.preferences-section-toggle:focus-visible {
    outline: 2px solid #43d674;
    outline-offset: 2px;
}

.preferences-section-toggle-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    color: #7f8c8d;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.preferences-section-toggle-chevron.is-open {
    transform: rotate(90deg);
}

.preferences-section-toggle-title {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
}

.preferences-section-toggle--bulk {
    border-bottom-color: #27ae60;
}

.preferences-section-toggle--bulk:hover {
    background-color: rgba(39, 174, 96, 0.06);
}

.preferences-section-toggle--messages {
    border-bottom-color: #f39c12;
}

.preferences-section-toggle--messages:hover {
    background-color: rgba(243, 156, 18, 0.08);
}

.preferences-section-toggle--ai {
    border-bottom-color: #9b59b6;
}

.preferences-section-toggle--ai:hover {
    background-color: rgba(155, 89, 182, 0.07);
}

.preferences-section-toggle--agents {
    border-bottom-color: #2980b9;
}

.preferences-section-toggle--agents:hover {
    background-color: rgba(41, 128, 185, 0.07);
}

.preferences-section-toggle--labels {
    border-bottom-color: #16a085;
}

.preferences-section-toggle--labels:hover {
    background-color: rgba(22, 160, 133, 0.07);
}

.preferences-section-body {
    padding-top: 16px;
}

.preferences-inline-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e1e5e9;
}

/* Mobile-style toggles (preferences modal only; scoped class) */
.pref-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.pref-switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.pref-switch-slider {
    display: block;
    width: 44px;
    height: 26px;
    border-radius: 13px;
    background: #c8cdd3;
    transition: background-color 0.2s ease;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.pref-switch-slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.pref-switch-input:checked + .pref-switch-slider {
    background: #34c759;
}

.pref-switch-input:checked + .pref-switch-slider::after {
    transform: translateX(18px);
}

.pref-switch-input:focus-visible + .pref-switch-slider {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 3px rgba(67, 214, 116, 0.35);
}

.pref-switch-input:disabled + .pref-switch-slider {
    opacity: 0.55;
    cursor: not-allowed;
}

.pref-switch:has(.pref-switch-input:disabled) {
    cursor: not-allowed;
}

.pref-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.pref-switch-row-label {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.35;
}

.pref-enricher-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    cursor: pointer;
    user-select: none;
}

.pref-enricher-chip span:last-child {
    font-size: 14px;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #43d674;
    box-shadow: 0 0 0 3px rgba(67, 214, 116, 0.1);
}

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

.form-group select {
    cursor: pointer;
    background-color: white;
}

/* Form Section Styles */
.form-section {
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.form-section:last-of-type {
    margin-bottom: 0;
}

.form-section-title {
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e1e5e9;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i {
    color: #43d674;
    font-size: 1.1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-group label i {
    color: #3498db;
    font-size: 0.9rem;
    width: 16px;
}

/* Enhanced Select Styles */
.form-select-enhanced {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
    cursor: pointer;
}

.form-select-enhanced:hover {
    border-color: #3498db;
}

.form-select-enhanced:focus {
    outline: none;
    border-color: #43d674;
    box-shadow: 0 0 0 3px rgba(67, 214, 116, 0.1);
}

.form-select-enhanced option {
    padding: 10px;
}

.form-field-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-field-label i {
    color: #3498db;
    font-size: 0.9rem;
    width: 16px;
}

.form-group input[type="radio"],
.form-group input[type="checkbox"] {
    width: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
}

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

.form-group .form-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    padding: 10px 12px;
    font-weight: 400;
    color: #333;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.form-group .form-radio-option:hover {
    border-color: #3498db;
    background: #f8fbff;
}

.form-group .form-radio-option:has(input:checked) {
    border-color: #43d674;
    background: #f0fdf4;
}

.form-group .form-radio-option:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f5f5f5;
}

.form-group .form-radio-option input[type="radio"] {
    accent-color: #43d674;
}

.form-help-text {
    margin: 8px 0 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.form-inline-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
    padding: 8px 0;
}

/* CSV Drop Zone Styles */
.csv-drop-zone {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 20px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.csv-drop-zone:hover {
    background: #e9ecef;
    border-color: #2980b9;
}

.csv-drop-zone.drag-over {
    background: #d4edda;
    border-color: #28a745;
    border-style: solid;
}

/* CSV Preview Table Styles */
.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.csv-preview-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.csv-preview-table th {
    padding: 8px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.csv-preview-table tbody tr {
    border-bottom: 1px solid #e1e5e9;
}

.csv-preview-table tbody tr:hover {
    background: #f8f9fa;
}

.csv-preview-table td {
    padding: 8px;
    color: #495057;
}

/* Chats UI – WhatsApp-like */
.chats-list-panel {
    background: #f0f2f5 !important;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease;
    position: relative;
}
.chat-list-item.chat-list-item--menu-open {
    z-index: 50;
}
.chat-list-item-menu-wrap {
    position: absolute;
    top: 8px;
    right: 8px;
    flex-shrink: 0;
    z-index: 10;
}
.chat-list-item-chevron {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #8696a0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s, color 0.15s;
}
.chat-list-item-chevron:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #667781;
}
.chat-list-item-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e9edef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
    z-index: 20;
}
.chat-list-item-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    font-size: 14px;
    color: #111b21;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.chat-list-item-dropdown-btn i {
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    font-size: 14px;
}
.chat-list-item-dropdown-btn:hover {
    background: #f5f6f6;
}
.chat-list-item-dropdown-btn--danger {
    color: #d32f2f;
}
.chat-list-item-dropdown-btn--danger:hover {
    background: #ffebee;
}

.chat-list-item-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e9edef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667781;
    font-size: 18px;
    overflow: hidden;
    position: relative;
}

.chat-list-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.chat-list-item-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    font-weight: 600;
    color: #667781;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Chats filter: Solo yo / De todos — clear selected state */
.chats-filter-buttons {
    display: flex;
    gap: 8px;
}
.chats-filter-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e9edef;
    background: #fff;
    color: #667781;
    border-radius: 8px;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chats-filter-btn:hover {
    background: #f0f2f5;
    border-color: #d1d7db;
}
.chats-filter-btn-active {
    background: #00a884 !important;
    border-color: #00a884 !important;
    color: #fff !important;
}
.chats-filter-btn-active:hover {
    background: #008f72 !important;
    border-color: #008f72 !important;
    color: #fff !important;
}

/* Chats filter: "Solo no leídos" — fila aparte, switch sutil */
.chats-filter-unread-row {
    display: flex;
    align-items: center;
}
.chats-filter-unread-row--with-labels {
    gap: 12px;
    flex-wrap: wrap;
}
.chats-label-filter-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Chats label filter dropdown (like user menu) */
.chats-label-filter-dropdown-wrap {
    position: relative;
}
.chats-label-filter-dropdown-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    gap: 6px;
}
.chats-label-filter-dropdown-btn:hover {
    background: #f5f5f5;
}
.chats-label-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}
.chats-label-filter-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    text-align: left;
}
.chats-label-filter-dropdown-item:hover {
    background: #f5f5f5;
}
.chats-label-filter-dropdown-item-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.chats-label-filter-dropdown-item--active {
    background: #e8f4fd;
    color: #0a6ed1;
}
.chats-label-filter-dropdown-item--active:hover {
    background: #d6ebfc;
}
.chats-unread-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #667781;
    transition: color 0.15s;
}
.chats-unread-switch:hover {
    color: #111b21;
}
.chats-unread-switch-track {
    display: inline-flex;
    align-items: center;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #e9edef;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.chats-unread-switch-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-left: 2px;
    transition: transform 0.2s ease;
}
.chats-unread-switch-on .chats-unread-switch-track {
    background: #00a884;
}
.chats-unread-switch-on .chats-unread-switch-thumb {
    transform: translateX(16px);
}
.chats-unread-switch-label {
    font-size: 12px;
    font-weight: 400;
}

.chat-list-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-list-item-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding-right: 20px; /* espacio para el chevron, evita solapamiento con el indicador de no leídos */
}

.chat-list-item-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 15px;
    color: #111b21;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item-row-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-list-item-muted-slot {
    width: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-list-item-muted-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8696a0;
    font-size: 14px;
    pointer-events: none;
}

.chat-list-item-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
    min-width: 0;
}

.chat-list-item-meta {
    font-size: 13px;
    color: #667781;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

/* Inbound presence ("escribiendo..."/"grabando...") in the sidebar row, WhatsApp-style. */
.chat-list-item-meta.chat-list-item-presence {
    color: #00a884;
}

.chat-list-item-time {
    font-size: 12px;
    color: #667781;
    flex-shrink: 0;
}

.chats-list-panel .chat-list-item:hover {
    background: #f5f6f6 !important;
}

.chats-list-panel .chat-list-item.active {
    background: #e9edef !important;
}

/* Panel de detalle: mismo fondo que el chat cuando no hay selección */
.chats-detail-panel {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: #efeae2;
    overflow: hidden;
}

.chats-detail-main {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chats-detail-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.chats-detail-column .chats-chat-header,
.chats-detail-column .chat-search-bar,
.chats-detail-column .chat-scheduled-back-bar,
.chats-detail-column .chat-scheduled-bar {
    flex-shrink: 0;
}

.chats-messages-scroll-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #efeae2;
}

.chats-empty-detail {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667781;
    font-size: 15px;
    background: #efeae2;
}

.chats-detail-panel .chats-chat-header {
    background: #00a884;
    color: #fff;
    border-bottom: none;
}

.chats-detail-panel .chats-chat-header strong {
    color: #fff;
}

.chats-detail-panel .chats-chat-header .chats-chat-header-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chats-detail-panel .chats-chat-header .chats-chat-header-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

/* Inbound presence sub-line under the contact name in the open chat header. */
.chats-chat-header-presence {
    font-size: 12px;
    font-weight: 600;
    color: #7ff0c8;
}

.chats-detail-panel .chats-messages {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-height: 0;
}

.chats-detail-panel .chats-scheduled-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

/* In-chat search bar (between header and messages) */
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f2f5;
    border-bottom: 1px solid #e9edef;
}
.chat-search-calendar-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e9edef;
    border-radius: 8px;
    background: #fff;
    color: #54656f;
    cursor: pointer;
}
.chat-search-calendar-btn:hover {
    background: #e9edef;
}
.chat-search-calendar-btn--active {
    background: var(--primary, #25d366);
    color: #fff;
    border-color: var(--primary, #25d366);
}
.chat-search-calendar-btn--active:hover {
    background: #20bd5a;
    color: #fff;
}
.chat-search-date-wrap {
    position: relative;
}
.chat-search-date-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    min-width: 260px;
    background: #fff;
    border: 1px solid #e9edef;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.chat-search-date-dropdown-inner {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-search-date-label {
    font-size: 13px;
    font-weight: 600;
    color: #111b21;
    margin: 0;
}
.chat-search-date-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e9edef;
    border-radius: 8px;
    font-size: 14px;
    color: #111b21;
    background: #fff;
    box-sizing: border-box;
}
.chat-search-date-input:focus {
    outline: none;
    border-color: var(--primary, #25d366);
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}
.chat-search-date-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.chat-search-date-clear,
.chat-search-date-close {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}
.chat-search-date-clear {
    background: transparent;
    color: #667781;
}
.chat-search-date-clear:hover {
    background: #f0f2f5;
    color: #111b21;
}
.chat-search-date-close {
    background: var(--primary, #25d366);
    color: #fff;
}
.chat-search-date-close:hover {
    background: #20bd5a;
    color: #fff;
}
.chat-search-date-close:disabled {
    opacity: 0.5;
    cursor: default;
    background: var(--primary, #25d366);
}
.chat-search-date-close:disabled:hover {
    background: var(--primary, #25d366);
    color: #fff;
}
.chat-search-in-chat-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #e9edef;
    border-radius: 8px;
    font-size: 14px;
}
.chat-search-results {
    background: #fff;
    border-bottom: 1px solid #e9edef;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}
.chat-search-result-item {
    padding: 8px 12px;
    font-size: 13px;
    color: #111b21;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
}
.chat-search-result-item:hover {
    background: #e9edef !important;
}
.chat-search-result-item:last-child {
    border-bottom: none;
}
.chat-search-result-item mark {
    background: #fff3cd;
    padding: 0 1px;
}

/* Chat list: label chips (colored dots with tooltip); min-height reserves space when empty */
.chat-list-item-labels {
    min-height: 20px;
}
.chat-list-label-chip {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* "Requires attention": muted chat with no agent assigned. Visually distinct
   from label/list chips (pill with text, warning color). */
.chat-list-attention-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: #fff3cd;
    color: #8a5a00;
    border: 1px solid #ffe08a;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Chats filters: label filter chips */
.chats-label-filter-wrap .chats-label-filter-chips {
    min-height: 0;
}
.chat-label-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.chat-label-filter-chip:hover {
    background: #f5f5f5;
    border-color: #ccc;
}
.chat-label-filter-chip-active {
    background: var(--chip-color, #e0e0e0) !important;
    border-color: var(--chip-color, #ccc) !important;
    color: #fff;
}

/* Chat detail: labels section (chips with remove + add dropdown) */
.chat-detail-label-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 1px rgba(0,0,0,0.3);
}
.chat-detail-label-chip button {
    padding: 0;
    margin: 0;
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-detail-label-chip button:hover {
    background: rgba(0,0,0,0.4);
}
.chat-detail-label-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Globos tipo WhatsApp: propios a la derecha, del contacto a la izquierda */
.chat-msg-from-me {
    background: #d9fdd3 !important;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    border-radius: 8px;
    transition: box-shadow 0.45s ease-out;
    align-self: flex-end !important;
    margin-left: auto;
    margin-right: 8px;
    max-width: 75%;
}

.chat-msg-from-them {
    background: #fff !important;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    border-radius: 8px;
    transition: box-shadow 0.45s ease-out;
    align-self: flex-start !important;
    margin-right: auto;
    margin-left: 8px;
    max-width: 75%;
}

.chat-msg-sticker {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    width: fit-content;
    max-width: 75%;
}

.chat-msg-from-me.chat-msg-sticker {
    align-items: flex-end;
}

.chat-msg-from-them.chat-msg-sticker {
    align-items: flex-start;
}

/* Contenedor general del mensaje (para resaltado) */
.chat-msg {
    position: relative;
    padding: 8px 12px;
}

.chat-msg-pending {
    opacity: 0.65;
}

/* Globos con menú de acciones (chevron): usar chat-msg--has-actions + .chat-msg-actions-btn */
.chat-msg--has-actions {
    padding-right: 28px;
}

.chat-msg-actions-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #667781;
    padding: 2px 4px;
    line-height: 1;
}

/* Resaltado temporal estilo WhatsApp: capa azul semitransparente con fade-in y fade-out */
.chat-msg.chat-msg-highlighted::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(0, 120, 215, 0.25);
    pointer-events: none;
    animation: chat-msg-highlight-fade 1s ease-out forwards;
}

@keyframes chat-msg-highlight-fade {
    0%   { opacity: 0; }
    20%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

.chat-msg-timestamp-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

.chat-msg-timestamp {
    margin-left: auto;
}

.chat-msg-sticker .chat-msg-timestamp-row {
    width: auto;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.chat-msg-from-me.chat-msg-sticker .chat-msg-timestamp-row {
    background: #d9fdd3;
}

.chat-msg-from-them.chat-msg-sticker .chat-msg-timestamp-row {
    background: #fff;
}

.chat-msg-sticker .chat-msg-timestamp {
    margin-left: 0;
}

.chats-detail-panel .chats-input-area {
    flex-shrink: 0;
    background: #f0f2f5;
    border-top: 1px solid #e9edef;
    padding: 12px 16px;
    box-sizing: border-box;
}

.chat-compose-form {
    --compose-control-height: 40px;
    --compose-line-height: 20px;
    --compose-input-padding-x: 10px;
    --compose-input-padding-y: 9px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    min-width: 0;
    width: 100%;
}

.chat-compose-form > .btn,
.chat-compose-form .quick-replies-trigger-btn,
.chat-compose-form .stickers-trigger-btn,
.chat-compose-form .compose-mic-btn {
    flex-shrink: 0;
    align-self: flex-end;
    box-sizing: border-box;
    width: var(--compose-control-height);
    min-width: var(--compose-control-height);
    height: var(--compose-control-height);
    min-height: var(--compose-control-height);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-compose-form > .quick-replies-trigger-wrap,
.chat-compose-form > .stickers-input-wrap,
.chat-compose-form > .chat-send-actions,
.chat-compose-form > div:has(.compose-mic-btn) {
    flex-shrink: 0;
    align-self: flex-end;
}

.chat-compose-form .chat-send-actions {
    height: var(--compose-control-height);
}

.chat-compose-input {
    flex: 1;
    min-width: 0;
    align-self: flex-end;
    padding: var(--compose-input-padding-y) var(--compose-input-padding-x);
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: none;
    overflow-y: hidden;
    font-size: 14px;
    line-height: var(--compose-line-height);
    height: var(--compose-control-height);
    min-height: var(--compose-control-height);
    max-height: calc(var(--compose-line-height) * 3 + var(--compose-input-padding-y) * 2 + 2px);
    field-sizing: fixed;
    font-family: inherit;
    box-sizing: border-box;
    margin: 0;
    vertical-align: bottom;
}

.chat-compose-input--scroll {
    overflow-y: auto;
}

.chats-context-panel {
    flex-shrink: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f0f2f5 !important;
    border-left: 1px solid #e9edef !important;
}

/* Editor visual de contexto (clave-valor, un nivel) */
.context-editor-scroll {
    min-height: 0;
}
.context-editor-hint {
    line-height: 1.4;
}
.context-entry-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}
.context-key-input {
    flex: 0 0 90px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
}
.context-key-input::placeholder {
    color: #999;
}
.context-value-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
}
.context-value-input::placeholder {
    color: #999;
}
.context-entry-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #666;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.context-entry-remove:hover {
    background: #fee;
    color: #c00;
    border-color: #fcc;
}
.context-add-btn {
    width: 100%;
    margin-top: 4px;
    font-size: 13px;
}

/* Quick replies popup and slash dropdown */
.quick-replies-trigger-wrap {
    position: relative;
    flex-shrink: 0;
    align-self: flex-end;
}

.quick-replies-input-wrap {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: flex-end;
}

.quick-replies-input-wrap .chat-compose-input,
.quick-replies-input-wrap .compose-recording-bar,
.quick-replies-input-wrap .compose-audio-draft {
    width: 100%;
}
.quick-replies-trigger-btn {
    flex-shrink: 0;
}
.quick-replies-popup,
.quick-replies-slash-popup {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.quick-replies-popup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.quick-replies-popup-item:last-child {
    border-bottom: none;
}
.quick-replies-popup-item:hover,
.quick-replies-slash-focused {
    background: #f0f4ff;
}
.quick-replies-admin-list .quick-replies-admin-item:hover {
    background: #f9f9f9;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}
.btn-icon {
    padding: 8px 10px;
    min-width: 36px;
    line-height: 1;
}
.btn-icon i {
    display: block;
}

/* Stickers popup */
.stickers-popup {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    width: 340px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.stickers-popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.stickers-search-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 13px;
    min-width: 0;
}
.stickers-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: #444;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.stickers-edit-toggle.is-active {
    background: #f0f4ff;
    color: #2563eb;
    border-color: #c7d2fe;
}
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}
.sticker-item {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f6f7f8;
    cursor: pointer;
}
.sticker-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s;
}
.sticker-item-placeholder {
    color: #98a2a8;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sticker-item:not(.sticker-item--editing) img:hover {
    transform: scale(1.08);
}
.sticker-item--editing img {
    cursor: default;
    animation: sticker-shake 0.5s ease-in-out infinite;
}
.sticker-item--editing {
    cursor: default;
}
.sticker-delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #dc2626;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    z-index: 2;
}
.sticker-delete-btn:hover {
    background: #b91c1c;
}
@keyframes sticker-shake {
    0% { transform: rotate(-4deg); }
    50% { transform: rotate(4deg); }
    100% { transform: rotate(-4deg); }
}

/* Quick replies admin modal */
.quick-replies-admin-modal-content {
    max-width: 560px;
}
.quick-replies-admin-bot-badge {
    font-weight: normal;
    color: #666;
    font-size: 0.9em;
}
.quick-replies-admin-empty-hint {
    padding: 20px 16px;
    color: #666;
    font-size: 14px;
    text-align: center;
}
.quick-replies-admin-body {
    padding-top: 4px;
}
.quick-replies-admin-form {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}
.quick-replies-admin-form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.quick-replies-admin-input-name {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
}
.quick-replies-admin-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 72px;
    box-sizing: border-box;
}
.quick-replies-admin-error {
    margin-bottom: 12px;
}
.quick-replies-admin-loading {
    text-align: center;
    padding: 24px;
    color: #666;
}
.quick-replies-admin-empty-list {
    padding: 20px;
    color: #667781;
    text-align: center;
    font-size: 14px;
}
.quick-replies-admin-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    background: #fff;
}
.quick-replies-admin-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}
.quick-replies-admin-item:last-child {
    border-bottom: none;
}
.quick-replies-admin-item-content {
    flex: 1;
    min-width: 0;
}
.quick-replies-admin-item-name {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: #212529;
}
.quick-replies-admin-item-body {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.quick-replies-admin-item-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}
.quick-replies-admin-delete-btn {
    color: #c00;
}
.quick-replies-admin-delete-btn:hover {
    color: #a00;
}
.quick-replies-admin-delete-confirm {
    margin-top: 16px;
    padding: 14px 16px;
    background: #fff8e6;
    border: 1px solid #ffecb3;
    border-radius: 8px;
    font-size: 14px;
}
.quick-replies-admin-delete-confirm button {
    margin-left: 8px;
}

/* Bot container logs modal (admin) */
.modal-content--bot-logs {
    max-width: min(960px, 96vw);
    width: 100%;
}

.bot-logs-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 320px;
}

.bot-logs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.bot-logs-search-input {
    flex: 1;
    min-width: 160px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
}

.bot-logs-toolbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bot-logs-hit-counter {
    font-size: 13px;
    color: #6c757d;
    min-width: 7rem;
}

.bot-logs-truncation-warn {
    font-size: 12px;
    color: #856404;
    margin: 0;
}

.bot-logs-viewport-wrap {
    position: relative;
    flex: 1;
    min-height: 280px;
    max-height: min(60vh, 520px);
    overflow: auto;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    scroll-behavior: smooth;
}

.bot-logs-pre {
    margin: 0;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.45;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

.bot-logs-pre .bot-log-hit {
    background: rgba(255, 193, 7, 0.35);
    color: #fff;
    padding: 0 1px;
    border-radius: 2px;
}

.bot-logs-pre .bot-log-hit-active {
    background: rgba(255, 152, 0, 0.85);
    color: #1a1a1a;
    outline: 1px solid #ffb74d;
}

.bot-logs-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(30, 30, 30, 0.85);
    color: #ccc;
    font-size: 14px;
    z-index: 2;
}

.locale-settings-card .locale-settings-hint {
    color: #666;
    font-size: 14px;
    margin: 0 0 16px;
}
.locale-settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.locale-select-wrap {
    position: relative;
    flex: 1 1 220px;
    max-width: 280px;
    min-width: 180px;
}
.locale-select-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}
.locale-select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
    pointer-events: none;
}
.locale-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 40px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background-color: #fff;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.locale-select:hover:not(:disabled) {
    border-color: #c7d2fe;
    background-color: #f8fafc;
}
.locale-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.locale-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f3f4f6;
}
.locale-settings-apply {
    flex: 0 0 auto;
    min-height: 44px;
}
.locale-settings-error {
    margin-top: 12px;
}