﻿/* TOAST NOTIFICATIONS - ABSOLUT CINEMA STYLE */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Deixa clicar no que está atrás */
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(50px);
    animation: slideIn 0.3s forwards;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--primary); }

.toast-content { flex: 1; }
.toast-title { font-weight: bold; font-size: 0.9rem; margin-bottom: 2px; }
.toast-msg { font-size: 0.85rem; color: var(--text-secondary); }

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(50px); }
}


/* =========================================
   4. TELA DE CONFERÊNCIA (Review UI)
   ========================================= */

/* Grid Responsivo Inteligente
   - Adapta automaticamente: 1 coluna no celular, 2 ou 3 em monitores
   - Gap generoso para respiro visual
*/
.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 30px;
    padding-bottom: 80px; /* Espaço para scroll final */
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* O Card em si - Estilo Premium */
.review-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    position: relative;
}

/* Efeito de "Levitar" ao passar o mouse */
.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
    border-color: var(--primary);
}

/* Área da Foto da Etiqueta */
.review-image {
    height: 220px;
    width: 100%;
    background: #000;
    position: relative;
    overflow: hidden;
    cursor: zoom-in;
    border-bottom: 1px solid var(--border);
}

.review-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Garante que a foto preencha sem distorcer */
    transition: transform 0.5s ease;
    opacity: 0.9;
}

.review-image:hover img {
    transform: scale(1.1); /* Zoom suave ao passar mouse */
    opacity: 1;
}

/* Área de Conteúdo (Inputs) */
.review-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Badges Flutuantes (Status da IA) */
.match-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: white;
    backdrop-filter: blur(8px); /* Efeito vidro */
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Variações da Badge */
.match-success {
    background: rgba(16, 185, 129, 0.85); /* Verde */
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.match-warning {
    background: rgba(245, 158, 11, 0.85); /* Laranja */
    border: 1px solid rgba(245, 158, 11, 0.5);
}

/* Área de Ações (Botões no rodapé do card) */
.actions {
    margin-top: auto;
    padding-top: 10px;
}

/* Seção vazia (quando não há nada para conferir) */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.empty-state .material-icons-round {
    font-size: 80px;
    opacity: 0.2;
}
/* =========================================
   4. TELA DE CONFERÊNCIA (GRID LAYOUT RIGIDO)
   ========================================= */

.review-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding-bottom: 50px;
    max-width: 1400px;
    margin: 0 auto;
    width: 98%;
}

.review-card {
    /* MUDANÇA: Usando Grid para dividir a tela rigidamente */
    display: grid;
    grid-template-columns: 55% 45%; /* 55% Imagem, 45% Dados */
    
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    
    /* Altura Fixa Alta */
    height: 85vh; 
    min-height: 600px;
    
    box-shadow: 0 30px 60px -15px rgba(0,0,0,0.6);
}

/* LADO ESQUERDO: A FOTO */
.review-image {
    position: relative;
    background: #000;
    width: 100%;
    height: 100%; /* Força altura total */
    border-right: 2px solid #334155;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.review-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Garante que a foto inteira apareça sem cortes */
    transition: transform 0.4s ease-out;
}

.review-image:hover img { 
    transform: scale(1.6); /* Zoom potente */
    cursor: zoom-in;
}

/* Badge de Status */
.status-badge {
    position: absolute; top: 25px; left: 25px; z-index: 10;
    padding: 10px 20px; border-radius: 8px;
    font-weight: 800; font-size: 0.9rem; text-transform: uppercase;
    background: rgba(0,0,0,0.6); color: white; /* Fundo escuro para contraste na foto */
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    display: flex; align-items: center; gap: 8px;
}
.status-success { border-color: #10b981; color: #10b981; background: rgba(0,0,0,0.8); }
.status-warning { border-color: #f59e0b; color: #f59e0b; background: rgba(0,0,0,0.8); }
.status-danger  { border-color: #ef4444; color: #ef4444; background: rgba(0,0,0,0.8); }


/* LADO DIREITO: DADOS */
.review-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    gap: 20px;
    position: relative;
    height: 100%; /* Garante que o container ocupe a altura */
    box-sizing: border-box;
    overflow-y: auto;
}

/* Botão Lupa */
.btn-search-resident {
    position: absolute; top: 30px; right: 30px;
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    z-index: 20;
}
.btn-search-resident:hover { 
    background: var(--primary); 
    color: white; 
    border-color: var(--primary); 
}

/* Inputs Floating Labels */
.form-floating {
    position: relative;
    width: 100%;
}

.form-floating input {
    width: 100%;
    padding: 26px 16px 8px 16px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    height: 64px;
    box-sizing: border-box;
}

.form-floating input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-floating label {
    position: absolute;
    top: 22px; left: 16px;
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.2s ease;
}

.form-floating input:focus ~ label,
.form-floating input:not(:placeholder-shown) ~ label {
    top: 8px;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
}

/* Rodapé */
.actions-footer {
    margin-top: auto; /* Empurra para baixo */
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-confirm-lg {
    width: 100%;
    padding: 20px;
    font-size: 1.1rem;
    border-radius: 12px;
    background: var(--success);
    border: none; color: white; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-confirm-lg:hover { transform: translateY(-3px); filter: brightness(1.1); }

/* RESPONSIVIDADE (Importante!) */
@media (max-width: 1000px) {
    .review-card { 
        grid-template-columns: 1fr; /* Vira coluna única */
        grid-template-rows: 400px auto; /* Foto fixa, dados auto */
        height: auto; 
    }
    .review-image { border-right: none; border-bottom: 2px solid var(--border); }
}
/* =========================================
   5. MODAL DE BUSCA (Drill-Down)
   ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 300000; /* garante que fique acima de modais de lote/dossiê */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-content {
    background: var(--bg-card);
    width: 100%; max-width: 500px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal-content { transform: scale(1); }

.modal-header { padding: 20px; border-bottom: 1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; }

/* Campo de busca premium no modal localizar pessoa */
#search-modal .modal-content { max-width: 540px; }
#search-modal .modal-content .form-control {
    width: 100%;
    height: 52px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    font-size: 0.95rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 30px rgba(0,0,0,0.25);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
#search-modal .modal-content .form-control::placeholder {
    color: var(--text-secondary);
}
#search-modal .modal-content .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
    background: rgba(255,255,255,0.07);
}

/* Garante que o modal de busca fique acima dos demais modais */
#search-modal.modal-overlay { z-index: 400000; }
#search-modal .modal-content { position: relative; z-index: 400001; }

/* Lista de Resultados */
.search-results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.result-item {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-app);
    border: 1px solid transparent;
    cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s;
}
.result-item:hover { border-color: var(--primary); background: var(--bg-hover); }
.result-info strong { display: block; color: var(--text-primary); }
.result-info span { font-size: 0.8rem; color: var(--text-secondary); }
/* =========================================
   6. ADMIN - GESTÃO DE USUÁRIOS
   ========================================= */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 80px;
}

/* Linha do Usuário (Rich Row) */
.user-row {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.user-row:hover {
    transform: translateX(5px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

/* Ações na linha (ícones) */
.btn-icon-small {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

.btn-icon-small:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.btn-icon-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Avatar com Iniciais */
.user-avatar-large {
    width: 50px; height: 50px;
    border-radius: 14px;
    background: var(--bg-app);
    color: var(--text-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.1rem;
    margin-right: 20px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

/* Informações */
.user-info-col { flex: 1; }
.user-name { font-weight: 700; font-size: 1rem; color: var(--text-primary); display: block; }
.user-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* Badges de Cargo */
.role-badge {
    padding: 4px 10px; border-radius: 6px;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.5px;
    text-transform: uppercase;
}
.role-master { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.role-admin { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.role-portaria { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }

/* Switch iOS Style (Ativar/Desativar) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-app);
    border: 1px solid var(--text-secondary);
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px;
    left: 2px; bottom: 2px;
    background-color: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--success); border-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); background-color: white; }
input:disabled + .slider { opacity: 0.4; cursor: not-allowed; }

/* Modal de Usuários - inputs e layout */
#user-modal .modal-content {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    width: 520px;
    max-width: 95vw;
    overflow: hidden;
}

#user-modal .modal-body {
    display: grid;
    gap: 14px;
}

#user-modal .form-group label {
    display: block;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

#user-modal .form-control {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px 14px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#user-modal .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(255,255,255,0.07);
}

#user-modal select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23cbd5e1'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    padding-right: 38px;
}

#user-modal small {
    color: var(--text-secondary);
}

#user-modal .modal-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
}

#user-modal .modal-header button:hover {
    color: white;
}
/* =========================================
   7. AUDITORIA - TIMELINE (DevOps Style)
   ========================================= */

.audit-container {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    width: 300px;
}
.search-bar input {
    background: transparent; border: none; color: var(--text-primary);
    width: 100%; margin-left: 8px; outline: none;
}

/* A Linha do Tempo */
.timeline {
    position: relative;
    padding-left: 30px;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 10px;
    width: 2px;
    background: var(--border);
}

/* O Item (Evento) */
.timeline-item {
    position: relative;
    margin-bottom: 25px;
    opacity: 0;
    animation: slideInLeft 0.3s forwards;
}

/* O Ponto (Marker) */
.timeline-marker {
    position: absolute;
    left: -26px; top: 18px;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 3px solid var(--bg-app); /* Cria espaço visual */
    z-index: 2;
}
.marker-success { background: var(--success); box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
.marker-falha { background: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
.marker-info { background: var(--primary); }

/* O Card do Evento */
.audit-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.audit-card:hover { border-color: var(--primary); transform: translateX(5px); }

/* Cabeçalho do Card */
.audit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.audit-user { font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.audit-time { font-size: 0.75rem; color: var(--text-secondary); font-family: monospace; }

/* Corpo do Card */
.audit-action { font-size: 0.9rem; color: var(--text-secondary); }
.audit-action strong { color: var(--primary); }

/* Detalhes Técnicos (JSON) - Escondido por padrão */
.audit-details {
    margin-top: 15px;
    background: #0f172a; /* Sempre escuro para código */
    padding: 15px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: #a5b4fc;
    overflow-x: auto;
    display: none; /* JS vai dar toggle */
    border-left: 3px solid var(--primary);
}
.audit-card.expanded .audit-details { display: block; animation: fadeIn 0.3s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =========================================
   8. CONEXÃO WHATSAPP (Cockpit)
   ========================================= */

.connection-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.connection-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 30px 60px -12px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Header do Card */
.conn-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.1); /* Verde Zap */
    color: #25d366;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
}
.conn-icon.disconnected { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Área do QR Code */
.qr-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 30px auto;
    background: white; /* QR precisa de fundo branco */
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.qr-wrapper img {
    width: 100%; height: 100%;
    object-fit: contain;
}

/* Animação de Scanner (Laser Verde) */
.scan-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: #25d366;
    box-shadow: 0 0 15px #25d366;
    top: 0; left: 0;
    animation: scan 2.5s infinite linear;
    opacity: 0.6;
}

@keyframes scan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Estado Conectado */
.connected-state {
    animation: zoomIn 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
.device-info {
    background: var(--bg-app);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 12px;
    margin: 20px 0;
    display: flex; align-items: center; gap: 15px;
    text-align: left;
}
.device-avatar {
    width: 40px; height: 40px;
    background: #25d366;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white;
}

/* Loader */
.pulse-loader {
    width: 12px; height: 12px;
    background: var(--primary);
    border-radius: 50%;
    margin: 20px auto;
    animation: pulse-dot 1s infinite;
}
@keyframes pulse-dot { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
/* =========================================
   9. MÓDULO DE RETIRADA (Scanner & Sign)
   ========================================= */

.retirada-container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 80px;
}

/* 1. O VIEWFINDER (Scanner) */
.scanner-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1; /* Quadrado perfeito */
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
}

#qr-reader {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Moldura de Mira (Overlay) */
.scanner-overlay {
    position: absolute; inset: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 16px;
    pointer-events: none;
    z-index: 10;
}
.scanner-overlay::after {
    content: ''; position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-bottom-color: var(--primary);
    animation: pulse-border 2s infinite;
}

/* Laser de Leitura */
.scanner-laser {
    position: absolute;
    top: 0; left: 20px; right: 20px;
    height: 2px;
    background: #ef4444; /* Laser Vermelho */
    box-shadow: 0 0 20px #ef4444;
    animation: scan-vertical 2s infinite ease-in-out;
    z-index: 11;
}
@keyframes scan-vertical { 0% { top: 20px; opacity: 0; } 50% { opacity: 1; } 100% { top: calc(100% - 20px); opacity: 0; } }

/* 2. CARD DO PACOTE (Resultado) */
.package-found-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: slideUp 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.pkg-hero-image {
    height: 250px;
    background: #000;
    position: relative;
}
.pkg-hero-image img { width: 100%; height: 100%; object-fit: contain; }

.pkg-info { padding: 25px; text-align: center; }
.pkg-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.pkg-subtitle { font-size: 0.9rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

/* 3. PAD DE ASSINATURA */
.signature-area {
    background: #fff; /* Assinatura precisa de fundo branco */
    border-radius: 16px;
    padding: 10px;
    position: relative;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}
canvas#sig-canvas {
    width: 100%;
    height: 250px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none; /* Importante para não rolar a tela no celular */
}
.sig-label {
    position: absolute; bottom: 20px; left: 0; right: 0;
    text-align: center; color: #94a3b8; font-size: 0.8rem; pointer-events: none;
    text-transform: uppercase; letter-spacing: 2px;
}

/* Botões de Controle */
.sig-controls { display: flex; justify-content: space-between; margin-bottom: 20px; }
.btn-clear { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 8px 16px; border-radius: 8px; cursor: pointer; }

/* Input Manual (Fallback) */
.manual-input-wrapper {
    display: flex; gap: 10px; margin-top: 20px;
}
/* =========================================
   ESTILO GLOBAL DE BOTÕES (Absolut Cinema)
   ========================================= */

/* 1. Reset Global de Botões */
button {
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* 2. Botão Primário (Azul Neon/Gradiente)
   Usado em: Login, Novo Usuário, Salvar, Voltar */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); /* Glow Azul */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
    filter: brightness(1.1);
}

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

/* 3. Botão Outline (Secundário/Cancelar) */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* 4. Correção Específica para o Botão "Lupa" (Busca Manual) 
   Para ele ficar quadrado e alinhado com o input de texto */
.manual-input-wrapper .btn-primary {
    height: 56px;      /* Mesma altura do input */
    width: 56px;       /* Quadrado */
    padding: 0;        /* Remove padding lateral */
    margin: 0;
    border-radius: 12px;
    box-shadow: none;  /* Remove sombra para ficar flat ao lado do input */
    background: var(--bg-card); /* Fundo escuro */
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.manual-input-wrapper .btn-primary:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 5. Ícones dentro de botões */
.btn-primary .material-icons-round,
.btn-outline .material-icons-round {
    font-size: 1.2rem;
}
.dashboard-scene {
    position: relative;
    height: calc(100vh - 80px);
    width: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 40% 50%, #0f172a 0%, #020617 100%);
    
    /* MUDANÇA: Grid Bipartido */
    display: grid;
    grid-template-columns: 1fr 450px; /* Mapa (Auto) | Sidebar (Fixa) */
    grid-template-rows: 100%;
}

/* Área do Mapa (Esquerda) */
.scene-left-col {
    position: relative;
    perspective: 1500px;
    overflow: hidden;
}

/* HUD Ajustado (Para não bater na sidebar) */
.hud-bar {
    position: absolute;
    top: 20px; left: 20px; right: 80px; /* Margem direita para não bater na barra de capacidade */
    display: grid;
    /* Grid de 5 colunas iguais para alinhar perfeito */
    grid-template-columns: repeat(5, 1fr); 
    gap: 12px;
    z-index: 100;
    pointer-events: none;
}

.kpi-card {
    background: rgba(13, 18, 30, 0.7); /* Mais escuro */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px; /* Cantos menos redondos, mais técnicos */
    padding: 12px 16px; /* Padding reduzido drasticamente */
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 60px; /* Altura fixa baixa */
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Tipografia KPI */
.kpi-data h3 { font-size: 1.8rem; margin: 0; font-weight: 800; letter-spacing: -1px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.kpi-data span { font-size: 0.65rem; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; opacity: 0.8; }

/* CORES TEMÁTICAS (Estado da Arte) */
/* Amarelo: Conferência (Gargalo Operacional) */
.kpi-conferencia { border-bottom: 3px solid #f59e0b; }
.kpi-conferencia h3 { color: #fbbf24; }

/* Azul: Retirada (Fluxo Normal) */
.kpi-retirada { border-bottom: 3px solid #3b82f6; }
.kpi-retirada h3 { color: #60a5fa; }

/* Verde: Recentes (+5 dias) */
.kpi-5d { border-bottom: 3px solid #10b981; }
.kpi-5d h3 { color: #34d399; }

/* Laranja: Atenção (+15 dias) */
.kpi-15d { border-bottom: 3px solid #f97316; }
.kpi-15d h3 { color: #fb923c; }

/* Vermelho: Crítico (+30 dias) - Efeito Glow */
.kpi-30d { 
    background: rgba(220, 38, 38, 0.25) !important; /* Fundo Avermelhado */
    border: 1px solid rgba(239, 68, 68, 0.5) !important;
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.2);
    animation: red-alert-pulse 2s infinite ease-in-out;
}

.kpi-30d h3 { 
    color: #fff !important; 
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.kpi-30d .kpi-icon {
    background: rgba(239, 68, 68, 1) !important; /* Ícone Sólido */
    color: white !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
}

/* Toolbar de visão (Mapa/Lista) */
.dashboard-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 10px 16px 0 16px;
}
.view-toggle {
    display: inline-flex;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
}
.view-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.view-toggle-btn.active {
    background: var(--primary);
    color: white;
}
.view-toggle-btn .material-icons-round {
    font-size: 18px;
}

.view-mode-list .scene-left-col {
    display: none;
}
.view-mode-list #side-inspector {
    width: 100%;
    max-width: none;
}

@media (max-width: 1024px) {
    .dashboard-toolbar {
        justify-content: flex-start;
        padding: 8px 10px 0 10px;
    }
    .view-toggle {
        width: 100%;
    }
    .view-toggle-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Mobile/Tablet: mostrar apenas um modo por vez */
@media (max-width: 1024px) {
    #scene-root {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        height: auto;
        min-height: calc(100vh - 80px);
    }
    #scene-root:not(.view-mode-list) .side-inspector {
        display: none;
    }
    #scene-root.view-mode-list .scene-left-col {
        display: none;
    }
    .scene-left-col,
    #side-inspector {
        min-height: calc(100vh - 140px);
    }
}

/* Inspector scrollable */
.side-inspector {
    overflow: hidden;
}
.side-inspector .inspector-body {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding-right: 4px;
}
.side-inspector .inspector-body::-webkit-scrollbar {
    width: 6px;
}
.side-inspector .inspector-body::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}
.side-inspector .inspector-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}

@keyframes red-alert-pulse { 
    0% { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 
    50% { border-color: rgba(239, 68, 68, 1); box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); } 
    100% { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } 
}

/* =========================================
   11. MAPA 3D ISOMÉTRICO (GPU Rendering V4)
   ========================================= */

/* O UNIVERSO (Scene) */
#isometric-world {
    position: absolute;
    /* Centro exato */
    top: 70%; 
    left:50%;
    
    width: 1000px; 
    height: 1000px;
    
    /* Variáveis de Câmera */
    --rotation: 45deg; 
    --zoom: 0.8; /* Zoom seguro para não cortar */
    --pan-x: -50%;
    --pan-y: -50%;
    
    /* A Matriz de Transformação */
    transform: translate(var(--pan-x), var(--pan-y)) rotateX(60deg) rotateZ(var(--rotation)) scale(var(--zoom));
    transform-style: preserve-3d; /* CRÍTICO: Mantém o 3D para os filhos */
    
    /* Grid de Fundo */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.05);
    
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1); /* Movimento Ultra-Suave */
    cursor: grab;
    z-index: 1;
    
    /* Otimização de GPU */
    will-change: transform;
}

#isometric-world:active { cursor: grabbing; }

/* CÂMERA DINÂMICA (Targeting) */
#isometric-world.view-tower-A { --zoom: 1.3; --pan-x: -25%; --pan-y: -65%; }
#isometric-world.view-tower-B { --zoom: 1.3; --pan-x: -50%; --pan-y: -30%; }
#isometric-world.view-tower-C { --zoom: 1.3; --pan-x: -75%; --pan-y: -65%; }


/* --- TORRES (Containers) --- */
.tower-plot {
    position: absolute;
    width: 100px; 
    height: 100px;
    transform-style: preserve-3d; /* CRÍTICO: Repassa o 3D para os andares */
    transition: opacity 0.5s ease;
}

/* Coordenadas Triangulares */
.plot-B { top: 200px; left: 450px; z-index: 10; } /* Fundo */
.plot-A { top: 550px; left: 200px; z-index: 20; } /* Esq */
.plot-C { top: 550px; left: 700px; z-index: 20; } /* Dir */


/* --- SISTEMA DE FOCO (Sem quebrar o 3D) --- */

/* Torres NÃO focadas: Apenas reduz opacidade (Sem filtros pesados) */
#isometric-world.has-focus .tower-plot:not(.focused) {
    opacity: 0.15; /* Fantasma */
    pointer-events: none;
}

/* Torre FOCADA */
#isometric-world.has-focus .tower-plot.focused {
    opacity: 1;
    z-index: 100;
}


/* --- ANDARES (Engenharia Sólida) --- */

/* 1. Base no Chão */
.tower-base {
    position: absolute; width: 140%; height: 140%; left: -20%; top: -20%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; font-weight: 900; color: rgba(255,255,255,0.1);
    transform: translateZ(0px); /* Cola no chão */
    pointer-events: none;
}

/* 2. Hitbox (Interação) */
.iso-floor-hitbox {
    position: absolute;
    width: 100px; height: 100px;
    transform-style: preserve-3d; /* Obrigatório */
    cursor: pointer;
}

/* 3. Visual (Animação) */
.iso-floor-visual {
    width: 100%; height: 100%;
    transform-style: preserve-3d; /* Obrigatório */
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

/* Pulo no Hover */
/* O seletor complexo garante que só pula se a torre estiver ativa */
.tower-plot:not([style*="opacity: 0.15"]) .iso-floor-hitbox:hover .iso-floor-visual,
.iso-floor-hitbox.selected .iso-floor-visual {
    transform: translateZ(30px);
}


/* --- FACES DO CUBO (Geometria Flutuante / Anti-Clipping) --- */

/* Topo (A Laje) - Mantém tamanho total */
.face-top { 
    position: absolute;
    width: 100px; height: 100px; 
    transform: translateZ(20px); 
    background: var(--floor-color);
    /* Borda suave para definição */
    border: 1px solid rgba(255,255,255,0.15); 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1); /* Profundidade interna */
    transition: all 0.3s;
    backface-visibility: hidden; /* Performance */
}

/* Lateral Esquerda (Paredes) - REDUZIDA */
.face-side-1 { 
    position: absolute;
    width: 100px; 
    height: 14px; /* <--- REDUZIDO de 20px para 14px (Cria o Vão) */
    
    /* A matemática: Rotaciona e desce para alinhar com a borda */
    transform: rotateX(-90deg) translateZ(50px) translateY(50px); 
    
    background: var(--floor-color); 
    filter: brightness(0.6); /* Lado Sombra */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    backface-visibility: hidden;
}

/* Lateral Direita (Paredes) - REDUZIDA */
.face-side-2 { 
    position: absolute;
    width: 14px; /* <--- REDUZIDO (Note que aqui é width por causa da rotação Y) */
    height: 100px; 
    
    transform: rotateY(90deg) translateZ(50px) translateX(-50px); 
    
    background: var(--floor-color); 
    filter: brightness(0.85); /* Lado Luz */
    border-right: 1px solid rgba(255,255,255,0.1);
    backface-visibility: hidden;
}

/* --- AJUSTES DE ESTADO --- */

/* Selecionado (Branco Puro e Brilhante) */
.iso-floor-hitbox.selected .face-top {
    background: #ffffff !important;
    box-shadow: 0 0 50px #fff;
    border-color: #fff;
    z-index: 10;
}
.iso-floor-hitbox.selected .face-side-1,
.iso-floor-hitbox.selected .face-side-2 {
    background: #e2e8f0 !important;
    filter: brightness(1);
}

/* Fantasma (Vazio) - Vidro Limpo */
/* Removemos sombras para ficar leve */
.iso-floor-visual.status-ghost .face-top {
    background: rgba(255, 255, 255, 0.04) !important;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.05);
}
.iso-floor-visual.status-ghost .face-side-1,
.iso-floor-visual.status-ghost .face-side-2 {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.02);
}


/* --- TOOLTIP (Billboard System) --- */
.iso-tooltip {
    position: absolute;
    /* Eleva Z e cancela rotações para ficar legível */
    transform: translateZ(160px) rotateZ(calc(var(--rotation) * -1)) rotateX(-60deg);
    
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--primary);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 2000;
}

/* Mostra tooltip apenas quando o andar está visível e interativo */
.tower-plot:not([style*="opacity: 0.15"]) .iso-floor-hitbox:hover .iso-tooltip,
.iso-floor-hitbox.selected .iso-tooltip { 
    opacity: 1; 
}
/* =========================================
   12. PAINEL LATERAL FIXO (Control Center)
   ========================================= */

.inspector-search-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px; /* Mais respiro */
}

.inspector-search {
    width: 100%;
    height: 54px; /* Mais alto para facilitar o toque */
    
    /* Fundo Escuro com Profundidade */
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    
    padding: 0 20px 0 50px; /* Padding esquerdo grande para o ícone */
    
    color: #fff;
    font-size: 1rem;
    font-family: var(--font-main);
    font-weight: 500;
    
    /* Sombra interna para dar sensação de "buraco" */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.inspector-search::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.inspector-search:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.5),
        0 0 0 1px var(--primary); /* Anel fino de foco */
}

/* Ícone da Lupa */
.search-icon-3d {
    position: absolute;
    left: 16px; 
    top: 50%;
    transform: translateY(-50%);
    
    color: var(--text-secondary);
    font-size: 22px;
    pointer-events: none;
    transition: color 0.3s;
}

.inspector-search:focus + .search-icon-3d,
.inspector-search-wrapper:focus-within .search-icon-3d {
    color: var(--primary); /* Ícone acende quando foca */
}

/* Chips de Filtro (Estilo iOS) */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    /* Esconde scrollbar */
    scrollbar-width: none; 
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-chip:hover { background: rgba(255,255,255,0.1); color: #fff; }

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

/* Chips de Alerta (Vermelho/Laranja) */
.filter-chip.chip-danger.active { background: var(--danger); border-color: var(--danger); box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3); }
.filter-chip.chip-warning.active { background: var(--warning); border-color: var(--warning); box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3); }


/* CORREÇÃO DO CARD DE ENCOMENDA (Imagem Gigante) */
.pkg-card-mini {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    
    /* MUDANÇA CRÍTICA: Permite que a imagem de zoom saia para fora do card */
    overflow: visible !important; 
}

.pkg-card-mini:hover { background: rgba(255, 255, 255, 0.05); z-index: 10; /* Traz card pra frente */ }
.pkg-card-mini.selected { background: rgba(16, 185, 129, 0.1); border-color: #10b981; }

/* A MINIATURA (Com Zoom Hover) */
.pkg-mini-img {
    width: 50px; 
    height: 50px;
    min-width: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #000;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
    
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    transform-origin: center left;
    position: relative;
    z-index: 1;
}

/* O Efeito de Lupa */
.pkg-mini-img:hover,
.pkg-mini-img.zoomed {
    transform: scale(4.5) translateX(20px); /* Zoom Grande */
    z-index: 9999; /* Garante que fique acima de TUDO */
    box-shadow: 0 20px 50px rgba(0,0,0,0.9);
    border-color: #fff;
    border-radius: 4px;
}

/* Resto das informações */
.pkg-mini-info { flex: 1; overflow: hidden; pointer-events: none; /* Evita conflito com hover da img */ }
.pkg-mini-info h4 { margin: 0; font-size: 0.9rem; color: #fff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;}
.pkg-mini-info p { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-secondary); }

.pkg-select { width: 18px; height: 18px; accent-color: var(--success); cursor: pointer; margin-left: 5px; }

.pkg-badge-time {
    align-self: flex-start; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px;
    background: rgba(255,255,255,0.1); color: var(--text-secondary); font-weight: 700; text-transform: uppercase;
}
.pkg-badge-time.late { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Footer Fixo no Bottom */
.inspector-footer {
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
/* --- CORREÇÃO DA SCROLLBAR (Painel Lateral) --- */
.inspector-body {
    flex: 1;
    overflow-y: auto; /* Garante rolagem vertical */
    overflow-x: hidden;
    min-height: 0; /* Truque do Flexbox para permitir scroll interno */
    padding: 20px;
    padding-bottom: 40px; /* Espaço extra no fim */
}

/* Scrollbar Estilizada (Webkit) */
.inspector-body::-webkit-scrollbar { width: 6px; }
.inspector-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.inspector-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.inspector-body::-webkit-scrollbar-thumb:hover { background: var(--primary); }
/* =========================================
   13. CAPACITY GAUGE 3D (Barra Lateral)
   ========================================= */

.capacity-sidebar {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60vh; /* Ocupa boa parte da altura */
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

/* O Tubo 3D */
.gauge-tube {
    width: 40px;
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8); /* Profundidade interna */
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

/* O Líquido (Enchimento) */
.gauge-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 0%; /* JS vai mudar isso */
    background: linear-gradient(to top, var(--success), #34d399);
    border-top: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 0 20px var(--success);
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s;
    opacity: 0.8;
}

/* Variações de cor do líquido baseadas na lotação */
.gauge-fill.medium { background: linear-gradient(to top, #f59e0b, #fbbf24); box-shadow: 0 0 20px #f59e0b; }
.gauge-fill.full { background: linear-gradient(to top, #ef4444, #f87171); box-shadow: 0 0 30px #ef4444; animation: liquid-pulse 2s infinite; }

/* Marcadores de Nível */
.gauge-marks {
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 19%,
        rgba(255, 255, 255, 0.1) 20%
    );
    pointer-events: none;
    z-index: 2;
}

/* Labels */
.capacity-label-top, .capacity-label-bottom {
    font-size: 0.7rem; color: var(--text-secondary); font-weight: 700; text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

@keyframes liquid-pulse { 0% { opacity: 0.8; } 50% { opacity: 1; } 100% { opacity: 0.8; } }
/* =========================================
   14. MODAL DE BAIXA EM LOTE (Checkout)
   ========================================= */

/* Carrossel de Imagens */
.batch-carousel {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0 20px 0;
    margin-bottom: 20px;
    /* Scrollbar fina */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.batch-item {
    min-width: 140px;
    width: 140px;
    background: var(--bg-card); /* Fundo escuro */
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    cursor: zoom-in;
    transition: transform 0.2s;
}

.batch-item:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.batch-item img {
    width: 100%;
    height: 110px; /* Altura fixa para a foto */
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.batch-item span {
    display: block;
    font-size: 0.7rem;
    padding: 8px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

/* Área de Assinatura no Modal */
.modal-content .signature-area {
    background: white;
    border-radius: 12px;
    margin-top: 15px;
    border: 2px dashed #cbd5e1;
}

.total-summary {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1.1rem;
}
/* =========================================
   15. LIGHTBOX (Visualizador de Imagem)
   ========================================= */

.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; 
    width: 100vw; height: 100vh;
    
    /* Fundo escuro para foco */
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(5px);
    
    /* Z-Index Altíssimo para ficar acima do Modal de Lote (que costuma ser z-index: 5000) */
    z-index: 999999 !important; 
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Estado inicial: Escondido */
    opacity: 0;
    visibility: hidden; 
    transition: opacity 0.3s ease, visibility 0.3s;
    cursor: zoom-out;
}

.lightbox-overlay.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-img {
    /* Tamanho: Grande, mas respeitando margens */
    max-width: 85vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    
    /* Animação de Entrada (Pop) */
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    
    /* Garante que a imagem não capture o clique de fechar do fundo, mas seja visível */
    pointer-events: auto;
}

.lightbox-overlay.open .lightbox-img {
    transform: scale(1);
}
/* =========================================
   16. MODAL DOSSIÊ & TIMELINE (High-End UX)
   ========================================= */

/* Container do Modal (Vidro Profundo) */
.dossier-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dossier-modal.open {
    opacity: 1;
    pointer-events: auto;
}

/* O Cartão Principal */
.dossier-content {
    width: 900px;
    max-width: 95%;
    height: 85vh;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.8);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.dossier-modal.open .dossier-content {
    transform: scale(1) translateY(0);
}

/* Layout Interno (Grid Bipartido) */
.dossier-body {
    flex: 1;
    display: grid;
    grid-template-columns: 400px 1fr; /* Esquerda (Info) | Direita (Timeline) */
    overflow: hidden;
}

/* --- COLUNA DA ESQUERDA (INFO & 3D FOTO) --- */
.dossier-info-col {
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}
.dossier-edit-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.dossier-edit-input:focus {
    border-color: var(--primary);
    outline: none;
    background: rgba(0, 0, 0, 0.5);
}

/* Card 3D da Foto (Efeito Tilt) */
.photo-3d-wrapper {
    width: 100%;
    aspect-ratio: 4/3;
    perspective: 1000px; /* Profundidade 3D */
}

.photo-3d-card {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s; /* Rápido para seguir o mouse */
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    cursor: zoom-in;
}

.photo-3d-card img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Overlay de Status na Foto */
.photo-status-badge {
    position: absolute;
    bottom: 15px; left: 15px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    transform: translateZ(20px); /* Flutua acima da foto */
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

/* Dados do Morador */
.dossier-resident-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
}
.d-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px; margin-bottom: 4px; }
.d-value { font-size: 1.1rem; color: #fff; font-weight: 600; margin-bottom: 15px; }

/* --- COLUNA DA DIREITA (TIMELINE) --- */
.dossier-timeline-col {
    padding: 30px 40px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(0,0,0,0.2) 100%);
}

.dossier-gallery {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.dossier-thumb {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    opacity: 0.6;
    transition: all 0.2s ease;
    background: #000;
}

.dossier-thumb:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.dossier-thumb.active {
    opacity: 1;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* --- ASSINATURA NA TIMELINE --- */
.timeline-signature-box {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    border: 2px dashed #cbd5e1;
    width: fit-content;
}

.timeline-signature-box img {
    height: 60px;
    display: block;
    filter: contrast(1.2); /* Melhora visibilidade do traço */
}

.timeline-track {
    position: relative;
    padding-left: 30px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.timeline-event {
    position: relative;
    margin-bottom: 40px;
    opacity: 0;
    animation: slideInUp 0.4s forwards;
}

/* O Ponto Brilhante */
.t-dot {
    position: absolute;
    left: -36px; top: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--bg-app);
    border: 2px solid var(--text-secondary);
    box-shadow: 0 0 0 4px var(--bg-app); /* Espaçamento visual */
}

/* Cores de Estado */
.t-dot.green { border-color: var(--success); box-shadow: 0 0 0 4px var(--bg-app), 0 0 15px var(--success); background: var(--success); }
.t-dot.red { border-color: var(--danger); box-shadow: 0 0 0 4px var(--bg-app), 0 0 15px var(--danger); background: var(--danger); }
.t-dot.blue { border-color: var(--primary); box-shadow: 0 0 0 4px var(--bg-app), 0 0 15px var(--primary); background: var(--primary); }

.t-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 15px 20px;
    border-radius: 12px;
    position: relative;
}

/* Triângulo do balão */
.t-content::before {
    content: ''; position: absolute;
    left: -6px; top: 12px;
    width: 10px; height: 10px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transform: rotate(45deg);
}

.t-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.85rem; }
.t-time { color: var(--text-secondary); font-family: monospace; }
.t-user { font-weight: 700; color: var(--primary); }

.t-body { color: #cbd5e1; font-size: 0.95rem; line-height: 1.5; }
.t-icon { vertical-align: middle; margin-right: 5px; font-size: 1.1rem; }

/* RODAPÉ DE AÇÕES */
.dossier-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    background: var(--bg-app);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.actions-group { display: flex; gap: 10px; }

/* Responsividade Tablet */
@media (max-width: 900px) {
    .dossier-body { grid-template-columns: 1fr; }
    .dossier-info-col { border-right: none; border-bottom: 1px solid var(--border); max-height: 300px; }
}

@keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* =========================================
   17. MÓDULO ESTOQUE (Prateleira Digital)
   ========================================= */

/* Layout Principal (Grid Híbrido) */
.stock-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
    position: relative;
    gap: 20px;
}

/* --- SIDEBAR DE FILTROS (Esquerda) --- */
.stock-filters {
    width: 280px;
    background: rgba(13, 18, 30, 0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 25px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    
    /* Scroll suave se tiver muitos filtros */
    overflow-y: auto;
}

.filter-group h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    font-weight: 700;
}

/* Item de Filtro (Botão Tecnológico) */
.filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.filter-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.filter-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.filter-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}
.filter-item.active .filter-count { background: var(--primary); color: white; }

/* --- ÁREA PRINCIPAL (Grid de Cards) --- */
.stock-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-right: 20px; /* Espaço para scroll */
}

/* Toolbar Superior (Busca e Ordenação) */
.stock-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

/* O Grid Responsivo */
.stock-grid {
    display: grid;
    /* Cards com largura mínima de 220px, preenchendo o espaço */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding-bottom: 80px; /* Espaço para a barra de ação flutuante */
    overflow-y: auto;
    padding-right: 5px;
}

.stock-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    
    /* CORREÇÃO DE ESTABILIDADE */
    display: flex;
    flex-direction: column;
    height: 100%;       /* Ocupa a altura da célula do grid */
    min-height: 280px;  /* Impede que vire uma linha fina */
}

.stock-card:hover {
    transform: translateY(-5px) scale(1.02);
    z-index: 10;
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.3);
}

.stock-card.selected {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 0 2px var(--success);
}

/* Header do Card (Foto) */
.card-img-wrapper {
    height: 160px; /* Altura fixa inegociável */
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #000;
    flex-shrink: 0; /* Impede que o flexbox esmague a foto */
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.card-img-wrapper img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.5s;
}
.stock-card:hover .card-img-wrapper img { transform: scale(1.1); }

/* Indicador de Status (Barra colorida no topo) */
.status-line {
    height: 4px; width: 100%; position: absolute; top: 0; left: 0; z-index: 2;
}
.status-normal .status-line { background: var(--success); box-shadow: 0 0 10px var(--success); } /* Verde (<5) */
.status-atencao-leve .status-line { background: #06b6d4; box-shadow: 0 0 10px #06b6d4; } /* Ciano (5-15) */
.status-atencao .status-line { background: var(--warning); box-shadow: 0 0 10px var(--warning); } /* Laranja (15-30) */
.status-critico .status-line { background: var(--danger); box-shadow: 0 0 15px var(--danger); } /* Vermelho (>30) */

/* Checkbox Flutuante */
.card-check {
    position: absolute; top: 10px; right: 10px; z-index: 5;
    width: 26px; height: 26px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.4);
    transition: all 0.2s;
}
.stock-card:hover .card-check { border-color: white; }
.stock-card.selected .card-check { background: var(--success); border-color: var(--success); }
.card-check span { font-size: 18px; color: white; display: none; }
.stock-card.selected .card-check span { display: block; }

/* Corpo do Card */
.card-body { 
    padding: 15px; 
    flex: 1; /* Ocupa o resto do espaço */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Espalha o conteúdo */
}

.card-title { 
    font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 5px; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
}
.card-meta { 
    font-size: 0.85rem; color: var(--text-secondary); 
    display: flex; justify-content: space-between; align-items: center; 
    margin-top: 5px;
}

.card-days { 
    font-weight: 700; font-size: 0.7rem; padding: 3px 8px; border-radius: 6px; 
    background: rgba(255,255,255,0.05); color: #fff; border: 1px solid rgba(255,255,255,0.1);
}

/* Cores do Badge de Dias */
.status-critico .card-days { color: #fca5a5; background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); }
.status-atencao .card-days { color: #fdba74; background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.3); }
.status-atencao-leve .card-days { color: #67e8f9; background: rgba(6, 182, 212, 0.15); border-color: rgba(6, 182, 212, 0.3); }


/* --- RESPONSIVIDADE (Tablet/Mobile) --- */
@media (max-width: 900px) {
    .stock-sidebar {
        position: absolute;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%); /* Esconde por padrão */
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .stock-sidebar.open { transform: translateX(0); }
    
    .stock-main { padding-left: 0; }
    
    /* Botão de abrir filtro (só aparece no mobile) */
    .mobile-filter-btn { display: flex !important; }
}

/* Botão Flutuante de Ação (Bulk Action) */
.bulk-action-bar {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 15px 30px;
    border-radius: 50px;
    display: flex; align-items: center; gap: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bulk-action-bar.visible { transform: translateX(-50%) translateY(0); }
/* =========================================
   18. MÓDULO MORADORES (CRM 360º)
   ========================================= */

/* Layout Principal */
.crm-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Header de Controle */
.crm-toolbar {
    display: flex;
    gap: 15px;
    background: rgba(13, 18, 30, 0.6);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    align-items: center;
}

/* GRID DE CARDS (Responsivo Automático) */
.resident-grid {
    display: grid;
    /* Cards com largura inteligente: enchem a tela, mínimo 300px */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding-right: 5px; /* Espaço para scroll */
    padding-bottom: 100px;
}

/* --- O CARD DE IDENTIDADE --- */
.res-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

.res-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.2);
}

/* Estado: Com Pendência (Borda Pulsante Sutil) */
.res-card.has-pending {
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-card) 40%);
}

/* Avatar no Card */
.res-avatar-small {
    width: 60px; height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
    background: #000;
}
.res-card.has-pending .res-avatar-small {
    border-color: var(--warning);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

/* Informações */
.res-info { flex: 1; overflow: hidden; }
.res-name { font-size: 1rem; font-weight: 700; color: #fff; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-unit { font-size: 0.8rem; color: var(--primary); font-weight: 600; margin-top: 4px; display: block; }
.res-contact { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 5px; }

/* Badge de Pendência (Caixa 3D) */
.pending-badge {
    position: absolute; top: 15px; right: 15px;
    background: var(--warning); color: #000;
    font-size: 0.7rem; font-weight: 800;
    padding: 4px 8px; border-radius: 6px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
    animation: bounce-slow 2s infinite;
}

@keyframes bounce-slow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* --- MODAL DE PERFIL 360º (Super Modal) --- */
.profile-modal-content {
    width: 900px; max-width: 95%; height: 85vh;
    background: #0f172a; /* Fundo sólido para performance */
    border-radius: 20px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.9);
    border: 1px solid rgba(255,255,255,0.1);
    flex-direction: row;
    position: relative;
    position: relative;
}

/* Coluna Esquerda: A Identidade */
.profile-sidebar {
    width: 300px;
    background: rgba(30, 41, 59, 0.5);
    border-right: 1px solid var(--border);
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow-y: auto;
}

/* Foto Grande Editável */
.profile-avatar-wrapper {
    width: 180px; height: 180px;
    position: relative;
    cursor: pointer;
    group: hover;
}
.profile-avatar-large {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: all 0.3s;
}
.profile-avatar-wrapper:hover .profile-avatar-large { border-color: var(--primary); filter: brightness(0.7); }
.avatar-edit-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: white; font-size: 40px; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.profile-avatar-wrapper:hover .avatar-edit-icon { opacity: 1; }

/* Coluna Direita: O Conteúdo (Abas) */
.profile-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
}

/* Navegação de Abas */
.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.tab-btn.active { color: white; border-bottom-color: var(--primary); background: rgba(255,255,255,0.02); }
.tab-btn:hover { color: white; }

/* Conteúdo da Aba */
.tab-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: none; /* Escondido por padrão */
}
.tab-content.active { display: block; animation: fadeIn 0.3s; }

/* Estilo para lista de Autorizados e Familiares */
.auth-person-row {
    display: flex; align-items: center; gap: 15px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
}

/* Widget de Câmera (Modal sobre Modal) */
  .webcam-overlay {
    position: absolute; inset: 0;
    background: #000; z-index: 50;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
}
  .webcam-circle-mask {
    width: 250px; height: 250px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.8); /* Escurece o resto */
    z-index: 2;
}

.webcam-overlay .btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff !important;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
    border: 1px solid rgba(59, 130, 246, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.webcam-overlay .btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.webcam-overlay .btn-outline {
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.05);
    font-weight: 700;
}

.webcam-overlay .btn-outline:hover {
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

/* Responsividade Mobile */
@media (max-width: 900px) {
    .profile-modal-content { flex-direction: column; height: 100vh; width: 100%; border-radius: 0; }
    .profile-sidebar { width: 100%; flex-direction: row;
    position: relative;
    position: relative; padding: 15px; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .profile-avatar-wrapper { width: 80px; height: 80px; }
    .profile-name-group { text-align: left; }
}
.res-avatar-wrapper {
    position: relative;
    width: 60px; height: 60px;
}

/* Bolinha de Status (Verde/Laranja) */
.status-dot {
    position: absolute; bottom: 0; right: 0;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.dot-green { background: #10b981; box-shadow: 0 0 10px #10b981; }
.dot-orange { background: #f59e0b; }

/* Bordas do Card */
.res-card.border-success { border-left: 3px solid #10b981; }
.res-card.border-warning { border-left: 3px solid #f59e0b; }

/* Ícone de Pendência 3D */
.pendency-floater {
    position: absolute; 
    top: 10px;        /* Traz para dentro */
    right: 10px;      /* Traz para dentro */
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #000;
    padding: 6px 12px;
    border-radius: 20px; /* Mais arredondado */
    font-weight: 800;
    font-size: 0.75rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); /* Sombra mais forte para destacar */
    z-index: 10;
    border: 2px solid rgba(255,255,255,0.2); /* Borda sutil */
    
    /* Animação suave */
    animation: float-badge 3s infinite ease-in-out;
}

@keyframes float-badge {
    0%, 100% { transform: translateY(0) rotate(5deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}
/* =========================================
   19. SEARCH & IDENTITY (Visual Premium)
   ========================================= */

/* --- LISTA DE BUSCA COM AVATAR --- */
.search-results {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 15px; /* Espaço entre foto e texto */
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.result-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

/* A Foto na Lista de Busca */
.result-avatar {
    width: 42px; 
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #1e293b;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.result-info strong {
    color: #fff;
    font-size: 0.95rem;
}

.result-info span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Badge de Localização na Busca */
.result-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}


/* --- IDENTITY CARD (No Modal de Lote) --- */
/* Substitui os estilos inline que usamos antes por classes robustas */

.identity-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

/* Brilho de fundo sutil */
.identity-card::before {
    content: ''; position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(59,130,246,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.id-avatar-wrapper {
    position: relative;
}

.id-avatar-img {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
}

.id-status-dot {
    position: absolute; 
    bottom: 2px; right: 2px;
    width: 22px; height: 22px;
    background: #10b981;
    border: 4px solid var(--bg-card); /* Cria recorte visual */
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.id-info small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 5px;
}

.id-info h3 {
    margin: 0;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}

.id-info .unit-badge {
    display: inline-block;
    margin-top: 5px;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
}
/* --- INDICADOR DE STATUS WHATSAPP (Sidebar) --- */
.wa-status-dot {
    position: absolute;
    bottom: 0; 
    right: -2px;
    width: 8px; 
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar); /* Cria uma borda "negativa" para separar do ícone */
    transition: all 0.3s ease;
    z-index: 10;
}

/* Estado: Conectado (Verde Pulsante) */
.wa-status-dot.connected {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: wa-pulse 2s infinite;
}

/* Estado: Desconectado (Vermelho Alerta) */
.wa-status-dot.disconnected {
    background-color: #ef4444;
    box-shadow: none;
    opacity: 0.8;
}

@keyframes wa-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
body.power-save-mode * {
    animation-play-state: paused !important;
    transition: none !important;
}

body.no-scroll {
    overflow: hidden;
}
/* =========================================
   RESPONSIVIDADE (MOBILE-ONLY TWEAKS)
   Mantém desktop intacto; aplica em < 992px e < 768px.
   ========================================= */

@media (max-width: 992px) {
    /* Sidebar off-canvas com overlay, controlada pelo botão hambúrguer */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: left 0.25s ease;
        z-index: 120000;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 119000;
        display: none;
    }
    .sidebar-overlay.open { display: block; }

    /* Toolbars principais: busca e filtros empilhados */
    .stock-toolbar,
    .inspector-header,
    .analytics-toolbar,
    .bi-toolbar,
    .dashboard-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .inspector-search-wrapper,
    .inspector-search {
        width: 100% !important;
    }

    /* Lista lateral do dashboard/estoque: ocupa toda a largura no modo lista */
    .side-inspector {
        width: 100%;
        position: relative;
    }
}

@media (max-width: 768px) {
    /* Grids viram coluna única */
    .stock-grid,
    .resident-grid,
    .review-grid,
    .charts-grid,
    .charts-layout {
        grid-template-columns: 1fr !important;
    }

    /* Cards e modais: padding menor e full-width */
    .stock-main,
    .stock-layout,
    .dossier-content,
    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
        padding: 10px;
        box-sizing: border-box;
    }
    .dossier-body,
    .dossier-content {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }
    .dossier-resident-card,
    .dossier-timeline-col {
        width: 100%;
    }

    /* Botões touch-friendly */
    button,
    .btn-primary,
    .btn-outline,
    .btn-toggle {
        min-height: 44px;
    }

    /* Campos de busca e filtros */
    .filter-chips {
        flex-wrap: wrap;
    }
    .filter-chip {
        flex: 1 1 45%;
        text-align: center;
    }

    /* Modais de busca: full height */
    .modal-overlay .modal-content {
        max-height: 95vh;
        overflow-y: auto;
    }

    /* DASHBOARD 3D em mobile: compactar torres e gauge */
    .dashboard-scene {
        flex-direction: column;
        gap: 12px;
    }
    .scene-left-col {
        width: 100%;
        min-height: 320px;
    }
    #isometric-world {
        transform: scale(0.75);
        transform-origin: top center;
        min-height: 320px;
    }
    .capacity-sidebar {
        left: auto !important;
        right: 10px !important;
        transform: scale(0.8);
        transform-origin: top right;
    }

    /* Dashboard: em mobile, prioriza o mapa 3D; lista só quando alternar para "Lista" */
    #scene-root:not(.view-mode-list) .side-inspector {
        display: none;
    }
    #scene-root:not(.view-mode-list) .scene-left-col {
        width: 100%;
    }
    #scene-root.view-mode-list .scene-left-col {
        display: none;
    }
    #scene-root.view-mode-list .side-inspector {
        display: block;
        width: 100%;
        position: relative;
    }
}

/* Hamburguer (desktop hidden) */
.sidebar-hamburger {
    display: none;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 12px;
    width: 40px; height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.sidebar-hamburger .material-icons-round { font-size: 24px; }
@media (max-width: 992px) {
    .sidebar-hamburger { display: inline-flex; margin-left: auto; }
}
/* =========================================
   20. BI & PRODUTIVIDADE (Gamification UI)
   ========================================= */

.bi-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* --- FILTROS DE DATA (Barra Superior) --- */
.bi-toolbar {
    background: rgba(13, 18, 30, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 15px 25px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.date-group {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.date-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-main);
    color-scheme: dark; /* Força calendário dark no navegador */
}

.podium-container {
    background: radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    padding: 40px 0 0 0;
    border-radius: 20px;
    margin-bottom: 40px;
    border: 1px solid rgba(255,255,255,0.05);
}

.podium-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 350px;
    gap: 25px;
}

.podium-step {
    width: 180px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

/* O Bloco Sólido */
.step-block {
    width: 100%;
    border-radius: 12px 12px 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    backdrop-filter: blur(10px);
    transition: height 1s cubic-bezier(0.19, 1, 0.22, 1);
    height: 0; /* JS vai animar a altura */
}

/* Avatar Flutuante */
.rank-avatar {
    width: 70px; height: 70px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    top: -35px;
    border: 3px solid;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    background: #0f172a;
    z-index: 10;
}

/* 1º LUGAR (OURO) */
.rank-1 .step-block { 
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0) 100%);
    border-top: 4px solid #fbbf24;
    box-shadow: 0 0 50px rgba(251, 191, 36, 0.1);
}
.rank-1 .rank-avatar { border-color: #fbbf24; }
.rank-1 .rank-medal { color: #fbbf24; text-shadow: 0 0 15px #fbbf24; font-size: 2.5rem; margin-bottom: 5px; }

/* 2º LUGAR (PRATA) */
.rank-2 .step-block { 
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.2) 0%, rgba(148, 163, 184, 0) 100%);
    border-top: 4px solid #94a3b8;
}
.rank-2 .rank-avatar { border-color: #94a3b8; }
.rank-2 .rank-medal { color: #94a3b8; text-shadow: 0 0 15px #94a3b8; font-size: 2rem; margin-bottom: 5px; }

/* 3º LUGAR (BRONZE) */
.rank-3 .step-block { 
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.2) 0%, rgba(217, 119, 6, 0) 100%);
    border-top: 4px solid #d97706;
}
.rank-3 .rank-avatar { border-color: #d97706; }
.rank-3 .rank-medal { color: #d97706; text-shadow: 0 0 15px #d97706; font-size: 1.8rem; margin-bottom: 5px; }

/* Textos */
.rank-name { font-weight: 700; color: #fff; font-size: 1rem; margin-top: 5px; }
.rank-score { font-size: 0.8rem; color: rgba(255,255,255,0.6); text-transform: uppercase; font-weight: 600; letter-spacing: 1px; }
.rank-xp { font-size: 1.2rem; font-weight: 800; color: white; margin-top: 5px; }

/* --- GRID DE GRÁFICOS --- */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Timeline maior, Pizza menor */
    gap: 20px;
}

/* --- QUICK STATS (Topo) --- */
.quick-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.q-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.q-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.3);
}

.q-stat-card.highlight {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(251, 191, 36, 0.05));
    border-color: rgba(251, 191, 36, 0.4);
}

.q-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.q-stat-card.highlight .q-icon {
    background: rgba(251, 191, 36, 0.25);
    color: #fbbf24;
}

.q-info h4 {
    margin: 0;
    font-size: 1.4rem;
    color: white;
    line-height: 1.2;
}

.q-info span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.chart-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
}
.chart-header h3 { margin: 0; font-size: 1.1rem; color: #fff; }

/* Responsividade */
@media (max-width: 900px) {
    .charts-grid { grid-template-columns: 1fr; }
    .podium-wrapper { transform: scale(0.8); }
}
/* =========================================
   21. MÓDULO ANALYTICS (BI Studio)
   ========================================= */

.analytics-layout {
    display: flex;
    height: 100%;
    gap: 20px;
    overflow: hidden;
}

/* Sidebar de Filtros (Estilo Vidro Escuro) */
.analytics-sidebar {
    width: 300px;
    background: rgba(13, 18, 30, 0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow-y: auto;
    z-index: 10;
}

.filter-section h4 {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    font-weight: 700;
}

/* Chips de Tempo (Pílulas) */
.time-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.time-chip {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.time-chip:hover { background: rgba(255,255,255,0.1); color: white; }

.time-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Área Principal (Grid de Dashboards) */
.analytics-main {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 80px;
}

/* KPI Row (Cards do Topo) */
.analytics-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.kpi-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.kpi-stat-box h3 { font-size: 2rem; margin: 0; color: white; }
.kpi-stat-box span { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; }

/* Grid de Gráficos */
.charts-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Colunas */
    gap: 20px;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    min-height: 400px; /* Altura garantida */
}

.chart-container.full-width {
    grid-column: 1 / -1; /* Ocupa toda a largura */
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.pill-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.4);
  color: #fff;
}

/* Responsividade */
@media (max-width: 1100px) {
    .charts-layout { grid-template-columns: 1fr; }
}
/* =========================================
   ESTILO DE DROPDOWN PREMIUM (Select)
   ========================================= */

select.form-control {
    /* 1. Remove o estilo nativo feio do navegador */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* 2. Visual de Vidro */
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    
    /* 3. Tipografia e Espaçamento */
    color: #e2e8f0; /* Texto claro */
    font-family: var(--font-main);
    font-size: 0.9rem;
    padding: 12px 16px;
    padding-right: 40px; /* Espaço extra na direita para a seta */
    
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 4. A Seta Customizada (Ícone Chevron SVG injetado via CSS) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

/* Estado: Hover */
select.form-control:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Estado: Foco (Clicado) */
select.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow); /* Anel de luz */
    background-color: rgba(0, 0, 0, 0.5);
    
    /* Muda a cor da seta para azul quando focado */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* As Opções da Lista (Dropdown aberto) */
/* Nota: Navegadores limitam muito a estilização aqui, mas o fundo escuro funciona */
select.form-control option {
    background-color: #1e293b; /* Azul escuro sólido */
    color: white;
    padding: 10px;
}

select.form-control option:disabled {
    color: #64748b;
    font-style: italic;
}
.date-row {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    align-items: center;
}

.date-input-mini {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 6px;
    font-family: var(--font-main);
    font-size: 0.75rem;
    width: 100%;
    color-scheme: dark; /* Força o calendário nativo a ser escuro */
}

.date-input-mini:focus {
    border-color: var(--primary);
    outline: none;
    color: white;
}





/* Botao de fechar no modal de perfil */
.profile-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: all 0.2s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.profile-close-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}
.profile-close-btn .material-icons-round {
    font-size: 20px;
}



/* Botão flutuante de fechar no modal de perfil/logística */
.profile-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: all 0.2s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.profile-close-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}
.profile-close-btn .material-icons-round {
    font-size: 20px;
}

