/* crossInvoice no bolso — as cores e a letra do crossInvoice do computador:
   verde-floresta e pedra do logo da Crosta, papel de líquen, Courier Prime */
@font-face { font-family: "Courier Prime"; src: url("fonts/CourierPrime-Regular.ttf"); font-weight: 400; }
@font-face { font-family: "Courier Prime"; src: url("fonts/CourierPrime-Bold.ttf"); font-weight: 700; }

:root {
  --paper: #e8ebe4;
  --card: #f7f8f3;
  --ink: #1b231f;
  --ink-soft: #59625c;
  --rule: #d2d7cd;
  --stamp: #2c5141;
  --stamp-soft: #dfe8e1;
  --debit: #a3392a;
  --debit-soft: #f5e8e3;
  --spine: #21342a;
  --spine-text: #ddd8cd;
  --type: "Courier Prime", "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--stamp); }
h1, h2 { font-family: var(--type); font-weight: 700; line-height: 1.2; }
h1 { font-size: 22px; margin: 0 0 10px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
[hidden] { display: none !important; }

.topo {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--spine); color: var(--spine-text);
}
.topo-anel { flex: none; }
.topo-texto { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topo-nome { font-family: var(--type); font-weight: 700; font-size: 20px; line-height: 1; }
.topo-sub { font-family: var(--type); font-size: 12px; opacity: .8; }
.topo-botao {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(221, 216, 205, .5); background: transparent;
  color: var(--spine-text); font-size: 22px; cursor: pointer;
}
.a-rodar { animation: rodar 1s linear infinite; }
@keyframes rodar { to { transform: rotate(360deg); } }

main { padding: 12px 16px; max-width: 640px; margin: 0 auto; }
.cartao {
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 16px; margin-bottom: 12px;
}
.nota { color: var(--ink-soft); font-size: 13px; display: block; }
.vencida { color: var(--debit); }
.nota-inline { color: var(--ink-soft); font-size: 13px; }

.aviso { border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.aviso-erro { background: var(--debit-soft); color: var(--debit); }
.aviso-ok { background: var(--stamp-soft); color: var(--stamp); }
.aviso-rede { background: var(--card); color: var(--ink-soft); border: 1px dashed var(--rule); }
.aviso-enviar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--stamp-soft); color: var(--stamp); font-weight: 600;
}
.aviso-enviar .btn { flex: none; width: auto; margin-top: 0; padding: 0 16px; }

.btn {
  display: block; width: 100%; min-height: 48px; margin-top: 10px;
  border: 1px solid var(--stamp); border-radius: 8px;
  background: var(--stamp); color: #fff; font: 600 16px var(--sans);
  text-align: center; text-decoration: none; line-height: 46px; cursor: pointer;
}
.btn:disabled { opacity: .45; }
.btn-ghost { background: transparent; color: var(--stamp); }
.btn-perigo { border-color: var(--debit); color: var(--debit); }
.btn-peq { min-height: 40px; line-height: 38px; font-size: 14px; }

.campo {
  width: 100%; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff;
  font: 16px var(--sans); color: var(--ink);
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.pilha { display: flex; flex-direction: column; gap: 12px; }
.lado-a-lado { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset.livros { border: 1px solid var(--rule); border-radius: 8px; padding: 10px; margin: 0; }
fieldset.livros legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.linha-livro {
  display: grid; grid-template-columns: 1fr 76px; gap: 6px 8px; margin-bottom: 10px;
}
.campo-qtd { text-align: right; }
.sugestao { grid-column: 1 / -1; font-size: 12.5px; min-height: 0; }
.sugestao-guia { color: var(--stamp); font-weight: 600; }
.sugestao-repor { color: var(--ink-soft); }

.cabecalho-lista { position: sticky; top: 64px; z-index: 1; padding-bottom: 8px; background: var(--paper); }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { margin-bottom: 8px; }
.loja {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  padding: 12px 14px; background: var(--card); border: 1px solid var(--rule);
  border-radius: 10px; color: var(--ink); text-decoration: none;
}
.loja-nome { font-weight: 600; }
.loja-info { color: var(--ink-soft); font-size: 13px; grid-column: 1; }
.loja-morada { color: var(--ink-soft); font-size: 13px; grid-column: 1 / -1; }
.loja .selo { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.selo {
  display: inline-block; font: 700 11px var(--type); text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 7px; border: 1.5px solid currentColor; border-radius: 4px;
}
.selo-alerta { color: var(--debit); }
.vazio { color: var(--ink-soft); }
.voltar { display: inline-block; margin-bottom: 8px; text-decoration: none; }

.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; font-size: 12px; color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding: 4px; }
.tabela td { border-bottom: 1px solid var(--rule); padding: 6px 4px; vertical-align: top; }
.tabela .num { text-align: right; white-space: nowrap; }
.linha-alerta td { color: var(--debit); }
.lista-simples { padding-left: 18px; margin: 6px 0; }
.lista-simples li { margin-bottom: 10px; }
.passos { padding-left: 20px; }
.passos li { margin-bottom: 8px; }
.dados { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.dados dt { color: var(--ink-soft); }
.dados dd { margin: 0; }

.menu {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--spine); padding-bottom: env(safe-area-inset-bottom);
}
.menu a {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 56px; color: var(--spine-text); text-decoration: none;
  font: 700 14px var(--type);
}
.menu a.activo { background: rgba(221, 216, 205, .14); box-shadow: inset 0 3px 0 var(--spine-text); }
.conta:not(:empty) {
  min-width: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--debit); color: #fff; font: 700 12px/20px var(--sans);
}
