/* ── Tokens · design system v2 "sketchbook on cream paper" ─────
   Fuente de verdad: proyecto de Claude Design "HabitaScan" (tokens.css).
   La tinta hace la estructura, el amarillo es un rotulador (no un botón)
   y los pasteles son notas adhesivas. Colores solo por var(). */
:root {
  /* Surfaces */
  --bg:             #FCFAF5;
  --bg-subtle:      #F5F1E6;
  --card:           #FCFAF5;
  --input-bg:       #FFFFFF;
  --nav-bg:         rgba(252, 250, 245, 0.92);

  /* Ink — text, primary buttons, borders */
  --ink:            #0E0E0C;
  --text:           #0E0E0C;
  --text-muted:     #5C5A52;
  --text-faint:     #8F8C83;

  /* Borders — 1px hairlines instead of shadows */
  --border:         #D9D6CC;
  --border-input:   #B6B6B6;
  --border-strong:  #0E0E0C;

  /* Yellow — marker highlight, badges, tags. Never a button fill. */
  --yellow:         #FFD400;
  --yellow-bg:      rgba(255, 212, 0, 0.18);
  --yellow-border:  rgba(255, 212, 0, 0.60);
  --yellow-text:    #0E0E0C;

  /* Sticky notes — one per row, never large surfaces */
  --note-butter:    #FFF1A8;
  --note-peach:     #FFD3A8;
  --note-honey:     #FFE066;
  --terracotta:     #CB5521;

  /* Buttons — ink fill */
  --btn-bg:         #0E0E0C;
  --btn-hover:      #2A2A26;
  --btn-text:       #FCFAF5;

  /* Semantic */
  --positive:       #E5A500;
  --danger:         #CB5521;

  /* Type */
  --font-display: 'Clash Display', 'General Sans', system-ui, sans-serif;
  --font-ui:      'General Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Shape */
  --radius-btn:  6px;
  --radius-card: 12px;
  --radius-nav:  16px;
  --radius-pill: 999px;

  --shadow:      0 1px 2px rgba(14, 14, 12, 0.06);

  /* Locales de la web (no están en el design system) */
  --on-color:    #0E0E0C;                            /* tinta fija sobre amarillo o nota: --ink se invierte en oscuro */
  --focus-ring:  0 0 0 3px rgba(255, 212, 0, 0.45);
  --wrap:        1120px;
  --gutter:      1.5rem;
}

html.dark {
  --bg:             #0E0E0C;
  --bg-subtle:      #1A1A18;
  --card:           #1A1A18;
  --input-bg:       #2A2A26;
  --nav-bg:         rgba(14, 14, 12, 0.92);
  --ink:            #FCFAF5;
  --text:           #FCFAF5;
  --text-muted:     #B8B5AB;
  --text-faint:     #5C5A52;
  --border:         #2A2A26;
  --border-input:   #3A3A34;
  --border-strong:  #FCFAF5;
  --yellow-bg:      rgba(255, 212, 0, 0.14);
  --yellow-border:  rgba(255, 212, 0, 0.35);
  --yellow-text:    #FFE34D;
  --btn-bg:         #FFD400;
  --btn-hover:      #FFE34D;
  --btn-text:       #0E0E0C;
  --shadow: none;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Los enlaces heredan la tinta de la marca; el énfasis va por el subrayado, no por el color. */
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--border-strong); outline-offset: 2px; }

/* ── Base ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  transition: background-color 0.2s, color 0.2s;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Dos columnas: titular a la izquierda, contenido a la derecha */
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 3rem 4rem;
  align-items: start;
}

/* Icono del set (icons.svg) */
.ic {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: -0.125em;
}

/* Etiqueta mono: eyebrows, metadatos, pies */
.eyebrow,
.section-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow { display: flex; align-items: center; gap: 0.5rem; }

/* Rotulador: una palabra del titular */
.hl {
  background: var(--yellow);
  color: var(--on-color);
  padding: 0 0.12em;
  margin: 0 -0.04em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.tag {
  display: inline-flex;
  align-self: flex-start;
  background: var(--yellow);
  color: var(--on-color);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Skip link ──────────────────────────────────────────────── */
.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* ── Nav ────────────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background 0.2s, border-color 0.2s;
}

.nav-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.logo-mark {
  flex-shrink: 0;
  display: block;
}

.logo-name {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-pill {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.lang-pill:hover { color: var(--text); border-color: var(--border-strong); }

.icon-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text); }

.nav-premium-btn {
  /* Rotulador amarillo siempre puesto; al pasar el ratón el trazo «se llena» hacia arriba
     hasta formar una caja amarilla del tamaño del botón «Entrar». */
  position: relative;
  isolation: isolate;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  padding: 0.5rem 0.85rem;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, text-decoration-color 0.2s;
}
.nav-premium-btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--yellow);
  border-radius: inherit;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.25s cubic-bezier(.2, .7, .2, 1);
}
.nav-premium-btn:hover,
.nav-premium-btn:focus-visible {
  color: var(--on-color);            /* tinta fija: el amarillo no se invierte en oscuro */
  border-color: var(--yellow);
  text-decoration-color: transparent;
}
.nav-premium-btn:hover::before,
.nav-premium-btn:focus-visible::before { transform: scaleY(1); }
.nav-premium-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .nav-premium-btn, .nav-premium-btn::before { transition: none; }
}

/* Botón Entrar (nav): outline */
.nav-login {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  padding: 0.5rem 1rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.nav-login:hover { background: var(--bg-subtle); }
.nav-login[hidden] { display: none; }

/* Con sesión: chip de cuenta (inicial + email) y menú. Mismo alto que .nav-login. */
.nav-account { position: relative; }
.nav-account[hidden] { display: none; }
.nav-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-account-btn:hover,
.nav-account-btn[aria-expanded="true"] { background: var(--bg-subtle); }
.nav-account-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.nav-account-avatar {
  /* Mismo avatar que el panel (.agency-avatar): círculo amarillo, inicial en mono 600. */
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--yellow);
  color: var(--on-color);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  text-transform: uppercase;
}
.nav-account-email {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-account-caret { color: var(--text-muted); }
.nav-account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 60;
  min-width: 15rem;
  max-width: calc(100vw - 2 * var(--gutter));
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-account-menu[hidden] { display: none; }
.nav-account-who {
  margin: 0;
  padding: 0.5rem 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-account-who b {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  overflow-wrap: anywhere;
}
.nav-account-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-btn);
  padding: 0.55rem 0.6rem;
  cursor: pointer;
}
.nav-account-item:hover,
.nav-account-item:focus-visible { background: var(--bg-subtle); outline: none; }

/* Decoración antigua (rejilla + halo): fuera en v2 */
.grid-bg, .hero-glow { display: none; }

/* ── Main ───────────────────────────────────────────────────── */
main {
  position: relative;
  padding-top: 4rem;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero { padding: 5rem 0 4.5rem; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 3rem 4rem;
  align-items: center;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  flex-shrink: 0;
}
.hero-copy .badge-dot { animation: pulse 2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 6.4vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-wrap: balance;
  color: var(--text);
  margin: 1.25rem 0 1.5rem;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 34rem;
  line-height: 1.55;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

/* Botón principal: tinta */
.hero-cta,
#submitBtn, #accSubmit,
.tg-connect-btn,
.notify-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-bg);
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.hero-cta { font-size: 1rem; }
.hero-cta:hover,
#submitBtn:hover:not(:disabled), #accSubmit:hover:not(:disabled),
.tg-connect-btn:hover,
.notify-btn:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--btn-hover); }
.hero-cta:active,
#submitBtn:active:not(:disabled), #accSubmit:active:not(:disabled),
.tg-connect-btn:active,
.notify-btn:active:not(:disabled) { transform: translateY(1px); }
#submitBtn:disabled, #accSubmit:disabled, .notify-btn:disabled { opacity: 0.45; cursor: default; }

/* Aviso de ejemplo */
.hero-demo {
  justify-self: end;
  width: 100%;
  max-width: 24rem;
}
.demo-label { margin-bottom: 0.75rem; }

.notif {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: rotate(1.5deg);
}
.notif-head { display: flex; gap: 0.75rem; align-items: flex-start; }
.notif-head .badge-dot { margin-top: 0.3rem; }
.notif-meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.notif-title { font-size: 0.9375rem; font-weight: 600; line-height: 1.35; }
.notif-body {
  background: var(--note-butter);
  color: var(--on-color);
  border-radius: var(--radius-card);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}
.notif-body strong { font-weight: 600; }
.notif-price { font-family: var(--font-mono); font-weight: 600; font-size: 1rem; }
.notif-body .tag { margin-top: 0.5rem; }
.notif-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.notif-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── Features ───────────────────────────────────────────────── */
.features { padding-bottom: 4.5rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 2.5rem;
}

.feature-card {
  border-top: 1px solid var(--border-strong);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-icon { font-size: 1.5rem; line-height: 1; margin-bottom: 0.5rem; }
.feature-title { font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.25; }
.feature-desc { font-size: 0.9375rem; color: var(--text-muted); }

/* ── Secciones ──────────────────────────────────────────────── */
.how, .signup { padding: 4.5rem 0; border-top: 1px solid var(--border); }
.signup { padding-bottom: 6rem; }

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-wrap: balance;
  margin-top: 0.75rem;
}
.section-head > p:not(.section-label) {
  color: var(--text-muted);
  margin-top: 1rem;
  max-width: 26rem;
}

@media (min-width: 861px) {
  .split > .section-head { position: sticky; top: 6rem; }
}

/* ── Pasos ("Cómo funciona") ────────────────────────────────── */
.steps-grid { list-style: none; }

.step-card {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}
.step-card:first-child { border-top-color: var(--border-strong); }
.step-card:last-child { padding-bottom: 0; }

.step-num {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding-top: 0.3rem;
}

.step-title { display: block; font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.25; }
.step-desc { display: block; font-size: 0.9375rem; color: var(--text-muted); margin-top: 0.375rem; max-width: 34rem; }

/* ── Canales ────────────────────────────────────────────────── */
.channels-block {
  padding: 3.5rem 0;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}
.channels-block .split { align-items: center; }
.channels-block .section-head { position: static; }

.channels-block h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-top: 0.5rem;
}

.channels-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.channel-badge {
  flex: 1 1 12rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
}

.channel-icon { width: 26px; height: 26px; flex-shrink: 0; fill: currentColor; }

.channel-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.channel-name { font-weight: 600; font-size: 0.9375rem; }

.channel-tag,
.plan-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.channel-tag.accent,
.plan-tag.accent {
  background: var(--yellow);
  color: var(--on-color);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
}

/* ── Tarjeta del formulario ─────────────────────────────────── */
#form { scroll-margin-top: 5.5rem; }

.form-card {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 2rem;
  transition: background 0.2s, border-color 0.2s;
}

/* ── Alquiler / Compra ──────────────────────────────────────── */
.toggle-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.buy-freq-hint {
  display: block;
  margin-top: -1.25rem;
  margin-bottom: 1.5rem;
}
.buy-freq-hint[hidden] { display: none; }   /* display:block gana al [hidden] del navegador: salía también en alquiler */

.toggle-btn {
  flex: 1;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border-input);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.toggle-btn:hover:not(.active) { color: var(--text); border-color: var(--border-strong); }
.toggle-btn.active {
  border-color: var(--border-strong);
  background: var(--note-butter);
  color: var(--on-color);
}

/* ── Campos ─────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto; /* label row · input row · hint row */
  column-gap: 1rem;
  row-gap: 0.375rem;
}

/* Dissolve the .field wrapper so its children are direct grid items,
   then place each one explicitly — no subgrid required */
.field-row .field { display: contents; }

.field-row .field:first-child > label  { grid-column: 1; grid-row: 1; align-self: end; }
.field-row .field:last-child  > label  { grid-column: 2; grid-row: 1; align-self: end; }
.field-row .field:first-child > input,
.field-row .field:first-child > select { grid-column: 1; grid-row: 2; }
.field-row .field:last-child  > input,
.field-row .field:last-child  > select { grid-column: 2; grid-row: 2; }
.field-row .field:first-child > small  { grid-column: 1; grid-row: 3; }
.field-row .field:last-child  > small  { grid-column: 2; grid-row: 3; }

.field + .field,
.field-row + .field,
.field + .field-row,
.field-row + .field-row { margin-top: 1.25rem; }

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}
label > .ic { color: var(--text-muted); margin-right: 0.25rem; }

.optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-left: 0.2em;
}

input:not([type="checkbox"]),
select {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  background: var(--input-bg);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-btn);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input[type="number"] { font-family: var(--font-mono); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238F8C83' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

select option { background: var(--input-bg); color: var(--text); }

input:not([type="checkbox"]):hover:not(:disabled),
select:hover:not(:disabled) { border-color: var(--text-faint); }

input:not([type="checkbox"]):focus,
select:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: var(--focus-ring);
}

input::placeholder { color: var(--text-faint); }

input:disabled, select:disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

small {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Barrios ────────────────────────────────────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-input);
  background: var(--input-bg);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.checkbox-item:hover { border-color: var(--border-strong); }
.checkbox-item:has(input:checked) {
  border-color: var(--border-strong);
  background: var(--note-butter);
  color: var(--on-color);
}

.checkbox-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--on-color);
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

/* ── Mensajes ───────────────────────────────────────────────── */
.form-message {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  line-height: 1.55;
  margin-top: 1.25rem;
  animation: fadeSlideIn 0.2s ease;
}
.form-message.hidden { display: none; }
.form-message strong { font-size: 0.9375rem; font-weight: 600; }

.form-message.success {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
}

.form-message.error { border: 1px solid var(--danger); }
.form-message.error strong { color: var(--danger); }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Botones del formulario ─────────────────────────────────── */
#submitBtn, #accSubmit {
  width: 100%;
  margin-top: 1.5rem;
}

.form-note {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cuenta (paso 0) ────────────────────────────────────────── */
.account-step { margin-bottom: 1rem; }
.account-intro { font-size: 0.9375rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.account-step.hidden { display: none; }
.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.3rem 0;
  display: block;
  margin: 0.75rem auto 0;
}
.link-btn:hover { color: var(--text); }

/* ── Conectar Telegram (tras el alta) ───────────────────────── */
.tg-step {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0 0.25rem;
  animation: fadeSlideIn 0.2s ease;
}
.tg-step.hidden,
#alertForm.hidden,
.toggle-group.hidden,
.checkbox-grid.hidden { display: none; }

.tg-step strong { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1; letter-spacing: -0.01em; }
.tg-step > p { font-size: 0.9375rem; color: var(--text-muted); }

.tg-connect-btn { width: 100%; margin-top: 0.5rem; }
/* Secundario: nota adhesiva */
.tg-connect-btn.secondary {
  background: var(--note-butter);
  color: var(--on-color);
  border-color: transparent;
  box-shadow: none;
}
.tg-connect-btn.secondary:hover { background: var(--note-butter); border-color: var(--border-strong); }

.tg-manual {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.tg-manual summary { cursor: pointer; }
.tg-manual summary:hover { color: var(--text); }
.tg-manual p { margin: 0.6rem 0 0.4rem; }
.tg-manual a { color: inherit; font-weight: 600; }
.tg-manual code {
  display: block;
  user-select: all;
  word-break: break-all;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
}

/* ── Footer ─────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); }

.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 2rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.footer-legal-links { margin-left: auto; }

/* ── Página Premium ─────────────────────────────────────────── */
.premium-hero { padding: 4rem 0 2.5rem; }
.premium-hero h1 { max-width: 16ch; }

.content {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter) 6rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--text); }

.plans-grid {
  display: grid;
  gap: 1.25rem;
  max-width: 52rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) { .plans-grid { grid-template-columns: 1fr 1fr; } }

.plan-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.plan-card.featured { border-color: var(--border-strong); }
.plan-card .plan-tag { align-self: flex-start; }

.plan-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.plan-price { font-family: var(--font-mono); font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.plan-price .per { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }

.plan-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.plan-card li { display: flex; align-items: flex-start; gap: 0.6rem; }
.feat-check { flex-shrink: 0; line-height: 1.55; }

.notify-btn { width: 100%; margin-top: auto; }
.plan-card .form-note,
.content > .form-note { text-align: left; }

/* ── Páginas legales (su CSS propio vive en cada HTML) ──────── */
main > .legal-content { max-width: var(--wrap); padding: 2.5rem var(--gutter) 4rem; }
main > .legal-content > * { max-width: 44rem; }
main > .legal-content h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 0.75rem;
}
main > .legal-content .legal-note { border-radius: var(--radius-btn); }
main > .legal-content .legal-nav { margin-left: 0; padding-left: 0; padding-right: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .split, .hero-grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 0; }
  .hero-demo { justify-self: start; }
  .feature-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .how, .signup { padding: 3.5rem 0; }
  .footer-legal-links { margin-left: 0; }
}

@media (max-width: 520px) {
  :root { --gutter: 1.25rem; }
  .field-row { grid-template-columns: 1fr; }
  /* Reset explicit placements so children stack in source order */
  .field-row .field:first-child > label,
  .field-row .field:first-child > input,
  .field-row .field:first-child > select,
  .field-row .field:first-child > small,
  .field-row .field:last-child  > label,
  .field-row .field:last-child  > input,
  .field-row .field:last-child  > select,
  .field-row .field:last-child  > small {
    grid-column: 1; grid-row: auto; align-self: auto;
  }
  .field-row .field:last-child > label { margin-top: 0.875rem; }
  .form-card { padding: 1.5rem 1.25rem; }
  .plan-card { padding: 1.25rem; }
  .checkbox-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .nav-controls { gap: 0.25rem; }
  .nav-login { padding: 0.4rem 0.7rem; }
  .nav-account-email { display: none; }          /* en móvil, solo la inicial */
  .nav-account-btn { padding: 0.25rem 0.45rem 0.25rem 0.25rem; gap: 0.3rem; }
  .notif { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-copy .badge-dot { animation: none; }
}

/* Móviles estrechos: con 320–390 px «Premium» se salía por la derecha. Por debajo de
   400 px queda solo el isotipo. Va al final para ganar a las reglas responsive de arriba. */
@media (max-width: 399px) {
  .logo-name { display: none; }
  .nav-inner { gap: 0.5rem; }
}
