/* ==============================================================================
   DESIGN SYSTEM EDTECH & MULTI-THEME ARCHITECTURE (PROFESSOR PRO)
   ============================================================================== */

/* TEMA 1: ACADEMIA CLÁSSICA (PADRÃO OFICIAL) - MODO CLARO */
:root,
[data-theme="classico"],
[data-theme="classico"][data-mode="light"] {
  color-scheme: light;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0ea5e9;
  --success: #15803d;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f0f9ff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --table-hover: #f8fafc;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
  --dark: #0f172a;
  --gray: #475569;
  --light: #f8fafc;
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 68px;
}

/* TEMA 1: ACADEMIA CLÁSSICA - MODO ESCURO (CARBON ONYX PURO - NEUTRO ZERO ROXO) */
[data-mode="dark"],
[data-theme="classico"][data-mode="dark"] {
  color-scheme: dark;
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: rgba(14, 165, 233, 0.15);
  --secondary: #38bdf8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-body: #121316;
  --bg-surface: #1c1d22;
  --bg-subtle: #16171b;
  --text-primary: #f4f4f6;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #2d2e36;
  --border-subtle: #23242a;
  --sidebar-bg: #0c0d0f;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --table-hover: #24252c;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --dark: #f4f4f6;
  --gray: #a1a1aa;
  --light: #16171b;
}

/* TEMA 2: CADERNO VIVO & SÁLVIA - MODO CLARO */
[data-theme="salvia"],
[data-theme="salvia"][data-mode="light"] {
  color-scheme: light;
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --primary-light: #e8f3ed;
  --secondary: #52b788;
  --success: #15803d;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-body: #f4f7f4;
  --bg-surface: #ffffff;
  --bg-subtle: #edf3ee;
  --text-primary: #1c2e24;
  --text-secondary: #4a5f52;
  --text-muted: #84998c;
  --border: #dde6de;
  --border-subtle: #e9f0ea;
  --sidebar-bg: linear-gradient(180deg, #1b3526 0%, #112319 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --table-hover: #f4f8f5;
  --shadow-sm: 0 1px 3px rgba(28, 46, 36, 0.05);
  --shadow-md: 0 4px 14px rgba(28, 46, 36, 0.07);
  --dark: #1c2e24;
  --gray: #4a5f52;
  --light: #f4f7f4;
}

/* TEMA 2: CADERNO VIVO & SÁLVIA - MODO ESCURO (OLIVA & CARBONO NÓRDICO - VERDE NEUTRO) */
[data-theme="salvia"][data-mode="dark"] {
  color-scheme: dark;
  --primary: #5c8d6e;
  --primary-dark: #3d694e;
  --primary-light: rgba(92, 141, 110, 0.15);
  --secondary: #7fae90;
  --success: #40916c;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-body: #111311;
  --bg-surface: #1a1e1b;
  --bg-subtle: #151815;
  --text-primary: #f3f5f3;
  --text-secondary: #9da49e;
  --text-muted: #6d746e;
  --border: #2b332d;
  --border-subtle: #222823;
  --sidebar-bg: #0c0e0c;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --table-hover: #202521;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --dark: #f3f5f3;
  --gray: #9da49e;
  --light: #151815;
}

/* TEMA 3: DIGITAL CAMPUS PRO - MODO CLARO */
[data-theme="campus"],
[data-theme="campus"][data-mode="light"] {
  color-scheme: light;
  --primary: #4338ca;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --secondary: #6366f1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-body: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #eef2ff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --table-hover: #f8fafc;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --dark: #0f172a;
  --gray: #475569;
  --light: #f1f5f9;
}

/* TEMA 3: DIGITAL CAMPUS PRO - MODO ESCURO */
[data-theme="campus"][data-mode="dark"] {
  color-scheme: dark;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --secondary: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-body: #0f172a;
  --bg-surface: #1e293b;
  --bg-subtle: #162032;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --border-subtle: #243044;
  --sidebar-bg: #0a0f1d;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --table-hover: #26354a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --dark: #f8fafc;
  --gray: #94a3b8;
  --light: #162032;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  overflow-x: clip;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ====== SIDEBAR (EXPANSÃO POR HOVER & SEM SETAS) ====== */
.sidebar {
  width: var(--sidebar-width-collapsed, 68px);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  user-select: none;
}

/* MODO FIXADO ABERTO (PINNED) */
.sidebar.pinned,
html.sidebar-pinned .sidebar {
  width: var(--sidebar-width, 260px);
  box-shadow: none !important;
}

/* EXPANSÃO POR HOVER NO DESKTOP:
   Ao passar o mouse sobre o menu recolhido, expande fluidamente como floating drawer */
.sidebar:not(.pinned):hover {
  width: var(--sidebar-width, 260px);
  box-shadow: 10px 0 32px rgba(0, 0, 0, 0.45);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Header do Menu */
.sidebar-logo {
  height: 64px;
  min-height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.sidebar-logo .logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary, #0284c7), var(--secondary, #0ea5e9));
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.sidebar-logo .logo-icon:hover {
  transform: scale(1.05);
}

.sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.sidebar.pinned .logo-text,
html.sidebar-pinned .sidebar .logo-text,
.sidebar:hover .logo-text {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-logo .logo-text h2 {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.sidebar-logo .logo-text span {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

/* Botão Pin (Fixar / Desafixar Menu Aberto) */
.sidebar-pin-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  flex-shrink: 0;
  outline: none;
  opacity: 0;
  pointer-events: none;
}

.sidebar.pinned .sidebar-pin-btn,
html.sidebar-pinned .sidebar .sidebar-pin-btn,
.sidebar:hover .sidebar-pin-btn {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-pin-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: scale(1.06);
}

.sidebar-pin-btn.is-pinned {
  background: rgba(2, 132, 199, 0.25);
  color: var(--secondary, #38bdf8);
  border-color: var(--primary, #0284c7);
}
[data-theme="classico"] .sidebar-pin-btn.is-pinned,
:root .sidebar-pin-btn.is-pinned {
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
  border-color: rgba(2, 132, 199, 0.45);
}
[data-theme="salvia"] .sidebar-pin-btn.is-pinned {
  background: rgba(45, 106, 79, 0.3);
  color: #52b788;
  border-color: rgba(45, 106, 79, 0.5);
}
[data-theme="campus"] .sidebar-pin-btn.is-pinned {
  background: rgba(67, 56, 202, 0.28);
  color: #818cf8;
  border-color: rgba(67, 56, 202, 0.5);
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.sidebar-close-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

/* Navegação e Grupos */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Item Direto (Dashboard) */
.sb-direct-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sb-direct-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.sb-direct-item.active {
  background: rgba(2, 132, 199, 0.25);
  color: #ffffff;
  font-weight: 700;
}
[data-theme="classico"] .sb-direct-item.active,
:root .sb-direct-item.active {
  background: rgba(2, 132, 199, 0.28);
}
[data-theme="salvia"] .sb-direct-item.active {
  background: rgba(45, 106, 79, 0.35);
}
[data-theme="campus"] .sb-direct-item.active {
  background: rgba(67, 56, 202, 0.32);
}

/* Grupos de Sessão (SEM SETAS DE EXPANSÃO) */
.sb-session-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

.sb-session-header {
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  outline: none;
  user-select: none;
}

.sb-session-header:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sb-session-group.open > .sb-session-header {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sb-session-group.open > .sb-session-header .sb-icon-badge {
  background: rgba(2, 132, 199, 0.28);
  transform: scale(1.05);
}
[data-theme="classico"] .sb-session-group.open > .sb-session-header .sb-icon-badge,
:root .sb-session-group.open > .sb-session-header .sb-icon-badge {
  background: rgba(2, 132, 199, 0.32);
}
[data-theme="salvia"] .sb-session-group.open > .sb-session-header .sb-icon-badge {
  background: rgba(45, 106, 79, 0.4);
}
[data-theme="campus"] .sb-session-group.open > .sb-session-header .sb-icon-badge {
  background: rgba(67, 56, 202, 0.35);
}

.sb-session-header.active-module {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.sb-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.sb-session-header:hover .sb-icon-badge {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.sb-header-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.1px;
  opacity: 0;
  transition: opacity 0.18s ease;
  white-space: nowrap;
}

.sidebar.pinned .sb-header-title,
html.sidebar-pinned .sidebar .sb-header-title,
.sidebar:hover .sb-header-title,
.sidebar:focus-within .sb-header-title {
  opacity: 1;
}

/* Submenu Filhos (Retraído por padrão até o clique) */
.sb-sub-list {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 6px 26px;
  margin-left: 15px;
  border-left: 1.5px solid rgba(255, 255, 255, 0.12);
  animation: sbSubListFade 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Mostra a lista apenas quando a sessão estiver .open E a barra lateral estiver expandida */
.sidebar:not(.pinned):hover .sb-session-group.open .sb-sub-list,
.sidebar:not(.pinned):focus-within .sb-session-group.open .sb-sub-list,
.sidebar.pinned .sb-session-group.open .sb-sub-list,
html.sidebar-pinned .sidebar .sb-session-group.open .sb-sub-list,
.sidebar.open .sb-session-group.open .sb-sub-list {
  display: flex;
}

.sb-sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6.5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: all 0.12s ease;
  white-space: nowrap;
  position: relative;
}

.sb-sub-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
  text-decoration: none;
}

.sb-sub-item.active {
  color: #ffffff;
  background: rgba(2, 132, 199, 0.25);
  font-weight: 700;
}
[data-theme="classico"] .sb-sub-item.active,
:root .sb-sub-item.active {
  background: rgba(2, 132, 199, 0.28);
}
[data-theme="salvia"] .sb-sub-item.active {
  background: rgba(45, 106, 79, 0.35);
}
[data-theme="campus"] .sb-sub-item.active {
  background: rgba(67, 56, 202, 0.32);
}

.sb-sub-item.active::before {
  content: '';
  position: absolute;
  left: -27.5px;
  width: 2.5px;
  height: 18px;
  background: var(--primary, #0284c7);
  border-radius: 2px;
}

.sb-tag-pro {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(2, 132, 199, 0.3));
  color: #f472b6;
  letter-spacing: 0.3px;
}

/* Card de Usuário no Rodapé */
.sidebar-user-card {
  margin: 10px 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.2s ease;
}

.sidebar:not(.pinned) .sidebar-user-card {
  padding: 10px 8px;
  justify-content: center;
}

.sidebar:not(.pinned):hover .sidebar-user-card,
.sidebar.pinned .sidebar-user-card,
html.sidebar-pinned .sidebar .sidebar-user-card {
  padding: 10px 12px;
  justify-content: space-between;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.sidebar-user-initial {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.sidebar.pinned .sidebar-user-details,
html.sidebar-pinned .sidebar .sidebar-user-details,
.sidebar:hover .sidebar-user-details {
  opacity: 1;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-logout {
  color: #ef4444;
  text-decoration: none;
  font-size: 15px;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.18s, transform 0.1s;
  flex-shrink: 0;
}

.sidebar.pinned .sidebar-user-logout,
html.sidebar-pinned .sidebar .sidebar-user-logout,
.sidebar:hover .sidebar-user-logout {
  opacity: 0.85;
}

.sidebar-user-logout:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* ====== MAIN CONTENT ====== */
.main-content {
  margin-left: var(--sidebar-width-collapsed, 68px);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-x: clip;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Quando o menu estiver fixado aberto, empurra o conteúdo */
html.sidebar-pinned .main-content {
  margin-left: var(--sidebar-width, 260px);
}

/* ====== FAIXA / BARRA SUPERIOR DE MODO SUPORTE ====== */
.top-support-banner {
  background: linear-gradient(135deg, var(--dark, #0f172a) 0%, var(--primary-dark) 60%, var(--primary) 100%);
  color: #fef08a;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--secondary);
  flex-wrap: wrap;
  gap: 8px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

[data-theme="classico"] .top-support-banner,
:root .top-support-banner {
  background: linear-gradient(135deg, #0f172a 0%, #0369a1 60%, #0284c7 100%);
  border-bottom-color: #38bdf8;
}

[data-theme="salvia"] .top-support-banner {
  background: linear-gradient(135deg, #1c2e24 0%, #1b4332 60%, #2d6a4f 100%);
  border-bottom-color: #52b788;
}

[data-theme="campus"] .top-support-banner {
  background: linear-gradient(135deg, #0f172a 0%, #3730a3 60%, #4338ca 100%);
  border-bottom-color: #6366f1;
}

[data-mode="dark"][data-theme="classico"] .top-support-banner {
  background: linear-gradient(135deg, #0c0d0f 0%, #0369a1 60%, #0284c7 100%);
  border-bottom-color: #38bdf8;
}

[data-mode="dark"][data-theme="salvia"] .top-support-banner {
  background: linear-gradient(135deg, #0c0e0c 0%, #1f2b22 60%, #3d694e 100%);
  border-bottom-color: #5c8d6e;
}

[data-mode="dark"][data-theme="campus"] .top-support-banner {
  background: linear-gradient(135deg, #0a0f1d 0%, #3730a3 60%, #4338ca 100%);
  border-bottom-color: #818cf8;
}

/* ====== TOPBAR ====== */
.topbar {
  background: var(--bg-surface);
  padding: 0 24px;
  height: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 3.5px solid var(--primary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  box-sizing: border-box;
}

[data-theme="classico"] .topbar,
:root .topbar {
  border-top-color: #0284c7;
}

[data-theme="salvia"] .topbar {
  border-top-color: #2d6a4f;
}

[data-theme="campus"] .topbar {
  border-top-color: #4338ca;
}

[data-mode="dark"][data-theme="classico"] .topbar {
  border-top-color: #0ea5e9;
}

[data-mode="dark"][data-theme="salvia"] .topbar {
  border-top-color: #5c8d6e;
}

[data-mode="dark"][data-theme="campus"] .topbar {
  border-top-color: #6366f1;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-title-group {
  min-width: 0;
  overflow: hidden;
}

.page-title {
  font-size: 17.5px;
  font-weight: 750;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}

.page-subtitle:empty {
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  height: 100%;
}

.topbar-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: var(--bg-subtle);
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Alternador Dark Mode Compacto Circular */
.theme-toggle-compact-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  outline: none;
  font-size: 15px;
  line-height: 1;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.theme-toggle-compact-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ====== MENU EXPANSÍVEL DO USUÁRIO, PLANO & IA ====== */
.topbar-user-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
}

.user-pill-btn {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px 0 5px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
  outline: none;
  user-select: none;
  box-sizing: border-box;
}

.user-pill-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-pill-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 14px;
}

.user-pill-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-pill-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-pill-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-pill-badge {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.user-pill-badge.admin {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.user-pill-caret {
  font-size: 10.5px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  margin-left: 2px;
}

/* Dropdown Flutuante de Perfil, Plano e IA */
.user-profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md), 0 20px 45px rgba(0, 0, 0, 0.25);
  z-index: 1050;
  overflow: hidden;
  animation: popoverSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.dropdown-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  flex-shrink: 0;
  font-size: 20px;
}

.dropdown-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dropdown-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.dropdown-user-name {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-roles {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

/* Caixas de Seção do Menu (Plano & IA) */
.dropdown-section-box {
  margin: 10px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.dropdown-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-label-bold {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.plan-badge-pill {
  font-size: 10px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.plan-badge-pill.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.plan-badge-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.plan-badge-pill.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Barra de Progresso de Consumo de IA */
.dropdown-progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 6px 0;
}

.dropdown-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.dropdown-progress-fill.primary {
  background: var(--primary, #0284c7);
}

.dropdown-progress-fill.warning {
  background: #f59e0b;
}

.dropdown-progress-fill.danger {
  background: #ef4444;
}

.dropdown-progress-fill.image-ai {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}

.dropdown-action-link {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.dropdown-action-link:hover {
  text-decoration: underline;
  transform: translateX(2px);
}

/* Links Rápidos do Menu */
.dropdown-menu-links {
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
}

.dropdown-link-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.dropdown-link-item:hover {
  background: var(--bg-subtle);
  color: var(--primary);
  transform: translateX(2px);
}

.dropdown-link-item.admin-highlight {
  color: #d97706;
}

/* Rodapé do Menu com Logout */
.dropdown-menu-footer {
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}

.btn-dropdown-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-dropdown-logout:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

[data-mode="dark"] .user-profile-dropdown-menu {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ====== PAGE BODY ====== */
.page-body {
  padding: 28px;
  flex: 1;
}

/* ====== STAT CARDS ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.25s, border-color 0.25s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.orange { background: #ffedd5; color: #c2410c; }
.stat-icon.cyan { background: #cffafe; color: #0e7490; }

.stat-info .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-info .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ====== CONTENT CARDS ====== */
.card {
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  transition: background-color 0.25s, border-color 0.25s;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  min-width: 0;
  transition: background-color 0.25s, border-color 0.25s;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 22px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* ====== TABLES ====== */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 12px 16px;
  text-align: left;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--table-hover);
}

/* ====== BADGES ====== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray    { background: #f1f5f9; color: var(--gray); }

/* ====== CAMPOS COM PENDÊNCIA (HIGHLIGHT REATIVO & NOTICES — MODELO 1) ====== */
.field-pending-highlight {
  border-color: rgba(245, 158, 11, 0.6) !important;
  background: rgba(245, 158, 11, 0.04) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
}
.field-pending-highlight:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;
}

.field-pending-notice {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #d97706;
  margin-top: 3px;
  line-height: 1.35;
}
[data-mode="dark"] .field-pending-notice {
  color: #f59e0b;
}

.card-ciclo-item.empty-pending {
  border-color: rgba(239, 68, 68, 0.45) !important;
  background: rgba(239, 68, 68, 0.04) !important;
}

/* ====== BUTTONS (DESIGN SYSTEM — MODELO 1: SAAS ENTERPRISE) ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm, 8px);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  line-height: 1;
  box-sizing: border-box;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none !important;
  transform: none !important;
}

/* Escala de Tamanhos Padronizada */
.btn-xs,
.btn-micro {
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
  border-radius: 6px;
  gap: 4px;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 7px;
  gap: 5px;
}

.btn-md {
  height: 40px;
  padding: 0 16px;
  font-size: 13.5px;
  border-radius: 8px;
  gap: 6px;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 10px;
  gap: 8px;
}

/* Botões Quadrados / Icon-Only */
.btn-icon-xs {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-md {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ações Padronizadas em Tabelas (Row Actions) */
.btn-acao-tabela,
.btn-acao-turma {
  height: 32px;
  min-width: 94px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
}

/* 1. Primário */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.25);
}

/* 2. Secundário / Outline */
.btn-secondary,
.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.btn-secondary:hover,
.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-hover, #cbd5e1);
}
[data-mode="dark"] .btn-secondary:hover,
[data-mode="dark"] .btn-outline:hover {
  border-color: #334155;
  background: rgba(255, 255, 255, 0.06);
}

/* 3. Sucesso */
.btn-success {
  background: var(--success, #10b981);
  color: #ffffff;
  border-color: var(--success, #10b981);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(16, 185, 129, 0.25);
}

/* 4. Edição / Alerta (Soft Amber) */
.btn-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.25);
}
[data-mode="dark"] .btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

/* 5. Destrutivo (Soft Danger — Modelo 1) */
.btn-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
}
[data-mode="dark"] .btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

/* 6. Visualizar / Info (Soft Info) */
.btn-info {
  background: var(--primary-light, rgba(2, 132, 199, 0.1));
  color: var(--primary);
  border-color: rgba(2, 132, 199, 0.25);
}
.btn-info:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.25);
}

/* 7. Especial IA (Gradient Shimmer) */
.btn-ai-magic {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.btn-ai-magic:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}

/* ====== FORMS ====== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}

.form-control,
input.form-control,
select.form-control,
textarea.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.25s, color 0.25s;
  outline: none;
}

.form-control:focus,
input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control:disabled,
.form-control[readonly],
input:disabled,
input[readonly],
select:disabled,
textarea:disabled {
  background-color: var(--bg-subtle) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
  cursor: not-allowed;
  opacity: 0.8;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

/* ==============================================================================
   OVERRIDE UNIVERSAL DE AUTOFILL E CREDENCIAIS SALVAS (CHROME / WEBKIT / GECKO)
   Impede que navegadores forcem caixas brancas/amarelas em campos com
   preenchimento automático ou credenciais salvas no Modo Escuro e Claro.
   ============================================================================== */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
  border-color: var(--border) !important;
  caret-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
}

input:-webkit-autofill:focus,
textarea:-webkit-autofill:focus,
select:-webkit-autofill:focus {
  border-color: var(--primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset, 0 0 0 3px var(--primary-light) !important;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset, 0 0 0 3px var(--primary-light) !important;
}

input:autofill,
input:-moz-autofill {
  filter: none;
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
}

[data-mode="dark"] .form-control,
[data-mode="dark"] input.form-control,
[data-mode="dark"] select.form-control,
[data-mode="dark"] textarea.form-control,
[data-mode="dark"] .password-input-wrapper input {
  color: var(--text-primary) !important;
  background-color: var(--bg-surface) !important;
  border-color: var(--border) !important;
}

[data-mode="dark"] input:-webkit-autofill,
[data-mode="dark"] input:-webkit-autofill:hover,
[data-mode="dark"] input:-webkit-autofill:focus,
[data-mode="dark"] input:-webkit-autofill:active,
[data-mode="dark"] textarea:-webkit-autofill,
[data-mode="dark"] textarea:-webkit-autofill:hover,
[data-mode="dark"] textarea:-webkit-autofill:focus,
[data-mode="dark"] textarea:-webkit-autofill:active,
[data-mode="dark"] select:-webkit-autofill,
[data-mode="dark"] select:-webkit-autofill:hover,
[data-mode="dark"] select:-webkit-autofill:focus,
[data-mode="dark"] select:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
  border-color: var(--border) !important;
  caret-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
}

[data-mode="dark"] input:-webkit-autofill:focus,
[data-mode="dark"] textarea:-webkit-autofill:focus,
[data-mode="dark"] select:-webkit-autofill:focus {
  border-color: var(--primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset, 0 0 0 3px var(--primary-light) !important;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset, 0 0 0 3px var(--primary-light) !important;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  appearance: auto;
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

/* ====== ALERTS ====== */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

/* ====== DASHBOARD GRID ====== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 8px;
}

.dashboard-grid .card-full {
  grid-column: 1 / -1;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 20px;
}

/* ====== PRESENCAS ====== */
.presenca-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.presenca-row:hover { background: var(--light); }

.toggle-presenca {
  display: flex;
  gap: 8px;
}

.btn-presente {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  transition: all 0.15s;
}

.btn-presente.presente {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-presente.ausente {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-presente.inativo {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border);
}

/* ====== PROGRESS BAR ====== */
.progress-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}

.fill-success { background: var(--success); }
.fill-warning { background: var(--warning); }
.fill-danger  { background: var(--danger); }

/* ====== DETAIL SECTIONS ====== */
.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  margin-bottom: 8px;
}

.detail-section p {
  font-size: 14px;
  color: var(--dark);
  line-height: 1.6;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.detail-item {
  background: var(--light);
  border-radius: 10px;
  padding: 14px;
}

.detail-item .di-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  margin-bottom: 4px;
}

.detail-item .di-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

/* ====== NOTA INPUT ====== */
.nota-input {
  width: 80px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.2s;
}

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

/* ====== RESPONSIVE & MOBILE PWA ====== */
.mobile-bottom-nav {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .sidebar,
  .sidebar.pinned,
  html.sidebar-pinned .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    width: min(300px, 85vw) !important;
    transform: translateX(-100%) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 0 !important;
  }
  .sidebar.open,
  .sidebar.pinned.open,
  html.sidebar-pinned .sidebar.open {
    transform: translateX(0) !important;
  }
  .sidebar-close-btn {
    display: flex !important;
  }
  .sidebar-pin-btn {
    display: none !important;
  }
  /* No mobile, restaurar visibilidade normal de textos e sub-listas */
  .sidebar .sidebar-logo {
    padding: 0 16px !important;
    justify-content: space-between !important;
  }
  .sidebar .logo-text,
  .sidebar .sb-header-title,
  .sidebar .sidebar-user-details,
  .sidebar .sidebar-user-logout {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .sidebar .sb-sub-list {
    display: none !important;
  }
  .sidebar .sb-session-group.open .sb-sub-list {
    display: flex !important;
  }
  .sidebar .sb-session-header {
    justify-content: flex-start !important;
    padding: 8px 10px !important;
  }
  .sidebar .sidebar-user-card {
    padding: 10px 12px !important;
    margin: 10px 8px !important;
    justify-content: space-between !important;
  }
  .sidebar-nav {
    padding-bottom: max(80px, env(safe-area-inset-bottom, 40px)) !important;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
  .main-content,
  html.sidebar-pinned .main-content {
    margin-left: 0 !important;
    min-height: 100vh;
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-x: clip;
  }
  .page-body {
    padding: 12px 12px 84px 12px; /* Espaço para a barra inferior */
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-x: clip;
  }
  .topbar {
    padding: 0 12px;
    height: auto;
    min-height: 54px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .topbar-date {
    display: none !important;
  }
  .topbar-left {
    width: 100%;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
  }
  .page-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 75px);
  }
  .page-subtitle {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 75px);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }
  .stats-grid > a {
    min-width: 0;
    display: block;
  }
  .stat-card {
    padding: 12px 10px !important;
    gap: 10px !important;
    border-radius: 12px !important;
    min-width: 0 !important;
  }
  .stat-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
  }
  .stat-info {
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .stat-info .stat-value {
    font-size: 20px !important;
    line-height: 1.1 !important;
  }
  .stat-info .stat-label {
    font-size: 11px !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
  .card {
    border-radius: 12px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-header h3 {
    font-size: 15px;
    flex-wrap: wrap;
    word-break: break-word;
  }
  .card-body {
    padding: 14px 12px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .card-footer {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .d-flex.justify-between {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .form-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .form-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 10px !important;
  }
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    margin: 0 !important;
  }
  .table-responsive table {
    width: 100%;
    min-width: max-content;
  }
  th {
    padding: 10px 10px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
  }
  td {
    padding: 10px 10px !important;
    font-size: 13px !important;
  }
  td strong {
    white-space: nowrap !important;
    display: inline-block;
  }
  .badge {
    white-space: nowrap !important;
    word-break: keep-all !important;
    display: inline-flex !important;
    align-items: center;
    padding: 4px 8px !important;
    font-size: 11.5px !important;
    flex-shrink: 0;
  }
  td .btn-sm {
    padding: 5px 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  td .d-flex {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .banner-qr-code {
    display: none !important;
  }
  .presenca-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }
  .toggle-presenca {
    flex-wrap: wrap;
  }
  .btn-presente {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Barra de Navegação Inferior estilo App Nativo */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-surface);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 990;
    align-items: center;
    justify-content: space-around;
    padding: 4px 8px env(safe-area-inset-bottom, 6px);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-decoration: none;
    color: var(--gray);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item .m-icon {
    font-size: 19px;
    line-height: 1;
    margin-bottom: 3px;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item .m-label {
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-nav-item.active {
    color: var(--primary);
  }

  .mobile-nav-item.active .m-icon {
    transform: scale(1.15);
  }

  /* Botão em Destaque Central para o Criador de IA */
  .mobile-nav-item.m-highlight {
    position: relative;
    top: -12px;
  }

  .mobile-nav-item.m-highlight .m-highlight-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary, #0284c7), var(--secondary, #0ea5e9));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
    margin-bottom: 2px;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item.m-highlight:active .m-highlight-icon {
    transform: scale(0.92);
  }

  .mobile-nav-item.m-highlight .m-label {
    color: var(--primary);
    font-weight: 700;
  }

  /* ====== TIMELINE RESPONSIVA EM MOBILE / TABLET ====== */
  #grade-horaria .card-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
    padding: 14px 16px !important;
  }

  #grade-horaria .card-header > div:last-child {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .grade-view-mode-toggle {
    width: 100%;
    display: flex;
  }

  .view-mode-btn {
    flex: 1;
    justify-content: center;
    padding: 7px 4px;
    font-size: 12px;
  }

  #grade-horaria .card-header .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 700;
  }

  #grade-horaria .card-body {
    padding: 8px 6px !important;
  }

  .grade-container {
    border-radius: 10px;
    margin: 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .grade-timeline-wrapper.mode-dia {
    min-width: 0 !important;
    width: 100%;
  }

  .grade-header-time,
  .grade-time-col {
    width: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
  }

  .grade-time-marker {
    padding-top: 4px;
  }

  .grade-time-label-main {
    font-size: 11px !important;
    font-weight: 700;
  }

  .grade-time-label-sub {
    font-size: 8.5px !important;
  }

  .grade-card-item {
    border-radius: 7px;
  }

  .grade-card-item-turma {
    font-size: 12px !important;
  }

  .grade-card-item-disc {
    font-size: 10.5px !important;
  }

  .grade-card-act-btn {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
  }

  /* Coluna de horário fixa à esquerda durante scroll horizontal no modo semana */
  .grade-timeline-wrapper.mode-semana .grade-header-time,
  .grade-timeline-wrapper.mode-semana .grade-time-col {
    position: sticky;
    left: 0;
    z-index: 25;
    background: var(--bg-subtle);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
  }

  .grade-timeline-wrapper.mode-semana {
    min-width: 1220px;
  }

  .grade-timeline-wrapper.mode-semana .grade-day-col,
  .grade-timeline-wrapper.mode-semana .grade-header-col {
    min-width: 165px;
  }

  .grade-timeline-wrapper.mode-semana .grade-card-act-btn {
    width: 20px !important;
    height: 20px !important;
    font-size: 11px !important;
    border-radius: 5px !important;
  }

  .grade-timeline-wrapper.mode-semana .grade-card-item-turma {
    font-size: 11.5px !important;
  }
}

@media (min-width: 769px) {
  /* Em telas grandes (desktop), o seletor de dias fica oculto se estiver no modo semana */
  .grade-timeline-wrapper.mode-semana .grade-mobile-day-picker {
    display: none !important;
  }
}

/* ====== UTILITY ====== */
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.w-100 { width: 100%; }

/* ====== PRIORITY BADGES ====== */
.priority-urgente { background: #fee2e2; color: #991b1b; }
.priority-alta    { background: #ffedd5; color: #c2410c; }
.priority-normal  { background: #dbeafe; color: #1e40af; }
.priority-baixa   { background: #f1f5f9; color: var(--gray); }

/* ====== TIPO OCORRENCIA ====== */
.tipo-disciplinar   { background: #fee2e2; color: #991b1b; }
.tipo-academico     { background: #fef3c7; color: #92400e; }
.tipo-comportamento { background: #ffedd5; color: #c2410c; }
.tipo-elogio        { background: #d1fae5; color: #065f46; }
.tipo-outros        { background: #f1f5f9; color: var(--gray); }

/* ====== MEDIA RESPONSIVE TABLE ====== */
@media (max-width: 600px) {
  .hide-mobile { display: none !important; }
}

/* ====== GRADE HORÁRIA SEMANAL (CALENDÁRIO) ====== */
.grade-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.grade-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed; /* Garante que colunas nunca expandam horizontalmente */
  border-collapse: separate;
  border-spacing: 0;
}

.grade-table th {
  background: #f8fafc;
  color: var(--dark);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 12px 8px;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: hidden;
}

.grade-table th:last-child {
  border-right: none;
}

.grade-table th.grade-col-hora {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  background: #f1f5f9;
  color: var(--gray);
  font-size: 12px;
}

.grade-table th.grade-th-hoje {
  background: #eef2ff;
  color: #3730a3;
  border-top: 3px solid var(--primary);
}

.grade-hoje-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ====== SELETOR DE DIAS E CONTROLES RESPONSIVOS (MOBILE/TABLET) ====== */
.grade-view-mode-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-mode-btn:hover {
  color: var(--dark);
}

.view-mode-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Barra Seletora de Dias (Tabs) no Topo da Grade */
.grade-mobile-day-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #f8fafc;
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--border);
  user-select: none;
}

.grade-mobile-days-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 4px;
  flex: 1;
  justify-content: flex-start;
  scroll-behavior: smooth;
}

.grade-mobile-days-scroll::-webkit-scrollbar {
  display: none;
}

.mobile-day-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: white;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.mobile-day-tab:hover {
  background: #f1f5f9;
  color: var(--dark);
}

.mobile-day-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  font-weight: 700;
}

.mobile-day-tab.is-today:not(.active) {
  border-color: var(--border, #bae6fd);
  background: var(--bg-subtle, #f0f9ff);
  color: var(--primary-dark, #0369a1);
}

.day-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  background: var(--primary-light, #e0f2fe);
  color: var(--primary-dark, #0369a1);
  line-height: 1;
}

.mobile-day-tab.active .day-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.btn-day-nav {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--dark);
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-day-nav:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ====== GRADE HORÁRIA TIMELINE CONTÍNUA ====== */
.grade-timeline-wrapper {
  width: 100%;
  min-width: 0;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: min-width 0.2s ease;
  box-sizing: border-box;
}

/* Modo Dia (Exibe apenas o dia selecionado em tela inteira sem rolagem horizontal) */
.grade-timeline-wrapper.mode-dia {
  min-width: 0 !important;
  width: 100% !important;
}

.grade-timeline-wrapper.mode-dia .grade-header-col {
  display: none !important;
}

.grade-timeline-wrapper.mode-dia .grade-header-col.day-selected {
  display: flex !important;
  flex: 1;
  text-align: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  background: #f8fafc;
}

.grade-timeline-wrapper.mode-dia .grade-day-col {
  display: none !important;
}

.grade-timeline-wrapper.mode-dia .grade-day-col.day-selected {
  display: block !important;
  flex: 1;
}

.grade-timeline-wrapper.mode-dia .grade-card-item {
  left: 6px !important;
  width: calc(100% - 12px) !important;
  padding: 4px 8px !important;
}

/* Modo Semana */
.grade-timeline-wrapper.mode-semana {
  min-width: 800px;
}

@media (min-width: 769px) {
  .grade-timeline-wrapper.mode-semana {
    min-width: 760px;
  }
}

/* Cabeçalho dos Dias da Semana */
.grade-timeline-header {
  display: flex;
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.grade-header-time {
  width: 76px;
  min-width: 76px;
  flex-shrink: 0;
  padding: 12px 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  border-right: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.grade-header-days {
  display: flex;
  flex: 1;
}

.grade-header-col {
  flex: 1;
  min-width: 105px;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  text-align: center;
  border-right: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.grade-header-col:last-child {
  border-right: none;
}

.grade-header-col.is-today {
  background: #eef2ff;
  color: #3730a3;
  border-top: 3px solid var(--primary);
}

/* Corpo do Timeline (Régua de Tempo + Colunas dos Dias) */
.grade-timeline-body {
  display: flex;
  position: relative;
  background: white;
}

/* Coluna Lateral da Régua de Tempo */
.grade-time-col {
  width: 76px;
  min-width: 76px;
  flex-shrink: 0;
  border-right: 1.5px solid var(--border);
  background: #f8fafc;
  position: relative;
}

.grade-time-marker {
  height: 72px;
  border-bottom: 1px solid #edf2f7;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 5px;
  text-align: center;
}

.grade-time-label-main {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.grade-time-label-sub {
  font-size: 10px;
  color: #94a3b8;
  display: block;
}

/* Container das Colunas dos Dias */
.grade-days-wrapper {
  display: flex;
  flex: 1;
  position: relative;
}

/* Coluna de Cada Dia */
.grade-day-col {
  flex: 1;
  min-width: 105px;
  border-right: 1px solid #edf2f7;
  position: relative;
  background: white;
}

.grade-day-col:last-child {
  border-right: none;
}

.grade-day-col.is-today {
  background: #fafbff;
}

/* Slots de Fundo por Hora (1 hora = 72px) */
.grade-hour-slots-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.grade-hour-slot {
  height: 72px;
  border-bottom: 1px solid #edf2f7;
  box-sizing: border-box;
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.grade-hour-slot:hover {
  background-color: rgba(238, 242, 255, 0.45);
}

/* Slots ocupados por aulas agendadas: inativos e sem prévia de hover */
.grade-hour-slot.slot-ocupado {
  cursor: default !important;
  pointer-events: none !important;
}

.grade-hour-slot.slot-ocupado:hover {
  background-color: transparent !important;
}

.grade-hour-slot.slot-ocupado .slot-preview {
  display: none !important;
}

/* Prévia ao passar o mouse em um slot vazio - Tamanho Padrão */
.grade-hour-slot .slot-preview {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  height: 60px; /* Tamanho padrão de 50 min */
  max-height: 60px;
  border-radius: 8px;
  border: 1.5px dashed #93c5fd;
  border-left: 4px dashed var(--primary);
  background: #f8faff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}

.grade-hour-slot:hover .slot-preview {
  display: flex;
}

.slot-preview-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.slot-preview-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: #475569;
  background: #e0e7ff;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.3;
}

/* Camada Flutuante de Eventos / Cards Contínuos */
.grade-events-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* Card Contínuo no Timeline (Top e Height proporcionais ao tempo) */
.grade-card-item {
  position: absolute;
  pointer-events: auto;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--border);
  border-left: 4.5px solid var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  padding: 4px 6px;
  box-sizing: border-box;
  overflow: hidden; /* Mantém cada aula rigorosamente contida no seu horário exato sem invadir a próxima */
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.grade-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  text-align: center;
}

.grade-card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  z-index: 50;
  border-color: #94a3b8;
}

.grade-card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3px;
  width: 100%;
  margin-bottom: 1px;
}

.grade-card-title-link {
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
  display: block;
}

.grade-card-body-link {
  text-decoration: none;
  color: inherit;
  display: block;
  flex: 1;
  min-width: 0;
}

.grade-card-item-turma {
  font-size: 11px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grade-card-item-turma:hover {
  color: var(--primary);
}

.grade-card-item-disc {
  font-size: 10px;
  color: #475569;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.grade-card-item-obs {
  font-size: 9.5px;
  color: #64748b;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-bottom: 2px;
  max-width: 100%;
}

.grade-card-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  margin-top: auto;
  max-width: 100%;
  overflow: hidden;
}

.grade-time-badge, .grade-sala-badge {
  font-size: 9px;
  background: #f1f5f9;
  color: var(--gray);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}

.grade-sala-badge {
  background: #e0f2fe;
  color: #0369a1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ações no Card: Editar e Excluir */
.grade-card-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  z-index: 15;
}

/* ====== VISÃO LISTA DO DIA (AGENDA COMPACTA - ZERO CORTE) ====== */
.grade-list-container {
  width: 100%;
  padding: 6px 4px;
  background: white;
  box-sizing: border-box;
}

.grade-list-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-list-card {
  display: flex;
  align-items: stretch;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  border-radius: 12px;
  padding: 12px 14px;
  gap: 12px;
  transition: all 0.18s ease;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.grade-list-card:hover {
  background: white;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.grade-list-card-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding-right: 12px;
  border-right: 1.5px solid #edf2f7;
  text-align: center;
  flex-shrink: 0;
}

.grade-list-card-time .time-start {
  font-size: 14.5px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.2;
}

.grade-list-card-time .time-sep {
  font-size: 9.5px;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1;
  margin: 1px 0;
}

.grade-list-card-time .time-end {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  line-height: 1.2;
}

.grade-list-card-time .time-duration {
  font-size: 10px;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
  margin-top: 5px;
}

.grade-list-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.grade-list-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
  line-height: 1.3;
  margin-bottom: 2px;
  display: block;
  word-break: break-word;
  overflow-wrap: break-word;
}

.grade-list-card-title:hover {
  color: var(--primary);
}

.grade-list-card-disc {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 4px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.grade-list-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.grade-list-card-obs {
  font-size: 11.5px;
  color: #92400e;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 5px;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.grade-list-card-obs .obs-icon {
  flex-shrink: 0;
}

.grade-list-card-obs .obs-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.grade-list-card-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.grade-list-card-actions .grade-card-act-btn {
  width: 32px;
  height: 32px;
  font-size: 14px;
  border-radius: 8px;
}

.grade-list-add-slot {
  margin-top: 10px;
  padding: 12px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grade-list-add-slot:hover {
  background: #eef2ff;
  border-color: var(--primary);
}

/* Barra inferior para expandir / recolher horários */
.grade-expand-hours-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: #64748b;
  text-align: center;
}

.grade-expand-hours-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.grade-expand-hours-link:hover {
  background: #e0e7ff;
}

.grade-card-act-btn {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: #64748b;
  font-size: 11px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

.grade-card-act-btn.edit-btn:hover {
  background: var(--primary-light, #e0f2fe);
  color: var(--primary-dark, #0369a1);
  border-color: var(--primary, #0284c7);
}

.grade-card-act-btn.del-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

.grade-card-del-form {
  margin: 0;
  padding: 0;
  display: inline;
}

/* ====== CUSTOM MODAL ====== */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1051;
}

.custom-modal-dialog {
  position: relative;
  z-index: 1052;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Seletor de Cores no Modal */
.cor-picker-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.cor-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  transition: all 0.15s ease;
}

.cor-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.cor-option input {
  display: none;
}

.cor-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

/* ====== MODAL DE CONFIRMAÇÃO DE EXCLUSÃO PERMANENTE ====== */
.confirm-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.confirm-modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.confirm-modal-dialog {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: scale(0.94);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.confirm-modal-backdrop.active .confirm-modal-dialog {
  transform: scale(1);
}

.confirm-modal-header {
  padding: 18px 20px;
  background: #fff5f5;
  border-bottom: 1px solid #fee2e2;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.confirm-modal-icon {
  width: 42px;
  height: 42px;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.confirm-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #991b1b;
  margin: 0;
  line-height: 1.2;
}

.confirm-modal-subtitle {
  font-size: 12px;
  color: #b91c1c;
  margin: 3px 0 0 0;
}

.confirm-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: #991b1b;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 1;
}
.confirm-modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
}

.confirm-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}

.confirm-warning-box {
  background: #f8fafc;
  border-left: 4px solid #ef4444;
  padding: 12px 14px;
  border-radius: 4px 8px 8px 4px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #334155;
}

.confirm-details-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #7f1d1d;
  line-height: 1.45;
}

.confirm-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  user-select: none;
  transition: background 0.2s;
}
.confirm-checkbox-label:hover {
  background: #e2e8f0;
}
.confirm-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  cursor: pointer;
  accent-color: #ef4444;
  flex-shrink: 0;
}

.confirm-modal-footer {
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.confirm-modal-footer .btn {
  padding: 9px 18px;
  font-size: 13.5px;
}
.confirm-modal-footer #modal-btn-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(40%);
}

/* ==============================================================================
   BOTÃO DE DARK MODE NA BARRA SUPERIOR (TOPBAR)
   ============================================================================== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1;
}
.theme-toggle-btn:hover {
  background: var(--border);
  transform: translateY(-1px);
}
.theme-toggle-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

/* Visibilidade alternada dos ícones de Sol e Lua */
[data-mode="dark"] .theme-icon-moon {
  display: none;
}
[data-mode="dark"] .theme-icon-sun {
  display: inline;
}
:root:not([data-mode="dark"]) .theme-icon-sun,
[data-mode="light"] .theme-icon-sun {
  display: none;
}
:root:not([data-mode="dark"]) .theme-icon-moon,
[data-mode="light"] .theme-icon-moon {
  display: inline;
}

@media (max-width: 768px) {
  .theme-toggle-btn .theme-toggle-label {
    display: none;
  }
  .theme-toggle-btn {
    padding: 6px 9px;
  }
}

/* ==============================================================================
   SELETOR DE TEMAS EDUCACIONAIS (CONFIGURAÇÕES)
   ============================================================================== */
.themes-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 14px;
}

.theme-choice-card {
  position: relative;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
}
.theme-choice-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.theme-choice-card.active {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

.theme-choice-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}
.badge-recomendado { background: #e0f2fe; color: #0369a1; }
.badge-botanico { background: #d1fae5; color: #065f46; }
.badge-tech { background: #ede9fe; color: #5b21b6; }

[data-mode="dark"] .badge-recomendado { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
[data-mode="dark"] .badge-botanico { background: rgba(92, 141, 110, 0.2); color: #7fae90; }
[data-mode="dark"] .badge-tech { background: rgba(99, 102, 241, 0.2); color: #c7d2fe; }

.theme-choice-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.theme-choice-icon {
  font-size: 24px;
  line-height: 1;
}
.theme-choice-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.theme-choice-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.theme-mini-preview {
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preview-classico { background: #f0f9ff; }
.preview-classico .mini-bar { height: 8px; width: 45%; background: #0284c7; border-radius: 4px; }
.preview-classico .mini-line { height: 5px; background: #bae6fd; border-radius: 3px; }

.preview-salvia { background: #f4f7f4; }
.preview-salvia .mini-bar { height: 8px; width: 45%; background: #2d6a4f; border-radius: 4px; }
.preview-salvia .mini-line { height: 5px; background: #dde6de; border-radius: 3px; }

.preview-campus { background: #f1f5f9; }
.preview-campus .mini-bar { height: 8px; width: 45%; background: #4338ca; border-radius: 4px; }
.preview-campus .mini-line { height: 5px; background: #cbd5e1; border-radius: 3px; }

[data-mode="dark"] .preview-classico { background: #121316; }
[data-mode="dark"] .preview-classico .mini-line { background: #2d2e36; }
[data-mode="dark"] .preview-salvia { background: #111311; }
[data-mode="dark"] .preview-salvia .mini-line { background: #2b332d; }
[data-mode="dark"] .preview-campus { background: #0f172a; }
[data-mode="dark"] .preview-campus .mini-line { background: #334155; }

.mini-content { display: flex; flex-direction: column; gap: 4px; }
.mini-line.w-60 { width: 60%; }
.mini-line.w-40 { width: 40%; }

.theme-choice-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 16px 0;
  flex: 1;
}
.theme-color-palette {
  display: flex;
  gap: 7px;
  align-items: center;
}
.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Modo Escuro Box */
.modo-escuro-box {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 24px;
  transition: background-color 0.25s, border-color 0.25s;
}

/* Switch Toggle Component */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .3s;
  border-radius: 26px;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch-toggle input:checked + .switch-slider {
  background-color: var(--primary);
}
.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* Barra de utilidades do cabeçalho escolar (visível apenas dentro do Word Studio) */
.cabecalho-tools-bar {
  display: none !important;
}

/* ==============================================================================
   DARK MODE ADJUSTMENTS PARA COMPONENTES DO SISTEMA
   ============================================================================== */
[data-mode="dark"] .confirm-modal-dialog {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
[data-mode="dark"] .confirm-warning-box {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .confirm-details-box {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
[data-mode="dark"] .confirm-checkbox-label {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .confirm-checkbox-label:hover {
  background: var(--border);
}
[data-mode="dark"] .settings-tabs {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .settings-tab-btn {
  color: var(--text-secondary);
}
[data-mode="dark"] .settings-tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .settings-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
}
[data-mode="dark"] .settings-section-card {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .settings-card-header {
  background: var(--bg-subtle);
  border-bottom-color: var(--border);
}
[data-mode="dark"] .settings-card-header h3 {
  color: var(--text-primary);
}
[data-mode="dark"] .settings-card-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}

/* ====== CARDS DE SELEÇÃO PEDAGÓGICA (GERADOR COM IA) ====== */
.tipo-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  cursor: pointer;
  text-align: center;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.tipo-card:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
  transform: translateY(-2px);
}

.tipo-card.active {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
  box-shadow: 0 0 0 2px var(--primary-light, rgba(2, 132, 199, 0.25));
}

.dif-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

.dif-card:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.dif-card.active {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
}

/* ==============================================================================
   DARK MODE COMPLETO PARA COMPONENTES DO SISTEMA
   ============================================================================== */
[data-mode="dark"] .confirm-modal-dialog,
[data-mode="dark"] .custom-modal-dialog {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
[data-mode="dark"] .confirm-warning-box {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .confirm-details-box {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
[data-mode="dark"] .confirm-checkbox-label {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .confirm-checkbox-label:hover {
  background: var(--border);
}
[data-mode="dark"] .confirm-modal-header {
  background: rgba(239, 68, 68, 0.15);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
}
[data-mode="dark"] .confirm-modal-title {
  color: #fca5a5;
}
[data-mode="dark"] .confirm-modal-subtitle {
  color: #f87171;
}
[data-mode="dark"] .confirm-modal-close {
  color: #fca5a5;
}
[data-mode="dark"] .confirm-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
}

[data-mode="dark"] .settings-tabs {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .settings-tab-btn {
  color: var(--text-secondary);
}
[data-mode="dark"] .settings-tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .settings-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
}
[data-mode="dark"] .settings-section-card {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .settings-card-header {
  background: var(--bg-subtle);
  border-bottom-color: var(--border);
}
[data-mode="dark"] .settings-card-header h3 {
  color: var(--text-primary);
}
[data-mode="dark"] .settings-card-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}

/* Dark Mode para Cards do Gerador Pedagógico */
[data-mode="dark"] .tipo-card {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
[data-mode="dark"] .tipo-card:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
}
[data-mode="dark"] .tipo-card.active {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
}
[data-mode="dark"] .dif-card {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
[data-mode="dark"] .dif-card:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
}
[data-mode="dark"] .dif-card.active {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
}

/* Dark Mode para Seletor de Cores no Modal */
[data-mode="dark"] .cor-option {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
}
[data-mode="dark"] .cor-option:hover {
  background: var(--bg-subtle);
}
[data-mode="dark"] .cor-option:has(input:checked) {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* Dark Mode para Grade Horária Semanal Completa */
[data-mode="dark"] .grade-container {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .grade-timeline-wrapper {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .grade-timeline-header {
  background: var(--bg-subtle);
  border-bottom-color: var(--border);
}
[data-mode="dark"] .grade-header-time {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-header-col {
  color: var(--text-primary);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-header-col.is-today {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-top-color: var(--primary);
}
[data-mode="dark"] .grade-timeline-wrapper.mode-dia .grade-header-col.day-selected {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .grade-timeline-body {
  background: var(--bg-surface);
}
[data-mode="dark"] .grade-time-col {
  background: var(--bg-subtle);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-timeline-wrapper.mode-semana .grade-header-time,
[data-mode="dark"] .grade-timeline-wrapper.mode-semana .grade-time-col {
  background: var(--bg-subtle);
}
[data-mode="dark"] .grade-time-marker {
  border-bottom-color: var(--border);
}
[data-mode="dark"] .grade-time-label-main {
  color: var(--text-primary);
}
[data-mode="dark"] .grade-time-label-sub {
  color: var(--text-muted);
}
[data-mode="dark"] .grade-day-col {
  background: var(--bg-surface);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-day-col.is-today {
  background: rgba(59, 130, 246, 0.05);
}
[data-mode="dark"] .grade-hour-slot {
  border-bottom-color: var(--border);
}
[data-mode="dark"] .grade-hour-slot:hover {
  background-color: var(--table-hover);
}
[data-mode="dark"] .grade-hour-slot .slot-preview {
  background: var(--bg-subtle);
  border-color: var(--primary);
}
[data-mode="dark"] .slot-preview-title {
  color: var(--primary);
}
[data-mode="dark"] .slot-preview-badge {
  background: var(--bg-surface);
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-card-item {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
[data-mode="dark"] .grade-card-item:hover {
  border-color: var(--primary);
}
[data-mode="dark"] .grade-card-item-turma {
  color: var(--text-primary);
}
[data-mode="dark"] .grade-card-item-disc {
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-card-item-obs {
  color: var(--text-muted);
}
[data-mode="dark"] .grade-time-badge {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-sala-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}
[data-mode="dark"] .grade-card-act-btn {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-card-act-btn.edit-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: var(--primary);
}
[data-mode="dark"] .grade-card-act-btn.del-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: var(--danger);
}
[data-mode="dark"] .grade-list-container {
  background: var(--bg-surface);
}
[data-mode="dark"] .grade-list-card {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-primary);
}
[data-mode="dark"] .grade-list-card:hover {
  background: var(--table-hover);
  border-color: var(--border);
}
[data-mode="dark"] .grade-list-card-time {
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-list-card-time .time-start {
  color: var(--text-primary);
}
[data-mode="dark"] .grade-list-card-time .time-sep {
  color: var(--text-muted);
}
[data-mode="dark"] .grade-list-card-time .time-end {
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-list-card-time .time-duration {
  background: var(--primary-light, rgba(2, 132, 199, 0.2));
  color: var(--secondary, #38bdf8);
}
[data-mode="dark"] .grade-list-card-title {
  color: var(--text-primary);
}
[data-mode="dark"] .grade-list-card-disc {
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-list-card-obs {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-left-color: var(--warning);
}
[data-mode="dark"] .grade-list-add-slot {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--primary);
}
[data-mode="dark"] .grade-list-add-slot:hover {
  background: var(--table-hover);
}
[data-mode="dark"] .grade-expand-hours-bar {
  background: var(--bg-subtle);
  border-top-color: var(--border);
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-expand-hours-link:hover {
  background: rgba(59, 130, 246, 0.2);
}
[data-mode="dark"] .grade-scroll-hint {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
[data-mode="dark"] .btn-day-nav {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
[data-mode="dark"] .btn-day-nav:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
}
[data-mode="dark"] .mobile-day-tab.is-today:not(.active) {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}
[data-mode="dark"] .day-tab-badge {
  background: var(--primary-light, rgba(2, 132, 199, 0.25));
  color: var(--secondary, #38bdf8);
}
[data-mode="dark"] .grade-table th {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-bottom-color: var(--border);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-table th.grade-col-hora {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
[data-mode="dark"] .grade-table th.grade-th-hoje {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
[data-mode="dark"] .grade-hora-cell {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-bottom-color: var(--border);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-slot {
  background: var(--bg-surface);
  border-bottom-color: var(--border);
  border-right-color: var(--border);
}
[data-mode="dark"] .grade-slot:hover {
  background: var(--table-hover);
}
[data-mode="dark"] .grade-view-mode-toggle {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .view-mode-btn {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
[data-mode="dark"] .view-mode-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
[data-mode="dark"] .view-mode-btn.active {
  background: var(--primary);
  color: #ffffff;
}
[data-mode="dark"] .grade-mobile-day-picker {
  background: var(--bg-surface);
  border-color: var(--border);
}
[data-mode="dark"] .mobile-day-tab {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}
[data-mode="dark"] .mobile-day-tab.active {
  background: var(--primary);
  color: #ffffff;
}
[data-mode="dark"] .mobile-bottom-nav {
  background: var(--bg-surface);
  border-top-color: var(--border);
}

/* ====== COMPONENTES E CAIXAS DE CONFIGURAÇÕES ====== */
code {
  font-family: monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--primary);
  border: 1px solid var(--border);
}

.settings-info-box {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--text-primary);
  box-sizing: border-box;
}

.settings-info-card {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text-primary);
}

.settings-tip-box {
  margin-top: 24px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border-radius: 10px;
  border: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.settings-guide-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  box-sizing: border-box;
}

.settings-alert-box-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #d97706;
  line-height: 1.45;
}

[data-mode="dark"] .settings-alert-box-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

/* Alertas no Modo Escuro */
[data-mode="dark"] .alert-success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}
[data-mode="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
[data-mode="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
}
[data-mode="dark"] .alert-info {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

/* Badges no Modo Escuro */
[data-mode="dark"] .badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}
[data-mode="dark"] .badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
[data-mode="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
[data-mode="dark"] .badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
[data-mode="dark"] .badge-gray {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
[data-mode="dark"] .badge-primary {
  background: var(--primary-light, rgba(99, 102, 241, 0.2));
  color: var(--primary, #a5b4fc);
}
[data-theme="salvia"][data-mode="dark"] .badge-primary {
  background: rgba(16, 185, 129, 0.2);
  color: #86efac;
}
[data-theme="classico"][data-mode="dark"] .badge-primary {
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
}

/* Badges Soft Globais (Design System EdTech) */
.badge-soft-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
[data-mode="dark"] .badge-soft-emerald {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.badge-soft-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
[data-mode="dark"] .badge-soft-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.badge-soft-slate {
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.25);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
[data-mode="dark"] .badge-soft-slate {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.3);
}

.badge-soft-indigo {
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
  border: 1px solid rgba(79, 70, 229, 0.3);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
[data-mode="dark"] .badge-soft-indigo {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
}

/* ==============================================================================
   CENTRAL DE NOTIFICAÇÕES (HEADER / TOPBAR)
   ============================================================================== */
@keyframes pulseGlow {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.75);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.topbar-notif-container {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-notif-btn {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--text-primary);
  transition: all 0.2s ease;
  outline: none;
  padding: 0;
}

.topbar-notif-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.notif-bell-icon {
  font-size: 16px;
  line-height: 1;
}

.notif-radar-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
}

.notif-radar-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.6);
  animation: pulseGlow 1.8s infinite ease-in-out;
  pointer-events: none;
}

.notif-radar-count {
  position: relative;
  z-index: 2;
  line-height: 1;
}

.notif-standard-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Popover Flutuante */
.topbar-notif-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md), 0 16px 36px rgba(0, 0, 0, 0.28);
  z-index: 1050;
  overflow: hidden;
  animation: popoverSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.notif-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.notif-popover-body {
  padding: 10px 12px;
  max-height: 380px;
  overflow-y: auto;
}

.notif-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-item-card {
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  transition: transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.notif-item-card.urgente-hoje,
.notif-item-card.urgente-atrasado {
  border-left: 3.5px solid #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.notif-item-card.urgente-amanha {
  border-left: 3.5px solid #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.notif-item-card.urgente-semana {
  border-left: 3.5px solid #3b82f6;
  background: rgba(59, 130, 246, 0.06);
}

.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notif-tag-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.notif-tag-badge.urgente-hoje,
.notif-tag-badge.urgente-atrasado {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.notif-tag-badge.urgente-amanha {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.notif-tag-badge.urgente-semana {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.notif-date-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.notif-item-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.btn-notif-action-check {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-notif-action-check:hover {
  background: #16a34a;
  color: #ffffff;
}

.btn-notif-action-view {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.btn-notif-action-view:hover {
  text-decoration: underline;
}

/* Card Modelo C: Concierge Sofia */
.notif-card-sofia {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.06) 100%);
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  border-left: 4px solid #6366f1;
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

[data-theme="dark"] .notif-card-sofia,
[data-mode="dark"] .notif-card-sofia {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16) 0%, rgba(168, 85, 247, 0.12) 100%);
  border-color: rgba(99, 102, 241, 0.45);
}

.notif-sofia-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-sofia-avatar {
  position: relative;
  width: 28px;
  height: 28px;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

[data-theme="dark"] .notif-sofia-avatar,
[data-mode="dark"] .notif-sofia-avatar {
  background: #312e81;
  border-color: #4f46e5;
}

.sofia-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 7px;
  height: 7px;
  background: #10b981;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
}

[data-theme="dark"] .sofia-online-dot,
[data-mode="dark"] .sofia-online-dot {
  border-color: #1e1b4b;
}

.notif-sofia-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.notif-sofia-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #4f46e5;
  display: flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .notif-sofia-name,
[data-mode="dark"] .notif-sofia-name {
  color: #a5b4fc;
}

.notif-sofia-tag {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.notif-sofia-message {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
}

.notif-sofia-message strong {
  color: var(--text-primary);
  font-weight: 700;
}

.notif-sofia-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed rgba(99, 102, 241, 0.25);
}

.btn-sofia-primary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #4f46e5;
  color: #ffffff !important;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.btn-sofia-primary:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.btn-sofia-dismiss {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-sofia-dismiss:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
  text-decoration: underline;
}

[data-theme="dark"] .btn-sofia-dismiss:hover,
[data-mode="dark"] .btn-sofia-dismiss:hover {
  background: rgba(255, 255, 255, 0.08);
}

.notif-empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-secondary);
}

.notif-popover-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.notif-popover-footer a {
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.notif-popover-footer a:hover {
  text-decoration: underline;
}

/* ==============================================================================
   QUADRO DE LEMBRETES ESCOLARES (DASHBOARD)
   ============================================================================== */
.lembretes-filter-tabs {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  gap: 3px;
}

.lembrete-tab-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.lembrete-tab-btn:hover {
  color: var(--text-primary);
}

.lembrete-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lembretes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.lembrete-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 205px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.lembrete-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.lembrete-card.urgente-hoje,
.lembrete-card.urgente-atrasado {
  border-left: 4.5px solid #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-surface) 100%);
}

.lembrete-card.urgente-amanha {
  border-left: 4.5px solid #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-surface) 100%);
}

.lembrete-card.urgente-semana {
  border-left: 4.5px solid #3b82f6;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.04) 0%, var(--bg-surface) 100%);
}

.lembrete-card.urgente-futuro {
  border-left: 4.5px solid var(--text-muted);
}

.lembrete-card.is-concluido {
  opacity: 0.68;
  border-left: 4.5px solid #10b981;
}

.lembrete-card.is-concluido .lembrete-title {
  text-decoration: line-through;
  opacity: 0.8;
}

.lembrete-card.is-arquivado {
  opacity: 0.62;
  border-left: 4.5px solid #64748b;
  background: var(--bg-surface);
}

.lembrete-card.is-arquivado .lembrete-title {
  text-decoration: line-through;
  opacity: 0.75;
}

.lembrete-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.lembrete-header-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.lembrete-header-row-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  min-height: 22px;
}

.lembrete-time-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.lembrete-urgencia-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
}

.lembrete-urgencia-badge.urgente-hoje,
.lembrete-urgencia-badge.urgente-atrasado {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.lembrete-urgencia-badge.urgente-amanha {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.lembrete-urgencia-badge.urgente-semana {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.lembrete-urgencia-badge.urgente-futuro {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.lembrete-urgencia-badge.status-concluido {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.lembrete-urgencia-badge.status-arquivado {
  background: rgba(100, 116, 139, 0.18);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.btn-action-archive {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.radar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  animation: pulseGlow 1.5s infinite ease-in-out;
}

.lembrete-cat-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.lembrete-prio-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.lembrete-prio-badge.prio-alta {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.lembrete-prio-badge.prio-baixa {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  opacity: 0.85;
}

.lembrete-card.prio-alta:not(.is-concluido) {
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.08);
}

.lembrete-card.prio-alta:not(.is-concluido) .lembrete-title {
  color: var(--text-primary);
  font-weight: 800;
}

.lembrete-date-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.lembrete-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  overflow: hidden;
}

.lembrete-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lembrete-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lembrete-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-check-lembrete {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-check-lembrete:hover {
  background: #16a34a;
  color: #ffffff;
}

.btn-check-lembrete.btn-reabrir {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-check-lembrete.btn-reabrir:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.lembrete-actions-menu {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-icon-action.btn-icon-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.lembretes-empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-secondary);
}

.lembretes-empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.lembretes-empty-state h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.lembretes-empty-state p {
  font-size: 13px;
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ==============================================================================
   MODAL UNIVERSAL DE CONFIRMAÇÃO MODERNO (EDTECH UI/UX)
   ============================================================================== */
.custom-confirm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.custom-confirm-backdrop.active {
  display: flex;
  opacity: 1;
}

.custom-confirm-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border);
  overflow: hidden;
  position: relative;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.custom-confirm-backdrop.active .custom-confirm-dialog {
  transform: scale(1) translateY(0);
}

.custom-confirm-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-surface);
}

.custom-confirm-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 2;
}

.custom-confirm-close-btn:hover {
  background: var(--border);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.custom-confirm-body {
  padding: 32px 24px 20px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.custom-confirm-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  transition: transform 0.2s ease;
}

.custom-confirm-icon-wrap.tipo-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.custom-confirm-icon-wrap.tipo-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

.custom-confirm-icon-wrap.tipo-primary {
  background: var(--primary-light, rgba(2, 132, 199, 0.12));
  border: 1.5px solid rgba(2, 132, 199, 0.25);
  color: var(--primary);
}

.custom-confirm-icon-wrap.tipo-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1.5px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
}

.custom-confirm-icon-wrap.tipo-info {
  background: rgba(14, 165, 233, 0.12);
  border: 1.5px solid rgba(14, 165, 233, 0.25);
  color: #0ea5e9;
}

.custom-confirm-icon {
  font-size: 28px;
  line-height: 1;
}

.custom-confirm-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.custom-confirm-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.custom-confirm-details {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  width: 100%;
  box-sizing: border-box;
}

.custom-confirm-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}

.custom-confirm-footer .btn {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 100px;
  transition: all 0.18s ease;
}

.custom-confirm-footer .btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.custom-confirm-footer .btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-1px);
}

.custom-confirm-footer .btn-primary {
  background: var(--primary, #0284c7);
  border-color: var(--primary, #0284c7);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.custom-confirm-footer .btn-primary:hover {
  background: var(--primary-hover, #0369a1);
  border-color: var(--primary-hover, #0369a1);
  transform: translateY(-1px);
}

.custom-confirm-footer .btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.custom-confirm-footer .btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
  transform: translateY(-1px);
}

[data-mode="dark"] .custom-confirm-dialog {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Animação suave de micro-feedback ao clicar fora do modal (Backdrop Click Prevention) */
@keyframes modalShake {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.025); }
  50% { transform: scale(0.985); }
  75% { transform: scale(1.015); }
}
.modal-shake-feedback {
  animation: modalShake 0.24s ease-in-out !important;
}

/* ====== HUB / SHARED DIALOG MODALS ====== */
.hub-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.hub-modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.hub-modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.hub-modal-backdrop.active .hub-modal-dialog {
  transform: scale(1);
}

.hub-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.hub-modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s ease;
  line-height: 1;
}

.hub-modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.hub-modal-body {
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hub-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

[data-mode="dark"] .hub-modal-dialog {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ========================================================================= */
/* ELEMENTOS PEDAGÓGICOS E MATERIAIS DE IA (ILUSTRAÇÕES E ESPAÇO DE CÁLCULO) */
/* ========================================================================= */
.material-ilustracao {
  max-width: 280px !important;
  margin: 12px auto !important;
  padding: 8px 10px !important;
  background: var(--bg-surface, #ffffff) !important;
  border: 1.5px solid var(--border, #e2e8f0) !important;
  border-radius: 12px !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05) !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

.material-ilustracao img {
  max-height: 180px !important;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px !important;
  display: block !important;
  margin: 0 auto !important;
}

.material-ilustracao p {
  font-size: 11px !important;
  color: var(--text-secondary, #64748b) !important;
  margin-top: 5px !important;
  margin-bottom: 0 !important;
  line-height: 1.3 !important;
}

[data-mode="dark"] .material-ilustracao,
[data-theme="dark"] .material-ilustracao {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-mode="dark"] .material-ilustracao p,
[data-theme="dark"] .material-ilustracao p {
  color: #94a3b8 !important;
}

/* Bloco de 4 Linhas para Cálculo e Desenvolvimento */
.bloco-espaco-calculo {
  margin: 14px 0 18px 0 !important;
  padding: 10px 14px 12px 14px !important;
  background: rgba(248, 250, 252, 0.8) !important;
  border: 1px dashed #cbd5e1 !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
}

.bloco-espaco-calculo-header {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 6px !important;
  user-select: none !important;
}

.bloco-espaco-calculo-linhas {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 2px !important;
}

.linha-calculo {
  height: 24px !important;
  border-bottom: 1px dotted #cbd5e1 !important;
  width: 100% !important;
}

[data-mode="dark"] .bloco-espaco-calculo,
[data-theme="dark"] .bloco-espaco-calculo {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

[data-mode="dark"] .bloco-espaco-calculo-header,
[data-theme="dark"] .bloco-espaco-calculo-header {
  color: var(--secondary, #38bdf8) !important;
}

[data-mode="dark"] .linha-calculo,
[data-theme="dark"] .linha-calculo {
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

/* ==============================================================================
   CUSTOM COMBOBOX MODERNO (RESILIENTE A EVENTOS CHROMIUM/LINUX)
   ============================================================================== */
.custom-combobox-wrap {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.custom-combobox-trigger {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-combobox-trigger:focus,
.custom-combobox-wrap.is-open .custom-combobox-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light, rgba(79, 70, 229, 0.15));
}

.custom-combobox-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
}

.custom-combobox-arrow {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.custom-combobox-wrap.is-open .custom-combobox-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

.custom-combobox-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 290px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  z-index: 1050;
  padding: 6px;
  box-sizing: border-box;
}

.custom-combobox-search-wrap {
  padding: 2px 2px 6px 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.custom-combobox-search {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.custom-combobox-search:focus {
  border-color: var(--primary);
}

.custom-combobox-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 230px;
  overflow-y: auto;
}

.custom-combobox-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s ease;
  user-select: none;
}

.custom-combobox-item:hover,
.custom-combobox-item.focused-item {
  background: var(--bg-subtle);
}

.custom-combobox-item.selected-item {
  background: var(--primary-light, rgba(79, 70, 229, 0.12)) !important;
  color: var(--primary);
  font-weight: 700;
}

.custom-combobox-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-combobox-check {
  font-weight: 800;
  color: var(--primary);
  margin-left: 8px;
  flex-shrink: 0;
}

.custom-combobox-optgroup-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 10px 2px;
  letter-spacing: 0.5px;
}

.custom-combobox-empty {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Tamanho compacto quando o select original era compacto (ex: 38px) */
.form-group-compact .custom-combobox-trigger,
.custom-combobox-wrap.input-compact-select .custom-combobox-trigger {
  height: 38px;
}

[data-mode="dark"] .custom-combobox-menu {
  background: var(--bg-surface);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

