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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    color: #111b21;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top-nav {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-top: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    margin-bottom: 10px;
}

.nav-logo {
    font-weight: 600;
    font-size: 1.2rem;
    color: #00a884;
}

.nav-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #e8f5e9;
    color: #00a884;
}

.tab-btn:hover:not(.active) {
    background: #f1f3f4;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 320px;
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    color: #202124;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.85rem;
    color: #5f6368;
}

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

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group small {
    font-size: 0.75rem;
    color: #6c757d;
}

.btn-primary {
    background-color: #00a884;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: #008f6f;
}

.btn-secondary {
    background-color: #e9ecef;
    color: #495057;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background-color: #dee2e6;
}

/* Chat Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #efeae2;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcd2de2.png');
    background-repeat: repeat;
    position: relative;
}

.chat-header {
    background-color: #f0f2f5;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e9ecef;
    z-index: 10;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: #00a884;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 500;
    font-size: 1.2rem;
}

.header-info h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0px;
}

.status {
    font-size: 0.75rem;
    color: #667781;
}

.chat-messages {
    flex: 1;
    padding: 20px 7%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #ced4da transparent;
}

.message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.system-msg {
    align-self: center;
    background-color: #fff5c4;
    color: #544c31;
    font-size: 0.8rem;
    border-radius: 8px;
    padding: 6px 10px;
    margin: 8px 0;
    box-shadow: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.message.user {
    align-self: flex-end;
    background-color: #d9fdd3;
    border-top-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background-color: #ffffff;
    border-top-left-radius: 4px;
}

.chat-input-area {
    background-color: #f0f2f5;
    padding: 12px 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.chat-input-area input:disabled {
    background-color: #e9ecef;
}

#btn-enviar {
    background: #00a884;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

#btn-enviar:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

#btn-enviar:not(:disabled):hover {
    background: #008f6f;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    background-color: #ffffff;
    border-radius: 8px;
    border-top-left-radius: 0;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    width: fit-content;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #8696a0;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Leads Tab Styles */
.leads-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.leads-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.leads-filters select {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
}

.table-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.leads-table th, .leads-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.leads-table th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    position: sticky;
    top: -20px;
}

.leads-table tr:hover {
    background-color: #f8f9fa;
}

.urgency-row {
    background-color: #fff3cd !important;
}

.inactive-24h {
    background-color: #f8d7da !important;
    border-left: 4px solid #dc3545;
}

/* Status Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.aguardando_confirmacao { background: #fff3cd; color: #856404; }
.badge.confirmado { background: #d4edda; color: #155724; }
.badge.sem_resposta { background: #e2e3e5; color: #383d41; }
.badge.cancelado { background: #f8d7da; color: #721c24; }
.badge.encaminhado { background: #cce5ff; color: #004085; }
.badge.coletando_dados { background: #e8f4fd; color: #0056b3; }
.badge.novo { background: #e2e3e5; color: #383d41; }
.badge.expirado { background: #f8f9fa; color: #6c757d; border: 1px solid #dee2e6; }

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

.action-buttons button {
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.btn-success { background: #28a745; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-warning { background: #ffc107; color: #212529; }
.btn-info { background: #17a2b8; color: white; }
.btn-whatsapp { background: #25D366; color: white; text-decoration: none; padding: 5px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 500; display: inline-block; }

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
