:root {
  --paper: #f3efe6;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #e4dccb;
  --card: #fffdf8;
  --blue: #2f6fed;
  --blue-deep: #1b3f86;
  --green: #0e6b4f;
  --green-soft: #e7f6ef;
  --amber: #8a4b12;
  --amber-soft: #fff4e4;
  --shadow: 0 18px 40px rgba(60, 42, 20, 0.08);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: Palatino, "Palatino Linotype", Georgia, serif; font-weight: 600; letter-spacing: -0.02em; }
h1 { margin: 0; font-size: 2.4rem; line-height: 0.95; }
h2 { margin: 0 0 0.6rem; font-size: 1.8rem; }
a { color: var(--blue-deep); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.fundo {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #1b3f86 url("../imagem/Tatu_icone.png") center / cover no-repeat;
}
.fundo img,
.fundo video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}
.fundo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(27, 63, 134, 0.18), rgba(243, 239, 230, 0.28) 28%, rgba(243, 239, 230, 0.2));
}

.top, .nav, main, .rodape { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.top { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding: 28px 0 12px; }
.brand { display: flex; gap: 14px; align-items: center; background: rgba(255, 253, 248, 0.92); border-radius: 22px; padding: 8px 18px 8px 8px; }
.mark {
  width: 72px;
  height: 72px;
  flex: none;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(27, 63, 134, 0.18);
}
.eyebrow { margin: 0 0 4px; color: var(--blue-deep); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }
.lede { max-width: 34rem; margin: 0; font-size: 1.15rem; line-height: 1.45; background: rgba(255, 253, 248, 0.92); border-radius: 16px; padding: 12px 16px; }

.nav { display: flex; gap: 8px; padding-bottom: 18px; flex-wrap: wrap; }
.nav-btn, .ghost, .chip, .year {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
}
.nav-btn.is-on, .chip.is-on, .year.is-on { background: var(--blue-deep); color: white; border-color: var(--blue-deep); }
.ghost { margin-top: 10px; }

.layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr); gap: 18px; align-items: start; padding-bottom: 28px; }
.panel, .resultado {
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: 0 22px 50px rgba(27, 40, 70, 0.14);
}
.panel { padding: 8px 22px 22px; }
.resultado { padding: 22px; position: sticky; top: 16px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 16px 0; }
legend { padding: 0; font-family: Palatino, Georgia, serif; font-size: 1.15rem; }
label { display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid #d9d0c0;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(47, 111, 237, 0.35); outline-offset: 1px; }
input:disabled { background: #f6f3ec; color: var(--muted); }
.choice, .grid-2, .grid-3, .years, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 8px; color: var(--ink); background: #faf7f1; border-radius: 12px; padding: 8px 10px; }
.choice input { width: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.hint { color: var(--muted); font-size: 0.9rem; line-height: 1.45; margin: 8px 0 0; }
.busca-caixa { position: relative; }
.busca-lista, .lista-class { display: grid; gap: 6px; }
.busca-lista {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(280px, 42dvh);
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.busca-lista[hidden] { display: none !important; }
.lista-class { margin-top: 8px; }
.hit, .linha-class {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
}
.hit small, .linha-class small { display: block; color: var(--muted); }
.classif-card { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: #f7f8fc; border: 1px solid #d9e1f5; }
.classif-card strong { font-family: Palatino, Georgia, serif; font-size: 1.35rem; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--ink); }
.check input { width: auto; }

.kicker { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
.total { margin: 4px 0 8px; font-family: Palatino, Georgia, serif; font-size: 3rem; line-height: 1; color: var(--green); }
.trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.trio article { background: var(--green-soft); border-radius: 14px; padding: 10px; }
.trio span { display: block; color: var(--muted); font-size: 0.8rem; }
.trio strong { font-size: 1.15rem; }
.aviso, .nota, .erro {
  border-radius: 14px;
  padding: 10px 12px;
  margin: 10px 0;
  line-height: 1.45;
}
.aviso { background: var(--amber-soft); color: var(--amber); }
.nota { background: #eef3ff; color: var(--blue-deep); }
.erro { background: #fdecea; color: #8d2a22; }
.linhas { list-style: none; padding: 0; margin: 8px 0; }
.linhas li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sai { color: var(--amber); }
.memoria { white-space: pre-wrap; background: #faf7f1; border-radius: 14px; padding: 12px; line-height: 1.5; }
.acoes { display: flex; gap: 8px; margin-top: 12px; }
.prose { padding: 22px; margin-bottom: 28px; }
.timeline { padding-left: 18px; }
.timeline li { margin: 0 0 12px; line-height: 1.45; }
.rodape { color: var(--muted); font-size: 0.85rem; margin-bottom: 28px; padding: 14px 18px; background: rgba(255, 253, 248, 0.92); border-radius: 16px; }
.lista-class { max-height: 70vh; overflow: auto; }

@media (max-width: 860px) {
  .top, .layout { display: block; }
  .lede { margin-top: 12px; }
  .resultado { position: static; margin-top: 16px; }
  .grid-3, .trio { grid-template-columns: 1fr; }
  .total { font-size: 2.4rem; }
  h1 { font-size: 2rem; }
}

@media (max-width: 560px) {
  .top, .nav, main, .rodape { width: min(1120px, calc(100% - 20px)); }
  .grid-2 { grid-template-columns: 1fr; }
  .panel, .resultado { padding: 8px 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .fundo video { display: none; }
}

@media print {
  .nav, .top .lede, #form-venda, .rodape, .acoes, #view-calendario, #view-classificar, .fundo { display: none !important; }
  .layout { display: block; }
  .resultado { box-shadow: none; border: 0; position: static; background: white; }
  body { background: white; }
}
