/* ============================================================================
   OKU ESCOLA — APP.CSS
   Design System corporativo para o painel de gestão (CodeIgniter 4 + Bootstrap 5)
   ----------------------------------------------------------------------------
   Ficheiro único, organizado por secções numeradas. Mantém 100% de compatibilidade
   com as classes já existentes nas views — nada foi renomeado. Os componentes
   novos estão assinalados com "[NOVO]" no comentário da secção.

   Índice:
     01. Fontes
     02. Design Tokens (cores, tipografia, espaçamento, sombras, z-index)
     03. Reset & Base
     04. Tipografia
     05. Layout Geral
     06. Sidebar (+ modo ícone recolhido)
     07. Topbar / Navbar
     08. Dropdowns da Topbar (pesquisa, notificações, utilizador)
     09. Footer
     10. Page Header
     11. Botões
     12. Formulários (inputs, select, textarea, checkbox, radio, switch, upload)
     13. Cards & Widgets
     14. Dashboard (KPIs, grid, chart container)
     15. Tabelas
     16. DataTables (override)
     17. Paginação [NOVO — genérica, fora do DataTables]
     18. Badges, Chips & Avatares
     19. Alertas & Toasts
     20. Modal & Offcanvas
     21. Dropdown genérico (menus fora da topbar)
     22. Tabs & Accordion
     23. Timeline [NOVO]
     24. Stepper / Wizard [NOVO]
     25. Tooltip & Popover (Bootstrap)
     26. Loading, Skeleton & Progress
     27. Calendário (FullCalendar — hooks visuais)
     28. Breadcrumb
     29. Search Box & Filtros
     30. Empty / Error / Success State
     31. Utilities
     32. Responsive
     33. Print
   ========================================================================= */

/* ============================================================================
   01. FONTES
   ========================================================================= */
@import url("https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap");

/* ============================================================================
   02. DESIGN TOKENS
   Todas as variáveis abaixo podem ser sobrescritas em runtime pelo helper PHP
   (buildThemeCss / load_theme_css) através de um <style id="theme-css"> injectado
   no <head>, depois deste ficheiro. Os nomes --primary, --accent, --success,
   --warning, --danger, --surface, --surface-card, --border, --text-primary,
   --text-secondary, --text-muted, --sidebar-bg e --header-bg são o "contrato"
   com esse helper — não alterar estes nomes.
   ========================================================================= */
:root {
  /* ---- Cor de marca (sobrescrita pelo utilizador via Theme Controller) ---- */
  --primary: #1b2b4b;
  --primary-light: #243761;
  --accent: #3b7fe8;
  --accent-hover: #2c6fd4;

  /* ---- Cores semânticas de estado ---- */
  --success: #16a87d;
  --danger: #e84646;
  --warning: #e8a020;
  --info: #0891b2;

  /* Variações tonais (derivadas, usadas em backgrounds suaves / hover) */
  --success-bg: rgba(22, 168, 125, 0.1);
  --danger-bg: rgba(232, 70, 70, 0.1);
  --warning-bg: rgba(232, 160, 32, 0.1);
  --info-bg: rgba(8, 145, 178, 0.1);
  --accent-bg: rgba(59, 127, 232, 0.1);
  --primary-bg: rgba(27, 43, 75, 0.08);

  /* ---- Superfícies ---- */
  --surface: #f5f7fc;
  --surface-card: #ffffff;
  --surface-hover: rgba(59, 127, 232, 0.04);
  --surface-sunken: #eef1f9;
  --border: #e2e8f4;
  --border-strong: #cbd5ea;

  /* ---- Texto ---- */
  --text-primary: #1a2238;
  --text-secondary: #6b7a99;
  --text-muted: #9aa5be;
  --text-inverse: #ffffff;

  /* ---- Tipografia ---- */
  --font: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", monospace;
  --fs-xs: 0.7rem;
  --fs-sm: 0.78rem;
  --fs-base: 0.875rem;
  --fs-md: 0.95rem;
  --fs-lg: 1.1rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.75rem;
  --lh-base: 1.5;
  --lh-tight: 1.25;

  /* ---- Espaçamento (escala base-4) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* ---- Raio de borda ---- */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* ---- Sombra / elevação ---- */
  --shadow-xs: 0 1px 2px rgba(27, 43, 75, 0.05);
  --shadow-sm: 0 1px 4px rgba(27, 43, 75, 0.07);
  --shadow-md: 0 4px 16px rgba(27, 43, 75, 0.1);
  --shadow-lg: 0 8px 32px rgba(27, 43, 75, 0.14);
  --shadow-xl: 0 16px 48px rgba(27, 43, 75, 0.18);
  --shadow-focus: 0 0 0 3px rgba(59, 127, 232, 0.15);

  /* ---- Layout ---- */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 78px;
  --topbar-h: 60px;
  --footer-h: 48px;

  /* ---- Transições ---- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease);
  --transition-base: 0.22s var(--ease);
  --transition-slow: 0.35s var(--ease);

  /* ---- Z-index ---- */
  --z-sticky: 1020;
  --z-sidebar: 1030;
  --z-dropdown: 1050;
  --z-modal: 1060;
  --z-tooltip: 1070;
  --z-popover: 1075;
  --z-toast: 1080;
  --z-overlay: 1029;
}

/* Tema Claro (padrão) */
:root[data-theme="light"] {
  --surface: #f5f7fc;
  --surface-card: #ffffff;
  --surface-sunken: #eef1f9;
  --border: #e2e8f4;
  --border-strong: #cbd5ea;
  --text-primary: #1a2238;
  --text-secondary: #6b7a99;
  --text-muted: #9aa5be;
}

/* Tema Escuro */
:root[data-theme="dark"] {
  --surface: #0f1419;
  --surface-card: #1a2027;
  --surface-hover: rgba(59, 127, 232, 0.08);
  --surface-sunken: #151b22;
  --border: #2d3748;
  --border-strong: #3c4759;
  --text-primary: #f7fafc;
  --text-secondary: #a0aec0;
  --text-muted: #718096;

  --success-bg: rgba(22, 168, 125, 0.16);
  --danger-bg: rgba(232, 70, 70, 0.16);
  --warning-bg: rgba(232, 160, 32, 0.16);
  --info-bg: rgba(8, 145, 178, 0.18);
  --accent-bg: rgba(59, 127, 232, 0.16);
  --primary-bg: rgba(59, 127, 232, 0.12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.55);
}

/* Aplicar cores dinâmicas do tema (contrato com o helper PHP) */
.sidebar {
  background-color: var(--primary);
  background-image: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  background: var(--sidebar-bg, linear-gradient(180deg, #1b2b4b 0%, #243761 100%));
}

.ci-page-header {
  background: var(--header-bg, linear-gradient(135deg, #1b2b4b 0%, #243761 60%, #2c6fd4 100%));
}

/* Respeitar utilizadores com preferência por movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   03. RESET & BASE — não interferir com classes Bootstrap
   ========================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Foco visível consistente para acessibilidade (teclado) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollbar global discreta (webkit) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::selection {
  background: var(--accent);
  color: #fff;
}

img {
  max-width: 100%;
}

/* ============================================================================
   04. TIPOGRAFIA
   ========================================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  color: var(--text-primary);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5 { font-size: var(--fs-base); font-weight: 700; }
h6 { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }

p {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-hover);
}

small, .fs-small { font-size: var(--fs-sm); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

kbd {
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.4rem;
  color: var(--text-primary);
  font-size: 0.75em;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

.text-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.page-lead {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  max-width: 60ch;
}

/* ============================================================================
   05. LAYOUT GERAL — sidebar fixa + conteúdo fluido
   ========================================================================= */
.ci-wrapper {
  display: flex;
  min-height: 100vh;
}

.container-fluid {
  width: 100%;
}

/* Grid utilitário simples para composições de página (não conflita com Bootstrap) */
.ci-grid {
  display: grid;
  gap: var(--space-5);
}
.ci-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ci-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ci-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 992px) {
  .ci-grid.cols-3, .ci-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px) {
  .ci-grid.cols-2, .ci-grid.cols-3, .ci-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ============================================================================
   06. SIDEBAR
   Estado "collapsed" em desktop passa a ser um modo "ícone" (rail), no estilo
   Fiori/Odoo/Stripe — em vez de esconder totalmente a sidebar. Em mobile
   mantém-se o comportamento de overlay (translateX) já existente no JS.
   ========================================================================= */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sidebar);
  transition: width var(--transition-base), transform var(--transition-base);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transform: translateX(0);
  visibility: visible;
  opacity: 1;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }

/* Brand */
.sidebar-header {
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-logo {
  width: auto;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.12);
  padding: 0px;
  flex-shrink: 0;
}

.sidebar-logo-placeholder {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar-brand-text {
  min-width: 0;
  transition: opacity var(--transition-fast);
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-subtitle {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 1px;
}

/* Nav */
.sidebar-nav {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0 0.6rem;
  flex: 1;
}

.nav-item {
  margin: 1px 0;
  position: relative;
}

.nav-group-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.28);
  padding: 0.9rem 0.7rem 0.3rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
}

/* override do Bootstrap .nav-link para a sidebar */
.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.46rem 0.75rem;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  font-family: var(--font);
  position: relative;
}

.sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.9);
}

.sidebar .nav-link.active {
  background: rgba(59, 127, 232, 0.22);
  color: #fff;
}

.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar .nav-link.active .nav-icon i {
  color: var(--accent);
}

/* Remover seta nativa do Bootstrap no dropdown da sidebar */
.sidebar .nav-link.dropdown-toggle::after,
.sidebar .nav-link.dropdown-toggle::before {
  display: none !important;
  content: none !important;
  border: none !important;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon i {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.18s;
}
.sidebar .nav-link:hover .nav-icon i { color: rgba(255, 255, 255, 0.8); }

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast);
}

.nav-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.1rem 0.45rem;
  border-radius: 50px;
  line-height: 1.4;
  flex-shrink: 0;
}
.nav-badge.warning { background: var(--warning); color: var(--primary); }

.nav-arrow {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.22s;
  flex-shrink: 0;
}
.sidebar .nav-link[aria-expanded="true"] .nav-arrow {
  transform: rotate(90deg);
  color: rgba(255, 255, 255, 0.6);
}

/* Submenu */
.submenu {
  list-style: none;
  padding: 0.2rem 0 0.2rem 2.1rem;
  margin: 0;
}

.submenu li a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.6rem;
  color: rgba(255, 255, 255, 0.52);
  text-decoration: none;
  border-radius: 7px;
  font-size: 0.78rem;
  transition: background 0.15s, color 0.15s;
}
.submenu li a i { font-size: 0.72rem; width: 15px; color: rgba(255, 255, 255, 0.3); }
.submenu li a:hover { background: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.85); }
.submenu li a.active { background: rgba(59, 127, 232, 0.18); color: #fff; }
.submenu li a.active i { color: var(--accent); }

.sub-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.08rem 0.4rem;
  border-radius: 50px;
  background: var(--accent);
  color: #fff;
}
.sub-badge.warning { background: var(--warning); color: var(--primary); }

.submenu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
  list-style: none;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.75rem 0.8rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-footer-info {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.footer-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 50px;
  padding: 0.22rem 0.7rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}
.footer-chip i { font-size: 0.65rem; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  background: rgba(232, 70, 70, 0.12);
  color: rgba(255, 140, 140, 0.85);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.18s;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
}
.btn-logout:hover { background: var(--danger); color: #fff; }

/* Overlay da sidebar em mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(27, 43, 75, 0.5);
  z-index: var(--z-overlay);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ---- Modo "ícone" (collapsed) em desktop ---- */
@media (min-width: 769px) {
  .sidebar.collapsed { width: var(--sidebar-w-collapsed); }

  .sidebar.collapsed .sidebar-brand-text,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .nav-arrow,
  .sidebar.collapsed .nav-group-label,
  .sidebar.collapsed .sidebar-footer-info,
  .sidebar.collapsed .btn-logout span {
    display: none;
  }

  .sidebar.collapsed .sidebar-header { justify-content: center; }
  .sidebar.collapsed .nav-link { justify-content: center; padding: 0.55rem; }
  .sidebar.collapsed .btn-logout { justify-content: center; padding: 0.55rem; }
  .sidebar.collapsed .submenu { display: none; }

  /* Tooltip do nome do item quando recolhido */
  .sidebar.collapsed .nav-link[data-title]:hover::after,
  .sidebar.collapsed .btn-logout[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: var(--z-tooltip);
    pointer-events: none;
  }

  .ci-content { margin-left: var(--sidebar-w); }
  .ci-content.expanded { margin-left: var(--sidebar-w-collapsed); }

  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay { display: none !important; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 6px 0 28px rgba(27, 43, 75, 0.3);
  }
  .sidebar.collapsed .sidebar-brand-text,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-badge { display: block; }
}

/* Flyout do submenu no modo ícone [CORRIGIDO]
   Não é possível resolver com ":hover" puro porque .sidebar tem
   overflow-y:auto + overflow-x:hidden, que recorta qualquer
   position:absolute que ultrapasse a largura da sidebar. A solução
   clona o .submenu e injecta-o em <body> com position:fixed
   (ver initCollapsedFlyouts em app.js). Por isso este bloco fica
   fora dos media queries acima — vive directamente em <body>. */
.submenu-flyout {
  position: fixed;
  list-style: none;
  margin: 0;
  min-width: 200px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  z-index: var(--z-tooltip);
  animation: ci-flyout-in 0.14s var(--ease);
}
.submenu-flyout li a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  border-radius: 7px;
  font-size: 0.78rem;
  transition: background 0.15s, color 0.15s;
}
.submenu-flyout li a i { font-size: 0.72rem; width: 15px; color: rgba(255, 255, 255, 0.3); }
.submenu-flyout li a:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.submenu-flyout li a.active { background: rgba(59, 127, 232, 0.22); color: #fff; }
.submenu-flyout li a.active i { color: var(--accent); }
.submenu-flyout .submenu-divider { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 0.4rem 0; }
.submenu-flyout .sub-badge { margin-left: auto; }

@keyframes ci-flyout-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Suprime o tooltip data-title do ícone enquanto o flyout estiver aberto,
   para não sobrepor visualmente o submenu [NOVO] */
.sidebar.collapsed .nav-item.flyout-open > .nav-link[data-title]:hover::after {
  display: none;
}

/* ============================================================================
   CONTENT AREA
   ========================================================================= */
.ci-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left var(--transition-base);
}

@media (max-width: 768px) {
  .ci-content { margin-left: 0 !important; }
}

/* ============================================================================
   07. TOPBAR / NAVBAR
   ========================================================================= */
.ci-topbar {
  height: var(--topbar-h);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
  gap: 1rem;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }

.topbar-toggle {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 9px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.18s;
  flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--surface); color: var(--primary); border-color: var(--primary); }

/* Breadcrumb da topbar */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
}
.topbar-breadcrumb a { color: var(--text-secondary); text-decoration: none; font-weight: 500; white-space: nowrap; transition: color 0.15s; }
.topbar-breadcrumb a:hover { color: var(--accent); }
.topbar-breadcrumb .bc-sep { color: var(--border); font-size: 0.65rem; }
.topbar-breadcrumb .bc-active {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Botões da topbar */
.topbar-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 9px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  position: relative;
  font-family: var(--font);
}
.topbar-btn:hover { background: var(--surface); color: var(--primary); border-color: var(--primary); }

.topbar-btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  width: auto;
  padding: 0 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 0.35rem;
  box-shadow: 0 3px 10px rgba(59, 127, 232, 0.3);
}
.topbar-btn.accent:hover { background: var(--accent-hover); color: #fff; }

/* Botão de alternância de tema claro/escuro (usado por #quickThemeToggle) */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 9px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
}
.theme-toggle-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.theme-toggle-btn.is-toggling { opacity: 0.6; pointer-events: none; }

.notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface-card);
}

/* Botão do utilizador */
.user-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 10px;
  padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--font);
}
.user-btn:hover { border-color: var(--accent); background: var(--surface); }

.user-avatar { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.user-chevron { font-size: 0.65rem; color: var(--text-muted); }
.user-info { min-width: 0; }
.user-name { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); }
.user-role { font-size: 0.68rem; color: var(--text-muted); }

/* ============================================================================
   08. DROPDOWNS DA TOPBAR — pesquisa, notificações, utilizador
   ========================================================================= */
.topbar-item { position: relative; }

.topbar-dropdown {
  width: 320px;
  padding: 0;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  margin-top: 0.5rem !important;
  background: var(--surface-card) !important;
}
.topbar-dropdown.user-dropdown { width: 280px; }
.topbar-dropdown.search-dropdown { width: 360px; }

.dropdown-inner { padding: 0.75rem 0; }

.dropdown-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0 1rem 0.5rem;
  margin-bottom: 0.25rem;
  display: block;
}

.dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.mark-all-read { font-size: 0.7rem; color: var(--accent); text-decoration: none; }
.mark-all-read:hover { text-decoration: underline; }

/* Campo de pesquisa do dropdown */
.search-input-wrap { position: relative; margin: 0 1rem 0.75rem; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.8rem; z-index: 2; }

.search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--surface);
  transition: all 0.18s;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }

.search-submit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.18s;
}
.search-submit:hover { background: var(--accent-hover); }

.search-quick-links { display: flex; gap: 0.5rem; padding: 0 1rem; flex-wrap: wrap; }
.search-quick-links a {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.2rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  transition: all 0.18s;
}
.search-quick-links a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Itens de dropdown */
.topbar-dd-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.18s;
}
.topbar-dd-item:hover { background: var(--accent-bg); color: var(--accent); }
.topbar-dd-item.danger:hover { background: var(--danger-bg); color: var(--danger); }

.dd-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.dd-icon.green { background: var(--success-bg); color: var(--success); }
.dd-icon.blue { background: var(--accent-bg); color: var(--accent); }
.dd-icon.purple { background: rgba(155, 93, 229, 0.1); color: #9b5de5; }
.dd-icon.orange { background: var(--warning-bg); color: var(--warning); }
.dd-icon.red { background: var(--danger-bg); color: var(--danger); }
.dd-icon.grey { background: rgba(107, 122, 153, 0.1); color: var(--text-secondary); }
.dd-icon.teal { background: rgba(56, 178, 172, 0.1); color: #38b2ac; }

.dd-divider { height: 1px; background: var(--border); margin: 0.5rem 0; }

/* Notificações */
.notif-dropdown .dropdown-inner { padding: 0; }
.notif-list { max-height: 350px; overflow-y: auto; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.18s;
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(59, 127, 232, 0.03); }
.notif-item.unread { background: var(--accent-bg); }

.notif-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.15rem; }
.notif-msg {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-time { font-size: 0.65rem; color: var(--text-muted); }

.notif-new-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  top: 12px;
  right: 12px;
}

.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2rem 1rem; color: var(--text-muted); }
.notif-empty i { font-size: 2rem; opacity: 0.3; }

.notif-footer {
  display: block;
  text-align: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.18s;
}
.notif-footer:hover { background: var(--accent-bg); }

/* Dropdown do utilizador */
.user-dd-header { display: flex; align-items: center; gap: 0.75rem; padding: 0 1rem 0.75rem; }
.user-dd-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.user-dd-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.15rem; }
.user-dd-email { font-size: 0.7rem; color: var(--text-muted); }

/* Badge do ano letivo */
.academic-year-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 0.2rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.academic-year-badge i { color: var(--accent); font-size: 0.7rem; }

/* ============================================================================
   MAIN CONTENT
   ========================================================================= */
.ci-main {
  flex: 1;
  padding: 1.75rem;
  background: var(--surface);
  min-width: 0;
}

/* ============================================================================
   09. FOOTER
   ========================================================================= */
.ci-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.75rem;
  background: var(--surface-card);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.footer-version {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.18rem 0.65rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ============================================================================
   10. PAGE HEADER
   ========================================================================= */
.ci-page-header {
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.ci-page-header::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}
.ci-page-header::after {
  content: "";
  position: absolute;
  bottom: -40px;
  right: 100px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(59, 127, 232, 0.15);
  pointer-events: none;
}

.ci-page-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.ci-page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.2rem;
  letter-spacing: -0.3px;
}

/* Variante compacta [NOVO] — para páginas internas/formulários */
.ci-page-header.compact { padding: 1rem 1.5rem; }
.ci-page-header.compact h1 { font-size: 1.1rem; }

/* Breadcrumb dentro do header — override Bootstrap */
.ci-page-header .breadcrumb { margin: 0; padding: 0; background: transparent; flex-wrap: wrap; }
.ci-page-header .breadcrumb-item a { color: rgba(255, 255, 255, 0.6); text-decoration: none; font-size: 0.8rem; transition: color 0.2s; }
.ci-page-header .breadcrumb-item a:hover { color: #fff; }
.ci-page-header .breadcrumb-item.active,
.ci-page-header .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

.ci-datetime {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.8rem;
  white-space: nowrap;
}
.ci-datetime i { font-size: 0.72rem; opacity: 0.7; }

.hdr-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.hdr-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  white-space: nowrap;
}

.hdr-btn.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(59, 127, 232, 0.28); }
.hdr-btn.primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }

.hdr-btn.secondary, .hdr-btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}
.hdr-btn.secondary:hover, .hdr-btn.ghost:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

.hdr-btn.success { background: var(--success); color: #fff; box-shadow: 0 3px 10px rgba(22, 168, 125, 0.25); }
.hdr-btn.success:hover { background: #12906b; color: #fff; transform: translateY(-1px); }

.hdr-btn.warning { background: var(--warning); color: #fff; }
.hdr-btn.warning:hover { background: #d18c1c; color: #fff; }

/* ============================================================================
   11. BOTÕES
   ========================================================================= */
.btn-ci {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border: none;
  text-decoration: none;
  font-family: var(--font);
  white-space: nowrap;
  line-height: 1.3;
}

.btn-ci.primary { background: var(--accent); color: #fff; }
.btn-ci.primary:hover { background: var(--accent-hover); transform: translateY(-1px); color: #fff; }

.btn-ci.success { background: var(--success); color: #fff; }
.btn-ci.success:hover { background: #0e8a64; transform: translateY(-1px); color: #fff; }

.btn-ci.warning { background: var(--warning); color: #fff; }
.btn-ci.warning:hover { background: #d18c1c; color: #fff; }

.btn-ci.danger { background: var(--danger); color: #fff; }
.btn-ci.danger:hover { background: #cc3535; color: #fff; }

.btn-ci.info { background: var(--info); color: #fff; }
.btn-ci.info:hover { background: #067188; color: #fff; }

.btn-ci.outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-ci.outline:hover { background: var(--surface-card); color: var(--primary); border-color: var(--primary); }

/* Variante "ghost" [NOVO] — sem borda, para acções terciárias */
.btn-ci.ghost { background: transparent; border: none; color: var(--text-secondary); }
.btn-ci.ghost:hover { background: var(--surface); color: var(--primary); }

/* Tamanhos [NOVO] */
.btn-ci.xs { padding: 0.28rem 0.6rem; font-size: 0.68rem; border-radius: var(--radius-xs); }
.btn-ci.small { padding: 0.35rem 0.8rem; font-size: 0.75rem; }
.btn-ci.large { padding: 0.65rem 1.4rem; font-size: 0.9rem; }

/* Bloco (ocupa toda a largura) [NOVO] */
.btn-ci.block { width: 100%; }

/* Apenas ícone [NOVO] */
.btn-ci.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
}
.btn-ci.icon-only.small { width: 30px; height: 30px; }

/* Estado de carregamento [NOVO] — usar com <button class="btn-ci primary is-loading"> */
.btn-ci.is-loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}
.btn-ci.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: ci-spin 0.7s linear infinite;
}
.btn-ci.outline.is-loading::after,
.btn-ci.ghost.is-loading::after {
  border: 2px solid rgba(59, 127, 232, 0.25);
  border-top-color: var(--accent);
}

.btn-ci:disabled,
.btn-ci.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Grupo de botões [NOVO] */
.btn-group-ci {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.btn-group-ci .btn-ci {
  border-radius: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}
.btn-group-ci .btn-ci.outline { border-right: 1px solid var(--border); }
.btn-group-ci .btn-ci:last-child { border-right: none; }

/* Botões de formulário */
.btn-save {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(59, 127, 232, 0.28);
}
.btn-save:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(59, 127, 232, 0.35); }
.btn-save:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(59, 127, 232, 0.2); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
}
.btn-back:hover { background: var(--surface-card); color: var(--primary); border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-back:active { transform: translateY(0); }

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

/* ============================================================================
   12. FORMULÁRIOS
   ========================================================================= */

/* ---- Secções e labels ---- */
.form-section { margin-bottom: 1.75rem; }

.form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.form-section-title i { color: var(--accent); }

.form-label-ci {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.form-label-ci .req { color: var(--danger); }
.form-label-ci i { color: var(--accent); font-size: 0.7rem; }

/* ---- Inputs, selects e textarea ---- */
.form-input-ci,
.form-select-ci,
.form-textarea-ci {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-input-ci:focus,
.form-select-ci:focus,
.form-textarea-ci:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
  background: var(--surface-card);
}

.form-input-ci:disabled,
.form-select-ci:disabled,
.form-textarea-ci:disabled {
  background: var(--surface-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
}

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

.form-input-ci.is-invalid,
.form-select-ci.is-invalid,
.form-textarea-ci.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(232, 70, 70, 0.1); }

.form-input-ci.is-valid,
.form-select-ci.is-valid,
.form-textarea-ci.is-valid { border-color: var(--success); box-shadow: 0 0 0 3px rgba(22, 168, 125, 0.1); }

/* Tamanhos [NOVO] */
.form-input-ci.small, .form-select-ci.small { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.form-input-ci.large, .form-select-ci.large { padding: 0.75rem 1rem; font-size: 0.95rem; }

.form-textarea-ci { resize: vertical; min-height: 100px; line-height: 1.5; }
.form-textarea-ci.no-resize { resize: none; }

/* Select nativo com seta customizada [NOVO — reaproveita o padrão do .filter-select] */
.form-select-ci {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7A99' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

.filter-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.42rem 2rem 0.42rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--surface);
  font-family: var(--font);
  transition: border-color 0.18s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7A99' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); background-color: var(--surface-card); }

/* Label flutuante [NOVO] — <div class="form-floating-ci"><input placeholder=" "><label> */
.form-floating-ci { position: relative; }
.form-floating-ci .form-input-ci { padding-top: 1.2rem; padding-bottom: 0.4rem; }
.form-floating-ci label {
  position: absolute;
  left: 0.9rem;
  top: 0.65rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.16s ease;
  background: transparent;
}
.form-floating-ci .form-input-ci:focus + label,
.form-floating-ci .form-input-ci:not(:placeholder-shown) + label {
  top: 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* Ajuda e erro */
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; display: flex; align-items: center; gap: 0.25rem; }
.form-error { font-size: 0.72rem; color: var(--danger); margin-top: 0.3rem; display: flex; align-items: center; gap: 0.3rem; }
.form-success { font-size: 0.72rem; color: var(--success); margin-top: 0.3rem; display: flex; align-items: center; gap: 0.3rem; }

/* Contador de caracteres [NOVO] — usado por app.js (data-char-counter) */
.form-char-counter { font-size: 0.68rem; color: var(--text-muted); text-align: right; margin-top: 0.25rem; }
.form-char-counter.is-limit { color: var(--danger); font-weight: 600; }

/* ---- Input com ícone [NOVO] ---- */
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-input-ci { padding-left: 2.4rem; }
.input-icon-wrap .form-input-ci.icon-right { padding-left: 0.9rem; padding-right: 2.4rem; }
.input-icon-wrap .input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}
.input-icon-wrap .input-icon.right { left: auto; right: 0.85rem; }

/* Toggle de visibilidade de password [NOVO — JS: initPasswordToggle] */
.input-icon-wrap .password-toggle {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem;
}
.input-icon-wrap .password-toggle:hover { color: var(--accent); }

/* Input group (rótulo/texto anexado, ex.: prefixo, sufixo) */
.input-group { display: flex; width: 100%; }
.input-group .input-group-text {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  padding: 0 0.65rem;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}
.input-group .filter-select,
.input-group .form-input-ci { border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .input-group-text ~ .input-group-text { border-left: none; }
.input-group .input-group-text.append {
  border-right: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-group .form-input-ci:has(+ .input-group-text.append) { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ---- Checkbox customizado [NOVO] ---- */
.form-check-ci {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.form-check-ci input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.form-check-ci .box {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.16s ease;
  position: relative;
}
.form-check-ci .box::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.14s ease;
  margin-top: -1px;
}
.form-check-ci input:checked ~ .box {
  background: var(--accent);
  border-color: var(--accent);
}
.form-check-ci input:checked ~ .box::after { transform: rotate(45deg) scale(1); }
.form-check-ci input:focus-visible ~ .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-check-ci input:disabled ~ .box { opacity: 0.5; cursor: not-allowed; }
.form-check-ci input:indeterminate ~ .box { background: var(--accent); border-color: var(--accent); }
.form-check-ci input:indeterminate ~ .box::after { transform: none; width: 9px; height: 2px; border-width: 2px 0 0 0; margin-top: 0; }

/* ---- Radio customizado [NOVO] ---- */
.form-radio-ci {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.form-radio-ci input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.form-radio-ci .dot {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.16s ease;
}
.form-radio-ci .dot::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform 0.14s ease;
}
.form-radio-ci input:checked ~ .dot { background: var(--accent); border-color: var(--accent); }
.form-radio-ci input:checked ~ .dot::after { transform: scale(1); }
.form-radio-ci input:focus-visible ~ .dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-radio-ci input:disabled ~ .dot { opacity: 0.5; cursor: not-allowed; }

/* Grupo horizontal de checkbox/radio [NOVO] */
.form-check-group { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; }

/* ---- Switch (mantido) ---- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: border-color 0.18s;
}
.toggle-row:hover { border-color: var(--accent); }
.toggle-row.checked { border-color: rgba(22, 168, 125, 0.3); background: rgba(22, 168, 125, 0.04); }

.tl-info { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.tl-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

.ci-switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex-shrink: 0; }
.ci-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.ci-switch-track { position: absolute; inset: 0; border-radius: 50px; background: var(--border); transition: background 0.22s; cursor: pointer; }
.ci-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s;
}
.ci-switch input:checked + .ci-switch-track { background: var(--success); }
.ci-switch input:checked + .ci-switch-track::after { transform: translateX(18px); }

/* Switch pequeno [NOVO] */
.ci-switch.small { width: 34px; height: 19px; }
.ci-switch.small .ci-switch-track::after { width: 13px; height: 13px; }
.ci-switch.small input:checked + .ci-switch-track::after { transform: translateX(15px); }

/* ---- Upload de ficheiros / Dropzone [NOVO — JS: initFileUpload] ---- */
.file-upload-ci {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.file-upload-ci input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-upload-ci:hover, .file-upload-ci.is-dragover { border-color: var(--accent); background: var(--accent-bg); }
.file-upload-ci .fu-icon { font-size: 1.8rem; color: var(--accent); margin-bottom: 0.6rem; }
.file-upload-ci .fu-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.file-upload-ci .fu-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }

.file-upload-list { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.file-upload-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}
.file-upload-item .fu-file-icon { color: var(--accent); font-size: 1rem; flex-shrink: 0; }
.file-upload-item .fu-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); font-weight: 500; }
.file-upload-item .fu-file-size { color: var(--text-muted); font-size: 0.7rem; flex-shrink: 0; }
.file-upload-item .fu-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.file-upload-item .fu-remove:hover { color: var(--danger); }
.file-upload-item.thumb img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }

/* ---- Range slider [NOVO] ---- */
.form-range-ci { width: 100%; display: flex; align-items: center; gap: 0.75rem; }
.form-range-ci input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
  outline: none;
}
.form-range-ci input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(59, 127, 232, 0.4);
  border: 2px solid #fff;
}
.form-range-ci input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(59, 127, 232, 0.4);
}
.form-range-ci .range-value {
  min-width: 42px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.4rem;
}

/* ---- Avaliação por estrelas [NOVO — JS: initRating] ---- */
.rating-ci { display: inline-flex; gap: 0.2rem; }
.rating-ci i { font-size: 1.1rem; color: var(--border-strong); cursor: pointer; transition: color 0.12s; }
.rating-ci i.is-filled { color: var(--warning); }
.rating-ci.readonly i { cursor: default; }

/* Formulário em cartão (mantido) */
.form-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: 780px;
  margin: 0 auto;
}
.form-card-header { background: var(--primary); padding: 1rem 1.5rem; display: flex; align-items: center; gap: 0.6rem; }
.form-card-header-title { font-size: 0.9rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 0.5rem; }
.form-card-body { padding: 1.75rem; }

/* Select2 — integração Bootstrap 5 */
.select2-container--bootstrap-5 .select2-selection {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--surface) !important;
  font-family: var(--font) !important;
  font-size: 0.875rem !important;
  min-height: 40px !important;
}
.select2-container--bootstrap-5 .select2-selection:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
  border-color: var(--accent) !important;
  box-shadow: var(--shadow-focus) !important;
}

/* Bootstrap .form-check nativo usado nalgumas telas de admissões — manter compatível */
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check-input { width: 18px; height: 18px; cursor: pointer; }
.form-check-label { cursor: pointer; }

/* ============================================================================
   13. CARDS & WIDGETS
   ========================================================================= */
.ci-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible; /* CRÍTICO: hidden quebra dropdowns/selects */
  margin-bottom: 1.25rem;
  transition: box-shadow var(--transition-base);
}

.ci-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.ci-card-title { display: flex; align-items: center; gap: 0.55rem; font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.ci-card-title i { color: var(--accent); font-size: 0.8rem; }
.ci-card-title .ci-card-sub { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); margin-left: 0.4rem; }

.ci-card-actions { display: flex; align-items: center; gap: 0.4rem; }

.ci-card-body { padding: 1.25rem; }
.ci-card-body.p0 { padding: 0; }

/* Card sem sombra, apenas contorno [NOVO] — para agrupamentos discretos */
.ci-card.flat { box-shadow: none; }
.ci-card.hoverable:hover { box-shadow: var(--shadow-md); }

/* Widget compacto [NOVO] — mini card para listas do dashboard (atividades, agenda) */
.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.widget-item:last-child { border-bottom: none; }
.widget-item:hover { background: var(--surface-hover); }
.widget-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.widget-body { flex: 1; min-width: 0; }
.widget-title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.widget-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ============================================================================
   14. DASHBOARD — KPIs, grid e contentor de gráficos
   ========================================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.stat-card.hoverable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--accent-bg); color: var(--accent); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.navy { background: var(--primary-bg); color: var(--primary); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.teal { background: var(--info-bg); color: var(--info); }

.stat-info { min-width: 0; flex: 1; }
.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value { font-size: 1.45rem; font-weight: 700; color: var(--text-primary); font-family: var(--font-mono); line-height: 1; }
.stat-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.18rem; }

/* Indicador de tendência [NOVO] — <span class="stat-trend up">+12%</span> */
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.4rem;
  border-radius: 50px;
  margin-top: 0.3rem;
}
.stat-trend.up { background: var(--success-bg); color: var(--success); }
.stat-trend.down { background: var(--danger-bg); color: var(--danger); }
.stat-trend.flat { background: var(--surface-sunken); color: var(--text-muted); }

/* Grid do dashboard [NOVO] — colunas assimétricas comuns (ex.: gráfico + lista lateral) */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.dashboard-grid.balanced { grid-template-columns: 1fr 1fr; }
@media (max-width: 992px) { .dashboard-grid, .dashboard-grid.balanced { grid-template-columns: 1fr; } }

/* Contentor de gráficos [NOVO] */
.chart-container { position: relative; width: 100%; }
.chart-container.h-sm { height: 220px; }
.chart-container.h-md { height: 300px; }
.chart-container.h-lg { height: 400px; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.75rem; justify-content: center; }
.chart-legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--text-secondary); }
.chart-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Lista de exames / agenda (mantido) */
.exam-list { list-style: none; margin: 0; padding: 0; }
.exam-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.18s ease;
}
.exam-list-item:last-child { border-bottom: none; }
.exam-list-item:hover { background: rgba(59, 127, 232, 0.03); }

.exam-info { flex: 1; min-width: 0; }
.exam-discipline {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exam-meta { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.exam-meta i { font-size: 0.65rem; color: var(--accent); opacity: 0.7; }
.meta-sep { opacity: 0.4; margin: 0 0.1rem; }

.exam-datetime { flex-shrink: 0; text-align: right; }
.exam-badge { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0.22rem 0.65rem; border-radius: 50px; white-space: nowrap; font-family: var(--font-mono); }
.exam-badge.today { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%); color: #fff; box-shadow: 0 2px 6px rgba(59, 127, 232, 0.25); }
.exam-badge.future { background: var(--accent-bg); color: var(--accent); }
.exam-time { font-size: 0.68rem; font-weight: 600; color: var(--text-secondary); margin-top: 0.2rem; font-family: var(--font-mono); }

/* ============================================================================
   15. TABELAS
   ========================================================================= */
.ci-table { width: 100%; border-collapse: separate; border-spacing: 0; }

.ci-table thead tr th {
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.65rem 1rem;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

/* Cabeçalho ordenável [NOVO] */
.ci-table thead tr th.sortable { cursor: pointer; user-select: none; }
.ci-table thead tr th.sortable:hover { color: var(--accent); }
.ci-table thead tr th.sortable::after { content: "\f0dc"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: 0.4rem; opacity: 0.35; font-size: 0.6rem; }
.ci-table thead tr th.sortable.asc::after { content: "\f0de"; opacity: 1; color: var(--accent); }
.ci-table thead tr th.sortable.desc::after { content: "\f0dd"; opacity: 1; color: var(--accent); }

.ci-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
.ci-table tbody tr:last-child { border-bottom: none; }
.ci-table tbody tr:hover { background: var(--surface-hover); }
.ci-table tbody tr.selected { background: var(--accent-bg); }

.ci-table tbody td { padding: 0.7rem 1rem; vertical-align: middle; font-size: 0.83rem; border: none; }
.ci-table tbody td.center { text-align: center; }

/* Cabeçalho fixo [NOVO] — usar num contentor com overflow */
.ci-table.sticky-head thead th { position: sticky; top: 0; z-index: 2; }

/* Linhas compactas [NOVO] */
.ci-table.compact tbody td, .ci-table.compact thead th { padding: 0.4rem 0.75rem; }

/* Badges da tabela */
.id-chip, .student-number {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  display: inline-block;
}

.code-badge { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; background: var(--accent-bg); color: var(--accent); padding: 0.12rem 0.42rem; border-radius: 5px; }

.status-badge { font-size: 0.68rem; font-weight: 600; padding: 0.25rem 0.55rem; border-radius: 50px; display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.status-badge.success, .status-badge.active { background: var(--success-bg); color: var(--success); }
.status-badge.warning { background: var(--warning-bg); color: var(--warning); }
.status-badge.danger, .status-badge.inactive { background: var(--danger-bg); color: var(--danger); }
.status-badge.info { background: var(--info-bg); color: var(--info); }

.course-badge { font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 50px; display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.course-badge.primary { background: var(--accent-bg); color: var(--accent); }
.course-badge.warning { background: var(--warning-bg); color: var(--warning); }
.course-badge.secondary { background: var(--primary-bg); color: var(--primary); }

.level-badge { font-size: 0.68rem; font-weight: 600; padding: 0.18rem 0.55rem; border-radius: 50px; display: inline-block; }
.level-badge.success { background: var(--success-bg); color: var(--success); }
.level-badge.warning { background: var(--warning-bg); color: var(--warning); }

.teacher-photo { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.teacher-initials {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.2rem;
  text-transform: uppercase;
}

/* Acções da linha */
.action-group { display: flex; gap: 0.25rem; flex-wrap: wrap; justify-content: center; }

.row-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.row-btn:hover { color: #fff; border-color: transparent; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }
.row-btn.view:hover { background: var(--success); }
.row-btn.edit:hover { background: var(--accent); }
.row-btn.del:hover { background: var(--danger); }
.row-btn.assign:hover { background: var(--primary); }
.row-btn.schedule:hover { background: var(--warning); }
.row-btn.history:hover { background: var(--primary); }
.row-btn.enroll:hover { background: var(--warning); }
.row-btn.activate:hover { background: var(--success); }
.row-btn.results:hover { background: var(--success); color: #fff; }
.row-btn.conclude:hover { background: var(--warning); color: #fff; }
.row-btn.reprocess:hover { background: var(--accent); color: #fff; }
.row-btn.semesters:hover { background: var(--warning); color: #fff; border-color: transparent; }
.row-btn.disabled-btn { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Tooltip custom do row-btn */
.row-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.current-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 50px;
  background: var(--accent-bg);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-set-current {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-set-current:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }

.ci-empty { text-align: center; padding: 3rem; color: var(--text-muted); }
.ci-empty i { font-size: 2rem; opacity: 0.15; display: block; margin-bottom: 0.6rem; }
.ci-empty p { font-size: 0.82rem; margin: 0; }

.id-chip { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; background: var(--primary-bg); color: var(--primary); padding: 0.15rem 0.45rem; border-radius: 5px; }
.year-name { font-weight: 700; color: var(--text-primary); }
.period-text { font-family: var(--font-mono); font-size: 0.73rem; color: var(--text-secondary); }

.status-dot { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 700; }
.sd { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sd-active { background: var(--success); box-shadow: 0 0 0 2px rgba(22, 168, 125, 0.2); }
.sd-inactive { background: var(--text-muted); }
.st-active { color: var(--success); }
.st-inactive { color: var(--text-muted); }

/* ============================================================================
   16. DATATABLES — override completo para Bootstrap 5
   ========================================================================= */
div.dataTables_wrapper { padding: 0.85rem 1.25rem 1rem; }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.3rem 0.6rem !important;
  font-size: 0.8rem !important;
  font-family: var(--font) !important;
  color: var(--text-primary) !important;
  background: var(--surface) !important;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: var(--shadow-focus) !important;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px !important;
  font-size: 0.78rem !important;
  font-family: var(--font) !important;
  border: 1px solid var(--border) !important;
  margin: 0 2px !important;
  color: var(--text-secondary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  box-shadow: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:not(.disabled):hover {
  background: var(--accent-bg) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: 0.4; cursor: not-allowed; }

.dt-buttons { margin-bottom: 1rem; display: flex; gap: 0.3rem; flex-wrap: wrap; }
.dt-button { border-radius: var(--radius-sm) !important; font-family: var(--font) !important; font-size: 0.78rem !important; }

/* ============================================================================
   17. PAGINAÇÃO GENÉRICA [NOVO] — Bootstrap .pagination fora do DataTables
   ========================================================================= */
.pagination { gap: 0.25rem; }
.pagination .page-link {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm) !important;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font);
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  transition: all 0.16s;
}
.pagination .page-link:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 8px rgba(59, 127, 232, 0.25); }
.pagination .page-item.disabled .page-link { opacity: 0.4; }

/* ============================================================================
   18. BADGES, CHIPS & AVATARES
   ========================================================================= */
.badge-ci { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 700; padding: 0.22rem 0.6rem; border-radius: 50px; white-space: nowrap; }
.badge-ci.primary { background: var(--primary-bg); color: var(--primary); }
.badge-ci.success { background: var(--success-bg); color: var(--success); }
.badge-ci.warning { background: var(--warning-bg); color: var(--warning); }
.badge-ci.info { background: var(--info-bg); color: var(--info); }
.badge-ci.danger { background: var(--danger-bg); color: var(--danger); }
.badge-ci.secondary { background: rgba(107, 122, 153, 0.1); color: var(--text-secondary); }
.badge-ci.code { font-family: var(--font-mono); background: var(--accent-bg); color: var(--accent); border-radius: 5px; padding: 0.15rem 0.45rem; }

/* Chip / Tag removível [NOVO] — para filtros activos, palavras-chave, etc. */
.chip-ci {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.chip-ci .chip-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.7rem; line-height: 1; padding: 0; }
.chip-ci .chip-remove:hover { color: var(--danger); }
.chip-ci.accent { background: var(--accent-bg); color: var(--accent); border-color: transparent; }

/* Avatar [NOVO] */
.avatar-ci {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  flex-shrink: 0;
  font-family: var(--font);
}
.avatar-ci.xs { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar-ci.sm { width: 32px; height: 32px; font-size: 0.7rem; }
.avatar-ci.md { width: 45px; height: 45px; font-size: 1rem; }
.avatar-ci.lg { width: 64px; height: 64px; font-size: 1.3rem; }

.avatar-group { display: flex; }
.avatar-group .avatar-ci { border: 2px solid var(--surface-card); margin-left: -10px; }
.avatar-group .avatar-ci:first-child { margin-left: 0; }
.avatar-group .avatar-more {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-sunken); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; border: 2px solid var(--surface-card); margin-left: -10px;
}

/* ============================================================================
   19. ALERTAS & TOASTS
   ========================================================================= */
.alert-ci { border-radius: var(--radius-sm); border: none; font-size: 0.875rem; padding: 0.8rem 1rem; border-left: 3px solid transparent; }
.alert-ci.success { background: var(--success-bg); color: #0e7a5a; border-left-color: var(--success); }
.alert-ci.danger { background: var(--danger-bg); color: #b03030; border-left-color: var(--danger); }
.alert-ci.warning { background: var(--warning-bg); color: #8a5a00; border-left-color: var(--warning); }
.alert-ci.info { background: var(--info-bg); color: #086a80; border-left-color: var(--info); }

.alert-ci.dismissible { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.alert-ci .alert-close { background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 0.9rem; }
.alert-ci .alert-close:hover { opacity: 1; }

/* Bootstrap .alert usado nalgumas views legadas — manter compatível */
.alert { border-radius: var(--radius-sm); border: none; font-size: 0.875rem; }
.alert-success { background: var(--success-bg); color: #0e7a5a; border-left: 3px solid var(--success); }
.alert-danger { background: var(--danger-bg); color: #b03030; border-left: 3px solid var(--danger); }

/* Toastr — tema (a biblioteca é usada via CDN vendor) */
#toast-container > div { border-radius: var(--radius-sm) !important; box-shadow: var(--shadow-lg) !important; font-family: var(--font) !important; opacity: 1 !important; }
#toast-container > .toast-success { background-color: var(--success) !important; }
#toast-container > .toast-error { background-color: var(--danger) !important; }
#toast-container > .toast-warning { background-color: var(--warning) !important; }
#toast-container > .toast-info { background-color: var(--info) !important; }

/* Toast nativo [NOVO] — alternativa leve ao toastr, controlado por window.toastCI (app.js) */
.toast-ci-wrap {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 340px;
}
.toast-ci {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  animation: ci-toast-in 0.22s var(--ease);
}
.toast-ci.success { border-left-color: var(--success); }
.toast-ci.danger { border-left-color: var(--danger); }
.toast-ci.warning { border-left-color: var(--warning); }
.toast-ci .toast-ci-icon { flex-shrink: 0; font-size: 0.95rem; }
.toast-ci.success .toast-ci-icon { color: var(--success); }
.toast-ci.danger .toast-ci-icon { color: var(--danger); }
.toast-ci.warning .toast-ci-icon { color: var(--warning); }
.toast-ci.info .toast-ci-icon, .toast-ci .toast-ci-icon { color: var(--accent); }
.toast-ci .toast-ci-body { flex: 1; }
.toast-ci .toast-ci-close { background: none; border: none; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.toast-ci.is-leaving { animation: ci-toast-out 0.18s var(--ease) forwards; }

@keyframes ci-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ci-toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ============================================================================
   20. MODAL & OFFCANVAS
   ========================================================================= */
.ci-modal .modal-content { border: none; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.ci-modal .modal-header { padding: 1rem 1.4rem; background: var(--primary); color: #fff; border: none; }
.ci-modal .modal-header.success-header { background: var(--success); }
.ci-modal .modal-header.danger-header { background: var(--danger); }
.ci-modal .modal-title { font-size: 0.9rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 0.5rem; }
.ci-modal .btn-close-white { filter: brightness(0) invert(1); opacity: 0.8; }
.ci-modal .modal-body { padding: 1.4rem; }
.ci-modal .modal-footer { padding: 0.9rem 1.4rem; border-top: 1px solid var(--border); }

/* Modal custom (alias mantido) */
.modal-custom .modal-content { border: none; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.modal-custom .modal-header { background: var(--primary); color: #fff; border: none; padding: 1rem 1.5rem; }
.modal-custom .modal-header .btn-close { filter: brightness(0) invert(1); opacity: 0.8; }
.modal-custom .modal-body { padding: 1.5rem; }
.modal-custom .modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }

/* Tamanhos de modal auxiliares [NOVO] */
.ci-modal .modal-body.scrollable { max-height: 60vh; overflow-y: auto; }

/* Offcanvas [NOVO] — painéis laterais (ex.: filtros avançados, detalhes rápidos) */
.offcanvas {
  background: var(--surface-card);
}
.offcanvas-header {
  padding: 1.1rem 1.4rem;
  background: var(--primary);
  border-bottom: none;
}
.offcanvas-title { color: #fff; font-size: 0.95rem; font-weight: 700; }
.offcanvas-header .btn-close { filter: brightness(0) invert(1); opacity: 0.8; }
.offcanvas-body { padding: 1.4rem; color: var(--text-primary); }
.offcanvas-body .form-section:last-child { margin-bottom: 0; }

/* ============================================================================
   21. DROPDOWN GENÉRICO [NOVO] — override do Bootstrap .dropdown-menu fora da topbar
   ========================================================================= */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  font-size: 0.85rem;
  font-family: var(--font);
}
.dropdown-menu .dropdown-item {
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s;
}
.dropdown-menu .dropdown-item i { width: 16px; color: var(--text-muted); font-size: 0.8rem; }
.dropdown-menu .dropdown-item:hover, .dropdown-menu .dropdown-item:focus { background: var(--accent-bg); color: var(--accent); }
.dropdown-menu .dropdown-item:hover i, .dropdown-menu .dropdown-item:focus i { color: var(--accent); }
.dropdown-menu .dropdown-item.active { background: var(--accent); color: #fff; }
.dropdown-menu .dropdown-item.active i { color: #fff; }
.dropdown-menu .dropdown-item.text-danger:hover { background: var(--danger-bg); color: var(--danger) !important; }
.dropdown-menu .dropdown-divider { border-top: 1px solid var(--border); margin: 0.35rem 0; }
.dropdown-menu .dropdown-header { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 0.4rem 0.75rem; }

/* ============================================================================
   22. TABS & ACCORDION (Bootstrap)
   ========================================================================= */
.nav-tabs { border-bottom: 1.5px solid var(--border); gap: 0.25rem; }
.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  transition: all 0.16s;
}
.nav-tabs .nav-link:hover { color: var(--accent); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
.nav-tabs .nav-link i { margin-right: 0.4rem; }

/* Variante em "pills" */
.nav-pills .nav-link { border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.82rem; font-weight: 600; padding: 0.5rem 1rem; }
.nav-pills .nav-link:hover { background: var(--surface); color: var(--primary); }
.nav-pills .nav-link.active { background: var(--accent); color: #fff; }

/* Variante em "card" [NOVO] — abas dentro de um ci-card-header */
.ci-card-header .nav-tabs { border-bottom: none; }

.tab-content { padding-top: 1.25rem; }

/* Accordion */
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius-sm) !important; margin-bottom: 0.6rem; overflow: hidden; }
.accordion-item:last-child { margin-bottom: 0; }
.accordion-button {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface-card);
  padding: 0.9rem 1.1rem;
  box-shadow: none !important;
}
.accordion-button:not(.collapsed) { background: var(--accent-bg); color: var(--accent); }
.accordion-button::after { width: 1rem; height: 1rem; background-size: 1rem; }
.accordion-body { padding: 1.1rem; font-size: 0.85rem; color: var(--text-secondary); background: var(--surface-card); }

/* ============================================================================
   23. TIMELINE [NOVO] — histórico de actividades, auditoria, percurso do aluno
   ========================================================================= */
.timeline-ci { position: relative; margin: 0; padding: 0 0 0 1.6rem; list-style: none; }
.timeline-ci::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1.5rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -1.6rem;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface-card);
  box-shadow: 0 0 0 2px var(--border);
}
.timeline-item.success .timeline-dot { background: var(--success); }
.timeline-item.danger .timeline-dot { background: var(--danger); }
.timeline-item.warning .timeline-dot { background: var(--warning); }
.timeline-item.muted .timeline-dot { background: var(--text-muted); }

.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.timeline-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.timeline-time { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.timeline-desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.2rem; }
.timeline-meta { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem; flex-wrap: wrap; }

/* Variante horizontal [NOVO] — para percursos curtos (ex.: estados de um pedido) */
.timeline-h { display: flex; align-items: flex-start; list-style: none; margin: 0; padding: 0; }
.timeline-h .timeline-h-item { flex: 1; text-align: center; position: relative; padding-top: 1.6rem; }
.timeline-h .timeline-h-item::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--border);
}
.timeline-h .timeline-h-item:first-child::before { left: 50%; width: 50%; }
.timeline-h .timeline-h-item:last-child::before { width: 50%; }
.timeline-h .timeline-h-item::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 2px solid var(--border-strong);
  z-index: 1;
}
.timeline-h .timeline-h-item.done::after { background: var(--success); border-color: var(--success); }
.timeline-h .timeline-h-item.done::before { background: var(--success); }
.timeline-h .timeline-h-item.current::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.timeline-h .timeline-h-item .timeline-h-label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); }
.timeline-h .timeline-h-item.done .timeline-h-label, .timeline-h .timeline-h-item.current .timeline-h-label { color: var(--text-primary); }

/* ============================================================================
   24. STEPPER / WIZARD [NOVO] — formulários multi-etapa (matrículas, admissões)
   ========================================================================= */
.stepper-ci { display: flex; align-items: flex-start; list-style: none; margin: 0 0 1.75rem; padding: 0; }
.stepper-step { flex: 1; text-align: center; position: relative; }
.stepper-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 17px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.stepper-step.is-done:not(:last-child)::after { background: var(--success); }

.stepper-circle {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 2px solid var(--border-strong);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin: 0 auto 0.5rem;
  transition: all 0.2s;
}
.stepper-step.is-active .stepper-circle { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.stepper-step.is-done .stepper-circle { background: var(--success); border-color: var(--success); color: #fff; }
.stepper-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.stepper-step.is-active .stepper-label { color: var(--accent); }
.stepper-step.is-done .stepper-label { color: var(--success); }
.stepper-sublabel { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }

.stepper-pane { display: none; }
.stepper-pane.is-active { display: block; }

.stepper-actions { display: flex; justify-content: space-between; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* Variante vertical compacta [NOVO] — para painéis laterais */
.stepper-v { list-style: none; margin: 0; padding: 0; }
.stepper-v .stepper-step { display: flex; align-items: flex-start; text-align: left; gap: 0.75rem; padding-bottom: 1.25rem; position: relative; }
.stepper-v .stepper-step:not(:last-child)::after { top: 34px; left: 17px; width: 2px; height: calc(100% - 20px); }
.stepper-v .stepper-circle { margin: 0; flex-shrink: 0; }

/* ============================================================================
   25. TOOLTIP & POPOVER (Bootstrap — inicializados via app.js)
   ========================================================================= */
.tooltip .tooltip-inner {
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 0.72rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-md);
}
.tooltip.bs-tooltip-top .tooltip-arrow::before { border-top-color: var(--primary); }
.tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: var(--primary); }
.tooltip.bs-tooltip-start .tooltip-arrow::before { border-left-color: var(--primary); }
.tooltip.bs-tooltip-end .tooltip-arrow::before { border-right-color: var(--primary); }

.popover {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-family: var(--font);
  max-width: 280px;
}
.popover-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius) var(--radius) 0 0;
}
.popover-body { font-size: 0.78rem; color: var(--text-secondary); padding: 0.75rem 0.9rem; }

/* ============================================================================
   26. LOADING, SKELETON & PROGRESS
   ========================================================================= */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.spinner-overlay.active { display: flex; }

:root[data-theme="dark"] .spinner-overlay { background: rgba(15, 20, 25, 0.75); }

/* Spinner circular reutilizável [NOVO] */
.ci-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: ci-spin 0.7s linear infinite;
}
.ci-spinner.small { width: 18px; height: 18px; border-width: 2px; }

/* Skeleton (loading placeholder) [NOVO] — usado por window.skeleton (app.js) */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-sunken);
  border-radius: var(--radius-xs);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: ci-shimmer 1.4s infinite;
}
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent); }

.skeleton.text { height: 0.85rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton.text.w-60 { width: 60%; }
.skeleton.text.w-40 { width: 40%; }
.skeleton.title { height: 1.3rem; width: 45%; margin-bottom: 0.75rem; }
.skeleton.avatar { width: 45px; height: 45px; border-radius: 50%; }
.skeleton.thumb { width: 100%; height: 140px; border-radius: var(--radius-sm); }
.skeleton.btn { height: 36px; width: 110px; border-radius: var(--radius-sm); }
.skeleton.row { height: 44px; width: 100%; margin-bottom: 0.5rem; border-radius: var(--radius-sm); }

@keyframes ci-shimmer { 100% { transform: translateX(100%); } }

/* Barra de progresso [NOVO] */
.progress-ci { width: 100%; height: 8px; border-radius: var(--radius-full); background: var(--surface-sunken); overflow: hidden; }
.progress-ci-bar { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width 0.35s var(--ease); }
.progress-ci-bar.success { background: var(--success); }
.progress-ci-bar.warning { background: var(--warning); }
.progress-ci-bar.danger { background: var(--danger); }
.progress-ci-bar.striped {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
  background-size: 1rem 1rem;
}
.progress-ci.small { height: 5px; }
.progress-ci-label { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 0.3rem; }

/* Progresso circular (KPI) [NOVO] — <div class="progress-circle" style="--val:72"> */
.progress-circle {
  --val: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: conic-gradient(var(--accent) calc(var(--val) * 1%), var(--surface-sunken) 0);
  position: relative;
}
.progress-circle::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface-card); }
.progress-circle span { position: relative; z-index: 1; }

/* ============================================================================
   27. CALENDÁRIO — hooks visuais para o FullCalendar
   ========================================================================= */
.ci-calendar { background: var(--surface-card); border-radius: var(--radius); padding: 1rem; }
.ci-calendar .fc { font-family: var(--font); color: var(--text-primary); }
.ci-calendar .fc-toolbar-title { font-size: 1rem !important; font-weight: 700; color: var(--text-primary); }
.ci-calendar .fc-button-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  font-family: var(--font) !important;
  font-size: 0.78rem !important;
  text-transform: capitalize;
  box-shadow: none !important;
}
.ci-calendar .fc-button-primary:hover { background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; }
.ci-calendar .fc-button-primary:not(:disabled).fc-button-active { background: var(--primary) !important; border-color: var(--primary) !important; }
.ci-calendar .fc-daygrid-day.fc-day-today { background: var(--accent-bg) !important; }
.ci-calendar .fc-col-header-cell { background: var(--surface); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.ci-calendar .fc-theme-standard td, .ci-calendar .fc-theme-standard th { border-color: var(--border); }
.ci-calendar .fc-event { border-radius: var(--radius-xs); border: none; font-size: 0.72rem; padding: 1px 4px; }

/* ============================================================================
   28. BREADCRUMB (standalone, fora do page header)
   ========================================================================= */
.breadcrumb-ci { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-size: 0.8rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.breadcrumb-ci a { color: var(--text-secondary); font-weight: 500; }
.breadcrumb-ci a:hover { color: var(--accent); }
.breadcrumb-ci .bc-sep { color: var(--border-strong); font-size: 0.65rem; }
.breadcrumb-ci .bc-active { color: var(--text-primary); font-weight: 600; }

/* ============================================================================
   29. SEARCH BOX & FILTROS
   ========================================================================= */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.filter-label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.3rem; display: block; }

.filter-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

.btn-filter { display: inline-flex; align-items: center; gap: 0.4rem; border-radius: var(--radius-sm); padding: 0.5rem 1.1rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.18s; border: none; font-family: var(--font); text-decoration: none; white-space: nowrap; }
.btn-filter.apply { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(59, 127, 232, 0.25); }
.btn-filter.apply:hover { background: var(--accent-hover); color: #fff; }
.btn-filter.clear { background: var(--surface); border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-filter.clear:hover { background: var(--surface-card); color: var(--primary); border-color: var(--primary); }

/* Chips de filtros activos [NOVO] */
.active-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }

/* Caixa de pesquisa de página [NOVO] — maior, para topo de listagens */
.page-search-box { position: relative; max-width: 420px; }
.page-search-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  background: var(--surface-card);
  color: var(--text-primary);
  transition: all 0.18s;
}
.page-search-box input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.page-search-box i { position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ============================================================================
   30. EMPTY / ERROR / SUCCESS STATE
   ========================================================================= */
.empty-state, .error-state, .success-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state i, .error-state i, .success-state i { font-size: 2.5rem; opacity: 0.2; margin-bottom: 0.75rem; display: block; }
.empty-state h5, .error-state h5, .success-state h5 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.4rem; }
.empty-state p, .error-state p, .success-state p { font-size: 0.82rem; max-width: 42ch; margin: 0 auto; }

/* Error state [NOVO] — falhas de carregamento, permissões, 404/500 internos ao layout */
.error-state i { color: var(--danger); opacity: 0.35; }
.error-state .error-code { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 800; color: var(--danger); opacity: 0.5; line-height: 1; margin-bottom: 0.5rem; }

/* Success state [NOVO] — confirmação de processo concluído (ex.: matrícula enviada) */
.success-state i { color: var(--success); opacity: 0.4; }
.success-state .success-icon-circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--success-bg); color: var(--success);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin-bottom: 0.85rem;
}

.ci-empty { text-align: center; padding: 3rem; color: var(--text-muted); }
.ci-empty i { font-size: 2rem; opacity: 0.15; display: block; margin-bottom: 0.6rem; }
.ci-empty p { font-size: 0.82rem; margin: 0; }

/* ============================================================================
   31. UTILITIES
   ========================================================================= */
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted-ci { color: var(--text-muted) !important; }

.bg-accent-light { background-color: var(--accent-bg); }
.bg-success-light { background-color: var(--success-bg); }
.bg-danger-light { background-color: var(--danger-bg); }
.bg-warning-light { background-color: var(--warning-bg); }
.bg-info-light { background-color: var(--info-bg); }

.font-mono { font-family: var(--font-mono) !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }

/* Espaçamento utilitário [NOVO] — complementa o Bootstrap p-*/m-* já usado nas views */
.gap-1 { gap: var(--space-1) !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }

.rounded-ci { border-radius: var(--radius) !important; }
.rounded-ci-sm { border-radius: var(--radius-sm) !important; }
.shadow-ci-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-ci-md { box-shadow: var(--shadow-md) !important; }

.truncate-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cursor-pointer { cursor: pointer !important; }
.divider-ci { height: 1px; background: var(--border); margin: 1rem 0; border: none; }

/* ============================================================================
   32. RESPONSIVE
   ========================================================================= */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .ci-main { padding: 1rem; }
  .ci-page-header { padding: 1.1rem 1.2rem; }
  .ci-page-header h1 { font-size: 1.1rem; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: 1fr; }

  .topbar-breadcrumb { display: none !important; }

  .topbar-btn.accent { width: 36px; padding: 0; justify-content: center; }
  .topbar-btn.accent span { display: none !important; }

  .topbar-dropdown { width: 280px !important; }

  .user-info { display: none; }
  .user-chevron { display: none; }

  .stepper-label, .stepper-sublabel { display: none; }
  .toast-ci-wrap { left: 1rem; right: 1rem; max-width: none; top: 0.75rem; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .ci-topbar { padding: 0 1rem; }
  .hdr-actions { width: 100%; }
  .hdr-actions .hdr-btn { flex: 1; justify-content: center; }
}

/* Info items usados em admissões (view/review) */
.info-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
.info-item:last-child { margin-bottom: 0; }
.info-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.info-value { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }

@media (max-width: 768px) {
  .info-item { padding: 0.4rem 0.6rem; }
  .info-value { font-size: 0.82rem; }
  .info-label { font-size: 0.6rem; }

  .exam-list-item { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; }
  .exam-datetime { display: flex; align-items: center; gap: 0.75rem; width: 100%; }
  .exam-badge { font-size: 0.65rem; padding: 0.18rem 0.55rem; }
  .exam-time { margin-top: 0; font-size: 0.65rem; }
  .exam-discipline { font-size: 0.82rem; white-space: normal; }
}

@media (max-width: 480px) {
  .exam-list-item { padding: 0.65rem 0.85rem; }
  .exam-discipline { font-size: 0.78rem; }
  .exam-meta { font-size: 0.65rem; }
}


/* ============================================================================
   08. DROPDOWNS DA TOPBAR — complementos (ícones de ação)
   ========================================================================= */
.dd-icon.success  { background: var(--success-bg); color: var(--success); }
.dd-icon.warning  { background: var(--warning-bg); color: var(--warning); }
.dd-icon.info     { background: var(--info-bg);    color: var(--info); }
.dd-icon.primary  { background: var(--primary-bg); color: var(--primary); }
.dd-icon.secondary{ background: rgba(107, 122, 153, 0.1); color: var(--text-secondary); }

/* Badge para notificações globais */
.badge-global {
  font-size: 0.6rem;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
}

/* Badge do semestre letivo (ao lado do ano letivo na breadcrumb) */
.academic-semester-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 0.2rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.academic-semester-badge i {
  color: var(--accent);
  font-size: 0.7rem;
}

/* ============================================================================
   31. UTILITIES — backgrounds adicionais para notificações
   ========================================================================= */
.bg-primary-light   { background-color: var(--primary-bg) !important; }
.bg-secondary-light { background-color: rgba(107, 122, 153, 0.1) !important; }











/* ============================================================================
   31. UTILITIES (complementos)
   ========================================================================= */
.text-pink { color: #E84683 !important; }

/* ============================================================================
   32. [NOVO] RANKING CARDS (Dashboard)
   ========================================================================= */
.rank-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 0.4rem;
    background: var(--surface-card);
    transition: box-shadow 0.18s;
}
.rank-card:hover { box-shadow: var(--shadow-xs); }

.rank-number {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}
.rank-number.gold   { background: rgba(232,160,32,.15); color: #B07800; }
.rank-number.silver { background: rgba(107,122,153,.15); color: #6B7A99; }
.rank-number.bronze { background: rgba(149,97,56,.15);   color: #95391A; }
.rank-number.other  { background: var(--surface); color: var(--text-muted); }

.rank-info {
    flex: 1;
    min-width: 0;
}
.rank-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.rank-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.rank-score {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
    flex-shrink: 0;
}

/* Ajuste para a classe .exam-list-item.today (já parcialmente no CSS original) */
.exam-list-item.today {
    background: rgba(232, 160, 32, 0.05);
    border-left: 3px solid var(--warning);
}


/* ============================================================================
   12. FORMULÁRIOS (complementos)
   ========================================================================= */

/* Step badge (usado no header do formulário) */
.step-badge {
  background: var(--primary);
  color: #fff;
  border-radius: 50px;
  padding: 0.2rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* Preview da foto do aluno */
.photo-preview {
  max-width: 150px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  padding: 0.25rem;
  margin-top: 0.5rem;
  transition: border-color 0.18s;
}
.photo-preview:hover {
  border-color: var(--accent);
}

/* Card da pré-matrícula */
.prereg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.prereg-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--success));
}
.prereg-card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.prereg-card-header i {
  color: var(--accent);
  font-size: 1rem;
}
.prereg-card-header h5 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.prereg-card-body {
  padding: 1.25rem;
}

/* Campo somente leitura */
.readonly-field {
  background: var(--surface);
  color: var(--text-muted);
  cursor: default;
  user-select: none;
}

/* ============================================================================
   34. CURRICULUM SPECIFIC — agrupamento por curso
   ========================================================================= */

/* Linha de cabeçalho de grupo (curso) */
.ci-table tr.curriculum-course-header td {
  background: rgba(139, 92, 246, 0.06) !important;
  border-top: 2px solid rgba(139, 92, 246, 0.2) !important;
  border-bottom: 1px solid rgba(139, 92, 246, 0.12) !important;
  padding: 0.55rem 1rem !important;
}

.ci-table tr.curriculum-course-header:hover td {
  background: rgba(139, 92, 246, 0.08) !important;
}

/* Linhas de disciplina via curso — recuo à esquerda */
.ci-table tbody tr.row-course:not(.curriculum-course-header) td:first-child {
  padding-left: 2.25rem;
}
.ci-table tbody tr.row-course:not(.curriculum-course-header) {
  background: rgba(139, 92, 246, 0.018);
}
.ci-table tbody tr.row-course:not(.curriculum-course-header):hover {
  background: rgba(139, 92, 246, 0.04) !important;
}

/* Badge de curso (roxo) */
.badge-ci.course {
  background: rgba(139, 92, 246, 0.1);
  color: #8B5CF6;
}

/* Código de disciplina roxo */
.code-badge.purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8B5CF6;
}

/* Linha de edição inline (expansível) */
.ci-table tr.curriculum-inline-edit {
  display: none;
  background: rgba(59, 127, 232, 0.03);
}
.ci-table tr.curriculum-inline-edit.open {
  display: table-row;
}
.ci-table tr.curriculum-inline-edit td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

/* ============================================================================
   22. TABS & ACCORDION – complemento vertical + correção horizontal
   ========================================================================= */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1.5px solid var(--border);
  gap: 0.25rem;
}

.nav-tabs-vertical {
  display: flex;
  flex-direction: column;
  border-bottom: none;
  gap: 0;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}

.nav-tabs-vertical .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  text-align: left;
  width: 100%;
}

.nav-tabs-vertical .nav-link:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.nav-tabs-vertical .nav-link.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-bg);
  border-left-color: var(--accent);
}

.nav-tabs-vertical .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.72rem;
  opacity: 0.6;
}
.nav-tabs-vertical .nav-link:hover i,
.nav-tabs-vertical .nav-link.active i {
  opacity: 1;
  color: var(--accent);
}

.nav-tabs-vertical-header {
  padding: 0.85rem 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.nav-tabs-vertical-header .nav-tabs-vertical-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.nav-tabs-vertical .nav-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0.8rem;
}

/* ============================================================================
   35. MEDIA UPLOAD (Branding)
   ========================================================================= */
.media-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 768px) {
  .media-upload-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .media-upload-grid { grid-template-columns: 1fr; }
}

.media-box {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.2s;
}
.media-box:hover { border-color: var(--accent); }
.media-box.has-image { border-style: solid; border-color: var(--accent); }

.media-preview {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.media-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}
.media-preview .ph {
  text-align: center;
  color: var(--text-muted);
}
.media-preview .ph i {
  font-size: 1.8rem;
  opacity: 0.2;
  display: block;
  margin-bottom: 0.4rem;
}
.media-preview .ph span { font-size: 0.72rem; }

.media-preview.dark-bg {
  background: linear-gradient(135deg, #0D1B33, #1B2B4B);
}
.media-preview.dark-bg .ph { color: rgba(255,255,255,0.3); }
.media-preview.dark-bg .ph i { opacity: 0.3; }

.media-preview.favicon-bg {
  background-image: repeating-conic-gradient(#e8eaf0 0% 25%, #f5f7fc 0% 50%);
  background-size: 16px 16px;
}

.media-footer {
  padding: 0.6rem 0.8rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.media-title { font-size: 0.72rem; font-weight: 700; color: var(--text-primary); }
.media-hint  { font-size: 0.65rem; color: var(--text-muted); }
.media-actions { display: flex; gap: 0.35rem; }

.media-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font);
  transition: all 0.15s;
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  color: var(--text-secondary);
}
.media-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}
.media-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

/* ============================================================================
   36. CARDS ESPECÍFICOS (Gestão, Sistema)
   ========================================================================= */
.person-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.person-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.person-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.person-card-icon.blue  { background: var(--accent-bg);  color: var(--accent); }
.person-card-icon.green { background: var(--success-bg); color: var(--success); }
.person-card-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.person-card-sub   { font-size: 0.7rem; color: var(--text-muted); }

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--info-bg);
  border: 1px solid rgba(8,145,178,0.15);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.info-banner i { color: var(--accent); margin-top: 0.1rem; flex-shrink: 0; }

.stat-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
@media (max-width: 768px) {
  .stat-mini-grid { grid-template-columns: 1fr 1fr; }
}
.stat-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  text-align: center;
}
.stat-mini-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
  line-height: 1;
}
.stat-mini-lbl {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

/* ============================================================================
   37. TABELAS & BOTÕES DE SISTEMA
   ========================================================================= */
.sys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.sys-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.sys-table tr:last-child td { border-bottom: none; }
.sys-table td:first-child {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.76rem;
  width: 50%;
}

.sys-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
}
.sys-badge.blue  { background: var(--accent-bg);  color: var(--accent); }
.sys-badge.green { background: var(--success-bg); color: var(--success); }
.sys-badge.amber { background: var(--warning-bg); color: var(--warning); }

.sys-action-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-family: var(--font);
  width: 100%;
  margin-bottom: 0.5rem;
}
.sys-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}
.sys-action-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}
.sys-action-btn.warning:hover {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-bg);
}
.sys-action-btn i { width: 20px; text-align: center; }

/* ============================================================================
   38. UTILITÁRIOS DE FORMULÁRIO (Secção, Save Bar)
   ========================================================================= */
.sec-divider {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.4rem 0 1rem;
}
.sec-divider-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}
.sec-divider-label i {
  color: var(--accent);
  margin-right: 0.25rem;
  font-size: 0.62rem;
}
.sec-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
/* .btn-save e .btn-back já existem na secção 11, não precisam ser redeclarados */


/* ============================================================================
   36. CARDS ESPECÍFICOS – Assinatura (Signature Preview)
   ========================================================================= */
.sig-preview {
  background: linear-gradient(135deg, var(--surface) 0%, #eef1f8 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
}
.sig-line {
  border-top: 1.5px solid var(--text-primary);
  width: 180px;
  margin: 1rem 0 0.3rem;
}
.sig-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.sig-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}


/* ============================================================================
   39. WIZARD / STEPPER GENÉRICO (complemento ao 24)
   ========================================================================= */
.wiz-steps {
  display: flex;
  gap: 0;
  margin-bottom: 1.75rem;
}
.wiz-step {
  flex: 1;
  text-align: center;
  padding: 0.55rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2.5px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}
.wiz-step.active {
  color: var(--accent);
  border-color: var(--accent);
}
.wiz-step.done {
  color: var(--success);
  border-color: var(--success);
}
.wiz-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-right: 0.35rem;
  transition: background 0.2s, color 0.2s;
}
.wiz-step.active span { background: var(--accent); color: #fff; }
.wiz-step.done span   { background: var(--success); color: #fff; }

/* Painel do wizard */
.wiz-panel { display: none; animation: ci-fade-slide-in 0.22s ease; }
.wiz-panel.visible { display: block; }
@keyframes ci-fade-slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   40. MODE TABS (selecção de contexto)
   ========================================================================= */
.mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.mode-tab {
  flex: 1;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}
.mode-tab.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

/* ============================================================================
   41. SELECT HIERÁRQUICO COM SPINNER
   ========================================================================= */
.select-group { position: relative; }
.select-group .form-select-ci:disabled { opacity: 0.55; cursor: not-allowed; }
.select-spinner {
  position: absolute;
  right: 2.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ci-spin 0.7s linear infinite;
  display: none;
}
.select-group.loading .select-spinner { display: block; }

/* ============================================================================
   42. INFO PANEL (contexto fixo em edição)
   ========================================================================= */
.info-panel {
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}
.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================================
   43. DURATION DISPLAY (formulário de cursos)
   ========================================================================= */
.duration-display {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 42px;
  transition: border-color 0.3s, background 0.3s;
}
.duration-display.has-value {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.duration-display .dur-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  min-width: 2rem;
  text-align: center;
  transition: color 0.3s;
}
.duration-display .dur-value.empty {
  color: var(--text-muted);
  font-size: 1rem;
}
.duration-display .dur-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.duration-display .dur-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ============================================================================
   44. STUDENT DASHBOARD SPECIFIC
   ========================================================================= */

/* Welcome Banner */
.welcome-banner {
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--accent) 100%);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.welcome-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  flex-wrap: wrap;
  color: #fff;
}
.welcome-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.welcome-initials {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}
.welcome-text {
  min-width: 0;
  flex: 1;
}
.welcome-text h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}
.welcome-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.75rem;
  opacity: 0.75;
}
.welcome-meta span i {
  margin-right: 0.3rem;
  opacity: 0.7;
}
.welcome-status {
  flex-shrink: 0;
  text-align: right;
}
.status-pill {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-pill.active {
  background: rgba(22, 168, 125, 0.2);
  color: #16a87d;
}
.status-pill.pending {
  background: rgba(232, 160, 32, 0.2);
  color: #e8a020;
}

/* Enrollment Info Items */
.enroll-info-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  height: 100%;
}
.enroll-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.enroll-label i {
  color: var(--accent);
  margin-right: 0.25rem;
}
.enroll-info-item strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}
.enroll-info-item small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Financial Summary Boxes */
.financial-box {
  padding: 0.75rem 0.5rem;
  height: 100%;
}
.financial-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.financial-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.financial-value small {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.7;
}




/* ============================================================================
   45. TEACHER DASHBOARD SPECIFIC
   ========================================================================= */

/* Quick Action Cards */
.quick-action-card {
  display: block;
  text-align: center;
  padding: 1.25rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.25s ease;
  height: 100%;
}
.quick-action-card:hover {
  background: var(--surface-card);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  color: var(--accent);
}
.quick-action-card i {
  transition: transform 0.2s ease;
}
.quick-action-card:hover i {
  transform: scale(1.05);
}
.quick-action-card h6 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Class Card (variante de ci-card para turmas) */
.class-card .ci-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
}
.class-card .class-info > div {
  padding: 0.25rem 0;
  font-size: 0.9rem;
}
.class-card .class-info i {
  width: 1.5rem;
  text-align: center;
}

/* Ícone roxo (não existia no Design System) */
.stat-icon.purple {
  background: rgba(111, 66, 193, 0.12);
  color: #6f42c1;
}

/* Animação blink (aula em andamento) */
.blink {
  animation: ci-blink 1s infinite;
}
@keyframes ci-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}



/* Centraliza o ano letivo no header em mobile */
.topbar-year-mobile {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}