/* Paneles (festejado y admin) y página de inicio — estilo papel café.
   Cormorant Garamond para títulos, DM Sans para la interfaz (legible para cualquiera). */
:root {
  --bg: #f2ece3;
  --surface: #fbf8f3;
  --surface-2: #f6f0e7;
  --ink: #3a2a1f;
  --muted: #6b5a4b;
  --line: #e3d8c8;
  --line-strong: #cbb9a2;
  --primary: #3a2a1f;
  --on-primary: #fbf8f3;
  --accent: #9a6a3c;
  --success: #2f6a3a; --success-soft: #e2ecdb;
  --danger: #9b2c1f;  --danger-soft: #f5e0da;
  --warning: #85570f; --warning-soft: #f4e8cf;
  --whatsapp: #1e7a45;
  --shadow-sm: 0 1px 2px rgba(58, 42, 31, .06), 0 1px 3px rgba(58, 42, 31, .06);
  --shadow-md: 0 8px 24px -12px rgba(58, 42, 31, .25);
  --shadow-lg: 0 24px 48px -16px rgba(58, 42, 31, .35);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .1 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C12.6 7.4 16.6 11.4 24 12 16.6 12.6 12.6 16.6 12 24 11.4 16.6 7.4 12.6 0 12 7.4 11.4 11.4 7.4 12 0Z'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0; min-height: 100dvh;
  font-family: var(--font-body); font-size: 16px; line-height: 1.5; color: var(--ink);
  background-color: var(--bg); background-image: var(--noise);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 7vw, 2.8rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
p { margin: 0; }
a { color: var(--ink); }
.italic { font-style: italic; }
.icon { flex-shrink: 0; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.star-mark { display: inline-block; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--star) center / contain no-repeat; mask: var(--star) center / contain no-repeat; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 1.4rem; text-decoration: none; color: var(--ink); }
main { padding: 24px 0 120px; }
.stack { display: grid; gap: 16px; }
.stack-lg { display: grid; gap: 28px; }
.stack > *, .stack-lg > *, .grid-2 > * { min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }

.kicker { font-family: var(--font-display); font-style: italic; font-size: 1.25rem; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-style: italic; font-weight: 500; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--line-strong); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card-soft { background: var(--surface-2); }
.card h3 { margin-bottom: 6px; }

/* ---------- Botones (mín. 48px) ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font: 600 1rem/1.1 var(--font-body);
  text-decoration: none; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease), filter .2s var(--ease);
}
.btn:hover { --b-bd: var(--ink); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { --b-bg: var(--primary); --b-fg: var(--on-primary); --b-bd: var(--primary); }
.btn-primary:hover { filter: brightness(1.15); }
.btn-whatsapp { --b-bg: var(--whatsapp); --b-fg: #fff; --b-bd: var(--whatsapp); }
.btn-whatsapp:hover { --b-bd: var(--whatsapp); filter: brightness(1.1); }
.btn-wa-outline { --b-fg: var(--whatsapp); --b-bd: color-mix(in srgb, var(--whatsapp) 45%, transparent); }
.btn-wa-outline:hover { --b-bd: var(--whatsapp); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; }
.btn-ghost:hover { --b-bg: var(--surface-2); --b-bd: transparent; }
.btn-danger { --b-fg: var(--danger); }
.btn-danger:hover { --b-bd: var(--danger); }
.btn-sm { min-height: 44px; padding: 8px 16px; font-size: .925rem; }
.btn-icon { width: 48px; padding: 0; }
.btn-block { width: 100%; }
.btn .spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .95rem; }
.hint { font-size: .85rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font: 400 1rem/1.4 var(--font-body); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .875rem; font-weight: 600; }
.field-error:empty { display: none; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: 44px; padding-top: 8px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); margin: 1px 0 0; flex-shrink: 0; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 44px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px; background: #fff; }
.stepper output { min-width: 3ch; text-align: center; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper .btn { min-height: 44px; width: 44px; padding: 0; --b-bd: transparent; --b-bg: var(--surface-2); }

/* ---------- Resumen ---------- */
.summary { display: grid; gap: 18px; }
.big-number { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big-number strong { font: 700 3.4rem/1 var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.big-number span { font-family: var(--font-display); font-style: italic; font-size: 1.6rem; }
.status-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-btn {
  display: grid; gap: 2px; justify-items: start; text-align: left; padding: 12px; min-height: 76px;
  border-radius: var(--radius); border: 1.5px solid transparent; cursor: pointer; font: inherit; color: inherit;
  transition: transform .15s var(--ease), border-color .2s var(--ease);
}
.status-btn:active { transform: scale(.97); }
.status-btn strong { font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.status-btn span { display: flex; align-items: center; gap: 4px; font-size: .85rem; font-weight: 600; }
.status-btn.yes { background: var(--success-soft); color: var(--success); }
.status-btn.no { background: var(--danger-soft); color: var(--danger); }
.status-btn.pending { background: var(--warning-soft); color: var(--warning); }
.status-btn[aria-pressed="true"] { border-color: currentColor; }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; display: flex; }
.bar span { height: 100%; transition: width .6s var(--ease); }

/* ---------- Pasos / ayuda ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; counter-increment: s; }
.steps li::before {
  content: counter(s); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--on-primary); font-weight: 700;
}
.steps strong { display: block; }

.way { display: grid; gap: 12px; align-content: start; }
.way-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.way .actions { display: grid; gap: 8px; margin-top: 4px; }

/* ---------- Chips de filtro ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chip {
  min-height: 42px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 600 .9rem var(--font-body); cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-primary); border-color: var(--ink); }

/* ---------- Invitados ---------- */
.guest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.guest { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; box-shadow: var(--shadow-sm); }
.guest-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.guest-name { font-weight: 700; font-size: 1.08rem; overflow-wrap: anywhere; }
.guest-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .95rem; margin-top: 4px; }
.guest-state.yes { color: var(--success); }
.guest-state.no { color: var(--danger); }
.guest-state.pending { color: var(--warning); }
.guest-sub { font-size: .875rem; color: var(--muted); margin-top: 2px; }
.guest-note { font-size: .925rem; background: var(--surface-2); border-left: 3px solid var(--line-strong); border-radius: 0 10px 10px 0; padding: 8px 12px; font-style: italic; }
.guest-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.guest-actions .btn { flex: 1 1 auto; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; color: var(--muted); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: grid; gap: 8px; justify-items: center; }

/* ---------- Diálogos / hojas ---------- */
dialog {
  width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0;
  border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(40, 28, 20, .45); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(16px); } }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.dialog-head h2 { font-style: italic; font-weight: 500; }
.dialog-body { padding: 16px 20px; display: grid; gap: 18px; }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }
.dialog-foot .btn { flex: 1 1 auto; }
.menu-list { display: grid; gap: 6px; padding: 8px 12px 16px; }
.menu-list .btn { justify-content: flex-start; --b-bd: transparent; --b-bg: transparent; border-radius: 14px; min-height: 52px; }
.menu-list .btn:hover { --b-bg: var(--surface-2); }
.success-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); margin: 0 auto; }

/* ---------- Login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 32px 24px; text-align: center; display: grid; gap: 16px; }
.pin-input { text-align: center; font-size: 1.8rem; letter-spacing: .5em; font-variant-numeric: tabular-nums; padding-left: calc(14px + .5em); }

.linkbox { display: flex; gap: 6px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 4px 4px 14px; }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }

details.more { border-top: 1px solid var(--line); padding-top: 8px; }
details.more summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 52px; font-weight: 700; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; font-weight: 400; }
details.more[open] summary::after { content: "–"; }

/* Barra inferior fija en celular */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
@media (min-width: 720px) { .bottom-bar { display: none; } main { padding-bottom: 48px; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 100;
  display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: var(--on-primary); font-weight: 600; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform .3s var(--ease), opacity .3s var(--ease);
  max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-error { background: var(--danger); }

/* Admin */
.events-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.event-card { display: grid; gap: 8px; text-decoration: none; color: inherit; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.event-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.media-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.media-preview img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.media-preview audio { max-width: 100%; height: 40px; }
.tones { display: flex; gap: 10px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.tone { position: relative; cursor: pointer; }
.tone input { position: absolute; opacity: 0; inset: 0; }
.tone span { display: grid; gap: 6px; justify-items: center; font-size: .85rem; font-weight: 600; padding: 8px; border-radius: 14px; border: 2px solid transparent; }
.tone i { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .1); display: block; }
.tone input:checked + span { border-color: var(--ink); }
.tone input:focus-visible + span { outline: 3px solid var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
