/* ===================================
   ESTÉTICA PREMIUM - DARK LUXURY (VERSÃO FINAL FUNCIONAL)
   =================================== */

:root {
    /* --- CORES DARK MODE --- */
    --bg-body: #121212;
    --bg-sidebar: #1A1A1A;
    --bg-card: #252525;
    --bg-input: #2C2C2C;
    --bg-hover: #333333;
    
    /* --- TEXTOS --- */
    --text-primary: #ECECEC;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;

    /* --- DOURADO --- */
    --gold: #D4AF37;
    --gold-light: #F4E4C1;
    --gold-dark: #B8941E;
    --gold-glow: rgba(212, 175, 55, 0.25);
    
    /* --- STATUS --- */
    --success: #66BB6A;
    --warning: #FFA726;
    --error: #EF5350;
    --info: #29B6F6;

    /* --- TIPOGRAFIA & BASE --- */
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Montserrat', sans-serif;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* ===================================
   RESET & ESTRUTURA
   =================================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ===================================
   SIDEBAR (MENU LATERAL)
   =================================== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid #333;
    z-index: 2001;
    transform: translateX(-100%);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

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

.sidebar-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid #333;
}

.sidebar-header i {
    font-size: 2.5rem;
    color: var(--gold);
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-size: 1.6rem;
}

.menu-item {
    padding: 1rem 2rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
    color: var(--gold);
    border-left-color: var(--gold);
}

.main-content {
    min-height: 100vh;
    transition: var(--transition);
    padding-bottom: 80px;
}

@media (max-width: 768px) {
    /* 1. Arrumar o container do cabeçalho */
    .app-header {
        /* Adiciona margem segura para o topo (Notch do iPhone) */
        padding-top: max(10px, env(safe-area-inset-top)) !important;
        padding-bottom: 10px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        
        height: auto !important;
        min-height: 60px;
        
        /* Garante que os itens fiquem na linha certa */
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        
        /* Garante que o fundo cubra tudo */
        background-color: #121212 !important; 
        position: sticky !important;
        top: 0 !important;
        z-index: 9999 !important;
    }

    /* 2. Esconder qualquer logo/texto "Estética Premium" que esteja sobrando */
    /* Se houver uma imagem ou div extra, isso vai sumir com ela no celular */
    .app-header > img,
    .app-header > .sidebar-header,
    .app-header > div:not(.header-actions) {
        display: none !important;
    }

    /* 3. Título da Página (Dashboard, Clientes...) - Centralizado e Ajustado */
    .app-header h1#pageTitle {
        display: block !important; /* Força aparecer */
        font-size: 1.1rem !important;
        text-align: center !important;
        flex: 1 !important; /* Ocupa o meio */
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--gold) !important;
        line-height: 1.2;
    }

    /* 4. Botões Laterais (Menu e Sino) - Tamanho Fixo */
    .menu-toggle, 
    .header-actions {
        flex-shrink: 0 !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .menu-toggle { justify-content: flex-start !important; }
    .header-actions { justify-content: flex-end !important; }
}

/* ===================================
   HEADER & NOTIFICAÇÕES
   =================================== */
.app-header {
    background-color: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #333;
}

.app-header h1 {
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: 1.8rem;
}

.header-actions { position: relative; display: flex; gap: 15px; }

.icon-btn {
    background: var(--bg-card);
    border: 1px solid #444;
    color: var(--text-primary);
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    position: relative;
}

.icon-btn:hover { border-color: var(--gold); color: var(--gold); }

.notification-badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--error); color: white;
    font-size: 0.7rem; padding: 2px 6px; border-radius: 10px;
}

/* --- FIX: NOTIFICAÇÕES --- */
/* Só aparece se tiver a classe .active */
.notifications-dropdown {
    display: none; /* ESCONDIDO POR PADRÃO */
    position: absolute;
    top: 50px; right: 0; width: 320px;
    background-color: var(--bg-card);
    border: 1px solid #444;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 5000;
}

.notifications-dropdown.active {
    display: block !important; /* FORÇA APARECER */
    animation: slideDown 0.2s ease;
}

.notif-header { padding: 15px; border-bottom: 1px solid #444; color: var(--gold); font-weight: 600; }
.notif-item { padding: 12px 15px; border-bottom: 1px solid #333; display: flex; gap: 10px; cursor: pointer; }
.notif-item:hover { background-color: var(--bg-hover); }
.notif-content h4 { font-size: 0.9rem; margin: 0; color: var(--text-primary); }
.notif-content p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }

/* ===================================
   CARDS & ELEMENTOS
   =================================== */
.page-container { padding: 2rem; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid #333;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex; align-items: center; gap: 15px;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-5px); border-color: var(--gold); }
.stat-icon { width: 50px; height: 50px; background: rgba(255,255,255,0.05); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--gold); }
.stat-info h3 { font-size: 2rem; color: var(--gold); } /* Números Dourados */
.stat-info p { text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; }

/* Grids */
.clientes-grid, .servicos-grid, .estoque-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.cliente-card, .estoque-card, .servico-card, .stat-card {
    background-color: #1E1E1E; /* Cinza um pouco mais claro que o fundo */
    border: 1px solid #333;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4); /* Sombra mais forte */
}

.cliente-card:hover, .agendamento-item:hover { border-color: #555; background-color: var(--bg-hover); transform: translateY(-3px); }
.cliente-header { display: flex; gap: 15px; align-items: center; margin-bottom: 15px; }
.cliente-avatar { width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), #907623); color: #000; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2rem; }
.cliente-info h3 { color: var(--text-primary); margin: 0; }
.cliente-stats { display: flex; justify-content: space-between; border-top: 1px solid #333; padding-top: 10px; margin-top: 10px; }
.cliente-stat strong { color: var(--gold); }

/* Agendamento Item */
.agendamento-item {
    padding: 15px 20px !important; /* Enchimento interno (Cima/Baixo, Esq/Dir) */
    margin-bottom: 15px !important; /* Espaço entre um item e outro */
    background-color: rgba(255, 255, 255, 0.02); /* Fundo muito sutil para destacar */
    border-radius: 0 8px 8px 0; /* Arredonda cantos da direita */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Espaço entre o título e o subtítulo dentro do item */
}
.agendamento-header h4 { color: var(--gold); margin-bottom: 5px; }
.agendamento-header {
    margin-left: 10px; /* Empurra o título para a direita */
}
.agendamento-info {
    margin-left: 10px; /* Empurra a descrição para a direita */
    opacity: 0.8; /* Deixa o texto secundário um pouco mais suave */
}
.agendamento-time { color: var(--text-secondary); font-size: 0.9rem; }

/* Search Bar */
.search-bar {
    background: var(--bg-card); border: 1px solid #333;
    padding: 0.8rem 1.2rem; border-radius: 100px;
    display: flex; align-items: center; gap: 10px;
    max-width: 400px; width: 100%; margin-bottom: 20px;
}
.search-bar input { background: transparent; border: none; color: var(--text-primary); width: 100%; outline: none; }
.search-bar i { color: var(--gold); }

/* ===================================
   MODAL & FORMULÁRIOS
   =================================== */
.modal {
    display: none; /* Escondido por padrão */
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 3000;
    align-items: center; justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal.active { display: flex !important; }

.modal-content {
    background-color: #1E1E1E;
    border: 1px solid #444; border-radius: 16px;
    width: 100%; max-width: 650px; padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    max-height: 90vh; overflow-y: auto;
    position: relative; animation: slideUp 0.3s ease-out;
}

.modal-header h2 { color: var(--gold); font-size: 2rem; margin-bottom: 1rem; border-bottom: 1px solid #333; padding-bottom: 1rem; }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; }
.modal-close:hover { color: var(--error); }

/* Inputs */
label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; }
input, select, textarea { width: 100%; background-color: var(--bg-input); border: 1px solid transparent; color: var(--text-primary); padding: 14px 16px; border-radius: 8px; font-size: 1rem; transition: all 0.2s; }
input:focus, select:focus { outline: none; border-color: var(--gold); background-color: #222; box-shadow: 0 0 0 3px var(--gold-glow); }
::placeholder { color: #555; }
hr { border: 0; border-top: 1px solid #333; margin: 25px 0; }

/* Grid Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-cep { display: grid; grid-template-columns: 1fr 2.5fr; gap: 20px; margin-bottom: 20px; }
.grid-numero { display: grid; grid-template-columns: 0.8fr 2fr; gap: 20px; margin-bottom: 20px; }
.grid-cidade { display: grid; grid-template-columns: 3fr 1fr; gap: 20px; margin-bottom: 20px; }

/* Botões */
.modal-buttons { display: flex; justify-content: flex-end; gap: 15px; margin-top: 30px; border-top: 1px solid #333; padding-top: 20px; }
.btn-primary { background: linear-gradient(135deg, var(--gold), #B88A00); color: #121212; font-weight: 700; border: none; padding: 12px 30px; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2); transition: 0.3s; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4); }
.btn-secondary { background: transparent; border: 1px solid #555; color: var(--text-primary); padding: 12px 24px; border-radius: 8px; cursor: pointer; transition: 0.3s; }
.btn-secondary:hover { border-color: var(--text-primary); background: rgba(255,255,255,0.05); }
.btn-edit {
    background-color: #2C2C2C; /* Fundo escuro */
    color: var(--text-primary);
    border-color: #444;
}
.btn-edit:hover {
    border-color: var(--gold);
    color: var(--gold);
    background-color: #333;
}
.btn-delete {
    background-color: rgba(239, 83, 80, 0.1); /* Vermelho transparente */
    color: #EF5350;
    border-color: transparent;
}
.btn-delete:hover {
    background-color: #EF5350;
    color: white;
}
.btn-link-gold:hover { color: var(--text-primary); }

/* Toasts */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 4000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-card); color: var(--text-primary); padding: 1rem 1.5rem; border-radius: var(--border-radius); box-shadow: 0 10px 30px rgba(0,0,0,0.5); border-left: 4px solid var(--gold); display: flex; align-items: center; gap: 10px; animation: slideInRight 0.3s; }
.toast.error { border-left-color: var(--error); } .toast.success { border-left-color: var(--success); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =================================================================
   SISTEMA DE NAVEGAÇÃO BLINDADO (ISSO CORRIGE AS PÁGINAS JUNTAS)
   ================================================================= */

/* 1. Esconde TODAS as páginas por padrão */
.page {
    display: none !important;
}

/* 2. Mostra APENAS a página que tem a classe 'active' */
.page.active {
    display: block !important;
    animation: fadeIn 0.4s ease-out;
}

input[type="date"] {
    color-scheme: dark; /* Força o ícone do calendário a ficar branco */
}

/* Animação de entrada suave */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* =======================================================
   CORREÇÕES FINAIS DE DESIGN (Relatórios, Rádios e Google)
   ======================================================= */

/* --- 1. RÁDIO BUTTONS (Modal Novo Agendamento) --- */
/* Transforma as bolinhas em botões clicáveis grandes */
.radio-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    margin-top: 5px;
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background-color: var(--bg-input); /* Fundo escuro */
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 600;
    color: var(--text-secondary);
}

.radio-label:hover {
    background-color: #333;
    border-color: var(--gold);
}

/* Quando selecionado (precisa de um pouco de JS ou CSS :has se suportado, 
   mas o estilo visual básico já melhora muito) */
.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold); /* Cor da bolinha */
    margin: 0;
    box-shadow: none; /* Remove brilho extra */
}

/* --- 2. RELATÓRIOS (Transforma a lista feia em Cards) --- */
/* Container dos cards de relatório */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* O Card de Relatório (igual ao do Dashboard) */
.metric-card {
    background-color: var(--bg-card);
    border: 1px solid #333;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.metric-icon {
    font-size: 2rem;
    color: var(--gold);
    opacity: 0.8;
}

.metric-info h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.metric-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- 3. BOTÃO GOOGLE AGENDA (Estilo Bonito) --- */
.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #fff;
    color: #444;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 10px;
    transition: 0.2s;
}
.btn-google:hover {
    background-color: #f1f1f1;
    transform: translateY(-2px);
}
.btn-google i { color: #DB4437; /* Vermelho Google */ }

/* --- 4. ALINHAMENTO DE CABEÇALHOS (Busca + Botão Novo) --- */
/* Use esta classe no HTML para alinhar a busca e o botão */
.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    background-color: var(--bg-card); /* Fundo sutil */
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #333;
}

.header-controls .search-bar {
    margin-bottom: 0; /* Remove margem antiga */
    flex: 1;
    border: none; /* Remove borda extra */
    background: transparent;
}

.header-controls .btn-new {
    background-color: var(--gold);
    color: #000;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Força o conteúdo a se afastar da borda colorida esquerda */
.dashboard-card .agendamento-item {
    padding-left: 25px !important; /* Empurra tudo para a direita */
    border-left-width: 6px !important; /* Engrossa a linha colorida */
    margin-bottom: 15px !important;
    background-color: #252525 !important; /* Garante o fundo cinza */
    border-radius: 0 8px 8px 0 !important;
}

/* Garante que o título e a info não fiquem colados */
.dashboard-card .agendamento-header,
.dashboard-card .agendamento-info {
    margin-left: 10px !important; /* Espaço extra de segurança */
}

/* Ajuste específico para a lista de Débitos que estava desalinhada */
.debitos-list .agendamento-item {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.dashboard-card .agendamento-header span {
    float: right; /* Garante que valores fiquem na direita */
}

/* Ajuste do Título dentro do Cartão */
.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 25px !important; /* Mais espaço embaixo da linha do título */
    padding-bottom: 15px !important; /* Mais espaço entre o texto e a linha */
    border-bottom: 1px solid #333; /* Linha separando título do conteúdo */
    font-size: 1.2rem;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Garante que a lista dentro não quebre o layout */
.dashboard-card .empty-state {
    padding: 10px 0;
    background: transparent; /* Remove fundo extra se houver */
}

/* =======================================================
   CORREÇÃO FINAL: CLIENTES & MODAL DETALHES
   ======================================================= */

/* 1. CARDS DE CLIENTES SIMÉTRICOS */
.clientes-grid {
    display: grid;
    /* Define largura mínima de 300px, mas expande para preencher */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px; /* Mais espaço entre os cards */
}

.cliente-card {
    display: flex;
    flex-direction: column; /* Organiza em coluna */
    justify-content: space-between; /* Empurra o rodapé para baixo */
    height: 100%; /* Ocupa 100% da altura da linha do grid */
    background-color: #1E1E1E;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.cliente-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
}

/* Garante que o rodapé (stats) fique sempre no fundo do card */
.cliente-stats {
    margin-top: auto; 
    padding-top: 15px;
    border-top: 1px solid #333;
}

/* 2. MODAL DE DETALHES (ORGANIZADO) */
/* Grid para os 3 números (Serviços, Gasto, Débito) */
.client-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background-color: var(--bg-input);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
}

.stat-box small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-box strong {
    display: block;
    color: var(--gold);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Destaque para Débito se houver */
.stat-box.debito strong { color: var(--error); }

/* Área de informações pessoais no Modal */
.client-personal-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.client-personal-info i {
    width: 20px;
    color: var(--gold);
    text-align: center;
    margin-right: 8px;
}

/* =================================================
   CORREÇÃO VISUAL: MODAL DETALHES (FINAL)
   ================================================= */

/* Avatar Grande no Topo */
.cliente-avatar-large {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--gold), #907623);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #000;
}

/* Grid de Informações (Telefone e Email lado a lado) */
.info-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* A Caixinha de Informação (O segredo da organização) */
.info-box {
    background-color: var(--bg-input); /* Fundo cinza escuro */
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #333;
}

.info-box label {
    display: block;
    font-size: 0.7rem;
    color: var(--gold); /* Rótulo Dourado */
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.info-box span {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grid de Estatísticas (3 caixas iguais) */
.client-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background-color: #1A1A1A;
    border: 1px solid #333;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-box small {
    display: block;
    color: #888;
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-box strong {
    font-size: 1.2rem;
    color: #fff;
}

/* Botões do Rodapé (Lado a Lado e Grandes) */
.modal-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.btn-action {
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.btn-action.edit {
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
}
.btn-action.edit:hover { border-color: var(--gold); color: var(--gold); }

.btn-action.delete {
    background-color: rgba(239, 83, 80, 0.15);
    color: var(--error);
}
.btn-action.delete:hover { background-color: var(--error); color: #fff; }

/* Lista com Scroll */
.scroll-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* =======================================================
   CORREÇÃO DAS ABAS (HISTÓRICO / AGENDADOS)
   ======================================================= */

/* =======================================================
   CORREÇÃO FINAL: BOTÕES DAS ABAS (HISTÓRICO / AGENDADOS)
   ======================================================= */

/* Container que segura os botões */
.detalhes-tabs {
    display: flex !important;
    gap: 15px !important;
    margin: 20px 0 !important;
    border-bottom: 1px solid #333 !important;
    padding-bottom: 15px !important;
}

.detalhes-tabs button {
    background-color: transparent !important; /* Remove o branco */
    border: 1px solid #555 !important;        /* Borda cinza discreta */
    color: #aaa !important;                   /* Texto cinza */
    border-radius: 50px !important;           /* Arredondado (Pílula) */
    padding: 8px 24px !important;             /* Tamanho */
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    outline: none !important;
}

.detalhes-tabs button.active {
    background: linear-gradient(135deg, #D4AF37 0%, #B88A00 100%) !important; /* Dourado */
    color: #000 !important;  /* Texto Preto */
    border-color: #D4AF37 !important;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3) !important;
}

.detalhes-tabs button:hover {
    border-color: #D4AF37 !important;
    color: #fff !important;
}

.alertas-list .agendamento-item, 
.debitos-list .agendamento-item {
    display: block !important; /* Garante que ocupem a largura */
}

/* O Botão da Aba (Estado Normal/Desativado) */
.tab-btn {
    background: transparent; /* Remove o fundo branco feio */
    border: 1px solid #444;  /* Borda cinza discreta */
    color: var(--text-secondary); /* Texto cinza */
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 24px; /* Mais gordinho */
    cursor: pointer;
    border-radius: 50px; /* Deixa redondinho (Pílula) */
    transition: all 0.3s ease;
    outline: none;
    font-family: var(--font-body);
}

/* Quando passa o mouse */
.tab-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* O Botão da Aba (Estado ATIVO/Selecionado) */
.tab-btn.active {
    background: linear-gradient(135deg, var(--gold) 0%, #B88A00 100%); /* Fundo Dourado */
    color: #000; /* Texto Preto para leitura fácil */
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3); /* Brilho dourado */
}

/* Ajuste para esconder o conteúdo da aba que não está selecionada */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* =======================================================
   CORREÇÃO VISUAL: AGENDA PRO
   ======================================================= */

/* Cabeçalho da Página */
.page-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Botão Google Sync */
.btn-google-sync {
    background-color: #fff;
    color: #444;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: 0.2s;
}
.btn-google-sync:hover { background-color: #f1f1f1; }
.btn-google-sync i { color: #DB4437; }

/* --- BARRA DE FERRAMENTAS (TOOLBAR) --- */
.agenda-toolbar {
    background-color: #1E1E1E; /* Card Dark */
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #333;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

/* Grupo de Botões (Dia/Semana/Mês) */
.view-switcher {
    display: flex;
    background-color: #121212;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #333;
}

.view-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.view-btn.active {
    background-color: var(--gold);
    color: #000;
    font-weight: 700;
}

/* Navegador de Data (< DATA >) */
.date-navigator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-arrow {
    background: #333;
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.nav-arrow:hover { background: var(--gold); color: #000; }

.btn-today {
    background: transparent;
    border: 1px solid #555;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Input de Data Customizado */
.date-display-wrapper input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    text-align: center;
    cursor: pointer;
    padding: 5px;
}
/* Ícone de calendário branco para destacar */
.date-display-wrapper input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* --- BARRA DE ESTATÍSTICAS --- */
.agenda-stats-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.agenda-stat {
    display: flex;
    flex-direction: column;
}

.stat-label { font-size: 0.75rem; color: #888; text-transform: uppercase; }
.stat-value { font-size: 1.2rem; color: #fff; font-weight: 700; }
.stat-value.gold { color: var(--gold); }

/* --- TIMELINE DE AGENDAMENTOS (LISTA) --- */
.agenda-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* O Card do Agendamento (Refeito) */
.agenda-card {
    background-color: #1E1E1E;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
    border-left: 4px solid var(--gold); /* Cor padrão */
}

.agenda-card:hover { transform: translateX(5px); border-color: var(--gold-light); }

.time-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 20px;
    border-right: 1px solid #333;
    min-width: 80px;
}

.time-hour { font-size: 1.2rem; font-weight: 700; color: #fff; }
.time-icon { color: var(--gold); font-size: 0.9rem; margin-top: 5px; }

.info-column {
    flex: 1;
    padding-left: 20px;
}

.service-title { font-size: 1.1rem; color: #fff; margin-bottom: 5px; font-weight: 600; }
.client-name { color: #aaa; font-size: 0.9rem; display: flex; align-items: center; gap: 5px; }

.action-column {
    text-align: right;
}

.price-tag { 
    display: block; 
    color: var(--gold); 
    font-weight: 700; 
    font-size: 1.1rem; 
    margin-bottom: 5px; 
}

/* Cores de Status para a borda lateral */
.status-concluido { border-left-color: var(--success) !important; opacity: 0.7; }
.status-cancelado { border-left-color: var(--error) !important; opacity: 0.5; text-decoration: line-through; }

/* Botões de ação no card da agenda */
.icon-btn-small {
    background: transparent;
    border: 1px solid #444;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn-small.delete { color: #EF5350; }
.icon-btn-small.delete:hover { background: rgba(239, 83, 80, 0.1); border-color: #EF5350; }

.icon-btn-small.success { color: #66BB6A; }
.icon-btn-small.success:hover { background: rgba(102, 187, 106, 0.1); border-color: #66BB6A; }

/* Botão Excluir no Modal */
#btnExcluirAgendaModal {
    background-color: rgba(239, 83, 80, 0.15); /* Fundo vermelho transparente */
    color: #EF5350; /* Texto vermelho */
    border: 1px solid #EF5350;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

#btnExcluirAgendaModal:hover {
    background-color: #EF5350;
    color: white;
}

/* =================================================
   ESTILO DOS GRÁFICOS E RELATÓRIOS
   ================================================= */

/* Grid dos Gráficos (Lado a Lado) */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* O Cartão do Gráfico */
.chart-card {
    background-color: var(--bg-card); /* Fundo Cinza */
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    height: 400px; /* Altura fixa para ficar bonito */
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.chart-card h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

/* Tabela de Relatórios */
.table-card {
    background-color: var(--bg-card);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
}

.relatorio-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

.relatorio-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #444;
    color: var(--gold);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.relatorio-table td {
    padding: 12px;
    border-bottom: 1px solid #333;
    font-size: 0.95rem;
}

.relatorio-table tr:hover {
    background-color: rgba(255,255,255,0.02);
}

/* =======================================================
   CORREÇÃO: TELA DE LOADING (LOADING SCREEN)
   ======================================================= */

/* 1. O Container Principal (Cobre toda a tela) */
#loadingScreen {
    position: fixed;       /* Fixa na tela, não rola */
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: #121212; /* Fundo preto sólido */
    z-index: 99999;        /* Fica acima de TUDO (até do modal e menu) */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s; /* Efeito Fade-out */
    opacity: 1;
    visibility: visible;
}

/* 2. O Estado "Escondido" (Aplicado pelo JS) */
#loadingScreen.hidden {
    opacity: 0;            /* Fica transparente */
    visibility: hidden;    /* O navegador ignora ele */
    pointer-events: none;  /* Permite clicar no que está atrás */
}

/* 3. Conteúdo Centralizado */
.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Ícone da Logo */
.loading-icon {
    font-size: 3rem;
    color: var(--gold);
    animation: pulse 2s infinite;
}

/* Texto "Estética Premium" */
.loading-content h2 {
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 2px;
    margin: 0;
}

/* Spinner (Rodinha girando) */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.3); /* Dourado fraco */
    border-top: 3px solid var(--gold);         /* Dourado forte */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 10px;
}

/* Animações */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* =======================================================
   CORREÇÃO VISUAL: BOTÕES DE MENU E NOTIFICAÇÃO
   ======================================================= */

/* 1. ESTILIZAR O BOTÃO DE MENU (HAMBÚRGUER) */
#menuToggle {
    background-color: transparent !important; /* Remove o fundo cinza feio */
    border: 1px solid #333 !important;        /* Borda sutil para definir a área */
    color: var(--gold) !important;            /* Ícone Dourado */
    border-radius: 8px !important;            /* Cantos arredondados */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

#menuToggle:hover {
    border-color: var(--gold) !important;     /* Brilha a borda ao passar o mouse */
    background-color: rgba(212, 175, 55, 0.1) !important; /* Fundo dourado bem leve */
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

/* 2. ESTILIZAR O BOTÃO "LIMPAR" (NOTIFICAÇÕES) */
.btn-link-gold {
    background: transparent !important;       /* Remove fundo branco */
    border: none !important;                  /* Remove borda padrão */
    color: #888 !important;                   /* Cor inicial discreta (Cinza) */
    font-size: 0.75rem !important;            /* Fonte pequena e elegante */
    font-weight: 600 !important;
    text-transform: uppercase;                /* Letras maiúsculas */
    letter-spacing: 1px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: 0.2s;
}

.btn-link-gold:hover {
    color: var(--gold) !important;            /* Fica dourado ao passar o mouse */
    background-color: rgba(255, 255, 255, 0.05) !important;
    text-decoration: underline;
}

/* 3. ALINHAMENTO DO CABEÇALHO DAS NOTIFICAÇÕES */
.notif-header {
    display: flex !important;
    justify-content: space-between !important; /* "Alertas" na esq, "Limpar" na dir */
    align-items: center !important;
    padding: 15px !important;
    border-bottom: 1px solid #333;
}

.notif-header span {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

/* =======================================================
   NOVO CALENDÁRIO (ESTILO CODEPEN - VERSÃO DARK LUXURY)
   ======================================================= */

.modern-calendar-wrapper {
    background-color: #1E1E1E;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    border: 1px solid #333;
    margin-bottom: 20px;
}

/* Cabeçalho (Mês e Setas) */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.calendar-header h3 {
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: 1.8rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cal-btn {
    background: transparent;
    border: 1px solid #444;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}

.cal-btn:hover {
    background-color: var(--gold);
    color: #000;
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* Dias da Semana */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 15px;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
}

/* Grid Principal */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* O Dia Individual */
.cal-day {
    aspect-ratio: 1; /* Quadrado perfeito */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    color: #ddd;
    position: relative;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    background-color: rgba(255,255,255,0.02);
}

.cal-day:hover:not(.empty) {
    background-color: #333;
    border-color: #555;
    transform: scale(1.05);
    z-index: 2;
}

/* Dia Vazio (Do mês anterior/próximo) */
.cal-day.empty {
    background: transparent;
    cursor: default;
    pointer-events: none;
}

/* Dia Selecionado (Dourado Sólido) */
.cal-day.selected {
    background: linear-gradient(135deg, var(--gold), #B88A00) !important;
    color: #000 !important;
    font-weight: 800;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
    border: none;
}

/* Dia de Hoje (Apenas Borda) */
.cal-day.today {
    border: 2px solid var(--gold);
    color: var(--gold);
}

.day-dots {
    display: flex;
    gap: 3px;
    position: absolute;
    bottom: 6px;
    justify-content: center;
    width: 100%;
}

.dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5); /* Sombra para destacar no fundo selecionado */
}

.dot.has-service { 
    background-color: #ECECEC !important; /* Branco/Cinza (Pendente/Normal) */
}
.cal-day.selected .dot { background-color: #000; } /* Preto se selecionado */

.dot.has-debt { 
    background-color: #EF5350 !important; /* Vermelho (Devendo) */
    box-shadow: 0 0 5px #EF5350; /* Brilho vermelho */
}

.dot.is-paid { 
    background-color: #66BB6A !important; /* Verde (Pago) */
}

/* Rodapé do Calendário */
.calendar-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.btn-today-modern {
    background: none; border: none;
    color: #888; font-size: 0.9rem;
    cursor: pointer; text-transform: uppercase;
    letter-spacing: 1px; transition: 0.3s;
}
.btn-today-modern:hover { color: var(--gold); }

/* Responsivo */
@media (max-width: 480px) {
    .modern-calendar-wrapper {
        padding: 15px;
    }
    .cal-day { font-size: 0.9rem; border-radius: 8px; }
    .calendar-header h3 { font-size: 1.4rem; }
}

/* =======================================================
   ANAMNESE & IMPRESSÃO
   ======================================================= */

/* Estilo do Canvas de Assinatura */
.signature-area {
    margin-top: 20px;
    text-align: center;
}

#signatureCanvas {
    background-color: #fff;
    border: 1px dashed #666;
    border-radius: 4px;
    cursor: crosshair;
    width: 100%; /* Responsivo */
    max-width: 500px;
}

.legal-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 15px;
    text-align: justify;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.anamnese-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.anamnese-section h3 {
    color: var(--gold);
    margin-bottom: 15px;
}

.only-print { display: none; }

/* ========================================
   ESTILOS DAS LISTAS DO DASHBOARD
   ======================================================= */

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.dashboard-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Divide em 2 colunas */
    gap: 20px;
}

@media (max-width: 768px) {
    .dashboard-row-split { grid-template-columns: 1fr; } /* Celular: 1 coluna */
}

.dashboard-card {
    background: #1E1E1E;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #333;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

/* ITENS DA LISTA */
.dash-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;
}
.dash-list-item:hover { background: rgba(255,255,255,0.08); }

.dash-item-time {
    display: flex; flex-direction: column; align-items: center;
    background: #000; padding: 5px 10px; border-radius: 6px;
    border: 1px solid var(--gold); color: var(--gold);
    min-width: 50px;
}
.dash-item-time .day { font-size: 1.2rem; font-weight: bold; }
.dash-item-time .month { font-size: 0.7rem; text-transform: uppercase; }

.dash-item-info { flex: 1; }
.dash-item-info h4 { margin: 0; font-size: 0.95rem; color: #fff; }
.dash-item-info p { margin: 2px 0 0 0; font-size: 0.8rem; color: #888; }

/* Cores de Alerta */
.dash-list-item.warning { border-left: 3px solid var(--warning); }
.dash-list-item.danger { border-left: 3px solid var(--error); }

.dash-item-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #333;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.warning .dash-item-icon { color: var(--warning); }
.danger .dash-item-icon { color: var(--error); }

/* =======================================================
   ANAMNESE COM MAPA FACIAL
   ======================================================= */

/* Abas */
.anamnese-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.tab-btn {
    background: #f5f5f5;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    transition: 0.3s;
}

.tab-btn.active {
    background: var(--gold);
    color: #000;
}

.anamnese-tab-content { display: none; }
.anamnese-tab-content.active { display: block; animation: fadeIn 0.3s; }

/* Mapa Facial (Sobreposição) */
.mapa-container {
    position: relative;
    width: 100%;
    max-width: 500px; /* Tamanho do rosto na tela */
    height: 400px;
    margin: 0 auto;
    border: 1px solid #eee;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.mapa-background svg {
    width: 80%; height: 80%; opacity: 0.3; /* Rosto cinza claro */
}

/* Toolbar de Cores */
.drawing-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.color-picker { display: flex; gap: 10px; }

.color-dot {
    width: 25px; height: 25px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}
.color-dot.active { border-color: #000; transform: scale(1.2); }

.mapa-container, .signature-area {
    touch-action: none !important; /* Garante que a área em volta também não role */
}

/* =======================================================
   ÁREA DE ASSINATURA E MAPA FACIAL (CORREÇÃO VISUAL)
   ======================================================= */

/* Define o tamanho e a aparência das áreas de desenho */
#signatureCanvas, #mapaFacialCanvas {
    width: 100%;           /* Ocupa toda a largura disponível */
    height: 200px;         /* Altura fixa para a área de desenho */
    background-color: #fff; /* Fundo branco para desenhar */
    border: 2px dashed var(--gold); /* Borda tracejada dourada */
    border-radius: 8px;    /* Cantos arredondados */
    cursor: crosshair;     /* Cursor de mira */
    touch-action: none;    /* Importante para tablet: impede scroll */
    display: block;        /* Garante que seja um bloco visível */
    margin-bottom: 10px;   /* Espaço abaixo do canvas */
}

/* Ajuste específico para a área de assinatura */
.signature-area {
    margin-top: 20px;
    text-align: center; /* Centraliza o título e o botão */
}

.signature-area label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--gold);
}

/* Ajuste para o container do mapa facial para garantir que o canvas fique por cima */
.mapa-container {
    position: relative;
    width: 100%;
    max-width: 500px; /* Largura máxima do mapa */
    height: 400px;    /* Altura do mapa */
    margin: 0 auto 20px auto; /* Centraliza e dá margem inferior */
    border: 2px dashed var(--gold); /* Borda do container */
    background: #fff;
    border-radius: 8px;
    overflow: hidden; /* Garante que nada saia do container */
}

/* =======================================================
   CORREÇÃO FINAL: VISUAL DA ASSINATURA E MAPA
   ======================================================= */

/* 1. O ENVOLTÓRIO (A CAIXA EXTERNA) */
/* Ele define o tamanho, a borda dourada e o fundo branco */
.canvas-wrapper, .mapa-container {
    position: relative;
    width: 100%;
    max-width: 600px; /* Largura máxima confortável */
    height: 300px;    /* Aumentei um pouco para ficar melhor de desenhar */
    margin: 15px auto;
    background-color: #fff;
    border: 2px dashed var(--gold); /* A única borda deve ser essa! */
    border-radius: 8px;
    overflow: hidden; /* Corta qualquer coisa que vaze */
    padding: 0;       /* IMPORTANTE: Sem padding para o canvas encostar na borda */
    box-sizing: border-box; /* Garante que a borda conte no tamanho total */
    touch-action: none; /* Trava o scroll do tablet */
}

/* 2. O CANVAS (A FOLHA DE DESENHO) */
/* Ele deve ser transparente, sem borda e preencher tudo */
canvas {
    display: block; /* Remove espaços estranhos de elementos inline */
    width: 100% !important;  /* Força ocupar 100% da largura do pai */
    height: 100% !important; /* Força ocupar 100% da altura do pai */
    border: none !important; /* REMOVE A BORDA DUPLA */
    background: transparent; /* Fundo transparente (o branco vem do wrapper) */
    cursor: crosshair;
    touch-action: none;
    outline: none; /* Remove contorno azul ao clicar */
}

/* Ajuste do fundo do rosto para ficar centralizado */
.mapa-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
    display: flex; 
    justify-content: center; 
    align-items: center;
    pointer-events: none;
}

.mapa-background svg {
    max-width: 80%; 
    max-height: 90%; 
    opacity: 0.3;
}

/* Garante que o canvas do mapa fique por cima do rosto */
#mapaFacialCanvas {
    position: relative; 
    z-index: 10;
}

/* =======================================================
   CSS DE IMPRESSÃO - CORREÇÃO FINAL
   ======================================================= */

/* =======================================================
   ESTILOS DE IMPRESSÃO PROFISSIONAL (ORGANIZADO)
   ======================================================= */

/* Garante que o molde fique escondido na tela normal */
.print-only-container {
    display: none !important;
}

@media print {
    /* --- 1. RESET GERAL PARA IMPRESSÃO --- */
    /* Margens da página (ajuste se sua impressora cortar) */
    @page { margin: 1.5cm; }

    /* Esconde tudo que não seja a ficha */
    body > *:not(#fichaImpressao) {
        display: none !important;
    }

    /* Configura o container principal da folha A4 */
    #fichaImpressao {
        display: block !important;
        visibility: visible !important;
        position: relative !important; /* Muda de absolute para relative para fluir melhor */
        width: 100% !important;
        height: auto !important;
        background: white !important;
        color: #000 !important;
        /* Fonte mais limpa e profissional para leitura */
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
        font-size: 11pt !important;
        line-height: 1.4;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Garante que todos os textos internos sejam pretos */
    #fichaImpressao * {
        color: #000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }

    /* --- 2. CABEÇALHO (HEADER) --- */
    .print-header {
        text-align: center;
        border-bottom: 3px double #000; /* Borda dupla elegante */
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .print-header h1 {
        font-size: 22pt !important;
        font-weight: 700;
        text-transform: uppercase;
        margin: 0 0 5px 0;
        font-family: 'Cormorant Garamond', serif !important; /* Mantém a identidade da marca no título */
    }
    
    .print-header p {
        font-size: 14pt;
        font-style: italic;
        margin: 0 0 15px 0;
    }
    
    /* Barra de Cliente e Data */
    .print-meta {
        display: flex;
        justify-content: space-between; /* Separa os itens nas pontas */
        border-top: 1px solid #ccc;
        padding-top: 10px;
        font-weight: 600;
        font-size: 12pt;
    }

    /* --- 3. SEÇÕES DO CORPO --- */
    .print-body {
        padding: 0 5px;
    }
    
    .print-section {
        margin-bottom: 25px;
        /* Evita quebrar uma seção no meio da página */
        break-inside: avoid;
        page-break-inside: avoid; 
    }
    
    /* Títulos das Seções (H3) */
    .print-section h3 {
        font-size: 13pt !important;
        font-weight: 700;
        text-transform: uppercase;
        background-color: #f0f0f0 !important; /* Fundo cinza claro para destacar */
        padding: 5px 10px;
        margin-bottom: 12px;
        border-left: 5px solid #333; /* Detalhe lateral */
    }

    /* Estilo para os campos de texto preenchidos */
    .print-section p {
        margin-bottom: 8px;
    }
    .print-section p strong {
        margin-right: 5px;
    }
    /* Adiciona uma linha pontilhada onde estão os dados */
    .print-section span[id^="print"] {
        border-bottom: 1px dotted #999;
        padding: 0 5px;
        display: inline-block;
        min-width: 50px;
    }

    /* --- 4. GRID DE CHECKBOXES (Organizado) --- */
    .print-grid { 
        display: flex;
        flex-wrap: wrap; /* Permite quebrar linha se precisar */
        gap: 10px 20px; /* Espaçamento vertical e horizontal */
        margin-bottom: 15px;
    }
    
    .print-grid div {
        display: flex;
        align-items: center;
        min-width: 150px; /* Largura mínima para alinhar colunas */
    }

    /* O quadrado do checkbox */
    .print-grid span[id^="check"] {
        font-family: monospace; /* Fonte monoespaçada para o quadrado ficar perfeito */
        font-size: 14pt;
        margin-right: 8px;
        font-weight: bold;
        line-height: 1;
        border-bottom: none; /* Remove a linha pontilhada dos checkboxes */
    }

    /* --- 5. IMAGENS (MAPA E ASSINATURA) --- */
    .print-section.keep-together {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Container do Mapa Facial */
    .print-map-container {
        text-align: center;
        margin-top: 10px;
        border: 1px solid #ccc;
        padding: 10px;
        background: #fff !important;
    }

    #printMapaImg {
        max-height: 220px !important; /* Reduz um pouco para caber melhor */
        width: auto !important;
        max-width: 100% !important;
        margin: 0 auto;
        display: block;
        /* Força a impressão de imagens */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Área de Assinatura */
    .legal-text-small {
        font-size: 10pt;
        font-style: italic;
        text-align: center;
        margin-bottom: 15px;
        color: #555 !important;
    }

    .print-sig-container {
        text-align: center;
        margin-top: 20px;
    }

    #printAssinaturaImg {
        height: 60px !important; /* Altura fixa para a assinatura */
        width: auto;
        display: block;
        margin: 0 auto 5px auto;
    }

    /* A linha da assinatura */
    .print-sig-container .line {
        border-top: 1px solid #000 !important;
        width: 250px !important;
        margin: 0 auto 5px auto !important;
    }
    
    .print-sig-container .label {
        font-size: 9pt;
        text-transform: uppercase;
    }
}

/* Botão de Compartilhar Link */
.btn-share-link {
    background-color: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex; 
    align-items: center; 
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-share-link:hover {
    background-color: var(--gold);
    color: #000; /* Texto fica preto no hover para contraste */
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4); /* Brilho dourado */
}

/* Indicador de Evento no Calendário (Bolinha) */
.event-dot {
    width: 6px;
    height: 6px;
    background-color: var(--gold); /* Dourado */
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.5); /* Brilho suave */
}

/* Ajuste para o dia selecionado (bolinha fica preta para contraste) */
.cal-day.selected .event-dot,
.cal-day.today .event-dot {
    background-color: #000; 
}

/* Ajuste para botão de Sair no Mobile */
.sidebar-footer {
    padding-bottom: 40px; /* Empurra pra cima para fugir da barra do iPhone/Android */
}

/* Garante que o botão seja grande e fácil de tocar */
.btn-logout {
    min-height: 44px; /* Tamanho mínimo de toque Apple */
    font-size: 1rem;
    touch-action: manipulation; /* Melhora a resposta do toque */
}