:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --bot-bubble: #1e3a8a;
    --user-bubble: #334155;
    --status-green: #10b981;
    --status-red: #ef4444;
    --status-orange: #f59e0b;
    --border-color: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.summary-cards-row {
    display: flex;
    gap: 15px;
    padding: 15px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.summary-cards-row::-webkit-scrollbar {
    height: 4px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.summary-card span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card h3 {
    font-size: 1.2rem;
    color: var(--accent-blue);
    margin: 0;
}

.contact-origin {
    font-size: 0.75rem;
    color: var(--status-green);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 5px;
    display: inline-block;
}

/* Sidebar */
.sidebar {
    width: 350px;
    min-width: 350px;
    flex: 0 0 350px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--accent-blue);
}

#searchInput {
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    outline: none;
}

#searchInput:focus {
    border-color: var(--accent-blue);
}

.contact-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
}

.contact-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-item:hover,
.contact-item.active {
    background-color: var(--bg-hover);
}

.contact-info {
    flex-grow: 1;
    overflow: hidden;
}

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

.contact-phone {
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-bottom: 5px;
    display: block;
}

.contact-last-msg {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.contact-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 10px;
    flex-shrink: 0;
}

.status-bot-active {
    background-color: var(--status-green);
}

.status-bot-silenced {
    background-color: var(--status-red);
}

.status-bot-waiting {
    background-color: var(--status-orange);
}

/* Chat Area */
.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
}

.no-chat-selected {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.active-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hidden {
    display: none !important;
}

/* Chat Header */
.chat-header {
    padding: 15px 25px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

#currentContactName {
    font-size: 1.2rem;
    font-weight: 600;
}

.edit-icon {
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
}

.edit-icon:hover {
    opacity: 1;
    color: var(--accent-blue);
}

#editNameInput {
    background: var(--bg-dark);
    border: 1px solid var(--accent-blue);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
}

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

.contact-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: normal;
}

.contact-phone {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.bot-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bot-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

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

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
}

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

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

.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--status-red);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--status-green);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.status-text {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 90px;
}

.handoff-banner {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--status-red);
    padding: 10px 25px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

/* Message History */
.message-history {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}


.message-user {
    align-self: flex-start;
    background-color: var(--user-bubble);
    border-bottom-left-radius: 2px;
}

.message-assistant {
    align-self: flex-end;
    background-color: var(--bot-bubble);
    border-bottom-right-radius: 2px;
}

.message-quote {
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--accent-blue);
    padding: 5px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-meta {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    display: block;
    text-align: right;
    margin-top: 5px;
}

/* Chat Input */
.chat-input-area {
    padding: 20px 25px;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    gap: 15px;
    position: relative;
}

/* Reply Preview */
.reply-preview {
    background-color: var(--bg-hover);
    border-left: 4px solid var(--accent-blue);
    margin: 0 20px;
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideUp 0.2s ease-out;
}

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

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

.reply-content {
    overflow: hidden;
}

.reply-label {
    font-size: 0.75rem;
    color: var(--accent-blue);
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

#replyPreviewText {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.cancel-reply {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

.cancel-reply:hover {
    color: var(--status-red);
}


#messageInput {
    flex-grow: 1;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    resize: none;
    min-height: 45px;
    max-height: 120px;
    overflow-y: auto;
}

#messageInput:focus {
    border-color: var(--accent-blue);
}

.btn-send {
    background-color: var(--accent-blue);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.btn-send:hover {
    background-color: var(--accent-blue-hover);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--status-red);
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-box {
    background-color: var(--bg-panel);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.login-box h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark);
    color: white;
    outline: none;
}

.login-box input:focus {
    border-color: var(--accent-blue);
}

.login-box .btn {
    width: 100%;
    padding: 12px;
}

.login-error {
    color: var(--status-red) !important;
    font-size: 0.85rem;
    margin-top: 15px;
    margin-bottom: 0 !important;
}

/* Nuevo Distintivo */
.new-badge {
    background: #25d366;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: bold;
    vertical-align: middle;
    display: inline-block;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(37, 211, 102, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

#syncIndicator {
    width: 8px;
    height: 8px;
    background-color: #444;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#syncIndicator.syncing {
    background-color: #25d366;
    box-shadow: 0 0 8px #25d366;
    transform: scale(1.2);
}

/* Cabecera del Sidebar */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

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

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, transform 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
}

.icon-btn:hover {
    color: var(--accent-blue);
    transform: rotate(45deg);
}

/* Panel Deslizante (Drawer) */
.utils-drawer {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-panel);
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    padding: 25px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow-x: hidden;
    overflow-y: auto;
}

.hidden-drawer {
    transform: translateX(-100%);
}

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

.drawer-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.drawer-item {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-item:hover {
    border-color: var(--accent-blue);
    background: var(--bg-hover);
    transform: translateX(5px);
}

/* Tarjetas de Datos (Para no mostrar JSON) */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
}

.status-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.status-card i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

/* --- Analytics Styles --- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.analytics-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(30, 58, 138, 0.2) 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    text-align: center;
    transition: transform 0.2s;
}

.analytics-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-blue);
}

.analytics-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.analytics-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-blue);
    word-break: break-word;
}

.chart-container {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding-top: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.chart-bar {
    width: 100%;
    background: var(--accent-blue);
    border-radius: 4px 4px 0 0;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 12px;
    opacity: 0.8;
}

.chart-bar:hover {
    opacity: 1;
    box-shadow: 0 0 15px var(--accent-blue);
}

.chart-bar::after {
    content: attr(data-value);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 0.2s;
}

.chart-bar:hover::after {
    opacity: 1;
}

.chart-label {
    font-size: 9px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.chart-container {
    overflow-x: auto;
    padding-bottom: 10px;
}

.chart-bar.incoming {
    background: var(--status-green);
    opacity: 0.6;
}

.chart-bar.ai-reply {
    background: var(--accent-blue);
    opacity: 0.8;
}

.latency-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.latency-good { background: var(--status-green); }
.latency-warn { background: var(--status-orange); }
.latency-bad { background: var(--status-red); }

.status-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.status-value {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 5px;
    color: #fff;
    word-break: break-all;
    line-height: 1.2;
}

.doc-list {
    list-style: none;
    padding: 0;
}

.doc-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--accent-blue);
    gap: 15px;
}

.doc-item > div:first-child {
    flex: 1;
    min-width: 0;
}

.doc-item strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal de Utilidades con Glassmorphism */
.utility-modal-content {
    background: rgba(30, 41, 59, 0.7) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    max-width: 800px !important;
    width: 90% !important;
}

.utility-body {
    max-height: 70vh;
    overflow-y: auto;
    color: #e2e8f0;
    margin-top: 10px;
}

.message-image {
    margin-bottom: 8px;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0);
}

.message-image img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image img:hover {
    transform: scale(1.05);
}

/* Estilos Omnicanal para Modo Oscuro */
.channel-tabs {
    display: flex;
    padding: 12px;
    background: #0f172a; /* Fondo oscuro integrado */
    gap: 8px;
    border-bottom: 1px solid #1e293b;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #334155;
    border-radius: 6px;
    background: #1e293b;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.tab-btn:hover:not(.active) {
    background: #334155;
    color: white;
}

.tab-btn.active {
    background: #1F4C8F;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(31, 76, 143, 0.4);
}

.tab-btn img {
    opacity: 0.9;
}

/* --- Main Top Navbar --- */
.main-top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 0 25px;
    height: 64px;
    flex-shrink: 0;
    z-index: 100;
}

.navbar-logo {
    display: flex;
    flex-direction: column;
}

.navbar-logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.navbar-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.navbar-tabs {
    display: flex;
    gap: 8px;
    height: 100%;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0 16px;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

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

.nav-tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    font-weight: 600;
    background-color: rgba(59, 130, 246, 0.05);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* --- Standalone Config Dashboard Layout --- */
.config-standalone-layout {
    display: flex;
    flex: 1;
    height: 100%;
    width: 100%;
    background-color: var(--bg-dark);
    overflow: hidden;
}

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

.config-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.config-sidebar-header h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.config-cat-list {
    list-style: none;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.config-cat-item {
    padding: 14px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.config-cat-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.config-cat-item.active {
    background-color: var(--accent-blue);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.config-main-panel {
    flex: 1;
    padding: 35px 45px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    max-width: 1100px;
}

.config-loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* --- Clean Human-Friendly Cards --- */
.config-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.config-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.config-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.config-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.config-card-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-input-clean {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s;
}

.config-input-clean:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

textarea.config-input-clean {
    min-height: 110px;
    resize: vertical;
}

.config-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-top: 5px;
}

.save-status-msg {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--status-green);
    opacity: 0;
    transition: opacity 0.3s;
}

.save-status-msg.show {
    opacity: 1;
}

/* --- Advisors Visual Table --- */
.advisors-table-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-dark);
}

.advisors-table {
    width: 100%;
    border-collapse: collapse;
}

.advisors-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

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

.advisor-input {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 0.95rem;
}

.advisor-input:focus {
    background: var(--bg-panel);
    border-color: var(--accent-blue);
    outline: none;
}

.btn-remove-row {
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-red);
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-remove-row:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-add-advisor {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    border: 1px dashed var(--accent-blue);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-add-advisor:hover {
    background: rgba(59, 130, 246, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 6px;
    font-weight: 500;
}

textarea.advisor-input {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    line-height: 1.4;
}

.btn-add-phrase-sm:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* ── Temperature Badges ── */
.temp-badge {
    font-size: 0.75rem;
    margin-right: 2px;
    vertical-align: middle;
}

/* ── Lead Profile Sidebar ── */
.lead-profile-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-profile-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px 10px;
}

.lead-profile-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}

.lead-profile-field:hover {
    background: rgba(255,255,255,0.06);
}

.lead-field-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.lead-field-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lead-field-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.lead-field-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
    margin-top: 2px;
}