/* ==========================================================================
   Álbum de bodas — estilos compartidos (invitados + panel)
   Mobile-first. Sin frameworks.
   ========================================================================== */

@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --ivory: #fbf8f3;
  --paper: #ffffff;
  --cream: #f4ece2;
  --blush: #f1dcd3;
  --blush-strong: #e6c2b4;
  --rose: #9a4f5c;          /* acento: contraste AA con blanco */
  --rose-dark: #7f3d49;
  --sage: #dfe5d8;
  --sage-dark: #5f7058;
  --gold: #b48a5a;
  --ink: #2e2622;
  --ink-soft: #5e514a;      /* texto secundario: contraste AA sobre marfil */
  --line: #eadfd4;
  --danger: #a63a2f;
  --danger-bg: #fbe9e6;
  --ok: #4f6b45;
  --ok-bg: #e8efe2;

  --serif: "Cormorant", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(70, 45, 30, .06), 0 8px 28px rgba(70, 45, 30, .08);
  --shadow-lg: 0 2px 6px rgba(70, 45, 30, .08), 0 18px 50px rgba(70, 45, 30, .14);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  -webkit-tap-highlight-color: transparent;
}
img, video, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--rose); text-underline-offset: 3px; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; border-radius: 6px; }

.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;
}

/* ---------- Tipografía ---------- */

.display, .h2, .h3, .stat .num, .date-line, .ring .pct {
  font-variant-numeric: lining-nums proportional-nums;
}
.display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 11vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -.01em;
  margin: 0;
}
.display .amp { font-style: italic; color: var(--rose); font-weight: 400; }
.h2 { font-family: var(--serif); font-weight: 500; font-size: 2rem; line-height: 1.1; margin: 0 0 .4rem; }
.h3 { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; line-height: 1.2; margin: 0 0 .3rem; }
.eyebrow {
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin: 0;
}
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }
.center { text-align: center; }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 52px; padding: .8rem 1.4rem;
  border: 1.5px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 1rem; letter-spacing: .01em;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: transform .15s var(--ease), background-color .2s, box-shadow .2s, border-color .2s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn-primary { background: var(--rose); color: #fff; box-shadow: 0 6px 20px rgba(154, 79, 92, .28); }
.btn-primary:hover { background: var(--rose-dark); }
.btn-primary:disabled { background: #c9aeb2; box-shadow: none; cursor: not-allowed; }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--blush-strong); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--cream); }
.btn-danger { background: var(--paper); color: var(--danger); border-color: #efc9c3; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-lg { min-height: 62px; font-size: 1.12rem; padding: 1rem 1.8rem; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 40px; padding: .45rem 1rem; font-size: .92rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--cream); }
.icon-btn svg { width: 22px; height: 22px; }
.link-btn { background: none; border: 0; padding: .2rem; color: var(--rose); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formularios ---------- */

.field { display: grid; gap: .45rem; margin-bottom: 1.15rem; }
.field label, .label { font-weight: 600; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--ink-soft); margin: 0; }
.input, .textarea, .select {
  width: 100%; min-height: 54px; padding: .8rem 1rem;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); font-size: 1.05rem; /* >=16px: iOS no hace zoom */
  transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 104px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(154, 79, 92, .14); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.counter { font-size: .8rem; color: var(--ink-soft); text-align: right; margin-top: -.2rem; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .95rem 0; border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .label { display: block; }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: #d9cfc6; transition: background .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease);
}
.switch input:checked + span { background: var(--sage-dark); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--rose); outline-offset: 2px; }

.choice { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.choice label {
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .95rem; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); cursor: pointer; font-size: .95rem;
}
.choice input { accent-color: var(--rose); width: 18px; height: 18px; margin: 0; }
.choice label:has(input:checked) { border-color: var(--rose); background: #fbf1f0; }

/* ---------- Avisos ---------- */

.alert { padding: .9rem 1.1rem; border-radius: var(--radius-sm); font-size: .95rem; margin: 0 0 1rem; display: flex; gap: .65rem; align-items: flex-start; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: .1rem; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--cream); color: var(--ink-soft); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: .8rem 1.2rem; border-radius: 999px; font-size: .95rem;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease);
  z-index: 100; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--blush); border-top-color: var(--rose);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: rise .7s var(--ease) both; }
.rise-2 { animation-delay: .08s; }
.rise-3 { animation-delay: .16s; }
.rise-4 { animation-delay: .24s; }

/* ==========================================================================
   Página pública de la boda
   ========================================================================== */

.page { min-height: 100dvh; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; animation: fade .35s ease both; }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 22px; }
.center-screen { flex: 1; display: grid; place-items: center; padding: 48px 0; }

.hero { position: relative; }
.hero-photo {
  position: relative; height: min(62dvh, 560px); min-height: 340px; overflow: hidden;
  background: var(--blush) url("../img/default-cover.svg") center / cover no-repeat;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; animation: heroIn 1.6s var(--ease) both; }
@keyframes heroIn { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }
.hero-photo::after {
  content: ""; position: absolute; inset: auto 0 -2px; height: 50%;
  background: linear-gradient(to bottom, rgba(251, 248, 243, 0), rgba(251, 248, 243, .85) 60%, var(--ivory) 94%);
}
.hero-card { position: relative; margin-top: -92px; text-align: center; padding-bottom: 8px; z-index: 1; }
.hero-card .eyebrow { margin-bottom: .9rem; }
.date-line {
  display: inline-flex; align-items: center; gap: .8rem; margin: 1.1rem 0 .2rem;
  font-family: var(--serif); font-size: 1.35rem; font-style: italic; color: var(--ink-soft);
}
.date-line::before, .date-line::after { content: ""; width: 34px; height: 1px; background: var(--gold); opacity: .6; }
.venue { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.welcome { margin: 1.4rem auto 0; max-width: 34ch; color: var(--ink-soft); font-size: 1.05rem; white-space: pre-line; }
.home-actions { display: grid; gap: .8rem; margin: 2rem 0 1.4rem; }
.privacy-note { font-size: .8rem; color: var(--ink-soft); text-align: center; max-width: 38ch; margin: 0 auto 2.4rem; line-height: 1.5; }
.ornament { color: var(--gold); width: 58px; margin: 0 auto; opacity: .8; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .3rem;
  padding: 10px 12px; background: rgba(251, 248, 243, .92); backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; flex: 1; text-align: center; margin-right: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Subida ---------- */

.upload-body { padding-top: 12px; padding-bottom: calc(120px + var(--safe-bottom)); }
.guest-chip {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1.2rem;
}
.guest-chip .who { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--blush); color: var(--rose-dark); font-family: var(--serif); font-weight: 600; font-size: 1.3rem;
}
.guest-chip strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.picker {
  position: relative; display: grid; place-items: center; gap: .5rem; text-align: center;
  padding: 2.2rem 1.2rem; border: 2px dashed var(--blush-strong); border-radius: 24px;
  background: linear-gradient(180deg, #fffaf6, #fbf1ea); cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s var(--ease);
}
.picker:hover { border-color: var(--rose); }
.picker:active { transform: scale(.985); }
.picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.picker:focus-within { outline: 3px solid var(--rose); outline-offset: 3px; }
.picker-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--rose); box-shadow: var(--shadow); }
.picker-icon svg { width: 30px; height: 30px; }
.picker strong { font-size: 1.15rem; }
.picker.compact { padding: 1rem; grid-template-columns: auto 1fr; text-align: left; gap: .9rem; margin-top: .8rem; justify-items: start; }
.field label.h3 { font-size: 1.5rem; font-weight: 600; }
.picker.compact .picker-icon { width: 46px; height: 46px; }
.picker.compact .picker-icon svg { width: 22px; height: 22px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--cream);
  animation: rise .35s var(--ease) both;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); text-align: center; padding: 8px; font-size: .72rem; }
.thumb .placeholder svg { width: 28px; height: 28px; margin: 0 auto 4px; }
.thumb .badge {
  position: absolute; left: 6px; bottom: 6px; background: rgba(46, 38, 34, .72); color: #fff;
  font-size: .7rem; padding: 2px 7px; border-radius: 999px; display: inline-flex; align-items: center; gap: 3px;
}
.thumb .badge svg { width: 12px; height: 12px; }
.thumb .remove {
  position: absolute; top: 5px; right: 5px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .94); display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.thumb .remove svg { width: 16px; height: 16px; }
.thumb.invalid::after { content: ""; position: absolute; inset: 0; background: rgba(251, 233, 230, .72); }
.thumb .warn { position: absolute; inset: auto 6px 6px; z-index: 1; background: var(--danger); color: #fff; font-size: .68rem; padding: 3px 6px; border-radius: 8px; line-height: 1.25; }

.section-gap { margin-top: 1.6rem; }
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px 22px calc(14px + var(--safe-bottom));
  background: linear-gradient(to top, var(--ivory) 70%, rgba(251, 248, 243, 0));
}
.sticky-cta .wrap { padding: 0; }

/* ---------- Progreso ---------- */

.progress-hero { text-align: center; padding: 2rem 0 1.4rem; }
.ring { position: relative; width: 148px; height: 148px; margin: 0 auto 1.2rem; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--blush); }
.ring .bar { stroke: var(--rose); stroke-linecap: round; transition: stroke-dashoffset .4s var(--ease); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 2.4rem; font-weight: 500; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: .8rem; align-items: center;
  padding: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
}
.file-row .mini { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--cream); display: grid; place-items: center; color: var(--ink-soft); }
.file-row .mini img { width: 100%; height: 100%; object-fit: cover; }
.file-row .mini svg { width: 22px; height: 22px; }
.file-row .meta { min-width: 0; }
.file-row .name { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .status { font-size: .8rem; color: var(--ink-soft); }
.file-row .status.err { color: var(--danger); }
.file-row .bar-line { height: 5px; border-radius: 99px; background: var(--blush); margin-top: 6px; overflow: hidden; }
.file-row .bar-line i { display: block; height: 100%; width: 0; background: var(--rose); border-radius: 99px; transition: width .25s; }
.file-row .state-icon { width: 30px; height: 30px; display: grid; place-items: center; }
.file-row .state-icon svg { width: 22px; height: 22px; }
.file-row .state-icon .spinner { width: 20px; height: 20px; border-width: 2.5px; }
.file-row.done .state-icon { color: var(--ok); }
.file-row.failed .state-icon { color: var(--danger); }

/* ---------- Pantallas de estado ---------- */

.state-screen { text-align: center; max-width: 420px; margin: 0 auto; padding: 0 8px; }
.state-art {
  width: 112px; height: 112px; margin: 0 auto 1.6rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--blush); color: var(--rose-dark);
}
.state-art svg { width: 50px; height: 50px; }
.state-art.sage { background: var(--sage); color: var(--sage-dark); }
.state-screen p { color: var(--ink-soft); }
.done-art { animation: pop .7s var(--ease) both; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: none; } }

/* ---------- Galería ---------- */

.gallery-head { padding: 1rem 0 1.2rem; text-align: center; }
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 4px;
  max-width: 1200px; margin: 0 auto;
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 16px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.tile {
  position: relative; aspect-ratio: 1; overflow: hidden; border: 0; padding: 0; cursor: pointer;
  background: var(--cream); border-radius: 6px; display: block; width: 100%;
}
@media (min-width: 700px) { .tile { border-radius: 12px; } }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), opacity .4s; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.04); }
.tile .video-tile, .tile .heic-tile {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px;
  background: linear-gradient(145deg, var(--blush), var(--cream)); color: var(--rose-dark); font-size: .75rem; padding: 6px; text-align: center;
}
.tile .video-tile svg, .tile .heic-tile svg { width: 34px; height: 34px; margin: 0 auto; }
.tile .play {
  position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(46, 38, 34, .6); color: #fff; display: grid; place-items: center;
}
.tile .play svg { width: 13px; height: 13px; }
.tile .tile-check {
  position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255, 255, 255, .85); border: 2px solid #fff; display: none;
}
.load-more { display: grid; place-items: center; padding: 2rem 0 3rem; }
.empty { text-align: center; padding: 3rem 1.2rem; color: var(--ink-soft); }
.empty .state-art { width: 92px; height: 92px; }

/* ---------- Visor (lightbox) ---------- */

.viewer {
  border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  background: #14100e; color: #fff; display: none;
}
.viewer[open] { display: flex; flex-direction: column; animation: fade .2s ease; }
.viewer::backdrop { background: rgba(20, 16, 14, .96); }
.viewer-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 0; }
.viewer .icon-btn { color: #fff; }
.viewer .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.viewer-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 8px; position: relative; }
.viewer-media { width: 100%; height: 100%; display: grid; place-items: center; min-height: 0; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.viewer-stage .spinner { position: absolute; border-color: rgba(255, 255, 255, .2); border-top-color: #fff; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, .35) !important; }
.viewer-nav.prev { left: 8px; }
.viewer-nav.next { right: 8px; }
.viewer-info { padding: 14px 20px calc(18px + var(--safe-bottom)); max-width: 640px; margin: 0 auto; width: 100%; }
.viewer-info .who { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; }
.viewer-info .msg { color: rgba(255, 255, 255, .82); font-size: .95rem; margin: .3rem 0 0; white-space: pre-line; max-height: 22vh; overflow: auto; }
.viewer-info .when { color: rgba(255, 255, 255, .55); font-size: .8rem; margin-top: .4rem; }
.viewer-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.viewer-actions .btn { min-height: 42px; padding: .4rem 1rem; font-size: .9rem; }
.viewer-actions .btn-secondary { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .25); }
.viewer-actions .btn-danger { background: transparent; color: #ffb4a8; border-color: rgba(255, 180, 168, .4); }
.no-preview { text-align: center; color: rgba(255, 255, 255, .8); max-width: 300px; }
.no-preview svg { width: 56px; height: 56px; margin: 0 auto 1rem; opacity: .8; }

/* ---------- Diálogos ---------- */

.dialog {
  border: 0; border-radius: 24px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(46, 38, 34, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.dialog[open] { animation: rise .3s var(--ease); }
.dialog-body { padding: 1.6rem 1.4rem 1.2rem; }
.dialog-actions { display: flex; gap: .6rem; justify-content: flex-end; padding: 0 1.4rem 1.4rem; flex-wrap: wrap; }

/* ==========================================================================
   Panel de administración
   ========================================================================== */

.admin { background: var(--ivory); }
.admin-header {
  position: sticky; top: 0; z-index: 30; background: rgba(251, 248, 243, .94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.admin-header .inner { display: flex; align-items: center; gap: .6rem; max-width: 1180px; margin: 0 auto; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 1.45rem; font-weight: 600; flex: 1; min-width: 0; }
.brand svg { width: 30px; height: 30px; color: var(--rose); flex: none; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; gap: .2rem; align-items: center; flex: none; }
@media (max-width: 600px) {
  .brand span:last-child { display: none; }
  .nav-links a:not(.icon-btn) { padding: .5rem .65rem; font-size: .88rem; }
}
.nav-links a { text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .92rem; padding: .5rem .8rem; border-radius: 999px; }
.nav-links a[aria-current="page"], .nav-links a:hover { color: var(--ink); background: var(--cream); }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .4rem 0 1.4rem; }
.page-head .h2 { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .92rem; margin-bottom: .6rem; }
.back-link svg { width: 18px; height: 18px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.3rem; }
@media (min-width: 700px) { .card-pad { padding: 1.7rem; } }
.card + .card { margin-top: 1rem; }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--blush), transparent 60%), var(--ivory); }
.login-card { width: min(420px, 100%); }
.login-card .brand { justify-content: center; margin-bottom: 1.4rem; font-size: 1.7rem; }

.credits-menu { position: relative; margin-right: .3rem; }
.credits-pill {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
  min-height: 38px; padding: .3rem .8rem .3rem .6rem; border-radius: 999px;
  background: #fbf1f0; border: 1px solid var(--blush-strong); color: var(--rose-dark); font-size: .9rem;
}
.credits-pill::-webkit-details-marker { display: none; }
.credits-pill svg { width: 18px; height: 18px; }
.credits-pill strong { font-size: .98rem; }
.credits-menu.empty .credits-pill { background: var(--danger-bg); border-color: #efc9c3; color: var(--danger); }
.credits-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 250px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: .9rem 1rem; animation: rise .2s var(--ease);
}
.credits-pop .eyebrow { margin-bottom: .5rem; font-size: .7rem; }
.credits-pop ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .35rem; }
.credits-pop li { display: grid; grid-template-columns: 18px 1fr auto; gap: .5rem; align-items: center; font-size: .92rem; }
.nav-links .credits-pop a.link-btn { padding: .2rem 0; color: var(--rose); text-decoration: underline; background: none; font-size: .88rem; }
.credits-pop li svg { width: 16px; height: 16px; color: var(--rose); }
@media (max-width: 600px) {
  .credits-pill .pill-text { display: none; }
  .credits-pill { padding: .3rem .6rem; }
  .credits-pop { right: -80px; }
}
.wedding-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.wcard { overflow: hidden; display: flex; flex-direction: column; transition: transform .2s var(--ease), box-shadow .2s; }
.wcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.wcard-cover { aspect-ratio: 16 / 9; background: var(--blush) url("../img/default-cover.svg") center / cover; position: relative; }
.wcard-cover img { width: 100%; height: 100%; object-fit: cover; }
.wcard-cover .pill { position: absolute; top: 12px; left: 12px; }
.wcard-body { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.wcard-body .h3 { margin: 0; }
.wcard-stats { display: flex; gap: 1rem; color: var(--ink-soft); font-size: .88rem; margin: .5rem 0 1rem; }
.wcard-stats span { display: inline-flex; align-items: center; gap: .3rem; }
.wcard-stats svg { width: 16px; height: 16px; }
.wcard-actions { display: flex; gap: .5rem; margin-top: auto; }
.wcard-actions .btn { flex: 1; }
.new-card {
  display: grid; place-items: center; align-content: center; gap: .6rem; min-height: 260px; text-align: center;
  border: 2px dashed var(--blush-strong); border-radius: var(--radius); background: transparent; color: var(--ink-soft);
  text-decoration: none; cursor: pointer; padding: 1.4rem; transition: border-color .2s, background .2s;
}
.new-card:hover { border-color: var(--rose); background: #fff9f6; color: var(--ink); }
.new-card .picker-icon { margin: 0 auto; }

.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.open { color: var(--ok); }
.pill.pending { color: var(--gold); }
.pill.closed, .pill.closed_manual { color: var(--ink-soft); }
.pill.expired { color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 1.2rem; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.stat .num { font-family: var(--serif); font-size: 2rem; font-weight: 500; line-height: 1.1; }
.stat .lbl { font-size: .82rem; color: var(--ink-soft); }

.tabs { display: flex; gap: .3rem; overflow-x: auto; margin: 0 -16px 1.2rem; padding: 0 16px 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { text-decoration: none; flex: none; border: 0; background: transparent; padding: .65rem 1.05rem; border-radius: 999px; font-weight: 600; color: var(--ink-soft); cursor: pointer; min-height: 44px; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.tab:not([aria-selected="true"]):hover { background: var(--cream); color: var(--ink); }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .select { width: auto; min-width: 200px; min-height: 44px; padding: .5rem .9rem; font-size: .95rem; }
.toolbar .grow { flex: 1; }

.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 700px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.form-section { margin-bottom: 1rem; }
.form-section-title { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; }
.form-section-title .num { width: 30px; height: 30px; border-radius: 50%; background: var(--blush); color: var(--rose-dark); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .5rem; }
.form-section-title .num { font-family: var(--sans); font-size: .95rem; }
.date-option { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.date-option:last-child { border-bottom: 0; }
.date-option .input { margin-top: .2rem; max-width: 320px; }

.cover-edit { display: grid; gap: 1rem; align-items: center; }
@media (min-width: 600px) { .cover-edit { grid-template-columns: 220px 1fr; } }
.cover-preview { aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--blush) url("../img/default-cover.svg") center / cover; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }

.qr-layout { display: grid; gap: 1.4rem; align-items: center; }
.qr-layout > * { min-width: 0; }
@media (min-width: 760px) { .qr-layout { grid-template-columns: 300px 1fr; } }
.qr-box { background: #fff; border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); max-width: 300px; margin: 0 auto; width: 100%; }
.qr-box img { width: 100%; height: auto; image-rendering: pixelated; }
.link-box { display: flex; gap: .5rem; align-items: center; background: var(--cream); padding: .55rem .55rem .55rem 1rem; border-radius: 999px; margin: .8rem 0 1.2rem; }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }

.messages { display: grid; gap: 12px; }
@media (min-width: 760px) { .messages { grid-template-columns: 1fr 1fr; } }
.message-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; position: relative; }
.message-card::before { content: "“"; position: absolute; top: -.1rem; right: 1rem; font-family: var(--serif); font-size: 4.4rem; color: var(--blush-strong); line-height: 1; }
.message-card p { margin: 0 0 .7rem; white-space: pre-line; font-family: var(--serif); font-size: 1.22rem; line-height: 1.4; }
.message-card .by { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .75rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.table td .btn { min-height: 36px; padding: .3rem .8rem; font-size: .85rem; }
.meter { height: 10px; background: var(--cream); border-radius: 99px; overflow: hidden; margin: .5rem 0 .3rem; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--sage-dark), var(--rose)); border-radius: 99px; }

.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 600px) { .admin-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } }
@media (min-width: 1000px) { .admin-grid { grid-template-columns: repeat(6, 1fr); } }
.admin-grid .tile-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; color: #fff; font-size: .72rem; text-align: left;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Tarjeta imprimible del QR ---------- */

.print-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: var(--cream); }
.print-card {
  width: 105mm; min-height: 148mm; background: var(--ivory); border-radius: 6px; box-shadow: var(--shadow-lg);
  padding: 12mm 10mm; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4mm;
  border: 1px solid var(--line); position: relative;
}
.print-card::before { content: ""; position: absolute; inset: 4mm; border: .6px solid var(--gold); opacity: .5; border-radius: 3px; pointer-events: none; }
.print-card .display { font-size: 30pt; }
.print-card .date-line { font-size: 14pt; margin: 0; }
.print-card .qr { width: 52mm; height: 52mm; background: #fff; padding: 2mm; }
.print-card .qr img { width: 100%; height: 100%; }
.print-card .call { font-family: var(--serif); font-size: 15pt; font-style: italic; margin: 0; line-height: 1.25; }
.print-card .sub { font-size: 8.5pt; color: var(--ink-soft); margin: 0; letter-spacing: .02em; }
.print-actions { display: flex; gap: .6rem; margin-top: 1.4rem; flex-wrap: wrap; justify-content: center; }
@media print {
  @page { size: A6; margin: 0; }
  body, .print-page { background: #fff; padding: 0; min-height: 0; }
  .print-card { box-shadow: none; border: 0; border-radius: 0; width: 105mm; height: 148mm; }
  .print-actions { display: none; }
}

/* ---------- Escritorio: la página de invitados respira más ---------- */

@media (min-width: 900px) {
  .hero-photo { height: 64vh; }
  .hero-card { margin-top: -120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
