:root {
  --green:  #22c55e; --green-bg:  #dcfce7; --green-tx:  #166534;
  --yellow: #eab308; --yellow-bg: #fef9c3; --yellow-tx: #854d0e;
  --orange: #f97316; --orange-bg: #ffedd5; --orange-tx: #9a3412;
  --red:    #ef4444; --red-bg:    #fee2e2; --red-tx:    #991b1b;
  --purple: #7c3aed; --purple-bg: #ede9fe; --purple-tx: #5b21b6;
  --bg: #f8f7f4; --surface: #ffffff; --surface2: #f3f2ef;
  --text: #1a1a18; --text2: #6b6a65; --text3: #9b9a95;
  --border: rgba(0,0,0,0.08); --border2: rgba(0,0,0,0.14);
  --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --surface: #1c1c1a; --surface2: #252523;
    --text: #f0ede8; --text2: #9b9a95; --text3: #6b6a65;
    --border: rgba(255,255,255,0.08); --border2: rgba(255,255,255,0.14);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* TOPBAR */
.topbar { background: var(--surface); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); position: relative; z-index: 10; }
.topbar-center { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; }
.topbar-logo { font-size: 28px; line-height: 1; }
.topbar-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.topbar-sub { font-size: 12px; color: var(--text3); font-weight: 500; }

/* SIDEBAR LAYOUT */
.app-layout { display: flex; min-height: 100vh; width: 100%; }
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-right: none;
  padding: 20px 14px;
  flex-shrink: 0;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
}
.sidebar-top {
  display: flex;
  flex-direction: column;
}
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 10px;
  margin-top: 4px;
  display: block;
}
.sidebar-tabs { display: flex; flex-direction: column; gap: 4px; }
.sidebar-tab {
  padding: 11px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  font-family: var(--font);
  border-radius: 8px;
  transition: all .2s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.sidebar-tab:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
  transform: translateX(2px);
}
.sidebar-tab.active {
  color: #fff;
  font-weight: 700;
  transform: translateX(2px);
}
.sidebar-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: currentColor;
}
/* Cores individuais de cada aba quando ativa */
#tab-btn-turmas.active   { background: rgba(59,130,246,0.20); color: #60a5fa; }
#tab-btn-ranking.active  { background: rgba(234,179, 8,0.18); color: #fbbf24; }
#tab-btn-alunos-rank.active { background: rgba(34,197,94,0.18); color: #4ade80; }
#tab-btn-prof-rank.active  { background: rgba(139,92,246,0.20); color: #c4b5fd; }
#tab-btn-turmas:hover    { background: rgba(59,130,246,0.10); color: #93c5fd; }
#tab-btn-ranking:hover   { background: rgba(234,179, 8,0.10); color: #fde68a; }
#tab-btn-alunos-rank:hover { background: rgba(34,197,94,0.10); color: #86efac; }
#tab-btn-prof-rank:hover   { background: rgba(139,92,246,0.10); color: #ddd6fe; }

.main-content { flex: 1; min-width: 0; background: var(--bg); padding-top: 0; }
.container { max-width: 1000px; margin: 0 auto; padding: 24px; padding-bottom: 70px; }
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.section-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 24px; line-height: 38px; margin-top: 0; }
.turma-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.turma-header h2 { font-size: 20px; font-weight: 800; color: var(--text); margin: 0; line-height: 38px; }
.section { display: none; } .section.active { display: block; }

/* LEGENDA */
.legenda { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; padding: 10px 16px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); align-items: center; }
.leg { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); }
.leg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.leg-sep { width: 1px; height: 14px; background: var(--border2); margin: 0 4px; }

/* TURMA GRID */
.turma-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.turma-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; text-align: left; width: 100%; transition: all .15s; box-shadow: var(--shadow); }
.turma-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.turma-card-nome { font-size: 15px; font-weight: 600; }
.turma-card-info { font-size: 12px; color: var(--text3); margin-top: 3px; }
.turma-bar { height: 4px; border-radius: 2px; overflow: hidden; margin-top: 10px; background: var(--surface2); }
.turma-bar-fill { height: 100%; border-radius: 2px; transition: width .5s; }
.turma-badge { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 9px; border-radius: 99px; font-weight: 600; margin-top: 8px; }

/* ALUNOS */
.alunos-topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.btn-back { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text2); transition: all .15s; }
.btn-back:hover { background: var(--surface2); color: var(--text); }
.alunos-title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.search-box { margin-left: 16px; position: relative; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); }
.search-input { padding: 7px 12px 7px 32px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--surface); color: var(--text); width: 200px; font-family: var(--font); }
.search-input:focus { outline: none; border-color: var(--border2); }

/* STATS */
.stats-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 80px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.stat-lbl { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ALUNO LIST */
.hint { font-size: 12px; color: var(--text3); margin-bottom: 10px; }
.emoji-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12px; color: var(--text3); align-items: center; }
.aluno-list { display: flex; flex-direction: column; gap: 6px; }
.aluno-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .2s; }
.aluno-card.prf { border-color: #fca5a5; border-width: 1.5px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; cursor: pointer; transition: transform .15s; }
.avatar:hover { transform: scale(1.1); }
.aluno-info { flex: 1; min-width: 120px; }
.aluno-nome { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: #2563eb; }
.aluno-nome:hover { text-decoration: underline; }
.aluno-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.emoji-btns { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; width: 258px; flex-shrink: 0; }
.ebtn { background: rgba(0,0,0,0.04); border: none; cursor: pointer; font-size: 16px; padding: 3px 0; border-radius: 6px; transition: transform .15s, background .15s, box-shadow .15s; line-height: 1; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 26px; }
@media (prefers-color-scheme: dark) { .ebtn { background: rgba(255,255,255,0.06); } }
.ebtn:hover { background: rgba(0,0,0,0.09); transform: scale(1.25); box-shadow: 0 2px 8px rgba(0,0,0,0.10); z-index: 2; }
@media (prefers-color-scheme: dark) { .ebtn:hover { background: rgba(255,255,255,0.12); } }
.ebtn:active { transform: scale(0.88); background: rgba(0,0,0,0.13); }
.prf-btn { background: var(--red-bg); border: none; cursor: pointer; font-size: 13px; padding: 5px 8px; border-radius: 8px; display: flex; align-items: center; gap: 3px; font-weight: 700; color: var(--red-tx); line-height: 1; transition: all .1s; flex-shrink: 0; }
.prf-btn:hover { filter: brightness(.95); }
/* ── BOTÃO FALTA ALERTA (3 Faltas Consecutivas) ── */
.falta-btn { background: #fef3c7; border: 1.5px solid #f59e0b; cursor: pointer; font-size: 13px; padding: 5px 8px; border-radius: 8px; display: flex; align-items: center; gap: 3px; font-weight: 700; color: #92400e; line-height: 1; transition: all .2s; position: relative; overflow: hidden; flex-shrink: 0; }
.falta-btn:hover { background: #fde68a; border-color: #d97706; transform: scale(1.05); box-shadow: 0 2px 10px rgba(245,158,11,0.3); }
.falta-btn:active { transform: scale(0.95); }
.falta-btn .falta-pulse { position: absolute; inset: 0; border-radius: 8px; border: 2px solid #f59e0b; animation: faltaPulse 2s infinite; pointer-events: none; }
@keyframes faltaPulse { 0% { opacity: 0.6; transform: scale(1); } 50% { opacity: 0; transform: scale(1.15); } 100% { opacity: 0; transform: scale(1.15); } }
.badge { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 9px; border-radius: 99px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }

/* ── MODAL ATENDIMENTO PRF / ENFERMARIA ── */
.atend-radio-label {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.atend-radio-label:has(input:checked) {
  border-color: #3b82f6; background: #eff6ff; color: #1d4ed8;
}
.atend-radio-label input[type="radio"] { accent-color: #3b82f6; }
.atend-check-label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; padding: 5px 8px; border-radius: 6px;
  transition: background .12s;
}
.atend-check-label:hover { background: rgba(0,0,0,0.04); }
.atend-check-label input[type="checkbox"] { accent-color: #3b82f6; width: 15px; height: 15px; cursor: pointer; }
/* Histórico de atendimento dentro do modal */
.atend-hist-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 3px;
}
.atend-hist-status { font-weight: 700; }
.atend-hist-status.recebido  { color: #b45309; }
.atend-hist-status.em_andamento { color: #1d4ed8; }
.atend-hist-status.resolvido { color: #166534; }
/* Cores do cabeçalho do modal por tipo */
#atend-modal.tipo-prf    #atend-head { background: var(--red-bg); }
#atend-modal.tipo-prf    #atend-titulo { color: var(--red-tx); }
#atend-modal.tipo-enfermaria #atend-head { background: #f0f9ff; }
#atend-modal.tipo-enfermaria #atend-titulo { color: #075985; }


/* RANKING */
.premio { background: var(--green-bg); border: 1.5px solid #86efac; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.premio-txt h3 { font-size: 14px; font-weight: 700; color: var(--green-tx); }
.premio-txt p { font-size: 12px; color: #15803d; margin-top: 3px; }
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: all .15s; }
.rank-item:hover { transform: translateX(2px); border-color: var(--border2); }
.rank-item.no-click { cursor: default; } .rank-item.no-click:hover { transform: none; border-color: var(--border); }
.rank-pos { font-size: 13px; font-weight: 600; color: var(--text3); min-width: 28px; text-align: center; }
.rank-bar-wrap { width: 80px; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.rank-bar { height: 100%; border-radius: 3px; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-btn { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; background: var(--surface); cursor: pointer; color: var(--text2); transition: all .15s; font-family: var(--font); }
.filter-btn:hover { border-color: var(--border2); }
.filter-btn.active { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }

/* MODAIS */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1100; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: 14px; border: 1px solid var(--border); width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.2); overflow: hidden; }
.modal-lg { max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-close { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text3); font-size: 20px; line-height: 1; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-body-scroll { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* FORM */
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; display: block; }
.sugestoes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sug { padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 11px; background: var(--surface2); cursor: pointer; color: var(--text2); transition: all .1s; font-family: var(--font); }
.sug:hover { border-color: var(--border2); color: var(--text); }
.textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg); color: var(--text); resize: none; height: 80px; font-family: var(--font); line-height: 1.5; }
.textarea:focus { outline: none; border-color: var(--border2); }
.textarea::placeholder { color: var(--text3); }
.btn-cancel { padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text2); font-family: var(--font); }
.btn-cancel:hover { background: var(--bg); }
.btn-primary { padding: 8px 18px; border: none; border-radius: var(--radius); background: #1e3a8a; cursor: pointer; font-size: 13px; font-weight: 600; color: #fff; font-family: var(--font); transition: opacity .15s; }
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-danger { background: var(--red-tx); color: #fff; }

/* BOTÃO DE MICROFONE (VOZ) */
.btn-mic {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s ease;
}
.btn-mic:hover {
  background: var(--border);
  color: var(--text);
  transform: translateY(-1px);
}
.btn-mic.recording {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  animation: micPulse 1.5s infinite alternate;
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  100% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* TIMELINE */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding-bottom: 4px; }
.tl-line { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 32px; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; border: 2px solid var(--surface); }
.tl-connector { width: 2px; flex: 1; min-height: 8px; background: var(--border2); }
.tl-content { flex: 1; padding-bottom: 14px; position: relative; }
.tl-ts { font-size: 11px; color: var(--text3); margin-bottom: 3px; }
.tl-desc { font-size: 13px; font-weight: 600; padding-right: 80px; }
.tl-obs { font-size: 12px; color: var(--text2); margin-top: 5px; padding: 7px 11px; background: var(--surface2); border-radius: 8px; border-left: 2.5px solid var(--border2); line-height: 1.5; }
.tl-prf { background: var(--red-bg); border-radius: 8px; padding: 8px 12px; margin-top: 4px; font-size: 12px; color: var(--red-tx); font-weight: 600; line-height: 1.5; padding-right: 80px; }
.tl-del-btn { position: absolute; right: 0; top: 0; background: none; border: none; font-size: 11px; color: var(--red); font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.15s; }
.tl-del-btn:hover { background: var(--red-bg); }
.tl-prf-lock { display: inline-block; font-size: 11px; color: var(--text3); font-weight: 500; padding: 3px 8px; border-radius: 6px; background: #f3f4f6; margin-top: 4px; }

/* HIST MODAL AVATAR */
.hist-avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.hist-stats { display: flex; gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.hist-stat { flex: 1; text-align: center; padding: 12px 8px; border-right: 1px solid var(--border); }
.hist-stat:last-child { border-right: none; }
.hist-stat-num { font-size: 18px; font-weight: 700; }
.hist-stat-lbl { font-size: 10px; color: var(--text3); margin-top: 2px; }

.loading { text-align: center; padding: 3rem 1rem; color: var(--text3); font-size: 13px; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text3); font-size: 14px; }

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — SISTEMA COMPLETO (≤768px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── LAYOUT PRINCIPAL ── */
  .app-layout {
    flex-direction: column;
  }

  /* ── SIDEBAR → BOTTOM NAV ── */
  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    flex-direction: row;
    padding: 0;
    z-index: 900;
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  }

  /* Esconde elementos da sidebar que não cabem no bottom nav */
  .sidebar-brand,
  .sidebar-label,
  .sidebar-divider,
  .sidebar-bottom,
  #tab-btn-relatorios + .sidebar-divider,
  .sidebar-top > .sidebar-label {
    display: none !important;
  }

  .sidebar-top {
    flex-direction: row;
    width: 100%;
  }

  .sidebar-tabs {
    flex-direction: row;
    width: 100%;
    gap: 0;
  }

  .sidebar-tab {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 8px 4px;
    font-size: 9px;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    text-align: center;
    transform: none !important;
    min-width: 0;
  }

  .sidebar-tab svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .sidebar-tab.active::before {
    top: 0;
    left: 10%;
    width: 80%;
    height: 2px;
    border-radius: 0 0 3px 3px;
  }

  /* ── TOPBAR ── */
  .topbar {
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .topbar-title { font-size: 14px; }
  .topbar-sub { font-size: 10px; }

  /* Esconde a busca geral da topbar no mobile */
  .search-box-geral { display: none !important; }
  .btn-novo-aluno, .btn-deletar-aluno { display: none !important; }

  /* ── MAIN CONTENT ── */
  .main-content {
    margin-bottom: 60px; /* espaço para o bottom nav */
  }

  .container {
    padding: 12px;
    padding-bottom: 72px; /* garante que o footer não cobre conteúdo */
  }

  /* ── FOOTER FIXO ── */
  .footer-fixo {
    display: none !important; /* esconde no mobile — sidebar ocupa o fundo */
  }

  /* ── TIPOGRAFIA ── */
  .section-title { font-size: 16px; margin-bottom: 14px; }
  .alunos-title { font-size: 16px; }
  .turma-header h2 { font-size: 16px; }

  /* ── TURMA GRID ── */
  .turma-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
  .turma-card { padding: 10px 12px; }
  .turma-card-nome { font-size: 14px; }

  /* ── STATS ROW ── */
  .stats-row { gap: 6px; }
  .stat { padding: 10px 8px; min-width: 60px; }
  .stat-num { font-size: 18px; }
  .stat-lbl { font-size: 10px; }

  /* ── BUSCA LOCAL (dentro da lista de alunos) ── */
  .alunos-topbar {
    gap: 8px;
    flex-wrap: wrap;
  }

  .search-box {
    margin-left: 0;
    width: 100%;
    order: 10; /* move busca para baixo */
  }

  .search-input {
    width: 100%;
    font-size: 14px;
    padding: 9px 12px 9px 32px;
  }

  /* ── ALUNO CARD (MOBILE GRID) ── */
  .aluno-card {
    display: grid !important;
    grid-template-columns: auto 1fr auto auto auto;
    grid-template-areas:
      "avatar info falta prf badge"
      "emojis emojis emojis emojis emojis";
    padding: 10px 8px;
    gap: 8px 6px;
    align-items: center;
  }

  .aluno-card > .avatar { grid-area: avatar; width: 32px; height: 32px; font-size: 10px; }
  .aluno-card > .aluno-info { grid-area: info; min-width: 0; }
  .aluno-card > .badge { grid-area: badge; justify-self: end; }
  
  .aluno-nome { font-size: 13px; }
  .aluno-sub  { font-size: 11px; }

  /* Botões de emoji na linha de baixo ocupando toda a largura */
  .aluno-card > .emoji-btns {
    grid-area: emojis;
    width: 100%;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
  }
  .ebtn { font-size: 16px; padding: 3px 0; width: 100%; height: 26px; }

  /* Botões de ação */
  .aluno-card > .falta-btn { grid-area: falta; font-size: 11px; padding: 5px 6px; }
  .aluno-card > .prf-btn { grid-area: prf; font-size: 11px; padding: 5px 6px; }

  /* ── RANKING ── */
  .rank-item { padding: 8px 10px; gap: 8px; }
  .rank-bar-wrap { width: 50px; }
  .rank-pos { min-width: 22px; font-size: 12px; }

  /* ── MODAIS ── */
  .overlay {
    padding: 0;
    align-items: flex-end; /* modal sobe de baixo como sheet */
  }

  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-lg {
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    border-radius: 18px 18px 0 0;
  }

  .modal-head { padding: 14px 16px; }
  .modal-body, .modal-body-scroll { padding: 14px 16px; }
  .modal-foot { padding: 10px 16px; }

  /* ── RELATÓRIOS ── */
  .relatorios-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .relatorio-card { padding: 14px; gap: 12px; }
  .relatorio-card-icon { width: 44px; height: 44px; border-radius: 10px; }
  .relatorio-card-title { font-size: 14px; }
  .relatorio-card-desc { font-size: 11px; }

  /* Tabelas de relatório: scroll horizontal */
  .relatorio-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .relatorio-table { font-size: 12px; }
  .relatorio-table th, .relatorio-table td { padding: 8px 8px; }

  /* ── PAI DASHBOARD ── */
  .pai-filhos-grid { grid-template-columns: 1fr; gap: 12px; }
  .pai-stats-row { flex-direction: column; }
  .pai-filho-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .pai-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pai-tab { padding: 8px 12px; font-size: 13px; }

  /* ── APROVAÇÕES ADMIN ── */
  .aprov-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .aprov-actions { width: 100%; }
  .aprov-btn { flex: 1; text-align: center; padding: 10px; }

  /* ── VINCULOS ── */
  .vinculo-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .vinculo-info { flex-direction: column; gap: 4px; }

  /* ── TIMELINE (modal histórico) ── */
  .tl-desc { padding-right: 52px; font-size: 12px; }
  .tl-prf  { padding-right: 52px; font-size: 11px; }
  .tl-obs  { font-size: 11px; }

  /* ── BTN MIC ── */
  .btn-mic { font-size: 10px; padding: 3px 6px; }

  /* ── BOTÕES GLOBAIS ── */
  .btn-back { font-size: 12px; padding: 6px 10px; }
  .btn-primary, .btn-cancel { padding: 9px 14px; font-size: 13px; }

  /* ── LEGENDA ── */
  .legenda { padding: 8px 10px; gap: 6px; }
  .leg { font-size: 11px; }

  /* ── TOPBAR PARCEIRO ── */
  .topbar-parceiro-label { display: none; }
  .topbar-parceiro-logo { height: 22px; }
  .topbar-parceiro { margin-left: 8px; padding-left: 8px; }
  .topbar-school-logo { height: 36px; }

  /* ── USER INFO ── */
  .user-info span { display: none; }
  .btn-logout { padding: 6px 10px; margin-left: 6px; }

  /* ── FILTROS RANKING ── */
  .filter-row { gap: 4px; }
  .filter-btn { padding: 4px 10px; font-size: 11px; }

  /* ── BOTÃO NOVO/EDITAR aluno ── */
  .btn-editar-aluno, .btn-limpar-prf {
    font-size: 12px;
    padding: 7px 10px;
  }

  /* ── BOTÃO BUSCA MOBILE ── */
  #btn-mobile-search {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text2);
    padding: 6px;
    border-radius: 8px;
    margin-left: auto;
    margin-right: 4px;
    transition: background 0.15s;
  }
  #btn-mobile-search:hover { background: var(--surface2); }
}


/* Telas muito pequenas (≤380px, ex: iPhone SE) */
@media (max-width: 380px) {
  .container { padding: 8px; }
  .turma-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
  .turma-card { padding: 8px 10px; }
  .ebtn { font-size: 15px; padding: 2px; }
  .aluno-card { padding: 7px 8px; gap: 6px; }
  .sidebar-tab { font-size: 8px; }
  .sidebar-tab svg { width: 18px; height: 18px; }
  .modal-head { padding: 12px; }
  .modal-body, .modal-body-scroll { padding: 12px; }
}



/* ─── AUTHENTICATION STYLES (NEW) ────────────────────────── */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #1e1e30 0%, #0f0f15 100%);
}
@media (prefers-color-scheme: light) {
  .auth-wrapper {
    background: linear-gradient(135deg, #f0f4f8 0%, #dbe3eb 100%);
  }
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-header {
  text-align: center;
}
.auth-logo {
  font-size: 44px;
  margin-bottom: 6px;
  display: inline-block;
  user-select: none;
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-top: 6px;
  line-height: 1.4;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-input:focus {
  outline: none;
  border-color: var(--border2);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}
@media (prefers-color-scheme: dark) {
  .auth-input:focus {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
  }
}
.auth-btn {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: var(--radius);
  background: #1e3a8a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s, transform 0.1s;
}
.auth-btn:hover {
  opacity: 0.9;
}
.auth-btn:active {
  transform: scale(0.98);
}
.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.auth-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text2);
  margin-top: 10px;
}
.auth-link {
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
}
.auth-link:hover {
  text-decoration: underline;
  color: #1d4ed8;
}
.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  display: none;
}
.auth-alert.error {
  display: block;
  background: var(--red-bg);
  color: var(--red-tx);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.auth-alert.success {
  display: block;
  background: var(--green-bg);
  color: var(--green-tx);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* CONTAINER DE SENHA COM OLHO */
.password-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-container .auth-input {
  padding-right: 42px; /* Espaço para o botão do olho */
}
.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.2s;
  user-select: none;
}
.password-toggle:hover {
  color: var(--text2);
}
.password-toggle svg {
  display: block;
}

/* BOTÃO SAIR NA TOPBAR */
.btn-logout {
  margin-left: 12px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  transition: all .15s;
  font-family: var(--font);
}
.btn-logout:hover {
  background: var(--red-bg);
  color: var(--red-tx);
  border-color: rgba(239, 68, 68, 0.2);
}
.user-info {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  margin-left: auto;
}
@media (max-width: 600px) {
  .user-info span { display: none; }
  .btn-logout { padding: 6px 10px; margin-left: 6px; }
}

/* ─── PARCEIRO PALMAS BRASIL ─────────────────────────────── */
.auth-parceiro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.auth-parceiro-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.auth-parceiro-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
  transition: opacity 0.2s;
}
.auth-parceiro-logo:hover { opacity: 1; }
.auth-parceiro-fallback {
  font-size: 14px;
  font-weight: 700;
  color: var(--text2);
}

/* Logo parceiro na Topbar */
.topbar-parceiro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}
.topbar-parceiro-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.topbar-parceiro-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.topbar-parceiro-logo:hover { opacity: 1; }
@media (max-width: 600px) {
  .topbar-parceiro-label { display: none; }
  .topbar-parceiro-logo { height: 22px; }
  .topbar-parceiro { margin-left: 8px; padding-left: 8px; }
  .search-box-geral { margin-left: 0; width: 100%; margin-top: 8px; }
  .btn-novo-aluno { padding: 4px 8px; font-size: 11px; margin-left: 4px; }
}

/* ─── LOGO DA ESCOLA ─────────────────────────────── */
.topbar-school-logo {
  height: 58px; /* Aumentado mais 20% */
  width: auto;
  object-fit: contain;
  margin-right: 8px;
}

/* ─── BUSCA GERAL E NOVO ALUNO ─────────────────────────────── */
.search-box-geral {
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
}
.search-box-geral .search-input {
  width: 250px;
}
.btn-novo-aluno,
.btn-deletar-aluno {
  padding: 7px 14px;
  background-color: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.btn-novo-aluno {
  margin-left: 12px;
  color: #2563eb;
  border: 1.5px solid #2563eb;
}
.btn-novo-aluno:hover {
  background-color: #2563eb;
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  transform: translateY(-1px);
}
.btn-deletar-aluno {
  margin-left: 8px;
  color: #dc2626;
  border: 1.5px solid #dc2626;
}
.btn-deletar-aluno:hover {
  background-color: #dc2626;
  color: white;
  box-shadow: 0 4px 12px rgba(220,38,38,0.3);
  transform: translateY(-1px);
}
.btn-editar-aluno {
  padding: 8px 14px;
  border: 1.5px solid #2563eb;
  border-radius: var(--radius);
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-editar-aluno:hover {
  background-color: #2563eb;
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  transform: translateY(-1px);
}
.btn-limpar-prf {
  padding: 8px 16px;
  border: 1.5px solid #d97706;
  border-radius: var(--radius);
  background: transparent;
  color: #d97706;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-limpar-prf:hover {
  background-color: #d97706;
  color: white;
  box-shadow: 0 4px 12px rgba(217,119,6,0.3);
  transform: translateY(-1px);
}


/* ─── FOOTER FIXO ─────────────────────────────── */
.footer-fixo {
  position: fixed;
  bottom: 0;
  left: 220px;
  width: calc(100% - 220px);
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.footer-parceiro-logo {
  height: 54px; /* Aumentado */
  object-fit: contain;
}
.container {
  padding-bottom: 70px; /* Evita que o footer cubra o final do grid */
}

/* ─── SIDEBAR DIVIDER ─────────────────────────────── */
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 12px 8px;
}

/* ─── COR DA ABA RELATÓRIOS ─────────────────────────────── */
#tab-btn-relatorios.active  { background: rgba(129,140,248,0.20); color: #818cf8; }
#tab-btn-relatorios:hover   { background: rgba(129,140,248,0.10); color: #a5b4fc; }

/* ─── RELATÓRIOS: HEADER ─────────────────────────────── */
.relatorios-header { margin-bottom: 28px; }
.relatorios-titulo { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.relatorios-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }

/* ─── RELATÓRIOS: GRID DE CARDS ─────────────────────────────── */
.relatorios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.relatorio-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.relatorio-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
}
.relatorio-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.relatorio-card:hover::before { opacity: 1; }
.relatorio-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.relatorio-card-body { flex: 1; min-width: 0; }
.relatorio-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.relatorio-card-desc { font-size: 12px; color: var(--text2); line-height: 1.6; margin-bottom: 10px; }
.relatorio-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.rel-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}
.rel-tag.blue   { background: rgba(59,130,246,0.12); color: #2563eb; }
.rel-tag.purple { background: rgba(139,92,246,0.12); color: #7c3aed; }
.rel-tag.amber  { background: rgba(245,158,11,0.12); color: #b45309; }
.relatorio-card-arrow {
  font-size: 20px;
  color: var(--text3);
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
  align-self: center;
}
.relatorio-card:hover .relatorio-card-arrow { transform: translateX(4px); color: var(--text); }

/* ─── RELATÓRIOS: CORPO DO RELATÓRIO ─────────────────────────────── */
.relatorio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
}
.relatorio-table th {
  background: var(--surface2);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.relatorio-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.relatorio-table tr:last-child td { border-bottom: none; }
.relatorio-table tr:hover td { background: var(--surface2); }

/* ─── IMPRESSÃO / PDF ──────────────────────────────────────────── */
#print-header, #print-footer { display: none; }

@media print {
  /* Esconder tudo da app */
  .sidebar, .topbar, .footer-fixo, .relatorio-card, .relatorio-resultado > div:first-child,
  #relatorio-resultado > div:first-child, button, .relatorios-header { display: none !important; }

  body { background: white !important; margin: 0; padding: 0; }
  .main-content, .container, #relatorio-corpo, .app-layout, .main-area { 
    all: unset; 
    display: block !important;
    width: 100% !important;
  }
  .section { display: none !important; }
  .section.active { display: block !important; }

  /* Cabeçalho institucional */
  #print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 2px solid #1e293b;
    margin-bottom: 24px;
  }
  #print-header .ph-left img  { height: 64px; object-fit: contain; }
  #print-header .ph-center    { text-align: center; }
  #print-header .ph-center img { height: 56px; object-fit: contain; }
  #print-header .ph-right     { width: 80px; }

  /* Rodapé institucional */
  #print-footer {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-top: 1px solid #e2e8f0;
    margin-top: 32px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
  }
  #print-footer img { height: 32px; object-fit: contain; }
  #print-footer span { font-size: 10px; color: #64748b; }

  /* Tabela de impressão */
  .relatorio-table th { background: #f1f5f9 !important; }
  .relatorio-table tr:hover td { background: transparent !important; }
  .relatorio-section-title { font-size: 14px; font-weight: 700; color: #1e293b; margin: 16px 0 8px; }
  .print-meta { font-size: 11px; color: #64748b; margin-bottom: 20px; }
}

/* ── REGISTRATION BANNERS ─────────────────────────────── */
.reg-banner-pendente {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  color: #92400e;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.reg-banner-icon { font-size: 20px; }

/* ── PAI REGISTRATION SECTION ─────────────────────────── */
.reg-pai-help {
  font-size: 13px;
  color: var(--text3);
  margin: 0;
}
.reg-pai-resultados {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.reg-pai-resultados:empty { display: none; }
.reg-pai-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.reg-pai-item:hover { background: var(--surface2); }
.reg-pai-item:last-child { border-bottom: none; }
.reg-pai-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reg-pai-item-mascote { font-size: 20px; }
.reg-pai-item-nome { font-weight: 500; }
.reg-pai-item-btn {
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}
.reg-pai-item-btn:hover { background: #16a34a; }
.reg-pai-item-btn.remover {
  background: #ef4444;
}
.reg-pai-item-btn.remover:hover { background: #dc2626; }

.reg-pai-selecionados {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.reg-pai-selecionados:empty { display: none; }
.reg-pai-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #dbeafe;
  color: #1e40af;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.reg-pai-chip button {
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}

/* ── PAI DASHBOARD ────────────────────────────────────── */
.pai-header {
  text-align: center;
  padding: 24px 16px 16px;
  position: relative;
}
.pai-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}
.pai-subtitle {
  color: var(--text2);
  font-size: 14px;
  margin: 0;
}
.pai-logout-btn {
  position: absolute;
  top: 24px;
  right: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.2s;
}
.pai-logout-btn:hover {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.pai-filhos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 0 16px 16px;
  max-width: 800px;
  margin: 0 auto;
}
.pai-filho-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.pai-filho-card:hover {
  border-color: #3b82f6;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(59,130,246,0.15);
}
.pai-filho-card .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
  font-weight: 700;
}
.pai-filho-card .nome {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.pai-filho-card .turma {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
}
.pai-filho-card .stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text3);
}
.pai-filho-card .stat-num {
  font-weight: 700;
  font-size: 18px;
  display: block;
  color: var(--text);
}

/* PAI VINCULAR SECTION */
.pai-vincular-section {
  max-width: 500px;
  margin: 16px auto;
  padding: 0 16px;
}
.pai-vincular-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text2);
}
.pai-vincular-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* PAI FILHO PANEL */
.pai-filho-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.pai-back-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.2s;
}
.pai-back-btn:hover { background: var(--border); }
.pai-filho-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pai-filho-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #dbeafe;
  font-weight: 700;
}
.pai-filho-info h3 {
  margin: 0;
  font-size: 18px;
}
.pai-filho-turma {
  font-size: 13px;
  color: var(--text2);
}

.pai-stats-row {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
}
.pai-stat-card {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.pai-stat-card .num {
  font-size: 28px;
  font-weight: 700;
}
.pai-stat-card .label {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

.pai-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  padding: 0 16px;
  gap: 4px;
}
.pai-tab {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-weight: 500;
}
.pai-tab:hover { color: var(--text); }
.pai-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.pai-tab-content {
  padding: 16px;
  max-width: 800px;
  margin: 0 auto;
}

/* PAI OCORRÊNCIAS LIST */
.pai-oc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.pai-oc-emoji { font-size: 24px; }
.pai-oc-info { flex: 1; }
.pai-oc-info .obs {
  font-size: 14px;
  color: var(--text);
  margin: 4px 0;
}
.pai-oc-info .meta {
  font-size: 12px;
  color: var(--text3);
}

/* PAI ENCAMINHAMENTOS */
.pai-enc-item {
  padding: 14px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  margin-bottom: 8px;
}
.pai-enc-item .obs {
  font-size: 14px;
  color: #991b1b;
  margin: 4px 0;
}
.pai-enc-item .meta {
  font-size: 12px;
  color: #b91c1c;
}

/* PAI RANKING */
.pai-rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  transition: all 0.2s;
}
.pai-rank-item.destaque {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.pai-rank-pos {
  font-size: 18px;
  font-weight: 700;
  color: var(--text3);
  min-width: 36px;
  text-align: center;
}
.pai-rank-item.destaque .pai-rank-pos { color: #3b82f6; }
.pai-rank-mascote { font-size: 24px; }
.pai-rank-nome {
  flex: 1;
  font-weight: 500;
}
.pai-rank-item.destaque .pai-rank-nome {
  color: #1e40af;
  font-weight: 700;
}
.pai-rank-oc {
  font-size: 13px;
  color: var(--text3);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 12px;
}
.pai-rank-star {
  font-size: 18px;
}

/* ── APROVAÇÕES ADMIN ─────────────────────────────────── */
.aprovacoes-list { margin-bottom: 24px; }
.aprov-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  gap: 12px;
}
.aprov-info {
  flex: 1;
}
.aprov-info .nome {
  font-weight: 600;
  font-size: 15px;
}
.aprov-info .meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.aprov-papel {
  background: #e0e7ff;
  color: #3730a3;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.aprov-actions {
  display: flex;
  gap: 6px;
}
.aprov-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.aprov-btn.aprovar {
  background: #22c55e;
  color: white;
}
.aprov-btn.aprovar:hover { background: #16a34a; }
.aprov-btn.rejeitar {
  background: #ef4444;
  color: white;
}
.aprov-btn.rejeitar:hover { background: #dc2626; }

.sidebar-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

/* VÍNCULOS LIST */
.vinculo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
}
.vinculo-info {
  display: flex;
  gap: 16px;
  font-size: 14px;
}
.vinculo-info .pai { font-weight: 600; }
.vinculo-info .aluno { color: var(--text2); }
.vinculo-delete {
  background: none;
  border: 1px solid #fca5a5;
  color: #ef4444;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.vinculo-delete:hover {
  background: #fef2f2;
}

/* EMPTY STATE */
.pai-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}
.pai-empty .emoji { font-size: 48px; margin-bottom: 12px; }
.pai-empty .msg { font-size: 15px; }

/* RESPONSIVE ADJUSTMENTS FOR PAI VIEW */
@media (max-width: 600px) {
  .pai-filhos-grid { grid-template-columns: 1fr; }
  .pai-stats-row { flex-direction: column; }
  .pai-filho-header { flex-direction: column; align-items: flex-start; }
  .aprov-card { flex-direction: column; align-items: flex-start; }
  .aprov-actions { width: 100%; }
  .aprov-btn { flex: 1; text-align: center; }
  .pai-tabs { overflow-x: auto; }
}

/* ── PAINEL PAI — garantia de visibilidade ─────────────────── */
/* O view-pai NÃO usa class=section, mas por segurança: */
#view-pai { box-sizing: border-box; background: var(--bg); min-height: 100vh; }
#view-pai .pai-filhos-grid { display: grid !important; }
#view-pai .pai-vincular-section { display: block !important; }

/* ── BOTÃO SOBRE (Sidebar) ─────────────────────────────────── */
.sidebar-sobre-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 24px);
  margin: 0 12px 10px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.45);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.3px;
}
.sidebar-sobre-btn:hover {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

/* ── MODAL SOBRE ──────────────────────────────────────────── */
.modal-sobre {
  max-width: 480px;
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Header do modal */
.sobre-header {
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1d4ed8 100%);
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}
.sobre-header-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(99,102,241,0.3) 0%, transparent 60%);
  pointer-events: none;
}
.sobre-header-content {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
.sobre-logo {
  width: 130px;
  height: 130px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.sobre-titulo {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.sobre-subtitulo {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
  font-weight: 500;
}
.sobre-close {
  position: relative;
  color: rgba(255,255,255,0.6) !important;
}
.sobre-close:hover { color: #fff !important; }

/* Body */
.sobre-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}
.sobre-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sobre-desc strong { color: var(--text); }

/* Section title */
.sobre-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #3b82f6;
  margin: 16px 0 10px;
}

/* Info grid */
.sobre-info-grid {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sobre-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.sobre-info-row:last-child { border-bottom: none; }
.sobre-info-row--top { align-items: flex-start; padding-top: 10px; }
.sobre-info-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  min-width: 130px;
  flex-shrink: 0;
}
.sobre-info-val {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.sobre-mono {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.5px;
}
.sobre-badge-version {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}
.sobre-link {
  font-size: 12px;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
}
.sobre-link:hover { text-decoration: underline; }

/* Tags de parceiros */
.sobre-parceiro-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
}

/* Logos parceiros */
.sobre-parceiros-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px 0 4px;
  border-top: 1px dashed var(--border);
  margin-top: 12px;
}
.sobre-parceiro-logo {
  height: 55px;
  width: auto;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity .2s;
}
.sobre-parceiro-logo:hover { opacity: 1; }

/* Footer */
.sobre-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  gap: 10px;
}
.sobre-footer span {
  font-size: 10px;
  color: var(--text3);
  font-weight: 500;
}

/* Responsivo mobile */
@media (max-width: 500px) {
  .modal-sobre { max-width: 98vw; }
  .sobre-info-key { min-width: 100px; }
}


/* --- ADMIN TOPBAR TOOLS --- */
.admin-topbar-tools { display: flex; align-items: center; gap: 8px; margin-left: 15px; border-left: 1px solid var(--border); padding-left: 15px; }

.btn-admin-outline {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background-color: transparent;
  border: 1.5px solid currentColor;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
}
.btn-admin-outline:hover {
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-outline-slate  { color: #64748b; }
.btn-outline-slate:hover  { background-color: #64748b; box-shadow: 0 4px 12px rgba(100,116,139,0.3); }

.btn-outline-purple { color: #8b5cf6; }
.btn-outline-purple:hover { background-color: #8b5cf6; box-shadow: 0 4px 12px rgba(139,92,246,0.3); }

.btn-outline-blue   { color: #3b82f6; }
.btn-outline-blue:hover   { background-color: #3b82f6; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }

.btn-outline-green  { color: #22c55e; }
.btn-outline-green:hover  { background-color: #22c55e; box-shadow: 0 4px 12px rgba(34,197,94,0.3); }

.btn-outline-red    { color: #ef4444; }
.btn-outline-red:hover    { background-color: #ef4444; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }

/* --- DELEÇÃO DE TURMAS --- */
.turma-delete-btn { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; opacity: 0.6; transition: opacity 0.2s, transform 0.2s; padding: 0; }
.turma-delete-btn:hover { opacity: 1; transform: scale(1.15); }

/* ════════════════════════════════════════════════
   RANKING DE PROFESSORES
   ════════════════════════════════════════════════ */

/* Pills de período */
.period-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.period-pill {
  padding: 5px 13px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}
.period-pill:hover { border-color: #8b5cf6; color: #8b5cf6; }
.period-pill.active { background: #8b5cf6; color: #fff; border-color: #8b5cf6; box-shadow: 0 2px 8px rgba(139,92,246,0.3); }

/* Cards de resumo estatístico */
.prc-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.prc-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.prc-stat-icon { font-size: 24px; flex-shrink: 0; }
.prc-stat-val  { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; line-height: 1.1; }
.prc-stat-label { font-size: 11px; color: var(--text3); margin-top: 2px; font-weight: 500; }

/* Lista de cards de professor */
.prof-rank-list { display: flex; flex-direction: column; gap: 6px; }

/* Card do professor (acordeão) */
.prof-rank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #22c55e; /* cor dinâmica via JS */
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
  cursor: pointer;
}
.prof-rank-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transform: translateX(2px);
}
.prof-rank-card.prc-open {
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

/* Linha de cabeçalho do card */
.prc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  user-select: none;
}

/* Posição (emoji ou número) */
.prc-pos {
  font-size: 18px;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

/* Avatar com iniciais */
.prc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

/* Info do professor */
.prc-info { flex: 1; min-width: 0; }
.prc-nome { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prc-disc { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* Barra de progresso */
.prc-bar-wrapper {
  width: 80px;
  height: 5px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.prc-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}

/* Totais */
.prc-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 56px;
  flex-shrink: 0;
  gap: 2px;
}
.prc-total-oc  { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1; }
.prc-total-prf { font-size: 11px; font-weight: 700; color: #dc2626; line-height: 1; }
.prc-total-label { font-size: 10px; font-weight: 500; color: var(--text3); }
.prc-total-label.prf-label { color: #dc2626; }

/* Chevron */
.prc-chevron {
  font-size: 16px;
  color: var(--text3);
  flex-shrink: 0;
  transition: transform .25s ease;
  margin-left: 4px;
}

/* Painel de detalhe (acordeão) */
.prc-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(0.4,0,0.2,1);
  border-top: 0px solid var(--border);
}
.prc-detail[aria-expanded="true"] {
  border-top-width: 1px;
}
.prc-detail-inner {
  padding: 14px 16px 16px;
}

/* Chips de tipo de ocorrência */
.prc-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.prc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.06);
}
.prc-chip strong { font-weight: 800; }
.prc-chip-prf {
  background: #fee2e2;
  color: #991b1b;
  border-color: rgba(239,68,68,0.2);
  font-weight: 700;
}

/* Chip pequeno para a tabela */
.prc-chip-sm {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.prc-chip-prf-sm {
  background: #fee2e2;
  color: #991b1b;
}

/* Título da tabela */
.prc-table-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

/* Wrap da tabela com scroll horizontal */
.prc-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }

/* Tabela de histórico */
.prc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--text);
}
.prc-table thead tr {
  background: var(--surface2);
}
.prc-table th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.prc-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.prc-table tbody tr:last-child td { border-bottom: none; }
.prc-table tbody tr:hover { background: var(--surface2); }
.prc-table tbody tr.prc-row-prf { background: #fff5f5; }
.prc-table tbody tr.prc-row-prf:hover { background: #fee2e2; }
@media (prefers-color-scheme: dark) {
  .prc-table tbody tr.prc-row-prf { background: rgba(239,68,68,0.06); }
  .prc-table tbody tr.prc-row-prf:hover { background: rgba(239,68,68,0.12); }
}

/* Badge de turma */
.prc-turma-badge {
  display: inline-block;
  padding: 2px 7px;
  background: var(--surface2);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
}

/* Coluna de observação */
.prc-obs {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text2);
  font-style: italic;
}

/* Responsivo: colapsa stat-cards em mobile */
@media (max-width: 600px) {
  .prc-stat-row { grid-template-columns: 1fr 1fr; }
  #prc-stat-tipo { display: none; }
  .prc-bar-wrapper { display: none; }
  .period-pills { gap: 3px; }
  .period-pill { font-size: 11px; padding: 4px 10px; }
}

/* ==========================================================================
   MÓDULO DE COMUNICADOS / AVISOS
   ========================================================================== */
.comunicados-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 20px;
  margin-top: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .comunicados-grid {
    grid-template-columns: 1fr;
  }
}

/* Upload de Arquivos UX */
.file-upload-container {
  width: 100%;
}
.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border2);
  border-radius: 8px;
  padding: 18px 12px;
  cursor: pointer;
  background: var(--surface);
  transition: all 0.2s ease;
  text-align: center;
}
.file-upload-label:hover {
  background: var(--surface2);
  border-color: var(--purple-tx);
}
.upload-icon {
  font-size: 20px;
  margin-bottom: 6px;
}
.upload-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}

/* Badges de Status do Lote / Envio */
.badge-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}
.badge-status.pending {
  background: var(--yellow-bg);
  color: var(--yellow-tx);
}
.badge-status.sending {
  background: var(--purple-bg);
  color: var(--purple-tx);
}
.badge-status.success {
  background: var(--green-bg);
  color: var(--green-tx);
}
.badge-status.error {
  background: var(--red-bg);
  color: var(--red-tx);
}
.badge-status.canceled {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}

/* Barra de Progresso UX */
.progress-container {
  width: 100%;
  margin-top: 4px;
}
.progress-bar-bg {
  background: var(--border);
  height: 8px;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar-fill {
  background: linear-gradient(90deg, var(--purple-tx) 0%, var(--purple) 100%);
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.1, 0.8, 0.25, 1);
  width: 0%;
}
.progress-bar-fill.success {
  background: linear-gradient(90deg, var(--green) 0%, #15803d 100%);
}
.progress-bar-fill.error {
  background: linear-gradient(90deg, var(--red) 0%, #b91c1c 100%);
}

/* Cartão do Lote de Comunicado */
.lote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lote-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}
.lote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lote-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.lote-meta {
  font-size: 10px;
  color: var(--text3);
  font-weight: 500;
}
.lote-msg-preview {
  font-size: 11px;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  background: var(--surface2);
  padding: 6px 8px;
  border-radius: 6px;
}
.lote-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  gap: 8px;
}
.lote-stats-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}
.btn-lote-detail {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-lote-detail:hover {
  background: var(--surface2);
  border-color: var(--text);
}
.btn-lote-cancel {
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red-tx);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-lote-cancel:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}


/* Toast Notification System */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 250px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-show {
  opacity: 1;
  transform: translateY(0);
}
.toast-hide {
  opacity: 0;
  transform: translateY(10px);
}
.toast-success { border-left: 4px solid var(--green); }
.toast-error { border-left: 4px solid var(--red); }
.toast-warning { border-left: 4px solid var(--yellow); }
.toast-info { border-left: 4px solid #2563eb; }
