/* BSN Imóveis - LEADFLOW IA Web Interface */
/* Color Palette */
:root {
    --bsn-primary: #0095F6;
    --bsn-secondary: #1877F2;
    --bsn-dark: #1a1a2e;
    --bsn-light: #f8f9fa;

    --bg-main: #e5ddd5;
    --bg-chat: #ffffff;
    --bg-panel: #ffffff;

    --msg-user: #dcf8c6;
    --msg-agent: #ffffff;

    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;

    --status-pronto: #28a745;
    --status-coletando: #0095F6;
    --status-aguardando: #ffc107;
    --status-desqualificado: #dc3545;

    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-chat);
    box-shadow: var(--shadow);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: var(--bsn-primary);
    color: white;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo-bsn {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo-imoveis {
    font-size: 20px;
    font-weight: 400;
    opacity: 0.9;
}

.header-subtitle {
    flex: 1;
    font-size: 14px;
    opacity: 0.85;
}

.btn-reset,
.btn-download {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-reset:hover,
.btn-download:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.welcome-message p {
    margin: 8px 0;
}

/* Messages */
.message {
    display: flex;
    max-width: 70%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
}

.message.agent {
    align-self: flex-start;
}

.message-content {
    padding: 10px 14px;
    border-radius: 8px;
    line-height: 1.4;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
    background: var(--msg-user);
    border-bottom-right-radius: 2px;
}

.message.agent .message-content {
    background: var(--msg-agent);
    border-bottom-left-radius: 2px;
}

.message.loading .message-content {
    color: var(--text-muted);
    font-style: italic;
}

/* Input Area */
.input-area {
    display: flex;
    padding: 12px 20px;
    background: var(--bg-chat);
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#message-input:focus {
    border-color: var(--bsn-primary);
}

.btn-send {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--bsn-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-send:hover {
    background: var(--bsn-secondary);
}

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

/* Right Panel - Data Panel */
.data-panel {
    width: 320px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
}

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

/* Data Items */
.data-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.data-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
}

.data-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.data-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.data-value.positive {
    color: var(--status-pronto);
}

.data-value.negative {
    color: var(--status-desqualificado);
}

.co-buyer-item {
    padding-left: 38px;
    background: rgba(0, 149, 246, 0.05);
    margin: -4px 0;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Status Section */
.status-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.status-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-badge-container {
    text-align: center;
    margin-bottom: 16px;
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.status-badge.pronto {
    background: var(--status-pronto);
    color: white;
}

.status-badge.coletando {
    background: var(--status-coletando);
    color: white;
}

.status-badge.aguardando {
    background: var(--status-aguardando);
    color: var(--text-primary);
}

.status-badge.desqualificado {
    background: var(--status-desqualificado);
    color: white;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 16px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bsn-primary), var(--bsn-secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Blockers */
.blockers-container {
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.blockers-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--status-desqualificado);
    margin-bottom: 8px;
}

.blockers-list {
    list-style: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.blockers-list li {
    padding: 4px 0;
    padding-left: 12px;
    position: relative;
}

.blockers-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--status-desqualificado);
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .data-panel {
        width: 100%;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .message {
        max-width: 85%;
    }
}

@media (max-width: 600px) {
    .header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-subtitle {
        order: 3;
        width: 100%;
        text-align: center;
    }

    .btn-reset {
        margin-left: auto;
    }

    .data-panel {
        padding: 12px;
    }

    .data-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .data-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 8px;
        background: var(--bsn-light);
        border-radius: 8px;
        border-bottom: none;
    }

    .data-value {
        text-align: left;
    }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.data-panel::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.data-panel::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.data-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.data-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* =============================================================================
   LOGIN PAGE
   ============================================================================= */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bsn-dark) 0%, var(--bsn-secondary) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.login-header .logo {
    justify-content: center;
    margin-bottom: 16px;
}

.login-header .logo-bsn {
    color: var(--bsn-primary);
}

.login-header .logo-imoveis {
    color: var(--text-secondary);
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.login-error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--status-desqualificado);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

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

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

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--bsn-primary);
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.1);
}

.btn-login {
    padding: 14px;
    background: var(--bsn-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.btn-login:hover {
    background: var(--bsn-secondary);
}

/* =============================================================================
   DASHBOARD LAYOUT
   ============================================================================= */

.dashboard-page {
    background: var(--bsn-light);
}

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

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bsn-dark);
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .logo-bsn {
    color: var(--bsn-primary);
}

.sidebar-header .logo-imoveis {
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
}

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

.nav-item.active {
    background: var(--bsn-primary);
    color: white;
}

.nav-icon {
    font-size: 18px;
}

.nav-label {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    margin-bottom: 12px;
}

.user-email {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.btn-logout {
    display: block;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    text-align: center;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.dashboard-page .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* =============================================================================
   KANBAN BOARD (Leads Page)
   ============================================================================= */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    height: 100%;
    min-height: 500px;
}

.kanban-column {
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    color: white;
}

.column-header h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.column-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.column-header.coletando { background: var(--status-coletando); }
.column-header.pronto { background: var(--status-pronto); }
.column-header.aguardando { background: var(--status-aguardando); color: var(--text-primary); }
.column-header.desqualificado { background: var(--status-desqualificado); }

.column-cards {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Lead Cards */
.lead-card {
    background: var(--bsn-light);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.card-phone {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-phone-secondary {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.followup-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--status-aguardando);
    color: var(--text-primary);
}

.followup-badge.due {
    background: var(--status-desqualificado);
    color: white;
}

.status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-badge.escalated {
    background: var(--status-pronto);
    color: white;
}

.status-badge.ended {
    background: var(--text-muted);
    color: white;
}

.docs-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e3f2fd;
    color: #1565c0;
}

.crm-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.modal-docs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bsn-light);
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.doc-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.doc-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.doc-name {
    font-size: 13px;
    color: var(--bsn-primary);
    text-decoration: none;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-name:hover {
    text-decoration: underline;
}

.doc-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.card-location {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.progress-bar-mini {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: var(--bsn-primary);
    border-radius: 2px;
}

.progress-text {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
}

.card-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-item strong {
    color: var(--text-primary);
}

/* =============================================================================
   MODAL
   ============================================================================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-section {
    margin-bottom: 24px;
}

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

.modal-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bsn-light);
    border-radius: 6px;
}

.modal-messages {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-message {
    padding: 12px;
    border-radius: 8px;
}

.modal-message.user {
    background: var(--msg-user);
    margin-left: 40px;
}

.modal-message.agent {
    background: var(--msg-agent);
    border: 1px solid var(--border-color);
    margin-right: 40px;
}

.message-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.message-content {
    font-size: 14px;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

.no-messages {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

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

/* =============================================================================
   WHATSAPP PAGE
   ============================================================================= */

.whatsapp-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.whatsapp-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow);
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected { background: var(--status-pronto); }
.status-dot.connecting { background: var(--status-aguardando); }
.status-dot.disconnected { background: var(--text-muted); }
.status-dot.error { background: var(--status-desqualificado); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.qr-container {
    padding: 24px;
}

.qr-placeholder {
    padding: 40px;
    color: var(--text-secondary);
}

.qr-placeholder .error-text {
    color: var(--status-desqualificado);
    font-weight: 500;
}

.qr-hint {
    font-size: 14px;
    margin-top: 8px;
}

.qr-image {
    max-width: 280px;
    border-radius: 12px;
    border: 4px solid var(--border-color);
}

.connected-info {
    padding: 24px;
}

.connected-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

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

.connected-message {
    color: var(--text-secondary);
    font-size: 14px;
}

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

.whatsapp-log-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.whatsapp-log-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.log-container {
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    background: var(--bsn-light);
    border-radius: 8px;
    padding: 12px;
}

.log-entry {
    padding: 6px 0;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    min-width: 70px;
}

.log-message {
    color: var(--text-primary);
}

.log-entry.success .log-message { color: var(--status-pronto); }
.log-entry.error .log-message { color: var(--status-desqualificado); }
.log-entry.warning .log-message { color: var(--status-aguardando); }

.whatsapp-instructions {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.whatsapp-instructions h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.whatsapp-instructions ol {
    margin-left: 20px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.instruction-note {
    margin-top: 16px;
    padding: 12px;
    background: var(--bsn-light);
    border-radius: 8px;
    font-size: 13px;
}

.instruction-note code {
    background: var(--bsn-dark);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* =============================================================================
   CRM PAGE
   ============================================================================= */

.crm-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.crm-status-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.crm-status-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

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

.status-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.status-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.crm-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card.success { border-top: 4px solid var(--status-pronto); }
.stat-card.error { border-top: 4px solid var(--status-desqualificado); }

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card.success .stat-number { color: var(--status-pronto); }
.stat-card.error .stat-number { color: var(--status-desqualificado); }

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.crm-log-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

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

.log-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.log-table-container {
    overflow-x: auto;
}

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

.log-table th,
.log-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.log-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bsn-light);
}

.log-table td {
    font-size: 13px;
}

.log-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.log-status.success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--status-pronto);
}

.log-status.error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--status-desqualificado);
}

.log-message-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 32px !important;
}

.empty-row.error {
    color: var(--status-desqualificado);
}

/* =============================================================================
   DATABASE PAGE
   ============================================================================= */

.database-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1200px;
}

.db-status-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.db-connection-info {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.info-label {
    font-size: 13px;
    color: var(--text-muted);
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: monospace;
    background: var(--bsn-light);
    padding: 4px 12px;
    border-radius: 4px;
}

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

.db-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.db-table-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

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

.table-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
}

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

.db-table th,
.db-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.db-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bsn-light);
}

.db-table td {
    font-size: 13px;
}

.classification-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.classification-badge.coletando {
    background: rgba(0, 149, 246, 0.1);
    color: var(--status-coletando);
}

.classification-badge.pronto {
    background: rgba(40, 167, 69, 0.1);
    color: var(--status-pronto);
}

.classification-badge.aguardando {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.classification-badge.desqualificado {
    background: rgba(220, 53, 69, 0.1);
    color: var(--status-desqualificado);
}

.log-status.escalated {
    background: rgba(0, 149, 246, 0.1);
    color: var(--status-coletando);
}

.log-status.ended {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-muted);
}

.log-status.active {
    background: rgba(40, 167, 69, 0.1);
    color: var(--status-pronto);
}

.db-log-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.db-log-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--bsn-secondary);
}

.btn-secondary {
    background: var(--bsn-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-crm {
    background: var(--status-pronto);
    color: white;
}

.btn-crm:hover {
    background: #218838;
}

.btn-crm.sent {
    background: var(--text-muted);
    cursor: default;
}

.btn-danger {
    background: var(--status-desqualificado);
    color: white;
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

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

/* =============================================================================
   RESPONSIVE DASHBOARD
   ============================================================================= */

@media (max-width: 1200px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }

    .crm-stats-row,
    .db-stats-row,
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .crm-stats-row,
    .db-stats-row,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .modal-data-grid {
        grid-template-columns: 1fr;
    }

    .db-connection-info {
        flex-direction: column;
        gap: 12px;
    }
}
