:root {
  --amarelo: #ffab00;
  --amarelo-esc: #c98500;
  --tinta: #111827;
  --tinta-2: #374151;
  --suave: #6b7280;
  --fundo: #f6f4ee;
  --card: #ffffff;
  --linha: #e7e2d6;
  --ok: #15803d;
  --bom: #65a30d;
  --medio: #d97706;
  --ruim: #dc2626;
  --raio: 16px;
  --sombra: 0 1px 2px rgba(17, 24, 39, .06), 0 4px 14px rgba(17, 24, 39, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--tinta);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.topo {
  position: sticky; top: 0; z-index: 20; background: var(--tinta);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
}
.marca img { height: 34px; display: block; }
.perfil {
  display: flex; align-items: center; gap: 8px; background: transparent; color: #fff;
  border: 1px solid #ffffff40; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .9rem;
}
.perfil:hover { border-color: var(--amarelo); color: var(--amarelo); }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 24px; outline: none; }
.card { background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio); padding: 16px; box-shadow: var(--sombra); margin-bottom: 14px; }
.suave { color: var(--suave); } .pequeno { font-size: .875rem; }
.centro { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--linha);
  display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.abas a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; text-decoration: none; color: var(--suave); font-size: .75rem; font-weight: 600; }
.abas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.abas a.ativa { color: var(--tinta); }
.abas a.ativa svg { stroke: var(--amarelo-esc); stroke-width: 2.4; }
.abas a.ativa span { box-shadow: inset 0 -3px 0 var(--amarelo); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  background: var(--amarelo); color: var(--tinta); border: 0; border-radius: 12px; font-weight: 800; cursor: pointer;
  text-decoration: none; box-shadow: 0 2px 0 var(--amarelo-esc);
}
.btn:hover { filter: brightness(1.05); } .btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sec { background: #fff; border: 1.5px solid var(--linha); box-shadow: none; font-weight: 700; }
.btn.perigo { color: var(--ruim); }
.btn.grande { width: 100%; min-height: 54px; font-size: 1.05rem; }
.btn.mini { min-height: 36px; padding: 0 12px; font-size: .85rem; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--amarelo); outline-offset: 2px; }

label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 12px; }
input[type=text], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px; background: #fff; border: 1.5px solid var(--linha); border-radius: 12px; font-weight: 400;
}
textarea { min-height: 300px; resize: vertical; line-height: 1.6; }

.hero { background: var(--tinta); color: #fff; border-radius: 20px; padding: 22px 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.provas { margin: 6px 0 18px; }
.prova-tit { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--amarelo-esc); margin: 14px 0 8px; }
.galeria { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.galeria img { width: auto; max-width: none; border-radius: 12px; scroll-snap-align: start; flex: 0 0 auto; background: #ece8dc; }
.hero-logo { display: block; height: 84px; width: auto; max-width: 70%; margin: 0 0 16px; position: relative; z-index: 1; }
.hero h1 { color: #fff; } .hero p { color: #d1d5db; }
.hero .btn { margin-top: 6px; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: var(--amarelo); opacity: .16; }

.grade-comp { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.comp-mini { display: flex; gap: 10px; align-items: flex-start; }
.comp-mini .num { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--amarelo); font-weight: 900; display: grid; place-items: center; }
.comp-mini b { display: block; font-size: .95rem; } .comp-mini span { font-size: .82rem; color: var(--suave); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #ece8dc; padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.seg button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--tinta-2); }
.seg button[aria-pressed=true] { background: #fff; box-shadow: var(--sombra); color: var(--tinta); }

.contador { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--suave); margin: 6px 0 14px; }
.contador .aviso { color: var(--medio); font-weight: 700; }
.contador .bom { color: var(--ok); font-weight: 700; }

.foto-area { border: 2px dashed #d6cfbc; border-radius: 14px; padding: 22px 14px; text-align: center; background: #fffdf7; }
.foto-area img { max-width: 100%; max-height: 360px; border-radius: 10px; display: block; margin: 0 auto 12px; }
.foto-area input[type=file] { display: none; }
.dicas-foto { text-align: left; font-size: .85rem; color: var(--suave); margin: 12px auto 0; max-width: 420px; padding-left: 18px; }

.erro { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.demo { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem; }
.alerta { background: #fef2f2; border: 1px solid #fca5a5; color: #7f1d1d; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }

.carregando { text-align: center; padding: 40px 10px; }
.spin { width: 54px; height: 54px; border-radius: 50%; border: 6px solid #f1e3b8; border-top-color: var(--amarelo); margin: 0 auto 18px; animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

.nota-topo { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; }
.gauge { position: relative; width: 150px; height: 150px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .fundo { stroke: #efe9d8; } .gauge .valor { transition: stroke-dashoffset .9s ease; stroke-linecap: round; }
.gauge .num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge .num b { font-size: 2.2rem; line-height: 1; } .gauge .num span { font-size: .75rem; color: var(--suave); }
.faixa { display: inline-block; font-weight: 800; font-size: .8rem; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.f-ok { background: #dcfce7; color: #166534; } .f-bom { background: #ecfccb; color: #3f6212; } .f-medio { background: #fef3c7; color: #92400e; } .f-ruim { background: #fee2e2; color: #991b1b; }
@media (max-width: 440px) { .nota-topo { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

details.comp { border: 1px solid var(--linha); border-radius: 14px; background: #fff; margin-bottom: 10px; overflow: hidden; }
details.comp summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
details.comp summary::-webkit-details-marker { display: none; }
details.comp .num { width: 34px; height: 34px; border-radius: 10px; background: var(--amarelo); font-weight: 900; display: grid; place-items: center; }
details.comp .nome b { display: block; } details.comp .nome span { font-size: .8rem; color: var(--suave); }
.barra { height: 8px; background: #efe9d8; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.barra i { display: block; height: 100%; border-radius: 99px; }
.pont { font-weight: 900; font-size: 1.1rem; min-width: 44px; text-align: right; }
.corpo-comp { padding: 0 14px 14px; border-top: 1px solid var(--linha); padding-top: 12px; }
.trecho { border-left: 4px solid var(--amarelo); background: #fffbf0; border-radius: 0 10px 10px 0; padding: 8px 12px; margin: 10px 0; font-size: .92rem; }
.trecho q { display: block; font-style: italic; color: var(--tinta-2); quotes: "“" "”"; }
.trecho .sug { display: block; margin-top: 4px; color: var(--ok); }

.sucesso { background: #f0fdf4; border: 1px solid #86efac; color: #166534; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: .9rem; margin-bottom: 12px; }
.check input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--amarelo-esc); }
fieldset.idade { border: 0; padding: 0; margin: 0 0 12px; }
fieldset.idade legend { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
fieldset.idade .check { display: inline-flex; margin-right: 18px; margin-bottom: 4px; }
input[type=email], input[type=tel] { display: block; width: 100%; margin-top: 6px; padding: 12px; background: #fff; border: 1.5px solid var(--linha); border-radius: 12px; font-weight: 400; }
.saldo-grande { font-size: 3.4rem; font-weight: 900; line-height: 1; color: var(--amarelo-esc); }
.pontos { display: flex; gap: 8px; margin: 10px 0; }
.pontos i { flex: 1; height: 10px; border-radius: 99px; background: #efe9d8; }
.pontos i.on { background: var(--amarelo); }
.btn:disabled.sec, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.limite { background: #f3f4f6; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.chip { padding: 5px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1.5px solid; }
.chip.sim { background: #dcfce7; border-color: #86efac; color: #166534; } .chip.nao { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.lista { padding-left: 20px; margin: 0 0 8px; } .lista li { margin-bottom: 6px; }

.texto-aluno { white-space: pre-wrap; line-height: 1.8; font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; }
.texto-aluno mark { background: #fde68a; border-radius: 3px; padding: 0 2px; }
.texto-aluno mark.c1 { background: #fecaca; } .texto-aluno mark.c2 { background: #bfdbfe; } .texto-aluno mark.c3 { background: #e9d5ff; } .texto-aluno mark.c4 { background: #bbf7d0; } .texto-aluno mark.c5 { background: #fde68a; }
.legenda { display: flex; flex-wrap: wrap; gap: 8px; font-size: .78rem; margin-bottom: 10px; }
.legenda span { padding: 2px 8px; border-radius: 6px; }

.acoes { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.acoes .btn { flex: 1 1 180px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--linha); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; } .stat span { font-size: .75rem; color: var(--suave); }
.item-hist { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--linha); }
.item-hist:first-child { border-top: 0; }
.item-hist .nota-mini { flex: none; width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 1.15rem; }
.item-hist a.corpo { flex: 1; min-width: 0; text-decoration: none; }
.item-hist .tit { font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-hist .del { background: none; border: 0; color: var(--suave); cursor: pointer; padding: 8px; font-size: 1.1rem; }
.chart svg { width: 100%; height: auto; display: block; }
.avg-bar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; margin: 8px 0; font-size: .88rem; }

.grupo-tema { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--amarelo-esc); margin: 18px 0 8px; }
.tema h3 { margin-bottom: 4px; } .tema .btn { margin-top: 10px; }

dialog { border: 0; border-radius: 18px; padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(17, 24, 39, .55); }
.dlg-acoes { display: flex; gap: 10px; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; }
.dica { font-size: .85rem; color: var(--suave); }

@media print {
  .topo, .abas, .acoes, .perfil { display: none !important; }
  body { background: #fff; padding: 0; } .card { box-shadow: none; break-inside: avoid; }
  details.comp:not([open]) > *:not(summary) { display: block; }
}
