:root {
  --bg: #f5f3fa;
  --card: #ffffff;
  --text: #1f1b2d;
  --muted: #6b6680;
  --line: #e3dfee;
  --brand: #7c3aed;
  --brand-2: #a855f7;
  --ok: #12b76a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 "Poppins", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.topo {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 22px 16px 26px;
  text-align: center;
}
.topo h1 { margin: 0; font-size: 1.45rem; font-weight: 800; }
.topo p { margin: 2px 0 0; opacity: .9; font-size: .92rem; }
main { max-width: 560px; margin: -12px auto 0; padding: 0 12px 40px; }
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: 0 2px 10px rgba(40, 20, 80, .06);
}
h2 { margin: 0 0 6px; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
.num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: inline-grid; place-items: center; font-size: .85rem;
}
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input:not([type=checkbox]):not([type=file]), textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-size: 16px; /* evita zoom no iPhone */
  color: var(--text);
  background: #fff;
}
input:focus, textarea:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; }
input[type=color] { height: 48px; padding: 4px; }
.linha { display: flex; gap: 8px; align-items: stretch; }
.linha > input { flex: 1; min-width: 0; }
.linha > .grande { flex: 1; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px;
  background: var(--brand); color: #fff;
  font: 600 1rem "Poppins", sans-serif;
  padding: 12px 16px; min-height: 48px;
  cursor: pointer; width: auto;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; }
.btn.sec { background: #efe9fc; color: var(--brand); }
.btn.grande { width: 100%; font-size: 1.05rem; margin-top: 10px; }
.linha .btn { margin-top: 0; }
.linha.acoes { margin-top: 10px; }
.linha.acoes .btn { flex: 1; }
#btnRefazer { flex: 0 0 auto; }
#btnPuxar { width: 100%; margin-top: 10px; }

.msg { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-size: .9rem; background: #f3f0fa; }
.msg.ok { background: #e7f8ef; color: #0a6b3d; }
.msg.erro { background: #fff4e5; color: #8a4b00; }

.foto-linha { display: flex; align-items: center; gap: 12px; }
#fotoMini { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; }
.arquivo { position: relative; overflow: hidden; margin: 0; }
.arquivo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.chips button {
  border: 1.5px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 9px 14px; font: 500 .92rem "Poppins", sans-serif;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.chips button.ativo { border-color: var(--brand); background: #f1eafe; color: var(--brand); font-weight: 600; }
#chamadas + input { margin-top: 10px; }
.modelos svg { width: 16px; height: 28px; fill: currentColor; opacity: .75; }
.temas i { width: 20px; height: 20px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.12); }

details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { font-weight: 600; cursor: pointer; color: var(--brand); }

.previa canvas {
  display: block; width: 100%; max-width: 340px; height: auto; aspect-ratio: 9 / 16;
  margin: 8px auto 0; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.dica { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }

.lista { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.lista li {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 8px;
}
.lista img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.lista .info { flex: 1; min-width: 0; cursor: pointer; }
.lista .info b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .info span { color: var(--muted); font-size: .85rem; }
.lista .apagar { border: 0; background: none; font-size: 1.2rem; padding: 8px; cursor: pointer; }
.lista .vazio { color: var(--muted); font-size: .9rem; border: 0; padding: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: #1f1b2d; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: .95rem; transition: .25s; max-width: calc(100% - 32px); text-align: center; z-index: 10;
}
.toast.mostrar { opacity: 1; transform: translateX(-50%) translateY(0); }
