:root {
  --fundo: #fbf6ee;
  --cartao: #ffffff;
  --texto: #2b2320;
  --suave: #6f625b;
  --linha: #eadfd2;
  --vermelho: #9e1b22;
  --vermelho-claro: #f7e3e1;
  --verde: #1f5f3f;
  --verde-claro: #e2efe6;
  --dourado: #c8962e;
  --sombra: 0 1px 2px rgba(60, 30, 20, .06), 0 4px 14px rgba(60, 30, 20, .06);
  --raio: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #17120f; --cartao: #231c18; --texto: #f3ebe3; --suave: #b3a59a; --linha: #3a2f29;
    --vermelho: #e0565c; --vermelho-claro: #3b1d1d; --verde: #6fc195; --verde-claro: #1c3227; --dourado: #e2b75a;
    --sombra: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
body.logado { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--vermelho); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .4rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { margin: .2rem 0 .4rem; font-size: 1.05rem; }
small, .nota { color: var(--suave); }
.nota { font-size: .9rem; }

.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--vermelho); color: #fff;
}
@media (prefers-color-scheme: dark) { .topo { background: #5e1216; } }
.marca { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.marca-nome { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.marca-ocasiao { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-grande { margin: 8px 0 0; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--vermelho); }
.boas-vindas h1 { margin-top: 2px; }
.estrela { color: #ffd77a; }
.perfil {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.18); color: #fff; text-decoration: none; font-weight: 700;
}

.conteudo { max-width: 720px; margin: 0 auto; padding: 16px; }

.cartao {
  background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 16px; margin: 0 0 12px; box-shadow: var(--sombra);
}
.vazio { color: var(--suave); text-align: center; padding: 28px 16px; }

.boas-vindas { text-align: center; padding: 24px 0 8px; }
.boas-vindas p { color: var(--suave); }
.enfeite { font-size: 3.2rem; line-height: 1; }

.formulario label { display: block; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
.formulario label small { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  font: inherit; font-size: 16px; color: var(--texto);
  background: var(--fundo); border: 1px solid var(--linha); border-radius: 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--dourado); outline-offset: 1px; }
.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .duas-colunas { grid-template-columns: 1fr; } }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--verde); }

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--linha); background: var(--cartao); color: var(--texto);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.botao.principal { background: var(--verde); border-color: var(--verde); color: #fff; }
@media (prefers-color-scheme: dark) { .botao.principal { color: #0d1f16; } }
.botao.perigo { color: var(--vermelho); }
.botao.grande { width: 100%; min-height: 56px; font-size: 1.1rem; }
.formulario > .botao.principal, form > .botao.principal:only-of-type { width: 100%; }
.mini {
  border: 1px solid var(--linha); background: transparent; color: var(--suave);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .85rem; cursor: pointer;
}
.mini.perigo { color: var(--vermelho); }
.linha-botoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.linha-botoes form { margin: 0; }
.linha-form { display: flex; gap: 8px; margin-top: 12px; }
.linha-form input, .linha-form select { margin: 0; flex: 1; min-width: 0; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details.formulario > summary { width: 100%; }
details.formulario[open] > summary { margin-bottom: 16px; }

.aviso { padding: 12px 14px; border-radius: 12px; margin: 0 0 12px; font-weight: 500; }
.aviso-ok { background: var(--verde-claro); color: var(--verde); }
.aviso-erro { background: var(--vermelho-claro); color: var(--vermelho); }

.voltar { display: inline-block; margin-bottom: 4px; text-decoration: none; color: var(--suave); }

/* Início */
.ola p { margin-top: -6px; color: var(--suave); }
.atalhos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.atalho { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--texto); margin: 0; min-height: 140px; }
.atalho .icone { font-size: 2rem; }
.atalho small { font-size: .85rem; line-height: 1.35; }
.instalar-dica { text-align: center; margin-top: 18px; }

/* Pessoas */
.grade-pessoas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pessoa {
  display: flex; align-items: center; gap: 10px; padding: 12px; text-decoration: none; color: var(--texto);
  background: var(--cartao); border: 1px solid var(--linha); border-radius: 14px; box-shadow: var(--sombra);
}
.pessoa small { display: block; font-size: .8rem; }
.pessoa.minha { border-color: var(--verde); }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--vermelho-claro); color: var(--vermelho); font-weight: 700;
}
.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.lista-simples li:last-child { border-bottom: 0; }
.lista-simples a { text-decoration: none; color: var(--texto); }
.lista-simples form { margin: 0; }

/* Presentes */
.presente-topo { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.etiqueta { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--linha); color: var(--texto); }
.prio-1 { background: var(--vermelho-claro); color: var(--vermelho); }
.prio-2 { background: var(--verde-claro); color: var(--verde); }
.dada { background: var(--dourado); color: #2b1d00; }
.presente.reservado { opacity: .72; }
.presente p { margin: .3rem 0; }
.detalhes { color: var(--suave); font-size: .92rem; }

/* Amigo secreto */
.sorteio .quem { margin: 0 0 8px; color: var(--suave); }
.revelar {
  position: relative; width: 100%; min-height: 110px; border: 0; border-radius: 14px; cursor: pointer;
  background: repeating-linear-gradient(45deg, var(--vermelho), var(--vermelho) 14px, #b8262e 14px, #b8262e 28px);
  color: #fff; font: inherit; overflow: hidden;
}
.revelar .capa { font-size: 1.25rem; font-weight: 700; transition: opacity .3s; }
.revelar .nome-amigo {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 10px;
  font-size: 1.7rem; font-weight: 800; color: var(--verde); background: var(--verde-claro);
  opacity: 0; transform: scale(.8); transition: opacity .4s, transform .4s;
}
.revelar.aberto .capa { opacity: 0; }
.revelar.aberto .nome-amigo { opacity: 1; transform: none; }
.depois-revelar { display: none; margin-top: 12px; }
.sorteio.revelado .depois-revelar { display: block; }
.depois-revelar .botao { width: 100%; }
.depois-revelar .nota { text-align: center; }

/* Festa */
.festa-data { font-size: 1.3rem; font-weight: 700; margin: 0; }
.festa-local { font-size: 1.1rem; margin: 4px 0 0; }
.presenca { border: 0; padding: 0; margin: 0 0 14px; }
.presenca legend { font-weight: 700; margin-bottom: 6px; }
.formulario label.opcao { display: inline-block; margin: 0 6px 6px 0; font-weight: 500; }
.opcao input { position: absolute; opacity: 0; pointer-events: none; width: auto; }
.opcao span { display: inline-block; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--linha); background: var(--fundo); cursor: pointer; }
.opcao input:checked + span { background: var(--verde); border-color: var(--verde); color: #fff; }
.opcao input:focus-visible + span { outline: 2px solid var(--dourado); }
.r-sim { color: var(--verde); } .r-nao { color: var(--vermelho); }

/* Organizar */
.sub-abas { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.sub-abas a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--texto); border: 1px solid var(--linha); background: var(--cartao); white-space: nowrap; }
.sub-abas a.ativa { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.linha-pessoa { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.linha-pessoa small { display: block; }
.linha-pessoa .linha-botoes { margin: 0; }
.linha-pessoa .botao { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.participantes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; margin-bottom: 14px; }
.participantes label.check { margin: 0; padding: 6px 0; }
.marcar-todos { margin-bottom: 6px; }
.convite-gerado { border-color: var(--verde); }
.convite-gerado input { font-size: .85rem; }
.apagar-sorteio { margin-top: 16px; text-align: right; }
.passos { padding-left: 1.3rem; } .passos li { margin-bottom: 8px; }

/* Barra de abas do app */
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--cartao); border-top: 1px solid var(--linha);
}
.abas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px; text-decoration: none; color: var(--suave); font-size: .72rem; font-weight: 600;
}
.abas svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.abas a.ativa { color: var(--vermelho); }
