/* ===================================================================
   Rifas — estilos (sitio público + panel)
   El color principal se define en <style>:root{--accent}</style>
   =================================================================== */

:root {
  --accent: #e11d48;
  --accent-ink: #fff;
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e9e3d8;
  --ok: #15803d;
  --ok-bg: #e8f6ed;
  --warn: #92400e;
  --warn-bg: #fff4dc;
  --err: #b91c1c;
  --err-bg: #fdeaea;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 8px 24px rgba(31, 36, 48, .06);
  --accent-dark: color-mix(in srgb, var(--accent) 78%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
body.has-cart { padding-bottom: 96px; }
img { max-width: 100%; display: block; }
a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--accent-dark); margin-bottom: .6em; }
.section { padding: 40px 0; }
.section.alt { background: #fff; border-block: 1px solid var(--line); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Cabecera ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 1.3rem; }
.brand-logo { height: 40px; width: 40px; object-fit: contain; }
.hero-logo { width: 120px; height: 120px; margin-bottom: 14px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }
.nav { display: flex; gap: 4px 16px; align-items: center; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.on { border-bottom-color: var(--accent); }
.tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 99px; }
.badge-n { background: var(--accent); color: var(--accent-ink); border-radius: 99px; font-size: .72rem; padding: 1px 7px; margin-left: 2px; }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 6px 2px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; color: var(--muted); }
.linklike:hover { color: var(--err); }

/* ---------- Héroe ---------- */
.hero {
  background:
    radial-gradient(900px 300px at 85% -20%, rgba(255,255,255,.25), transparent 60%),
    linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--accent-ink);
  padding: 56px 0 64px;
}
.hero .eyebrow { color: inherit; opacity: .85; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.hero .lead { font-size: 1.15rem; max-width: 40em; opacity: .95; }

/* ---------- Botones ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700;
  padding: 11px 20px; border-radius: 12px; transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(.94); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-light { background: #fff; color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--accent-dark); box-shadow: inset 0 0 0 2px var(--accent); }
.btn-wa { background: #25d366; color: #0b2e18; }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 9px; }
.btn-ghost-sm { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; padding: 8px; }

/* ---------- Tarjetas ---------- */
.cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.empty { text-align: center; padding: 36px 20px; }
.raffle-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.thumb { display: block; aspect-ratio: 16 / 10; background: var(--accent-soft); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-ph { height: 100%; display: grid; place-items: center; font-size: 3.2rem; }
.thumb-ph.big { aspect-ratio: 16 / 10; font-size: 5rem; background: var(--accent-soft); border-radius: var(--radius); }
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body .btn { margin-top: auto; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 3px 10px; border-radius: 99px; background: #eee; color: #555; margin-bottom: 8px; align-self: flex-start; }
.pill-on { background: var(--ok-bg); color: var(--ok); }
.prize { font-weight: 600; margin-bottom: .4em; }
.price { margin-bottom: .6em; }
.big.price strong, .price.big strong { font-size: 1.8rem; }
.prize.big { font-size: 1.2rem; }
.progress { height: 10px; background: #eee6da; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: 99px; }

/* ---------- Pasos ---------- */
.steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; }
.steps p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
input, select, textarea {
  display: block; width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1.5px solid #d9d2c5; border-radius: 10px; padding: 10px 12px; margin-top: 5px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 6px 0 0; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 42px; width: 80px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; flex: none; }
.row { display: flex; gap: 10px; }
.row input { margin-top: 0; }
.lookup label { font-weight: 500; }
.form-error { color: var(--err); background: var(--err-bg); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.help { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 3px; }

/* ---------- Página de rifa ---------- */
.raffle-head { display: grid; gap: 28px; padding-top: 28px; padding-bottom: 8px; }
@media (min-width: 820px) { .raffle-head { grid-template-columns: 1.05fr 1fr; align-items: start; } }
.raffle-media img { width: 100%; height: auto; max-height: 85vh; object-fit: contain; border-radius: var(--radius); box-shadow: var(--shadow); }
.desc p:last-child { margin-bottom: 0; }

.winner { text-align: center; background: linear-gradient(135deg, #fff7d6, #ffe9a8); border: 2px solid #f2c94c; border-radius: var(--radius); padding: 22px; margin: 18px 0; color: #5b4300; }
.winner .eyebrow { color: #8a6500; }
.winner-n { font-size: 3.2rem; font-weight: 900; margin: 0; line-height: 1.1; }

/* ---------- Selector de números ---------- */
.picker-tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; margin-bottom: 12px; }
.goto { width: 190px; }
.goto .row { gap: 6px; }
.goto .row input { min-width: 0; }
.goto label { margin-bottom: 0; font-size: .8rem; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1.5px solid #d9d2c5; border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem; padding: 10px 14px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.lucky { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; flex-wrap: wrap; }
.lucky button { border: 1.5px solid var(--accent); color: var(--accent-dark); background: #fff; font: inherit; font-weight: 700; padding: 7px 12px; border-radius: 10px; cursor: pointer; }
.lucky button:hover { background: var(--accent-soft); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 12px; font-size: .85rem; color: var(--muted); }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; border: 1.5px solid #cfc7b8; background: #fff; }
.dot.sel { background: var(--accent); border-color: var(--accent); }
.dot.held { background: #ffe9a8; border-color: #e6bf4d; }
.dot.sold { background: #d9d6d0; border-color: #c2beb6; }

.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
.num {
  font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
  padding: 11px 0; border-radius: 10px; border: 1.5px solid #d9d2c5; background: #fff; color: var(--ink);
  transition: transform .08s, background .12s;
}
.num.free:hover { border-color: var(--accent); background: var(--accent-soft); }
.num.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.04); }
.num.held { background: #fff2c6; border-color: #e6bf4d; color: #8a6a00; cursor: not-allowed; }
.num.sold { background: #e6e3dd; border-color: #d3cfc6; color: #9a958b; cursor: not-allowed; text-decoration: line-through; }
.num.ping { animation: ping 1.2s ease-out 1; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--accent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; }
.pager button { border: 1.5px solid #d9d2c5; background: #fff; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- Barra de selección ---------- */
.cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.1); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.cart[hidden] { display: none; }
.cart-in { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.cart-sum { min-width: 0; flex: 1; }
.cart-sum strong { font-size: 1.05rem; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: thin; }
.chip { flex: none; border: 0; background: var(--accent-soft); color: var(--accent-dark); font: inherit; font-weight: 700; font-size: .8rem; padding: 3px 10px; border-radius: 99px; cursor: pointer; }
.cart-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- Ventana de apartado ---------- */
dialog.modal { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 24px 60px rgba(0,0,0,.35); color: var(--ink); }
dialog.modal::backdrop { background: rgba(20, 20, 30, .55); }
.modal-body { padding: 24px 22px 26px; position: relative; }
.modal-body[hidden] { display: none; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); }
.summary { background: var(--accent-soft); padding: 12px 14px; border-radius: 12px; }
.notice { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; border-radius: 12px; margin: 14px 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.notice.warn { background: var(--err-bg); color: var(--err); }

.bank { border: 1.5px dashed #cfc7b8; border-radius: 12px; padding: 4px 14px; margin: 8px 0 12px; background: #fffdf9; }
.bank-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bank-row:last-child { border-bottom: 0; }
.bank-l { color: var(--muted); font-size: .85rem; }
.bank-v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.copy { margin-left: 8px; border: 1.5px solid var(--accent); background: #fff; color: var(--accent-dark); border-radius: 8px; font: inherit; font-size: .78rem; font-weight: 700; padding: 3px 9px; cursor: pointer; }
.copy.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

.terms summary { cursor: pointer; font-weight: 700; }
.terms-body { margin-top: 10px; color: #444; }

/* ---------- Folio ---------- */
.order h1 { margin-bottom: .3em; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 16px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts .nums { font-variant-numeric: tabular-nums; word-break: break-word; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); opacity: 0; background: #1f2430; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: min(92vw, 460px); font-weight: 600; transition: all .25s; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; margin-top: 24px; text-align: center; background: #fff; }

/* ===================================================================
   Panel de administración
   =================================================================== */
body.admin { background: #f4f1ea; }
.admin-main { padding-top: 24px; padding-bottom: 60px; }
.page-title { font-size: 1.6rem; }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-err { background: var(--err-bg); color: var(--err); }
.flash a { color: inherit; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf8f3; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nums { max-width: 240px; font-variant-numeric: tabular-nums; word-break: break-word; }
td.act { white-space: nowrap; }
td.act form { display: inline; }
td.act .btn { margin: 2px 2px 2px 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; }
.b-pend { background: var(--warn-bg); color: var(--warn); }
.b-paid { background: var(--ok-bg); color: var(--ok); }
.b-off { background: #eceae5; color: #6b665c; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 16px; }
.filters label { margin: 0; font-size: .8rem; }
.filters select, .filters input { width: auto; min-width: 150px; }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.panel h2 { font-size: 1.15rem; }
.todo { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.todo a { color: inherit; font-weight: 700; }
.thumb-sm { width: 120px; border-radius: 10px; margin: 6px 0; }
.pagination { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
.pagination .on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.login-box { max-width: 420px; margin: 8vh auto; }

@media (max-width: 560px) {
  .hero { padding: 40px 0 46px; }
  .cart-in { gap: 8px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Regalos */
.gift-pick{border:1px solid var(--line,#e5e7eb);border-radius:12px;padding:10px 14px;margin:12px 0}
.gift-pick legend{font-weight:700;padding:0 6px}
.gift-box{margin-top:16px;text-align:center}
.coupon-code code{display:inline-block;font-size:1.5rem;letter-spacing:.08em;padding:10px 16px;border:2px dashed var(--accent);border-radius:10px;user-select:all}
