/* ==========================================================================
   Nuestro Adviento · Estética "Bento Grid Cozy Latte"
   Paleta cálida editorial + tipografía Fraunces & Plus Jakarta Sans
   ========================================================================== */

:root {
  --bg-sand: #F5EFE6;
  --surface-latte: #E8DFCA;
  --surface-latte-hover: #E0D5BC;
  --surface-cream: #FAF6F0;
  --accent-sage: #4F6F52;
  --accent-sage-soft: #E2E9E1;
  --accent-cherry: #9E2A2B;
  --accent-cherry-soft: #F3E3E3;
  --accent-ochre: #D4A373;
  --accent-ochre-soft: #F3E8DC;
  --ink-espresso: #2C221E;
  --ink-mocha: #63534B;
  --ink-muted: #86766D;
  --border-warm: rgba(44, 34, 30, 0.09);
  --border-strong: rgba(44, 34, 30, 0.18);

  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-card: 1.25rem; /* 20px exacto */
  --radius-modal: 1.5rem;
  --radius-pill: 999px;
  --radius-control: 0.875rem;

  --shadow-hover: 0 14px 30px -10px rgba(44, 34, 30, 0.12), 0 4px 10px -4px rgba(44, 34, 30, 0.06);
  --shadow-modal: 0 28px 60px -16px rgba(44, 34, 30, 0.28);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background-color: var(--bg-sand);
  color: var(--ink-espresso);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-sand);
  color: var(--ink-espresso);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.modal-open {
  overflow: hidden;
}

/* Textura sutil de papel algodón sin coste de red */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Barra superior de administración */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
  padding: 0.625rem 1.25rem;
}

.admin-bar__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-bar__status {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.admin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-ochre);
}

.admin-counter {
  background-color: rgba(250, 246, 240, 0.14);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
}

/* Contenedor principal */
.page-shell {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.75rem 1rem 4rem;
}

@media (min-width: 640px) {
  .page-shell {
    padding: 2.5rem 1.75rem 4.5rem;
  }
}

@media (min-width: 960px) {
  .page-shell {
    padding: 3rem 2rem 5rem;
  }
}

/* Cabecera editorial */
.hero-header {
  margin-bottom: 2rem;
}

.hero-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.season-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-mocha);
}

.inline-doodle {
  width: 17px;
  height: 17px;
  color: var(--accent-cherry);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background-color: var(--surface-cream);
  color: var(--ink-espresso);
  font-size: 0.8125rem;
  font-weight: 600;
}

.hero-header__main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: end;
}

@media (min-width: 820px) {
  .hero-header__main {
    grid-template-columns: 1.45fr 0.85fr;
    gap: 2rem;
  }
}

.hero-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.35rem, 6vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink-espresso);
  cursor: pointer;
  user-select: none;
  display: inline-block;
}

.hero-subtitle {
  margin: 0.85rem 0 0;
  max-width: 56ch;
  font-size: clamp(0.975rem, 1.8vw, 1.075rem);
  line-height: 1.6;
  color: var(--ink-mocha);
}

.hero-progress-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--surface-cream);
  border-radius: var(--radius-card);
}

.hero-progress-card__illustration {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 0.9rem;
  background-color: var(--surface-latte);
  color: var(--ink-espresso);
  display: grid;
  place-items: center;
}

.hero-progress-card__illustration svg {
  width: 32px;
  height: 32px;
}

.hero-progress-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hero-progress-card__count {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-espresso);
}

.hero-progress-card__hint {
  font-size: 0.85rem;
  color: var(--ink-mocha);
}

/* ==========================================================================
   CUADRÍCULA BENTO ASIMÉTRICA (24 DÍAS, CERO HUECOS EN TODOS LOS TAMAÑOS)
   ========================================================================== */

.bento-grid {
  display: grid;
  /* Móvil: rejilla base de 6 fracciones para combinar anchos 100%, 67%/33%, 50%/50% y 33%/33%/33% */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(126px, auto);
  gap: 0.75rem;
}

/* Móvil (< 640px): distribución Bento asimétrica exacta sin huecos */
.bento-card {
  grid-column: span 3;
}
.bento-card[data-day="1"],
.bento-card[data-day="24"] {
  grid-column: span 6;
  min-height: 148px;
}
.bento-card[data-day="6"],
.bento-card[data-day="12"],
.bento-card[data-day="18"] {
  grid-column: span 4;
}
.bento-card[data-day="7"],
.bento-card[data-day="8"],
.bento-card[data-day="9"],
.bento-card[data-day="10"],
.bento-card[data-day="11"],
.bento-card[data-day="15"],
.bento-card[data-day="16"],
.bento-card[data-day="17"],
.bento-card[data-day="19"] {
  grid-column: span 2;
}

/* Tablet (640px – 959px): rejilla de 4 columnas exactas (9 filas × 4 cols = 36 celdas) */
@media (min-width: 640px) and (max-width: 959px) {
  .bento-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(146px, auto);
    gap: 0.95rem;
  }
  .bento-card,
  .bento-card[data-day="7"],
  .bento-card[data-day="8"],
  .bento-card[data-day="9"],
  .bento-card[data-day="10"],
  .bento-card[data-day="11"],
  .bento-card[data-day="15"],
  .bento-card[data-day="16"],
  .bento-card[data-day="17"],
  .bento-card[data-day="19"] {
    grid-column: span 1;
    grid-row: span 1;
  }
  .bento-card[data-day="1"] {
    grid-column: span 2;
    grid-row: span 2;
  }
  .bento-card[data-day="6"],
  .bento-card[data-day="12"],
  .bento-card[data-day="18"] {
    grid-column: span 3;
    grid-row: span 1;
  }
  .bento-card[data-day="24"] {
    grid-column: span 4;
    grid-row: span 1;
    min-height: 168px;
  }
}

/* Escritorio (>= 960px): rejilla de 6 columnas exactas (6 filas × 6 cols = 36 celdas) */
@media (min-width: 960px) {
  .bento-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: minmax(154px, auto);
    gap: 1.05rem;
  }
  .bento-card,
  .bento-card[data-day="7"],
  .bento-card[data-day="8"],
  .bento-card[data-day="9"],
  .bento-card[data-day="10"],
  .bento-card[data-day="11"],
  .bento-card[data-day="15"],
  .bento-card[data-day="16"],
  .bento-card[data-day="17"],
  .bento-card[data-day="19"] {
    grid-column: span 1;
    grid-row: span 1;
  }
  .bento-card[data-day="1"] {
    grid-column: span 2;
    grid-row: span 2;
  }
  .bento-card[data-day="6"] {
    grid-column: span 2;
    grid-row: span 1;
  }
  .bento-card[data-day="12"] {
    grid-column: span 2;
    grid-row: span 2;
  }
  .bento-card[data-day="18"] {
    grid-column: span 2;
    grid-row: span 2;
  }
  .bento-card[data-day="24"] {
    grid-column: span 3;
    grid-row: span 1;
  }
}

/* Tarjeta individual Bento */
.bento-card {
  position: relative;
  appearance: none;
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-card);
  background-color: var(--surface-latte);
  color: var(--ink-espresso);
  padding: 1rem 1.05rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition:
    transform 0.28s var(--ease-out),
    box-shadow 0.28s var(--ease-out),
    background-color 0.22s ease,
    border-color 0.22s ease;
  font-family: inherit;
}

/* Alternancia sutil de tonos cálidos en días destacados */
.bento-card--cream {
  background-color: var(--surface-cream);
}

.bento-card--special {
  background-color: var(--surface-cream);
  border-color: rgba(158, 42, 43, 0.16);
}

.bento-card[data-day="24"] {
  background-color: #EFE5D4;
  border-color: rgba(158, 42, 43, 0.26);
}

/* Estados de apertura */
.bento-card.is-today {
  border-color: var(--accent-cherry);
  box-shadow: 0 0 0 2px rgba(158, 42, 43, 0.15);
}

.bento-card.is-opened {
  background-color: var(--surface-cream);
}

.bento-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.bento-card:active {
  transform: translateY(0) scale(0.985);
}

.bento-card:focus-visible {
  outline: 2px solid var(--accent-cherry);
  outline-offset: 3px;
}

/* Cabecera interna de cada tarjeta */
.bento-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  position: relative;
  z-index: 2;
}

.bento-card__number {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink-espresso);
}

.bento-card--special .bento-card__number {
  font-size: clamp(2.15rem, 3.8vw, 3rem);
}

.bento-card[data-day="24"] .bento-card__number {
  color: var(--accent-cherry);
}

/* Indicador superior derecho (candado / abierto / admin) */
.bento-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.22rem 0.5rem;
  border-radius: var(--radius-pill);
  color: var(--ink-mocha);
  background-color: rgba(250, 246, 240, 0.72);
  flex-shrink: 0;
}

.bento-card__badge svg {
  width: 13px;
  height: 13px;
}

.bento-card__badge--ready {
  background-color: var(--accent-cherry-soft);
  color: var(--accent-cherry);
}

.bento-card__badge--opened {
  background-color: var(--accent-sage-soft);
  color: var(--accent-sage);
}

.bento-card__badge--admin-ok {
  background-color: var(--accent-sage-soft);
  color: var(--accent-sage);
}

.bento-card__badge--admin-empty {
  background-color: rgba(44, 34, 30, 0.06);
  color: var(--ink-mocha);
}

/* Ilustración minimalista lineal de papelería */
.bento-card__doodle {
  position: absolute;
  right: 0.75rem;
  bottom: 0.65rem;
  width: 44px;
  height: 44px;
  color: var(--ink-espresso);
  opacity: 0.22;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.35s ease;
}

.bento-card--special .bento-card__doodle {
  width: 68px;
  height: 68px;
  right: 1rem;
  bottom: 0.8rem;
  opacity: 0.28;
}

.bento-card[data-day="6"] .bento-card__doodle,
.bento-card[data-day="24"] .bento-card__doodle {
  color: var(--accent-cherry);
}

.bento-card[data-day="12"] .bento-card__doodle {
  color: var(--accent-sage);
}

.bento-card:hover .bento-card__doodle {
  transform: scale(1.07) rotate(-3deg);
  opacity: 0.38;
}

/* Pie de cada tarjeta */
.bento-card__bottom {
  position: relative;
  z-index: 2;
  margin-top: 0.85rem;
  padding-right: 2.2rem;
}

.bento-card__caption {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-mocha);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bento-card--special .bento-card__caption {
  font-size: 0.9rem;
  color: var(--ink-espresso);
}

.bento-card__admin-pills {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.mini-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.42rem;
  border-radius: 6px;
  background-color: rgba(44, 34, 30, 0.07);
  color: var(--ink-espresso);
}

/* Vibración (shake) cuando pulsa un día futuro bloqueado */
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-6px) rotate(-1deg); }
  36% { transform: translateX(6px) rotate(1deg); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(4px); }
}

.bento-card.is-shaking {
  animation: cardShake 0.46s ease;
  border-color: var(--accent-cherry);
}

/* Pie de página */
.site-footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--ink-mocha);
}

.site-footer__ornament {
  width: 120px;
  margin: 0 auto 0.5rem;
  color: var(--accent-ochre);
}

.site-footer__text {
  margin: 0;
  font-size: 0.875rem;
}

/* ==========================================================================
   MODALES (LECTURA DEL DÍA, LOGIN Y EDITOR)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(44, 34, 30, 0.48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: backdropFade 0.2s ease;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1.25rem;
  }
}

@keyframes backdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-card {
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  background-color: var(--surface-cream);
  color: var(--ink-espresso);
  border-radius: var(--radius-modal) var(--radius-modal) 0 0;
  padding: 1.35rem 1.25rem calc(1.75rem + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-modal);
  animation: cardRise 0.28s var(--ease-out);
}

@media (min-width: 640px) {
  .modal-card {
    border-radius: var(--radius-modal);
    padding: 1.75rem 2rem 2rem;
    max-height: 88dvh;
  }
}

.modal-card--day {
  max-width: 620px;
}

.modal-card--narrow {
  max-width: 420px;
}

.modal-card--editor {
  max-width: 640px;
}

.modal-card__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-card__top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.day-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  background-color: var(--surface-latte);
  color: var(--ink-espresso);
  font-size: 0.8125rem;
  font-weight: 600;
}

.icon-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background-color: var(--surface-latte);
  color: var(--ink-espresso);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.icon-close-btn:hover {
  background-color: var(--surface-latte-hover);
}

.icon-close-btn svg {
  width: 18px;
  height: 18px;
}

.modal-heading {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.15;
}

.modal-lead {
  margin: 0 0 1.25rem;
  color: var(--ink-mocha);
  font-size: 0.9375rem;
}

/* ==========================================================================
   INTERIOR DEL MODAL DE DÍA (CARTA, FOTO, AUDIO, VALE, RASCA Y GANA)
   ========================================================================== */

.day-view__header {
  margin-bottom: 1.35rem;
}

.day-view__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.14;
  color: var(--ink-espresso);
}

.day-view__photo-frame {
  margin: 0 0 1.35rem;
  padding: 0.65rem 0.65rem 0.85rem;
  background-color: #FFFFFF;
  border: 1px solid var(--border-warm);
  border-radius: 1rem;
}

.day-view__photo {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 0.65rem;
  cursor: zoom-in;
  background-color: var(--surface-latte);
}

.day-view__photo-hint {
  display: block;
  margin-top: 0.45rem;
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.day-view__letter {
  background-color: var(--bg-sand);
  border-radius: 1.1rem;
  padding: 1.25rem 1.3rem;
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.72;
  color: var(--ink-espresso);
}

.day-view__letter p {
  margin: 0 0 0.9rem;
}

.day-view__letter p:last-child {
  margin-bottom: 0;
}

/* Reproductor de audio cálido personalizado */
.cozy-audio-card {
  background-color: var(--surface-latte);
  border-radius: 1.1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}

.cozy-audio-card__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-espresso);
  margin-bottom: 0.65rem;
}

.cozy-audio-card__label svg {
  width: 16px;
  height: 16px;
  color: var(--accent-cherry);
}

.cozy-audio-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.audio-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.audio-play-btn:hover {
  background-color: var(--accent-cherry);
}

.audio-play-btn:active {
  transform: scale(0.95);
}

.audio-play-btn svg {
  width: 18px;
  height: 18px;
}

.audio-timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audio-range {
  width: 100%;
  accent-color: var(--accent-cherry);
  cursor: pointer;
  height: 6px;
}

.audio-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-mocha);
  font-variant-numeric: tabular-nums;
}

/* Vale canjeable de papelería */
.voucher-ticket {
  position: relative;
  background-color: var(--surface-latte);
  border: 1.5px dashed var(--accent-ochre);
  border-radius: 1.15rem;
  padding: 1.25rem 1.3rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.voucher-ticket__kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cherry);
  background-color: var(--surface-cream);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.6rem;
}

.voucher-ticket__title {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink-espresso);
}

.voucher-ticket__detail {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ink-mocha);
}

.voucher-ticket.is-redeemed {
  border-style: solid;
  border-color: var(--accent-sage);
  background-color: var(--accent-sage-soft);
}

/* Tarjeta Rasca y Gana */
.scratch-box {
  background-color: var(--bg-sand);
  border-radius: 1.15rem;
  padding: 1.1rem;
  margin-bottom: 0.5rem;
}

.scratch-box__hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-mocha);
  text-align: center;
}

.scratch-stage {
  position: relative;
  min-height: 148px;
  border-radius: 0.95rem;
  background-color: var(--surface-cream);
  border: 1px solid var(--border-warm);
  display: grid;
  place-items: center;
  padding: 1.25rem;
  overflow: hidden;
  user-select: none;
}

.scratch-secret-text {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-espresso);
  text-align: center;
  line-height: 1.4;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.55s ease;
}

.scratch-canvas.is-cleared {
  opacity: 0;
  pointer-events: none;
}

.day-empty-note {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-mocha);
}

/* ==========================================================================
   FORMULARIOS Y CONTROLES DEL PANEL ADMIN
   ========================================================================== */

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.field-group--tight {
  margin-top: 0.5rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-espresso);
}

.field-sublabel {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-mocha);
}

.field-input,
.field-textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background-color: #FFFFFF;
  color: var(--ink-espresso);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.72rem 0.9rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-input--pin {
  text-align: center;
  font-size: 1.25rem;
  letter-spacing: 0.18em;
}

.field-textarea {
  resize: vertical;
  line-height: 1.55;
}

.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--accent-cherry);
  box-shadow: 0 0 0 3px rgba(158, 42, 43, 0.12);
}

/* Selector de iconos lineales */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (max-width: 460px) {
  .icon-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.icon-choice {
  height: 46px;
  border-radius: 0.75rem;
  border: 1px solid var(--border-warm);
  background-color: var(--bg-sand);
  color: var(--ink-espresso);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.icon-choice svg {
  width: 22px;
  height: 22px;
}

.icon-choice.is-selected {
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
  border-color: var(--ink-espresso);
}

/* Cajas multimedia del editor */
.media-box {
  background-color: var(--bg-sand);
  border-radius: 1.05rem;
  padding: 0.95rem 1rem;
}

.media-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-danger {
  border: none;
  background: none;
  color: var(--accent-cherry);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.upload-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 0.85rem;
  background-color: var(--surface-cream);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.upload-dropzone:hover {
  border-color: var(--accent-cherry);
}

.upload-dropzone svg {
  width: 26px;
  height: 26px;
  color: var(--ink-mocha);
}

.upload-dropzone span {
  font-size: 0.875rem;
  font-weight: 600;
}

.upload-dropzone small {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.media-preview-wrap {
  margin-top: 0.65rem;
}

.media-preview-img {
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  border-radius: 0.75rem;
  display: block;
}

/* Botones de audio (subir + grabar micrófono) */
.audio-source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

@media (max-width: 460px) {
  .audio-source-grid {
    grid-template-columns: 1fr;
  }
}

.upload-compact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 0.9rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border-strong);
  background-color: var(--surface-cream);
  color: var(--ink-espresso);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.upload-compact-btn svg {
  width: 18px;
  height: 18px;
}

.rec-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-cherry);
}

.recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.8rem;
  background-color: var(--accent-cherry-soft);
  color: var(--accent-cherry);
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.4rem;
}

.recording-bar__pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-cherry);
  animation: pulseRec 1s infinite ease-in-out;
}

@keyframes pulseRec {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.45; }
}

.audio-editor-preview {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.audio-editor-preview__name {
  font-size: 0.8rem;
  color: var(--accent-sage);
  font-weight: 600;
}

.audio-editor-preview audio {
  width: 100%;
  height: 38px;
}

/* Selector segmentado (Ninguna / Vale / Rasca / Ambos) */
.segmented-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

@media (min-width: 520px) {
  .segmented-tabs {
    grid-template-columns: repeat(4, 1fr);
  }
}

.seg-tab {
  padding: 0.55rem 0.5rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border-warm);
  background-color: var(--surface-cream);
  color: var(--ink-mocha);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.seg-tab.is-active {
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
  border-color: var(--ink-espresso);
}

.special-subfields {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-warm);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Progreso de subida */
.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.upload-progress__bar {
  height: 8px;
  background-color: var(--surface-latte);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.upload-progress__fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-sage);
  transition: width 0.15s ease;
}

.upload-progress__label {
  font-size: 0.8rem;
  color: var(--ink-mocha);
}

.form-error {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  background-color: var(--accent-cherry-soft);
  color: var(--accent-cherry);
  font-size: 0.85rem;
  font-weight: 600;
}

.editor-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

/* Botones */
.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.78rem 1.3rem;
  font-family: var(--font-sans);
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform 0.16s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
}

.btn--primary:hover:not(:disabled) {
  background-color: #3D302A;
}

.btn--secondary {
  background-color: var(--surface-latte);
  color: var(--ink-espresso);
}

.btn--secondary:hover:not(:disabled) {
  background-color: var(--surface-latte-hover);
}

.btn--cherry {
  background-color: var(--accent-cherry);
  color: var(--surface-cream);
}

.btn--sage {
  background-color: var(--accent-sage);
  color: var(--surface-cream);
}

.btn--ghost {
  background-color: rgba(250, 246, 240, 0.14);
  color: var(--surface-cream);
}

.btn--sm {
  padding: 0.42rem 0.9rem;
  font-size: 0.8125rem;
}

.btn--full {
  width: 100%;
}

/* Lightbox de foto */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background-color: rgba(28, 21, 18, 0.92);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.lightbox__img {
  max-width: 96vw;
  max-height: 88dvh;
  object-fit: contain;
  border-radius: 0.75rem;
}

.lightbox__close {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
}

/* Lienzo de confeti */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
}

/* Toasts flotantes */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(92vw, 440px);
  pointer-events: none;
}

.toast {
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
  padding: 0.8rem 1.15rem;
  border-radius: 1rem;
  font-size: 0.885rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-modal);
  animation: cardRise 0.25s var(--ease-out);
}

/* Banner discreto inferior de instalación PWA en móvil */
.pwa-banner {
  position: fixed;
  left: 0.85rem;
  right: 0.85rem;
  bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  max-width: 520px;
  margin: 0 auto;
  background-color: var(--ink-espresso);
  color: var(--surface-cream);
  border-radius: 1.15rem;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-modal);
}

.pwa-banner__content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pwa-banner__icon {
  width: 36px;
  height: 36px;
  border-radius: 0.7rem;
  background-color: rgba(250, 246, 240, 0.12);
  color: var(--accent-ochre);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.pwa-banner__icon svg {
  width: 20px;
  height: 20px;
}

.pwa-banner__text strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}

.pwa-banner__text p {
  margin: 0.12rem 0 0;
  font-size: 0.78rem;
  color: var(--surface-latte);
}

.pwa-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pwa-banner__close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--surface-latte);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.pwa-banner__close svg {
  width: 16px;
  height: 16px;
}

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