/* ==========================================================================
   Intranet Marillac — módulo Turmas (turmas por segmento e detalhe)
   ========================================================================== */

.f-acima { --fc: var(--s-acima); } .f-na { --fc: #D97706; } .f-abaixo { --fc: var(--s-abaixo); } .f-sem { --fc: var(--s-sem); }
span.f-acima, b.f-acima, dd.f-acima { color: var(--s-acima); }
span.f-na, b.f-na, dd.f-na { color: var(--s-na); }
span.f-abaixo, b.f-abaixo, dd.f-abaixo { color: var(--s-abaixo); }

/* ---------- Lista: seções por segmento ---------- */
.tm-segs { display: grid; gap: 18px; }
.tm-seg {
  position: relative; overflow: hidden; padding: 18px 20px 20px;
  animation: subir .5s var(--ease) backwards; animation-delay: calc(var(--si) * 70ms);
}
.tm-seg::before { /* filete na cor do segmento */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 30%, transparent));
}
.tm-seg-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tm-seg-cab h2 { font-size: 17px; font-weight: 800; color: var(--tx-titulo); }
.tm-seg-cab p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tm-seg-ic {
  position: relative; width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface));
}
.tm-seg-ic::after { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--c); opacity: 0; animation: halo 3.4s ease-out infinite; animation-delay: calc(var(--si) * .6s); }
.tm-seg:hover .tm-seg-ic .ic { animation: ic-pulo .7s var(--ease-mola); }

.tm-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.tm-card {
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 12px 14px; border-radius: 14px; text-decoration: none; color: inherit;
  background: color-mix(in srgb, var(--c) 5%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 18%, var(--line));
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
  animation: card-entra .5s var(--ease) backwards; animation-delay: calc(var(--i) * 28ms + 120ms);
}
.tm-card::after { /* faixa de luz no hover */
  content: ''; position: absolute; top: 0; bottom: 0; width: 45%; left: -70%; pointer-events: none; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent); transform: skewX(-18deg);
}
.tm-card:hover, .tm-card:focus-visible {
  transform: translateY(-4px); border-color: color-mix(in srgb, var(--c) 45%, var(--line));
  box-shadow: 0 16px 30px -18px color-mix(in srgb, var(--c) 70%, #0B1440);
}
.tm-card:hover::after { left: 130%; transition: left .8s var(--ease); }
.tm-card-topo { display: flex; align-items: flex-start; gap: 8px; }
.tm-card-ic {
  width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); transition: transform .35s var(--ease-mola);
}
.tm-card:hover .tm-card-ic { transform: scale(1.12) rotate(-8deg); }
.tm-card-tit { flex: 1; min-width: 0; display: grid; }
.tm-card-tit strong { font-size: 14px; font-weight: 800; color: var(--tx-titulo); line-height: 1.2; }
.tm-card-tit small { font-size: 11px; color: var(--muted); line-height: 1.35; }
.tm-card-ir { color: var(--muted); transition: transform .25s var(--ease-mola), color .2s; }
.tm-card:hover .tm-card-ir { transform: translateX(3px); color: var(--c); }
.tm-card-met { margin: 0; display: grid; gap: 4px; }
.tm-card-met div { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.tm-card-met dt { color: var(--muted); }
.tm-card-met dd { margin: 0; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.tm-card-met dd.baixa, .tm-card-met dd.atencao { color: var(--s-abaixo); }
.tm-card-trilho { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--c) 12%, transparent); }
.tm-card-trilho span {
  display: block; height: 100%; width: var(--f); background: var(--c); border-radius: 0 3px 3px 0;
  transform-origin: left; animation: tm-cresce 1s var(--ease) backwards; animation-delay: calc(var(--i) * 28ms + 400ms);
}
@keyframes tm-cresce { from { transform: scaleX(0); } }

/* ---------- Detalhe: cabeçalho ---------- */
.tm-cab { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tm-cab-ic {
  width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 60%, #0B1440));
  box-shadow: 0 12px 24px -12px var(--c); animation: tm-flutua 4s ease-in-out infinite;
}
@keyframes tm-flutua { 50% { transform: translateY(-3px) rotate(-3deg); } }
.tm-cab-txt { flex: 1; min-width: 0; }
.tm-cab-txt h2 { font-size: clamp(26px, 3vw, 36px); font-weight: 800; color: var(--tx-titulo); letter-spacing: -.02em; line-height: 1.1; }
.tm-cab-txt p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.tm-ver-alunos .ic { transition: transform .25s var(--ease-mola); }
.tm-ver-alunos:hover .ic { transform: translateX(4px); }

.tm-filtros { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
.tm-filtros.tm-filtros-alunos { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tm-kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tm-kpis-5 .al-kpi .valor { font-size: 26px; }
.tm-kpis-5 .al-kpi:nth-child(5) .al-kpi-ic::after { animation-delay: 3.2s; }
.tm-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- Tabelas ---------- */
.tm-tabela td, .tm-tabela th { white-space: nowrap; }
.tm-tabela td:first-child { white-space: normal; }
.tm-tabela th.tm-grupo { text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.tm-tabela .tm-sub th { padding-top: 6px; }
.tm-tabela th[rowspan] { vertical-align: bottom; }
.tm-tabela .tm-ini, .tm-tabela th.tm-grupo { border-left: 1px solid var(--line); }
.tm-disc-nome { white-space: normal; line-height: 1.25; }
.tm-aviso { margin: 12px 16px 16px; }
.tm-col-freq { min-width: 140px; }
.tm-col-freq b { font-variant-numeric: tabular-nums; }
.tm-grade-disc { grid-template-columns: minmax(0, 1fr) 340px; }
.tm-tabela th, .tm-tabela td { padding-left: 12px; padding-right: 12px; }
.tm-tabela td:first-child, .tm-tabela th:first-child { padding-left: 20px; }
.tm-medidor {
  display: inline-block; vertical-align: middle; width: 64px; height: 7px; margin-right: 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--fc) 14%, var(--trilho)); overflow: hidden;
}
.tm-medidor span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--fc); transition: width 1s var(--ease); }
.barras-prontas .tm-medidor span { width: var(--w); }

/* alunos com mais faltas: barra proporcional */
.tm-faltas li { animation: subir .4s var(--ease) backwards; animation-delay: calc(var(--i) * 60ms); }
.tm-faltas-barra { display: block; height: 4px; margin-top: 5px; border-radius: 99px; background: var(--trilho); overflow: hidden; }
.tm-faltas-barra::before {
  content: ''; display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #E8622C, #BE123C); transition: width 1s var(--ease);
}
.barras-prontas .tm-faltas-barra::before { width: var(--w); }

/* ---------- Frequência: anel e faixas ---------- */
.tm-anel {
  --tam: 150px; position: relative; width: var(--tam); height: var(--tam); margin: 4px auto 16px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: conic-gradient(var(--fc) calc(var(--p) * 1%), var(--trilho) 0);
  animation: anel-encher 1.3s var(--ease) both;
}
.tm-anel::before { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.tm-anel > * { position: relative; }
.tm-anel strong { font-size: 28px; font-weight: 800; color: var(--fc); font-variant-numeric: tabular-nums; }
.tm-anel span { font-size: 12px; color: var(--muted); }
.tm-faixas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tm-faixas li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.tm-faixas i { width: 10px; height: 10px; border-radius: 50%; background: var(--fc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fc) 18%, transparent); }
.tm-faixas b { margin-left: auto; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .tm-kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .tm-duo { grid-template-columns: 1fr; }
  .tm-filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tm-kpis-5 { grid-template-columns: 1fr 1fr; }
  .tm-grade { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tm-cab .tm-ver-alunos { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-seg, .tm-card, .tm-card-trilho span, .tm-faltas li, .tm-anel, .tm-cab-ic { animation: none; }
  .tm-seg-ic::after { display: none; }
  .tm-medidor span, .tm-faltas-barra::before { transition: none; }
}
