:root {
  --bg: #fbf6ef;
  --surface: #ffffff;
  --surface-2: #f6efe5;
  --text: #2a2320;
  --muted: #7a6d64;
  --border: #e8ddd0;
  --accent: #c8372d;
  --accent-hover: #ab2c23;
  --accent-text: #ffffff;
  --accent-soft: #fbe6e3;
  --green: #1f8a4c;
  --green-soft: #e1f3e8;
  --warn-bg: #fff5d6;
  --warn-border: #f0d67a;
  --whatsapp: #1fa855;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 6px 24px rgba(60, 40, 20, 0.06);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f;
    --surface: #221c17;
    --surface-2: #2b241e;
    --text: #f3ebe2;
    --muted: #b2a497;
    --border: #3a3129;
    --accent: #e5554a;
    --accent-hover: #f06b60;
    --accent-text: #ffffff;
    --accent-soft: #3d201c;
    --green: #4cc27f;
    --green-soft: #1c3326;
    --warn-bg: #3a3017;
    --warn-border: #6b5a22;
    --whatsapp: #2cc066;
    --danger: #f2766b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.container.narrow { max-width: 480px; }

h1, h2 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }

.hero { text-align: center; padding: 16px 0 24px; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 460px; }
.hero-icon { font-size: 3rem; line-height: 1; margin-bottom: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card.center, .center { text-align: center; }
.card h2:not(:first-child) { margin-top: 24px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
}

label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 12px; }
label .opt { font-weight: 400; color: var(--muted); }

input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--surface-2); }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

/* Lista de cadastro */
.person {
  display: grid;
  grid-template-columns: 28px 1.4fr 1fr 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.person input { margin-top: 0; }
.person .num { color: var(--muted); font-size: 0.85rem; text-align: right; }

.icon-btn {
  width: 36px; height: 36px;
  border: none; border-radius: 8px;
  background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); filter: none; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 14px 20px; font-size: 1.05rem; margin-top: 16px; }
.btn.whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: #fff; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

.error { color: var(--danger); font-weight: 600; }
p.error { margin: 12px 0 0; }

/* Painel */
.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 12px; font-size: 0.9rem; }
.back:hover { color: var(--accent); }

.info { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); }
.info.center { justify-content: center; margin-bottom: 16px; }

.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { margin-top: 0; font-size: 0.85rem; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section-head h2 { margin: 0; }

.participants { list-style: none; padding: 0; margin: 0; }
.participant {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.participant:first-child { border-top: none; }
.p-main { min-width: 0; }
.p-main .name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 0.8rem; color: var(--muted); }
.status.seen { color: var(--green); }
.p-actions { display: flex; gap: 6px; flex-shrink: 0; }

.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 12px 0 16px; }
.progress-bar > div { height: 100%; background: var(--green); transition: width 0.4s; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Meus grupos */
.group-list { list-style: none; padding: 0; margin: 0; }
.group-list li { border-top: 1px solid var(--border); }
.group-list li:first-child { border-top: none; }
.group-list a { display: flex; justify-content: space-between; padding: 10px 0; color: var(--text); text-decoration: none; }
.group-list a:hover { color: var(--accent); }
.group-list small { color: var(--muted); }

/* Participante */
.reveal-card { padding: 32px 24px; }
.target {
  font-size: 2.2rem; font-weight: 800; color: var(--accent);
  padding: 20px; margin: 8px 0 12px;
  background: var(--accent-soft); border-radius: 14px;
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  word-break: break-word;
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.note {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; text-align: left;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  box-shadow: var(--shadow); z-index: 10; max-width: calc(100% - 32px); text-align: center;
}

@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  .grid3 { grid-template-columns: 1fr; }
  .person { grid-template-columns: 22px 1fr 36px; }
  .person .p-phone { grid-column: 2; }
  .person .remove { grid-row: 1; grid-column: 3; }
  .person { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .participant { flex-direction: column; align-items: stretch; }
  .p-actions .btn { flex: 1; }
}
