:root {
  --fundo: #e4ebf0;
  --tinta: #1a2433;
  --papel: #fffaf3;
  --navy: #1b3a4b;
  --navy-2: #24556f;
  --ouro: #a67c3d;
  --linha: #e6dccb;
  --erro: #8c2f2f;
  --ok: #1e6b45;
  --ainda: #8a8175;
  --sombra: 0 18px 40px rgba(27, 58, 75, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--tinta);
  background:
    radial-gradient(900px 420px at 0% -10%, #f8f1e4 0%, transparent 55%),
    var(--fundo);
  font-family: "Segoe UI", Candara, "Trebuchet MS", sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--ouro);
  outline-offset: 2px;
}

.entrada {
  display: grid;
  min-height: 100vh;
}

.entrada-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(300px, 0.85fr);
  min-height: 100vh;
}

.entrada-lado {
  background:
    linear-gradient(160deg, rgba(255, 250, 243, 0.08), transparent 40%),
    var(--navy);
  color: #f6efe4;
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.entrada-lado h1,
.boletim h1,
.cartao h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.entrada-lado h1 { font-size: 56px; line-height: 0.95; max-width: 8ch; }
.entrada-lado p { max-width: 36ch; font-size: 18px; color: #efe4d2; }

.selo {
  margin: 0 0 18px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
  color: var(--ouro);
}

.entrada-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.cartao, .boletim, .bloco {
  background: var(--papel);
  border: 1px solid var(--linha);
  box-shadow: var(--sombra);
}

.cartao { width: min(440px, 100%); padding: 32px 28px 28px; }
.cartao h1 { font-size: 34px; }

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 650; }
.campo span { font-size: 14px; }

input {
  width: 100%;
  border: 1px solid #d9cdb8;
  background: #fff;
  color: var(--tinta);
  border-radius: 8px;
  padding: 12px 12px;
  font: inherit;
  font-weight: 450;
}

.botao, .botao-secundario, .botao-perigo {
  border-radius: 8px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.botao {
  width: 100%;
  border: 0;
  background: var(--navy);
  color: #f6efe4;
}

.botao:disabled { opacity: 0.7; cursor: wait; }

.botao-secundario, .botao-perigo {
  width: auto;
  background: transparent;
}

.botao-secundario { border: 1px solid #c9b89a; color: var(--navy); }
.botao-perigo { border: 1px solid #e2b4b4; color: var(--erro); }

.miudo { width: auto; padding: 8px 12px; }
.atalho { margin: 14px 0 0; text-align: center; }
.atalho a { color: var(--navy-2); font-weight: 700; }

.erro, .aviso, .pendente {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

.erro { background: #f8e8e8; color: var(--erro); }
.aviso, .pendente { background: #eef6f1; color: var(--ok); }

.topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  background: var(--navy);
  color: #f7f1e6;
  border-bottom: 3px solid #c4a15a;
}

.marca { display: flex; flex-direction: column; text-decoration: none; }
.marca span { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #e7c98a; }
.marca strong { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }

.topo-acoes { display: flex; align-items: center; gap: 12px; }
.topo-acoes form { margin: 0; }
.topo-acoes .botao-secundario { color: #f6efe4; border-color: rgba(246, 239, 228, 0.4); }

.conteudo { width: min(1180px, calc(100% - 32px)); margin: 28px auto 48px; }

.boletim {
  border: 0;
  border-radius: 20px;
  padding: 32px 32px 22px;
  background:
    linear-gradient(#c4a15a, #c4a15a) top / 100% 4px no-repeat,
    var(--papel);
  box-shadow: 0 24px 60px rgba(20, 32, 51, 0.1);
}
.boletim-topo { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 22px; }
.boletim h1 { font-size: 44px; color: #142033; line-height: 1; }
.meta, .origem, .rodape, .ajuda { color: #3e4652; }
.origem { text-align: right; font-size: 14px; }
.origem strong { display: block; color: var(--navy); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }

.tabela-rola {
  overflow: auto;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px #e3d7c4;
  background: #fff;
}

table { width: 100%; border-collapse: collapse; min-width: 640px; background: white; }
th, td { padding: 11px 12px; text-align: left; }
thead th { background: var(--navy); color: #f7f1e6; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
td { border-bottom: 1px solid #efe6d8; color: #142033; }
tbody tr:nth-child(even) td { background: #f7f3eb; }
th:first-child, td:first-child { position: sticky; left: 0; }
thead th:first-child { z-index: 3; }
td:first-child { background: #fff; z-index: 1; color: #142033; font-weight: 700; }
tbody tr:nth-child(even) td:first-child { background: #f7f3eb; }
td.nota, th.nota { text-align: center; font-variant-numeric: tabular-nums; }
td.nota { font-weight: 700; color: #142033; }
td.ainda { color: #7d756b; font-weight: 500; }
table.grade { min-width: 1080px; }
table.grade caption {
  caption-side: bottom;
  text-align: left;
  padding: 10px 2px 0;
  color: #5c6570;
  font-size: 13px;
}
table.grade thead tr:first-child th { border-bottom: 2px solid #c4a15a; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
table.grade thead th.sub { background: #163246; color: #f6efe4; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
table.grade th.nota, table.grade td.nota { position: static; left: auto; }
table.grade tbody th.materia {
  position: sticky;
  left: 0;
  min-width: 210px;
  text-align: left;
  z-index: 1;
  color: #142033;
  background: #fffdf8;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 1px 0 0 #e6dccb, 12px 0 16px -14px rgba(20, 32, 51, 0.85);
}
table.grade thead th.materia {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 210px;
  background: var(--navy);
  color: #f7f1e6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}
table.grade tbody tr:nth-child(even) th.materia { background: #f7f3eb; color: #142033; }
table.grade tbody td.grupo-b { background: #f3f7f8; }
table.grade tbody tr:nth-child(even) td.grupo-b { background: #e8eef1; }
table.grade tbody tr.resumo th.materia { background: #1b3a4b; color: #f7f1e6; box-shadow: none; }
table.grade tbody tr.resumo td,
table.grade tbody tr.resumo td.grupo-b { background: #f3ecdf; color: #142033; }

.rodape { margin-top: 16px; }

.acoes { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 16px; }
.acoes form { margin: 0; }
.acoes .botao { width: auto; }

.bloco { padding: 22px; margin-bottom: 18px; }
.bloco h2 { margin: 0 0 8px; font-size: 22px; font-family: Georgia, "Times New Roman", serif; }

.grade-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grade-form .largo, .grade-form .botao { grid-column: 1 / -1; }

.vinculos { display: flex; flex-direction: column; gap: 12px; }
.vinculo {
  border: 1px solid var(--linha);
  background: #fff;
  padding: 14px;
}
.vinculo h3 { margin: 0 0 4px; }
.botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.enderecos { margin: 8px 0 0; padding-left: 18px; }

@media (max-width: 800px) {
  .entrada-grid { grid-template-columns: 1fr; }
  .entrada-lado { padding: 36px 24px; }
  .entrada-lado h1 { font-size: 42px; }
  .boletim, .cartao, .bloco { padding: 18px; }
  .boletim-topo, .topo, .acoes { flex-direction: column; align-items: stretch; }
  .origem, .topo-acoes { text-align: left; }
  .boletim h1 { font-size: 32px; }
  .grade-form { grid-template-columns: 1fr; }
  .conteudo { width: min(100% - 20px, 1040px); }
}

@media print {
  body { background: white; }
  .topo, .acoes, .no-print { display: none !important; }
  .boletim { box-shadow: none; border: 0; }
  .conteudo { width: 100%; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
