:root {
  --bg: #f8f5ef;
  --surface: #ffffff;
  --surface-2: #f2ede4;
  --ink: #1f2a24;
  --ink-2: #5b655f;
  --line: #e4ddd0;
  --accent: #3f5e4c;
  --accent-ink: #ffffff;
  --accent-soft: #e3ebe5;
  --gold: #a8844f;
  --danger: #a33a32;
  --danger-soft: #f6e3e1;
  --ok: #2f6b45;
  --ok-soft: #e2efe6;
  --warn-soft: #f7edd9;
  --shadow: 0 1px 2px rgba(31, 42, 36, .06), 0 8px 24px rgba(31, 42, 36, .07);
  --radius: 16px;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141815; --surface: #1d221f; --surface-2: #252b27; --ink: #ecebe6; --ink-2: #a7aea9;
    --line: #333b36; --accent: #8fb89e; --accent-ink: #10150f; --accent-soft: #24342b; --gold: #d0ad78;
    --danger: #e3837a; --danger-soft: #3a2422; --ok: #8fcfa2; --ok-soft: #1f3326; --warn-soft: #3a3120;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--sans); min-height: 100dvh;
}
img, video { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* Layout */
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.h-sm { font-size: 20px !important; }
.center { text-align: center; }

/* Hero */
.hero { text-align: center; padding: 40px 0 28px; }
.eyebrow { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.hero h1 { font-size: clamp(34px, 9vw, 52px); margin-top: 10px; }
.hero .date { margin-top: 8px; color: var(--ink-2); font-family: var(--serif); font-style: italic; font-size: 18px; }
.ornament { display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--gold); margin-top: 16px; }
.ornament::before, .ornament::after { content: ""; height: 1px; width: 48px; background: currentColor; opacity: .5; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2 { font-size: 24px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }

/* Forms */
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=email], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 14px; min-height: 48px; transition: border-color .15s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px/1 var(--sans); padding: 0 18px; min-height: 44px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  text-decoration: none; transition: transform .06s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-ok { color: var(--ok); }
.btn-ok:hover { border-color: var(--ok); }
.btn-lg { min-height: 56px; font-size: 17px; padding: 0 24px; width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Upload list */
.uploads { list-style: none; margin: 0; padding: 0; }
.upload { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.upload:first-child { border-top: 0; }
.upload .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.upload .thumb svg { width: 22px; height: 22px; }
.upload .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload .status { font-size: 13px; color: var(--ink-2); }
.upload.done .status { color: var(--ok); }
.upload.error .status { color: var(--danger); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s; }
.upload.done .progress > i { background: var(--ok); }

.banner { padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.banner-warn { background: var(--warn-soft); }
.banner-ok { background: var(--ok-soft); color: var(--ok); }
.banner-error { background: var(--danger-soft); color: var(--danger); }

details.more summary { cursor: pointer; color: var(--ink-2); font-size: 14px; padding: 8px 0; }

/* Toast */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* Panel */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap-wide { display: flex; align-items: center; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.topbar h1 { font-size: 24px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 12px 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { font: 600 14px var(--sans); background: none; border: 0; padding: 10px 14px; border-radius: 999px; color: var(--ink-2); cursor: pointer; white-space: nowrap; min-height: 40px; }
.tab[aria-selected=true] { background: var(--ink); color: var(--bg); }
.tab .count { display: inline-block; min-width: 22px; padding: 1px 6px; margin-left: 4px; border-radius: 99px; background: var(--surface-2); color: var(--ink); font-size: 12px; }
.tab[aria-selected=true] .count { background: color-mix(in srgb, var(--bg) 25%, transparent); color: inherit; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; } }
.tile { container-type: inline-size; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile.selected { outline: 3px solid var(--accent); outline-offset: -1px; }
.tile .media { position: relative; aspect-ratio: 1; overflow: hidden; flex: none; background: var(--surface-2); cursor: zoom-in; border: 0; padding: 0; display: block; width: 100%; }
.tile .media img, .tile .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .media .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 13px; }
.tile .badge { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 99px; display: inline-flex; gap: 4px; align-items: center; }
.tile .badge svg { width: 14px; height: 14px; }
.tile .badge.warn { background: var(--danger); }
.tile .pick { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; accent-color: var(--accent); cursor: pointer; }
.tile .meta { padding: 10px 12px 0; font-size: 13px; }
.tile .meta span { display: block; }
.tile .meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .actions { display: flex; gap: 6px; padding: 8px 12px 12px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.tile .actions .btn { flex: 1 1 0; padding: 0 8px; min-width: 0; }
.tile .actions .btn-icon { flex: 0 0 40px; }
.tile .actions select { order: -1; flex: 1 1 100%; min-height: 38px; padding: 4px 10px; font-size: 14px; border-radius: 10px; }

.bulkbar { position: sticky; bottom: 16px; z-index: 20; margin: 16px auto 0; width: fit-content; max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 8px 8px 18px; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow); flex-wrap: wrap; justify-content: center; }
.bulkbar .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.bulkbar select { min-height: 40px; width: auto; padding: 4px 10px; border-radius: 999px; background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.bulkbar select option { color: var(--ink); background: var(--surface); }

.moment-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.moment-title h2 { font-size: 26px; }

.empty { text-align: center; padding: 64px 16px; color: var(--ink-2); }
.empty svg { width: 44px; height: 44px; color: var(--gold); margin: 0 auto 12px; }
.empty h2 { color: var(--ink); font-size: 24px; margin-bottom: 6px; }

.requests { display: grid; gap: 12px; }
.request.resolved { opacity: .6; }

/* Dialog / lightbox */
dialog { border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); max-width: min(92vw, 480px); }
dialog::backdrop { background: rgba(10, 14, 12, .6); }
dialog .dialog-body { padding: 24px; }
dialog.lightbox { max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; border-radius: 0; background: #0c0f0d; color: #fff; }
.lightbox .lb-stage { position: absolute; inset: 56px 0 120px; display: grid; place-items: center; padding: 0 56px; }
.lightbox .lb-stage img, .lightbox .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lb-top { position: absolute; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.lightbox .lb-bottom { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px 16px 20px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lightbox .btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); }
.lightbox .btn.on { background: #fff; color: #0c0f0d; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .nav.prev { left: 8px; } .lightbox .nav.next { right: 8px; }
.qr-box { background: #fff; border-radius: 12px; padding: 12px; width: 240px; margin: 0 auto; }
.qr-box svg { display: block; width: 100%; height: auto; }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 6px 6px 6px 12px; }
.linkbox code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }

.legal h2 { font-size: 22px; margin-top: 24px; }
.legal p, .legal li { color: var(--ink-2); }

footer.foot { text-align: center; padding: 32px 16px 40px; color: var(--ink-2); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
}
.row-center { justify-content: center; }

@container (max-width: 230px) { .tile .actions .lbl { display: none; } }

.lang-select { width: auto; min-height: 36px; padding: 4px 28px 4px 10px; font-size: 13px; border-radius: 999px; background: var(--surface); }
footer.foot .lang-select { margin-left: 4px; vertical-align: middle; }

/* Administración */
.wrap-admin { max-width: 880px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi.warn { background: var(--danger-soft); color: var(--danger); }
.kpi-value { font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--ink-2); }
.kpi.warn .kpi-label { color: inherit; }
.event-list { display: grid; gap: 16px; }
.event-card h3 { font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--ink); }
.chip.zero { background: var(--surface-2); color: var(--ink-2); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
