/* ===================== VARIAVEIS ===================== */
:root {
    --primary: #C4AB8E;
    --primary-light: #e1ceb9;
    --secondary: #C2958F;
    --danger: #e74c3c;
    --warning: #f39c12;
    --bg: #ecf0f1;
    --card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #bdc3c7;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===================== AUTH PAGES ===================== */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #C4AB8E 0%, #C4AB8E 50%, rgb(190, 149, 143) 100%);
}

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

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 30px 25px;
    text-align: center;
}

.auth-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.auth-header p {
    font-size: 0.9rem;
    opacity: 0.85;
}

.auth-form {
    padding: 30px 25px 15px;
}

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-field input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s;
    background: white;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(41, 128, 185, 0.4);
}

.auth-footer {
    padding: 15px 25px 25px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-alert {
    padding: 12px 20px;
    margin: 0 25px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 15px;
}

.auth-alert.error {
    background: #fce4e4;
    color: #c0392b;
    border-left: 4px solid #c0392b;
}

.auth-alert.success {
    background: #d5f5e3;
    color: #27ae60;
    border-left: 4px solid #27ae60;
}

/* ===================== HEADER ===================== */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.header-info {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.85rem;
}

.header-info .badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.header-info .user-badge {
    background: rgba(39, 174, 96, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-logout {
    background: rgba(231, 76, 60, 0.3);
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-logout:hover {
    background: rgba(231, 76, 60, 0.7);
}

/* ===================== NAV TABS ===================== */
.nav-tabs {
    display: flex;
    background: white;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.nav-tab {
    padding: 14px 24px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--primary);
    background: #f8f9fa;
}

.nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #f0f7ff;
}

/* ===================== MAIN CONTENT ===================== */
.main {
    padding: 20px 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* ===================== CARDS ===================== */
.card {
    background: var(--card);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* ===================== FORM STYLES ===================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

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

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label .required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:read-only {
    background: #f0f7ff;
    font-weight: 600;
    color: var(--primary);
}

/* ===================== BUTTONS ===================== */
.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

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

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

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

.btn-warning:hover {
    background: #e67e22;
}

.btn-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ===================== TABLE ===================== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table thead {
    background: var(--primary);
    color: white;
}

table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

table td {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
}

table tbody tr:hover {
    background: #f8f9fa;
}

table td select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.82rem;
    font-family: inherit;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-aberto {
    background: #ffeaa7;
    color: #6c5ce7;
}

.status-em-analise {
    background: #74b9ff;
    color: #fff;
}

.status-em-resolucao {
    background: #fdcb6e;
    color: #2d3436;
}

.status-resolvido {
    background: #55efc4;
    color: #00695c;
}

.status-finalizado {
    background: #dfe6e9;
    color: #636e72;
}

.status-treinamento {
    background: #a29bfe;
    color: #fff;
}

/* ===================== DASHBOARD ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary);
}

.stat-card .number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.stat-card.green {
    border-top-color: var(--secondary);
}

.stat-card.green .number {
    color: var(--secondary);
}

.stat-card.red {
    border-top-color: var(--danger);
}

.stat-card.red .number {
    color: var(--danger);
}

.stat-card.yellow {
    border-top-color: var(--warning);
}

.stat-card.yellow .number {
    color: var(--warning);
}

.stat-card.purple {
    border-top-color: #6c5ce7;
}

.stat-card.purple .number {
    color: #6c5ce7;
}

/* ===================== SEARCH BAR ===================== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-bar input,
.search-bar select {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}

.search-bar input {
    flex: 1;
    min-width: 200px;
}

.search-bar input:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* ===================== MODAL ===================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 5px;
}

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

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 2px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===================== DETAIL VIEW ===================== */
.detail-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}

.detail-item span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===================== TIMELINE ===================== */
.timeline {
    margin: 15px 0;
}

.timeline-item {
    display: flex;
    gap: 15px;
    padding: 12px 0;
    border-left: 3px solid var(--primary-light);
    padding-left: 20px;
    margin-left: 10px;
    position: relative;
}

.timeline-item::before {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--primary-light);
    border-radius: 50%;
    position: absolute;
    left: -7.5px;
    top: 16px;
}

.timeline-item .time {
    font-size: 0.75rem;
    color: var(--text-light);
    min-width: 130px;
}

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

/* ===================== TRAINING CARD ===================== */
.training-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

.training-card h4 {
    margin-bottom: 10px;
}

.training-card p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

/* ===================== TOAST ===================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--secondary);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--primary-light);
}

@keyframes slideIn {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================== ACTION COLUMN ===================== */
.action-btns {
    display: flex;
    gap: 5px;
}

/* ===================== TIMER 48H ===================== */
.timer-48h {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
}

.timer-48h.ok {
    background: #d5f5e3;
    color: #1e8449;
}

.timer-48h.alerta {
    background: #fdebd0;
    color: #e67e22;
}

.timer-48h.vencido {
    background: #fadbd8;
    color: #c0392b;
}

/* ===================== ATIVOS TABLE ===================== */
.ativos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.85rem;
}

.ativos-table th {
    background: var(--primary-light);
    color: #fff;
    padding: 8px 10px;
    text-align: left;
}

.ativos-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #eee;
}

.ativos-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.85rem;
}

.ativos-table .btn-sm {
    padding: 4px 10px;
}

/* ===================== CHECKLIST ETAPAS ===================== */
.checklist-container {
    margin-top: 10px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: background 0.2s;
}

.checklist-item.done {
    background: #d5f5e3;
    border-color: #a9dfbf;
}

.checklist-item input[type=checkbox] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--secondary);
}

.checklist-item .step-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}

.checklist-item .step-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: right;
    min-width: 180px;
}

.checklist-item .step-meta strong {
    color: var(--primary);
}

/* ===================== PRINT ===================== */
.print-area {
    display: none;
}

@media print {
    body * {
        visibility: hidden;
    }

    .print-area,
    .print-area * {
        visibility: visible;
    }

    .print-area {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* ===================== ANEXOS DO SAC ===================== */
.anexos-upload-area {
    margin-top: 10px;
}

.anexos-dropzone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.anexos-dropzone:hover,
.anexos-dropzone.dragover {
    border-color: var(--primary-light);
    background: #f0f7ff;
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 2rem;
    opacity: 0.6;
}

.dropzone-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.dropzone-hint {
    font-size: 0.75rem;
    color: var(--text-light);
}

.anexos-lista {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.anexo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: all 0.2s;
}

.anexo-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.anexo-preview {
    flex-shrink: 0;
}

.anexo-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
}

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

.anexo-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.anexo-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.anexo-nome {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.anexo-nome:hover {
    text-decoration: underline;
}

.anexo-meta {
    font-size: 0.72rem;
    color: var(--text-light);
}

.anexo-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Anexos no modal de detalhes */
.modal-anexos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.modal-anexo-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: all 0.2s;
}

.modal-anexo-card:hover {
    border-color: var(--primary-light);
}

.modal-anexo-preview {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    text-decoration: none;
}

.modal-anexo-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

.modal-anexo-icon {
    font-size: 2rem;
}

.modal-anexo-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.modal-anexo-nome {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-anexo-meta {
    font-size: 0.7rem;
    color: var(--text-light);
}

/* ===================== MESSENGER WIDGET ===================== */
.messenger-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.messenger-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26, 82, 118, 0.4);
    transition: all 0.3s;
    position: relative;
    z-index: 501;
}

.messenger-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(26, 82, 118, 0.5);
}

.messenger-fab-icon {
    font-size: 1.5rem;
}

.messenger-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

.messenger-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: messengerSlideUp 0.3s ease;
}

@keyframes messengerSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.messenger-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.messenger-title {
    font-size: 1rem;
    font-weight: 700;
}

.messenger-header-actions {
    display: flex;
    gap: 5px;
}

.messenger-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.messenger-minimize:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Contacts */
.messenger-contacts {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.messenger-search {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.messenger-search input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #eee;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.messenger-search input:focus {
    border-color: var(--primary-light);
}

.messenger-contacts-list {
    flex: 1;
    overflow-y: auto;
}

.messenger-contato {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.messenger-contato:hover {
    background: #f0f7ff;
}

.messenger-contato.tem-nova {
    background: #f0f7ff;
}

.contato-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    color: white;
}

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

.contato-nome {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.contato-nome small {
    font-weight: 400;
    color: var(--text-light);
    font-size: 0.72rem;
}

.contato-badge {
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.contato-ultima-msg {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.messenger-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.messenger-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Chat area */
.messenger-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.messenger-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    background: #fafbfc;
}

.messenger-back {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--primary);
    padding: 4px;
    transition: color 0.2s;
}

.messenger-back:hover {
    color: var(--primary-light);
}

.messenger-chat-user {
    display: flex;
    flex-direction: column;
}

.messenger-chat-user strong {
    font-size: 0.9rem;
    color: var(--text);
}

.messenger-chat-user small {
    font-size: 0.72rem;
    color: var(--text-light);
}

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

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

.messenger-msg.msg-minha {
    align-self: flex-end;
}

.messenger-msg.msg-outra {
    align-self: flex-start;
}

.msg-bubble {
    padding: 8px 14px;
    border-radius: 16px;
    position: relative;
    word-break: break-word;
}

.msg-minha .msg-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-outra .msg-bubble {
    background: white;
    color: var(--text);
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}

.msg-text {
    display: block;
    font-size: 0.85rem;
    line-height: 1.4;
}

.msg-hora {
    display: block;
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 3px;
    text-align: right;
}

.msg-outra .msg-hora {
    color: var(--text-light);
}

/* Input area */
.messenger-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0;
}

.messenger-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #eee;
    border-radius: 20px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.messenger-input-area input:focus {
    border-color: var(--primary-light);
}

.messenger-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.messenger-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(26, 82, 118, 0.3);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .header-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main {
        padding: 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .nav-tab {
        padding: 10px 16px;
        font-size: 0.8rem;
    }

    .auth-container {
        padding: 15px;
    }

    /* Messenger mobile */
    .messenger-panel {
        width: calc(100vw - 20px);
        right: -10px;
        height: 70vh;
        max-height: 500px;
    }

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

    .anexo-item {
        flex-wrap: wrap;
    }
}