/* ============================================================
   CRM WhatsApp — Sistema de diseño
   ============================================================ */
:root {
    --brand-green: #1fae66;
    --brand-green-dark: #148a51;
    --brand-green-light: #e8f8f0;
    --brand-teal: #0aa89e;
    --sidebar-bg: #182234;
    --sidebar-bg-active: #1fae66;
    --sidebar-text: #aab4c5;
    --surface: #ffffff;
    --surface-muted: #f4f6fa;
    --border-color: #e6e9f0;
    --text-muted: #7c8797;
    --text-dark: #202b3c;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow-soft: 0 2px 10px rgba(20, 30, 50, 0.06);
    --shadow-medium: 0 4px 18px rgba(20, 30, 50, 0.09);
}

body {
    background-color: var(--surface-muted);
    color: var(--text-dark);
}

/* --- Sidebar --- */
.sidebar {
    width: 250px;
    min-height: 100vh;
    background: var(--sidebar-bg) !important;
    padding: 1.25rem 1rem !important;
}

.sidebar h5 {
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 0 0.5rem;
}

.sidebar .nav-link {
    color: var(--sidebar-text) !important;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem !important;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.925rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff !important;
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-bg-active);
    color: #fff !important;
    box-shadow: var(--shadow-soft);
}

/* --- Tarjetas y contenedores generales --- */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.card-header {
    border-top-left-radius: var(--radius-md) !important;
    border-top-right-radius: var(--radius-md) !important;
    border-bottom: 1px solid var(--border-color);
}

.card-footer {
    border-bottom-left-radius: var(--radius-md) !important;
    border-bottom-right-radius: var(--radius-md) !important;
    border-top: 1px solid var(--border-color);
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-success {
    background-color: var(--brand-green);
    border-color: var(--brand-green);
}

.btn-success:hover, .btn-success:focus {
    background-color: var(--brand-green-dark);
    border-color: var(--brand-green-dark);
}

.btn-outline-success {
    color: var(--brand-green);
    border-color: var(--brand-green);
}

.btn-outline-success:hover {
    background-color: var(--brand-green);
    border-color: var(--brand-green);
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 0.2rem rgba(31, 174, 102, 0.15);
}

.table td, .table th {
    vertical-align: middle;
}

.badge {
    border-radius: var(--radius-pill);
    font-weight: 500;
}

/* ============================================================
   Bandeja unificada
   ============================================================ */

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
}

.min-w-0 {
    min-width: 0;
}

.conversation-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.28em 0.65em;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

/* --- Pestañas de estado, estilo píldora --- */
.status-tabs {
    border-bottom: none;
    display: flex;
    gap: 0.4rem;
    background: var(--surface);
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.status-tabs .nav-item {
    flex: 1;
}

.status-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 0.4rem;
    background: var(--surface-muted);
    border-radius: var(--radius-pill);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.status-tabs .nav-link .badge {
    font-size: 0.68rem;
}

.status-tabs .nav-link.active {
    background: var(--brand-green);
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.status-tabs .nav-link.active .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff;
}

#conversation-list.card,
.card.rounded-top-0 {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* --- Ítems de la lista de conversaciones --- */
.conversation-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    transition: background-color 0.12s ease;
}

.conversation-item:hover {
    background-color: var(--surface-muted);
}

.conversation-item.active {
    background-color: var(--brand-green-light);
    border-left: 3px solid var(--brand-green);
    padding-left: calc(1rem - 3px);
}

/* --- Panel de chat --- */
#chat-header {
    border-radius: 0;
    padding: 0.9rem 1.25rem;
}

#chat-messages {
    background-color: #eef2f0;
    background-image:
        radial-gradient(rgba(31, 174, 102, 0.035) 1px, transparent 1px);
    background-size: 18px 18px;
}

.msg-bubble {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 0.55rem 0.8rem;
    max-width: 70%;
}

.msg-bubble.msg-out {
    background: #d9f4e3;
    border-bottom-right-radius: 4px;
}

.msg-bubble.msg-in {
    background: var(--surface);
    border-bottom-left-radius: 4px;
}

/* --- Barra de envío --- */
.send-bar {
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.send-bar input.form-control {
    border: none;
    background: transparent;
    box-shadow: none !important;
}

.send-bar .btn-attach {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    flex-shrink: 0;
}

.send-bar .btn-send {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-green);
    border: none;
    color: #fff;
    flex-shrink: 0;
}

.send-bar .btn-send:disabled {
    background: #c7ccd4;
}

/* --- Panel de contacto --- */
#contact-panel .card-body {
    padding: 1.25rem;
}

.contact-panel-tag {
    font-size: 0.72rem;
    padding: 0.35em 0.7em;
}