/* ==========================================================================
   Gift Cards — Atelier de Flores
   Sistema de diseño: marfil cálido, verde eucalipto, rosa antiguo y dorado.
   Tipografías: Cormorant Garamond (títulos) + Jost (texto). Sin recursos externos.
   ========================================================================== */

@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-latin-500-normal.efeea72c7a42.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/cormorant-garamond-latin-600-normal.bf1e09fb81d7.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-latin-500-italic.9b8a16c9964e.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/jost-latin-400-normal.3c986c6628b4.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/jost-latin-500-normal.a3c2438bfe16.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/jost-latin-600-normal.b6346d671c34.woff2") format("woff2"); }

:root {
  /* Valores por defecto; tema.css los reemplaza con los colores del comercio */
  --c-primary: #33493D;
  --c-primary-ink: #FFFFFF;
  --c-primary-strong: #2A3C32;
  --c-primary-soft: #EAEDE6;
  --c-primary-line: #BFC8BE;
  --c-accent: #B7745F;
  --c-accent-ink: #FFFFFF;
  --c-accent-soft: #F4E6E0;
  --c-bg: #FAF6F0;
  --c-surface: #FDFBF8;

  --c-ink: #1F2620;
  --c-ink-2: #3B443D;
  --c-muted: #6A726B;
  --c-line: #E7DFD3;
  --c-line-strong: #D6CBBB;
  --c-gold: #B08D57;
  --c-ok: #2F6B4F;
  --c-ok-soft: #E3F0E8;
  --c-warn: #8A5A12;
  --c-warn-soft: #F8EDD9;
  --c-danger: #9B2C2C;
  --c-danger-soft: #F8E3E1;
  --c-info: #3B5878;
  --c-info-soft: #E3EBF4;

  --f-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --f-body: "Jost", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(31, 38, 32, .05);
  --shadow-2: 0 1px 2px rgba(31, 38, 32, .04), 0 12px 32px -18px rgba(31, 38, 32, .35);
  --shadow-3: 0 2px 6px rgba(31, 38, 32, .06), 0 24px 48px -24px rgba(31, 38, 32, .45);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Ornamentos (por defecto, tono marfil) */
  --o-stem: #B08D57; --o-leaf: #7D9583; --o-leaf-alt: #A9BBA9; --o-vein: #FAF6F0;
  --o-petal: #E7B9AB; --o-petal-line: #C98F7E; --o-center: #3B2D2B; --o-berry: #C08A5B;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-ink);
  font: 400 17px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--c-primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--c-primary-strong); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.12; color: var(--c-ink); margin: 0 0 .4em; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); }
h2 { font-size: clamp(1.55rem, 4.4vw, 2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .86rem; }
.muted { color: var(--c-muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums lining-nums; }
.eyebrow { font: 500 .74rem/1.2 var(--f-body); letter-spacing: .22em; text-transform: uppercase; color: var(--c-gold); margin: 0 0 .6rem; }
.lead { font-size: 1.08rem; color: var(--c-ink-2); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 1.6rem 0; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.6rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--center { justify-content: center; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.6rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 1rem; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* --- Estructura pública ----------------------------------------------------- */

.site { display: flex; flex-direction: column; min-height: 100vh; }
.site__header { padding: 18px 20px 6px; }
.site__bar { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--c-ink); }
.brand__logo { height: 40px; width: auto; }
.brand__name { font: 600 1.45rem/1 var(--f-display); letter-spacing: .01em; }
.brand__tag { display: block; font: 500 .62rem/1.3 var(--f-body); letter-spacing: .24em; text-transform: uppercase; color: var(--c-muted); margin-top: 3px; }
.site__nav { display: flex; gap: 6px; align-items: center; }
.site__main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 20px 48px; }
.site__main--wide { max-width: 760px; }
.site__footer { padding: 28px 20px 36px; text-align: center; color: var(--c-muted); font-size: .86rem; border-top: 1px solid var(--c-line); background: color-mix(in srgb, var(--c-bg) 70%, white); }
.site__footer a { color: var(--c-muted); }
.site__footer .orn { width: 120px; margin: 0 auto 10px; opacity: .9; }

/* --- Superficies ------------------------------------------------------------- */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 22px;
}
.card--flat { box-shadow: none; }
.card--soft { background: var(--c-primary-soft); border-color: transparent; box-shadow: none; }
.card--accent { background: var(--c-accent-soft); border-color: transparent; box-shadow: none; }
.card__title { font: 600 1.3rem/1.2 var(--f-display); margin: 0 0 .35rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 2rem 0 .8rem; }
.section-title h2 { margin: 0; }

.notice { border-radius: var(--r-md); padding: 14px 16px; font-size: .95rem; display: flex; gap: 10px; align-items: flex-start; }
.notice svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.notice--info { background: var(--c-info-soft); color: var(--c-info); }
.notice--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.notice--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.notice--danger { background: var(--c-danger-soft); color: var(--c-danger); }
.notice--quiet { background: var(--c-primary-soft); color: var(--c-ink-2); }
.notice p:last-child { margin-bottom: 0; }

.flash-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.flash { border-radius: var(--r-md); padding: 12px 16px; font-size: .95rem; border: 1px solid transparent; animation: flash-in .35s var(--ease); }
.flash--success { background: var(--c-ok-soft); color: var(--c-ok); }
.flash--error { background: var(--c-danger-soft); color: var(--c-danger); }
.flash--info, .flash--warning { background: var(--c-info-soft); color: var(--c-info); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* --- Botones ------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--c-primary); --btn-ink: var(--c-primary-ink); --btn-line: transparent;
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border-radius: var(--r-pill);
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-ink);
  font: 500 1rem/1 var(--f-body); letter-spacing: .02em; text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 16px -10px color-mix(in srgb, var(--btn-bg) 80%, black);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { color: var(--btn-ink); background: color-mix(in srgb, var(--btn-bg) 90%, black); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.btn--block { width: 100%; }
.btn--lg { min-height: 58px; font-size: 1.05rem; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .9rem; }
.btn--accent { --btn-bg: var(--c-accent); --btn-ink: var(--c-accent-ink); }
.btn--outline { --btn-bg: transparent; --btn-ink: var(--c-primary); --btn-line: var(--c-primary-line); box-shadow: none; }
.btn--outline:hover { background: var(--c-primary-soft); }
.btn--ghost { --btn-bg: transparent; --btn-ink: var(--c-ink-2); box-shadow: none; }
.btn--ghost:hover { background: rgba(31,38,32,.05); }
.btn--danger { --btn-bg: var(--c-danger); --btn-ink: #fff; }
.btn--danger-outline { --btn-bg: transparent; --btn-ink: var(--c-danger); --btn-line: color-mix(in srgb, var(--c-danger) 40%, white); box-shadow: none; }
.btn--danger-outline:hover { background: var(--c-danger-soft); }
.btn--whatsapp { --btn-bg: #1F8F5A; --btn-ink: #fff; }
.btn-row { display: grid; gap: 10px; }
@media (min-width: 520px) { .btn-row--2 { grid-template-columns: 1fr 1fr; } }
.link-btn--inherit { color: inherit !important; }
.link-btn { appearance: none; border: 0; background: none; padding: 0; color: var(--c-primary); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* --- Formularios ------------------------------------------------------------------ */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > label, .field__label { font-weight: 500; font-size: .95rem; color: var(--c-ink-2); }
.field__help { font-size: .84rem; color: var(--c-muted); }
.field__error, .errorlist { color: var(--c-danger); font-size: .86rem; margin: 0; padding: 0; list-style: none; }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]), .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 14px;
  border: 1px solid var(--c-line-strong); background: #fff; color: var(--c-ink);
  font: 400 1rem/1.4 var(--f-body); transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 110px; resize: vertical; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--c-muted) 50%), linear-gradient(135deg, var(--c-muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-primary) 16%, transparent); }
.field input[type="file"] { font: inherit; font-size: .9rem; }
.field input[type="color"] { width: 64px; height: 48px; padding: 4px; border-radius: 12px; border: 1px solid var(--c-line-strong); background: #fff; }
.field--inline { grid-template-columns: auto 1fr; align-items: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--c-primary); flex: none; }
.counter { font-size: .8rem; color: var(--c-muted); text-align: right; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Selector WhatsApp / Email */
.seg { display: inline-grid; grid-auto-flow: column; background: var(--c-primary-soft); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 9px 18px; border-radius: var(--r-pill); font-size: .92rem; font-weight: 500; color: var(--c-ink-2); cursor: pointer; transition: background .2s, color .2s; }
.seg input:checked + label { background: #fff; color: var(--c-primary); box-shadow: var(--shadow-1); }
.seg input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--c-primary) 45%, transparent); }

/* Importes */
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip label { display: grid; place-items: center; min-height: 64px; border-radius: var(--r-md); border: 1px solid var(--c-line-strong); background: #fff; font: 600 1.35rem/1 var(--f-display); cursor: pointer; transition: all .18s var(--ease); }
.chip input:checked + label { border-color: var(--c-primary); background: var(--c-primary); color: var(--c-primary-ink); box-shadow: var(--shadow-2); }
.chip input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--c-primary) 45%, transparent); outline-offset: 2px; }
.chip--other label { font: 500 .95rem/1 var(--f-body); }

/* Diseños */
.designs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .designs { grid-template-columns: repeat(4, 1fr); } }
.design-opt input { position: absolute; opacity: 0; pointer-events: none; }
.design-opt label { display: block; border-radius: var(--r-md); padding: 6px; border: 2px solid transparent; cursor: pointer; text-align: center; font-size: .86rem; color: var(--c-ink-2); }
.design-opt .swatch { display: block; height: 54px; border-radius: 12px; margin-bottom: 6px; position: relative; overflow: hidden; }
.design-opt input:checked + label { border-color: var(--c-primary); background: #fff; }

/* Código de un solo uso */
.otp-input { text-align: center; font: 600 2rem/1 var(--f-body) !important; letter-spacing: .5em; padding-left: .5em !important; min-height: 64px !important; font-variant-numeric: tabular-nums; }

/* --- Gift Card visual ------------------------------------------------------------------ */

.gift {
  --g-bg: #30493D; --g-bg2: #253B30; --g-ink: #F7F1E6; --g-muted: #C7D2C6; --g-gold: #D1AE6E;
  position: relative; isolation: isolate; overflow: hidden;
  aspect-ratio: 1.586; width: 100%; border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--g-bg) 0%, var(--g-bg2) 100%);
  color: var(--g-ink); box-shadow: var(--shadow-3); text-align: left;
  padding: clamp(16px, 5vw, 26px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.gift::after { content: ""; position: absolute; inset: 9px; border: 1px solid color-mix(in srgb, var(--g-gold) 55%, transparent); border-radius: calc(var(--r-lg) - 7px); pointer-events: none; z-index: 1; }
.gift .orn { position: absolute; right: -6%; bottom: -12%; width: 62%; z-index: 0; pointer-events: none; }
.gift__top, .gift__bottom { position: relative; z-index: 2; }
.gift__brand { font: 600 clamp(1.05rem, 4.4vw, 1.3rem)/1.1 var(--f-display); }
.gift__brand img { height: 28px; width: auto; }
.gift__label { font: 500 .62rem/1 var(--f-body); letter-spacing: .3em; text-transform: uppercase; color: var(--g-gold); margin-top: 6px; }
.gift__amount { font: 600 clamp(2rem, 10vw, 2.9rem)/1 var(--f-display); letter-spacing: -.005em; }
.gift__to { font-size: .92rem; color: var(--g-muted); margin-top: 4px; }
.gift__code { font: 500 .7rem/1 var(--f-body); letter-spacing: .18em; color: var(--g-muted); margin-top: 8px; }
.gift--eucalipto { --g-bg: #30493D; --g-bg2: #253B30; --g-ink: #F7F1E6; --g-muted: #C7D2C6; --g-gold: #D1AE6E;
  --o-stem: #C8B07C; --o-leaf: #8EA897; --o-leaf-alt: #B4C4B5; --o-vein: #2F4A3D; --o-petal: #F4E8DE; --o-petal-line: #DCC2B0; --o-center: #34282A; --o-berry: #D1AE6E; }
.gift--rosa { --g-bg: #EBD5CD; --g-bg2: #E0C2B8; --g-ink: #4A2E2B; --g-muted: #7B5C57; --g-gold: #A9824C;
  --o-stem: #9B7A57; --o-leaf: #7F9784; --o-leaf-alt: #A4B5A2; --o-vein: #EAD6CE; --o-petal: #FBF1EC; --o-petal-line: #C98E7F; --o-center: #5A2F2C; --o-berry: #B8695B; }
.gift--marfil { --g-bg: #F7F1E8; --g-bg2: #EEE4D5; --g-ink: #2F3B33; --g-muted: #68716A; --g-gold: #B08D57;
  --o-stem: #B08D57; --o-leaf: #7D9583; --o-leaf-alt: #A9BBA9; --o-vein: #F6F0E6; --o-petal: #E7B9AB; --o-petal-line: #C98F7E; --o-center: #3B2D2B; --o-berry: #C08A5B; }
.gift--lavanda { --g-bg: #DED8EC; --g-bg2: #CFC6E2; --g-ink: #3B3355; --g-muted: #625B7B; --g-gold: #9C8656;
  --o-stem: #9C8656; --o-leaf: #7E9284; --o-leaf-alt: #A6B6A9; --o-vein: #DDD7EB; --o-petal: #F7F2FB; --o-petal-line: #9C8BC2; --o-center: #3B3355; --o-berry: #8C7BB3; }
.gift--muted { filter: grayscale(.65) saturate(.6); opacity: .82; }
.gift-link { display: block; text-decoration: none; color: inherit; border-radius: var(--r-lg); transition: transform .25s var(--ease); }
.gift-link:hover { transform: translateY(-2px); color: inherit; }
.gift-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 4px 0; }

.orn-stem { stroke: var(--o-stem); }
.orn-leaf { fill: var(--o-leaf); }
.orn-leaf-alt { fill: var(--o-leaf-alt); }
.orn-vein { stroke: var(--o-vein); opacity: .55; }
.orn-petal { fill: var(--o-petal); stroke: var(--o-petal-line); }
.orn-center { fill: var(--o-center); }
.orn-berry { fill: var(--o-berry); }

.swatch--eucalipto { background: linear-gradient(160deg, #30493D, #253B30); }
.swatch--rosa { background: linear-gradient(160deg, #EBD5CD, #E0C2B8); }
.swatch--marfil { background: linear-gradient(160deg, #F7F1E8, #EEE4D5); border: 1px solid var(--c-line); }
.swatch--lavanda { background: linear-gradient(160deg, #DED8EC, #CFC6E2); }

/* Dedicatoria */
.dedication { font: italic 500 1.25rem/1.45 var(--f-display); color: var(--c-ink-2); text-align: center; margin: 0; white-space: pre-line; }
.dedication__from { display: block; margin-top: .4rem; font: 500 .85rem/1.3 var(--f-body); color: var(--c-muted); font-style: normal; letter-spacing: .02em; }

/* Insignias de estado */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); font: 500 .72rem/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge--info { background: var(--c-info-soft); color: var(--c-info); }
.badge--muted { background: #EEEAE3; color: var(--c-muted); }
.badge--danger { background: var(--c-danger-soft); color: var(--c-danger); }

/* --- Portada ------------------------------------------------------------------------------ */

.hero { text-align: center; padding: 8px 0 8px; }
.hero .orn { width: min(420px, 92%); margin: 0 auto 8px; }
.hero h1 { margin-bottom: .25em; }
.hero__actions { display: grid; gap: 10px; margin: 22px 0 6px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.steps li::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c-primary-soft); color: var(--c-primary); font: 600 1.15rem/1 var(--f-display); }
.steps strong { display: block; font-weight: 500; }
.steps span { display: block; font-size: .95rem; }
.conditions { margin: 0; padding-left: 1.1rem; display: grid; gap: 8px; color: var(--c-ink-2); font-size: .95rem; text-align: left; }

/* --- Sobre (invitación) ----------------------------------------------------------------------- */

.envelope { position: relative; margin: 10px auto 24px; width: min(340px, 86%); aspect-ratio: 1.45; perspective: 900px; }
.envelope__body { position: absolute; inset: 0; border-radius: 18px; background: linear-gradient(170deg, #F3E7DD, #E9D6C8); box-shadow: var(--shadow-3); overflow: hidden; }
.envelope__body::before, .envelope__body::after { content: ""; position: absolute; bottom: 0; width: 60%; height: 70%; background: linear-gradient(160deg, #EDDCCF, #E2CBBB); }
.envelope__body::before { left: 0; clip-path: polygon(0 0, 100% 100%, 0 100%); }
.envelope__body::after { right: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.envelope__flap { position: absolute; left: 0; right: 0; top: 0; height: 62%; background: linear-gradient(180deg, #E6D1C1, #DDC4B2); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; border-radius: 18px 18px 0 0; z-index: 2; }
.envelope__seal { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: 66px; height: 66px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #C58A78, var(--c-accent) 60%, #8E5444); display: grid; place-items: center; color: #fff; font: 600 1.4rem/1 var(--f-display); z-index: 3; box-shadow: 0 6px 14px -6px rgba(0,0,0,.4); }
.envelope--open { margin-top: clamp(96px, 26vw, 140px); }
.envelope--open .envelope__flap { animation: flap-open 1s var(--ease) forwards; }
.envelope--open .envelope__seal { animation: seal-fade .5s var(--ease) forwards; }
@keyframes flap-open { to { transform: rotateX(180deg); z-index: 0; } }
@keyframes seal-fade { to { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
.reveal { animation: reveal .9s .25s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* --- QR de canje -------------------------------------------------------------------------- */

.qr-wrap { position: relative; width: min(300px, 82vw); margin: 8px auto 0; padding: 14px; background: #fff; border-radius: 24px; box-shadow: var(--shadow-3); }
.qr-wrap svg { width: 100%; height: auto; }
.qr-wrap.is-expired svg { filter: blur(6px); opacity: .35; }
.qr-ring { width: 64px; height: 64px; margin: 18px auto 0; position: relative; }
.qr-ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.qr-ring circle { fill: none; stroke-width: 5; }
.qr-ring .track { stroke: var(--c-line); }
.qr-ring .bar { stroke: var(--c-primary); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.qr-ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 1.25rem/1 var(--f-body); font-variant-numeric: tabular-nums; }
.short-code { font: 600 1.6rem/1 var(--f-body); letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.sheet { position: fixed; inset: auto 0 0 0; background: var(--c-surface); border-radius: 26px 26px 0 0; box-shadow: 0 -20px 50px -20px rgba(0,0,0,.4); padding: 24px 22px calc(26px + env(safe-area-inset-bottom)); z-index: 40; animation: sheet-up .35s var(--ease); max-width: 560px; margin: 0 auto; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet__backdrop { position: fixed; inset: 0; background: rgba(20, 25, 21, .45); z-index: 39; backdrop-filter: blur(2px); }
.big-amount { font: 600 clamp(2.6rem, 12vw, 3.6rem)/1 var(--f-display); text-align: center; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--c-primary-soft); color: var(--c-primary); font-weight: 500; font-size: .92rem; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.check-anim { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; background: var(--c-ok-soft); display: grid; place-items: center; color: var(--c-ok); animation: pop .5s var(--ease); }
.check-anim svg { width: 44px; height: 44px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Compartir --------------------------------------------------------------------------- */

.share-preview { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-3); background: var(--c-primary-soft); aspect-ratio: 4 / 5; display: grid; place-items: center; }
.share-preview img { width: 100%; height: 100%; object-fit: cover; }
.copy-box { display: flex; gap: 8px; align-items: stretch; }
.copy-box input { flex: 1; min-width: 0; font-size: .86rem !important; color: var(--c-muted) !important; }
.share-text { width: 100%; min-height: 190px !important; }

/* --- Listas y tablas ---------------------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.list__item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-line); text-decoration: none; color: inherit; }
a.list__item:hover { border-color: var(--c-primary-line); color: inherit; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 1px solid var(--c-line-strong); display: grid; gap: 14px; }
.timeline li { position: relative; font-size: .93rem; }
.timeline li::before { content: ""; position: absolute; left: -23px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--c-surface); border: 2px solid var(--c-primary); }
.timeline time { display: block; color: var(--c-muted); font-size: .8rem; }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 8px 14px; margin: 0; font-size: .95rem; }
.kv dt { color: var(--c-muted); }
.kv dd { margin: 0; word-break: break-word; }

.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font: 500 .74rem/1.2 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--c-muted); padding: 12px 14px; border-bottom: 1px solid var(--c-line); background: color-mix(in srgb, var(--c-bg) 60%, white); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--c-primary-soft) 45%, white); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.rowlink { color: inherit; text-decoration: none; font-weight: 500; }
@media (max-width: 700px) {
  .table--stack thead { display: none; }
  .table--stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--c-line); }
  .table--stack td { padding: 0; border: 0; }
  .table--stack td[data-label]::before { content: attr(data-label) " · "; color: var(--c-muted); font-size: .78rem; }
  .table--stack .num { text-align: right; }
}
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 18px 0; font-size: .92rem; }

/* --- Panel del comercio ---------------------------------------------------------------- */

.panel { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .panel { grid-template-columns: 248px 1fr; } }
.panel__side { display: none; }
@media (min-width: 1000px) {
  .panel__side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 26px 18px; background: var(--c-primary); color: var(--c-primary-ink); }
}
.panel__side .brand { color: inherit; padding: 0 8px 22px; }
.panel__side .brand__tag { color: color-mix(in srgb, var(--c-primary-ink) 70%, transparent); }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: color-mix(in srgb, var(--c-primary-ink) 82%, transparent); text-decoration: none; font-size: .95rem; transition: background .15s; }
.side-nav a svg { width: 19px; height: 19px; opacity: .85; flex: none; }
.side-nav a:hover { background: color-mix(in srgb, var(--c-primary-ink) 10%, transparent); color: var(--c-primary-ink); }
.side-nav a.is-active { background: color-mix(in srgb, var(--c-primary-ink) 16%, transparent); color: var(--c-primary-ink); font-weight: 500; }
.side-nav__label { font: 500 .66rem/1 var(--f-body); letter-spacing: .2em; text-transform: uppercase; opacity: .55; padding: 18px 12px 8px; }
.side-nav .count { margin-left: auto; background: var(--c-accent); color: var(--c-accent-ink); border-radius: var(--r-pill); font-size: .72rem; padding: 2px 8px; }
.panel__side-foot { margin-top: auto; font-size: .85rem; opacity: .85; padding: 0 8px; }
.panel__side-foot form { margin-top: 8px; }
.panel__side-foot .link-btn { color: inherit; }
.panel__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--c-primary); color: var(--c-primary-ink); position: sticky; top: 0; z-index: 30; }
.panel__top .brand { color: inherit; }
@media (min-width: 1000px) { .panel__top { display: none; } }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--c-primary-ink) 12%, transparent); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary svg { width: 22px; height: 22px; }
.menu[open] .menu__panel { display: block; }
.menu__panel { display: none; position: absolute; right: 0; top: 52px; width: min(300px, 86vw); background: var(--c-primary); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-3); }
.panel__main { padding: 22px 18px 60px; min-width: 0; }
@media (min-width: 1000px) { .panel__main { padding: 34px 44px 70px; } }
.panel__inner { max-width: 1080px; margin: 0 auto; }
.panel__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.panel__head h1 { margin: 0; font-size: clamp(1.9rem, 5vw, 2.5rem); }
.panel__head p { margin: 4px 0 0; color: var(--c-muted); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow-1); }
.stat__label { font: 500 .72rem/1.2 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }
.stat__value { font: 600 clamp(1.5rem, 4.6vw, 2rem)/1.1 var(--f-display); margin-top: 8px; font-variant-numeric: lining-nums; }
.stat__sub { font-size: .82rem; color: var(--c-muted); margin-top: 2px; }
.stat--primary { background: var(--c-primary); color: var(--c-primary-ink); border-color: transparent; }
.stat--primary .stat__label, .stat--primary .stat__sub { color: color-mix(in srgb, var(--c-primary-ink) 75%, transparent); }

.quick { display: grid; gap: 12px; }
@media (min-width: 700px) { .quick { grid-template-columns: 1fr 1fr; } }
.quick a { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-line); text-decoration: none; color: var(--c-ink); box-shadow: var(--shadow-1); transition: border-color .2s, transform .2s var(--ease); }
.quick a:hover { border-color: var(--c-primary-line); transform: translateY(-1px); color: var(--c-ink); }
.quick__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--c-primary-soft); color: var(--c-primary); flex: none; }
.quick__icon svg { width: 24px; height: 24px; }
.quick strong { display: block; font-weight: 500; }
.quick span { font-size: .88rem; color: var(--c-muted); }

.layout-2 { display: grid; gap: 20px; }
@media (min-width: 980px) { .layout-2 { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
.sticky { position: sticky; top: 20px; }
.actions { display: grid; gap: 12px; }
.action { border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 16px; background: var(--c-surface); }
.action h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.action details > summary { cursor: pointer; font-weight: 500; color: var(--c-primary); }
.filters { display: grid; gap: 12px; grid-template-columns: 1fr; padding: 16px; border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-line); margin-bottom: 16px; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr; align-items: end; } }
.filters .field input, .filters .field select { min-height: 46px; }

/* Escáner */
.scanner { position: relative; width: 100%; max-width: 420px; margin: 0 auto; aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: #111; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner__frame { position: absolute; inset: 14%; border-radius: 22px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.85); }
.scanner__hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-size: .9rem; text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* Comprobante */
.receipt { max-width: 460px; margin: 0 auto; background: #fff; border-radius: 18px; border: 1px solid var(--c-line); padding: 28px 26px; box-shadow: var(--shadow-2); }
.receipt__head { text-align: center; border-bottom: 1px dashed var(--c-line-strong); padding-bottom: 16px; margin-bottom: 16px; }
.receipt .kv { font-size: .95rem; }
@media print {
  .panel__side, .panel__top, .no-print, .flash-list { display: none !important; }
  .panel { display: block; }
  .receipt { box-shadow: none; border: 0; }
  body { background: #fff; }
}

/* Diálogo de confirmación */
dialog.confirm { border: 0; border-radius: 22px; padding: 24px; width: min(420px, 92vw); box-shadow: var(--shadow-3); background: var(--c-surface); color: var(--c-ink); }
dialog.confirm::backdrop { background: rgba(20, 25, 21, .45); backdrop-filter: blur(2px); }
dialog.confirm h3 { margin-top: 0; }

.dev-banner { background: #FFF3C4; color: #6B5300; border: 1px dashed #D6B53E; border-radius: 12px; padding: 10px 14px; font-size: .88rem; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font: 600 1.05rem/1 var(--f-body); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.codes span { padding: 12px; border-radius: 10px; background: var(--c-primary-soft); text-align: center; }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 18px; width: 220px; margin: 0 auto; border: 1px solid var(--c-line); }
.qr-box svg { width: 100%; height: auto; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; word-break: break-all; }

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