:root{
  --ink:#1c140d;
  --paper:#e8dfc4;
  --paper-dark:#dcd0ab;
  --bg-1:#0d1116;
  --bg-2:#171c22;
  --gold:#e3ac1f;
  --gold-dark:#b98615;
  --terracotta:#b5502e;
  --green-ok:#2f8f5b;
  --line: rgba(28,20,13,0.18);
  --sold: #b3a685;
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background: var(--bg-1);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  min-height:100vh;
}
a{ color: inherit; }

/* ---------- páginas públicas ---------- */
.page-wrap{
  display:flex; justify-content:center; padding: 40px 16px 60px;
}
.ticket{
  width:100%; max-width: 640px; background: var(--paper);
  border-radius: 4px; overflow:hidden;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.hero{
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  color: var(--paper); padding: 26px 28px 32px;
}
.hero.com-banner{ padding: 0; }
.brand{ display:flex; align-items:center; gap:10px; margin-bottom: 18px; }
.brand img{ width:32px; height:32px; border-radius:50%; }
.brand span{ font-family:'IBM Plex Mono', monospace; font-size:12.5px; color: rgba(232,223,196,0.8); }
.hero-banner{
  width:100%; aspect-ratio: 2 / 1; object-fit:cover; display:block;
  background: rgba(232,223,196,0.06);
}
.hero-content{ padding: 22px 28px 30px; }
.hero h1{ font-family:'Fraunces', serif; font-weight:600; font-size:24px; line-height:1.16; margin:0 0 8px; max-width:20ch; }
.hero p{ margin:0; font-size:14.5px; line-height:1.5; color: rgba(232,223,196,0.72); }
.hero-meta{ display:flex; gap:22px; margin-top:22px; flex-wrap:wrap; }
.hero-meta .num{ font-family:'IBM Plex Mono', monospace; font-size:19px; color: var(--gold); }
.hero-meta .label{ font-family:'IBM Plex Mono', monospace; font-size:11px; color: rgba(232,223,196,0.5); margin-top:2px; }

.body-pad{ padding: 22px 28px 28px; }
.grid-head{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:12px; }
.grid-head h2{ font-family:'Fraunces', serif; font-weight:600; font-size:17px; margin:0; }
.legend{ display:flex; gap:12px; font-size:11.5px; color: rgba(28,20,13,0.62); }
.legend span{ display:inline-flex; align-items:center; gap:5px; }
.dot{ width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot.avail{ background: var(--paper-dark); border:1px solid var(--line); }
.dot.res{ background: var(--terracotta); }
.dot.sold{ background: var(--sold); }

.grid{ display:grid; grid-template-columns: repeat(8, 1fr); gap:6px; margin-bottom:20px; }
.n{
  aspect-ratio:1; display:flex; align-items:center; justify-content:center;
  font-family:'IBM Plex Mono', monospace; font-size:12.5px; font-weight:500;
  border-radius:3px; border:1px solid var(--line); background: var(--paper-dark);
  cursor:pointer; user-select:none;
}
.n.selected{ background: var(--bg-1); color: var(--gold); border-color: var(--bg-1); }
.n.reserved{ background:transparent; color: var(--terracotta); border-color: var(--terracotta); border-style:dashed; cursor:not-allowed; }
.n.sold{ background: var(--sold); color: rgba(28,20,13,0.4); cursor:not-allowed; text-decoration: line-through; }

.rules{ font-size:12.5px; color: rgba(28,20,13,0.58); line-height:1.6; padding-bottom:18px; border-bottom:1px solid var(--line); margin-bottom:18px; }

.field{ margin-bottom:12px; }
.field label{ display:block; font-size:12px; color: rgba(28,20,13,0.65); margin-bottom:5px; }
.field input,.field textarea{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:3px;
  background:#fbf8f0; font-family:'Inter', sans-serif; font-size:14px; color: var(--ink);
}
.field input:focus,.field textarea:focus{ outline:2px solid var(--ink); outline-offset:1px; }

.summary-row{ display:flex; justify-content:space-between; align-items:center; padding-top:14px; border-top:1px dashed var(--line); margin-top:6px; }
.summary-row .count{ font-size:13px; color: rgba(28,20,13,0.6); }
.summary-row .total{ font-family:'IBM Plex Mono', monospace; font-size:19px; color: var(--terracotta); }

button.primary{
  width:100%; margin-top:16px; padding:13px; border:none; border-radius:5px;
  background: var(--ink); color: var(--paper); font-family:'Inter',sans-serif;
  font-weight:600; font-size:14px; cursor:pointer;
}
button.primary:disabled{ opacity:.35; cursor:not-allowed; }

.msg{ padding:12px 14px; border-radius:5px; font-size:13px; margin-bottom:16px; }
.msg.erro{ background: rgba(181,80,46,0.12); color: var(--terracotta); }
.msg.ok{ background: rgba(47,143,91,0.12); color: var(--green-ok); }

.raffle-card{
  display:flex; flex-direction:column; background: var(--paper); border-radius:6px;
  overflow:hidden; margin-bottom:16px; text-decoration:none;
}
.raffle-card .banner{ width:100%; aspect-ratio: 2 / 1; object-fit:cover; background: var(--paper-dark); display:block; }
.raffle-card .info{ padding:14px 16px; }
.raffle-card h3{ font-family:'Fraunces', serif; margin:0 0 4px; font-size:16px; color: var(--ink); }
.raffle-card p{ margin:0; font-size:12.5px; color: rgba(28,20,13,0.6); }

/* ---------- admin ---------- */
.admin-wrap{ display:flex; min-height:100vh; }
.sidebar{
  width:216px; flex-shrink:0; background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  color: var(--paper); padding:22px 16px; display:flex; flex-direction:column;
}
.sb-brand{ display:flex; align-items:center; gap:9px; margin-bottom:30px; padding:0 4px; }
.sb-brand img{ width:30px; height:30px; border-radius:50%; }
.sb-brand span{ font-family:'IBM Plex Mono', monospace; font-size:11.5px; color: rgba(244,236,211,0.75); line-height:1.3; }
.nav-item{ display:block; padding:10px 12px; border-radius:6px; margin-bottom:4px; font-size:13.5px; color: rgba(244,236,211,0.62); text-decoration:none; }
.nav-item:hover{ background: rgba(244,236,211,0.06); color: rgba(244,236,211,0.9); }
.nav-item.active{ background: rgba(227,172,31,0.14); color: var(--gold); }
.sb-foot{ margin-top:auto; font-family:'IBM Plex Mono', monospace; font-size:10.5px; color: rgba(244,236,211,0.35); padding:0 4px; }

.main{ flex:1; padding:28px 34px; max-width:1040px; background:#faf5e6; min-height:100vh; }
.page-head{ display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:22px; }
.page-head h1{ font-family:'Fraunces', serif; font-weight:700; font-size:24px; margin:0 0 4px; }
.page-head p{ margin:0; font-size:13px; color: rgba(28,20,13,0.55); }

.btn{ border:none; border-radius:5px; font-family:'Inter',sans-serif; font-weight:600; font-size:12.5px; padding:9px 14px; cursor:pointer; text-decoration:none; display:inline-block; }
.btn-dark{ background: var(--ink); color: var(--paper); }
.btn-ghost{ background:transparent; border:1px solid var(--line); color: var(--ink); }
.btn-confirm{ background: var(--green-ok); color:#fff; }
.btn-cancel{ background:transparent; border:1px solid var(--terracotta); color: var(--terracotta); }
.btn-sm{ padding:6px 10px; font-size:11.5px; }

.stat-grid{ display:grid; grid-template-columns: repeat(4,1fr); gap:14px; margin-bottom:26px; }
.stat-card{ background: var(--paper); border:1px solid var(--line); border-radius:8px; padding:16px 18px; }
.stat-card .label{ font-size:11px; color: rgba(28,20,13,0.55); margin-bottom:8px; }
.stat-card .value{ font-family:'IBM Plex Mono', monospace; font-size:22px; }
.stat-card .value.gold{ color: var(--gold-dark); }
.stat-card .value.terracotta{ color: var(--terracotta); }
.stat-card .sub{ font-size:11px; color: rgba(28,20,13,0.4); margin-top:4px; }

table{ width:100%; border-collapse:collapse; background: var(--paper); border-radius:8px; overflow:hidden; }
thead th{ text-align:left; font-size:10.5px; color: rgba(28,20,13,0.5); padding:10px 14px; border-bottom:1px solid var(--line); font-weight:600; }
tbody td{ padding:12px 14px; border-bottom:1px solid var(--line); font-size:12.5px; vertical-align:middle; }
tbody tr:last-child td{ border-bottom:none; }
.buyer-sub{ font-size:11px; color: rgba(28,20,13,0.5); margin-top:1px; }
.nums{ font-family:'IBM Plex Mono', monospace; font-size:11.5px; }
.valor{ font-family:'IBM Plex Mono', monospace; font-weight:600; }
.badge{ display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; padding:4px 9px; border-radius:12px; }
.badge.pendente{ background: rgba(181,80,46,0.12); color: var(--terracotta); }
.badge.pago{ background: rgba(47,143,91,0.12); color: var(--green-ok); }
.badge.cancelado, .badge.expirado{ background: rgba(28,20,13,0.08); color: rgba(28,20,13,0.5); }
.row-actions{ display:flex; gap:6px; }
.row-actions form{ display:inline; }

.rifa-card{ display:flex; gap:14px; background: var(--paper); border:1px solid var(--line); border-radius:8px; padding:14px 16px; margin-bottom:10px; align-items:center; }
.rifa-thumb{ width:96px; height:48px; border-radius:6px; object-fit:cover; flex-shrink:0; background: linear-gradient(160deg, var(--bg-2), var(--bg-1)); }
.rifa-info{ flex:1; }
.rifa-info h4{ margin:0 0 3px; font-family:'Fraunces', serif; font-size:14.5px; }
.rifa-info .meta{ font-size:11.5px; color: rgba(28,20,13,0.55); }
.rifa-status{ font-size:11px; font-weight:600; padding:4px 9px; border-radius:12px; }
.rifa-status.ativa{ background: rgba(47,143,91,0.12); color: var(--green-ok); }
.rifa-status.encerrada,.rifa-status.cancelada{ background: rgba(28,20,13,0.08); color: rgba(28,20,13,0.5); }

.form-card{ background: var(--paper); border:1px solid var(--line); border-radius:8px; padding:20px; max-width:640px; }
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.form-with-image{ display:flex; gap:20px; margin-bottom:14px; }
.image-upload{
  width:220px; height:110px; flex-shrink:0; border-radius:8px; border:1.5px dashed var(--line);
  background:#fbf8f0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; cursor:pointer; overflow:hidden; position:relative; text-align:center;
}
.image-upload .plus{ font-size:22px; color: rgba(28,20,13,0.35); }
.image-upload .txt{ font-size:10.5px; color: rgba(28,20,13,0.5); padding:0 14px; line-height:1.4; }
.image-upload img{ width:100%; height:100%; object-fit:cover; position:absolute; top:0; left:0; }
.image-upload input[type=file]{ display:none; }
.hint{ font-size:10.5px; color: rgba(28,20,13,0.45); margin-top:6px; max-width:140px; }

.login-wrap{ display:flex; align-items:center; justify-content:center; min-height:100vh; background: var(--bg-1); }
.login-card{ width:100%; max-width:340px; background: var(--paper); border-radius:8px; padding:28px; }
.login-card .brand{ color: var(--ink); }
.login-card .brand span{ color: rgba(28,20,13,0.6); }
