:root {
  --fundo: #f7f3ee; --cartao: #ffffff; --texto: #2a2420; --sutil: #7a6e66; --linha: #e6ddd3;
  --acento: #8a3b12; --acento-claro: #f3e2d6; --ok: #2f7a4b; --alerta: #b5531c; --perigo: #b3261e;
  --roma: #b3261e; --florenca: #8a5a00; --veneza: #1f5f8b; --outro: #5b5b5b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #1a1715; --cartao: #25211e; --texto: #efe8e1; --sutil: #a99d93; --linha: #3a342f;
    --acento: #e08a5a; --acento-claro: #3a2a20; --ok: #6cc28f; --alerta: #e69a64; --perigo: #f08a80;
    --roma: #f08a80; --florenca: #e0b45a; --veneza: #7fb7e0; --outro: #aaa;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
       -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h2 { font-size: 1.15rem; margin-top: 1.2em; }
a { color: var(--acento); }
.sutil { color: var(--sutil); margin: 0; font-size: .9rem; }
.erro { color: var(--perigo); min-height: 1.2em; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: .55em .65em; border: 1px solid var(--linha);
  border-radius: 10px; background: var(--cartao); }
button { cursor: pointer; border: 0; border-radius: 10px; padding: .6em 1em;
  background: var(--acento); color: #fff; font-weight: 600; }
button.secundario { background: var(--acento-claro); color: var(--acento); }
button.link { background: none; color: var(--acento); padding: .2em .3em; font-weight: 500; }
label { display: block; margin: .6em 0; font-size: .9rem; color: var(--sutil); }
label input, label select, label textarea { margin-top: .25em; color: var(--texto); }

.tela { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(360px, 100%); }
.cartao { background: var(--cartao); border: 1px solid var(--linha); border-radius: 14px;
  padding: 14px 16px; margin: 10px 0; }

.topo { position: sticky; top: 0; z-index: 500; display: flex; justify-content: space-between;
  align-items: center; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--fundo); border-bottom: 1px solid var(--linha); }
.topo h1 { font-size: 1.2rem; margin: 0; cursor: pointer; }
.sync { font-size: .8rem; color: var(--sutil); }
.sync.offline { color: var(--alerta); }

main { padding: 4px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.abas { position: fixed; bottom: 0; left: 0; right: 0; z-index: 600; display: flex;
  background: var(--cartao); border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom); }
.abas button { flex: 1; background: none; color: var(--sutil); font-size: .72rem; font-weight: 500;
  padding: 8px 0 6px; border-radius: 0; display: flex; flex-direction: column; align-items: center; }
.abas button span { font-size: 1.25rem; line-height: 1.1; }
.abas button.ativa { color: var(--acento); }

.contagem { font-size: 2.4rem; font-weight: 700; color: var(--acento); line-height: 1; }
.linha-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--linha); }
.linha-item:last-child { border-bottom: 0; }
.linha-item .corpo { flex: 1; min-width: 0; }
.linha-item .titulo { font-weight: 550; overflow-wrap: anywhere; }
.linha-item.feito .titulo { text-decoration: line-through; color: var(--sutil); }
.check { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--acento);
  background: none; padding: 0; color: #fff; font-size: .9rem; }
.check.marcado { background: var(--ok); border-color: var(--ok); }
.etiqueta { display: inline-block; font-size: .72rem; padding: .1em .55em; border-radius: 99px;
  background: var(--acento-claro); color: var(--acento); margin: 2px 4px 0 0; white-space: nowrap; }
.etiqueta.roma { color: var(--roma); } .etiqueta.florenca { color: var(--florenca); }
.etiqueta.veneza { color: var(--veneza); }
.etiqueta.alerta { background: var(--alerta); color: #fff; }
.filtros { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; }
.filtros button { white-space: nowrap; background: var(--acento-claro); color: var(--acento);
  font-weight: 500; padding: .35em .8em; border-radius: 99px; }
.filtros button.ativo { background: var(--acento); color: #fff; }
#mapa { height: calc(100vh - 210px); min-height: 320px; border-radius: 14px;
  border: 1px solid var(--linha); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grade button { background: var(--cartao); color: var(--texto); border: 1px solid var(--linha);
  text-align: left; padding: 14px; font-weight: 550; }
.md { overflow-wrap: anywhere; }
.md table { border-collapse: collapse; width: 100%; font-size: .88rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--linha); padding: 4px 6px; text-align: left; }
.md code { background: var(--acento-claro); padding: 0 .3em; border-radius: 4px; }
.md blockquote { margin: .5em 0; padding: .2em .8em; border-left: 3px solid var(--acento);
  color: var(--sutil); }
.total { font-variant-numeric: tabular-nums; font-weight: 650; }
dialog { border: 0; border-radius: 16px; padding: 16px; width: min(480px, calc(100vw - 32px));
  background: var(--cartao); color: var(--texto); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
.acoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.voltar { margin: 8px 0; }
