/* =====================================================
   SV PHARMA - Sistema de Gestão
   Identidade Visual
   Primária:   #C4AB8E
   Secundária: #C2958F
   Terciária:  #969E81
   ===================================================== */

:root {
    --sv-primary: #C4AB8E;
    --sv-primary-dark: #b09474;
    --sv-primary-light: #e1ceb9;
    --sv-primary-ultra-light: #f5efe8;
    --sv-secondary: #C2958F;
    --sv-secondary-dark: #a87a74;
    --sv-secondary-light: #dbb8b4;
    --sv-tertiary: #969E81;
    --sv-tertiary-dark: #7d856a;
    --sv-tertiary-light: #b5bba4;

    --sv-danger: #e74c3c;
    --sv-warning: #f39c12;
    --sv-success: #27ae60;
    --sv-info: #3498db;

    --sv-bg: #f4f1ed;
    --sv-card: #ffffff;
    --sv-text: #2c3e50;
    --sv-text-light: #7f8c8d;
    --sv-border: #e0d8cf;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Override Bootstrap primary → brand color */
    --bs-primary: #C4AB8E;
    --bs-primary-rgb: 196, 171, 142;
    --bs-btn-bg: #C4AB8E;
    --bs-btn-border-color: #C4AB8E;
    --bs-btn-hover-bg: #b09474;
    --bs-btn-hover-border-color: #b09474;
    --bs-link-color: #b09474;
    --bs-link-hover-color: #9a7e5e;
}

/* Bootstrap primary overrides */
.btn-primary {
    background-color: #C4AB8E !important;
    border-color: #C4AB8E !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #b09474 !important;
    border-color: #b09474 !important;
    color: #fff !important;
}
.btn-outline-primary {
    color: #C4AB8E !important;
    border-color: #C4AB8E !important;
    background-color: transparent !important;
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: #C4AB8E !important;
    border-color: #C4AB8E !important;
    color: #fff !important;
}
.text-primary { color: #C4AB8E !important; }
a.text-primary:hover { color: #b09474 !important; }
.border-primary { border-color: #C4AB8E !important; }
.bg-primary { background-color: #C4AB8E !important; }
.form-control:focus, .form-select:focus {
    border-color: #C4AB8E;
    box-shadow: 0 0 0 0.2rem rgba(196,171,142,.25);
}

/* =====================================================
   Reset & Base
   ===================================================== */
* { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--sv-bg);
    color: var(--sv-text);
    margin: 0;
    min-height: 100vh;
}

a { color: var(--sv-primary-dark); text-decoration: none; }
a:hover { color: var(--sv-secondary-dark); }

/* =====================================================
   Auth Pages
   ===================================================== */
.auth-body {
    background: linear-gradient(135deg, var(--sv-primary-ultra-light) 0%, var(--sv-bg) 50%, #f0ece6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.auth-card {
    background: var(--sv-card);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 4px 24px rgba(196, 171, 142, 0.15);
    border: 1px solid var(--sv-border);
}

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

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--sv-primary), var(--sv-secondary));
    color: white;
    font-size: 24px;
    font-weight: 700;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    letter-spacing: 1px;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sv-text);
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--sv-text-light);
    font-size: 0.9rem;
    margin: 0;
}

.auth-form .form-control {
    border: 1px solid var(--sv-border);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form .form-control:focus {
    border-color: var(--sv-primary);
    box-shadow: 0 0 0 3px rgba(196, 171, 142, 0.15);
}

.auth-form .form-floating > label {
    color: var(--sv-text-light);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--sv-text-light);
}

.auth-footer a {
    color: var(--sv-primary-dark);
    font-weight: 600;
}

.auth-credits {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--sv-text-light);
}

/* =====================================================
   Sidebar
   ===================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--sv-primary), var(--sv-secondary));
    color: white;
    font-weight: 700;
    font-size: 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.72rem;
    opacity: 0.6;
    display: block;
}

.sidebar-close {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 8px 24px 4px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(196, 171, 142, 0.12);
    color: var(--sv-primary-light);
    border-left-color: var(--sv-primary);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--sv-primary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-details {
    min-width: 0;
}

.user-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.72rem;
    opacity: 0.5;
}

.btn-logout {
    color: rgba(255,255,255,0.5);
    font-size: 1.1rem;
    padding: 6px;
    transition: color 0.2s;
}

.btn-logout:hover {
    color: var(--sv-danger);
}

/* Sidebar Overlay Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--sv-card);
    border-bottom: 1px solid var(--sv-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    font-size: 0.85rem;
    color: var(--sv-text-light);
}

.btn-menu {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--sv-text);
    cursor: pointer;
    padding: 4px 8px;
}

/* Content Wrapper */
.content-wrapper {
    padding: 24px;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--sv-card);
    border: 1px solid var(--sv-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--sv-border);
    padding: 16px 20px;
}

.card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* =====================================================
   Stat Cards (Dashboard)
   ===================================================== */
.stat-card {
    background: var(--sv-card);
    border: 1px solid var(--sv-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-info {
    min-width: 0;
}

.stat-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--sv-text-light);
    margin-top: 2px;
}

.stat-primary .stat-icon { background: var(--sv-primary-ultra-light); color: var(--sv-primary-dark); }
.stat-warning .stat-icon { background: #fff3cd; color: #856404; }
.stat-info .stat-icon { background: #d1ecf1; color: #0c5460; }
.stat-success .stat-icon { background: #d4edda; color: #155724; }
.stat-danger .stat-icon { background: #f8d7da; color: #721c24; }
.stat-secondary .stat-icon { background: rgba(194,149,143,0.15); color: var(--sv-secondary-dark); }
.stat-tertiary .stat-icon { background: rgba(150,158,129,0.15); color: var(--sv-tertiary-dark); }
.stat-action .stat-icon { background: linear-gradient(135deg, var(--sv-primary), var(--sv-secondary)); color: white; }
.stat-action:hover { color: inherit; }

/* =====================================================
   Quick Actions
   ===================================================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--sv-primary-ultra-light);
    border-radius: 10px;
    color: var(--sv-primary-dark);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: var(--sv-primary-light);
    color: var(--sv-primary-dark);
    transform: translateY(-1px);
}

.quick-action-btn i {
    font-size: 1.4rem;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn-primary-sv {
    background: var(--sv-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.2s;
}

.btn-primary-sv:hover {
    background: var(--sv-primary-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-primary-sv:active {
    transform: translateY(0);
}

.btn { border-radius: 8px; }

/* =====================================================
   Tables
   ===================================================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sv-text-light);
    font-weight: 600;
    border-bottom-width: 1px;
    padding: 12px 16px;
    white-space: nowrap;
    background: var(--sv-primary-ultra-light);
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 0.9rem;
    border-color: var(--sv-border);
}

.table-hover tbody tr:hover {
    background: var(--sv-primary-ultra-light);
}

/* =====================================================
   Badges
   ===================================================== */
.bg-primary-sv {
    background-color: var(--sv-primary) !important;
    color: white;
}

/* Perfil badges */
.badge-perfil {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.badge-admin { background: rgba(196,171,142,0.2); color: var(--sv-primary-dark); }
.badge-farmaceutico { background: rgba(150,158,129,0.2); color: var(--sv-tertiary-dark); }
.badge-atendente { background: rgba(194,149,143,0.2); color: var(--sv-secondary-dark); }

/* Status badges */
.badge-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.badge-status-aberto { background: #fff3cd; color: #856404; }
.badge-status-em-analise { background: #d1ecf1; color: #0c5460; }
.badge-status-em-resolucao { background: #ffeaa7; color: #856404; }
.badge-status-resolvido { background: #d4edda; color: #155724; }
.badge-status-finalizado { background: #e2e3e5; color: #383d41; }

/* Criticidade badges */
.badge-crit {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.badge-crit-baixa { background: #d4edda; color: #155724; }
.badge-crit-media { background: #fff3cd; color: #856404; }
.badge-crit-alta { background: #ffeaa7; color: #856404; }
.badge-crit-critica { background: #f8d7da; color: #721c24; }

/* =====================================================
   Avatar
   ===================================================== */
.avatar-sm {
    width: 32px;
    height: 32px;
    background: var(--sv-primary);
    color: white;
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =====================================================
   Checklist
   ===================================================== */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--sv-border);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item i {
    font-size: 1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.checklist-info {
    flex: 1;
    min-width: 0;
}

.checklist-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
}

.checklist-item.checked .checklist-label {
    color: var(--sv-success);
}

/* =====================================================
   Info List (View page)
   ===================================================== */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
}

.info-item .text-muted {
    font-size: 0.82rem;
}

/* =====================================================
   Timeline (Histórico)
   ===================================================== */
.timeline {
    padding: 16px 20px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding-bottom: 16px;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: 0;
    width: 2px;
    background: var(--sv-border);
}

.timeline-dot {
    width: 12px;
    height: 12px;
    background: var(--sv-primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.timeline-content p {
    font-size: 0.85rem;
}

.timeline-content small {
    font-size: 0.75rem;
}

/* =====================================================
   Form styling
   ===================================================== */
.form-control, .form-select {
    border: 1px solid var(--sv-border);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--sv-primary);
    box-shadow: 0 0 0 3px rgba(196, 171, 142, 0.15);
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--sv-text);
}

/* =====================================================
   Alert styling
   ===================================================== */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.9rem;
}

/* =====================================================
   Progress bar colors
   ===================================================== */
.progress {
    border-radius: 4px;
    background: var(--sv-primary-ultra-light);
}

/* =====================================================
   Text colors
   ===================================================== */
.text-primary-sv {
    color: var(--sv-primary-dark) !important;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 28px 24px;
    }

    .topbar-title {
        font-size: 1rem;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   Scrollbar styling
   ===================================================== */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card, .card {
    animation: fadeIn 0.3s ease;
}

/* =====================================================
   Avatar Tertiary
   ===================================================== */
.bg-tertiary {
    background: var(--sv-tertiary) !important;
}

/* =====================================================
   Conteudo Cards
   ===================================================== */
.conteudo-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

/* =====================================================
   Dropzone (Drag & Drop)
   ===================================================== */
.dropzone {
    border: 2px dashed var(--sv-border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--sv-primary-ultra-light);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--sv-primary);
    background: var(--sv-primary-light);
}

.dropzone.dragover {
    transform: scale(1.01);
}

/* =====================================================
   Chat Messenger Widget
   ===================================================== */
.messenger-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--sv-primary), var(--sv-secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(196,171,142,0.4);
    z-index: 1050;
    transition: transform 0.2s, box-shadow 0.2s;
}

.messenger-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(196,171,142,0.5);
}

.messenger-bubble.active {
    background: var(--sv-primary-dark);
}

.messenger-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--sv-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Pulse animation for new messages */
@keyframes pulse {
    0% { box-shadow: 0 4px 16px rgba(196,171,142,0.4); }
    50% { box-shadow: 0 4px 24px rgba(231,76,60,0.6); }
    100% { box-shadow: 0 4px 16px rgba(196,171,142,0.4); }
}

.messenger-bubble.pulse {
    animation: pulse 0.6s ease-in-out 3;
}

/* Messenger Panel */
.messenger-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 360px;
    height: 480px;
    background: var(--sv-card);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}

.messenger-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.messenger-header {
    background: linear-gradient(135deg, var(--sv-primary), var(--sv-secondary));
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.messenger-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 2px 4px;
}

.messenger-close:hover { opacity: 1; }

.messenger-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messenger-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--sv-border);
}

.messenger-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

/* Contact items */
.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.contact-item:hover {
    background: var(--sv-primary-ultra-light);
}

.contact-item.has-unread {
    background: rgba(196,171,142,0.08);
}

.contact-avatar {
    width: 36px;
    height: 36px;
    background: var(--sv-tertiary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-last {
    display: block;
    font-size: 0.75rem;
    color: var(--sv-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-unread {
    background: var(--sv-danger);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Conversation */
.messenger-conv-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--sv-border);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.messenger-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg {
    display: flex;
    max-width: 80%;
}

.msg-mine {
    align-self: flex-end;
    margin-left: auto;
}

.msg-other {
    align-self: flex-start;
}

.msg-bubble {
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.msg-mine .msg-bubble {
    background: var(--sv-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-other .msg-bubble {
    background: #f0f0f0;
    color: var(--sv-text);
    border-bottom-left-radius: 4px;
}

.msg-time {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-left: 8px;
    white-space: nowrap;
}

.messenger-input {
    padding: 10px 12px;
    border-top: 1px solid var(--sv-border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* =====================================================
   Responsive - Chat
   ===================================================== */
@media (max-width: 575.98px) {
    .messenger-panel {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 80px;
        height: 60vh;
    }

    .messenger-bubble {
        bottom: 16px;
        right: 16px;
    }
}

/* Print */
@media print {
    .sidebar, .topbar, .sidebar-overlay, .messenger-bubble, .messenger-panel { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrapper { padding: 0 !important; }
}
