/* =========================================================
   Festeja — visual "app": fundo pastel em degradê, cartões
   brancos bem arredondados, destaque azul e blocos coloridos.
   ========================================================= */
:root {
  --bg-grad: linear-gradient(135deg, #ffe4ee 0%, #fff3e8 35%, #f4ecff 70%, #e7eeff 100%);
  --surface: #ffffff;
  --surface-2: #f4f5fb;
  --border: #eceef6;
  --text: #1b1c2b;
  --text-2: #5d6075;
  --muted: #9a9db0;
  --accent: #2f6bff;
  --accent-2: #5a8cff;
  --accent-soft: #e8efff;
  --accent-ink: #ffffff;
  --hero: linear-gradient(135deg, #3b7bff 0%, #2459f0 100%);
  --bar: #2f6bff;

  /* blocos coloridos (fundo suave / cor forte) */
  --orange-soft: #fff0dc; --orange: #ff9f1c;
  --blue-soft:   #e3edff; --blue:   #2f6bff;
  --pink-soft:   #ffe3ef; --pink:   #ff4f93;
  --green-soft:  #dcf7ea; --green:  #17b26a;
  --purple-soft: #efe6ff; --purple: #8b5cf6;
  --yellow-soft: #fff6cc; --yellow: #e0a800;

  --good: #17924f; --good-soft: #dcf7ea;
  --warn: #c26a00; --warn-soft: #fff0dc;
  --bad: #e0245e;  --bad-soft: #ffe3ef;

  --shadow: 0 8px 28px rgba(70, 60, 140, .08), 0 1px 3px rgba(70, 60, 140, .05);
  --shadow-lg: 0 18px 40px rgba(47, 107, 255, .28);
  --radius: 22px;
  --radius-sm: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-grad: linear-gradient(135deg, #1d1424 0%, #17141f 45%, #121626 100%);
    --surface: #1f1f2c;
    --surface-2: #282838;
    --border: #33344a;
    --text: #f1f1f8;
    --text-2: #b9bbcf;
    --muted: #8789a0;
    --accent: #6b95ff;
    --accent-2: #8aabff;
    --accent-soft: #24304f;
    --accent-ink: #ffffff;
    --hero: linear-gradient(135deg, #3768e6 0%, #2547b8 100%);
    --bar: #6b95ff;
    --orange-soft: #3a2a14; --orange: #ffb547;
    --blue-soft:   #1f2b4a; --blue:   #7aa2ff;
    --pink-soft:   #3a1d2b; --pink:   #ff7eb0;
    --green-soft:  #163327; --green:  #45d690;
    --purple-soft: #2c2245; --purple: #b195fb;
    --yellow-soft: #3a3214; --yellow: #f2c94c;
    --good: #45d690; --good-soft: #163327;
    --warn: #ffb547; --warn-soft: #3a2a14;
    --bad: #ff7eb0;  --bad-soft: #3a1d2b;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 14px 34px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg-grad) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 800; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
small, .muted { color: var(--muted); }
a { color: var(--accent); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.4rem; background: var(--pink-soft);
}
.brand strong { display: block; font-size: 1.2rem; font-weight: 900; letter-spacing: -.01em; }
.brand small { display: block; font-size: .78rem; }
.top-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.menu-btn { display: none; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 290px 1fr; min-height: calc(100vh - 67px); }
.sidebar { padding: 22px 16px 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.main { padding: 22px 28px 60px; min-width: 0; max-width: 1280px; }

.ev-item {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 18px; cursor: pointer;
  border: 2px solid transparent; text-align: left;
  background: var(--surface); color: inherit; font: inherit; width: 100%;
  box-shadow: var(--shadow);
}
.ev-item:hover { transform: translateY(-1px); }
.ev-item.ativo { border-color: var(--accent); }
.ev-item .emoji {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.5rem;
}
.ev-item .info { min-width: 0; flex: 1; }
.ev-item .info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.ev-item .info small { display: block; }

/* ---------- Cores dos blocos ---------- */
.c-orange { background: var(--orange-soft); --cor: var(--orange); }
.c-blue   { background: var(--blue-soft);   --cor: var(--blue); }
.c-pink   { background: var(--pink-soft);   --cor: var(--pink); }
.c-green  { background: var(--green-soft);  --cor: var(--green); }
.c-purple { background: var(--purple-soft); --cor: var(--purple); }
.c-yellow { background: var(--yellow-soft); --cor: var(--yellow); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 16px rgba(47, 107, 255, .3); }
.btn.primary:hover { color: var(--accent-ink); transform: translateY(-1px); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 5px 12px; font-size: .8rem; }
.icon-btn {
  border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 1rem; padding: 4px 8px; border-radius: 10px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--bad); }
.menu-btn { font-size: 1.3rem; color: var(--text); }
.menu-btn:hover { color: var(--text); }

/* ---------- Cartão de destaque (hero) ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--hero); color: #fff;
  border-radius: 28px; padding: 22px 26px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1);
}
.hero::before { width: 220px; height: 220px; right: -60px; top: -90px; }
.hero::after { width: 140px; height: 140px; right: 140px; bottom: -80px; }
.hero > * { position: relative; }
.hero .avatar {
  width: 74px; height: 74px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 2.3rem; flex: none;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .25);
}
.hero h1 { font-size: 1.65rem; font-weight: 900; }
.hero .sub { opacity: .88; font-size: .92rem; margin-top: 3px; }
.hero .pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.hero .pill { background: rgba(255, 255, 255, .18); padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.hero .countdown {
  margin-left: auto; background: #fff; color: var(--text);
  border-radius: 20px; padding: 10px 18px; text-align: center; min-width: 110px;
}
.hero .countdown strong { display: block; font-size: 2rem; font-weight: 900; color: #2f6bff; line-height: 1.1; }
.hero .countdown small { color: #6b6f86; font-weight: 700; }

/* ---------- Abas (controle segmentado) ---------- */
.tabs {
  display: flex; gap: 4px; background: var(--surface); padding: 5px;
  border-radius: 999px; margin-bottom: 20px; overflow-x: auto; box-shadow: var(--shadow);
  width: fit-content; max-width: 100%;
}
.tab {
  border: none; background: none; font: inherit; color: var(--text-2); font-weight: 700;
  padding: 9px 16px; cursor: pointer; white-space: nowrap; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--accent); }
.tab.ativo { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(47, 107, 255, .35); }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface); border: none;
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card.c-orange { background: var(--orange-soft); }
.card.c-blue   { background: var(--blue-soft); }
.card.c-pink   { background: var(--pink-soft); }
.card.c-green  { background: var(--green-soft); }
.card.c-purple { background: var(--purple-soft); }
.card.c-yellow { background: var(--yellow-soft); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .acoes { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stack > * + * { margin-top: 16px; }

.ico-tile {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: grid; place-items: center; font-size: 1.25rem;
}

.kpi { padding: 18px; box-shadow: none; position: relative; }
.kpi .ico-tile { background: var(--surface); margin-bottom: 10px; box-shadow: var(--shadow); }
.kpi .rot { font-size: .78rem; color: var(--text-2); font-weight: 700; }
.kpi .val { font-size: 1.6rem; font-weight: 900; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .82rem; color: var(--text-2); }
.kpi.destaque { background: var(--hero); color: #fff; box-shadow: var(--shadow-lg); }
.kpi.destaque .rot, .kpi.destaque .sub { color: inherit; opacity: .9; }
.kpi.destaque .ico-tile { background: rgba(255, 255, 255, .2); box-shadow: none; }

.meter { height: 8px; background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--cor, var(--accent)); border-radius: 99px; }
.meter.over > span { background: var(--bad); }
.kpi.destaque .meter { background: rgba(255, 255, 255, .25); }
.kpi.destaque .meter > span { background: #fff; }

/* ---------- Gráfico de barras ---------- */
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row {
  display: grid; grid-template-columns: minmax(120px, 210px) 1fr 100px;
  gap: 10px; align-items: center; padding: 5px 6px; border-radius: 10px;
}
.bar-row:hover { background: var(--surface-2); }
.bar-row .lbl { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 12px; position: relative; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--bar); border-radius: 99px; min-width: 4px; }
.bar-fill.est {
  background: repeating-linear-gradient(45deg, var(--bar) 0 4px, color-mix(in srgb, var(--bar) 40%, transparent) 4px 8px);
}
.bar-row .v { text-align: right; font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--text-2); margin-top: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; background: var(--bar); vertical-align: middle; margin-right: 5px; }
.legend i.est { background: repeating-linear-gradient(45deg, var(--bar) 0 3px, color-mix(in srgb, var(--bar) 40%, transparent) 3px 6px); }

/* ---------- Formulários ---------- */
label.campo { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--text-2); font-weight: 700; }
label.campo > span.hint { font-size: .78rem; color: var(--muted); font-weight: 400; }
input, select, textarea {
  font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface-2); border: 1.5px solid transparent;
  border-radius: 12px; padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input[type=checkbox] { width: auto; accent-color: var(--accent); transform: scale(1.2); }
textarea { resize: vertical; min-height: 90px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check { display: flex; align-items: center; gap: 9px; font-size: .9rem; cursor: pointer; }
.checks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.checks .check { background: var(--surface-2); padding: 10px 12px; border-radius: 14px; }

.seg { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 999px; gap: 4px; flex-wrap: wrap; }
.seg button {
  border: none; background: none; font: inherit; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  cursor: pointer; color: var(--text-2);
}
.seg button.ativo { background: var(--accent); color: #fff; }

.padroes { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.padrao {
  border: 2px solid transparent; border-radius: 18px; padding: 14px; cursor: pointer;
  text-align: left; font: inherit; color: inherit;
}
.padrao.ativo { border-color: var(--cor); }
.padrao strong { display: block; font-weight: 800; }
.padrao small { display: block; margin-top: 2px; color: var(--text-2); }

/* ---------- Tabelas ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 800; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td input, td select { padding: 6px 9px; font-size: .88rem; border-radius: 10px; }
td input.n { width: 90px; text-align: right; }
tfoot td { font-weight: 900; border-top: 2px solid var(--border); }

/* ---------- Etiquetas e avisos ---------- */
.tag {
  display: inline-block; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.tag.ok { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }

.dicas { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.dicas li { padding: 11px 14px; border-radius: 16px; background: var(--blue-soft); font-size: .9rem; display: flex; gap: 10px; }
.dicas li.alerta { background: var(--pink-soft); }
.dicas li.ok { background: var(--green-soft); }

.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { border-radius: 16px; padding: 10px 14px; font-size: .82rem; color: var(--text-2); background: var(--surface-2); }
.chip b { font-size: 1.2rem; display: block; font-weight: 900; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Categorias de gastos ---------- */
.cat-card.off { opacity: .6; }
.cat-card .resumo-cat { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85rem; color: var(--text-2); margin-bottom: 10px; align-items: center; }
.cat-card .resumo-cat b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Tarefas (com selo de data) ---------- */
.tarefa {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 18px; background: var(--surface-2); margin-bottom: 8px;
}
.tarefa .txt { flex: 1; font-weight: 700; }
.tarefa .txt small { display: block; font-weight: 400; }
.tarefa.feito { opacity: .6; }
.tarefa.feito .txt { text-decoration: line-through; }
.selo {
  width: 52px; height: 52px; border-radius: 15px; flex: none; text-align: center;
  display: flex; flex-direction: column; justify-content: center; line-height: 1;
}
.selo b { font-size: 1.3rem; font-weight: 900; color: var(--cor); }
.selo span { font-size: .7rem; font-weight: 800; text-transform: uppercase; color: var(--text-2); margin-top: 3px; }
.tarefa input[type=checkbox] { transform: scale(1.35); }
.grupo-tit { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; }
.rot-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.rot-item input[type=time] { background: var(--blue-soft); font-weight: 800; color: var(--accent); }

/* ---------- Boas-vindas (splash) ---------- */
.welcome { max-width: 900px; margin: 20px auto; text-align: center; }
.balloons { font-size: 4.5rem; line-height: 1; filter: drop-shadow(0 10px 18px rgba(255, 79, 147, .25)); }
.welcome h1 { font-size: 3rem; font-weight: 900; letter-spacing: -.02em; margin: 6px 0; }
.welcome h1 .a { color: var(--accent); }
.welcome h1 .b { color: var(--pink); }
.welcome p { color: var(--text-2); max-width: 560px; margin: 0 auto; }
.tipos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 26px; }
.tipo-card {
  border: 2px solid transparent; border-radius: 22px; padding: 18px 10px;
  cursor: pointer; font: inherit; color: var(--text); text-align: center; font-weight: 700;
  transition: transform .15s, box-shadow .15s;
}
.tipo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tipo-card.ativo { border-color: var(--cor); }
.tipo-card .emoji {
  width: 58px; height: 58px; margin: 0 auto 8px; border-radius: 18px; background: var(--surface);
  display: grid; place-items: center; font-size: 1.8rem; box-shadow: var(--shadow);
}
.tipo-card span { font-size: .85rem; }
.modal .tipos { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.modal .tipo-card { padding: 12px 6px; }
.modal .tipo-card .emoji { width: 44px; height: 44px; font-size: 1.4rem; border-radius: 14px; }

/* ---------- Modal / toast ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20, 15, 40, .45); backdrop-filter: blur(4px); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 28px; padding: 26px; width: min(780px, 100%); box-shadow: 0 30px 70px rgba(0, 0, 0, .3); }
.modal-box .rodape { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--surface); padding: 12px 20px; border-radius: 999px; font-size: .9rem; font-weight: 700;
}
.toast[hidden] { display: none; }

.vazio { text-align: center; color: var(--muted); padding: 24px; }
.linha { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.linha > .cresce { flex: 1; min-width: 160px; }

/* ---------- Celular: menu lateral + barra de abas inferior ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 290px; z-index: 40;
    background: var(--surface); padding: 20px 16px;
    transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow-lg);
  }
  .sidebar.aberta { transform: none; }
  .topbar { padding: 10px 16px; }
  .main { padding: 16px 16px 110px; }
  .grid.c2, .grid.c3, .padroes { grid-template-columns: 1fr; }
  .top-actions .btn { padding: 6px 9px; }
  .top-actions .tl { display: none; }
  .brand small { display: none; }
  .bar-row { grid-template-columns: 110px 1fr 80px; }
  .hero { padding: 18px; border-radius: 24px; }
  .hero .countdown { margin-left: 0; }
  .hero .avatar { width: 58px; height: 58px; font-size: 1.8rem; }
  .hero h1 { font-size: 1.4rem; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 1.25rem; }
  .kpi.destaque { grid-column: 1 / -1; }

  .tabs {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; margin: 0;
    width: auto; border-radius: 24px; padding: 6px; justify-content: space-between;
    box-shadow: 0 10px 30px rgba(40, 30, 90, .18);
  }
  .tab { flex-direction: column; gap: 2px; padding: 6px 4px; border-radius: 16px; flex: 1; font-size: .66rem; }
  .tab .ti { font-size: 1.25rem; }
  .tab.ativo { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
}


/* =========================================================
   Foto do homenageado
   ========================================================= */
.avatar-btn { position: relative; border: none; background: none; padding: 0; cursor: pointer; flex: none; border-radius: 50%; }
.avatar-btn .avatar-cam {
  position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; font-size: .85rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2); opacity: 0; transition: opacity .15s;
}
.avatar-btn:hover .avatar-cam, .avatar-btn.grande .avatar-cam, .foto-box .avatar-cam { opacity: 1; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.hero .avatar.com-foto { background: var(--anel, #fff); padding: 4px; }
.avatar.grande {
  width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center;
  font-size: 3.6rem; padding: 5px; background: var(--anel, var(--surface-2));
}
.ev-item .emoji.foto { padding: 0; overflow: hidden; }
.ev-item .emoji.foto img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Escolha de tema ---------- */
.tema-topo { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.foto-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; width: 190px; }
.temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.tema-card {
  border: 2px solid var(--border); background: var(--surface); border-radius: 18px; padding: 12px;
  cursor: pointer; font: inherit; color: var(--text); text-align: left; display: flex; flex-direction: column; gap: 4px;
}
.tema-card:hover { border-color: var(--accent); }
.tema-card.ativo { border-color: var(--accent); background: var(--accent-soft); }
.tema-card .tema-emoji { font-size: 1.6rem; }
.tema-card strong { font-size: .88rem; }
.swatches { display: flex; gap: 3px; }
.swatches i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .08); }
.ideias { margin-top: 18px; background: var(--surface-2); border-radius: 18px; padding: 14px 18px; }
.ideias h4 { margin-bottom: 6px; }
.ideias ul { margin: 0; padding-left: 20px; }
.ideias li { margin: 4px 0; font-size: .9rem; }

/* ---------- Desfile de bichinhos e enfeites de fundo ---------- */
.hero .parada {
  flex-basis: 100%; font-size: 1.5rem; letter-spacing: .1em; white-space: nowrap; overflow: hidden;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}
.enfeites { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.enfeites span { position: absolute; opacity: .55; animation: flutuar 7s ease-in-out infinite; }
@keyframes flutuar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.layout { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .enfeites span { animation: none; } }

/* =========================================================
   Temas visuais (sempre em cores claras e alegres)
   ========================================================= */
body[data-tema]:not([data-tema="padrao"]) {
  --surface: #ffffff; --surface-2: #f6f4ee; --border: #ece6d8;
  --text: #2b2a33; --text-2: #5c5a66; --muted: #97949f;
  --good: #2e8b3e; --good-soft: #e3f4e1; --warn: #b8680b; --warn-soft: #fff1d6; --bad: #d23c4f; --bad-soft: #ffe4e6;
  --shadow: 0 8px 24px rgba(60, 50, 30, .09), 0 1px 3px rgba(60, 50, 30, .06);
  color-scheme: light;
}
body[data-tema]:not([data-tema="padrao"]) :is(h1, h2, h3, h4, .brand strong, .kpi .val, .countdown strong) {
  font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600;
}
body[data-tema]:not([data-tema="padrao"]) .card { border: 3px solid rgba(255, 255, 255, .9); }
body[data-tema]:not([data-tema="padrao"]) .hero .countdown strong { color: var(--accent); }
body[data-tema]:not([data-tema="padrao"]) .hero h1 { text-shadow: 0 2px 6px rgba(0, 0, 0, .15); }

/* ---------- Arca de Noé ---------- */
body[data-tema="arca"] {
  --bg-grad: linear-gradient(180deg, #bfe6fb 0%, #e3f5fe 38%, #fffbea 78%, #eaf6d9 100%);
  --accent: #2f8fcf; --accent-2: #5bb4e5; --accent-soft: #dcf0fc; --bar: #3a9ad9;
  --hero: linear-gradient(180deg, #7fcaf2 0%, #4aa6de 62%, #3592cf 100%);
  --shadow-lg: 0 18px 40px rgba(47, 143, 207, .3);
  --anel: conic-gradient(#ff8a80, #ffd54f, #aed581, #4fc3f7, #b39ddb, #ff8a80);
  --orange-soft: #fff4cc; --orange: #e5a800;
  --blue-soft:   #dcf0fc; --blue:   #2f8fcf;
  --pink-soft:   #ffe5e1; --pink:   #e8665a;
  --green-soft:  #e6f4d4; --green:  #5d9b2a;
  --purple-soft: #f2e6d9; --purple: #a86b3c;
  --yellow-soft: #fff7d6; --yellow: #d39b00;
}
body[data-tema="arca"] .brand-logo { background: #fff4cc; }
body[data-tema="arca"] .btn.primary { background: #a86b3c; border-color: #a86b3c; box-shadow: 0 6px 16px rgba(168, 107, 60, .3); }
body[data-tema="arca"] .tab.ativo { background: #a86b3c; box-shadow: 0 4px 12px rgba(168, 107, 60, .35); }
body[data-tema="arca"] .hero { padding-bottom: 54px; }
/* arco-íris */
body[data-tema="arca"] .hero::before {
  width: 320px; height: 320px; right: -60px; top: -160px; border-radius: 50%;
  background: radial-gradient(circle, transparent 46%, #b39ddb 46% 52%, #4fc3f7 52% 58%, #aed581 58% 64%, #ffd54f 64% 70%, #ff8a80 70% 76%, transparent 76%);
  opacity: .9;
}
/* ondas do dilúvio */
body[data-tema="arca"] .hero::after {
  left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 34px; border-radius: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 30' preserveAspectRatio='none'%3E%3Cpath d='M0 15 Q15 0 30 15 T60 15 T90 15 T120 15 V30 H0Z' fill='%23ffffff' fill-opacity='.35'/%3E%3C/svg%3E") repeat-x;
  background-size: 120px 34px;
}
body[data-tema="arca"] .hero .parada { position: absolute; left: 26px; right: 26px; bottom: 14px; z-index: 1; }
body[data-tema="arca"]::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 60px; z-index: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 40' preserveAspectRatio='none'%3E%3Cpath d='M0 20 Q20 4 40 20 T80 20 T120 20 T160 20 V40 H0Z' fill='%2389cff0' fill-opacity='.45'/%3E%3C/svg%3E") repeat-x;
  background-size: 160px 60px;
}

/* ---------- Safári ---------- */
body[data-tema="safari"] {
  --bg-grad: linear-gradient(180deg, #f6edd3 0%, #fbf6e6 50%, #e7efd2 100%);
  --accent: #6b8e23; --accent-soft: #edf3dc; --bar: #7a9a3a;
  --hero: linear-gradient(135deg, #8aa645 0%, #5d7a1f 100%);
  --shadow-lg: 0 18px 40px rgba(93, 122, 31, .3);
  --anel: repeating-linear-gradient(45deg, #e9b949 0 8px, #5b4630 8px 12px);
  --orange-soft: #fbeccb; --orange: #c2773b; --blue-soft: #eef1dc; --blue: #6b8e23;
  --pink-soft: #f6e2d3; --pink: #b9652f; --green-soft: #e4eecf; --green: #4f7a1a;
  --purple-soft: #efe5d6; --purple: #5b4630; --yellow-soft: #fbf1cf; --yellow: #c69214;
}
body[data-tema="safari"] .btn.primary, body[data-tema="safari"] .tab.ativo { background: #c2773b; border-color: #c2773b; }

/* ---------- Fundo do mar ---------- */
body[data-tema="mar"] {
  --bg-grad: linear-gradient(180deg, #d4f3fb 0%, #e9fafd 45%, #fdf4e3 100%);
  --accent: #1e88c7; --accent-soft: #dcf2fb; --bar: #1e88c7;
  --hero: linear-gradient(180deg, #33b3e0 0%, #0d6fa8 100%);
  --shadow-lg: 0 18px 40px rgba(13, 111, 168, .3);
  --anel: conic-gradient(#4dd0e1, #1e88c7, #ff8a65, #ffd54f, #4dd0e1);
  --orange-soft: #ffe8dd; --orange: #e8693f; --blue-soft: #dcf2fb; --blue: #1e88c7;
  --pink-soft: #ffe3e0; --pink: #e05a6e; --green-soft: #d8f5f1; --green: #12938a;
  --purple-soft: #e1ecf8; --purple: #3d6fb6; --yellow-soft: #fff5d2; --yellow: #cf9a00;
}
body[data-tema="mar"] .btn.primary, body[data-tema="mar"] .tab.ativo { background: #f0764e; border-color: #f0764e; }

/* ---------- Circo ---------- */
body[data-tema="circo"] {
  --bg-grad: repeating-linear-gradient(90deg, #fff1ef 0 60px, #fffdf6 60px 120px);
  --accent: #e53935; --accent-soft: #ffe5e3; --bar: #1e88e5;
  --hero: repeating-linear-gradient(90deg, #e53935 0 46px, #d32f2f 46px 92px);
  --shadow-lg: 0 18px 40px rgba(229, 57, 53, .3);
  --anel: conic-gradient(#e53935, #ffca28, #1e88e5, #43a047, #e53935);
  --orange-soft: #fff4d1; --orange: #d99a00; --blue-soft: #e1eefc; --blue: #1e88e5;
  --pink-soft: #ffe5e3; --pink: #e53935; --green-soft: #e1f3e2; --green: #2e8b37;
  --purple-soft: #efe5fb; --purple: #7b4bc4; --yellow-soft: #fff6d5; --yellow: #d39b00;
}

/* ---------- Jardim encantado ---------- */
body[data-tema="jardim"] {
  --bg-grad: linear-gradient(160deg, #fde4ef 0%, #f6ecfb 45%, #e6f6e8 100%);
  --accent: #d0659b; --accent-soft: #fbe3ef; --bar: #c27ad4;
  --hero: linear-gradient(135deg, #f19ac1 0%, #b98ad6 100%);
  --shadow-lg: 0 18px 40px rgba(208, 101, 155, .3);
  --anel: conic-gradient(#f48fb1, #fff59d, #a5d6a7, #81d4fa, #ce93d8, #f48fb1);
  --orange-soft: #fff6d6; --orange: #d39b00; --blue-soft: #e0f1fb; --blue: #3a8fc4;
  --pink-soft: #fde3ee; --pink: #d0659b; --green-soft: #e3f4e4; --green: #4c9a54;
  --purple-soft: #f2e6f9; --purple: #9b5cbf; --yellow-soft: #fffbd9; --yellow: #c9a400;
}

@media (max-width: 900px) {
  .enfeites span { opacity: .3; }
  .hero .parada { font-size: 1.15rem; }
  .foto-box { width: 100%; }
}

/* ---------- Impressão ---------- */
@media print {
  .topbar, .sidebar, .tabs, .no-print, button.icon-btn, .enfeites, .avatar-cam { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  body { background: #fff; color: #000; }
  .card, .hero { box-shadow: none; break-inside: avoid; }
  input, select, textarea { border: none; padding: 0; background: none; }
}

/* ---------- Sincronização / compartilhar ---------- */
.hero-acoes { margin-left: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.hero-acoes .countdown { margin-left: 0; }
.hero .btn.compartilhar { background: rgba(255, 255, 255, .22); color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero .btn.compartilhar:hover { background: #fff; color: var(--accent); }
.hero .pill.sync { background: rgba(255, 255, 255, .9); color: #2b2a33; }
.hero .pill.sync.offline, .hero .pill.sync.local { background: #fff1d6; color: #8a4b00; }
@media (max-width: 900px) {
  .hero-acoes { margin-left: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
}

/* ---------- App instalado (PWA) ---------- */
.instalar-topo { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.instalar-topo img { border-radius: 18px; box-shadow: var(--shadow); }
.passos { padding-left: 22px; margin: 16px 0; }
.passos li { margin: 10px 0; line-height: 1.5; }
.tecla { display: inline-block; background: var(--surface-2); border-radius: 8px; padding: 0 7px; font-size: .9em; }
#btn-instalar[hidden] { display: none; }

/* área segura (entalhe do iPhone, barra de gestos do Android) */
.topbar { padding-top: max(12px, env(safe-area-inset-top)); padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
@media (max-width: 900px) {
  .topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .tabs { bottom: max(12px, env(safe-area-inset-bottom)); }
  .main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  #btn-instalar .tl { display: inline; }
}
/* no app instalado não faz sentido "imprimir" ocupar espaço no celular */
.app-instalado .topbar { -webkit-user-select: none; user-select: none; }
@media (max-width: 900px) {
  .top-actions { flex-wrap: nowrap; gap: 2px; }
  .top-actions .btn { padding: 6px 7px; }
  #btn-instalar { padding: 6px 10px; }
}
@media (max-width: 480px) {
  .top-actions [data-act="imprimir"] { display: none; }
  .brand-logo { width: 36px; height: 36px; font-size: 1.2rem; }
  .topbar { gap: 8px; }
}
.brand-logo { background: none !important; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
