:root {
    --primary-color: #0d9488; /* Azul esverdeado / Teal */
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1; /* Fundo suave para tags e interações */
    --bg-color: #f8fafc; /* Fundo mais claro e frio */
    --card-bg: #ffffff;
    --text-main: #0f172a; /* Slate 900 (Contraste moderno) */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0;
    --danger: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Roboto Slab', serif; background-color: var(--bg-color); color: var(--text-main); height: 100vh; overflow: hidden; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* Utilitários */
.hidden { display: none !important; }
.flex-center { display: flex; justify-content: center; align-items: center; height: 100vh; }
.text-primary { color: var(--primary-color); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; font-weight: 400; }
.text-danger { color: var(--danger); }
.w-100 { width: 100%; }
.mt-4 { margin-top: 1.5rem; }

/* Componentes Básicos */
.card { background: var(--card-bg); padding: 1.5rem; border-radius: 1rem; box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03); border: 1px solid var(--border-color); transition: box-shadow 0.2s; }
.btn { padding: 0.625rem 1.25rem; border: none; border-radius: 0.5rem; cursor: pointer; font-weight: 500; font-size: 0.875rem; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2); }
.btn-outline { background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); }
.btn-outline:hover { background: var(--primary-light); color: var(--primary-hover); }
.btn-icon { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); transition: color 0.2s; }
.btn-icon:hover { color: var(--danger); }
.toggle-password-btn { position: absolute; right: 0.75rem; top: 2.1rem; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.toggle-password-btn svg { width: 18px; height: 18px; }

/* Formulários */
.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-main); }
input, textarea, select { width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--border-color); border-radius: 0.5rem; font-family: inherit; font-size: 0.9rem; outline: none; background: #fff; transition: all 0.2s; color: var(--text-main); }
input:focus, textarea:focus, select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15); }
textarea { resize: vertical; min-height: 80px; }
.alert { padding: 1rem; background: #fef2f2; color: var(--danger); border-radius: 0.5rem; text-align: center; margin-bottom: 1rem; font-size: 0.875rem; border: 1px solid #fecaca; }

/* Spinner de Carregamento */
.spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.875rem; flex-shrink: 0; }

/* Tela de Login */
.login-bg {
    display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.85) 0%, rgba(15, 118, 110, 0.95) 100%), url('https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
}
.login-box { width: 100%; max-width: 420px; padding: 2.5rem; border-radius: 1.5rem; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.4); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.05em; color: var(--primary-color); margin-bottom: 0.25rem; }
.login-header p { font-size: 0.95rem; }

/* Layout App */
#app-view { display: flex; height: 100vh; }
.sidebar { width: 260px; background: white; border-right: 1px solid var(--border-color); display: flex; flex-direction: column; z-index: 10; }
.sidebar-title { padding: 1.5rem; font-size: 1.5rem; font-weight: bold; }
.sidebar-nav { flex: 1; padding: 0 1rem; }
.nav-item { display: block; padding: 0.875rem 1rem; color: var(--text-muted); text-decoration: none; border-radius: 0.5rem; margin-bottom: 0.35rem; font-weight: 500; transition: all 0.2s; }
.nav-item:hover, .nav-item.active { background: var(--primary-light); color: var(--primary-hover); }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border-color); }
.main-content { flex: 1; padding: 2.5rem; overflow-y: auto; }
.content-section { display: none; }
.content-section.active { display: block; }

/* Dashboard */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.summary-card h2 { font-size: 2rem; margin-top: 0.5rem; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.card-title { margin-bottom: 1.5rem; color: var(--text-main); font-size: 1.1rem; font-weight: 600; }
.chart-container { position: relative; height: 320px; width: 100%; }
.shortcuts-list { display: flex; flex-direction: column; gap: 1rem; }
.shortcut-btn { display: flex; align-items: center; justify-content: flex-start; gap: 1rem; padding: 1.25rem; font-size: 1rem; font-weight: 500; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 0.75rem; color: var(--text-main); cursor: pointer; transition: all 0.2s ease; }
.shortcut-btn:hover { background: var(--primary-light); color: var(--primary-color); border-color: var(--primary-color); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(13, 148, 136, 0.1); }
.shortcut-btn span:first-child { font-size: 1.5rem; }

/* Tabela de Clientes */
.header-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.header-between h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.025em; }
.table-container { padding: 0; overflow: hidden; }
.search-bar { padding: 1rem; border-bottom: 1px solid var(--border-color); background: #f9fafb; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
.table th, .table td { padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.table th { background: #f9fafb; color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table tbody tr { cursor: pointer; transition: background 0.2s; }
.table tbody tr:hover { background: #f9fafb; }

/* Paginação */
.pagination { display: flex; justify-content: flex-end; align-items: center; padding: 1rem 1.5rem; gap: 0.5rem; border-top: 1px solid var(--border-color); background: #ffffff; border-radius: 0 0 1rem 1rem; }
.page-btn { padding: 0.35rem 0.75rem; border: 1px solid var(--border-color); background: #ffffff; border-radius: 0.375rem; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--text-main); transition: all 0.2s; }
.page-btn:hover:not(:disabled) { background: var(--bg-color); }
.page-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Tags */
.tag { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; background: var(--primary-light); color: var(--primary-hover); border-radius: 9999px; font-size: 0.75rem; font-weight: 600; margin-right: 0.35rem; margin-bottom: 0.35rem; }
.tag-remove { margin-left: 0.25rem; cursor: pointer; color: var(--danger); font-weight: bold; }

/* Accordion Turmas */
.accordion-item { background: var(--card-bg); border-radius: 0.75rem; border: 1px solid var(--border-color); overflow: hidden; margin-bottom: 0.5rem; }
.accordion-header { padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; background: #ffffff; cursor: pointer; transition: background 0.2s; border-bottom: 1px solid transparent; }
.accordion-header:hover { background: #f3f4f6; }
.accordion-content { padding: 1.5rem; border-top: 1px solid var(--border-color); }
.client-list-item { padding: 1rem 0; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.client-list-item:hover { background: #f9fafb; }
.client-list-item:last-child { border-bottom: none; padding-bottom: 0; }

/* Modal */
.modal-overlay { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); 
    display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 1rem; 
    opacity: 1; visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Sobrescreve a classe .hidden global apenas para os modais, permitindo a animação de saída */
.modal-overlay.hidden {
    display: flex !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal { 
    width: 100%; max-width: 800px; padding: 0; max-height: 90vh; overflow-y: auto; 
    transform: translateY(0) scale(1);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}
.modal-overlay.hidden .modal {
    transform: translateY(20px) scale(0.96);
    opacity: 0;
}

.modal-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background: #ffffff; }
.modal-body { padding: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.col-span-2 { grid-column: span 2; }

/* Responsividade (Mobile) */
.mobile-menu-btn { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); z-index: 5; }

@media (max-width: 768px) {
    .mobile-menu-btn { display: inline-flex; }
    
    /* Menu Lateral Mobile */
    .sidebar { position: fixed; top: 0; left: -280px; height: 100vh; transition: left 0.3s ease; box-shadow: 4px 0 24px rgba(0,0,0,0.1); }
    .sidebar.open { left: 0; }
    .sidebar-overlay.active { display: block; }
    
    /* Ajustes de layout e espaçamentos */
    .main-content { padding: 1.25rem; }
    .grid-cards { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }
    
    /* Ajustes de cabeçalhos e tabelas */
    .header-between { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .header-between div { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; }
    .search-bar { flex-direction: column; }
    .search-bar select, .search-bar input { width: 100% !important; }
    .table-container { overflow-x: auto; }
    .table th, .table td { white-space: nowrap; }
}

/* --- Sistema de Notificações (Toasts) --- */
.toast-container {
    position: fixed; top: 1.5rem; right: 1.5rem; z-index: 9999;
    display: flex; flex-direction: column; gap: 0.75rem;
    pointer-events: none; /* Para não bloquear cliques na tela */
}

.toast {
    min-width: 280px; padding: 1rem 1.25rem; border-radius: 0.5rem;
    background: #ffffff; color: var(--text-main);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
    font-weight: 500; font-size: 0.875rem; pointer-events: auto;
    
    /* Animação inicial */
    transform: translateX(120%); opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { border-left-color: #10b981; } /* Verde para sucesso */
.toast.error { border-left-color: var(--danger); } /* Vermelho para erro */