* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
}

/* LOGIN */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 8px;
}

.logo p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #34495e;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-primary:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-align: center;
}

/* NAVBAR */
.navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h2 {
    color: #667eea;
    font-size: 1.5rem;
}

.empresa-nombre {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-left: 10px;
}

.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: #2c3e50;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: #f0f3ff;
    color: #667eea;
}

.btn-logout {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c0392b;
}

/* CONTAINER */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 4px;
}

.stat-info p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* QR SECTION */
.qr-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.qr-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.qr-container {
    text-align: center;
}

.qr-connected {
    padding: 40px;
}

.checkmark {
    font-size: 4rem;
    margin-bottom: 20px;
}

.qr-waiting {
    padding: 20px;
}

.qr-waiting #qrcode {
    margin: 20px auto;
    max-width: 300px;
}

.qr-error {
    padding: 40px;
    color: #e74c3c;
}

/* CONVERSACIONES */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.search-input {
    padding: 10px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    width: 300px;
}

.conversaciones-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.conversacion-item {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    cursor: pointer;
    transition: background 0.2s;
}

.conversacion-item:hover {
    background: #f8f9fa;
}

.conv-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 16px;
}

.conv-info {
    flex: 1;
}

.conv-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.conv-numero {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.conv-ultimo-mensaje {
    color: #95a5a6;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.conv-fecha {
    color: #95a5a6;
    font-size: 0.8rem;
}

.conv-badge {
    background: #ecf0f1;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #7f8c8d;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    float: right;
    font-size: 2rem;
    cursor: pointer;
    color: #95a5a6;
}

.close:hover {
    color: #2c3e50;
}

.chat-history {
    margin-top: 20px;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
}

.chat-message.user {
    background: #e3f2fd;
    margin-left: 20%;
}

.chat-message.assistant {
    background: #f5f5f5;
    margin-right: 20%;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.msg-time {
    color: #95a5a6;
}

.msg-content {
    line-height: 1.5;
}

/* CITAS */
.select-filter {
    padding: 10px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
}

.citas-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cita-item {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    border-left: 4px solid #667eea;
}

.cita-item.completada {
    border-left-color: #27ae60;
    opacity: 0.7;
}

.cita-item.cancelada {
    border-left-color: #e74c3c;
    opacity: 0.7;
}

.cita-fecha {
    text-align: center;
    margin-right: 20px;
    min-width: 60px;
}

.fecha-dia {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

.fecha-mes {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.cita-info {
    flex: 1;
}

.cita-info h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.cita-hora,
.cita-numero,
.cita-notas {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.cita-acciones {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-programada {
    background: #fff3cd;
    color: #856404;
}

.badge-confirmada {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-completada {
    background: #d4edda;
    color: #155724;
}

.badge-cancelada {
    background: #f8d7da;
    color: #721c24;
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    background: #667eea;
    color: white;
}

.btn-small:hover {
    background: #5568d3;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
}

.btn-success:hover {
    background: #229954;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
}