:root {
  --bg: #f8f4ef;
  --card: #ffffff;
  --text: #3b2f2f;
  --muted: #8b7c73;
  --brand: #8a5a44;
  --brand-dark: #6e4533;
  --line: #ece3da;
  --ok: #2f7a4b;
  --ok-bg: #e8f4ec;
  --no: #b2452f;
  --no-bg: #fbeae5;
  --warn-bg: #fff6e0;
  --info-bg: #ebeff8;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--brand); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; line-height: 1.2; }
h1 { font-size: 2rem; margin: .2em 0; }
code { background: #f3ede6; padding: 1px 5px; border-radius: 4px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; gap: 16px; align-items: center; }
.brand { font-family: Georgia, serif; font-size: 1.5rem; text-decoration: none; color: var(--brand); }

.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px; }
.footer a { color: inherit; }
.prose h3 { margin-top: 24px; }
.prose li { margin-bottom: 6px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px;
}
.card.narrow { max-width: 600px; margin-left: auto; margin-right: auto; }
.card.warn { background: var(--warn-bg); }
.center { text-align: center; }
.muted { color: var(--muted); }
.pre { white-space: pre-line; }

.btn {
  display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 10px 20px; border-radius: 10px; font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.outline { background: transparent; color: var(--brand); }
.btn.outline:hover { background: #f3ebe4; }
/* Branco explícito: a regra .danger abaixo (texto vermelho dos links) também alcança o botão. */
.btn.danger { background: var(--no); border-color: var(--no); color: #fff; }
.btn.danger:hover { background: #8f3624; border-color: #8f3624; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
button.link.danger, .danger { color: var(--no); }
form.inline { display: inline; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid #d9ccc0; border-radius: 8px; background: #fff; color: var(--text); width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 84px; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: .85rem; padding: 4px 8px;
}
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
legend { font-family: Georgia, serif; font-size: 1.1rem; padding: 0 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.row > label.grow { flex: 3 1 240px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.erro { background: var(--no-bg); color: var(--no); }
.flash.aviso { background: var(--warn-bg); }

.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 { font-size: 2.8rem; }
.hero p { max-width: 640px; margin: 12px auto; color: var(--muted); font-size: 1.1rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 24px; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.event-card { text-decoration: none; color: inherit; transition: box-shadow .15s; }
.event-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.event-card p { margin: 4px 0; }

.tag { display: inline-block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); background: #f3ebe4; padding: 2px 10px; border-radius: 99px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted); }
.stat strong { display: block; font-size: 1.8rem; color: var(--text); font-family: Georgia, serif; font-weight: normal; }
.stat.ok { background: var(--ok-bg); }
.stat.no { background: var(--no-bg); }
.stat.info { background: var(--info-bg); }
.stat.gift { background: var(--warn-bg); }

.filters a { margin-right: 10px; text-decoration: none; color: var(--muted); }
.filters a.active { color: var(--brand); font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 8px; }
td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
.row-actions { white-space: nowrap; }
.row-actions > * { margin-right: 8px; }
.row-actions details.thanks { white-space: normal; min-width: 240px; }

.status { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .82rem; background: #f1ece6; }
.status.yes, .status.paid { background: var(--ok-bg); color: var(--ok); }
.status.no, .status.cancelled, .status.refunded { background: var(--no-bg); color: var(--no); }
.status.awaiting { background: var(--warn-bg); color: #9a6a00; }

.gift img { width: 100%; height: 170px; object-fit: cover; border-radius: 10px; }
.gift h3 { margin: 10px 0 4px; }
.gift.sold { opacity: .6; }
.price { font-size: 1.3rem; color: var(--brand); font-family: Georgia, serif; margin: 6px 0 12px; }
details summary { cursor: pointer; color: var(--brand); margin: 6px 0; }
.find-invite { margin-top: 16px; }
.find-invite summary { text-align: center; }
.choice-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gift-summary { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.gift-summary img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; }

.copy { display: flex; gap: 8px; margin-bottom: 12px; }
.copy input { font-family: ui-monospace, monospace; font-size: .85rem; }
.qr { width: 260px; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }

.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--brand); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.invite { text-align: left; }
.invite-head { text-align: center; border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 10px; }
.script { font-size: 2.4rem; color: var(--brand); }
.hosts { font-size: 1.2rem; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.companions { display: flex; flex-direction: column; gap: 14px; }
.form label[hidden] { display: none; }
.choice { flex-direction: row !important; align-items: center; gap: 10px !important; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); background: #fbf6f2; }

.danger-zone { border-color: #efc9bf; }

.mp-box { border: 1px dashed #b9d4f5; background: #f3f8fe; border-radius: 10px; padding: 12px 16px; margin-top: 12px; }
.mp-box.connected { border-style: solid; border-color: #bfe0cb; background: var(--ok-bg); }
.mp-box p { margin: 4px 0; }
.hosts-list { list-style: none; padding: 0; margin: 0 0 14px; }
.hosts-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hosts-list form { margin-left: 8px; }
.seat-list { list-style: none; padding: 0; margin: 0 0 12px; }
.seat-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.seat-list select { width: auto; padding: 4px 8px; }
.prefixed { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.prefixed input { flex: 1 1 160px; width: auto; }

@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 2rem; }
  .topbar { padding: 12px 16px; }
}

/* Anúncios (só nas páginas dos convidados) */
.ad-slot { margin: 24px auto; max-width: 728px; text-align: center; }
.ad-slot small { display: block; margin-bottom: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.ads-consent { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: 640px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 50; }
.ads-consent p { margin: 0 0 10px; font-size: 14px; }
.ads-consent[hidden] { display: none; }
