/* --- VARIAVEIS GLOBAIS --- */
:root {
    --santander-red: #EC0000;
    --santander-dark: #cc0000;
    --bg-body: #F5F7FA;
    --bg-white: #FFFFFF;
    --text-primary: #222222;
    --text-secondary: #666666;
    --border-light: #E0E0E0;
    --success: #008000;
    --sidebar-w: 260px;
}

/* --- ANIMAÇÕES SUTIS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.card, .kpi-card {
    animation: fadeIn 0.4s ease-out;
}

.flame-table tbody tr {
    animation: fadeIn 0.3s ease-out;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

/* Smooth Transitions */
.btn, .status-badge, .badge, .kpi-card, .card, .modal-window {
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand {
    background: var(--santander-red);
    color: white;
    padding: 24px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Relógio Digital - Flip Clock */
.relogio-container {
    padding: 18px 16px 14px;
    text-align: center;
}

.flip-clock {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.flip-group {
    display: flex;
    gap: 3px;
}

.flip-card {
    background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 49%, #171717 51%, #1a1a1a 100%);
    color: #fff;
    font-family: 'Segoe UI', 'Arial Black', sans-serif;
    font-size: 32px;
    font-weight: 700;
    width: 28px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.3);
    position: relative;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.flip-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0,0,0,0.4);
}

.flip-card::after {
    content: '';
    position: absolute;
    top: calc(50% + 1px);
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255,255,255,0.05);
}

.flip-separator {
    color: #EC0000;
    font-size: 28px;
    font-weight: 700;
    padding: 0 2px;
    text-shadow: 0 0 10px rgba(236,0,0,0.5);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.relogio-data {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 10px;
    font-weight: 500;
}

.nav-menu ul { list-style: none; margin-top: 20px; }

.nav-menu li {
    padding: 16px 24px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
    border-left: 4px solid transparent;
}

.nav-menu li:hover, .nav-menu li.active {
    background: #FEF2F2;
    color: var(--santander-red);
    border-left-color: var(--santander-red);
    font-weight: 600;
}

/* Agenda Widget */
.agenda-widget {
    margin: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.agenda-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

.agenda-header .material-icons {
    font-size: 18px;
    color: var(--santander-red);
}

.agenda-add-btn {
    margin-left: auto;
    background: var(--santander-red);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.agenda-add-btn:hover {
    background: var(--santander-dark);
    transform: scale(1.1);
}

.agenda-add-btn .material-icons {
    font-size: 16px;
}

.agenda-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agenda-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid;
    cursor: pointer;
    transition: 0.2s;
}

.agenda-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.agenda-item.baixa {
    border-left-color: #999;
}

.agenda-item.media {
    border-left-color: #FF9800;
}

.agenda-item.alta {
    border-left-color: #f44336;
}

.agenda-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.agenda-item-time {
    font-size: 11px;
    color: #666;
}

.agenda-item-delete {
    opacity: 0;
    color: #999;
    font-size: 16px;
    transition: 0.2s;
}

.agenda-item:hover .agenda-item-delete {
    opacity: 1;
}

.agenda-item-delete:hover {
    color: #f44336;
}

.agenda-empty {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 20px 10px;
}

.user-footer {
    padding: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: var(--text-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--santander-red);
    border: 2px solid white;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.avatar-upload-btn:hover {
    background: var(--santander-dark);
    transform: scale(1.1);
}

.avatar-upload-btn .material-icons {
    font-size: 14px;
}

.user-info-container {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-matricula {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Header Adjustments */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-left {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 70%;
}

.search-box {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 10px 15px;
    flex: 1;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box input { border: none; width: 100%; font-size: 14px; }

.system-status { font-size: 12px; color: var(--success); display: flex; align-items: center; gap: 5px; }
.status-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

/* Sistema de Notificações */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-bell {
    position: relative;
    background: white;
    border: 1px solid var(--border-light);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.notification-bell:hover {
    background: #f5f5f5;
}

.notification-bell .material-icons {
    font-size: 22px;
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--santander-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.notifications-panel {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}

.notifications-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: 0.2s;
}

.notification-item:hover {
    background: #f9f9f9;
}

.notification-item.unread {
    background: #FFF3E0;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.success {
    background: #E8F5E9;
    color: #4CAF50;
}

.notification-icon.warning {
    background: #FFF3E0;
    color: #FF9800;
}

.notification-icon.error {
    background: #FFEBEE;
    color: #F44336;
}

.notification-icon .material-icons {
    font-size: 20px;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.notification-text {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: #999;
}

/* Client Info */
.client-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
}

.client-title h1 { 
    font-size: 28px; 
    font-weight: 300; 
    margin-bottom: 5px;
}

.client-title h1.welcome-message {
    color: var(--santander-red);
    font-weight: 400;
}

.badge {
    background: #222; color: white; padding: 4px 8px;
    font-size: 11px; text-transform: uppercase; border-radius: 4px; letter-spacing: 1px;
}
.badge.select { background: #000; }
.badge.vangogh { background: #E67E22; }
.badge.especial { background: #7f8c8d; }

.client-meta span { margin-left: 20px; color: var(--text-secondary); font-size: 14px; }

/* Indicadores Visuais de Risco por Rating */
.rating-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
}

.rating-indicator .material-icons {
    font-size: 14px;
}

/* Ratings B+ B B- (Médio Risco) */
.rating-b {
    background: #FFF3E0;
    color: #F57C00;
    border: 2px solid #FFB74D;
}

/* Ratings CCC CC C (Alto Risco) */
.rating-c {
    background: #FFEBEE;
    color: #C62828;
    border: 2px solid #EF9A9A;
}

/* Rating D (Inadimplente/Default) */
.rating-d {
    background: #B71C1C;
    color: white;
    border: 2px solid #D32F2F;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Cards KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border-top: 4px solid var(--santander-red);
}

.card-header { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 10px; }
.card-value { font-size: 32px; font-weight: 700; color: var(--text-primary); }
.card-footer { font-size: 12px; color: #999; margin-top: 8px; }
.text-green { color: var(--success); }

/* Actions */
.actions-bar { margin-bottom: 20px; display: flex; gap: 10px; }

.btn {
    padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer;
    font-weight: 600; display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.btn-sm { padding: 8px 16px; font-size: 13px; }

.btn-primary { background: var(--santander-red); color: white; }
.btn-primary:hover { background: var(--santander-dark); }
.btn-secondary { background: white; border: 1px solid var(--border-light); color: var(--text-primary); }
.btn-secondary:hover { background: #f0f0f0; }

/* Table */
.data-table-container { background: white; border-radius: 8px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.data-table-container h3 { margin-bottom: 20px; font-size: 16px; }

.flame-table { width: 100%; border-collapse: collapse; }
.flame-table th { text-align: left; padding: 12px; color: var(--text-secondary); font-size: 12px; border-bottom: 2px solid var(--bg-body); }
.flame-table td { padding: 14px 12px; border-bottom: 1px solid var(--bg-body); font-size: 14px; }
.flame-table tr:hover { background: #FAFAFA; }

.action-icon {
    color: #999; cursor: pointer; transition: 0.2s;
    padding: 5px; border-radius: 4px;
}
.action-icon:hover { color: var(--santander-red); background: #ffe5e5; }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
}
.hidden { display: none; }

.modal-window {
    background: white; width: 500px; padding: 30px; border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: slideDown 0.3s;
}

@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; }}

.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid #CCC; border-radius: 4px; font-family: inherit; }

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
    border-left: 4px solid #ccc;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.warning {
    border-left-color: #ff9800;
}

.toast.info {
    border-left-color: #2196F3;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #4CAF50;
}

.toast.error .toast-icon {
    color: #f44336;
}

.toast.warning .toast-icon {
    color: #ff9800;
}

.toast.info .toast-icon {
    color: #2196F3;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #222;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: 0.2s;
}

.toast-close:hover {
    background: #f5f5f5;
    color: #333;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* STATUS BADGES - BOTÕES */
.status-badge {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 2px solid;
}

/* Em Análise */
.status-badge.em_analise {
    background: #FFF3E0;
    color: #F57C00;
    border-color: #FFB74D;
}

.status-badge.em_analise:hover {
    background: #FFE0B2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

/* Aguardando Docs */
.status-badge.aguardando_docs {
    background: #E3F2FD;
    color: #1976D2;
    border-color: #64B5F6;
}

.status-badge.aguardando_docs:hover {
    background: #BBDEFB;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

/* Aprovado */
.status-badge.aprovado {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.status-badge.aprovado:hover {
    background: #45a049;
    border-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* Liberado */
.status-badge.liberado {
    background: #00897B;
    color: white;
    border-color: #00897B;
}

.status-badge.liberado:hover {
    background: #00796B;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 137, 123, 0.3);
}

/* Reprovado */
.status-badge.reprovado {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.status-badge.reprovado:hover {
    background: #da190b;
    border-color: #da190b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

/* Cancelado */
.status-badge.cancelado {
    background: #757575;
    color: white;
    border-color: #757575;
}

.status-badge.cancelado:hover {
    background: #616161;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(117, 117, 117, 0.3);
}

.status-badge .material-icons {
    font-size: 16px;
}

/* COR ESPECIAL PARA TAXA DE DESBLOQUEIO */
.card-value.taxa-desbloqueio {
    color: #EC0000;
}

/* VALOR VERMELHO PARA TRANSAÇÕES REPROVADAS */
.valor-reprovado {
    color: #f44336 !important;
}

/* BOTÃO DE EXCLUIR CLIENTE */
.btn-delete-client {
    background: none;
    border: none;
    color: #c62828;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin-left: 20px;
    transition: 0.2s;
    border-radius: 4px;
}

.btn-delete-client:hover {
    background: #ffebee;
    color: #b71c1c;
}

.btn-delete-client .material-icons {
    font-size: 18px;
}

/* ==========================================
   MÉTRICAS GERAIS - PAINEL ADMINISTRATIVO
   ========================================== */
.metricas-gerais {
    margin-bottom: 28px;
    animation: fadeIn 0.4s ease;
}

.metricas-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.metrica-card {
    background: var(--bg-white);
    border-radius: 4px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

.metrica-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.metrica-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.metrica-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metrica-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metrica-badge.positivo {
    background: #E8F5E9;
    color: #2E7D32;
}

.metrica-badge.receita {
    background: #FFEBEE;
    color: #C62828;
}

.metrica-badge.info {
    background: #E3F2FD;
    color: #1565C0;
}

.metrica-valor {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.metrica-valor.verde {
    color: #2E7D32;
}

.metrica-valor.vermelho {
    color: #C62828;
}

.metrica-valor.azul {
    color: #1565C0;
}

.metrica-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #999;
}

.metrica-footer .material-icons {
    font-size: 14px;
}

.metrica-barra {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.metrica-barra.verde {
    background: linear-gradient(90deg, #4CAF50, #81C784);
}

.metrica-barra.vermelho {
    background: linear-gradient(90deg, #EC0000, #EF5350);
}

.metrica-barra.azul {
    background: linear-gradient(90deg, #1976D2, #64B5F6);
}