:root {
  --cafe: #3B2912; --cafe-escuro: #2B1D0E; --caramelo: #946E3E; --caramelo-claro: #C9A46A;
  --creme: #F4EFE7; --creme-claro: #FAF7F2; --texto: #3A2E22; --texto-suave: #6B5A46; --borda: #E3D9CA;
  --verde: #2F6B3A; --verde-fundo: #E7F1E6; --vermelho: #9B2C1F; --vermelho-fundo: #F8E6E2;
  --ambar: #8A5A00; --ambar-fundo: #FBF0D9; --raio: 10px;
  --sombra: 0 1px 2px rgba(43, 29, 14, .06), 0 2px 8px rgba(43, 29, 14, .06);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--creme-claro); color: var(--texto); line-height: 1.45;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--cafe); margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
a { color: var(--cafe); }
button, input, select, textarea { font: inherit; color: inherit; }
.pular { position: absolute; left: -999px; top: 0; background: var(--cafe); color: #fff; padding: .5rem 1rem; z-index: 10; }
.pular:focus { left: .5rem; top: .5rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1rem;
  border-radius: 8px; border: 1px solid var(--cafe); background: var(--cafe); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--cafe-escuro); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.secundario { background: #fff; color: var(--cafe); }
.btn.secundario:hover { background: var(--creme); }
.btn.perigo { background: #fff; color: var(--vermelho); border-color: var(--vermelho); }
.btn.pequeno { min-height: 36px; padding: .3rem .7rem; font-size: .88rem; }
.btn.link { background: none; border: 0; color: var(--cafe); text-decoration: underline; padding: 0; min-height: 0; font-weight: 500; }
:focus-visible { outline: 3px solid var(--caramelo-claro); outline-offset: 2px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.campo { margin-bottom: .9rem; }
.ajuda { font-size: .87rem; color: var(--texto-suave); margin: .25rem 0 0; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid #B9A88F; border-radius: 8px; background: #fff; }
.marcar { display: flex; align-items: center; gap: .5rem; font-weight: 500; min-height: 40px; cursor: pointer; }
.marcar input { width: 20px; height: 20px; accent-color: var(--cafe); }
.linha-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.erro { background: var(--vermelho-fundo); color: var(--vermelho); padding: .6rem .8rem; border-radius: 8px; margin-bottom: 1rem; }
.nota { background: var(--ambar-fundo); color: #5C3D00; padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.sucesso { background: var(--verde-fundo); color: var(--verde); padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; }

/* telas de entrada */
.tela-central { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--creme); }
.cartao-central { width: 100%; max-width: 440px; background: #fff; border-radius: 14px; box-shadow: var(--sombra); padding: 2rem; }
.marca { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.4rem; }
.marca img { width: 40px; height: 40px; }
.marca .nome { font-family: Georgia, serif; font-size: 1.3rem; color: var(--cafe); font-weight: 700; line-height: 1.1; }
.marca .sub { font-size: .78rem; color: var(--texto-suave); letter-spacing: .04em; }
.qr { display: block; width: 200px; height: 200px; margin: .5rem auto 1rem; border: 1px solid var(--borda); border-radius: 8px; padding: 6px; background: #fff; }
.segredo { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--creme); padding: .4rem .6rem; border-radius: 6px; word-break: break-all; }
.codigos { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; padding: 0; list-style: none; margin: 1rem 0;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.02rem; }
.codigos li { background: var(--creme); padding: .45rem; border-radius: 6px; text-align: center; }
ol.passos { padding-left: 1.2rem; } ol.passos li { margin-bottom: .6rem; }

/* estrutura interna */
.topo { background: var(--cafe); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1.2rem; }
.topo .marca { margin: 0; } .topo .marca .nome { color: #fff; font-size: 1.15rem; } .topo .marca .sub { color: var(--caramelo-claro); }
.topo .marca img { width: 32px; height: 32px; background: var(--creme); border-radius: 6px; padding: 3px; }
.topo .usuario { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.topo .btn.secundario { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.estrutura { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 58px); }
nav.menu { background: #fff; border-right: 1px solid var(--borda); padding: 1rem .6rem; }
nav.menu a { display: flex; align-items: center; min-height: 44px; padding: .4rem .8rem; border-radius: 8px; text-decoration: none; color: var(--texto); font-weight: 500; }
nav.menu a:hover { background: var(--creme); }
nav.menu a[aria-current=page] { background: var(--creme); color: var(--cafe); font-weight: 700; box-shadow: inset 3px 0 0 var(--caramelo); }
main { padding: 1.5rem; max-width: 1100px; width: 100%; min-width: 0; }
.cabecalho-pagina { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.cartao { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.2rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.selo { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--creme); color: var(--cafe); margin: 0 .2rem .2rem 0; }
.selo.ok { background: var(--verde-fundo); color: var(--verde); }
.selo.alerta { background: var(--vermelho-fundo); color: var(--vermelho); }
.selo.atencao { background: var(--ambar-fundo); color: var(--ambar); }
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); }
td .acoes { gap: .35rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.suave { color: var(--texto-suave); }
dialog { border: 0; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 1.4rem; width: min(480px, 92vw); }
dialog::backdrop { background: rgba(43, 29, 14, .45); }
.caixa-link { background: var(--creme); border-radius: 8px; padding: .9rem; margin-top: .8rem; }
.caixa-link input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.aviso { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--cafe); color: #fff; padding: .7rem 1.1rem;
  border-radius: 8px; box-shadow: var(--sombra); max-width: 92vw; z-index: 20; }
.aviso.erro-aviso { background: var(--vermelho); }
.matriz td, .matriz th { text-align: center; } .matriz td:first-child, .matriz th:first-child { text-align: left; }

@media (max-width: 760px) {
  .estrutura { grid-template-columns: minmax(0, 1fr); }
  nav.menu { display: flex; overflow-x: auto; gap: .3rem; border-right: 0; border-bottom: 1px solid var(--borda); padding: .4rem; }
  nav.menu a { white-space: nowrap; }
  nav.menu a[aria-current=page] { box-shadow: inset 0 -3px 0 var(--caramelo); }
  main { padding: 1rem; }
  .topo .usuario .nome-usuario { display: none; }
  .cartao-central { padding: 1.4rem; }
}
.largo { width: 100%; }
.topo-1 { margin-top: 1rem; } .topo-05 { margin-top: .5rem; } .sem-topo { margin-top: 0; }
.acoes.entre { justify-content: space-between; }
fieldset.grupo { border: 0; padding: 0; margin: 0 0 .9rem; }
.legenda { font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
