/* ==========================================================================
   DESIGN SYSTEM INSTITUCIONAL - AEB (Associação dos Estudantes de Batatais)
   Sistema Corporativo de Gestão de Presença & Transporte Universitário
   Estilo Profissional, Limpo, Sério e Moderno (Sem Emojis, 100% SVG)
   ========================================================================== */

:root {
  color-scheme: light;

  /* Brand Colors - Paleta Oficial AEB */
  --primary-950: #061020;
  --primary-900: #0b1a30; /* Azul Marinho Corporativo */
  --primary-800: #0d2850;
  --primary-700: #005fa8; /* Azul Royal Institucional */
  --primary-600: #0082cb; /* Azul Vibrante AEB */
  --primary-500: #009fe3; /* Azul Turquesa AEB */
  --primary-400: #38bdf8;
  --primary-300: #7dd3fc;
  --primary-200: #bae6fd;
  --primary-100: #e0f2fe;
  --primary-50:  #f0f9ff;

  /* Semantic Colors */
  --success-800: #166534;
  --success-700: #15803d;
  --success-600: #16a34a;
  --success-100: #dcfce7;
  --success-50:  #f0fdf4;
  
  --warning-800: #9a3412;
  --warning-600: #ea580c;
  --warning-100: #ffedd5;
  --warning-50:  #fff7ed;
  
  --danger-800:  #991b1b;
  --danger-700:  #b91c1c;
  --danger-600:  #dc2626;
  --danger-100:  #fee2e2;
  --danger-50:   #fef2f2;

  /* Neutrais Corporativos */
  --neutral-950: #090e17;
  --neutral-900: #0f172a;
  --neutral-800: #1e293b;
  --neutral-700: #334155;
  --neutral-600: #475569;
  --neutral-500: #64748b;
  --neutral-400: #94a3b8;
  --neutral-300: #cbd5e1;
  --neutral-200: #e2e8f0;
  --neutral-100: #f1f5f9;
  --neutral-50:  #f8fafc;
  --white:       #ffffff;

  /* Superfícies & Textos */
  --bg-app:        #f4f7fa;
  --bg-primary:    #ffffff;
  --bg-secondary:  #f8fafc;
  --bg-tertiary:   #f1f5f9;
  --bg-card-hover: #f0f7ff;
  
  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-tertiary:  #64748b;
  
  --border-color:       #d8e2ec;
  --border-color-light: #e8eef5;
  --border-color-dark:  #cbd5e1;

  /* Tipografia */
  --font-family-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Raios */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  
  /* Espaçamentos */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  
  /* Sombras Sutis e Profissionais */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 24px -4px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 30px -6px rgba(11, 26, 48, 0.16);
  --shadow-2xl: 0 25px 50px -12px rgba(11, 26, 48, 0.25);
  
  /* Transições */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  
  --z-dropdown: 100;
  --z-modal: 9999;
}

/* ==========================================
   RESET & BASE
   ========================================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-app);
  color-scheme: light !important;
}

body {
  margin: 0;
  padding: 24px 20px 80px;
  font-family: var(--font-family-base);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
  min-height: 100vh;
  color-scheme: light !important;
}

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ==========================================
   HEADER INSTITUCIONAL (PROFISSIONAL & SÉRIO)
   ========================================== */

.app-header {
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-800) 55%, var(--primary-700) 100%);
  color: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-4);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.header-main {
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 18px;
}

.aeb-header-logo-wrap {
  background: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.aeb-header-logo {
  height: 44px;
  max-width: 130px;
  width: auto;
  display: block;
  object-fit: contain;
}

.header-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.version-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #86efac;
  background: rgba(22, 163, 74, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(134, 239, 172, 0.3);
}

.dot-online {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--white);
  line-height: 1.2;
}

.header-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

/* Painel de Usuário no Header */
.header-user-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}

.user-info-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

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

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
}

.user-role-tag {
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  vertical-align: middle;
}

.nav-action-btn svg {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.nav-action-btn span {
  display: inline-block;
  line-height: 1;
}

.nav-action-btn:hover {
  color: var(--primary-300);
  background: rgba(255, 255, 255, 0.08);
}

.nav-action-btn.admin-return {
  background: rgba(220, 38, 38, 0.25);
  color: #fecaca;
}

.nav-action-btn.logout:hover {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.15);
}

/* Barra de Contexto (Data, Cidade, Rota) */
.header-context-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 24px;
  background: rgba(0, 0, 0, 0.22);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  flex-wrap: wrap;
}

.context-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.context-item svg {
  opacity: 0.85;
  color: var(--primary-300);
}

.context-divider {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================
   PAINEL UNIFICADO DA ROTA & CONTROLES
   ========================================== */

/* Banner Superior de Compartilhamento GPS */
.route-gps-sharing-banner {
  margin-bottom: 12px;
}

.route-panel-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 14px;
  overflow: hidden;
}

.route-overview-row {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: nowrap;
}

.route-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-section-title h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f172a;
}

.route-personnel-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap;
}

.personnel-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
}

.pill-label {
  color: #64748b;
  font-weight: 600;
}

.pill-value {
  color: #0f172a;
  font-weight: 700;
}

/* Linha de Ações e Abas */
.route-controls-row {
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  background: #ffffff;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* Abas Pílula Segmentada (Fundo cinza claro, ativo branco com sombra) */
.seg {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  gap: 2px;
}

.seg button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  border-radius: 999px;
}

.seg button:hover {
  color: #0f172a;
}

.seg button.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.assigned-route-pill {
  font-size: 12.5px;
  color: #0f172a;
  font-weight: 700;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* ==========================================
   SELECTS & CAMPOS
   ========================================== */

select,
.rota-select,
.fac-select,
.manage-select {
  background-color: #ffffff !important;
  color: var(--text-primary) !important;
  border: 1.5px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  font-family: inherit;
}

select option,
.rota-select option,
.fac-select option,
.manage-select option {
  background-color: #ffffff !important;
  color: var(--text-primary) !important;
}

select:hover,
.rota-select:hover,
.fac-select:hover,
.manage-select:hover {
  border-color: var(--primary-500);
}

select:focus,
.rota-select:focus,
.fac-select:focus,
.manage-select:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(0, 130, 203, 0.15);
}

/* ==========================================
   BOTÕES INSTITUCIONAIS AEB (MINIMALISTAS & PÍLULA)
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  font-family: inherit;
  user-select: none;
  white-space: nowrap;
}

.btn svg {
  flex-shrink: 0;
}

.btn:hover {
  color: var(--primary-600);
  background: transparent;
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: #005fa8;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  box-shadow: 0 2px 6px rgba(0, 95, 168, 0.25);
}

.btn.primary:hover {
  background: #0082cb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 130, 203, 0.35);
  transform: translateY(-1px);
}

.btn.danger {
  background: transparent;
  color: var(--danger-600);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn.danger:hover {
  color: var(--primary-600);
  background: transparent;
}

.btn.danger svg {
  transition: transform 0.35s ease;
}

.btn.danger:hover svg {
  transform: rotate(360deg);
}

.btn.ghost {
  background: transparent;
  border: none;
  color: var(--text-primary);
}

.btn.ghost:hover {
  color: var(--primary-600);
  background: transparent;
}

.btn.edit-btn {
  background: transparent;
  color: var(--primary-700);
  border: none;
}

.btn.edit-btn:hover {
  color: var(--primary-500);
  background: transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================
   CARDS DE RESUMO & ESTATÍSTICAS
   ========================================== */

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.sum-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.sum-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.sum-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sum-info {
  display: flex;
  flex-direction: column;
}

.sum-card .num {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.sum-card .lbl {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 3px;
}

/* Título de Seção Paradas de Hoje */
.section-heading-row {
  margin: 20px 0 10px 0;
}

.section-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

/* ==========================================
   CARDS DE PONTOS DE EMBARQUE
   ========================================== */

.stop-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stop-card:hover {
  border-color: #cbd5e1;
}

.stop-head {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #ffffff;
  user-select: none;
  gap: 12px;
  transition: background-color var(--transition-fast);
}

.stop-head:hover {
  background: #f8fafc;
}

.stop-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.stop-idx {
  background: #0284c7;
  color: #ffffff;
  font-weight: 800;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
}

.stop-name {
  font-weight: 800;
  font-size: 13.5px;
  color: #0f172a;
}

.stop-sentido-tag {
  background: #f1f5f9;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 6px;
  border: 1px solid #e2e8f0;
  text-transform: uppercase;
  margin-left: 4px;
}

.stop-center-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.stop-center-info svg {
  color: #94a3b8;
}

.stop-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.badge-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.badge-count-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.badge-count-pill .caret {
  transition: transform var(--transition-base);
  color: #64748b;
}

.stop-card.open .badge-count-pill .caret {
  transform: rotate(90deg);
}

.btn-select-ponto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-select-ponto:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.btn-select-ponto.selected {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.stop-card.open .caret {
  transform: rotate(90deg);
}

.stop-body {
  display: none;
  padding: 6px 18px 14px;
  border-top: 1px solid var(--border-color-light);
  background: var(--bg-secondary);
}

.stop-card.open .stop-body {
  display: block;
}

/* Linha de Aluno */
.student-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  margin: 4px 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.student-row:hover {
  border-color: var(--primary-300);
}

.student-row.present {
  background: var(--success-50);
  border-color: var(--success-100);
}

.check {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid var(--border-color-dark);
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.check:hover {
  border-color: var(--primary-600);
}

.student-row.present .check {
  background: var(--success-600);
  border-color: var(--success-600);
}

.check svg {
  width: 12px;
  height: 12px;
  display: none;
  color: #ffffff;
}

.student-row.present .check svg {
  display: block;
}

.stud-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  color: var(--text-primary);
  padding: 2px 4px;
}

.stud-name-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stud-name:focus {
  background: #ffffff;
  border: 1px solid var(--primary-500);
}

/* Card com ponto selecionado pelo usuário */
.stop-card.my-stop-selected {
  border-color: var(--primary-500);
  box-shadow: 0 2px 8px rgba(0, 95, 168, 0.12);
  position: relative;
}

.stop-card.my-stop-selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary-600);
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.my-stop-badge {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #bae6fd;
  white-space: nowrap;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Botão de Selecionar Ponto */
.btn-select-ponto {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 140px;
  height: 30px;
  box-sizing: border-box;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary-300);
  background: #f0f7ff;
  color: var(--primary-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.btn-select-ponto:hover {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.btn-select-ponto:active {
  transform: translateY(0);
}

.btn-select-ponto.selected {
  background: #10b981;
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-select-ponto.selected:hover {
  background: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.25);
}

/* Badge Você */
.badge-you {
  background: var(--primary-700);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-block;
  vertical-align: middle;
}

.student-row.is-me-row {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.student-row.is-me-row.present {
  background: var(--success-50);
  border-color: var(--success-200);
}

.action-rm-me {
  color: var(--text-tertiary);
}

.action-rm-me:hover {
  color: var(--danger-600);
  background: var(--danger-50);
}

.fac-select {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.fac-tag {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  color: #ffffff;
  user-select: none;
}

.action-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.action-icon-btn:hover {
  background: var(--danger-50);
  color: var(--danger-600);
}

/* Adicionar Aluno / Ponto */
.add-student-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.add-student-row input {
  flex: 1;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px dashed var(--primary-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
  outline: none;
  font-family: inherit;
  color: var(--text-primary);
}

.add-student-row input:focus {
  border-style: solid;
  border-color: var(--primary-600);
}

.add-student-row button {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-300);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.add-student-row button:hover {
  background: var(--primary-100);
  border-color: var(--primary-600);
}

.add-stop {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  background: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.add-stop input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.add-stop input:focus {
  border-color: var(--primary-600);
  background: #ffffff;
}

/* ==========================================
   MODAIS & FORMULÁRIOS
   ========================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 26, 48, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 460px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.modal-head {
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-800) 60%, var(--primary-700) 100%);
  color: var(--white);
  padding: 20px 24px;
  text-align: center;
  position: relative;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.85);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 24px;
  background: #ffffff;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
}

.input-wrap input:hover {
  border-color: var(--primary-400);
}

.input-wrap input:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(0, 130, 203, 0.15);
  background: #ffffff;
}

.toggle-pwd {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-pwd:hover {
  color: var(--primary-600);
}

.login-error {
  display: none;
  background: var(--danger-50);
  border: 1px solid var(--danger-600);
  color: var(--danger-800);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 13.5px;
}

.auth-modal-logo-wrap {
  background: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-modal-logo {
  max-width: 140px;
  height: auto;
  display: block;
}

/* Cards de Gerenciamento de Rota */
.rota-card-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rota-name-input {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary) !important;
  background: var(--bg-secondary) !important;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  flex: 1;
  margin-right: 8px;
  outline: none;
}

.rota-name-input:focus {
  border-color: var(--primary-600);
  background: #ffffff !important;
}

.form-label-sm {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 700;
  display: block;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.manage-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff !important;
  color: var(--text-primary) !important;
}

/* Tabelas em Modais */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 10px;
}

.users-table th {
  background: var(--bg-secondary);
  text-align: left;
  padding: 8px 10px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}

.users-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color-light);
  vertical-align: middle;
  color: var(--text-primary);
}

.user-route-badge {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status & Overlays */
.loading-overlay {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: var(--space-5);
  text-align: center;
  font-weight: 700;
  color: var(--primary-700);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-xs);
}

/* ==========================================
   RODAPÉ OFICIAL AEB (LIMPO)
   ========================================== */

.aeb-footer {
  margin-top: var(--space-8);
  padding: var(--space-6) 0 0;
  border: none;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.aeb-footer-main {
  padding: 0 0 var(--space-5) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.aeb-footer-info {
  flex: 1;
  min-width: 240px;
}

.aeb-footer-title {
  margin: 0 0 6px 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.aeb-footer-address {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.aeb-footer-social {
  display: flex;
  align-items: center;
  gap: 12px;
}

.social-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.social-icon-btn svg {
  pointer-events: none;
}

.social-icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.social-icon-btn.whatsapp {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.social-icon-btn.whatsapp:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.social-icon-btn.instagram {
  color: #c026d3;
  background: #fdf4ff;
  border-color: #f5d0fe;
}

.social-icon-btn.instagram:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d946ef 50%, #6366f1 100%);
  color: #ffffff;
  border-color: transparent;
}

.aeb-footer-bottom {
  padding: 16px 0 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  background: transparent;
}

.aeb-footer-bottom p {
  margin: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ==========================================
   RESPONSIVIDADE
   ========================================== */

@media (max-width: 768px) {
  body {
    padding: 10px 8px 50px;
  }

  .wrap {
    padding: 0 2px;
    width: 100%;
  }

  .header-main {
    padding: 16px 14px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  .header-branding {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    width: 100%;
  }

  .aeb-header-logo-wrap {
    width: auto;
    max-width: 140px;
    height: auto;
    padding: 6px 14px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.6);
  }

  .aeb-header-logo {
    height: 40px;
    max-width: 115px;
    width: auto;
    display: block;
    object-fit: contain;
  }

  .header-title-block {
    align-items: center;
    text-align: center;
  }

  .header-title {
    font-size: 16px;
    text-align: center;
  }

  .header-subtitle {
    font-size: 11.5px;
    text-align: center;
  }

  .header-user-panel {
    width: 100%;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 12px;
  }

  .user-info-card {
    justify-content: center;
    align-items: center;
  }

  .header-nav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: center;
  }

  .nav-action-btn {
    flex: 0 1 auto;
    text-align: center;
    padding: 6px 12px;
    font-size: 11.5px;
  }

  .header-context-bar {
    padding: 10px 12px;
    font-size: 11.5px;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }

  .context-divider {
    display: none;
  }

  .context-item {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .route-overview-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 14px;
    gap: 10px;
  }

  .card-section-title {
    justify-content: center;
    text-align: center;
  }

  .route-personnel-group {
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .route-controls-row {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .controls-left {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .seg {
    width: 100%;
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 4px;
    border: 1px solid var(--border-color);
  }

  .seg button {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 11.5px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
  }

  .seg button.active {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .rota-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
  }

  .controls-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-left: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
  }

  .controls-right .btn {
    width: 100%;
    justify-content: center;
    padding: 9px 6px;
    font-size: 11.5px;
    white-space: nowrap;
    border-radius: 8px;
  }

  .controls-right .btn.ghost {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
  }

  .controls-right .btn.ghost:hover {
    background: var(--primary-50);
    color: var(--primary-600);
  }

  .controls-right .btn.danger {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--danger-600);
  }

  .controls-right .btn.danger:hover {
    background: var(--primary-50);
    color: var(--primary-600);
  }

  .controls-right #gen-report,
  .controls-right .btn.primary {
    grid-column: 1 / -1;
    background: #005fa8 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 700;
    padding: 10px 14px;
    box-shadow: 0 2px 6px rgba(0, 95, 168, 0.25);
  }

  .controls-right #gen-report:hover,
  .controls-right .btn.primary:hover {
    background: #0082cb !important;
    color: #ffffff !important;
  }

  .summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .sum-card {
    padding: 10px 8px;
  }

  .sum-card .num {
    font-size: 20px;
  }

  .sum-card .lbl {
    font-size: 10px;
  }

  .fac-legend {
    padding: 8px 10px;
    gap: 8px;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .stop-head {
    padding: 12px 10px;
    gap: 8px;
  }

  .stop-head-left {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .stop-idx {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .stop-name,
  .stop-name-edit {
    font-size: 13.5px;
    width: 100%;
  }

  .stop-meta {
    gap: 4px;
    flex-shrink: 0;
  }

  .badge-count {
    font-size: 11px;
    padding: 2px 6px;
  }

  .stop-body {
    padding: 10px 10px 14px;
  }

  .student-row {
    padding: 8px 8px;
    gap: 6px;
  }

  .stud-name {
    font-size: 12.5px;
    min-width: 0;
  }

  .fac-tag,
  .fac-select {
    font-size: 10px;
    padding: 2px 6px;
  }

  .add-student-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .add-student-row input,
  .add-student-row button {
    width: 100%;
  }

  .add-stop {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 10px;
    gap: 10px;
  }

  .add-stop input {
    width: 100%;
    font-size: 13px;
    padding: 10px 12px;
  }

  .add-stop button {
    width: 100%;
    padding: 10px;
    font-size: 13px;
  }

  .aeb-footer {
    padding: 20px 14px 14px;
    margin-top: 24px;
  }

  .aeb-footer-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .aeb-footer-social {
    width: 100%;
    justify-content: flex-start;
  }

  .modal-card {
    width: 95% !important;
    max-width: 95% !important;
    padding: 0 !important;
    margin: 10px auto;
  }

  .modal-body {
    padding: 14px !important;
  }
}

/* ==========================================
   TOAST NOTIFICATIONS (Substituição de alert)
   ========================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 400px;
  background: #ffffff;
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px -4px rgba(11, 26, 48, 0.2), 0 4px 8px -2px rgba(11, 26, 48, 0.08);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.toast-success {
  border-left: 4px solid var(--success-600);
}

.toast.toast-error {
  border-left: 4px solid var(--danger-600);
}

.toast.toast-info {
  border-left: 4px solid var(--primary-600);
}

.toast-icon {
  flex-shrink: 0;
}

.toast.toast-success .toast-icon {
  color: var(--success-600);
}

.toast.toast-error .toast-icon {
  color: var(--danger-600);
}

.toast.toast-info .toast-icon {
  color: var(--primary-600);
}

.toast-msg {
  flex: 1;
}

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

.toast.toast-fadeout {
  opacity: 0;
  transform: translateY(8px) scale(0.95);
}

/* ========================================================================== */
/* OTIMIZAÇÃO E RESPONSIVIDADE MOBILE & TABLETS (AEB TRANSPORTE)             */
/* ========================================================================== */

@media (max-width: 900px) {
  .wrap {
    padding: 0 8px;
  }
  
  .route-overview-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .route-personnel-group {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 16px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px 8px 60px;
  }

  .wrap {
    padding: 0;
  }

  /* Cabeçalho */
  .app-header {
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
  }

  .header-main {
    padding: 14px 14px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-branding {
    gap: 12px;
    align-items: center;
  }

  .aeb-header-logo-wrap {
    padding: 4px 10px;
  }

  .aeb-header-logo {
    height: 36px;
    max-width: 105px;
  }

  .header-title {
    font-size: 15px;
    line-height: 1.25;
  }

  .header-subtitle {
    font-size: 11.5px;
  }

  .header-user-panel {
    width: 100%;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    flex-wrap: wrap;
    gap: 8px;
  }

  .user-info-card {
    padding-right: 6px;
    border-right: none;
  }

  .user-name {
    font-size: 12px;
  }

  .user-role-tag {
    font-size: 9px;
  }

  .header-nav-actions {
    gap: 4px;
    flex-wrap: wrap;
  }

  .nav-action-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .header-context-bar {
    padding: 8px 12px;
    gap: 6px 12px;
    font-size: 11px;
    justify-content: space-between;
  }

  .context-divider {
    display: none;
  }

  /* Painel Principal da Rota */
  .route-panel-card {
    border-radius: var(--radius-md);
    margin-bottom: 12px;
  }

  .route-overview-row {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .route-title-group {
    justify-content: space-between;
    width: 100%;
  }

  .route-personnel-group {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: flex-start;
  }

  .personnel-pill {
    font-size: 12px;
  }

  .route-controls-row {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .controls-left {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
  }

  .seg button {
    text-align: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
  }

  .seg button.active {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .rota-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
  }

  .assigned-route-pill {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    font-size: 12px;
    padding: 6px 10px;
  }

  .controls-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-left: 0;
  }

  #expand-all,
  #gen-report {
    width: 100%;
    justify-content: center;
    padding: 9px 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 11.5px;
    font-weight: 700;
  }

  #expand-all {
    grid-column: span 1;
  }

  #gen-report {
    grid-column: span 1;
  }

  /* Estatísticas / Resumo */
  .summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .sum-card {
    padding: 10px 8px;
  }

  .sum-card .num {
    font-size: 18px;
  }

  .sum-card .lbl {
    font-size: 10px;
  }

  .fac-legend {
    padding: 8px 10px;
    gap: 6px 10px;
    font-size: 11px;
    margin-bottom: 12px;
  }

  /* Cards de Pontos */
  .stop-card {
    border-radius: var(--radius-md);
    margin-bottom: 8px;
  }

  .stop-head {
    padding: 10px 10px;
    gap: 8px;
  }

  .stop-head-left {
    gap: 8px;
    flex: 1;
  }

  .stop-idx {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .stop-name {
    font-size: 13.5px;
    word-break: break-word;
  }

  .stop-meta {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .btn-select-ponto {
    width: auto;
    min-width: 85px;
    height: 28px;
    padding: 0 6px;
    font-size: 11px;
  }

  .badge-count {
    min-width: 46px;
    height: 28px;
    font-size: 11px;
    padding: 0 5px;
  }

  .stop-body {
    padding: 6px 8px 10px;
  }

  /* Linhas de Aluno */
  .student-row {
    padding: 7px 8px;
    gap: 6px;
    margin: 3px 0;
  }

  .check {
    width: 22px;
    height: 22px;
  }

  .stud-name {
    font-size: 12.5px;
  }

  .fac-tag,
  .fac-select {
    font-size: 10px;
    padding: 2px 5px;
  }

  .action-icon-btn {
    width: 26px;
    height: 26px;
    padding: 2px;
  }

  /* Adicionar Ponto */
  .add-stop {
    flex-direction: column;
    gap: 8px;
    padding: 12px 10px;
  }

  .add-stop input {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
  }

  .add-stop button {
    width: 100%;
    padding: 10px;
    font-size: 13px;
  }

  /* Modais no Mobile */
  .modal-backdrop {
    padding: 8px;
    align-items: center;
  }

  .modal-card {
    width: 96% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    margin: auto;
    border-radius: var(--radius-lg);
  }

  .modal-head {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 14px 16px;
  }

  /* Rodapé */
  .aeb-footer {
    margin-top: 24px;
    padding: 16px 12px 12px;
  }

  .aeb-footer-main {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .aeb-footer-address {
    text-align: center;
  }

  .aeb-footer-social {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .header-title {
    font-size: 14px;
  }

  .header-subtitle {
    font-size: 11px;
  }

  .stop-head {
    flex-wrap: wrap;
  }

  .stop-head-left {
    width: 100%;
  }

  .stop-meta {
    width: 100%;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--border-color-light);
  }

  .btn-select-ponto {
    flex: 1;
  }

  .badge-count {
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   ESTILOS DO MÓDULO DE MAPA INTERATIVO E RASTREAMENTO GPS (LEAFLET)
   ========================================================================== */

/* Botão VER ÔNIBUS NO MAPA */
.btn-ver-mapa-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #0f172a;
  border: none;
  font-weight: 700;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.btn-ver-mapa-action:hover {
  background: #f1f5f9;
  color: #0284c7;
}

/* Barra de Compartilhamento de GPS do Ônibus */
.route-gps-sharing-banner {
  margin-bottom: 12px;
}

.btn-share-location-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  background: #0284c7;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.btn-share-location-action:hover {
  background: #0369a1;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

.btn-share-location-action:active {
  transform: translateY(0);
}

.btn-share-location-action.broadcasting-active {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.35);
  animation: pulse-broadcast-btn 2.2s infinite ease-in-out;
}

@keyframes pulse-broadcast-btn {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.live-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-block;
  animation: blink-dot 1s infinite alternate;
}

@keyframes blink-dot {
  0% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.15); }
}

/* Card de Telemetria e Transmissão em Segundo Plano */
.broadcast-telemetry-panel {
  margin-top: 10px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.08);
  animation: fadeInTelemetry 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.telemetry-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #bbf7d0;
  flex-wrap: wrap;
}

.bg-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #15803d;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bg-status-badge .badge-pulse-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  animation: pulseGreenRing 1.8s infinite;
}

@keyframes pulseGreenRing {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.screen-on-warning-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.screen-on-warning-box .warning-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.screen-on-warning-box .warning-text {
  font-size: 12px;
  color: #854d0e;
  line-height: 1.45;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
}

.telemetry-item {
  background: #ffffff;
  border: 1px solid #dcfce7;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-label {
  font-size: 10px;
  font-weight: 700;
  color: #15803d;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.telemetry-val {
  font-size: 13.5px;
  font-weight: 800;
  color: #14532d;
  font-family: 'JetBrains Mono', -apple-system, BlinkMacSystemFont, monospace;
}

/* Modal do Mapa Leaflet */
.modal-card-mapa {
  width: 95vw !important;
  max-width: 1140px !important;
  height: 88vh !important;
  max-height: 88vh !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: 14px !important;
}

.map-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
  flex-wrap: nowrap;
}

.map-head-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.map-head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.map-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 12.5px;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.15);
}

.map-close-btn:hover {
  background: #fecaca;
  color: #991b1b;
  border-color: #f87171;
  transform: scale(1.03);
}

.map-close-btn:active {
  transform: scale(0.98);
}

.map-seg-group {
  display: inline-flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.map-seg-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.map-seg-btn.active {
  background: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 95, 168, 0.25);
}

/* Pílula de Status Online/Offline */
.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.live-status-pill.online {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.live-status-pill.offline {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.live-status-pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.live-status-pill.online .pill-dot {
  background: #10b981;
  animation: blink-dot 1s infinite alternate;
}

/* Barra de Status Inferior do Cabeçalho */
.map-bus-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.status-bar-icon {
  color: var(--primary-600);
  display: flex;
  align-items: center;
}

/* Wrapper do Mapa e Leaflet */
.map-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#leaflet-map-container {
  width: 100%;
  height: 100%;
  background: #e2e8f0;
}

/* Barra Flutuante de Controles do Mapa */
.map-floating-actions {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px;
  border-radius: 30px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.8);
  max-width: 94%;
  overflow-x: auto;
}

.map-float-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.map-float-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-400);
  color: var(--primary-700);
}

.map-float-btn.active {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-700);
  box-shadow: 0 2px 6px rgba(0, 95, 168, 0.3);
}

.map-float-btn.close-float-btn {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.map-float-btn.close-float-btn:hover {
  background: #fecaca;
  color: #991b1b;
  border-color: #f87171;
}

/* Marcador Customizado do Ônibus */
.custom-bus-div-icon {
  background: transparent;
  border: none;
}

.bus-marker-container {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bus-marker-bubble {
  position: relative;
  z-index: 2;
  width: 36px;
  height: 36px;
  background: #005fa8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.bus-pulse-radar {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.35);
  animation: bus-radar-wave 2s infinite ease-out;
  z-index: 1;
}

@keyframes bus-radar-wave {
  0% { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

.bus-marker-arrow {
  position: absolute;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid #005fa8;
  z-index: 3;
}

/* Marcador Customizado dos Pontos de Parada */
.custom-stop-div-icon {
  background: transparent;
  border: none;
}

.stop-marker-pin {
  position: relative;
  width: 32px;
  height: 36px;
  border-radius: 16px 16px 16px 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.stop-marker-pin:hover {
  transform: rotate(-45deg) scale(1.1);
}

.stop-marker-pin.active-stop-marker {
  background: #005fa8;
}

.stop-marker-pin.empty-stop-marker {
  background: #94a3b8;
}

.stop-marker-pin.my-stop-marker {
  background: #f59e0b;
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.85);
}

.stop-pin-number {
  transform: rotate(45deg);
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
}

.my-stop-beacon {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.35);
  animation: my-stop-pulse 1.8s infinite;
  z-index: -1;
  top: -4px;
  left: -4px;
}

@keyframes my-stop-pulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Marcador de Localização do Usuário */
.custom-user-div-icon {
  background: transparent;
  border: none;
}

.user-location-marker {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.user-pulse {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.35);
  animation: user-pulse-anim 1.8s infinite ease-out;
  z-index: 1;
}

@keyframes user-pulse-anim {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Popups Customizados Leaflet */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
  min-width: 210px !important;
  max-width: 280px !important;
}

.map-popup-card {
  padding: 12px 14px;
  background: #ffffff;
}

.map-popup-head {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.map-popup-badge-bus {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.stop-popup-idx {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--primary-700);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.map-popup-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
}

.popup-meta-item {
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.popup-students-list {
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.popup-student-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-size: 11.5px;
}

.popup-student-row.is-me-row {
  background: #fef3c7;
  border: 1px solid #fde68a;
  font-weight: 700;
}

.popup-student-name {
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  #mapa-modal {
    padding: 0 !important;
  }

  .modal-card-mapa {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .map-modal-head {
    padding: 8px 12px !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  .map-head-info h2 {
    font-size: 12.5px !important;
    gap: 4px !important;
  }

  .map-head-info h2 span {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #map-rota-title {
    font-size: 11px !important;
    margin: 2px 0 0 !important;
  }

  .live-status-pill {
    padding: 2px 6px !important;
    font-size: 9px !important;
  }

  .map-close-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
    min-height: 32px !important;
    border-radius: 16px !important;
  }

  .map-bus-status-bar {
    padding: 5px 10px !important;
    font-size: 10.5px !important;
    overflow-x: auto;
    white-space: nowrap;
  }

  .map-floating-actions {
    bottom: 16px !important;
    gap: 6px !important;
    padding: 4px !important;
    max-width: 90% !important;
  }

  .map-float-btn {
    padding: 7px 12px !important;
    font-size: 11px !important;
  }

  .btn-share-location-action {
    font-size: 12px;
    padding: 10px 14px;
  }
}


