/* ALIADOS — estilo base. Mobile-first, elegante-romantico. El tenant sobreescribe --primary. */
:root {
  --primary: #b8324f;
  --primary-2: #7a1f38;
  --ink: #1d1720;
  --muted: #6d6470;
  --line: #ece6ea;
  --bg: #fdfbfc;
  --card: #ffffff;
  --ok: #1f8a54;
  --warn: #b7791f;
  --danger: #c0362c;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(40, 20, 35, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Georgia", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* Hero */
.hero {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  padding: 56px 18px 48px;
  text-align: center;
}
.hero .logo { max-height: 74px; margin: 0 auto 18px; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.8rem, 6vw, 2.8rem); margin: 0 0 10px; font-weight: 700; letter-spacing: -0.01em; }
.hero p { margin: 0 auto; max-width: 34rem; opacity: 0.94; }
.badge { display: inline-block; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.3); padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; margin-bottom: 14px; }

/* Grid de paquetes */
.grid { display: grid; grid-template-columns: 1fr; gap: 18px; padding: 34px 0; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(40,20,35,0.13); }
.card .ph, .card img.cover { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #f2edf0; }
.card .ph { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; text-align: center; padding: 12px; }
.card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 1.08rem; }
.card .inc { color: var(--muted); font-size: 0.86rem; flex: 1; }
.card .price { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-top: 6px; }
.card .price small { font-weight: 400; color: var(--muted); font-size: 0.72rem; display: block; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 0.95rem; padding: 11px 18px; border-radius: 12px; text-decoration: none; }
.btn:hover { background: var(--primary-2); }
.btn.wa { background: #25d366; color: #06301a; }
.btn.wa:hover { background: #1fb457; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }

/* Formularios */
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.field-err { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }

/* Paneles */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 4px; font-size: 1.2rem; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: #faf6f8; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi .n { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.kpi .l { font-size: 0.78rem; color: var(--muted); }

/* "Mi pagina" (editor): campo de solo-lectura con el link para compartir */
.mp-linkbox { margin-top: 6px; }
.mp-url { background: #faf6f8; color: var(--ink); font-size: 0.95rem; font-weight: 600; cursor: text; }
.mp-url:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.tag.borrador { background: #fef3e6; color: var(--warn); }
.tag.activo { background: #e6f6ec; color: var(--ok); }
.tag.pausado { background: #f0eef1; color: var(--muted); }
.tag.pend { background: #fff4e0; color: var(--warn); }
.tag.aprob { background: #e6f6ec; color: var(--ok); }
.tag.rech { background: #fdecea; color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.tablewrap { overflow-x: auto; }

.notice { padding: 12px 14px; border-radius: 10px; font-size: 0.88rem; margin: 10px 0; }
.notice.info { background: #eef4fb; color: #24557f; }
.notice.warn { background: #fdf3e3; color: var(--warn); }
.notice.stale { background: #fdecea; color: var(--danger); }

.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 30px 18px 50px; }
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transition: opacity 0.2s; z-index: 50; }
.toast.show { opacity: 1; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

/* ==========================================================================
   PANEL DEL ALIADO (editor) — esencia A&V vino/dorado/crema, nivel producto.
   TODO va scopeado bajo .editor para no tocar el micrositio público ni admin.
   ========================================================================== */
body.editor {
  --wine-900: #2b0a12; --wine-800: #3a0f1c; --wine-700: #5a1528;
  --wine-600: #7a1f38; --wine: #9e2542; --wine-500: #b8324f;
  --gold-800: #8f6a2c; --gold-700: #a9803a; --gold-600: #c69a45;
  --gold: #dcb56d; --gold-300: #e6c988; --gold-100: #f4dfab;
  --e-cream: #fbf6f2; --e-card: #ffffff; --e-ink: #2a1720; --e-muted: #8a7a80;
  --e-line: #efe2e7; --e-line-soft: #f5ecf0;
  --e-shadow: 0 8px 30px -12px rgba(58, 15, 28, 0.20);
  --e-shadow-lg: 0 22px 60px -26px rgba(58, 15, 28, 0.42);
  --serif: "Georgia", "Times New Roman", serif;
  background: var(--e-cream);
  color: var(--e-ink);
}
body.editor::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 340px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 120% at 15% -10%, rgba(230,201,136,.10) 0%, rgba(230,201,136,0) 46%),
    radial-gradient(90% 90% at 100% 0%, rgba(184,50,79,.07) 0%, rgba(184,50,79,0) 50%);
}
body.editor .wrap { max-width: 720px; position: relative; z-index: 1; }

/* — Hero cálido del panel — */
.ed-hero { position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(158deg, var(--wine-700) 0%, var(--wine-800) 52%, var(--wine-900) 100%);
  padding: 22px 0 34px; box-shadow: 0 20px 50px -30px rgba(43,10,18,.7); }
.ed-hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 90% at 88% 0%, rgba(230,201,136,.20) 0%, rgba(230,201,136,0) 55%),
    radial-gradient(70% 100% at 8% 120%, rgba(158,37,66,.55) 0%, rgba(158,37,66,0) 60%); }
.ed-hero__inner { position: relative; z-index: 1; }
.ed-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.ed-brand__mark { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; color: var(--gold-100); }
.ed-brand__rule { flex: 0 0 34px; height: 1px; background: linear-gradient(90deg, rgba(230,201,136,.7), rgba(230,201,136,0)); }
.ed-brand__tag { font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.66); font-weight: 600; }
.ed-hero__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.ed-eyebrow { margin: 0 0 4px; color: var(--gold-300); letter-spacing: .14em; text-transform: uppercase; font-size: .64rem; font-weight: 700; }
.ed-title { font-family: var(--serif); font-weight: 700; font-size: clamp(1.6rem, 6.4vw, 2.2rem); line-height: 1.06; margin: 0; letter-spacing: -.01em; }
.ed-badge { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(230,201,136,.34); color: var(--gold-100); white-space: nowrap; }
.ed-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-300); box-shadow: 0 0 0 3px rgba(230,201,136,.22); }
.ed-badge.is-borrador::before, .ed-badge.is-pausado::before { background: #e6b25a; box-shadow: 0 0 0 3px rgba(230,178,90,.2); }

.ed-main { padding-top: 20px; padding-bottom: 40px; }

/* — Paneles del editor — */
body.editor .ed-panel { background: var(--e-card); border: 1px solid var(--e-line); border-radius: 20px;
  padding: 20px 18px; margin: 16px 0; box-shadow: var(--e-shadow); }
.ed-panel__head { margin-bottom: 14px; }
.ed-panel__head h2 { font-family: var(--serif); font-size: 1.24rem; margin: 0; color: var(--wine-700); letter-spacing: -.01em; }
.ed-panel__head .ed-sub { margin: 4px 0 0; color: var(--e-muted); font-size: .86rem; }
.ed-panel__eyebrow { display: flex; align-items: center; gap: 8px; font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--gold-700); margin-bottom: 10px; }
.ed-panel__eyebrow svg { width: 15px; height: 15px; }

/* — Mi página: acción rápida destacada — */
.ed-panel--page { background: linear-gradient(160deg, #fff 0%, #fdf7f9 100%); border-color: var(--gold-300); box-shadow: var(--e-shadow-lg); }
.ed-linkbox { display: flex; align-items: center; gap: 8px; background: var(--e-cream); border: 1px solid var(--e-line); border-radius: 14px; padding: 6px 6px 6px 14px; }
body.editor .ed-linkbox .mp-url { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font-weight: 600; color: var(--wine-700); font-size: .92rem; }
body.editor .ed-linkbox .mp-url:focus { outline: none; }
.ed-copybtn { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .82rem;
  background: var(--wine-600); color: #fff; padding: 9px 14px; border-radius: 10px; transition: background .15s, transform .05s; }
.ed-copybtn:hover { background: var(--wine-700); }
.ed-copybtn:active { transform: translateY(1px); }
.ed-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
body.editor .ed-actions .btn { width: 100%; border-radius: 12px; padding: 13px 14px; font-weight: 700; }
body.editor .ed-actions .btn-ver { background: #fff; color: var(--wine-700); border: 1px solid var(--e-line); box-shadow: none; }
body.editor .ed-actions .btn-ver:hover { background: var(--e-cream); }
body.editor .ed-actions .btn.wa { background: #25d366; color: #06301a; box-shadow: 0 10px 24px -14px rgba(37,211,102,.8); }
body.editor .ed-actions .btn.wa:hover { background: #1fb457; }
.ed-actions .btn svg { width: 18px; height: 18px; }

/* — KPI cards con ícono + contexto — */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi-card { position: relative; background: linear-gradient(165deg, #fff 0%, #fdf8fa 100%); border: 1px solid var(--e-line);
  border-radius: 16px; padding: 15px 14px 14px; overflow: hidden; }
.kpi-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--wine-500), var(--wine-700)); opacity: .0; transition: opacity .2s; }
.kpi-card:hover::before { opacity: .55; }
.kpi-card__icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(230,201,136,.24), rgba(198,154,69,.14)); color: var(--gold-800); margin-bottom: 10px; }
.kpi-card__icon svg { width: 19px; height: 19px; }
.kpi-card__n { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--wine-700); font-variant-numeric: tabular-nums; }
.kpi-card__l { font-size: .82rem; font-weight: 700; color: var(--e-ink); margin-top: 6px; }
.kpi-card__hint { font-size: .72rem; color: var(--e-muted); margin-top: 2px; line-height: 1.35; }

/* — Highlight de conversión (dato real) — */
.ed-highlight { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 13px 15px; border-radius: 14px;
  background: linear-gradient(150deg, var(--wine-700), var(--wine-800)); color: #fff; }
.ed-highlight svg { width: 20px; height: 20px; color: var(--gold-300); flex: none; }
.ed-highlight b { color: var(--gold-100); }
.ed-highlight .t { font-size: .86rem; line-height: 1.4; }

/* — Embudo de conversión — */
.ed-funnel { margin-top: 16px; display: grid; gap: 9px; }
.ed-funnel__step { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.ed-funnel__label { font-size: .8rem; font-weight: 600; color: var(--e-ink); display: flex; align-items: center; gap: 7px; }
.ed-funnel__label .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ed-funnel__val { font-size: .82rem; font-weight: 700; color: var(--wine-700); font-variant-numeric: tabular-nums; }
.ed-funnel__val .pct { color: var(--e-muted); font-weight: 600; font-size: .72rem; margin-left: 6px; }
.ed-funnel__track { grid-column: 1 / -1; height: 12px; border-radius: 999px; background: var(--e-line-soft); overflow: hidden; }
.ed-funnel__fill { height: 100%; border-radius: 999px; width: 0; transition: width .8s cubic-bezier(.2,.7,.2,1); }

/* — Estado de precio claro — */
.ed-price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.ed-price-cell { border: 1px solid var(--e-line); border-radius: 14px; padding: 13px 14px; background: #fff; }
.ed-price-cell.is-vigente { border-color: var(--gold-300); background: linear-gradient(165deg, #fffdf8, #fdf7ee); }
.ed-price-cell__k { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--e-muted); }
.ed-price-cell__v { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--wine-700); margin-top: 5px; font-variant-numeric: tabular-nums; }
.ed-price-cell__v small { display: block; font-family: var(--font); font-size: .72rem; font-weight: 500; color: var(--e-muted); margin-top: 3px; }
.ed-price-status { display: flex; align-items: center; gap: 9px; font-size: .86rem; padding: 11px 14px; border-radius: 12px; margin-bottom: 4px; }
.ed-price-status svg { width: 18px; height: 18px; flex: none; }
.ed-price-status.ok { background: #ecf7f0; color: #1f7a4d; }
.ed-price-status.pend { background: #fdf4e3; color: #a06a13; }
.ed-price-status.rech { background: #fdecea; color: #b3352b; }

/* — Formularios del editor — */
body.editor label { color: var(--e-ink); font-size: .82rem; }
body.editor input, body.editor select, body.editor textarea { border: 1px solid var(--e-line); border-radius: 12px; padding: 12px 13px; background: #fff; min-height: 44px; }
body.editor input:focus, body.editor select:focus, body.editor textarea:focus { outline: 2px solid var(--gold-600); outline-offset: 1px; border-color: transparent; }
body.editor .btn { background: var(--wine-600); border-radius: 12px; padding: 13px 18px; font-weight: 700; min-height: 44px; box-shadow: 0 12px 26px -16px rgba(122,31,56,.8); }
body.editor .btn:hover { background: var(--wine-700); }
body.editor .btn.ghost { background: #fff; color: var(--wine-700); border: 1px solid var(--e-line); box-shadow: none; }
body.editor .btn.ghost:hover { background: var(--e-cream); }
.ed-formgrid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) { .ed-formgrid { grid-template-columns: 1fr 1fr; } }

/* — Tabla — */
body.editor table { font-size: .86rem; }
body.editor th { color: var(--e-muted); }
body.editor th, body.editor td { border-bottom: 1px solid var(--e-line-soft); }

/* — Pills / notices — */
body.editor .tag.aprob, body.editor .tag.activo { background: #ecf7f0; color: #1f7a4d; }
body.editor .tag.pend, body.editor .tag.borrador { background: #fdf4e3; color: #a06a13; }
body.editor .tag.rech { background: #fdecea; color: #b3352b; }
body.editor .notice { border-radius: 13px; }
.ed-gate { margin: 0 0 4px; }

/* — Skeleton de carga (imita el layout) — */
.sk { background: linear-gradient(100deg, var(--e-line-soft) 30%, #fff 50%, var(--e-line-soft) 70%);
  background-size: 220% 100%; animation: skShimmer 1.3s ease-in-out infinite; border-radius: 8px; }
.sk-kpi { height: 118px; border-radius: 16px; }
.sk-line { height: 12px; margin: 8px 0; }
@keyframes skShimmer { from { background-position: 180% 0; } to { background-position: -40% 0; } }

/* — Estado vacío honesto — */
.ed-empty { text-align: center; padding: 22px 16px; color: var(--e-muted); }
.ed-empty svg { width: 34px; height: 34px; color: var(--gold-600); margin-bottom: 8px; }
.ed-empty b { color: var(--e-ink); display: block; font-size: .95rem; margin-bottom: 4px; }
.ed-empty p { margin: 0; font-size: .86rem; line-height: 1.5; }

/* — Estado de error con reintento — */
.ed-error { background: #fdecea; color: #b3352b; border: 1px solid #f6cfca; border-radius: 14px; padding: 16px; text-align: center; margin: 16px 0; }
.ed-error b { display: block; margin-bottom: 4px; }
.ed-error .btn { margin-top: 10px; }

.ed-signout { text-align: center; padding: 8px 0 20px; }

/* — Entrada escalonada — */
.reveal { opacity: 0; transform: translateY(10px); animation: edReveal .5s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes edReveal { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .ed-funnel__fill { transition: none; }
  .sk { animation: none; }
}
