/* admin/assets/css/main.css */
:root {
  --primary: #1a4e8a;
  --primary-light: #2563eb;
  --primary-hover: #113669;
  --accent: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f2444;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow-card: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

/* ---------------------------------------------------
   1. RESETS & GLOBALS
   --------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
svg { max-width: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-light); }

/* ---------------------------------------------------
   2. LAYOUT
   --------------------------------------------------- */
.main-wrapper {
  margin-left: 240px !important;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  margin-top: 60px !important;
  padding: 28px 32px !important;
  flex: 1;
}

/* ---------------------------------------------------
   3. SIDEBAR
   --------------------------------------------------- */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  padding: 0;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.01em;
}
.sidebar-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
}
.sidebar-logo svg {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.sidebar-group {
  margin-bottom: 4px;
  padding: 0 12px;
}
.sidebar-group-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 12px 8px 6px;
}
.sidebar-link {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  border-radius: 8px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 400;
  transition: all .15s;
  margin-bottom: 1px;
  white-space: nowrap;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.sidebar-link.active {
  background: var(--primary-light);
  color: #fff;
  font-weight: 500;
}
.sidebar-label {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .8;
}
.sidebar-icon svg { width: 18px !important; height: 18px !important; flex-shrink: 0; }
.sidebar-link.active .sidebar-icon,
.sidebar-link:hover .sidebar-icon { opacity: 1; }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #f87171;
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s;
}
.sidebar-logout:hover { background: rgba(248,113,113,.1); }
.sidebar-version {
  display: block;
  text-align: center;
  font-size: 11px;
  color: #334155;
  margin-top: 8px;
}

/* ---------------------------------------------------
   4. TOPBAR
   --------------------------------------------------- */
.topbar {
  left: 240px !important;
  right: 0 !important;
  top: 0 !important;
  position: fixed !important;
  height: 60px !important;
  z-index: 99 !important;
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 24px !important;
  justify-content: space-between;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  padding: 4px; border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--bg-page); color: var(--text-primary); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .875rem;
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-icon-btn {
  width: 36px; height: 36px;
  border: none; background: none;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background .15s;
}
.topbar-icon-btn:hover { background: var(--bg-page); }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: background .15s;
}
.topbar-user:hover { background: var(--bg-page); }
.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8125rem;
  font-weight: 600;
}
.topbar-username { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 160px;
  box-shadow: var(--shadow-card);
  z-index: 200;
}
.user-dropdown.open { display: block; animation: slideDown 0.15s ease-out; }
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: .875rem;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  transition: background .15s;
}
.user-dropdown a:hover { background: var(--bg-page); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.text-danger { color: var(--danger) !important; }

/* ---------------------------------------------------
   5. COMPONENTS (BOTÕES, CARDS, ALERTAS, ETC)
   --------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 1.375rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.page-subtitle { font-size: .875rem; color: var(--text-secondary); margin: 2px 0 0; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: .9375rem; font-weight: 600; margin: 0; color: var(--text-primary); }
.card-body { padding: 20px; }

/* Dashboard Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
}
.stat-card-info { flex: 1; }
.stat-label { font-size: .8125rem; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-change { font-size: .75rem; margin-top: 6px; display: inline-block; font-weight: 500; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px !important; height: 24px !important; flex-shrink: 0; }
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap !important;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn-secondary:hover { background: var(--bg-page); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 5px 10px; font-size: .8125rem; border-radius: 6px; }
.btn-lg { padding: 10px 22px; font-size: 1rem; }
.btn svg { width: 16px !important; height: 16px !important; flex-shrink: 0; }

/* Alertas */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .875rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
  font-weight: 500;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.alert button { background: none; border: none; cursor: pointer; color: inherit; font-size: 1.25rem; padding: 0; opacity: .6; line-height: 1; }
.alert button:hover { opacity: 1; }

/* Toolbar & Filtros */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}
.search-input-wrap, .search-input { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap svg, .search-input svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 18px !important; height: 18px !important;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.search-input-wrap .form-control, .search-input input { padding-left: 34px; width: 100%; }
.search-input input {
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  height: 40px;
}
.filter-bar select.form-control { min-width: 140px; width: auto !important; height: 40px; }
.filter-bar .btn { height: 40px; }

/* Tabelas */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-page);
  padding: 11px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 16px;
  font-size: .875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-active { background: #f0fdf4; color: #15803d; }
.badge-trial { background: #eff6ff; color: #1d4ed8; }
.badge-blocked, .badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-suspended { background: #fff7ed; color: #c2410c; }
.badge-inactive { background: #f8fafc; color: #64748b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-primary { background: #eff6ff; color: var(--accent); }

/* Paginação */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: .8125rem;
  color: var(--text-secondary);
  background: var(--bg-card);
}
.pagination-pages { display: flex; gap: 4px; }
.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: .8125rem;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  transition: all .15s;
}
.page-btn:hover { background: var(--bg-page); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ---------------------------------------------------
   6. FORMULÁRIOS
   --------------------------------------------------- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.form-section {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; }
.form-section-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-primary);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.form-control:disabled { background: var(--bg-page); color: var(--text-muted); cursor: not-allowed; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 2px; }
.form-actions {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
select.form-control { cursor: pointer; appearance: auto; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* Checkboxes & Radios */
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .875rem; }
.check-row input[type="checkbox"],
.check-row input[type="radio"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* Empty States */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: #94a3b8;
}
.empty-state svg { 
  width: 40px !important; 
  height: 40px !important; 
  margin: 0 auto 12px;
  display: block;
  opacity: .4;
  flex-shrink: 0;
}
.empty-state-title { 
  font-size: .9375rem; 
  font-weight: 500; 
  color: #64748b;
  margin-bottom: 4px;
}
.empty-state-text { font-size: .8125rem; }

/* ---------------------------------------------------
   7. UTILITIES E ANIMAÇÕES
   --------------------------------------------------- */
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.flex { display: flex; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }

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

/* ---------------------------------------------------
   8. RESPONSIVO
   --------------------------------------------------- */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .topbar { left: 0; padding: 0 16px; }
  .sidebar-toggle { display: block; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .table-card { border-radius: 0; border-left: none; border-right: none; }
}
/* Badges de status de turma */
.badge-open     { background: #f0fdf4; color: #15803d; }
.badge-progress { background: #eff6ff; color: #1d4ed8; }
.badge-finished { background: #f8fafc; color: #475569; }
.badge-cancelled{ background: #fef2f2; color: #b91c1c; }

/* Grid de presena */
.attendance-grid { width: 100%; border-collapse: collapse; }
.attendance-grid th,
.attendance-grid td {
  padding: 8px 10px;
  font-size: .8125rem;
  border: 1px solid var(--border);
  text-align: center;
}
.attendance-grid thead th { background: var(--bg-page); font-weight: 600; }
.att-present { background: #f0fdf4; color: #15803d; font-weight: 500; }
.att-absent  { background: #fef2f2; color: #b91c1c; font-weight: 500; }
.att-justified { background: #fffbeb; color: #92400e; font-weight: 500; }

/* Grid de notas */
.grades-grid td input {
  width: 60px;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .8125rem;
  text-align: center;
  outline: none;
}
.grades-grid td input:focus { border-color: var(--accent); }
.grade-approved { color: #15803d; font-weight: 600; }
.grade-failed   { color: #b91c1c; font-weight: 600; }
.table-card { border-radius: 0; border-left: none; border-right: none; }
}

/* -- SweetAlert2  tema do sistema -- */
.swal-popup {
  border-radius: 16px !important;
  padding: 28px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.15) !important;
  border: 1px solid var(--border) !important;
}
.swal-title {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  margin-bottom: 6px !important;
}
.swal-html {
  font-size: .9375rem !important;
  color: var(--text-secondary) !important;
  line-height: 1.6 !important;
}
.swal-icon {
  margin-bottom: 16px !important;
}
.swal-actions {
  gap: 8px !important;
  margin-top: 20px !important;
}

/* Botes do SweetAlert2 */
.swal-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 9px 20px !important;
  border-radius: 8px !important;
  font-size: .875rem !important;
  font-weight: 500 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  cursor: pointer !important;
  border: none !important;
  transition: all .15s !important;
  white-space: nowrap !important;
}
.swal-btn-confirm {
  background: var(--primary) !important;
  color: #fff !important;
}
.swal-btn-confirm:hover {
  filter: brightness(.9) !important;
}
.swal-btn-danger {
  background: #dc2626 !important;
  color: #fff !important;
}
.swal-btn-danger:hover {
  background: #b91c1c !important;
}
.swal-btn-warning {
  background: #d97706 !important;
  color: #fff !important;
}
.swal-btn-warning:hover {
  background: #b45309 !important;
}
.swal-btn-cancel {
  background: #f1f5f9 !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
.swal-btn-cancel:hover {
  background: #e2e8f0 !important;
}
.swal-btn-deny {
  background: #64748b !important;
  color: #fff !important;
}

/* Textarea do SwalBlock */
.swal-textarea {
  width: 100% !important;
  padding: 8px 12px !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  font-size: .875rem !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  resize: vertical !important;
  outline: none !important;
  margin-top: 8px !important;
}
.swal-textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12) !important;
}

/* Toast */
.swal-toast {
  border-radius: 10px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: .875rem !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
  border: 1px solid var(--border) !important;
}

/* Overlay mais suave */
.swal2-backdrop-show {
  background: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(2px) !important;
}

/* -- Header de turma com abas -- */
.class-tabs-header {
  margin-bottom: 0;
}
.class-tabs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.class-tabs-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}
.class-tabs-breadcrumb a:hover {
  color: var(--primary);
}
.class-tabs-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* Nav de abas */
.class-tabs-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 0;
}
.class-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all .15s;
  border-radius: 6px 6px 0 0;
}
.class-tab:hover {
  color: var(--text-primary);
  background: var(--bg-page);
}
.class-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
  font-weight: 600;
}
.class-tab svg {
  opacity: .7;
  flex-shrink: 0;
}
.class-tab.active svg { opacity: 1; }

/* Badge de contagem na aba */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
}
.class-tab:not(.active) .tab-badge {
  background: var(--border);
  color: var(--text-muted);
}

/* rea de contedo da aba */
.class-tab-content {
  animation: fadeTabIn .2s ease;
}
@keyframes fadeTabIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsivo: abas com scroll horizontal em mobile */
@media (max-width: 768px) {
  .class-tabs-nav {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .class-tabs-nav::-webkit-scrollbar { display: none; }
  .class-tab { padding: 10px 12px; font-size: .8125rem; }
  .class-tabs-title-row { flex-direction: column; gap: 12px; }
}


/* -- Pgina de documentos -- */
.docs-page { display: flex; flex-direction: column; gap: 20px; }

.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.docs-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.docs-header-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.docs-header-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
}
.docs-header-subtitle {
  font-size: .875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Empty state */
.docs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.docs-empty-icon {
  width: 80px; height: 80px;
  border-radius: 20px;
  background: var(--bg-page);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 20px;
  opacity: .5;
}
.docs-empty-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
}
.docs-empty-desc {
  font-size: .875rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 0 20px;
  line-height: 1.6;
}

/* Generator container */
.docs-generator {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Steps */
.docs-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.docs-step-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
  flex-wrap: wrap;
}
.docs-step-number {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.docs-step-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
}
.docs-step-desc {
  font-size: .8125rem;
  color: var(--text-muted);
  margin: 0;
}
.docs-select-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* Templates grid */
.docs-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}
.docs-template-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all .18s;
  background: var(--bg-card);
}
.docs-template-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.docs-template-card.selected {
  border-color: var(--primary);
  background: #f0fdf4;
}
.docs-tpl-thumb {
  height: 100px;
  background: #f8fafc;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border);
}
.docs-tpl-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.docs-tpl-thumb-placeholder {
  font-size: 2rem;
  opacity: .4;
}
.docs-tpl-info {
  padding: 10px 12px;
}
.docs-tpl-name {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-tpl-type {
  font-size: .75rem;
  color: var(--text-muted);
}
.docs-tpl-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  background: var(--primary);
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  color: #fff;
}
.docs-template-card.selected .docs-tpl-check {
  display: flex;
}
.docs-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: .8125rem;
  color: #15803d;
  margin: 0 24px 16px;
}

/* Students table */
.docs-students-table {
  overflow-x: auto;
}
.docs-students-table table {
  width: 100%;
  border-collapse: collapse;
}
.docs-students-table thead th {
  background: var(--bg-page);
  padding: 10px 16px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.docs-students-table tbody td {
  padding: 12px 16px;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.docs-students-table tbody tr:last-child td {
  border-bottom: none;
}
.docs-students-table tbody tr:hover td {
  background: #f8fafc;
}
.docs-student-name {
  display: flex;
  align-items: center;
  gap: 10px;
}
.docs-student-avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  flex-shrink: 0;
}
.docs-freq-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .8125rem;
  font-weight: 600;
}
.docs-freq-badge.ok {
  background: #f0fdf4;
  color: #15803d;
}
.docs-freq-badge.fail {
  background: #fef2f2;
  color: #b91c1c;
}
.docs-generated-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  color: #15803d;
}
.docs-selection-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #eff6ff;
  border-top: 1px solid #bfdbfe;
  font-size: .875rem;
  color: #1d4ed8;
}

/* Options */
.docs-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px 24px;
}
.docs-option-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-option-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.docs-option-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Generate area */
.docs-generate-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.docs-validation-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 20px;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #b91c1c;
  font-size: .875rem;
}

/* Progress steps */
.docs-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 20px 24px 0;
}
.docs-progress-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  opacity: .4;
  transition: opacity .3s;
}
.docs-progress-step:last-child { border-bottom: none; }
.docs-progress-step.active { opacity: 1; }
.docs-progress-step.done { opacity: 1; }

.docs-progress-step-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.docs-progress-step.active .docs-progress-step-icon {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.docs-progress-step.done .docs-progress-step-icon {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

/* Spinner e check dentro do step icon */
.pstep-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid #bfdbfe;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.pstep-check { display: none; color: #16a34a; }
.docs-progress-step.active .pstep-spinner { display: block; }
.docs-progress-step.done .pstep-spinner { display: none; }
.docs-progress-step.done .pstep-check { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.docs-progress-step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pstep-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.pstep-desc {
  font-size: .8125rem;
  color: var(--text-muted);
}

/* Progress bar */
.docs-progress-bar-wrap {
  padding: 16px 24px;
}
.docs-progress-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.docs-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--primary), var(--primary-light));
  border-radius: 999px;
  transition: width .4s ease;
}
.docs-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .8125rem;
  color: var(--text-muted);
}

/* Progress tip */
.docs-progress-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-page);
  border-top: 1px solid var(--border);
  font-size: .8125rem;
  color: var(--text-muted);
}

/* Success box */
.docs-success-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
}
.docs-success-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: #dcfce7;
  color: #16a34a;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.docs-success-title {
  font-size: .9375rem;
  font-weight: 600;
  color: #15803d;
  margin: 0 0 4px;
}
.docs-success-desc {
  font-size: .875rem;
  color: #166534;
  margin: 0;
}
.docs-success-info { flex: 1; }

/* Action bar */
.docs-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-page);
}
.docs-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: .8125rem;
  font-weight: 600;
}

/* Boto gerar com spinner */
.btn-generate {
  position: relative;
  min-width: 200px;
  justify-content: center;
}
.btn-generate:disabled {
  opacity: .5;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* Step empty */
.docs-step-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
}

/* Responsivo */
@media (max-width: 768px) {
  .docs-options-grid { grid-template-columns: 1fr; }
  .docs-templates-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .docs-action-bar { flex-direction: column; gap: 12px; }
  .docs-select-actions { margin-left: 0; width: 100%; }
}


/* ---------------------------------------------------
   9. CRM MODULE
   --------------------------------------------------- */
.crm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.crm-stat {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.crm-stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.crm-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.crm-stat-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.crm-stat-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  width: fit-content;
  margin-top: 8px;
}

.crm-stat-badge.green { background: #dcfce7; color: #166534; }
.crm-stat-badge.red { background: #fee2e2; color: #991b1b; }

.crm-view-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.crm-view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.crm-view-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.crm-view-btn:not(.active):hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-primary);
}

/* Kanban Extensions */
.crm-kanban-wrapper {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: calc(100vh - 250px);
  align-items: flex-start;
}

.crm-column {
  min-width: 300px;
  width: 300px;
  background: #f8fafc;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  border: 1px solid var(--border);
}

.crm-column.won { background: rgba(22, 163, 74, 0.03); border-color: rgba(22, 163, 74, 0.15); }
.crm-column.lost { background: rgba(220, 38, 38, 0.03); border-color: rgba(220, 38, 38, 0.15); }

.crm-column-header { padding: 16px 16px 12px; }
.crm-column-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.crm-column-color { width: 4px; height: 16px; border-radius: 2px; }
.crm-column-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); flex: 1; }
.crm-column-count { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; background: #fff; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); }
.crm-column-add { color: var(--text-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; transition: color 0.2s; }
.crm-column-add:hover { color: var(--primary); }

.crm-cards-list { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 12px; min-height: 100px; }
.crm-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  cursor: grab;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.crm-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.crm-card.dragging { opacity: 0.5; cursor: grabbing; }

.crm-card-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; line-height: 1.4; }
.crm-card-company { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.crm-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.crm-tag { background: #f1f5f9; color: #475569; font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; font-weight: 500; }

.crm-card-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f1f5f9; padding-top: 12px; }
.crm-card-meta { display: flex; align-items: center; gap: 10px; }

.crm-priority { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.crm-priority.urgent { background: #fee2e2; color: #991b1b; }
.crm-priority.high { background: #ffedd5; color: #9a3412; }
.crm-priority.medium { background: #eff6ff; color: #1e40af; }
.crm-priority.low { background: #f1f5f9; color: #475569; }

.crm-card-due { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.crm-card-due svg { width: 14px; height: 14px; opacity: 0.6; }
.crm-card-due.overdue { color: var(--danger); font-weight: 600; }

.crm-card-avatar { width: 22px; height: 22px; border-radius: 6px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; }

/* Timeline & Show Lead */
.crm-lead-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: flex-start; }

.crm-activity-type {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.crm-activity-type svg { width: 16px !important; height: 16px !important; transition: transform 0.2s; flex-shrink: 0; }
.crm-activity-type:hover { border-color: var(--accent); color: var(--text-primary); }
.crm-activity-type.active { border-color: var(--accent); background: #eff6ff; color: var(--accent); }

.crm-timeline { position: relative; margin-top: 10px; }
.crm-timeline::before { content: ''; position: absolute; left: 19px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.crm-timeline-item { position: relative; padding-left: 50px; margin-bottom: 24px; animation: slideDown 0.3s ease-out; }
.crm-timeline-icon {
  position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-card); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; z-index: 1;
  font-size: 1.1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.crm-timeline-item .crm-timeline-icon svg { width: 18px !important; height: 18px !important; flex-shrink: 0; }

.crm-timeline-body { background: var(--bg-card); border-radius: 12px; padding: 16px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.crm-timeline-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.crm-timeline-title { font-weight: 700; color: var(--text-primary); font-size: 0.9375rem; }
.crm-timeline-time { font-size: 0.75rem; color: var(--text-muted); }
.crm-timeline-desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }

.crm-stage-selector { display: flex; flex-direction: column; gap: 4px; }
.crm-stage-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; border: 1px solid transparent; position: relative;
}
.crm-stage-option:hover { background: #f8fafc; }
.crm-stage-option.current { background: #eff6ff; border-color: rgba(59, 130, 246, 0.2); }
.crm-stage-option-dot { width: 8px; height: 8px; border-radius: 50%; }
.crm-stage-option-name { font-size: 14px; font-weight: 500; color: var(--text-primary); flex: 1; }
.crm-stage-option-check { opacity: 0; color: var(--accent); font-weight: bold; }
.crm-stage-option.current .crm-stage-option-check { opacity: 1; }
