/* ================= 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; }
.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);
}
.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-link { padding: 13px 18px; border-radius: var(--bt-radius); background: var(--bt-accent); color: var(--bt-button-text); font-weight: 600; }
.dp-socials { display: flex; gap: 10px; margin-top: 10px; }
.dp-social { width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--bt-text) 12%, transparent); color: var(--bt-text); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; }

.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; }

/* ================= 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; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; }

.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; }

/* 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-main strong { min-width: 120px; }
.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; }

/* 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 { width: 100%; height: auto; }
.bar-views { fill: var(--brand); }
.bar-clicks { fill: #7c85ff; }
.chart-x { fill: var(--text-dim); font-size: 10px; text-anchor: middle; }
.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; }

/* 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; }
.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: block; 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:hover { transform: translateY(-1px); opacity: .94; text-decoration: none; }
.bt-empty { opacity: .7; padding: 8px 0; }
.bt-socials { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.bt-social {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--bt-text) 12%, transparent);
  color: var(--bt-text); font-size: .86rem; font-weight: 600;
}
.bt-social:hover { text-decoration: none; opacity: .9; }
.bt-social-chip {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bt-accent); color: var(--bt-button-text);
  display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 800;
}
.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; }

/* ---------- 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; }
  .land-nav-in { flex-wrap: wrap; gap: 10px; }
  .land-links { gap: 14px; }
  .hero { padding: 48px 0 40px; }
  .band { padding: 44px 0; }
}
@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);
  }
}