/* ============================================================================
   UPAWEB DESIGN SYSTEM v1.0
   ============================================================================
   Sistema de Design unificado para aplicações de gestão hospitalar/clínica.
   Baseado em Bootstrap 5 + Inter (Google Fonts) + FontAwesome 6.
   
   Dependências externas:
   - Google Fonts: Inter (300, 400, 500, 600, 700)
   - Bootstrap 5.3+
   - FontAwesome 6.4+
   - Select2 + Select2 Bootstrap 5 Theme (opcional)
   - SweetAlert2 (opcional)
   - Chart.js 4+ (para dashboard/gráficos)
   
   Importação:
   <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
   <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
   <link rel="stylesheet" href="css/design-system.css">
   ============================================================================ */


/* ============================================================================
   1. DESIGN TOKENS — Variáveis Globais
   ============================================================================ */

:root {
  /* ── Paleta Primária (Azul Institucional) ────────────────────────────── */
  --ds-primary:          #0B5CAA;   /* Azul principal / Oficial                */
  --ds-primary-rgb:      11, 92, 170;
  --ds-primary-soft:     #eef4f9;   /* Fundo azul ultra-claro                 */
  --ds-primary-light:    #e0f2fe;   /* Soft highlight                         */
  --ds-primary-dark:     #094a8a;   /* Hover / destaque                       */
  --ds-primary-deep:     #073869;   /* Pressed / bordas fortes                */

  /* ── Paleta Semântica ────────────────────────────────────────────────── */
  --ds-accent:           #0284c7;   /* Accent para destaques e seções         */
  --ds-success:          #10b981;   /* Verde — sucesso / positivo             */
  --ds-danger:           #f43f5e;   /* Rosa/Vermelho — erro / alerta crítico  */
  --ds-warning:          #f59e0b;   /* Amarelo — aviso / atenção              */
  --ds-info:             #0ea5e9;   /* Azul claro — informação                */
  --ds-indigo:           #6366f1;   /* Indigo — destaque especial / totais    */

  /* ── Paleta de Superfície (Light Theme) ──────────────────────────────── */
  --ds-bg-body:          #f8f9fa;   /* Fundo geral da aplicação               */
  --ds-bg-page:          #f8fafc;   /* Fundo de páginas de conteúdo           */
  --ds-bg-card:          #ffffff;   /* Fundo de cards                         */
  --ds-bg-subtle:        #f1f5f9;   /* Fundo sutil (thead, section-title)     */
  --ds-bg-submenu:       #e8f4fc;   /* Fundo de submenus colapsáveis          */

  /* ── Tipografia ──────────────────────────────────────────────────────── */
  --ds-font-family:      'Inter', system-ui, -apple-system, sans-serif;
  --ds-text-primary:     #1e293b;   /* Texto principal (títulos / corpo)      */
  --ds-text-default:     #2c3e50;   /* Texto padrão do body                   */
  --ds-text-muted:       #64748b;   /* Texto secundário / descritivo          */
  --ds-text-subtle:      #475569;   /* Labels de tabela / cabeçalhos leves    */
  --ds-text-link:        #0B5CAA;
  --ds-text-link-hover:  #094a8a;

  /* ── Bordas & Sombras ────────────────────────────────────────────────── */
  --ds-border-color:     #e2e8f0;
  --ds-border-light:     #f1f1f1;
  --ds-radius-sm:        8px;
  --ds-radius-md:        12px;
  --ds-radius-lg:        16px;
  --ds-radius-xl:        20px;
  --ds-shadow-xs:        0 1px 2px rgba(0, 0, 0, 0.05);
  --ds-shadow-sm:        0 2px 10px rgba(0, 0, 0, 0.05);
  --ds-shadow-md:        0 4px 15px rgba(0, 0, 0, 0.03);
  --ds-shadow-lg:        0 8px 25px rgba(0, 0, 0, 0.08);
  --ds-shadow-xl:        0 15px 35px rgba(52, 152, 219, 0.12);
  --ds-shadow-card:      0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --ds-shadow-card-hover:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* ── Gradientes ──────────────────────────────────────────────────────── */
  --ds-gradient-blue:    linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  --ds-gradient-pink:    linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  --ds-gradient-yellow:  linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --ds-gradient-green:   linear-gradient(135deg, #10b981 0%, #059669 100%);
  --ds-gradient-indigo:  linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --ds-gradient-login:   linear-gradient(135deg, var(--ds-primary-soft) 0%, #ffffff 100%);

  /* ── Transições ──────────────────────────────────────────────────────── */
  --ds-transition-fast:  all 0.2s ease;
  --ds-transition-base:  all 0.3s ease;
  --ds-transition-smooth:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Layout ──────────────────────────────────────────────────────────── */
  --ds-sidebar-width:    260px;
  --ds-navbar-height:    auto;

  /* ── Bootstrap Overrides ─────────────────────────────────────────────── */
  --bs-primary:          var(--ds-primary) !important;
  --bs-primary-rgb:      var(--ds-primary-rgb) !important;
  --bs-link-color:       var(--ds-text-link) !important;
  --bs-link-hover-color: var(--ds-text-link-hover) !important;
}


/* ============================================================================
   2. RESET & BASE
   ============================================================================ */

body {
  background-color: var(--ds-bg-body);
  font-family: var(--ds-font-family);
  color: var(--ds-text-default);
}


/* ============================================================================
   3. BOOTSTRAP OVERRIDES
   ============================================================================ */

.btn-primary {
  --bs-btn-bg: var(--ds-primary) !important;
  --bs-btn-border-color: var(--ds-primary) !important;
  --bs-btn-hover-bg: var(--ds-primary-dark) !important;
  --bs-btn-hover-border-color: var(--ds-primary-dark) !important;
  --bs-btn-active-bg: var(--ds-primary-deep) !important;
}

.badge.bg-primary {
  background-color: var(--ds-primary) !important;
}


/* ============================================================================
   4. UTILITÁRIOS DE COR
   ============================================================================ */

/* ── Backgrounds ───────────────────────────────────────────────────────── */
.bg-upa,
.bg-ds-primary {
  background-color: var(--ds-primary) !important;
  color: white;
}

/* ── Soft Backgrounds (para ícones KPI) ────────────────────────────────── */
.bg-soft-blue   { background-color: var(--ds-primary-light); color: #0369a1; }
.bg-soft-pink   { background-color: #ffe4e6;                 color: #be123c; }
.bg-soft-yellow { background-color: #fef3c7;                 color: #b45309; }
.bg-soft-green  { background-color: #d1fae5;                 color: #047857; }
.bg-soft-indigo { background-color: #e0e7ff;                 color: #4338ca; }

/* ── Texto ─────────────────────────────────────────────────────────────── */
.text-upa,
.text-ds-primary {
  color: var(--ds-primary-dark) !important;
}


/* ============================================================================
   5. COMPONENTE: BOTÃO UPA (Primário Custom)
   ============================================================================ */

.btn-upa {
  background-color: var(--ds-primary-dark);
  color: white;
  border: none;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--ds-radius-sm);
  transition: var(--ds-transition-base);
}

.btn-upa:hover {
  background-color: var(--ds-primary-deep);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.35);
}

/* ── Botão Relatório (Gradient Indigo) ─────────────────────────────────── */
.btn-relatorio {
  background: var(--ds-gradient-indigo);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: var(--ds-radius-md);
  font-weight: 600;
  transition: var(--ds-transition-base);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-relatorio:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.35);
  color: white;
}


/* ============================================================================
   6. COMPONENTE: LAYOUT — Sidebar + Content
   ============================================================================ */

.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  min-width: var(--ds-sidebar-width);
  max-width: var(--ds-sidebar-width);
  width: var(--ds-sidebar-width);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  align-self: flex-start;
  flex-shrink: 0;
  background-color: var(--ds-bg-card);
  border-right: 1px solid var(--ds-border-color);
  box-shadow: var(--ds-shadow-sm);
  transition: var(--ds-transition-smooth);
}

.sidebar-menu {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 24px 14px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-menu::-webkit-scrollbar {
  width: 5px;
}
.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: var(--ds-border-color);
  border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: var(--ds-text-muted);
}

.sidebar.active {
  margin-left: calc(-1 * var(--ds-sidebar-width));
}

.sidebar .sidebar-header {
  flex-shrink: 0;
  padding: 24px 20px 16px 20px;
  background: var(--ds-bg-card);
  border-bottom: none;
}

/* Brand Header Branding */
.brand-logo-container {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ds-primary) 0%, var(--ds-accent) 100%);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(11, 92, 170, 0.2);
  transition: var(--ds-transition-fast);
}

.brand-logo-icon {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.brand-logo-container--img {
  width: auto;
  max-width: 52px;
  height: auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.brand-logo-img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.navbar-brand-logo {
  height: 32px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--ds-text-primary);
  background: linear-gradient(135deg, var(--ds-primary) 0%, var(--ds-primary-deep) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ds-text-muted);
  display: block;
}

.sidebar ul p {
  color: var(--ds-text-muted);
  padding: 10px;
}

.sidebar ul li {
  margin-bottom: 2px;
  list-style: none;
}

.sidebar ul li a {
  padding: 10px 14px;
  font-size: 0.875rem; /* 14px */
  display: flex;
  align-items: center;
  color: var(--ds-text-subtle);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--ds-radius-sm);
  border-left: none;
  transition: var(--ds-transition-fast);
  gap: 10px;
}

.sidebar ul li a i,
.sidebar ul li a svg {
  color: var(--ds-text-muted);
  transition: var(--ds-transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 0 !important;
}

/* Hover state */
.sidebar ul li a:hover {
  color: var(--ds-primary);
  background: var(--ds-primary-soft);
}

.sidebar ul li a:hover i,
.sidebar ul li a:hover svg {
  color: var(--ds-primary);
  transform: translateX(1px);
}

/* Active State */
.sidebar ul li.active > a {
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--ds-primary) 0%, var(--ds-primary-dark) 100%);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(11, 92, 170, 0.15);
}

.sidebar ul li.active > a i,
.sidebar ul li.active > a svg {
  color: #ffffff !important;
}

/* ── Page Content ──────────────────────────────────────────────────────── */
#content {
  width: 100%;
  min-height: 100vh;
  transition: var(--ds-transition-base);
}


/* ============================================================================
   7. COMPONENTE: NAVBAR
   ============================================================================ */

.navbar-upa {
  background-color: var(--ds-bg-card);
  box-shadow: var(--ds-shadow-sm);
  padding: 15px 20px;
}


/* ============================================================================
   8. COMPONENTE: CARDS
   ============================================================================ */

/* ── Card Dashboard (uso geral) ────────────────────────────────────────── */
.card-dashboard {
  border: none;
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--ds-bg-card);
}

.card-dashboard:hover {
  transform: translateY(-5px);
  box-shadow: var(--ds-shadow-lg);
}

/* ── Card Dashboard Alternativo (com borda) ────────────────────────────── */
.card-dashboard--bordered {
  background: var(--ds-bg-card);
  border: 1px solid var(--ds-border-color);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-card);
  transition: var(--ds-transition-smooth);
  margin-bottom: 1rem;
}

.card-dashboard--bordered:hover {
  transform: translateY(-4px);
  box-shadow: var(--ds-shadow-card-hover);
}

/* ── Icon Box (dentro de cards) ────────────────────────────────────────── */
.icon-box {
  width: 60px;
  height: 60px;
  border-radius: var(--ds-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}


/* ============================================================================
   9. COMPONENTE: KPI CARDS (Indicadores)
   ============================================================================ */

.kpi-card {
  position: relative;
  overflow: hidden;
  border-top: 4px solid transparent;
}

/* Variações de cor por tipo */
.kpi-transfer { border-top-color: var(--ds-info);    }
.kpi-tomo     { border-top-color: var(--ds-danger);  }
.kpi-exame    { border-top-color: var(--ds-warning); }
.kpi-saida    { border-top-color: var(--ds-success); }
.kpi-total    { border-top-color: var(--ds-indigo);  }

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 1rem;
}

/* ── KPI Box (estilo relatório / print-friendly) ───────────────────────── */
.kpi-box {
  border: 1px solid var(--ds-border-color);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  background-color: var(--ds-bg-card);
}

.kpi-box .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ds-accent);
  margin-bottom: 0.25rem;
}

.kpi-box .label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ds-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ============================================================================
   10. COMPONENTE: TABELAS
   ============================================================================ */

/* ── Tabela Custom (listagens gerais) ──────────────────────────────────── */
.table-custom {
  background: var(--ds-bg-card);
  border-radius: 10px;
  overflow: visible;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.table-custom th {
  background-color: var(--ds-bg-body);
  border-bottom: 2px solid var(--ds-primary-soft);
  color: #555;
  font-weight: 600;
}

/* ── Tabela Dashboard (estatísticas) ───────────────────────────────────── */
.table-dash {
  color: var(--ds-text-primary);
  font-size: 0.9rem;
}

.table-dash thead th {
  background: var(--ds-bg-subtle);
  color: var(--ds-text-subtle);
  border-bottom: 2px solid var(--ds-border-color);
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.75rem;
}

/* ── Tabela Relatório (impressão) ──────────────────────────────────────── */
.table-report {
  font-size: 0.85rem;
}

.table-report thead th {
  background-color: var(--ds-bg-page);
  border-bottom: 2px solid var(--ds-border-color);
  color: var(--ds-text-subtle);
}

/* ── Ações em Tabela ───────────────────────────────────────────────────── */
.actions-cell {
  min-width: 140px;
  white-space: nowrap;
}

.actions-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.actions-group .btn {
  margin-left: 0 !important;
}


/* ============================================================================
   11. COMPONENTE: FORMULÁRIOS
   ============================================================================ */

.form-control:focus,
.form-select:focus {
  border-color: var(--ds-primary-dark);
  box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.22);
}

/* ── Formulários do Dashboard (filtros) ────────────────────────────────── */
.form-select-dash,
.form-control-dash {
  background-color: var(--ds-bg-card) !important;
  border: 1px solid var(--ds-border-color) !important;
  color: var(--ds-text-primary) !important;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

/* ── Painel de Filtros ─────────────────────────────────────────────────── */
.filter-panel {
  background: var(--ds-bg-card);
  border: 1px solid var(--ds-border-color);
  border-radius: var(--ds-radius-md);
  padding: 1.25rem;
  box-shadow: var(--ds-shadow-xs);
}


/* ============================================================================
   12. COMPONENTE: LOGIN
   ============================================================================ */

.login-page {
  margin: 0;
  min-height: 100vh;
  background: var(--ds-bg-card);
  font-family: var(--ds-font-family);
}

/* Layout split: foto (esquerda) + formulário (direita) */
.login-split {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.login-split__hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  background: var(--ds-primary-deep);
}

.login-split__hero-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  object-position: left center;
}

.login-split__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.75rem 2rem;
  background: var(--ds-bg-card);
}

.login-split__form {
  width: 100%;
  max-width: 400px;
}

.login-split__logo {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
}

.login-split__brand-label {
  letter-spacing: 0.12em;
}

.login-split__compliance {
  line-height: 1.5;
  opacity: 0.85;
}

@media (min-width: 992px) {
  .login-split {
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
    grid-template-rows: 1fr;
  }

  .login-split__hero {
    min-height: 100vh;
    order: 0;
  }

  .login-split__hero-img {
    min-height: 100vh;
    /* Foca na cena e no logo; a área clara da arte fica na junção com o painel */
    object-position: 18% center;
  }

  .login-split__panel {
    order: 1;
    padding: 3rem 3.5rem;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.06);
    position: relative;
    z-index: 1;
  }

  .login-split__panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(
      180deg,
      transparent 0%,
      var(--ds-border-color) 15%,
      var(--ds-border-color) 85%,
      transparent 100%
    );
  }
}

@media (min-width: 1400px) {
  .login-split {
    grid-template-columns: 1.15fr 1fr;
  }

  .login-split__form {
    max-width: 420px;
  }

  .login-split__logo {
    max-width: 340px;
  }
}

/* Layout legado (cadastro e telas antigas) */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-gradient-login);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 3rem 2rem;
  border-radius: var(--ds-radius-xl);
  box-shadow: var(--ds-shadow-xl);
  background-color: var(--ds-bg-card);
  border: none;
  text-align: center;
}

.login-logo {
  width: 450px;
  margin-bottom: 2rem;
}


/* ============================================================================
   13. COMPONENTE: DASHBOARD CONTAINER
   ============================================================================ */

.dashboard-container {
  background-color: var(--ds-bg-page);
  padding: 2rem;
  min-height: calc(100vh - 70px);
}

/* ── Section Header (títulos de seção com barra lateral) ───────────────── */
.section-header {
  border-left: 5px solid var(--ds-accent);
  padding-left: 1rem;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
}

/* ── Section Title (estilo relatório) ──────────────────────────────────── */
.section-title {
  background-color: var(--ds-bg-subtle);
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--ds-accent);
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  font-size: 0.85rem;
}

/* ── Chart Container ───────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-container-sm {
  height: 200px;
  margin-bottom: 1rem;
}

/* ── Chart Help Text ───────────────────────────────────────────────────── */
.chart-help {
  color: var(--ds-text-muted);
  font-size: 0.8rem;
  margin-top: -0.5rem;
  margin-bottom: 0.75rem;
}


/* ============================================================================
   14. COMPONENTE: BADGES DE TURNO
   ============================================================================ */

.badge-diurno {
  background-color: #fef9c3;
  color: #854d0e;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-noturno {
  background-color: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}


/* ============================================================================
   15. COMPONENTE: RELATÓRIO (Print-Ready)
   ============================================================================ */

.report-wrapper {
  background-color: var(--ds-bg-card);
  min-height: 100vh;
  padding: 3rem;
  margin: 2rem auto;
  max-width: 1100px;
  border-radius: var(--ds-radius-md);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.report-header {
  border-bottom: 2px solid var(--ds-accent);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}


/* ============================================================================
   16. RESPONSIVIDADE
   ============================================================================ */

@media (max-width: 768px) {
  .sidebar {
    margin-left: calc(-1 * var(--ds-sidebar-width));
  }

  .sidebar.active {
    margin-left: 0;
  }

  #sidebarCollapse span {
    display: none;
  }

  .table-responsive.table-custom {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
  }

  .table-responsive .table {
    min-width: 640px;
  }

  .actions-cell {
    min-width: 160px;
  }

  .dashboard-container {
    padding: 1rem;
  }

  .filter-panel {
    padding: 1rem;
  }

  #filtro-form .col-auto {
    width: 100%;
  }

  #filtro-form .form-select-dash,
  #filtro-form .form-control-dash,
  #filtro-form .btn {
    width: 100%;
  }

  #filtro-custom {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  #filtro-custom > div {
    min-width: 0;
  }

  .btn-relatorio {
    width: 100%;
  }
}


/* ============================================================================
   17. PRINT STYLES
   ============================================================================ */

@media print {
  .no-print { display: none !important; }

  body {
    background-color: white !important;
    margin: 0;
    padding: 0;
  }

  .report-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1cm !important;
    box-shadow: none !important;
    border: none !important;
  }

  .section-title {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background-color: var(--ds-bg-subtle) !important;
    border-left: 4px solid var(--ds-accent) !important;
  }

  .kpi-box {
    border: 1px solid var(--ds-border-color) !important;
  }

  .chart-container,
  .chart-container-sm {
    page-break-inside: avoid;
  }

  @page {
    margin: 1cm;
    size: A4 portrait;
  }
}


/* ============================================================================
   18. CHART.JS — Configuração de Tema (usar via JavaScript)
   ============================================================================
   
   Aplique no seu JS antes de criar os gráficos:
   
   Chart.defaults.color        = '#64748b';       // var(--ds-text-muted)
   Chart.defaults.borderColor  = '#e2e8f0';       // var(--ds-border-color)
   Chart.defaults.font.family  = "'Inter', sans-serif";
   
   Paleta de cores para datasets:
   
   const DS_CHART_COLORS = {
     blue:          '#0ea5e9',
     blueAlpha:     'rgba(14, 165, 233, 0.1)',
     pink:          '#f43f5e',
     pinkAlpha:     'rgba(244, 63, 94, 0.1)',
     yellow:        '#f59e0b',
     yellowAlpha:   'rgba(245, 158, 11, 0.1)',
     green:         '#10b981',
     greenAlpha:    'rgba(16, 185, 129, 0.1)',
     indigo:        '#6366f1',
     indigoAlpha:   'rgba(99, 102, 241, 0.1)',
   };
   
   Tooltip padrão (light theme):
   
   const DS_TOOLTIP = {
     backgroundColor: '#ffffff',
     titleColor:      '#1e293b',
     bodyColor:       '#475569',
     borderColor:     '#e2e8f0',
     borderWidth:     1,
     padding:         10,
     cornerRadius:    8,
     titleFont:       { weight: 'bold' },
   };
   
   ============================================================================ */


/* ============================================================================
   19. GESTÃO ESCOLA — Componentes Adicionais
   ============================================================================ */

/* ── Lucide Icon Sizes ─────────────────────────────────────────────────── */
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 22px; height: 22px; }
.icon-lg { width: 28px; height: 28px; }

/* ── User Avatar (Navbar) ──────────────────────────────────────────────── */
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ds-gradient-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid var(--ds-primary-light);
  transition: var(--ds-transition-fast);
}

.user-avatar:hover {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px rgba(11, 92, 170, 0.15);
}

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

.user-avatar-initials {
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

/* ── Login Icon Wrapper ────────────────────────────────────────────────── */
.login-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--ds-primary-light);
}

/* ── App Footer ────────────────────────────────────────────────────────── */
.app-footer {
  background-color: var(--ds-bg-card);
  border-top: 1px solid var(--ds-border-color);
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
}

/* ── Sidebar Overlay (Mobile) ──────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ── Sidebar Extras ────────────────────────────────────────────────────── */
.sidebar-divider {
  border-top: 1px solid var(--ds-border-color);
  margin: 12px 10px;
  list-style: none;
  opacity: 0.6;
}

.sidebar-section-title {
  padding: 8px 14px 4px 14px;
  list-style: none;
}

.sidebar-section-title small {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ds-text-muted);
  opacity: 0.8;
}

/* ── Sidebar Collapsed (Desktop) ───────────────────────────────────────── */
.sidebar.collapsed {
  min-width: 0;
  max-width: 0;
  overflow: hidden;
}

/* ── Dropdown Menu Enhancements ────────────────────────────────────────── */
.dropdown-menu {
  border-radius: var(--ds-radius-md);
  border: 1px solid var(--ds-border-color);
  padding: 0.5rem 0;
}

.dropdown-item {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  transition: var(--ds-transition-fast);
}

.dropdown-item:hover {
  background-color: var(--ds-primary-soft);
}


/* ============================================================================
   20. RESPONSIVIDADE ESTENDIDA (Mobile → TV 85")
   ============================================================================ */

@media (max-width: 576px) {
  .login-split__panel {
    padding: 2rem 1.25rem 1.5rem;
  }

  .login-split__hero {
    min-height: 180px;
  }

  .login-split__hero-img {
    min-height: 180px;
    object-position: 22% center;
  }

  .login-card {
    margin: 1rem;
    padding: 2rem 1.5rem;
  }

  .sidebar {
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    height: 100vh;
    margin-left: calc(-1 * var(--ds-sidebar-width));
  }

  .sidebar.active {
    margin-left: 0;
  }
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    height: 100vh;
    margin-left: calc(-1 * var(--ds-sidebar-width));
  }

  .sidebar.active {
    margin-left: 0;
  }

  .navbar-brand span {
    font-size: 0.95rem;
  }
}

@media (min-width: 1920px) {
  html { font-size: 17px; }

  .dashboard-container {
    padding: 2.5rem 3rem;
    max-width: 1800px;
    margin: 0 auto;
  }
}

@media (min-width: 2560px) {
  html { font-size: 20px; }

  :root {
    --ds-sidebar-width: 320px;
  }

  .dashboard-container {
    padding: 3rem 4rem;
    max-width: 2400px;
  }

  .user-avatar {
    width: 48px;
    height: 48px;
  }

  .kpi-icon {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
}

@media (min-width: 3840px) {
  html { font-size: 24px; }

  :root {
    --ds-sidebar-width: 400px;
  }

  .dashboard-container {
    padding: 4rem 5rem;
    max-width: 3400px;
  }

  .login-card {
    max-width: 600px;
    padding: 4rem 3rem;
  }
}
