/* ================= TreeHere · styles globales ================= */

:root {
  --bg: #0d0f14;
  --bg-soft: #141821;
  --panel: #171b26;
  --panel-2: #1c2130;
  --border: #262d3d;
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --brand: #2dd4a7;
  --brand-2: #1f9d78;
  --brand-ink: #04231a;
  --danger: #ff5d6c;
  --ring: rgba(45, 212, 167, .35);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel-2); padding: .1em .35em; border-radius: 6px; font-size: .9em; }
img { max-width: 100%; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.15; }
.muted { color: var(--text-dim); }
.tiny { font-size: .82rem; }
.center { text-align: center; }
.mt { margin-top: 1.2rem; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ---------- marca ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.15rem; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo { color: var(--brand); }
.brand-center { justify-content: center; margin: 0 auto 6px; }
.brand.muted { color: var(--text-dim); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-2); color: var(--brand-ink); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); background: rgba(45,212,167,.08); text-decoration: none; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(255,93,108,.1); text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field-label { font-weight: 600; font-size: .9rem; }
.field-hint { color: var(--text-dim); font-size: .8rem; }
input, textarea, select {
  font: inherit; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
textarea { resize: vertical; }
.color-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
/* Campo + boton de copiar pegados: el texto se lee de un vistazo y el boton
   no salta de ancho cuando "Copiar" se convierte en "Copiado". */
.copy-row { display: flex; align-items: stretch; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.copy-row .btn { flex: none; min-width: 6.4em; }
.qr-row { display: flex; gap: 16px; align-items: flex-start; }
.qr-row .stack-sm { flex: 1; min-width: 0; }
.qr-img {
  width: 164px; height: 164px; flex: none; background: #fff; padding: 8px;
  border: 1px solid var(--border); border-radius: 12px; image-rendering: pixelated;
}
@media (max-width: 560px) { .qr-row { flex-direction: column; } }
.check-row { margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
.honeypot { position: absolute; left: -9999px; top: -9999px; opacity: 0; }

/* switch (mostrar marca) */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { display: none; }
.switch-slider {
  width: 40px; height: 22px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; position: relative; transition: background .15s;
}
.switch-slider::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: var(--text-dim); border-radius: 50%; transition: left .15s, background .15s;
}
.switch input:checked + .switch-slider { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch-slider::after { left: 20px; background: var(--brand-ink); }
.switch-label { font-size: .88rem; color: var(--text-dim); }

/* ---------- flash ---------- */
.flash {
  border-radius: 10px; padding: 12px 14px; margin: 0 0 16px;
  border: 1px solid var(--border); background: var(--panel);
}
.flash-ok { border-color: var(--brand); background: rgba(45,212,167,.1); color: var(--brand); }
.flash-err { border-color: var(--danger); background: rgba(255,93,108,.1); color: var(--danger); }

/* ================= landing ================= */
body.land { background: var(--bg); }
.land-nav { border-bottom: 1px solid var(--border); background: rgba(13,15,20,.8); position: sticky; top: 0; z-index: 10; }
.land-nav-in { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.land-links { display: flex; align-items: center; gap: 18px; }
.land-links > a:not(.btn) { color: var(--text-dim); }
.land-links > a:not(.btn):hover { color: var(--text); }

.hero { padding: 72px 0 60px; }
.hero-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); gap: 48px; align-items: center; }
.hero h1 { margin: 0 0 16px; }
.hero-sub { color: var(--text-dim); font-size: 1.1rem; max-width: 560px; }
.hero-cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-note { color: var(--text-dim); font-size: .88rem; margin-top: 14px; }
.hero-demo { display: flex; justify-content: center; }

.demo-profile {
  width: min(360px, 100%);
  padding: 36px 22px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border-radius: 22px; text-align: center;
  font-family: var(--bt-font);
  background: var(--bt-bg); color: var(--bt-text);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
/* La demo recicla los botones reales (.bt-link y su links.theme) */
.demo-profile .bt-link { width: 100%; padding: 13px 18px; font-size: .95rem; }
.demo-profile .bt-link svg { width: 18px; height: 18px; }
.demo-profile .dp-links { gap: 12px; }
.dp-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--bt-accent); color: var(--bt-button-text); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.5rem; }
.dp-name { font-size: 1.3rem; }
.dp-bio { color: color-mix(in srgb, var(--bt-text) 70%, transparent); margin: 0 0 8px; }
.dp-links { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.dp-socials { display: flex; gap: 10px; margin-top: 10px; }
.dp-social {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--dp-bg, color-mix(in srgb, var(--bt-text) 12%, transparent));
  color: var(--dp-text, var(--bt-text));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  transition: transform .12s;
}
.dp-social svg { width: 18px; height: 18px; }
.demo-profile:hover .dp-social { transform: translateY(-2px); }

.band { padding: 60px 0; }
.band-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.band h2 { text-align: center; margin: 0 0 8px; }
.band > .wrap > p.center { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 28px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.b-marker { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.m1 { background:#f2994a; } .m2 { background:#2dd4a7; } .m3 { background:#7c85ff; }
.m4 { background:#ff7da6; } .m5 { background:#ffd166; } .m6 { background:#4fc3f7; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 720px; margin: 30px auto 0; }
.plan { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; }
.plan-hl { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(45,212,167,.15); }
.plan-muted { opacity: .85; }
.plan-price { font-size: 2.2rem; font-weight: 800; margin: 12px 0; }
.plan-period { font-size: .85rem; color: var(--text-dim); font-weight: 500; margin-left: 8px; }
.plan-cta { margin: 6px 0 16px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-list li::before { content: "·"; color: var(--brand); font-weight: 800; margin-right: 8px; }

.faq { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--text-dim); margin: 10px 0 0; }

/* pasos + distintivos */
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  font-size: .85rem; font-weight: 800; flex: none;
}
.plan-flag {
  display: block; margin: 6px 0 0;
  color: var(--brand); font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}

/* páginas legales */
.legal-bar { border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.legal-bar .wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
.prose { max-width: 760px; padding: 40px 20px 64px; }
.prose h1 { margin: 8px 0 18px; }
.prose h2 { margin: 34px 0 8px; font-size: 1.2rem; }
.prose h3 { margin: 22px 0 6px; font-size: 1rem; color: var(--text); }
.prose p, .prose li { color: var(--text-dim); }
.prose b { color: var(--text); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose a { text-decoration: underline; }

.land-footer { border-top: 1px solid var(--border); padding: 34px 0; color: var(--text-dim); margin-top: 40px; }
.land-footer .wrap { text-align: center; }
.land-footer p { margin: 6px 0; }

/* ================= selector de idioma =================
   Lista desplegable con banderita. El boton muestra el idioma activo y al
   abrirlo salen las tres opciones; cada enlace va con lang/hreflang para que
   el navegador y los buscadores sepan en que idioma esta cada destino.
   Se dibuja pegado a la barra superior del panel y al pie del resto. */
.lang-menu { position: relative; display: inline-flex; }
.lang-pop { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: .84rem; line-height: 1.5; cursor: pointer; list-style: none; }
.lang-btn::-webkit-details-marker { display: none; }
.lang-btn:hover { border-color: var(--brand); }
.lang-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.lang-current { white-space: nowrap; }
.lang-caret { flex: none; color: var(--text-dim); transition: transform .15s ease; }
.lang-pop[open] .lang-caret { transform: rotate(180deg); }
.lang-list { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 178px; display: flex; flex-direction: column; gap: 2px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.34); }
.lang-option { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; color: var(--text-dim); font-size: .86rem; text-decoration: none; white-space: nowrap; }
.lang-option:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.lang-option.is-active { color: var(--brand); font-weight: 700; }
.flag { flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(128,128,128,.35); }
.lang-foot { display: flex; justify-content: center; margin-top: 16px; }
.lang-menu.lang-link { white-space: nowrap; }
.land-footer .lang-menu { display: flex; justify-content: center; margin-top: 14px; }
.dash-actions .lang-menu { margin-left: 4px; padding-left: 10px; border-left: 1px solid var(--border); }
/* Al pie del documento la lista se abre hacia arriba: si se abriera hacia abajo
   se saldria de la pantalla, que es justo donde esta el selector. */
.land-footer .lang-list, .lang-foot .lang-list { top: auto; bottom: calc(100% + 6px); }
body.auth .lang-menu { position: fixed; bottom: 18px; left: 0; right: 0; display: flex; justify-content: center; }
body.auth .lang-list { top: auto; bottom: calc(100% + 6px); left: 50%; right: auto; transform: translateX(-50%); }

/* ================= auth ================= */
body.auth { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: min(430px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 30px; }
.auth-card h1 { margin: 0 0 18px; font-size: 1.5rem; text-align: center; }

/* ================= dashboard ================= */
.dash-top { border-bottom: 1px solid var(--border); background: var(--bg-soft); position: sticky; top: 0; z-index: 10; }
.dash-top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; flex-wrap: wrap; }
.dash-tabs { display: flex; gap: 4px; }
.dash-tabs a {
  color: var(--text-dim); padding: 8px 13px; border-radius: 9px; font-weight: 600; font-size: .92rem;
}
.dash-tabs a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.dash-tabs a.is-active { background: rgba(45,212,167,.12); color: var(--brand); }
.dash-actions { display: flex; align-items: center; gap: 10px; }
.dash-userbar { border-bottom: 1px solid var(--border); padding: 6px 0; font-size: .88rem; color: var(--text-dim); }
.dash-userbar .wrap { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.dash-wrap { padding: 26px 20px 60px; }
.dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding: 24px; align-items: start; }
.dash-editor { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.dash-preview-col { position: sticky; top: 86px; display: flex; justify-content: center; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; }

/* analytics bar */
.analytics-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.analytics-label { font-weight: 700; margin-right: auto; }
.analytics-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--text-dim); }
.analytics-pill strong { color: var(--text); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.views { background: #2dd4a7; }
.dot.clicks { background: #8b5cf6; }
.dot.ctr { background: #3b82f6; }

/* add link card */
.add-link-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.add-link-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.add-link-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.add-link-fields { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 10px; align-items: end; }

/* link cards */
.link-cards { display: flex; flex-direction: column; gap: 14px; }
.link-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; overflow: hidden; transition: opacity .15s, box-shadow .15s; }
.link-card.is-hidden { opacity: .65; }
.link-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.card-grip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px 6px; background: var(--panel-2); border-right: 1px solid var(--border); }
.grip-btn { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: transparent; border: none; color: var(--text-dim); font-size: .8rem; cursor: pointer; }
.grip-btn:hover:not(:disabled) { background: var(--panel); color: var(--text); }
.grip-btn:disabled { opacity: .3; cursor: not-allowed; }
.card-body { flex: 1; min-width: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.card-header { display: flex; align-items: center; gap: 12px; }
.card-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text); }
.card-icon svg { width: 20px; height: 20px; }
.card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-text strong { font-weight: 600; }
.card-text .muted { font-size: .84rem; word-break: break-all; }
.card-controls { display: flex; align-items: center; gap: 10px; }
.toggle-form { display: flex; align-items: center; }
.delete-form .btn-icon { background: transparent; border: none; color: var(--text-dim); font-size: 1.1rem; cursor: pointer; padding: 4px; }
.delete-form .btn-icon:hover { color: var(--danger); }
.card-edit { border-top: 1px solid var(--border); padding-top: 14px; }
.edit-form { display: flex; flex-direction: column; gap: 12px; }
.edit-fields { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 10px; align-items: end; }
.empty-card { background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--text-dim); }

/* icon mini picker inside cards */
.icon-mini-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-mini { position: relative; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color .15s, background .15s; }
.icon-mini:hover { border-color: var(--brand); }
.icon-mini input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon-mini.is-active { border-color: var(--brand); background: rgba(45,212,167,.12); color: var(--brand); }
.icon-mini svg { width: 16px; height: 16px; }
.icon-mini-none { font-size: .9rem; font-weight: 700; color: var(--text-dim); }

/* switch small */
.switch-sm .switch-slider { width: 42px; height: 24px; }
.switch-sm .switch-slider::after { width: 18px; height: 18px; top: 3px; left: 3px; }
.switch-sm input:checked + .switch-slider::after { left: 21px; }

/* phone preview */
.phone-preview { width: 280px; height: 580px; background: #0f0f0f; border-radius: 40px; padding: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.35); position: relative; }
.phone-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 100px; height: 22px; background: #0f0f0f; border-radius: 0 0 14px 14px; z-index: 2; }
.phone-preview iframe { width: 100%; height: 100%; border-radius: 30px; border: none; background: #fff; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.widget {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.widget h2 { margin: 0 0 14px; font-size: 1.05rem; }
.widget-head { display: flex; align-items: center; justify-content: space-between; }
.widget form h2 { margin-top: 6px; }

.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.row-between { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.input-readonly { background: var(--bg-soft); color: var(--text-dim); cursor: not-allowed; }

/* avatar */
.row-actions input[type="file"] { display: none; }

/* redes */
#socials { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.social-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
.social-row input { padding: 8px 10px; }

/* preview */
.pv { border: 1px dashed var(--border); border-radius: 16px; padding: 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pv-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.pv-name { font-size: 1.05rem; }
.pv-bio { color: var(--text-dim); font-size: .9rem; margin: 0; }
.pv-links { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 6px; }
.pv-link { height: 12px; border-radius: 6px; background: var(--panel-2); }

/* enlaces */
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.link-row { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.link-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.link-icon { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text); }
.link-icon svg { width: 18px; height: 18px; }
.link-info { display: flex; flex-direction: column; gap: 2px; min-width: 120px; flex: 1; }
.link-info strong { font-weight: 600; }
.link-info a { font-size: .84rem; word-break: break-all; }
.link-state { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.link-state.on { background: rgba(45,212,167,.15); color: var(--brand); }
.link-state.off { background: rgba(154,164,184,.15); color: var(--text-dim); }
.link-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.link-edit { margin-top: 12px; }
.link-edit summary { cursor: pointer; color: var(--brand); font-size: .9rem; }
.link-edit form { margin-top: 10px; }
.empty { color: var(--text-dim); padding: 14px 0; }
.add-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 10px; align-items: end; }

/* picker de iconos */
.icon-grid { border: none; padding: 0; margin: 0 0 12px; }
.icon-grid legend { font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; }
.icon-grid-inner { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-tile { position: relative; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color .15s, background .15s; }
.icon-tile:hover { border-color: var(--brand); }
.icon-tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon-tile.is-active { border-color: var(--brand); background: rgba(45,212,167,.12); color: var(--brand); }
.icon-tile svg { width: 20px; height: 20px; }
.icon-none { font-size: 1.1rem; font-weight: 700; color: var(--text-dim); }

/* portal de administracion */
.admin-tag {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: .7rem;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: #12b9811f; color: #12b981;
}
.admin-shell .page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-shell .page-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
.page-head { margin-bottom: 4px; }
.table-wrap { overflow-x: auto; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--text-dim); font-size: .82rem; }
.grid2.tight { gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text-dim); font-size: .84rem; text-decoration: none;
}
.chip:hover { border-color: var(--brand); color: var(--text); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #04241a; font-weight: 600; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: #12b9811f; color: #12b981; }
.pill-warn { background: #f59e0b22; color: #d97706; }
.pill-off { background: #ef444422; color: #ef4444; }
.pill-admin { background: #7c85ff22; color: #7c85ff; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search-row input[type="text"] { flex: 1; min-width: 220px; }
.ok-note { color: #12b981; font-size: .9rem; margin: 0 0 10px; }
.mail-frame { width: 100%; height: 620px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.mail-text { white-space: pre-wrap; word-break: break-word; font-size: .84rem; color: var(--text-dim); margin: 0; }
code { font-size: .82em; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }

/* estadisticas */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-num { display: block; font-size: 2rem; font-weight: 800; }
.stat-label { color: var(--text-dim); font-size: .86rem; }
/* Chart.js dibuja dentro del canvas: el alto real lo pone el contenedor, porque
   el canvas es responsivo y sin altura fija no tiene de donde estirarse. */
.chart-box { position: relative; width: 100%; height: 300px; margin-top: 6px; }
.grid2 .chart-box { height: 260px; }
.segment-card .chart-box { height: 200px; margin-top: 10px; }
.segment-card .chart-box.chart-doughnut { height: 220px; }
.legend { display: flex; gap: 18px; justify-content: center; margin-top: 8px; font-size: .85rem; color: var(--text-dim); }
.lg::before { content: "▪"; margin-right: 6px; font-size: .9rem; }
.lg-views::before { color: var(--brand); }
.lg-clicks::before { color: #7c85ff; }
/* Un segmento por tarjeta: dispositivos, referrers, paises y ciudades. */
.segment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.segment-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.segment-card h3 { margin: 0; font-size: .95rem; }

/* tabla */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.table th { color: var(--text-dim); font-weight: 600; }
.table thead tr:hover th, .table tbody tr:hover td { background: var(--panel-2); }

/* plan */
.plan-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .82rem; text-transform: uppercase; margin-bottom: 10px; }
.plan-badge.pro { background: rgba(45,212,167,.15); color: var(--brand); }
.plan-badge.free { background: rgba(154,164,184,.15); color: var(--text-dim); }

/* ================= perfil público (usa variables --bt-*) ================= */
.bt-body {
  font-family: var(--bt-font);
  background: var(--bt-bg); color: var(--bt-text);
  min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
}
.bt-page {
  width: min(560px, 100%); padding: 56px 22px 40px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.bt-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.bt-avatar-init {
  display: flex; align-items: center; justify-content: center;
  background: var(--bt-accent); color: var(--bt-button-text);
  font-size: 2.4rem; font-weight: 800;
}
.bt-name { font-size: 1.55rem; margin: 18px 0 4px; }
.bt-bio { margin: 0 0 6px; opacity: .82; max-width: 46ch; white-space: pre-line; }
.bt-rule { border: none; height: 1px; background: color-mix(in srgb, var(--bt-text) 15%, transparent); width: 100%; margin: 18px 0; }
.bt-links { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.bt-link {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 20px; border-radius: var(--bt-radius);
  background: var(--bt-accent); color: var(--bt-button-text);
  font-weight: 600; font-size: 1rem; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); transition: transform .06s, opacity .15s;
}
.bt-link svg { flex: none; width: 20px; height: 20px; }
/* ---------- estilos de boton por enlace (links.theme) ---------- */
.bt-st-brand { background: var(--bt-brand, var(--bt-accent)); color: var(--bt-brand-text, var(--bt-button-text)); }
.bt-st-brand svg { color: var(--bt-brand-text, var(--bt-button-text)); }
.bt-st-outline {
  background: transparent; border: 2px solid var(--bt-text); color: var(--bt-text);
  box-shadow: none;
}
.bt-st-soft {
  background: color-mix(in srgb, var(--bt-text) 12%, transparent);
  color: var(--bt-text); box-shadow: none;
}
.bt-st-shadow { box-shadow: 4px 4px 0 color-mix(in srgb, var(--bt-text) 70%, transparent); transform: translate(0); }
.bt-st-shadow:hover { transform: translate(1px, 1px); box-shadow: 3px 3px 0 color-mix(in srgb, var(--bt-text) 70%, transparent); }
.bt-st-soft-shadow { box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.bt-st-glass {
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.4); box-shadow: none; color: var(--bt-text);
}
.bt-st-gradient {
  background: linear-gradient(120deg, var(--bt-accent), color-mix(in srgb, var(--bt-accent) 45%, #ffffff));
  color: var(--bt-button-text);
}
@media (prefers-color-scheme: dark) {
  .bt-st-glass { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.28); }
}
.bt-link:hover { transform: translateY(-1px); opacity: .94; text-decoration: none; }
.bt-empty { opacity: .7; padding: 8px 0; }
/* Las redes sociales ahora son botones de enlace full-width con color de marca */
.bt-socials { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.bt-socials .bt-link { width: 100%; }
.bt-footer { margin-top: 34px; }
.bt-powered { color: color-mix(in srgb, var(--bt-text) 55%, transparent); font-size: .82rem; text-decoration: none; }
.bt-powered:hover { text-decoration: underline; }
.bt-powered-empty { display: block; height: 14px; }

/* ---------- cabeceras de seccion ---------- */
.bt-section {
  width: 100%; margin: 14px 0 -2px; padding: 0 4px;
  font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  text-align: left; opacity: .62;
}
/* ---------- animaciones de los botones ---------- */
/* Se animan al pasar el raton o al tocarlos, nunca solos: un perfil que se
   mueve por si solo es ruido y roba la atencion al contenido. Ademas, quien
   pidio reducir el movimiento las pierde. */
@media (prefers-reduced-motion: no-preference) {
  .bt-anim-bounce:hover { animation: bt-bounce .5s ease; }
  .bt-anim-pulse:hover { animation: bt-pulse .9s ease; }
  .bt-anim-wobble:hover { animation: bt-wobble .5s ease; }
  .bt-anim-shake:hover { animation: bt-shake .45s ease; }
  .bt-anim-tada:hover { animation: bt-tada .6s ease; }
}
@keyframes bt-bounce { 40% { transform: translateY(-7px) scale(1.02); } 70% { transform: translateY(2px); } }
@keyframes bt-pulse { 50% { transform: scale(1.035); } }
@keyframes bt-wobble {
  25% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg); }
  75% { transform: rotate(-.7deg); } 100% { transform: none; }
}
@keyframes bt-shake {
  20% { transform: translateX(-5px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}
@keyframes bt-tada {
  20% { transform: scale(.94); } 40% { transform: scale(1.06); }
  60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } 100% { transform: none; }
}

/* ---------- puerta de edad ---------- */
.gate-card {
  width: 100%; padding: 30px 24px; border-radius: var(--bt-radius);
  background: color-mix(in srgb, var(--bt-text) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--bt-text) 14%, transparent);
}
.gate-card h1 { font-size: 1.3rem; margin: 0 0 10px; }
.gate-card p { margin: 0 0 20px; opacity: .8; }
.gate-card form { margin: 0; }
.gate-card .bt-powered { display: inline-block; margin-top: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .grid2 { grid-template-columns: 1fr; }
  .add-row { grid-template-columns: 1fr; }
  .social-row { grid-template-columns: 1fr 1.4fr; }
  .dash-top-in { justify-content: center; }
  .dash-tabs { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .dash-layout { grid-template-columns: 1fr; }
  .dash-preview-col { position: static; order: -1; }
  .phone-preview { width: 260px; height: 520px; }
  .land-nav-in { flex-wrap: wrap; gap: 10px; }
  .land-links { gap: 14px; }
  .hero { padding: 48px 0 40px; }
  .band { padding: 44px 0; }
}
@media (max-width: 560px) {
  .qr-row { flex-direction: column; }
  .add-link-fields, .edit-fields { grid-template-columns: 1fr; }
  .analytics-bar { gap: 8px; }
  .analytics-label { width: 100%; }
  .dash-layout { padding: 16px; }
}
@media (prefers-color-scheme: light) {
  :root {
    --bg:#f4f5f7; --bg-soft:#eceef2; --panel:#ffffff; --panel-2:#f1f3f6;
    --border:#dde1ea; --text:#14181f; --text-dim:#5c6675; --brand:#119e7a; --brand-2:#0d8264;
    --brand-ink:#ffffff; --ring:rgba(17,158,122,.3);
  }
}
/* ================= Landing · estilo Linktree =================
   Superficie crema con tinta oscura, tipografia display pesada
   con tracking negativo, botones pill y bandas de color fuerte
   alternadas con crema, como la landing de linktr.ee. */
body.land {
  --bg: #f2f3f0;
  --bg-soft: #e9ebe6;
  --panel: #ffffff;
  --panel-2: #f5f6f3;
  --border: #dde0d9;
  --text: #17241e;
  --text-dim: #5d6a63;
  --brand: #12b98d;
  --brand-2: #0e9e77;
  --brand-ink: #062c22;
  --ring: rgba(18, 185, 141, .35);
  background: var(--bg);
}
body.land a:not(.btn) { color: #0e8a68; }
body.land a:not(.btn):hover { color: #0a6b51; }

body.land h1, body.land h2 {
  letter-spacing: -.025em;
  line-height: 1.06;
  font-weight: 800;
}
body.land .hero { padding: 88px 0 72px; }
body.land .hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.6rem);
  margin: 0 0 20px;
}
body.land .hero-sub { font-size: 1.18rem; line-height: 1.6; max-width: 520px; }
body.land .hero-cta { margin-top: 32px; }

/* Botones pill con cuerpo generoso, como el look linktree */
body.land .btn { border-radius: 999px; font-weight: 700; }
body.land .btn-lg { padding: 15px 30px; font-size: 1.05rem; }
body.land .btn-primary { box-shadow: 0 4px 14px rgba(18,185,141,.25); }
body.land .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(18,185,141,.32); }

body.land .land-nav { background: rgba(242,243,240,.85); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(23,36,30,.06); }
body.land .land-links > a:not(.btn) { color: var(--text-dim); font-weight: 600; }

/* Bandas: crema, banda de acento fuerte y banda final en color de marca */
body.land .band { padding: 76px 0; }
body.land .band h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 10px; }
body.land .band-alt {
  background: #0d3b2d;
  color: #eaf4ee;
  border: none;
}
body.land .band-alt h2 { color: #dff5e9; }
body.land .band-alt p { color: #a9c4b6; }
body.land .band-alt .card { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
body.land .band-alt .card h3 { color: #dff5e9; }
body.land .band-alt .card p { color: #a9c4b6; }
body.land .band-alt .step-num { background: #2dd4a7; color: #062c22; }
body.land .band-alt .b-marker { background: #2dd4a7; }
.land main > section:last-child { background: #2dd4a7; }
.land main > section:last-child h2 { color: #062c22; }
.land main > section:last-child .muted { color: rgba(6,44,34,.75); }
body.land .land-footer { border-top: 1px solid var(--border); background: var(--bg); }

/* Superficies: tarjetas blancas con sombra suave en vez de borde duro */
body.land .card, body.land .faq, body.land .plan {
  border: none;
  box-shadow: 0 2px 10px rgba(23,36,30,.06), 0 12px 32px rgba(23,36,30,.06);
}
body.land .card h3 { gap: 10px; }
body.land .step-num {
  width: 26px; height: 26px; border-radius: 8px; background: #0d3b2d; color: #dff5e9;
  display: inline-flex; align-items: center; justify-content: center; font-size: .85rem;
}
body.land .b-marker { width: 26px; height: 10px; border-radius: 5px; background: #12b98d; display: inline-block; }
body.land .m1 { background: linear-gradient(90deg,#12b98d,#2dd4a7); }
body.land .m2 { background: linear-gradient(90deg,#0d8264,#12b98d); }
body.land .m3 { background: linear-gradient(90deg,#12b98d,#7be0c3); }
body.land .m4 { background: linear-gradient(90deg,#0a6b51,#12b98d); }
body.land .m5 { background: linear-gradient(90deg,#2dd4a7,#0d3b2d); }
body.land .m6 { background: linear-gradient(90deg,#0d3b2d,#2dd4a7); }
body.land .faq summary { font-weight: 700; }
body.land .code, body.land code { background: #e7eae4; color: var(--text); }

/* Tarjeta demo del hero: flotante sobre el crema */
body.land .demo-profile {
  background: #fff;
  border: none;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(23,36,30,.10), 0 24px 56px rgba(23,36,30,.10);
}

/* Planes: la tarjeta destacada respira sobre el crema */
body.land .plan-hl { box-shadow: 0 0 0 3px #12b98d, 0 12px 32px rgba(23,36,30,.08); }
body.land .plan-flag { background: #0d3b2d; color: #dff5e9; }
body.land .plan-flag.pro { background: #2dd4a7; color: #062c22; }

/* Campos del propio landing (busquedas/legales) respiran igual */
body.land input, body.land textarea, body.land select {
  background: #fff; border-color: #cfd4cb; color: var(--text);
}

/* Focus visible consistente y movimiento reducido, para toda la app */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 760px) {
  body.land .hero { padding: 56px 0 44px; }
  body.land .band { padding: 52px 0; }
}
