/* WhatsLink Pro — estilo "papelería": papel, tinta y stickers */
:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #161613;
  --muted: #5d5a52;
  --line: #161613;
  --green: #138a4a;
  --green-soft: #d7f2df;
  --lime: #d9f562;
  --sun: #ffd84d;
  --coral: #ff6b4a;
  --coral-soft: #ffe1d8;
  --sky: #bfe3ff;
  --shadow: 4px 4px 0 var(--line);
  --radius: 14px;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121411;
    --card: #1b1e1a;
    --ink: #f1eee5;
    --muted: #b3b0a6;
    --line: #f1eee5;
    --green: #4fd28a;
    --green-soft: #1e3a29;
    --lime: #c6e64e;
    --sun: #e9c23b;
    --coral: #ff8466;
    --coral-soft: #3d2620;
    --sky: #23384a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--body);
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 6vw, 4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
code, kbd { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--green-soft); padding: .05em .35em; border-radius: 5px; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(820px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Marcador tipo resaltador */
.hl { background: linear-gradient(transparent 55%, var(--lime) 55%); padding: 0 .1em; color: #161613; }
@media (prefers-color-scheme: dark) { .hl { background: var(--lime); border-radius: 6px; } }
.dark .hl, .on-ink .hl { color: var(--ink); }

/* Cabecera */
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper);
  border-bottom: 2px solid var(--line);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 1.25rem; text-decoration: none; }
.logo-mark {
  width: 38px; height: 38px; border: 2px solid var(--line); border-radius: 50% 50% 50% 6px;
  background: var(--lime); display: grid; place-items: center; box-shadow: 2px 2px 0 var(--line);
}
.logo-mark svg { width: 20px; height: 20px; color: #161613; }
.nav { display: flex; gap: 22px; font-weight: 600; font-size: .95rem; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
@media (max-width: 860px) { .nav { display: none; } }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 .95rem/1 var(--body);
  padding: 12px 18px; min-height: 44px;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  box-shadow: 3px 3px 0 var(--line);
  cursor: pointer; text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-go { background: var(--green); color: #fff; }
.btn-lime { background: var(--lime); color: #161613; }
.btn-sun { background: var(--sun); color: #161613; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: .85rem; box-shadow: 2px 2px 0 var(--line); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; box-shadow: none; border-style: dashed; }
.btn-ghost:hover { box-shadow: none; transform: none; background: var(--green-soft); }

/* Hero */
.hero { padding: 48px 0 28px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 32px; align-items: end; }
.hero p.lead { font-size: 1.15rem; max-width: 640px; }
.stickers { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sticker {
  display: inline-block; padding: 6px 12px; font-weight: 700; font-size: .85rem;
  border: 2px solid var(--line); border-radius: 999px; background: var(--card);
}
.sticker:nth-child(1) { background: var(--lime); color: #161613; transform: rotate(-2deg); }
.sticker:nth-child(2) { background: var(--sky); transform: rotate(1.5deg); }
.sticker:nth-child(3) { background: var(--sun); color: #161613; transform: rotate(-1deg); }
.hero-note {
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: 18px; box-shadow: var(--shadow); transform: rotate(1.2deg);
}
.hero-note strong { font-family: var(--display); font-size: 1.1rem; display: block; margin-bottom: 4px; }
@media (max-width: 860px) {
  .hero { padding-top: 28px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-note { transform: none; }
}

/* Tarjetas */
.card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 22px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; font-size: 1.3rem; }
.step-n {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 2px solid var(--line); border-radius: 50%; background: var(--sun); color: #161613;
  font: 800 1rem var(--display); margin-right: 8px;
}

/* App */
.app { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 26px; align-items: start; padding-bottom: 32px; }
.app-side { position: sticky; top: 84px; }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .app-side { position: static; }
  .app-main, .app-side { display: contents; }
  .app .card + .card, .app .card[style] { margin-top: 0 !important; }
  #waForm { order: 1; } .o-res { order: 2; } .phone { order: 3; } .o-qr { order: 4; } .o-hist { order: 5; } .o-dec { order: 6; }
}

label.lbl, .lbl { display: block; font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
input[type=text], input[type=tel], input[type=url], select, textarea {
  width: 100%; font: 500 1rem var(--body); color: var(--ink);
  background: var(--paper); border: 2px solid var(--line); border-radius: 10px;
  padding: 11px 12px; min-height: 46px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--lime); background: var(--card); }
.phone-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 8px; }
.phone-row.custom { grid-template-columns: minmax(0, 190px) 90px minmax(0, 1fr); }
@media (max-width: 520px) {
  .phone-row, .phone-row.custom { grid-template-columns: 1fr; }
}
.hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.check { font-size: .9rem; font-weight: 600; margin-top: 8px; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line); }
.check.ok { background: var(--green-soft); }
.check.warn { background: var(--coral-soft); }
.check:empty { display: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tool {
  font: 700 .85rem var(--body); min-width: 38px; min-height: 36px; padding: 4px 10px;
  border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer;
}
.tool:hover { background: var(--lime); color: #161613; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border: 2px dashed var(--line); border-radius: 10px; margin-bottom: 8px; }
.emoji-grid button { font-size: 1.25rem; width: 40px; height: 40px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; }
.emoji-grid button:hover { background: var(--green-soft); }
.counter { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Plantillas */
.tpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-tab { font: 700 .85rem var(--body); padding: 6px 12px; border: 2px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; }
.tpl-tab[aria-selected=true] { background: var(--ink); color: var(--paper); }
.tpl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.tpl {
  text-align: left; font: 600 .9rem/1.3 var(--body); color: var(--ink);
  padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer;
}
.tpl:hover { background: var(--lime); color: #161613; }
.tpl small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }
.tpl:hover small { color: #3c3b36; }

details.more { border: 2px solid var(--line); border-radius: 10px; margin-bottom: 18px; background: var(--paper); }
details.more > summary { cursor: pointer; padding: 12px 14px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font: 800 1.3rem var(--display); }
details.more[open] > summary::after { content: "–"; }
details.more > div { padding: 0 14px 14px; }

/* Resultado */
.result-link { display: flex; gap: 8px; flex-wrap: wrap; }
.result-link input { flex: 1 1 260px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; background: var(--green-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; width: fit-content; max-width: 100%; margin: 18px 0 10px; }
.seg button { font: 700 .85rem var(--body); padding: 8px 12px; border: 0; border-right: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-selected=true] { background: var(--ink); color: var(--paper); }
pre.code {
  margin: 0; padding: 14px; border: 2px solid var(--line); border-radius: 10px;
  background: #161613; color: #e9f5d0; font: .8rem/1.5 ui-monospace, Consolas, monospace;
  white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto;
}
.embed-preview { padding: 16px; border: 2px dashed var(--line); border-radius: 10px; margin-top: 10px; background: var(--paper); min-height: 70px; position: relative; }

/* Simulador de chat */
.phone {
  border: 2px solid var(--line); border-radius: 26px; overflow: hidden; background: #0b141a;
  box-shadow: var(--shadow);
}
.phone-head { background: #1f2c33; color: #e9edef; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--lime); color: #161613; display: grid; place-items: center; font: 800 1rem var(--display); flex: none; }
.phone-head b { display: block; font-size: .95rem; }
.phone-head span { font-size: .8rem; color: #b4c0c6; }
.phone-body {
  min-height: 230px; padding: 16px 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 14px 14px;
}
.sys { align-self: center; background: #182229; color: #ffd279; font-size: .78rem; padding: 6px 10px; border-radius: 8px; text-align: center; max-width: 90%; }
.bubble {
  align-self: flex-end; max-width: 88%; background: #005c4b; color: #e9edef;
  padding: 8px 10px 6px; border-radius: 10px 0 10px 10px; font-size: .9rem; line-height: 1.4;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble .meta { display: block; text-align: right; font-size: .75rem; color: #a9d8cb; margin-top: 2px; }
.bubble code { background: rgba(0,0,0,.25); color: inherit; }
.phone-foot { background: #1f2c33; padding: 10px; display: flex; gap: 8px; align-items: center; }
.phone-foot span { flex: 1; background: #2a3942; color: #aebac1; border-radius: 999px; padding: 8px 14px; font-size: .85rem; }
.phone-foot i { width: 38px; height: 38px; border-radius: 50%; background: #00a884; display: block; }

/* QR */
.qr-box { display: grid; place-items: center; padding: 16px; border: 2px dashed var(--line); border-radius: 12px; background: var(--paper); }
#qr { background: #fff; padding: 10px; border-radius: 10px; line-height: 0; }
#qr canvas, #qr svg { width: 220px !important; height: 220px !important; }
.qr-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.qr-opts .lbl { font-size: .85rem; }
.qr-opts input[type=color] { width: 100%; height: 44px; border: 2px solid var(--line); border-radius: 10px; padding: 2px; background: var(--paper); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .grid2, .qr-opts { grid-template-columns: 1fr; } }

/* Historial */
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li { min-width: 0; display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--paper); }
.history li button.load { flex: 1; min-width: 0; overflow: hidden; text-align: left; background: none; border: 0; color: var(--ink); cursor: pointer; font: 600 .9rem var(--body); padding: 4px 0; }
.history li button.load small { display: block; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history li .x { border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); width: 34px; height: 34px; cursor: pointer; font-weight: 800; flex: none; }

/* Secciones de contenido */
section.block { padding: 56px 0; border-top: 2px solid var(--line); }
section.block.alt { background: var(--card); }
.kicker { display: inline-block; font: 800 .8rem var(--body); letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: 4px 10px; border-radius: 6px; margin-bottom: 12px; }
.intro { max-width: 720px; font-size: 1.08rem; }
.uses { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 26px; }
.use { border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--paper); }
.alt .use { background: var(--paper); }
.use .em { font-size: 1.8rem; line-height: 1; display: block; margin-bottom: 10px; }
.use h3 { font-size: 1.1rem; }
.use p { font-size: .95rem; margin-bottom: .6em; }
.use blockquote { margin: 0; font-size: .85rem; border-left: 4px solid var(--green); padding: 4px 10px; color: var(--muted); }

.steps { counter-reset: s; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 24px; padding: 0; list-style: none; }
.steps li { counter-increment: s; border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--card); box-shadow: var(--shadow); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid var(--line); border-radius: 50%; background: var(--lime); color: #161613; font: 800 1.3rem var(--display); margin-bottom: 10px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

.guides { display: grid; gap: 10px; margin-top: 22px; }
.guides details { border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
.guides summary { cursor: pointer; padding: 14px 16px; font: 700 1.05rem var(--display); list-style: none; display: flex; gap: 10px; align-items: center; }
.guides summary::-webkit-details-marker { display: none; }
.guides summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; }
.guides details[open] summary::after { content: "–"; }
.guides details[open] summary { border-bottom: 2px dashed var(--line); }
.guides .body { padding: 14px 18px 6px; }
.guides ol, .guides ul { padding-left: 1.2em; margin: 0 0 1em; }
.guides li { margin-bottom: .4em; }

.table-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 12px; margin-top: 22px; background: var(--card); }
table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 25%, transparent); vertical-align: top; }
th { background: var(--ink); color: var(--paper); font-weight: 700; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--green-soft) 45%, transparent); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }
.box { border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--card); }
.box.bad { background: var(--coral-soft); }
.box.good { background: var(--green-soft); }
.box ul { padding-left: 1.2em; margin: 0; }
.box li { margin-bottom: .5em; }

.faq { display: grid; gap: 10px; margin-top: 22px; }
.faq details { border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font: 800 1.3rem var(--display); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 16px 14px; }

.cta-band { background: var(--lime); color: #161613; border-block: 2px solid var(--line); padding: 40px 0; }
.cta-band .wrap { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta-band h2 { margin: 0; }
.cta-band .btn { --line: #161613; }

/* Pie */
footer.foot { background: #161613; color: #d9d6cc; padding: 44px 0 28px; font-size: .92rem; }
footer.foot a { color: #f1eee5; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 28px; }
.foot-grid h3 { color: #fff; font-size: 1rem; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot .logo { color: #fff; margin-bottom: 10px; }
.foot .logo-mark { --line: #f1eee5; }
.foot-bottom { margin-top: 30px; padding-top: 18px; border-top: 1px solid #3a3a35; font-size: .82rem; color: #a3a097; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%);
  background: var(--ink); color: var(--paper); border: 2px solid var(--line);
  padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 60;
  transition: transform .25s, visibility .25s; max-width: calc(100% - 32px); text-align: center; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }

/* Páginas legales */
.doc { padding: 40px 0 60px; }
.doc .card { padding: clamp(18px, 4vw, 40px); }
.doc h2 { font-size: 1.4rem; margin-top: 1.6em; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: .4em; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .top, footer.foot, .toast, .cta-band { display: none; }
}
