:root {
  --bg: #f3f1ec;
  --paper: #fffcf7;
  --ink: #1c1b19;
  --muted: #6b675f;
  --line: #e2ddd3;
  --accent: #2c4a3e;
  --topo: 52px;
  --arvore: 268px;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

.topo {
  height: var(--topo);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.marca {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}
.busca { flex: 1; min-width: 0; }
.busca input {
  width: 100%;
  border: 0;
  background: var(--bg);
  border-radius: 999px;
  padding: 8px 14px;
  outline: none;
}
.acoes { display: flex; align-items: center; gap: 10px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button {
  border: 0; background: transparent; padding: 4px 9px; cursor: pointer;
}
.lang button.ativo { background: var(--ink); color: var(--paper); }
.entrar, .menu {
  border: 0; background: none; cursor: pointer; text-decoration: none;
}
.menu { display: none; font-size: 18px; }
.ia { font-size: 11px; color: var(--muted); white-space: nowrap; }

.nota { background: var(--paper); border-bottom: 1px solid var(--line); }
.nota-bar {
  width: 100%; text-align: left; background: none; border: 0;
  padding: 10px 20px; display: flex; justify-content: space-between;
  cursor: pointer; color: var(--muted);
}
.nota-corpo { padding: 0 20px 16px; max-width: 720px; font-family: var(--serif); font-size: 16px; line-height: 1.55; }
.nota-corpo p { margin: 0 0 12px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }

.layout { display: grid; grid-template-columns: var(--arvore) 1fr; min-height: calc(100vh - var(--topo)); }
.arvore {
  border-right: 1px solid var(--line);
  padding: 12px 8px 40px;
  overflow: auto;
  background: var(--paper);
}
.arvore-cab { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 10px 10px; font-size: 12px; color: var(--muted); }
.arvore a { text-decoration: none; }
.no {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.no:hover, .no.ativo { background: var(--bg); }
.no .n { float: right; color: var(--muted); font-size: 11px; }
.filhos { padding-left: 12px; }

main { padding: 16px 20px 80px; }
.trilha { font-size: 13px; color: var(--muted); margin-bottom: 10px; min-height: 1em; }
.filtros { margin-bottom: 14px; }
.filtros select { border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 4px 8px; }

.grade {
  columns: 210px;
  column-gap: 12px;
}
.card {
  break-inside: avoid;
  margin: 0 0 12px;
  background: var(--paper);
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}
.card img { width: 100%; height: auto; display: block; vertical-align: middle; }
.card .cap { display: none; }

.vazio { color: var(--muted); text-align: center; padding: 48px 0; }
.mais { height: 1px; }

.lb { border: 0; padding: 0; max-width: min(1100px, 96vw); background: transparent; }
.lb::backdrop { background: rgba(20, 18, 14, .72); }
.lb-in {
  display: grid;
  grid-template-columns: 1fr 300px;
  background: var(--paper);
  border-radius: 8px;
  overflow: hidden;
  max-height: 92vh;
}
.lb-in img { width: 100%; height: 100%; object-fit: contain; background: #111; max-height: 92vh; }
.lb-meta { padding: 20px; overflow: auto; }
.lb-meta h2 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 0 0 6px; }
.lb-meta .pasta { color: var(--muted); margin: 0 0 12px; }
.dl { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.dl a, .dl button, .fechar {
  display: block; text-align: center; text-decoration: none;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: 8px; border-radius: 6px; cursor: pointer;
}
.dl button, .fechar { background: transparent; color: var(--ink); }
.aviso { font-size: 12px; color: var(--muted); }

.painel { max-width: 560px; margin: 48px auto; background: var(--paper); padding: 28px; border-radius: 8px; }
.painel h1 { font-family: var(--serif); font-weight: 500; margin: 0 0 8px; }
.painel input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0 12px; background: var(--bg); }
.cards { display: grid; gap: 12px; margin-top: 20px; }
.cards article { border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.cards h2 { margin: 0 0 6px; font-size: 16px; }

@media (max-width: 860px) {
  .menu { display: block; }
  .layout { grid-template-columns: 1fr; }
  .arvore {
    display: none; position: fixed; top: var(--topo); left: 0; bottom: 0; width: min(84vw, 320px); z-index: 15;
    box-shadow: 8px 0 24px rgba(0,0,0,.08);
  }
  .arvore.aberta { display: block; }
  .ia { display: none; }
  .lb-in { grid-template-columns: 1fr; }
}
