:root {
  --brand: #2a3e5a;
  --flame: #f15f3a;
  --sun: #fcd335;
  --ink: #1b2430;
  --muted: #5d6b7a;
  --line: #e3e8ee;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #1e7d4f;
  --ok-bg: #e5f5ec;
  --warn: #9a6200;
  --warn-bg: #fff3dc;
  --bad: #b3261e;
  --bad-bg: #fde8e6;
  --info-bg: #e8f0f9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1100px; }

/* topo */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: .02em; }
.brand-logo { height: 38px; width: auto; display: block; }
.topbar { border-top: 3px solid var(--flame); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: 0; }
.topbar .spacer { flex: 1; }
.demo-band { background: #2b2d42; color: #fff; font-size: .82rem; text-align: center; padding: 6px 12px; }
.demo-band a { color: #ffd166; }

/* cards e layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.section { margin-top: 24px; margin-bottom: 24px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.pre { white-space: pre-line; }

/* hero do evento */
.hero { background: var(--ev, var(--brand)); color: #fff; padding: 34px 0 30px; }
.hero h1 { font-size: 2rem; margin-bottom: 10px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; opacity: .95; font-size: .95rem; }
.hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.hero-home { background: var(--brand); color: #fff; padding: 40px 0 34px; position: relative; overflow: hidden; border-bottom: 5px solid var(--sun); }
.hero-home .wrap { display: flex; align-items: center; gap: 24px; }
.hero-home .wrap > div { flex: 1; }
.hero-home img { height: 130px; width: auto; filter: drop-shadow(0 4px 14px rgba(0,0,0,.25)); background: #fff; border-radius: 18px; padding: 12px 16px; }
@media (max-width: 560px) { .hero-home img { height: 84px; padding: 8px 10px; border-radius: 12px; } }
.hero-home p { opacity: .9; margin: 0; }

/* lista de eventos */
.ev-card { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.ev-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(16, 24, 40, .1); }
.ev-card .stripe { height: 6px; background: var(--ev, var(--brand)); }
.ev-card .body { padding: 16px 18px 18px; }
.ev-card h3 { margin-bottom: 6px; font-size: 1.1rem; }
.ev-date { display: flex; gap: 14px; align-items: flex-start; }
.cal { min-width: 54px; text-align: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal b { display: block; font-size: 1.35rem; line-height: 1.2; padding: 4px 0 0; }
.cal span { display: block; font-size: .7rem; text-transform: uppercase; font-weight: 700; color: #fff; background: var(--ev, var(--brand)); padding: 2px 0; letter-spacing: .06em; }
.cal i { display: block; font-style: normal; font-size: .7rem; color: var(--muted); padding-bottom: 4px; }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--info-bg); color: var(--brand); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.gray { background: #eef0f3; color: var(--muted); }

/* formulários */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
label.f > span em { font-style: normal; color: var(--bad); }
label.f > small { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #cfd7e0; border-radius: 10px; padding: 11px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(42, 62, 90, .18); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
input[type=color] { padding: 3px; height: 44px; width: 70px; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; cursor: pointer; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .fields-2 { grid-template-columns: 1fr; } }

.opt-list { display: grid; gap: 8px; margin-bottom: 14px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #cfd7e0; border-radius: 10px; cursor: pointer; background: #fff; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--info-bg); }
.opt .grow { flex: 1; }

.participant { border: 1px dashed #c6d0db; border-radius: 12px; padding: 16px; margin-bottom: 12px; background: #fbfcfd; }
.participant header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: .95rem; border-radius: 10px; padding: 10px 16px; border: 1px solid transparent; cursor: pointer; text-decoration: none; background: var(--brand); color: #fff; transition: filter .12s, background .12s; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.big { padding: 14px 22px; font-size: 1.05rem; width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cfd7e0; }
.btn.ghost:hover { background: #f5f7fa; filter: none; }
.btn.ok { background: var(--ok); }
.btn.danger { background: #fff; color: var(--bad); border-color: #f0c4c0; }
.btn.danger:hover { background: var(--bad-bg); filter: none; }
.btn.sm { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.btn.link { background: none; color: var(--brand); padding: 4px 6px; border: 0; }
.btn.wa { background: #1fa855; }

/* total */
.total-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--info-bg); margin: 6px 0 16px; font-weight: 600; }
.total-bar b { font-size: 1.3rem; }

/* comprovante */
.receipt-ok { text-align: center; padding: 26px 20px; }
.receipt-ok .tick { width: 58px; height: 58px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin: 0 auto 10px; font-size: 1.8rem; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.6rem; letter-spacing: .18em; font-weight: 700; background: #f1f4f8; border-radius: 10px; padding: 8px 14px; display: inline-block; }
.pix { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
@media (max-width: 620px) { .pix { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.qr { width: 220px; height: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.qr svg { width: 100%; height: 100%; display: block; }
.copy-field { font-family: ui-monospace, Menlo, monospace; font-size: .75rem; word-break: break-all; background: #f1f4f8; border-radius: 8px; padding: 10px; max-height: 92px; overflow: auto; text-align: left; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .94rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* painel */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat small { color: var(--muted); font-size: .8rem; display: block; }
.stat b { font-size: 1.35rem; }
.progress { height: 6px; border-radius: 9px; background: #e9edf2; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--ok); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #cfd7e0; background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .94rem; }
table.list tr:last-child td { border-bottom: 0; }
table.list .right { text-align: right; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #f8fafc; }
table.list tr.cancel td { opacity: .5; }
@media (max-width: 720px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
  table.list td { border: 0; padding: 3px 10px; }
  table.list td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .82rem; }
}

.editor-row { display: grid; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fbfcfd; }
.editor-row.opt-row { grid-template-columns: 1fr 140px auto; }
.editor-row.q-row { grid-template-columns: 1fr 150px auto; }
.editor-row .sub { grid-column: 1 / -1; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: .88rem; }
.editor-row .sub label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
@media (max-width: 560px) { .editor-row.opt-row, .editor-row.q-row { grid-template-columns: 1fr 1fr; } .editor-row > .btn { grid-column: 2; justify-self: end; } }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 35, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 620px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal header { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 12px; }
.x { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.pay-line { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .93rem; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--brand); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(30px); background: #1b2430; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: .92rem; opacity: 0; transition: .2s; z-index: 80; pointer-events: none; max-width: 90vw; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 30px 16px 40px; }

@media print {
  .topbar, .toolbar, .tabs, .no-print, footer.foot, .demo-band { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

.optblock { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 2px; margin-bottom: 10px; background: #fbfcfd; }
.chips .chip { min-height: 34px; }
.hero-home .btn { background: var(--flame); }

/* ---------- montar o questionário ---------- */
.q-card { border: 1px solid var(--line); border-left: 4px solid var(--flame); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.q-head b { color: var(--brand); }
.q-tools { display: flex; gap: 4px; align-items: center; }
.q-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.q-type { text-align: left; border: 1.5px solid #cfd7e0; background: #fff; border-radius: 10px; padding: 9px 11px; cursor: pointer; font: inherit; color: var(--ink); line-height: 1.25; }
.q-type b { display: block; font-size: .92rem; }
.q-type small { color: var(--muted); font-size: .76rem; }
.q-type:hover { border-color: var(--brand); }
.q-type.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.q-type.on small { color: #d6deea; }
.q-choices { margin-top: 12px; padding: 10px 12px; background: #f6f8fb; border-radius: 10px; }
.chip-x { border: 0; background: transparent; color: inherit; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 0 0 4px; }
.q-flags { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: .9rem; }
.q-prev { margin-top: 12px; padding: 10px 12px; border: 1px dashed #cfd7e0; border-radius: 10px; background: #fbfcfd; }
.q-prev .f { margin-bottom: 0; }
.q-prev input, .q-prev select, .q-prev textarea, .q-prev-full input, .q-prev-full select, .q-prev-full textarea { pointer-events: none; }
.q-empty { padding: 12px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 12px; }
.q-add { padding: 14px; background: #f6f8fb; border-radius: 12px; }
@media (max-width: 560px) { .q-types { grid-template-columns: 1fr 1fr; } }
