/* Ágora no celular (Android e iPhone). Só vale em telas estreitas; no computador nada muda.
   Regras: alvos de toque de pelo menos 44 px, campos com letra de 16 px (o iPhone dá zoom em letra menor),
   menu do aluno embaixo (como no painel do professor), respeito à barra do iPhone (safe-area) e à barra do navegador (dvh). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, summary, label, select, input, [role=button] { touch-action: manipulation; -webkit-tap-highlight-color: rgba(11,59,112,.12); }

@media (max-width: 700px) {
  /* ---- campos: sem zoom do iPhone, fáceis de tocar e de ler ---- */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea { font-size: 16px !important; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select { min-height: 46px; }
  textarea { min-height: 112px; line-height: 1.45; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  label.campo > span, .campo > span { font-size: .92rem; }
  .campo { margin-bottom: .85rem; }

  /* ---- botões e links tocáveis ---- */
  .btn, button.btn, .btn-sec, .btn-peq { min-height: 46px; padding-top: .6rem; padding-bottom: .6rem; }
  .btn-peq { min-height: 42px; }
  .btn-link, button.btn-link { min-height: 42px; padding: .5rem .6rem; }
  .btn-icone { min-width: 44px; min-height: 44px; }
  .chip { min-height: 42px; }
  .linha-botoes { gap: .55rem; }
  .linha-botoes > .btn, .linha-botoes > button { flex: 1 1 auto; }
  summary { min-height: 44px; display: flex; align-items: center; }

  /* ---- janelas: ocupam a altura certa mesmo com a barra do navegador do iPhone ---- */
  .modal, .modal.largo { max-height: 92dvh; }
  .modal-acoes { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .modal-acoes .btn, .modal-acoes button { flex: 1 1 auto; }

  /* ---- tabelas largas rolam de lado em vez de estourar a tela ---- */
  .tabela-caixa, .caderneta { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  img, video, canvas, iframe { max-width: 100%; }
  pre, code { overflow-x: auto; max-width: 100%; }

  /* ---- ÁREA DO ALUNO: topo enxuto e menu embaixo ---- */
  .pagina-aluno { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .pagina-aluno .topo { flex-wrap: wrap; gap: .1rem .5rem; padding: max(.4rem, env(safe-area-inset-top)) .75rem .35rem; align-items: center; }
  .pagina-aluno .topo-marca { flex: 1 1 auto; min-width: 0; min-height: 40px; }
  .pagina-aluno .topo-acoes { flex: 1 1 100%; justify-content: flex-end; gap: .45rem; margin: 0; order: 3; }
  .pagina-aluno .topo-acoes .xp { margin-right: auto; }
  .pagina-aluno .letra-controle button { width: 40px; height: 40px; }
  .pagina-aluno #aparencia-aluno, .pagina-aluno #sair { min-height: 40px; }
  .pagina-aluno .abas-aluno {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 150; width: auto; order: 0; margin: 0;
    display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: .1rem; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom));
    background: var(--ag-menu-fundo, #0B3B70); border-top: 2px solid var(--ag-secundaria, #EBAA10); box-shadow: 0 -4px 18px rgba(0,0,0,.18);
  }
  .pagina-aluno .abas-aluno::-webkit-scrollbar { display: none; }
  .pagina-aluno .abas-aluno a {
    flex: 0 0 auto; min-width: 80px; scroll-snap-align: center; flex-direction: column; justify-content: center; gap: .15rem;
    padding: .4rem .35rem; font-size: .72rem; line-height: 1.15; text-align: center; white-space: nowrap; border-radius: 14px;
  }
  .pagina-aluno .abas-aluno a .ag-ic { width: 26px; height: 26px; }
  .pagina-aluno .abas-aluno a:not(.ativo) { justify-content: center; }
  /* o robô e o aviso de instalar sobem para não cobrirem o menu */
  .pagina-aluno .tutor-bt, body:has(.nav-inferior) .tutor-bt { width: 52px; height: 52px; bottom: calc(92px + env(safe-area-inset-bottom)); right: 12px; }
  body.pagina-aluno .ag-app, body:has(.nav-inferior) .ag-app { bottom: calc(92px + env(safe-area-inset-bottom)) !important; max-width: calc(100vw - 24px); }
  .pagina-aluno #faixas > *, .pagina-aluno .faixa-aba { margin-left: .5rem; margin-right: .5rem; }

  /* ---- mural: o campo de texto usa a largura toda e o botão Publicar fica fácil de tocar ---- */
  .mu-comp-linha { flex-direction: column; align-items: stretch; gap: .5rem; }
  .mu-comp-linha .avatar { display: none; }
  .mu-comp-linha textarea { width: 100%; }
  .mu-compositor .linha-botoes { flex-wrap: wrap; }
  .mu-compositor .linha-botoes .btn:last-child { flex: 1 1 100%; }

  /* ---- leitura: nada de texto minúsculo nem cortado pelo robô ---- */
  .pagina-aluno main, .pagina-aluno #vista { padding-bottom: 4.5rem; }
}

@media (max-width: 380px) {
  .pagina-aluno .abas-aluno a { min-width: 72px; }
  .pagina-aluno .topo-marca small { display: none; }
}

/* ---- tela inicial: botões do guia e pontinhos do carrossel com área de toque de dedo ---- */
@media (max-width: 700px) {
  .ap-bt { min-height: 44px; min-width: 44px; }
  .ap-pontos button { position: relative; }
  .ap-pontos button::after { content: ""; position: absolute; inset: -17px -6px; }
  #recuperar { min-height: 44px; }
}
/* o aviso de instalar fica abaixo do menu lateral aberto do professor */
@media (max-width: 700px) { body:has(.nav-inferior) .ag-app { z-index: 140 !important; } }

/* cartão do ranking publicado (painel do professor): vale no computador e no celular */
.placar-prof { background: var(--ag-superficie, #fff); border: 1px solid var(--ag-borda, #D9E2EE); border-radius: 16px; padding: 1rem 1.1rem; margin: 0 0 1rem; box-shadow: 0 2px 10px rgba(11,59,112,.06); }
.placar-prof h3 { margin: 0 0 .4rem; }
.placar-prof .linha-botoes { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.placar-prof .campo.inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
@media (max-width: 700px) { .placar-prof .linha-botoes > .btn { flex: 1 1 100%; } .placar-prof .campo.inline { flex: 1 1 100%; } .placar-prof select { flex: 1; } }

/* ================= BOTÕES ALINHADOS E UNIFORMES ================= */
/* Barra de ações dos conteúdos (Trazer da Biblioteca, Gerar Avaliação, Gerar Slides, ÁgoraAI, Criar Conteúdo):
   mesma altura e mesmo respiro em qualquer tela; o botão principal não "foge" para a ponta quando a linha quebra. */
.ct-acoes .btn, .it-faixa-acoes .btn, .rp-barra .btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.ct-acoes { align-items: stretch; }
.ct-filtro { min-height: 44px; }

@media (max-width: 700px) {
  .ct-acoes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
  .ct-acoes .ct-criar { grid-column: 1 / -1; order: -2; margin: 0; min-height: 50px; }
  .ct-acoes .ct-escuro { grid-column: 1 / -1; order: -1; }
  .ct-acoes .btn:not(.ct-criar):not(.ct-escuro) { flex-direction: column; gap: .25rem; min-height: 76px; padding: .55rem .3rem; font-size: .82rem; line-height: 1.15; text-align: center; }
  .ct-acoes .btn .ag-ic { width: 1.45rem; height: 1.45rem; }
  .ct-vista-barra { justify-content: space-between; }

  /* qualquer fileira de botões: colunas iguais; o botão que sobra ocupa a linha inteira */
  .linha-botoes:not(:has(> :is(input, select, label, span, p, textarea))), .it-faixa-acoes, .modal-acoes {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; align-items: stretch;
  }
  .linha-botoes:not(:has(> :is(input, select, label, span, p, textarea))) > :last-child:nth-child(odd),
  .it-faixa-acoes > :last-child:nth-child(odd), .modal-acoes > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .linha-botoes:not(:has(> :is(input, select, label, span, p, textarea))) > .btn, .linha-botoes:not(:has(> :is(input, select, label, span, p, textarea))) > button,
  .it-faixa-acoes > *, .modal-acoes > * { width: 100%; margin: 0; justify-content: center; text-align: center; }

  /* ================= MENU ⋯ (e outras listas flutuantes): nunca cortado ================= */
  .menu-lista, .cd-menu-lista {
    position: fixed !important; left: .7rem !important; right: .7rem !important; top: auto !important;
    bottom: calc(80px + env(safe-area-inset-bottom)) !important; width: auto !important; min-width: 0 !important;
    max-height: 68dvh; overflow-y: auto; z-index: 400; padding: .4rem; border-radius: 16px;
    box-shadow: 0 -8px 40px rgba(8,20,40,.35); -webkit-overflow-scrolling: touch;
  }
  .menu-op { min-height: 48px; display: flex; align-items: center; white-space: normal; padding: .7rem .9rem; font-size: 1rem; }
  .menu > summary { min-width: 44px; min-height: 44px; justify-content: center; }

  /* ================= TEXTO NUNCA CORTADO ================= */
  h1, h2, h3, h4, p, li, summary, label, .sub, .cartao-item *, .rk-nome, .nome-txt { overflow-wrap: anywhere; min-width: 0; }
  .cartao-item, .card, .cartao { min-width: 0; }
  td, th { overflow-wrap: break-word; word-break: normal; }
  table .nome-txt { white-space: normal; }
}

/* ícone de traço fino na aba ativa do aluno (o mesmo do menu lateral do professor) */
.abas-aluno a .ag-ic { display: inline-grid; width: 22px; height: 22px; flex: none; }
.abas-aluno a .ag-ic svg { width: 100%; height: 100%; }
.abas-aluno a .ag-ic .ag-ic-emoji { display: none; }

/* cartão de conteúdo no celular: título com a largura toda; interruptor e ⋯ numa linha própria */
@media (max-width: 700px) {
  .ct-item { flex-wrap: wrap; row-gap: .4rem; }
  .ct-item .item-linha { flex: 1 1 100%; align-items: flex-start; }
  .ct-item .item-texto { flex: 1; min-width: 0; }
  .ct-item .item-texto strong { overflow-wrap: break-word; word-break: normal; }
  .ct-item .interruptor { margin-left: auto; }
}

/* abas sem ícone (inativas) mantêm a mesma altura da ativa */
@media (max-width: 700px) { .pagina-aluno .abas-aluno a { min-height: 56px; } }

/* ===== aluno no celular: barra só com ícones (a aba ativa fica em destaque, sem nome); topo alinhado ===== */
@media (max-width: 700px) {
  .pagina-aluno .abas-aluno { overflow-x: hidden; gap: .15rem; padding-inline: .35rem; justify-content: space-between; }
  .pagina-aluno .abas-aluno a { flex: 1 1 0; min-width: 0 !important; padding: .4rem .15rem; font-size: 0; line-height: 0; gap: 0; border-radius: 14px; }
  .pagina-aluno .abas-aluno a .ag-ic { width: 28px; height: 28px; }
  .pagina-aluno .abas-aluno a.ativo { flex: 1.5 1 0; font-size: 0; line-height: 0; gap: 0; }
  .pagina-aluno .abas-aluno a.ativo .ag-ic { width: 28px; height: 28px; }

  .pagina-aluno .topo-marca { display: flex; align-items: center; gap: .5rem; flex: 1 1 100%; min-width: 0; }
  .pagina-aluno .topo-marca .marca-nome { flex: none; }
  .pagina-aluno .topo-marca small { display: block; flex: 1; min-width: 0; margin: 0; font-size: .72rem; letter-spacing: .06em; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; opacity: .85; }
  .pagina-aluno .topo-acoes { flex: 1 1 100%; justify-content: space-between; }
}

/* ===== mapa mental e atalhos externos ===== */
.mm-moldura { border: 1px solid var(--linha, #d9e0ea); border-radius: 14px; background: #fff; overflow: auto; max-height: 56dvh; -webkit-overflow-scrolling: touch; }
.mm-palco svg { display: block; max-width: none; }
.mm-texto { width: 100%; font: 500 .95rem/1.5 ui-monospace, Menlo, Consolas, monospace; border-radius: 12px; }
.mm-corpo > * + * { margin-top: .9rem; }
.atalhos-externos { border-top: 1px solid var(--linha, #d9e0ea); padding-top: .8rem; }
@media (max-width: 700px) {
  .ct-acoes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-acoes .btn:not(.ct-criar):not(.ct-escuro) { min-height: 64px; flex-direction: row; gap: .45rem; font-size: .9rem; }
}

/* ===== pesquisa dos alunos ===== */
.pq-barra { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.pq-campo { flex: 1 1 220px; min-height: 48px; border-radius: 14px; padding: .6rem .9rem; font-size: 1rem; }
.pq-mic { min-width: 48px; min-height: 48px; border-radius: 14px; border: 2px solid var(--petroleo, #0b3b70); background: #fff; font-size: 1.3rem; cursor: pointer; }
.pq-mic.ouvindo { background: #b3261e; color: #fff; animation: pq-pulso 1s infinite; }
@keyframes pq-pulso { 50% { box-shadow: 0 0 0 8px rgba(179,38,30,.25); } }
.pq-tons { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .7rem 0; }
.pq-tom { min-height: 44px; padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--petroleo, #0b3b70); background: #fff; color: var(--petroleo, #0b3b70); font-weight: 700; cursor: pointer; }
.pq-tom[aria-pressed="true"] { background: var(--petroleo, #0b3b70); color: #fff; }
.pq-troca { background: var(--ag-superficie, #fff); border: 1px solid var(--linha, #d9e0ea); border-radius: 16px; padding: .9rem 1rem; margin-top: .8rem; }
.pq-r { line-height: 1.6; margin: .4rem 0; overflow-wrap: anywhere; }
.pq-espera { opacity: .7; }
.pq-cit { font-weight: 800; text-decoration: none; padding: 0 .1rem; }
.pq-fontes ol { margin: .3rem 0 0; padding-left: 1.2rem; }
.pq-fontes li { margin: .2rem 0; overflow-wrap: anywhere; }
.pq-item { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--linha, #d9e0ea); flex-wrap: wrap; }
.pq-item-txt { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.pq-lista { list-style: none; padding: 0; margin: 0; }

/* ===== repositório de modelos ===== */
.rp-medidor { margin: .4rem 0 .8rem; }
.rp-barra-uso { height: 10px; border-radius: 999px; background: #e6ecf3; overflow: hidden; }
.rp-barra-uso i { display: block; height: 100%; background: #17803f; border-radius: 999px; }
.rp-barra-uso i.quase { background: #c26a00; } .rp-barra-uso i.cheio { background: #b3261e; }
.rp-lista, .rp-canva { list-style: none; padding: 0; margin: .4rem 0 1rem; display: grid; gap: .6rem; }
.rp-canva { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.rp-modelo { display: flex; gap: .7rem; justify-content: space-between; align-items: center; flex-wrap: wrap; border: 1px solid var(--linha, #d9e0ea); border-radius: 14px; padding: .7rem .9rem; background: var(--ag-superficie, #fff); }
.rp-modelo-txt { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; }
.rp-ferr { margin: .5rem 0 .8rem; }
@media (max-width: 700px) { .rp-modelo-bt { width: 100%; } .rp-modelo-bt .btn { width: 100%; } }

/* ===== janelas e caixas flutuantes: nunca passam da tela (corrige conteúdo cortado à direita) ===== */
.modal-fundo { grid-template-columns: minmax(0, 1fr); box-sizing: border-box; max-width: 100vw; overflow: hidden; }
.modal, .modal.largo, .modal.publicar { min-width: 0; max-width: 100%; box-sizing: border-box; }
.modal * { min-width: 0; box-sizing: border-box; }
.modal-corpo { overflow-x: hidden; overflow-wrap: anywhere; }
.modal-corpo :is(pre, textarea, table, svg, img, video, iframe, input, select) { max-width: 100%; }
.modal-corpo pre { white-space: pre-wrap; word-break: break-word; }
.modal-topo h2 { min-width: 0; overflow-wrap: anywhere; }
.modal .btn, .modal button { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.ar-espera, .tutor-convite, .a11y-painel { max-width: calc(100vw - 1.2rem); }
#toasts, #toast { max-width: calc(100vw - 1.2rem); }
@media (max-width: 700px) {
  .modal-fundo { padding: 0; }
  .modal, .modal.largo, .modal.publicar { width: 100%; }
  .mm-moldura { max-width: 100%; }
  .menu-lista, .cd-menu-lista { max-width: calc(100vw - 1.2rem); box-sizing: border-box; overflow-wrap: anywhere; }
  .menu-lista *, .cd-menu-lista * { min-width: 0; white-space: normal; }
}

/* ===== cabeçalho da escola (logo + nome + código): no celular o código desce para baixo e o nome usa a largura toda ===== */
@media (max-width: 700px) {
  .cabeca-turma:has(.logo-escola-bt) { flex-wrap: wrap; align-items: center; gap: .7rem .8rem; }
  .cabeca-turma:has(.logo-escola-bt) .logo-escola-txt { flex: 1 1 0; min-width: 0; }
  .cabeca-turma:has(.logo-escola-bt) .logo-escola-txt h2 { font-size: 1.1rem; line-height: 1.25; overflow-wrap: break-word; word-break: normal; hyphens: auto; margin: 0 0 .2rem; }
  .cabeca-turma:has(.logo-escola-bt) .carimbo { flex: 1 1 100%; max-width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: .8rem; text-align: left; }
  .cabeca-turma:has(.logo-escola-bt) .carimbo-rotulo { grid-column: 1; }
  .cabeca-turma:has(.logo-escola-bt) .carimbo-codigo { grid-column: 1; }
  .cabeca-turma:has(.logo-escola-bt) .carimbo-acoes { grid-column: 2; grid-row: 1 / span 2; flex-direction: column; align-items: flex-end; gap: 0; }
}

/* ===== pé do menu lateral: "Configurações" ocupa a linha e os 3 ícones ficam embaixo, sem se sobrepor ===== */
html:not(.ag-menu-compacto) .pe-atalhos { flex-wrap: wrap; gap: .3rem; }
html:not(.ag-menu-compacto) .pe-atalhos .pe-config { flex: 1 1 100%; min-width: 0; justify-content: flex-start; }
html:not(.ag-menu-compacto) .pe-atalhos .pe-config span { overflow: hidden; text-overflow: ellipsis; }
html:not(.ag-menu-compacto) .pe-atalhos .btn-icone:not(.pe-config) { flex: 1 1 0; min-width: 44px; }

/* ===== barra de pesquisa da tela inicial do aluno (estilo buscador) ===== */
.pq-hero { text-align: center; max-width: 720px; margin: .4rem auto 1.4rem; padding: 1rem .6rem .4rem; }
.pq-hero-titulo { margin: 0; font-size: clamp(1.7rem, 6vw, 2.5rem); line-height: 1.1; color: var(--ag-texto, #14243a); letter-spacing: -.02em; }
.pq-hero-titulo span { background: linear-gradient(90deg, #0b3b70, #1582c5 55%, #e8a30f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pq-hero-sub { margin: .45rem 0 1rem; color: var(--ag-texto-2, #4a5568); font-size: .98rem; }
.pq-hero-barra { display: flex; align-items: center; gap: .3rem; background: #fff; border: 1px solid #d5dde8; border-radius: 999px; padding: .3rem .35rem .3rem 1rem; box-shadow: 0 4px 18px rgba(11,59,112,.12); transition: box-shadow .15s, border-color .15s; }
.pq-hero-barra:focus-within { border-color: #1582c5; box-shadow: 0 6px 24px rgba(21,130,197,.28); }
.pq-hero-lupa { display: inline-grid; width: 22px; height: 22px; color: #6b7a90; flex: none; }
.pq-hero-lupa svg { width: 100%; height: 100%; }
.pq-hero-campo { flex: 1 1 auto; min-width: 0; border: 0 !important; outline: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 1.05rem; padding: .55rem .4rem; color: #14243a; }
.pq-hero-mic { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; flex: none; }
.pq-hero-mic.ouvindo { background: #fde8e8; animation: pq-pulsa 1s infinite; }
@keyframes pq-pulsa { 50% { box-shadow: 0 0 0 8px rgba(179,38,30,.15); } }
.pq-hero-ir { border: 0; background: #0b3b70; color: #fff; font-weight: 700; border-radius: 999px; min-height: 44px; padding: 0 1.2rem; cursor: pointer; flex: none; }
@media (max-width: 480px) { .pq-hero-ir { padding: 0 .9rem; } .pq-hero-lupa { display: none; } .pq-hero-barra { padding-left: .8rem; } }
html.ag-escuro .pq-hero-barra { background: var(--ag-superficie); border-color: var(--ag-borda); }
html.ag-escuro .pq-hero-campo { color: var(--ag-texto); }
.rp-passos { margin: .4rem 0 .9rem; padding-left: 1.3rem; display: grid; gap: .35rem; line-height: 1.45; }

/* ===== modelos visuais: a aula aparece sobre a imagem do modelo ===== */
.aula-modelo { background-size: cover; background-position: center top; background-repeat: no-repeat; border-radius: 16px; padding: clamp(1rem, 4vw, 2.2rem); min-height: 14rem; box-shadow: 0 6px 22px rgba(11,59,112,.14); overflow: hidden; }
.aula-modelo, .aula-modelo .texto-rico, .aula-modelo h1, .aula-modelo h2, .aula-modelo h3, .aula-modelo h4, .aula-modelo p, .aula-modelo li, .aula-modelo strong, .aula-modelo blockquote { color: var(--cor-modelo, inherit); }
.aula-modelo-corpo > * + * { margin-top: 1rem; }
.aula-modelo-faixa { padding: 0; background: var(--ag-superficie, #fff); box-shadow: 0 6px 22px rgba(11,59,112,.14); }
.aula-faixa { display: block; width: 100%; height: auto; }
.aula-modelo-faixa .aula-modelo-corpo { padding: clamp(1rem, 4vw, 1.8rem); }
.mv-previa { margin: .6rem 0 1rem; }
.mv-previa .aula-modelo { min-height: 9rem; }
.mv-mini { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid #d5dde8; flex: none; }

/* ---------- ficha sobre o modelo (diário de bordo) ---------- */
.fh-moldura{max-width:720px;margin:10px auto;border:1px solid var(--borda,#d9e1ee);border-radius:10px;overflow:hidden;box-shadow:0 6px 22px rgba(11,59,112,.12)}
.fh-pagina{position:relative;width:100%;background-size:100% 100%;background-repeat:no-repeat;container-type:inline-size;background-color:#fff}
.fh-txt{position:absolute;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.3;font-family:"Segoe UI",Arial,sans-serif}
.fh-marcar{touch-action:none;cursor:crosshair;user-select:none}
.fh-ret{position:absolute;border:2px solid #EBAA10;background:rgba(235,170,16,.22);border-radius:4px;pointer-events:none;display:grid;place-items:start}
.fh-ret b{background:#EBAA10;color:#3a2a00;font-size:12px;padding:0 6px;border-radius:0 0 6px 0}
.fh-ret.novo{border-style:dashed}
.fh-lista{display:grid;gap:8px;margin-top:10px}
.fh-linha{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;gap:8px;align-items:center}
.fh-linha input,.fh-linha select{min-width:0}
.fh-abas{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.fh-campo-form textarea{width:100%}
.fh-prof{display:flex;gap:8px;flex-wrap:wrap}
.fh-estado{display:block;min-height:1.2em}
.rp-margens{display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center;font-size:.85rem;margin:6px 0}
.rp-margens label{display:inline-flex;gap:5px;align-items:center}
.rp-margens input{width:4.2em}

/* ---------- páginas A4 sobre o modelo (aulas e fichas) ---------- */
.pm-raiz{display:grid;gap:10px}
.pm-lista{display:grid;gap:14px;width:100%}
.pm-pw{position:relative;width:100%;max-width:794px;margin:0 auto;overflow:hidden;border-radius:6px;box-shadow:0 4px 18px rgba(11,59,112,.18);background:#fff}
.pm-pag{position:absolute;left:0;top:0;width:794px;height:1123px;transform-origin:0 0;overflow:hidden;background:#fff;box-sizing:border-box;font:17px/1.5 "Segoe UI",Arial,sans-serif}
.pm-pag *{box-sizing:border-box}
.pm-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0}
.pm-area{position:absolute;z-index:1;overflow:hidden;display:flex;flex-direction:column;gap:10px;color:inherit}
.pm-area>*{flex:none;margin:0;color:inherit}
.pm-area h1,.pm-area h2,.pm-area h3,.pm-area h4{color:inherit;margin:0}
.pm-area img{max-width:100%;max-height:420px;object-fit:contain;border-radius:4px}
.pm-area a{color:inherit;text-decoration:underline}
.pm-capa .pm-area{justify-content:center;align-items:center;text-align:center}
.pm-capa-corpo h1{font-size:40px;line-height:1.15;margin:8px 0 14px}
.pm-capa-corpo p{font-size:18px;margin:4px 0}
.pm-rotulo{text-transform:uppercase;letter-spacing:.3em;font-weight:700;font-size:15px;opacity:.85}
.pm-medir,.pm-fora{position:fixed;left:-12000px;top:0;width:794px;pointer-events:none}
.pm-barra{align-items:center}

/* ================= TABELAS NO CELULAR =================
   Coluna nunca vira 1 letra por linha: a tabela tem largura mínima e rola de lado dentro da caixa;
   a lista "Ao vivo" vira cartões empilhados (nome, situação, progresso, última ação). */
@media (max-width: 760px) {
  .tabela { min-width: 540px; }
  .tabela td, .tabela th { padding: .55rem .6rem; }
  .tabela td:first-child, .tabela th:first-child { min-width: 7.5rem; }
  .tabela-caixa { border-radius: 12px; }
  .tabela-caixa.caderneta .tabela { min-width: 0; }

  .av-tabela { overflow: visible; border: 0; background: transparent; }
  .av-tabela .tabela { min-width: 0; display: block; }
  .av-tabela thead { display: none; }
  .av-tabela tbody { display: grid; gap: .6rem; }
  .av-tabela tbody tr {
    display: grid; grid-template-columns: 1fr auto; gap: .35rem .6rem; align-items: center;
    padding: .7rem .8rem; background: var(--papel, #fff); border: 1px solid var(--linha, #d6dde6);
    border-radius: 14px;
  }
  .av-tabela td { display: block; padding: 0; border: 0; min-width: 0 !important; }
  .av-tabela td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .av-tabela td:nth-child(5) { grid-column: 2; grid-row: 1; }
  .av-tabela td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .av-tabela td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: .6rem; }
  .av-tabela td:nth-child(3) .av-barra { flex: 1; }
  .av-tabela td:nth-child(4) { grid-column: 1 / -1; grid-row: 4; color: var(--tinta-3, #5b6b7b); }
  .av-tabela .btn-icone { min-width: 44px; min-height: 44px; }
  .av-tabela .av-aluno strong { overflow-wrap: anywhere; }
}

@media (max-width: 760px) {
  .av-stat small { line-height: 1.2; display: block; }
  .av-stat > div { min-width: 0; }
}

/* ================= TEXTO DENTRO DA CAIXA (PC e celular) =================
   Botões, etiquetas e chips quebram a linha em vez de vazar; o ícone não encolhe. */
.btn, .cd-bt, .cd-menu > summary, .btn-link {
  max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: break-word; line-height: 1.2; text-align: center;
}
.cd-bt > span, .btn > span { min-width: 0; }
.cd-bt > .ag-ic, .btn > .ag-ic { flex: none; }
.cd-bt { height: auto; }

/* Professor vendo a turma como aluno (aluno.html?ver=1) */
.faixa-ver { position: sticky; top: 0; z-index: 999; padding: .5rem .8rem; text-align: center; font-weight: 700; font-size: .9rem;
  background: #FFF4CC; color: #5A4300; border-bottom: 2px solid #E8B923; }

/* ===== Cabeçalho do aluno no celular, mais elegante: marca em duas linhas e barra de ações organizada ===== */
@media (max-width: 700px) {
  html .pagina-aluno .topo { gap: .35rem .5rem; padding: max(.55rem, env(safe-area-inset-top)) .85rem .55rem; }
  /* marca: símbolo à esquerda; "ÁGORA" em cima e a turma/escola numa linha discreta embaixo */
  html .pagina-aluno .topo-marca { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .65rem; row-gap: 0; align-items: center; flex: 1 1 100%; min-height: 44px; }
  html .pagina-aluno .topo-marca .topo-simbolo { grid-row: 1 / span 2; width: 42px; height: 42px; }
  html .pagina-aluno .topo-marca .marca-nome { grid-row: 1; align-self: end; font-size: 1.25rem; line-height: 1.05; letter-spacing: .1em; }
  html .pagina-aluno .topo-marca small { grid-row: 2; align-self: start; display: block; margin: 0; font-size: .7rem; letter-spacing: .08em; line-height: 1.25; opacity: .78;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
  /* barra de ações: pontos à esquerda; letra, tela e sair à direita, todos do mesmo tamanho e sem sublinhado */
  html .pagina-aluno .topo-acoes { flex: 1 1 100%; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: .4rem; padding-top: .45rem;
    border-top: 1px solid color-mix(in srgb, var(--ag-menu-texto, #fff) 16%, transparent); }
  html .pagina-aluno .topo-acoes .xp { order: -1; margin-right: auto; display: inline-flex; align-items: center; min-height: 34px; padding: 0 .85rem; border-radius: 999px; font-size: .86rem; letter-spacing: .01em; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset; }
  html .pagina-aluno .letra-controle { gap: 0; border: 1px solid color-mix(in srgb, var(--ag-menu-texto, #fff) 32%, transparent); border-radius: 999px; overflow: hidden; }
  html .pagina-aluno .letra-controle button { width: 40px; height: 36px; border: 0; border-radius: 0; font-size: .85rem; }
  html .pagina-aluno .letra-controle button + button { border-left: 1px solid color-mix(in srgb, var(--ag-menu-texto, #fff) 22%, transparent); }
  html .pagina-aluno #aparencia-aluno, html .pagina-aluno #sair { min-height: 36px; padding: 0 .85rem; border: 1px solid color-mix(in srgb, var(--ag-menu-texto, #fff) 32%, transparent); border-radius: 999px; text-decoration: none; font-size: .85rem; font-weight: 600; white-space: nowrap; }
  html .pagina-aluno #aparencia-aluno:active, html .pagina-aluno #sair:active { background: color-mix(in srgb, var(--ag-menu-texto, #fff) 14%, transparent); }
}
@media (max-width: 380px) {
  html .pagina-aluno .topo-acoes { gap: .3rem; }
  html .pagina-aluno .topo-acoes .xp { padding: 0 .65rem; font-size: .8rem; }
  html .pagina-aluno .letra-controle button { width: 34px; }
  html .pagina-aluno #aparencia-aluno, html .pagina-aluno #sair { padding: 0 .65rem; font-size: .8rem; }
}
