/* ===== As minhas notas + imprimir/PDF (13-10-2026) =====
   CSS próprio sobre as variáveis da plataforma: o Tailwind compilado não
   conhece classes novas. A caixa fecha a lição como um bloco de caderno:
   fundo de papel, margem de cor da marca à esquerda, o cadeado a dizer
   «privadas». Na impressão, a caixa dá lugar ao texto da nota. */

.notas { margin-top: 2rem; padding: 1.1rem 1.25rem 1rem; border: 1px solid var(--color-slate-200);
  border-left: 4px solid var(--color-brand); border-radius: 0.9rem;
  background: linear-gradient(#fffdf7, #fffdf7) padding-box; }
.notas-cab { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.notas-titulo { display: flex; align-items: center; gap: 0.5rem; margin: 0 !important;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--color-slate-900); }
.notas-titulo svg { width: 1.1rem; height: 1.1rem; color: var(--color-brand); }
.notas-privado { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem;
  border-radius: 999px; background: var(--color-brand-soft); color: var(--color-brand);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.notas-privado svg { width: 0.8rem; height: 0.8rem; }
.notas-form { margin: 0.75rem 0 0 !important; }
.notas-texto { display: block; width: 100%; min-height: 6.5rem; resize: vertical; margin: 0 !important;
  padding: 0.75rem 0.9rem; border: 1px solid var(--color-slate-300); border-radius: 0.6rem; background: #fff;
  font: inherit; font-size: 1rem; line-height: 1.6; color: var(--color-slate-900);
  transition: border-color 150ms ease, box-shadow 150ms ease; }
.notas-texto:focus { outline: none; border-color: var(--color-brand);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-brand) 22%, transparent); }
.notas-rodape { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem;
  flex-wrap: wrap; margin-top: 0.45rem; }
.notas-ajuda { margin: 0 !important; font-size: 0.82rem; color: var(--color-slate-600); }
.notas-estado { font-size: 0.8rem; font-weight: 600; color: var(--color-slate-600); min-height: 1.2em; }
.notas-estado.a-gravar { color: var(--color-slate-500); }
.notas-estado.erro { color: #b42318; }
.notas-todas { margin: 0.6rem 0 0 !important; font-size: 0.85rem; }
.nota-impressa { display: none; }
.notas-oculto { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* botão «Imprimir ou guardar em PDF» */
.btn-imprimir { display: inline-flex !important; align-items: center; gap: 0.45rem; padding: 0.4rem 0.8rem !important;
  font-size: 0.85rem !important; text-decoration: none !important; min-height: 2.25rem; }
.btn-imprimir svg { width: 1rem; height: 1rem; flex: none; }
.licao-acoes { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; margin: -0.25rem 0 0.75rem; }

/* página «As minhas notas» */
.notas-pag-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.notas-acoes { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.notas-docente, .notas-aviso, .notas-vazio { margin-bottom: 1.25rem; padding: 0.9rem 1.1rem; border-radius: 0.8rem; font-size: 0.95rem; }
.notas-docente { border: 1px dashed color-mix(in oklab, var(--color-brand) 45%, transparent); background: color-mix(in oklab, var(--color-brand-soft) 50%, white); }
.notas-docente-t { margin: 0 0 0.25rem !important; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-brand); }
.notas-aviso { border: 1px solid #f5c26b; background: #fffbeb; color: #7a4a06; }
.notas-vazio { border: 1px dashed var(--color-slate-300); background: var(--color-slate-50); }
.notas-cap { margin-bottom: 1.75rem; }
.notas-cap-t { margin: 0 0 0.6rem !important; font-size: 0.72rem !important; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--color-slate-600); }
.notas-item { margin-bottom: 0.75rem; padding: 0.9rem 1.1rem; border: 1px solid var(--color-slate-200);
  border-left: 4px solid var(--color-brand); border-radius: 0.8rem; background: #fffdf7; }
.notas-item-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; flex-wrap: wrap; margin: 0 0 0.4rem !important; }
.notas-item-cab a { font-weight: 700; color: var(--color-slate-900); }
.notas-item-data { font-size: 0.78rem; color: var(--color-slate-600); }
.notas-item-texto, .nota-impressa-texto { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; color: var(--color-slate-800); }
.imprimir-eyebrow { margin: 0 0 0.25rem !important; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--color-brand); }
.imprimir-licao { margin-bottom: 1.5rem; }
.imprimir-nota { margin-top: 1.5rem; padding: 0.9rem 1.1rem; border-left: 4px solid var(--color-brand); background: #fffdf7; border-radius: 0.6rem; }
.nota-impressa-t { margin: 0 0 0.35rem !important; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-brand); }

@media (max-width: 640px) {
  .notas { padding: 1rem; }
  .notas-acoes, .licao-acoes { width: 100%; }
  .notas-acoes .btn-imprimir, .licao-acoes .btn-imprimir { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .notas-texto { transition: none; } }

/* ===== Impressão =====
   Fica a matéria, as figuras, as tabelas e a nota. Sai tudo o que é para
   clicar. O modo de estudo (uma secção de cada vez) não esconde nada. */
@media print {
  @page { margin: 16mm 15mm 18mm; }
  html, body { background: #fff !important; }
  body { font-size: 11pt; }
  #sidebar, #sb-fundo, .app-grid header.sticky, .app-grid > div > footer, .pagina-grelha > aside, #pagina-nav,
  .estudo-barra, .estudo-nav, .est, #est-config, #est-molde, .btn-imprimir, .licao-acoes, .notas-acoes,
  .pagina-grelha > div > .helptext:first-child, .mx-auto > .helptext:first-child, button, .btn,
  .messages, .so-ecra, .notas-form, .notas-todas, .notas-cab, .notas-docente, .notas-aviso,
  .nao-projetar:not(.notas), [data-no-print] { display: none !important; }
  .app-grid, .pagina-grelha { display: block !important; max-width: none !important; }
  main, .card { box-shadow: none !important; border: 0 !important; padding: 0 !important; margin: 0 !important; background: none !important; }
  .leitura.em-estudo > *:not(.est):not(.nao-projetar):not(script):not(template):not(form):not(.verificacao):not([data-no-print]):not(#resumo-espera) { display: revert !important; }
  .leitura details > *:not(summary) { display: block !important; }
  .leitura > p, .leitura > ul, .leitura > ol, .leitura > h2, .leitura > h3 { max-width: none !important; }
  h1, h2, h3, h4 { break-after: avoid; page-break-after: avoid; }
  figure, table, .diagrama, .destaque, .exemplo, .factos, .facto, blockquote, pre { break-inside: avoid; page-break-inside: avoid; }
  .diagrama { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .diagrama img { max-height: none !important; }
  a { color: inherit !important; text-decoration: none !important; }
  .licao-artigo > *:not(h1):not(.leitura):not(.notas):not(.glossario) { display: none !important; }
  /* dentro da matéria: o que é para clicar sai, o resumo libertado fica */
  .leitura .verificacao, .leitura form, #resumo-espera, #resumo-do-bloco:has(~ #resumo-espera),
  .leitura > .nao-projetar { display: none !important; }
  .notas { margin-top: 1.25rem; padding: 0; border: 0; background: none; }
  .notas.vazia { display: none !important; }
  .nota-impressa, .imprimir-nota { display: block !important; padding: 8pt 10pt; border-left: 3pt solid #14532d;
    background: #fffdf7 !important; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .imprimir-licao { break-before: page; page-break-before: always; }
  .imprimir-licao:first-of-type { break-before: auto; page-break-before: auto; }
}
.licao-imprimir { margin-left: auto; }
/* Notas fechadas por defeito (18-10-2026): uma linha do mesmo cartão; abre ao clicar */
.notas:has(> .notas-dobra:not([open])) { padding-top: .7rem; padding-bottom: .7rem; }
.notas-dobra > summary { list-style: none; cursor: pointer; flex-wrap: nowrap; border-radius: .5rem; }
.notas-dobra > summary .notas-titulo { flex: none; white-space: nowrap; }
.notas-dobra > summary .notas-titulo svg, .notas-dobra > summary .notas-privado { flex: none; }
.notas-dobra > summary::-webkit-details-marker { display: none; }
.notas-dobra > summary:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 4px; }
.notas-resumo { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .9rem; color: var(--color-slate-600); }
.notas-dobra > summary:hover .notas-resumo { color: var(--color-brand); }
.notas-dobra[open] .notas-resumo { visibility: hidden; }
.notas-seta { width: 1.1rem; height: 1.1rem; flex: none; color: var(--color-slate-500); }
.notas-dobra[open] .notas-seta { transform: rotate(180deg); }
@media (prefers-reduced-motion: no-preference) { .notas-seta { transition: transform .18s ease; } }
@media (max-width: 640px) { .notas-dobra > summary .notas-privado { display: none; } }

