@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ============ Tokens ============ */
/* Modo claro (default) */
:root {
  --bg: #f5f5fa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8f8fc;
  --surface-3: #eef0f6;
  --border: rgba(20, 20, 43, 0.10);
  --border-strong: rgba(20, 20, 43, 0.18);

  --text: #14142b;
  --text-dim: #4a4a68;
  --text-mute: #6c6c88;

  --primary: #6366f1;
  --primary-bright: #4f46e5;
  --primary-deep: #4338ca;
  --accent: #f97316;
  --success: #059669;
  --danger: #dc2626;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.6) inset, 0 8px 22px rgba(20,20,43,0.06);
  --shadow-glow: 0 0 0 1px rgba(99,102,241,0.25), 0 12px 32px rgba(99,102,241,0.15);

  --bg-radial:
    radial-gradient(900px 600px at 12% -10%, rgba(99,102,241,0.07), transparent 60%),
    radial-gradient(700px 500px at 95% 8%, rgba(236,72,153,0.05), transparent 55%),
    radial-gradient(800px 600px at 50% 100%, rgba(6,182,212,0.04), transparent 60%);

  --bg-glass: rgba(255,255,255,0.85);
  --input-bg: rgba(20, 20, 43, 0.04);
  --input-bg-hover: rgba(20, 20, 43, 0.08);
  --input-bg-soft: rgba(20, 20, 43, 0.05);
  --shadow-inset: rgba(20, 20, 43, 0.04);
  --btn-highlight: rgba(255,255,255,0.4);
  --scrim: rgba(20,20,43,0.45);
}

/* Modo oscuro */
[data-theme="dark"] {
  --bg: #08080f;
  --bg-elev: #0f0f1f;
  --surface: #14142b;
  --surface-2: #1c1c38;
  --surface-3: #252548;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f5f5fa;
  --text-dim: #a4a4c0;
  --text-mute: #6a6a86;

  --primary: #6366f1;
  --primary-bright: #818cf8;
  --primary-deep: #4f46e5;
  --accent: #f97316;
  --success: #10b981;
  --danger: #ef4444;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 18px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 1px rgba(99,102,241,0.25), 0 18px 50px rgba(99,102,241,0.18);

  --bg-radial:
    radial-gradient(900px 600px at 12% -10%, rgba(99,102,241,0.18), transparent 60%),
    radial-gradient(700px 500px at 95% 8%, rgba(236,72,153,0.12), transparent 55%),
    radial-gradient(800px 600px at 50% 100%, rgba(6,182,212,0.08), transparent 60%);

  --bg-glass: rgba(8,8,15,0.78);
  --input-bg: rgba(255,255,255,0.03);
  --input-bg-hover: rgba(255,255,255,0.07);
  --input-bg-soft: rgba(255,255,255,0.04);
  --shadow-inset: rgba(0,0,0,0.18);
  --btn-highlight: rgba(255,255,255,0.18);
  --scrim: rgba(8,8,15,0.78);
}

:root {
  --grad-1: linear-gradient(135deg, #6366f1, #ec4899);
  --grad-2: linear-gradient(135deg, #f97316, #ec4899);
  --grad-3: linear-gradient(135deg, #ef4444, #7c3aed);
  --grad-4: linear-gradient(135deg, #06b6d4, #6366f1);
  --grad-5: linear-gradient(135deg, #10b981, #6366f1);
  --grad-6: linear-gradient(135deg, #ec4899, #8b5cf6);
  --grad-7: linear-gradient(135deg, #f59e0b, #ef4444);
  --grad-8: linear-gradient(135deg, #14b8a6, #6366f1);
  --grad-9: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --grad-10: linear-gradient(135deg, #f97316, #6366f1);
  --grad-11: linear-gradient(135deg, #ec4899, #f59e0b);
  --grad-12: linear-gradient(135deg, #6366f1, #06b6d4);

  --radius: 14px;
  --radius-lg: 22px;

  --t-fast: 120ms cubic-bezier(.4,.0,.2,1);
  --t-med: 240ms cubic-bezier(.4,.0,.2,1);

  /* Escala de espaciado consistente. Usar estas en lugar de magic numbers
     cuando sea posible (ya hay mucho legacy con valores ad-hoc). */
  --space-2: 4px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 20px;
  --space-7: 24px;
  --space-8: 32px;
  --space-9: 40px;
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--bg-radial);
  z-index: -1;
}
button { font: inherit; cursor: pointer; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: transparent; border: none; outline: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ============ Botones ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: transform var(--t-fast), background var(--t-med), box-shadow var(--t-med);
  position: relative;
  user-select: none;
}
.btn-small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 0 1px 0 var(--btn-highlight) inset, 0 8px 20px rgba(99,102,241,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 var(--btn-highlight) inset, 0 12px 26px rgba(99,102,241,0.45); }
.btn-primary:active { transform: translateY(0); }
/* Disabled: en lugar de bajar opacity (que confunde — parece un estado de
   "loading" o "casi-disponible"), pintamos el botón como ghost mate y
   forzamos cursor not-allowed. cursor:progress se reserva para .is-loading. */
.btn-primary[disabled],
.btn[disabled] {
  background: var(--input-bg) !important;
  color: var(--text-mute) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none;
}
.btn.is-loading { cursor: progress; }
.btn-ghost {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--input-bg-hover); border-color: var(--border-strong); }

.btn-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Login ============ */
.login-page { min-height: 100vh; min-height: 100dvh; overflow: hidden; }
.login-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  min-height: 100vh; min-height: 100dvh;
}

/* --- Aside (panel izquierdo con ticket-stack) --- */
.login-aside {
  position: relative;
  overflow: hidden;
  padding: 48px 56px;
  display: flex; flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(1100px 700px at -10% -10%, rgba(99,102,241,0.35), transparent 55%),
    radial-gradient(800px 600px at 110% 0%, rgba(236,72,153,0.28), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(6,182,212,0.18), transparent 60%),
    linear-gradient(155deg, #0a0a18 0%, #14142b 100%);
  border-right: 1px solid var(--border);
}
.aside-blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.45;
  animation: float 22s ease-in-out infinite;
  pointer-events: none;
}
.aside-blob-a { width: 420px; height: 420px; background: #6366f1; top: -120px; left: -80px; }
.aside-blob-b { width: 360px; height: 360px; background: #ec4899; top: 38%; right: -110px; animation-delay: -8s; }
.aside-blob-c { width: 380px; height: 380px; background: #06b6d4; bottom: -140px; left: 28%; animation-delay: -15s; }
@keyframes float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(60px, -40px) scale(1.08); }
  66% { transform: translate(-40px, 30px) scale(0.95); }
}
.aside-header { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; }
.aside-brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.brand-mark {
  display: inline-flex; gap: 6px; padding: 7px 11px;
  background: var(--input-bg-hover); border: 1px solid var(--border);
  border-radius: 100px;
}
.brand-mark.small { padding: 4px 8px; gap: 4px; vertical-align: middle; }
.brand-mark-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-bright); box-shadow: 0 0 12px var(--primary); }
.brand-mark-dot:nth-child(2) { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-mark.small .brand-mark-dot { width: 6px; height: 6px; }

/* Ticket stack */
.ticket-stack {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  gap: 14px;
  margin: 24px 0;
  perspective: 1200px;
}
.ticket {
  display: flex;
  background: linear-gradient(135deg, rgba(28,28,56,0.92), rgba(20,20,43,0.92));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35), 0 1px 0 rgba(255,255,255,0.08) inset;
  animation: ticketIn 700ms cubic-bezier(.2,.8,.2,1) backwards, ticketFloat 8s ease-in-out infinite;
  transform-origin: left center;
}
.ticket-1 { animation-delay: 0ms, 0s; transform: rotate(-1.5deg) translateX(0); }
.ticket-2 { animation-delay: 120ms, -2.5s; transform: rotate(0.8deg) translateX(28px); }
.ticket-3 { animation-delay: 240ms, -5s; transform: rotate(-0.6deg) translateX(8px); }
@keyframes ticketIn {
  from { opacity: 0; transform: translateY(20px) rotate(-3deg); }
}
@keyframes ticketFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -4px; }
}
.ticket-stub {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  padding: 18px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 70px;
  position: relative;
  font-family: 'Space Grotesk', sans-serif;
  color: #fff;
}
.ticket-stub::after {
  content: '';
  position: absolute; right: -1px; top: 0; bottom: 0;
  width: 2px;
  background-image: radial-gradient(circle at center, rgba(8,8,15,0.95) 1.5px, transparent 1.6px);
  background-size: 4px 8px;
  background-repeat: repeat-y;
}
.ticket-2 .ticket-stub { background: linear-gradient(135deg, #ef4444, #f97316); }
.ticket-3 .ticket-stub { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.ticket-stub-day { font-size: 26px; font-weight: 700; line-height: 1; }
.ticket-stub-month { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; margin-top: 4px; opacity: 0.9; }
.ticket-body { padding: 14px 18px; flex: 1; min-width: 0; }
.ticket-genre {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); font-weight: 600;
  margin-bottom: 4px;
}
.ticket-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticket-venue { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.ticket-buddies {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--primary-bright); font-weight: 600;
  padding: 3px 9px; border-radius: 100px;
  background: rgba(99,102,241,0.14);
  border: 1px solid rgba(99,102,241,0.28);
}
.ticket-buddies .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary-bright);
  box-shadow: 0 0 0 0 rgba(99,102,241, 0.5);
  animation: pulse 2s infinite;
}

.aside-quote { position: relative; z-index: 2; max-width: 480px; }
.aside-headline {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(24px, 2.6vw, 30px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-weight: 700;
}
.aside-sub { color: var(--text-dim); margin: 0; font-size: 15px; }

/* --- Main (panel derecho con form) --- */
.login-main {
  display: grid; place-items: center;
  padding: 32px;
  position: relative;
  background: var(--bg);
}
.login-main::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(500px 360px at 100% 0%, rgba(99,102,241,0.10), transparent 60%),
    radial-gradient(420px 320px at 0% 100%, rgba(236,72,153,0.06), transparent 60%);
  pointer-events: none;
}
.login-shell {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}
.login-mobile-brand {
  display: none;
  align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.login-pill {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--primary-bright);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.28);
  padding: 5px 12px; border-radius: 100px;
  margin-bottom: 18px;
}
.login-h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 3vw, 34px);
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  font-weight: 700;
}
.login-lede { color: var(--text-dim); margin: 0 0 26px; font-size: 15px; line-height: 1.5; }
.login-form { display: block; }
.login-trust {
  list-style: none; padding: 0;
  margin: 18px 0 0;
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12px; color: var(--text-mute);
}
.login-trust li { display: inline-flex; align-items: center; gap: 6px; }
.login-trust svg { color: var(--success); }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  transition: border var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.field-pw { position: relative; }
.field-pw input { padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  background: none; border: none; color: var(--text-mute); padding: 8px; border-radius: 8px;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.pw-toggle:hover { color: var(--text); background: var(--input-bg-hover); }
.pw-toggle:active { transform: translateY(-50%) scale(0.92); }

/* Animación del ojo (mostrar/ocultar contraseña).
   Estado por defecto = ojo abierto. .is-closed = ojo cerrado, párpados se
   pegan en el centro como una pestaña. La curva CSS easeOutBack da el rebote. */
.eye-svg { display: block; overflow: visible; }
.eye-svg .eye-lid,
.eye-svg .eye-iris,
.eye-svg .eye-pupil,
.eye-svg .eye-glint,
.eye-svg .eye-lash {
  transition:
    d 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 200ms ease,
    r 240ms ease;
  transform-origin: 12px 12px;
  transform-box: fill-box;
}
.eye-svg .eye-lash {
  opacity: 0;
  stroke-dasharray: 0 24;
}
.eye-svg .eye-iris,
.eye-svg .eye-pupil,
.eye-svg .eye-glint {
  opacity: 1;
}

/* === Estado: ojo cerrado === */
.pw-toggle.is-closed .eye-svg .eye-lid-top {
  d: path('M1 12s4-2 11-2 11 2 11 2');
}
.pw-toggle.is-closed .eye-svg .eye-lid-bottom {
  d: path('M1 12s4 2 11 2 11-2 11-2');
}
.pw-toggle.is-closed .eye-svg .eye-iris,
.pw-toggle.is-closed .eye-svg .eye-pupil,
.pw-toggle.is-closed .eye-svg .eye-glint {
  opacity: 0;
  transform: scale(0.1);
}
.pw-toggle.is-closed .eye-svg .eye-lash {
  opacity: 1;
  stroke-dasharray: 24 0;
  transition-delay: 60ms;
}

/* Pestañas pequeñas que parpadean al cerrar — mediante pseudo "guiño" */
@keyframes eyeBlink {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.3); }
}
.pw-toggle.just-toggled .eye-svg {
  animation: eyeBlink 320ms ease-out;
}

/* Fallback: navegadores que no soportan `d:` en CSS (Firefox <129) reciben
   un cambio de opacidad limpio. */
@supports not (d: path('M0 0')) {
  .pw-toggle.is-closed .eye-svg .eye-lid-top,
  .pw-toggle.is-closed .eye-svg .eye-lid-bottom {
    transform: translateY(0);
  }
  .pw-toggle.is-closed .eye-svg .eye-iris,
  .pw-toggle.is-closed .eye-svg .eye-pupil,
  .pw-toggle.is-closed .eye-svg .eye-glint {
    opacity: 0;
  }
}

.field-textarea textarea { resize: vertical; min-height: 60px; }
.field-counter { display: block; text-align: right; color: var(--text-mute); font-size: 12px; margin-top: 4px; }

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 4px 0 12px;
  font-weight: 500;
  padding: 0;
}
/* Cuando tiene contenido, lo pintamos como "card" de error con bg/border:
   más fácil de ver, especialmente en formularios largos donde un error
   suelto en color rojo se pierde entre los labels normales. */
.form-error:not(:empty) {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.10);
  border: 1px solid rgba(220, 38, 38, 0.28);
}
[data-theme="dark"] .form-error:not(:empty) {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.32);
}
.form-error:empty { display: none; }

.login-footnote {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
}

/* ============ App shell ============ */
/*
  Layout:
    - Desktop: top-nav horizontal sticky (brand + nav + bell + avatar dropdown).
      Sin sidebar. Main content full-width con max-width.
    - Mobile: topbar mínima (brand + bell). Bottom-nav fija con 5 items.
*/
.app-page {
  padding-bottom: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700;
  flex: 0 0 auto;
}
.topbar-brand:hover { opacity: 0.85; }
.topbar-title { font-family: 'Space Grotesk', sans-serif; font-size: 18px; letter-spacing: -0.02em; }

/* Nav inline desktop. En mobile la ocultamos (la cubre la bottom-nav). */
.topbar-nav-desktop {
  display: flex; gap: 2px;
  flex: 1;
}
.topnav-link {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14.5px; font-weight: 500;
  color: var(--text-dim);
  transition: color var(--t-fast), background var(--t-fast);
}
.topnav-link:hover { color: var(--text); background: var(--input-bg-soft); }
.topnav-link.is-active {
  color: var(--text);
  background: rgba(99,102,241,0.12);
}
.topnav-link.is-active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: -13px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}
.topnav-badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--primary);
  color: #fff;
  border-radius: 100px;
  font-size: 10px; font-weight: 700;
}

.topbar-actions {
  display: flex; align-items: center; gap: 10px;
  flex: 0 0 auto;
}
.topbar-bell {
  /* La campana ya tiene .icon-btn estilado; aquí sólo aseguramos visibilidad. */
  position: relative;
}

.topbar-avatar-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.topbar-avatar-btn:hover {
  background: var(--input-bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.topbar-avatar-btn[aria-expanded="true"] {
  border-color: rgba(99,102,241,0.45);
  background: rgba(99,102,241,0.10);
}
.topbar-avatar {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--grad-1);
  color: #fff;
  font-weight: 700; font-size: 13px;
}
.topbar-avatar-chevron { transition: transform var(--t-fast); }
.topbar-avatar-btn[aria-expanded="true"] .topbar-avatar-chevron { transform: rotate(180deg); }

/* User menu dropdown */
.user-menu {
  position: absolute;
  top: 56px; right: 16px;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  z-index: 60;
  overflow: hidden;
  padding: 6px;
  animation: modalIn 200ms ease-out;
}
[data-theme="dark"] .user-menu { box-shadow: 0 24px 60px rgba(0,0,0,0.55); }
.user-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background var(--t-fast);
}
.user-menu-header:hover { background: var(--input-bg-soft); }
.user-menu-avatar {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-1);
  color: #fff;
  font-weight: 700; font-size: 15px;
  flex: 0 0 36px;
}
.user-menu-info { display: flex; flex-direction: column; min-width: 0; }
.user-menu-name {
  font-weight: 600; font-size: 14px;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu-sub {
  font-size: 12px; color: var(--text-mute); margin-top: 1px;
}
.user-menu-divider {
  height: 1px; background: var(--border);
  margin: 6px 4px;
}
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--text-dim);
  background: transparent; border: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--t-fast), color var(--t-fast);
}
.user-menu-item:hover { background: var(--input-bg-soft); color: var(--text); }
.user-menu-item svg { color: var(--text-mute); flex: 0 0 18px; transition: color var(--t-fast); }
.user-menu-item:hover svg { color: var(--text); }
.user-menu-logout { color: var(--danger); }
.user-menu-logout svg { color: var(--danger); }
.user-menu-logout:hover { background: rgba(220,38,38,0.10); color: var(--danger); }
.user-menu-logout:hover svg { color: var(--danger); }
[data-theme="dark"] .user-menu-logout { color: #fca5a5; }
[data-theme="dark"] .user-menu-logout svg { color: #fca5a5; }
[data-theme="dark"] .user-menu-logout:hover { background: rgba(239,68,68,0.12); color: #fca5a5; }

/* Theme button: alterna icono sun/moon (mismo patrón que el viejo drawer-theme). */
.user-menu-action .icon-sun,
.profile-account-item .icon-sun { display: none; }
[data-theme="dark"] .user-menu-action .icon-sun,
[data-theme="dark"] .profile-account-item .icon-sun { display: inline-block; }
[data-theme="dark"] .user-menu-action .icon-moon,
[data-theme="dark"] .profile-account-item .icon-moon { display: none; }

/* Bottom-nav: sólo visible en mobile (el media query la oculta en desktop). */
.bottom-nav {
  display: none;
}

.app-main { max-width: 1200px; margin: 0 auto; padding: 32px; }
.page-loading { display: grid; place-items: center; min-height: 50vh; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary-bright);
  animation: spin 0.8s linear infinite;
}

/* ============ Home search section (Ticketmaster-style) ============ */
.home-search-section {
  margin: 0 -32px 36px;
  padding: 56px 32px 44px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 400px at 50% -10%, rgba(99,102,241,0.16), transparent 65%),
    var(--surface);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .home-search-section {
  background:
    radial-gradient(1100px 400px at 50% -10%, rgba(99,102,241,0.10), transparent 65%),
    var(--bg-elev);
}
.home-search-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}
.home-h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--text);
}
.home-tagline {
  color: var(--text-dim);
  font-size: clamp(15px, 1.6vw, 17px);
  margin: 0 0 24px;
}

/* Search bar: pill grande con icono+input+botón submit. */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  box-shadow: 0 4px 14px rgba(20,20,43,0.06), 0 1px 2px rgba(20,20,43,0.04);
  padding: 4px 4px 4px 16px;
  max-width: 620px;
  margin: 0 auto;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
[data-theme="dark"] .search-bar {
  box-shadow: 0 4px 18px rgba(0,0,0,0.32), 0 1px 2px rgba(0,0,0,0.24);
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(99,102,241,0.18), 0 0 0 4px rgba(99,102,241,0.14);
}
.search-bar-icon { color: var(--text-mute); flex: 0 0 20px; }
.search-bar-input {
  flex: 1;
  min-width: 0;
  padding: 14px 12px;
  background: transparent;
  border: 0;
  font-size: 15px;
  color: var(--text);
}
.search-bar-input::placeholder { color: var(--text-mute); }
.search-bar-submit {
  flex: 0 0 auto;
  padding: 12px 22px;
  border: 0;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-med);
  box-shadow: 0 4px 12px rgba(99,102,241,0.32);
}
.search-bar-submit:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(99,102,241,0.42); }
.search-bar-submit:active { transform: translateY(0); }

/* Filtros como pills sutiles debajo de la search. */
.search-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.search-filter {
  padding: 8px 32px 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238e8eaa' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
.search-filter:hover { border-color: var(--border-strong); background-color: var(--input-bg-soft); }
.search-filter:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.18); }
.search-filter option { background: var(--surface); color: var(--text); }

/* ============ Sections ============ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.section-header > div { display: flex; align-items: baseline; gap: 12px; }
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.02em; margin: 0;
  font-weight: 700;
}
.section-count { color: var(--text-mute); font-size: 14px; }

/* ============ Events grid (Ticketmaster-style cards) ============ */
.events-grid {
  display: grid;
  /* Cards más grandes que antes (320px min vs 280px) para que la imagen
     respire más y la tipografía no quede apretada. */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.event-card-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform var(--t-med), border var(--t-med), box-shadow var(--t-med);
  display: flex; flex-direction: column;
  cursor: pointer;
  position: relative;
}
.event-card-link:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 36px rgba(20,20,43,0.10), 0 4px 8px rgba(20,20,43,0.04);
}
[data-theme="dark"] .event-card-link:hover {
  box-shadow: 0 18px 40px rgba(0,0,0,0.45), 0 4px 8px rgba(0,0,0,0.30);
}

/* Imagen dominante: aspect-ratio 16:10 para que sea siempre el ~60% de la
   card visual. Esto es el patrón de Ticketmaster/Eventbrite/Songkick. */
.event-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  width: 100%;
}
@supports not (aspect-ratio: 16 / 10) {
  .event-thumb { padding-top: 62.5%; }
}
.event-thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.55));
}
.event-thumb-date {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: rgba(255,255,255,0.95);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(20,20,43,0.18);
}
.event-thumb-day {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--text);
}
.event-thumb-month {
  font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-mute);
  margin-top: 2px;
  font-weight: 600;
}
.event-thumb-genre {
  position: absolute; bottom: 12px; left: 12px; z-index: 2;
  font-size: 10.5px; font-weight: 600;
  background: rgba(255,255,255,0.92);
  color: #14142b;
  padding: 4px 10px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.event-card-body {
  padding: 18px 18px 14px;
  flex: 1;
  display: flex; flex-direction: column;
  gap: 6px;
}
.event-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.25;
  margin: 0;
  color: var(--text);
  /* Truncar a 2 líneas para mantener altura de card consistente. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-card-venue {
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-card-country {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 4px;
  background: rgba(99,102,241,0.14);
  color: var(--primary-bright);
  vertical-align: middle;
}

/* Status badges (cancelled/sold_out/postponed/...) sobre la imagen del thumb */
.event-thumb-status {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(10px);
}
.event-thumb-status.status-cancelled,
.event-thumb-status.status-postponed { background: rgba(220,38,38,0.92); color: #fff; }
.event-thumb-status.status-sold_out { background: rgba(0,0,0,0.78); color: #fff; }
.event-thumb-status.status-rescheduled { background: rgba(245,158,11,0.92); color: #fff; }
.event-thumb-status.status-off_sale { background: rgba(75,85,99,0.85); color: #fff; }
.event-card-link.is-cancelled .event-card-title { text-decoration: line-through; opacity: 0.7; }

/* Banner de status en detalle de evento */
.event-status-banner {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid;
}
.event-status-banner.status-cancelled,
.event-status-banner.status-postponed {
  background: rgba(220,38,38,0.10);
  border-color: rgba(220,38,38,0.35);
  color: #b91c1c;
}
[data-theme="dark"] .event-status-banner.status-cancelled,
[data-theme="dark"] .event-status-banner.status-postponed {
  color: #fca5a5;
}
.event-status-banner.status-sold_out {
  background: var(--input-bg-soft);
  border-color: var(--border);
  color: var(--text-dim);
}
.event-status-banner.status-rescheduled {
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.35);
  color: #b45309;
}
[data-theme="dark"] .event-status-banner.status-rescheduled {
  color: #fef3c7; /* WCAG AA contra el background semi-translúcido en oscuro */
}
.event-status-banner.status-off_sale {
  background: var(--input-bg-soft);
  border-color: var(--border);
  color: var(--text-dim);
}

/* Action row debajo del card de descripción */
.event-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
}
.event-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px 16px;
  font-size: 13px;
  gap: 8px;
}
.event-card-price { color: var(--text-dim); }
.event-card-price strong { color: var(--text); font-weight: 700; }
.event-card-buddies { display: inline-flex; align-items: center; gap: 6px; color: var(--primary-bright); font-weight: 500; }
.event-card-buddies .pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary-bright);
  box-shadow: 0 0 0 0 rgba(99,102,241, 0.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}

/* ============ Event detail ============ */
.event-detail { max-width: 980px; margin: 0 auto; }
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--text); }
.event-hero {
  height: 280px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  display: flex; align-items: flex-end;
  margin-bottom: 24px;
}
.event-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.85));
}
.event-hero-content {
  position: relative; z-index: 1;
  padding: 28px 32px;
  width: 100%;
}
.event-hero-date { font-size: 14px; color: rgba(255,255,255,0.85); margin: 0 0 6px; font-weight: 500; }
.event-hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05; letter-spacing: -0.03em;
  margin: 0 0 6px; font-weight: 700;
  color: #fff;
}
.event-hero-venue { font-size: 16px; color: rgba(255,255,255,0.78); margin: 0 0 12px; }
.genre-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.genre-tag {
  font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  padding: 4px 10px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

.event-body { display: grid; grid-template-columns: 1fr; gap: 18px; }
.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.card-title { font-family: 'Space Grotesk', sans-serif; font-size: 17px; letter-spacing: -0.01em; margin: 0 0 14px; }
.card-sub { color: var(--text-dim); font-size: 14px; margin: -8px 0 14px; }
.event-description { color: var(--text-dim); line-height: 1.55; margin: 0 0 18px; }
.event-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.meta-item {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); font-weight: 600; }
.meta-value { font-size: 14px; font-weight: 600; }

/* ============ Intent form ============ */
.intent-card.is-active { box-shadow: var(--shadow-glow); border-color: rgba(99,102,241,0.4); }
.intent-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.intent-header .card-title { margin: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-slider {
  width: 42px; height: 24px; border-radius: 100px;
  background: var(--input-bg-hover);
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--t-med), border-color var(--t-med);
}
.switch-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(20,20,43,0.18);
  transition: transform var(--t-med);
}
.switch input:checked + .switch-slider { border-color: transparent; }
.switch input:checked + .switch-slider { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); }
.switch input:checked + .switch-slider::after { transform: translateX(18px); }
.switch-label { font-size: 14px; font-weight: 500; }

.intent-form { margin-top: 18px; }
.intent-row { margin-bottom: 16px; }
.intent-row-double { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.chip-group { display: block; }
.chip-group-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.chip-group-options { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 13px; font-weight: 500;
  transition: all var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-selected {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.5);
  color: var(--primary-bright);
}

.age-range { display: flex; align-items: center; gap: 8px; }
.age-range input {
  width: 64px;
  text-align: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 4px;
  font-weight: 600;
}
.age-range input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.age-sep { color: var(--text-mute); }

.intent-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.intent-status { font-size: 13px; color: var(--text-dim); }
.intent-status.is-saved { color: var(--success); }

/* ============ Buddies list ============ */
.badge {
  display: inline-block;
  background: rgba(99,102,241,0.18);
  color: var(--primary-bright);
  font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 100px;
  margin-left: 4px;
}
.buddies-list { display: flex; flex-direction: column; gap: 10px; }
.buddy-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  transition: border var(--t-fast), box-shadow var(--t-med), transform var(--t-fast);
}
.buddy-row:hover {
  border-color: rgba(99,102,241,0.35);
  box-shadow: 0 6px 18px rgba(20,20,43,0.06);
  transform: translateY(-1px);
}
[data-theme="dark"] .buddy-row:hover {
  box-shadow: 0 8px 22px rgba(0,0,0,0.32);
}
.buddy-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--grad-1);
  flex: 0 0 42px;
  position: relative;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}
.buddy-info { flex: 1; min-width: 0; }
.buddy-name { font-weight: 600; font-size: 15px; }
.buddy-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.buddy-tag { font-size: 11px; padding: 2px 8px; border-radius: 100px; background: var(--input-bg-hover); color: var(--text-dim); }
.buddy-note {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.4;
  /* Truncar a 2 líneas con ellipsis. Una nota de 280 chars hacía 5-6
     líneas y desequilibraba la card; el usuario abre el chat para ver
     el detalle completo. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-dim);
  background: var(--input-bg);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.empty-state p { margin: 0; }

/* ============ Profile ============ */
.profile-page { max-width: 640px; margin: 0 auto; }
.page-title { font-family: 'Space Grotesk', sans-serif; font-size: 28px; letter-spacing: -0.02em; margin: 0 0 20px; }
.profile-info { list-style: none; padding: 0; margin: 0 0 18px; }
.profile-info li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.profile-info li:last-child { border-bottom: none; }
.profile-info li span { color: var(--text-dim); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(20,20,43,0.18);
  opacity: 0; pointer-events: none;
  transition: all var(--t-med);
  z-index: 250;
  max-width: calc(100% - 32px);
}
[data-theme="dark"] .toast { box-shadow: 0 12px 30px rgba(0,0,0,0.5); }
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { border-color: rgba(220,38,38,0.55); color: var(--danger); }
.toast.is-success { border-color: rgba(5,150,105,0.55); color: var(--success); }
[data-theme="dark"] .toast.is-error { color: #fca5a5; }
[data-theme="dark"] .toast.is-success { color: #86efac; }
@media (max-width: 720px) {
  /* Por encima del bottom-nav */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ============ Image gradients (for events without real photos) ============ */
.img-gradient-1 { background: var(--grad-1); }
.img-gradient-2 { background: var(--grad-2); }
.img-gradient-3 { background: var(--grad-3); }
.img-gradient-4 { background: var(--grad-4); }
.img-gradient-5 { background: var(--grad-5); }
.img-gradient-6 { background: var(--grad-6); }
.img-gradient-7 { background: var(--grad-7); }
.img-gradient-8 { background: var(--grad-8); }
.img-gradient-9 { background: var(--grad-9); }
.img-gradient-10 { background: var(--grad-10); }
.img-gradient-11 { background: var(--grad-11); }
.img-gradient-12 { background: var(--grad-12); }

/* Decorative pattern overlay */
.event-thumb::before, .event-hero::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,0.25), transparent 40%);
}

/* ============ Intent form (selects + más opciones) ============ */
.switch-large .switch-slider { width: 48px; height: 26px; }
.switch-large .switch-slider::after { width: 20px; height: 20px; }
.switch-large input:checked + .switch-slider::after { transform: translateX(22px); }

.intent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.intent-grid-narrow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 320px;
}
@media (max-width: 900px) {
  .intent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .intent-grid { grid-template-columns: 1fr; gap: 12px; }
}
.intent-select {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.intent-select-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
}
.intent-select select,
.intent-select input {
  width: 100%;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border var(--t-fast), background-color var(--t-fast), box-shadow var(--t-fast);
  height: 42px;
}
.intent-select select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8eaa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
[data-theme="dark"] .intent-select select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a4a4c0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
.intent-select input { cursor: text; text-align: center; }
.intent-select select:focus,
.intent-select input:focus {
  border-color: var(--primary);
  background-color: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
  outline: none;
}
.intent-select select option {
  background: var(--surface);
  color: var(--text);
}

.intent-more {
  margin: 4px 0 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.intent-more summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin: -4px -8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.intent-more summary:hover { color: var(--text); background: var(--input-bg-soft); }
.intent-more summary::-webkit-details-marker { display: none; }
.intent-more summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform var(--t-fast);
}
.intent-more[open] summary::before { transform: rotate(180deg); }

#intent-status-line {
  margin: 4px 0 0;
}

/* ============ My status banner ============ */
.my-status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.05));
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
}
.my-status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary-bright);
  box-shadow: 0 0 0 0 rgba(99,102,241, 0.5);
  animation: pulse 2s infinite;
  flex: 0 0 10px;
}

/* ============ My events page ============ */
.my-events-page { max-width: 800px; margin: 0 auto; }
.page-head { margin-bottom: 28px; }
.page-sub { color: var(--text-dim); font-size: 15px; margin: 6px 0 0; }
.my-events-list { display: flex; flex-direction: column; gap: 12px; }
.my-event-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: all var(--t-med);
}
.my-event-row:hover {
  border-color: rgba(99,102,241,0.4);
  transform: translateX(4px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.4);
}
.my-event-thumb {
  width: 80px; height: 80px;
  border-radius: 11px;
  flex: 0 0 80px;
  background-size: cover; background-position: center;
  position: relative;
  overflow: hidden;
}
.my-event-thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.4));
}
.my-event-info { flex: 1; min-width: 0; }
.my-event-status {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 100px;
  margin-bottom: 6px;
}
.my-event-status.looking {
  background: rgba(99,102,241,0.18);
  color: var(--primary-bright);
}
.my-event-status.going {
  background: rgba(16,185,129,0.18);
  color: #6ee7b7;
}
.my-event-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px; font-weight: 600;
  margin: 0 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.my-event-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}
.my-event-arrow {
  font-size: 22px;
  color: var(--text-mute);
  transition: color var(--t-fast), transform var(--t-fast);
}
.my-event-row:hover .my-event-arrow { color: var(--primary-bright); transform: translateX(4px); }
.empty-state a { color: var(--primary-bright); text-decoration: underline; }

/* ============ Event extras ============ */
.event-thumb-photo, .event-hero-photo {
  background-size: cover;
  background-position: center;
}
.source-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 100px;
  background: rgba(249,115,22,0.15);
  color: #fdba74;
  border: 1px solid rgba(249,115,22,0.28);
  font-weight: 600;
}
.section-action { margin-left: auto; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
  animation: overlayIn 200ms ease-out;
}
@keyframes overlayIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 580px;
  max-height: calc(100dvh - 48px);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.06) inset;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn 280ms cubic-bezier(.2,.8,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 8px;
}
.modal-title { font-family: 'Space Grotesk', sans-serif; font-size: 22px; letter-spacing: -0.02em; margin: 0; }
.modal-sub { color: var(--text-dim); margin: 0 26px 14px; font-size: 14px; line-height: 1.45; }
.modal-body { padding: 8px 26px 4px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--border);
  background: var(--shadow-inset);
}
.icon-btn {
  background: transparent; border: 1px solid transparent;
  padding: 8px; border-radius: 10px;
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.icon-btn:hover { color: var(--text); background: var(--input-bg-hover); border-color: var(--border); }

.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-row .field { margin-bottom: 14px; }
.field-row .field:has(input[type="date"]) { grid-column: span 1; }
@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row .field:nth-child(3) { grid-column: 1 / -1; }
}

.probe-result {
  border: 1px solid rgba(249,115,22,0.35);
  background: linear-gradient(180deg, rgba(249,115,22,0.08), rgba(249,115,22,0.02));
  border-radius: 12px;
  padding: 14px 16px;
  margin: 4px 0 14px;
  animation: modalIn 220ms ease-out;
}
.probe-title { font-size: 14px; font-weight: 600; margin: 0 0 8px; color: #fdba74; }
.probe-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.probe-card-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.probe-card-info strong { font-size: 14px; }
.probe-card-info span { font-size: 12px; color: var(--text-dim); }
.probe-card-date { font-weight: 500; color: var(--text) !important; }

/* (Sidebar/drawer eliminado: ahora la nav vive inline en la topbar desktop
    y en la bottom-nav mobile. El acceso a perfil/ajustes está en el avatar
    dropdown — desktop — y en la pestaña "Tú" de la bottom-nav — mobile.) */

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .login-split { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-mobile-brand { display: inline-flex; }
}
@media (max-width: 720px) {
  /* Topbar mobile: brand izquierda + bell derecha. Sin nav inline (vive en
     bottom-nav). Sin avatar dropdown (vive en pestaña Perfil de bottom-nav). */
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar-brand { flex: 1; justify-content: flex-start; }
  .topbar-brand .topbar-title { font-size: 16px; }
  .topbar-nav-desktop { display: none; }
  .topbar-avatar-btn { display: none; }
  .hide-on-mobile { display: none !important; }

  /* Bottom-nav: 5 items con icono + label. */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 40;
    justify-content: space-around;
    gap: 0;
  }
  .bnav-link {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    min-height: 56px;
    font-size: 10.5px;
    text-align: center;
    border-radius: 10px;
    color: var(--text-mute);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    transition: color var(--t-fast);
  }
  .bnav-icon, .bnav-avatar {
    width: 24px; height: 24px;
    color: var(--text-mute);
    transition: color var(--t-fast), transform var(--t-fast);
  }
  .bnav-avatar {
    border-radius: 50%;
    background: var(--grad-1);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 11px;
    border: 2px solid transparent;
    box-sizing: content-box;
    width: 22px; height: 22px;
  }
  .bnav-label { line-height: 1; font-weight: 500; letter-spacing: -0.005em; }
  .bnav-link.is-active { color: var(--primary-bright); }
  .bnav-link.is-active .bnav-icon { color: var(--primary-bright); transform: scale(1.04); }
  .bnav-link.is-active .bnav-avatar { border-color: var(--primary); }
  .bnav-link.is-active .bnav-label { font-weight: 600; }
  .bnav-badge {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(7px);
    background: var(--danger);
    color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 100px;
    display: inline-grid; place-items: center;
    border: 2px solid var(--bg);
  }

  /* Padding-bottom del main: hueco para la bottom-nav (~70px) sin que el
     contenido quede oculto. */
  .app-main { padding: 18px 14px 96px; }

  /* Home search en mobile: ocupa todo el ancho del viewport, padding ajustado. */
  .home-search-section {
    margin: 0 -14px 24px;
    padding: 32px 16px 24px;
  }
  .search-bar { padding: 4px 4px 4px 14px; }
  .search-bar-input { padding: 12px 8px; font-size: 16px; /* anti zoom iOS */ }
  .search-bar-submit { padding: 10px 16px; font-size: 13.5px; }
  /* Filtros: en mobile pasamos a fila scrollable horizontal (no apilados
     verticalmente). Ocultamos la scrollbar y damos un poco de padding lateral
     para que se sienta el "swipe". Patrón Ticketmaster / Eventbrite. */
  .search-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    gap: 8px;
    margin: 16px -16px 0;
    padding: 4px 16px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .search-filters::-webkit-scrollbar { display: none; }
  .search-filter {
    flex: 0 0 auto;
    scroll-snap-align: start;
    font-size: 13px;
    padding: 8px 30px 8px 14px;
  }

  .event-hero { height: 220px; border-radius: 16px; }
  .event-hero-content { padding: 16px; }
  .event-hero-title { font-size: 22px !important; }
  .event-hero-venue { font-size: 13px; }

  .event-card { padding: 16px; border-radius: 12px; }
  .card-title { font-size: 16px; }

  .intent-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .intent-grid-narrow { grid-template-columns: 1fr 1fr; }
  .intent-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .intent-header > div { width: 100%; }
  .intent-actions { flex-wrap: wrap; gap: 8px; }
  .intent-row-double { grid-template-columns: 1fr; }

  .login-h1 { font-size: 26px; }
  /* Grid: 1 columna full width en mobile, gap generoso para no asfixiar. */
  .events-grid { grid-template-columns: 1fr; gap: 18px; }
  .event-card-link { border-radius: 14px; }
  .event-card-body { padding: 16px 16px 12px; }
  .event-card-title { font-size: 17px; }
  .section-header { flex-wrap: wrap; gap: 8px; }
  .section-title { font-size: 20px; }
  .section-action { margin-left: 0; }

  .my-event-row { padding: 12px; gap: 12px; }
  .my-event-thumb { width: 56px; height: 56px; flex: 0 0 56px; }
  .my-event-title { font-size: 15px; }
  .my-event-meta { font-size: 12px; }
  .my-event-arrow { display: none; }

  .notif-dropdown {
    top: 56px;
    left: 8px; right: 8px;
    width: auto;
    max-width: none;
  }

  /* Chat: header en columna, composer pegado al teclado */
  .chat-header { flex-wrap: wrap; }
  .chat-header-info { width: 100%; }
  /* En mobile la chat-page se enmarca entre topbar (~50px) y bottom-nav
     (~70px + safe-area). El padding inferior lo gestiona el composer. */
  body.is-chat-route .chat-page {
    top: 50px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    padding: 0 12px;
  }
  body.is-chat-route .bottom-nav {
    /* Sutil sombra superior para diferenciarse del chat detrás. */
    box-shadow: 0 -1px 0 var(--border);
  }
  .chat-msg { max-width: 85%; font-size: 14px; }

  /* Buddies con mucho contenido: stack vertical */
  .buddy-row { flex-wrap: wrap; align-items: flex-start; padding: 14px; }
  .buddy-info { min-width: 0; flex: 1; }
  .buddy-actions { width: 100%; justify-content: flex-end; margin-top: 8px; }

  /* Modales pegados a los bordes con padding más reducido */
  .modal { max-height: calc(100dvh - 16px); border-radius: 18px; }
  .modal-header, .modal-sub, .modal-body, .modal-footer {
    padding-left: 16px; padding-right: 16px;
  }
  .modal-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row .field { margin-bottom: 12px; }

  /* Touch targets más generosos */
  .icon-btn { width: 40px; height: 40px; }

  /* Páginas con back-link: padding superior */
  .back-link { font-size: 13px; }

  /* Profile actions: pila vertical */
  .profile-actions { flex-direction: column; align-items: stretch; }
  .profile-actions .btn { width: 100%; }

  /* iOS hace zoom en inputs con font-size <16px al hacer focus. Subimos a
     16px en mobile para todos los campos editables y selects. */
  .field input,
  .field textarea,
  .field select,
  .intent-select input,
  .intent-select select,
  .search-input-wrap input,
  #search-genre, #search-city, #search-country,
  .chat-composer input {
    font-size: 16px;
  }
}
@media (max-width: 420px) {
  .topbar-brand .topbar-title { font-size: 15px; }
  .bnav-link { font-size: 10px; padding: 6px 2px; min-height: 52px; }
  .bnav-icon { width: 22px; height: 22px; }
  .bnav-avatar { width: 20px; height: 20px; font-size: 10px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; }
  .home-h1 { font-size: 24px; }
  .home-tagline { font-size: 14px; }
  .event-hero { height: 200px; }
  .event-hero-title { font-size: 20px !important; }
  .modal-narrow { max-width: 100%; }
}
@media (max-width: 1100px) and (min-width: 961px) {
  .login-aside { padding: 36px 40px; }
}

/* ============ Theme toggle ============ */
.theme-toggle {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--input-bg-hover); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-corner {
  position: fixed; top: 18px; right: 18px;
  z-index: 50;
}

/* ============ Login plain (genérico) ============ */
.login-page-plain {
  display: grid; place-items: center;
  min-height: 100vh; min-height: 100dvh;
  padding: 24px;
  background: var(--bg);
}
.login-page-plain::before {
  content: '';
  position: fixed; inset: 0;
  background: var(--bg-radial);
  pointer-events: none;
  z-index: 0;
}
.login-shell-plain {
  width: 100%; max-width: 380px;
  position: relative; z-index: 1;
}
.login-card-plain {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-card);
}
.login-mark {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}
.login-h1-plain {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px; letter-spacing: -0.02em;
  margin: 0 0 6px;
  text-align: center;
  font-weight: 700;
}
.login-lede-plain {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  margin: 0 0 24px;
}

/* ============ Notifications ============ */
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--input-bg-hover); }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 100px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-elev);
}
/* (.nav-badge antigua eliminada: ahora son .bnav-badge — bottom-nav móvil —
    y .topnav-badge — nav inline desktop —, definidas más arriba.) */
.notif-dropdown {
  position: absolute;
  top: 60px; right: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: 480px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  z-index: 60;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn 200ms ease-out;
}
.notif-dropdown-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.link-btn {
  background: none; border: none;
  color: var(--primary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}
.link-btn:hover { background: var(--input-bg-hover); }
.notif-dropdown-list {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
}
.notif-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.notif-dropdown-actions { display: inline-flex; gap: 4px; align-items: center; }
.link-btn-danger { color: var(--danger); }
.link-btn-danger:hover { background: rgba(220, 38, 38, 0.10); color: var(--danger); }
[data-theme="dark"] .link-btn-danger { color: #fca5a5; }
[data-theme="dark"] .link-btn-danger:hover { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }

.notif-row {
  display: flex; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  /* Transitions agrupadas para soportar la animación de "is-removing":
     slide right + fade + collapse vertical. */
  transition:
    background 120ms ease,
    transform 240ms cubic-bezier(0.4, 0.0, 0.2, 1),
    opacity 240ms ease,
    max-height 240ms cubic-bezier(0.4, 0.0, 0.2, 1),
    padding-top 240ms ease,
    padding-bottom 240ms ease,
    border-color 240ms ease;
  overflow: hidden;
}
.notif-row.is-removing {
  transform: translateX(40px);
  opacity: 0;
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
  pointer-events: none;
}
.notif-delete {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  display: inline-grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-mute);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.notif-row:hover .notif-delete,
.notif-delete:focus-visible { opacity: 1; }
.notif-delete:hover { background: var(--input-bg-hover); color: var(--text); }
@media (max-width: 720px) {
  /* En mobile no hay :hover, así que dejamos el botón visible siempre. */
  .notif-delete { opacity: 0.6; }
}
.notif-row:hover { background: var(--input-bg); }
.notif-row.unread { background: rgba(99,102,241,0.08); }
.notif-row.unread:hover { background: rgba(99,102,241,0.12); }
.notif-row:last-child { border-bottom: none; }
.notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-1);
  flex: 0 0 32px;
  display: grid; place-items: center;
  color: #fff;
}
.notif-content { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; line-height: 1.4; }
.notif-text strong { font-weight: 600; }
.notif-time { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.notif-quote {
  display: block;
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--input-bg);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}
.notif-actions { display: flex; gap: 8px; margin-top: 8px; }
.notif-actions .btn { flex: 1; }

/* ============ Chats list ============ */
.chats-page { max-width: 760px; margin: 0 auto; }
.chats-list { display: flex; flex-direction: column; gap: 8px; }
.chat-row {
  display: flex; gap: 14px; align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all var(--t-fast);
}
.chat-row { position: relative; cursor: pointer; }
.chat-row:hover { border-color: rgba(99,102,241,0.4); transform: translateX(3px); }
.chat-row-delete {
  position: absolute;
  top: 50%; right: 10px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-mute);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chat-row:hover .chat-row-delete,
.chat-row-delete:focus-visible { opacity: 1; }
.chat-row-delete:hover {
  background: rgba(220,38,38,0.10);
  border-color: rgba(220,38,38,0.35);
  color: var(--danger);
}
@media (max-width: 720px) {
  /* En mobile no hay :hover; lo dejamos siempre visible (semitransparente). */
  .chat-row-delete { opacity: 0.55; }
}
.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--grad-1);
  flex: 0 0 44px;
  display: grid; place-items: center;
  font-weight: 700; color: #fff;
}
.chat-row-info { flex: 1; min-width: 0; }
.chat-row-name {
  display: flex; gap: 8px; align-items: center;
  font-weight: 600; font-size: 15px;
}
.chat-row-event {
  color: var(--text-dim);
  font-size: 13px;
  margin: 2px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row-last {
  color: var(--text-mute);
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px;
}
.chat-row-time { font-size: 11px; color: var(--text-mute); }
.chat-row-unread {
  background: var(--primary);
  color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 100px;
  padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ============ Chat detail ============ */
/* En la ruta /chat/:id la página entera se fija a viewport: sólo el área
   de mensajes scrolla. Bloqueamos scroll en html Y body (en mobile sólo
   con body no basta — el doc-element todavía puede scrollear), y fijamos
   posición de app-main para que no contribuya altura al flujo. */
html.is-chat-route,
body.is-chat-route {
  overflow: hidden !important;
  height: 100vh;
  height: 100dvh;
  /* iOS: evitar el bounce / overscroll que muestra contenido por debajo. */
  overscroll-behavior: none;
  /* Safari iOS: position fixed en algunos casos no respeta 100% altura
     correctamente cuando el body es más alto. Limitarlo aquí. */
  max-height: 100dvh;
}
body.is-chat-route .app-main {
  position: fixed;
  inset: 0;
  padding: 0;
  max-width: none;
  height: 100%;
  overflow: hidden;
}
body.is-chat-route .app-main .chat-page {
  /* La chat-page ya es position:fixed; su top/bottom se gestionan abajo. */
}
.chat-page {
  position: fixed;
  /* topbar = ~58px en desktop. Dejamos un pelín más para no pegarse al borde. */
  top: 58px;
  left: 0; right: 0; bottom: 0;
  max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: 0 16px;
  background: var(--bg);
}
.chat-header {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.chat-peer {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; letter-spacing: -0.02em; margin: 0;
}
.chat-event-link {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
}
.chat-event-link:hover { text-decoration: underline; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 4px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.chat-msg-mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-theirs {
  align-self: flex-start;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
}
.chat-day-divider {
  align-self: center;
  font-size: 11px;
  color: var(--text-mute);
  background: var(--input-bg-soft);
  padding: 4px 10px;
  border-radius: 100px;
  margin: 8px 0;
}
.chat-composer {
  display: flex; gap: 8px;
  /* En mobile la chat-page ya termina por encima de la home-bar (bottom:
     70px + safe-area). En desktop el composer está pegado al borde inferior
     de chat-page que es bottom: 0. Padding interno simple en ambos casos. */
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.chat-composer input {
  flex: 1;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text);
}
.chat-composer input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

/* ============ Trust & safety ============ */

/* Buddy actions: stack horizontal con botón de overflow */
.buddy-actions { display: flex; gap: 6px; align-items: center; }
.buddy-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trust-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-dim);
}
.trust-stars { color: #d97706; letter-spacing: -1px; }
[data-theme="dark"] .trust-stars { color: #fcd34d; }
.trust-meta { color: var(--text-dim); }

/* Menú flotante (más opciones de un buddy) */
.user-action-menu {
  position: fixed;
  z-index: 100;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  overflow: hidden;
  animation: modalIn 140ms ease-out;
}
.user-action-menu button {
  width: 100%; text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  background: transparent; border: 0;
  color: var(--text);
  cursor: pointer;
}
.user-action-menu button:hover { background: var(--input-bg-soft); }

/* Chat header con menú */
.chat-header { display: flex; align-items: center; gap: 8px; }
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-actions { position: relative; }
.chat-menu {
  position: absolute;
  top: 100%; right: 0;
  margin-top: 4px;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  overflow: hidden;
  z-index: 60;
  animation: modalIn 140ms ease-out;
}
.chat-menu-item {
  display: block; width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  background: transparent; border: 0;
  color: var(--text);
  cursor: pointer;
}
.chat-menu-item:hover { background: var(--input-bg-soft); }
.chat-menu-danger { color: #ef4444; }

/* Modal narrow (rate / report / match). En mobile ocupa todo el ancho
   menos un margen; en desktop sube a 520px para que el textarea de
   comentarios no se vea encorsetado. */
.modal-narrow { max-width: min(520px, calc(100vw - 32px)); }

/* Rate stars */
.rate-stars { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.rate-star {
  background: transparent; border: 0;
  font-size: 36px;
  color: var(--text-mute);
  cursor: pointer;
  transition: color 120ms, transform 120ms;
  padding: 0 4px;
}
.rate-star:hover { transform: scale(1.1); }
.rate-star.is-active, .rate-star.is-selected { color: #fbbf24; }

/* Rate tags */
.rate-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.rate-tag {
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--t-fast);
}
.rate-tag:hover { color: var(--text); border-color: var(--primary); }
.rate-tag.is-selected {
  background: rgba(99,102,241,0.14);
  color: var(--primary-bright);
  border-color: var(--primary);
}

.rate-checkbox {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0;
  font-size: 14px;
  cursor: pointer;
}
.rate-checkbox input { width: 16px; height: 16px; cursor: pointer; }

/* Rateable page */
.rateable-page { max-width: 760px; margin: 0 auto; }
.rateable-list { display: flex; flex-direction: column; gap: 10px; }
.rateable-row {
  display: flex; gap: 12px; align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.rateable-row.is-done { opacity: 0.55; }
.rateable-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  flex: 0 0 44px;
  display: grid; place-items: center;
  color: #fff; font-weight: 600;
}
.rateable-info { flex: 1; min-width: 0; }
.rateable-name { font-weight: 600; }
.rateable-event { font-size: 14px; color: var(--text); }
.rateable-meta { font-size: 12px; color: var(--text-dim); }
.rateable-done {
  font-size: 12px; color: var(--text-dim);
  padding: 4px 10px;
  background: var(--input-bg-soft);
  border-radius: 100px;
}

/* Profile trust */
.profile-trust { margin: 16px 0; }
.profile-trust-card {
  display: flex; gap: 14px; align-items: center;
  padding: 14px;
  background: var(--input-bg-soft);
  border-radius: 12px;
}
.profile-trust-stars {
  font-size: 22px; color: #fbbf24; letter-spacing: -2px;
}
.profile-trust-text { font-size: 14px; color: var(--text-dim); }
.profile-trust-text strong { color: var(--text); }
.profile-trust-empty {
  font-size: 13px; color: var(--text-dim);
  padding: 12px;
  background: var(--input-bg-soft);
  border-radius: 10px;
}
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* Blocks page */
.blocks-page { max-width: 720px; margin: 0 auto; }
.blocks-list { display: flex; flex-direction: column; gap: 10px; }
.block-row {
  display: flex; gap: 12px; align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.block-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex: 0 0 40px;
  display: grid; place-items: center;
  color: #fff; font-weight: 600;
}
.block-info { flex: 1; min-width: 0; }
.block-name { font-weight: 600; }
.block-reason { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.block-since { font-size: 11px; color: var(--text-mute); margin-top: 4px; }

@media (max-width: 540px) {
  .rate-stars .rate-star { font-size: 32px; }
  /* Ocupa toda la fila debajo del avatar+info; el "Pedir match" queda
     a la derecha como acción primaria, el "..." a su lado. Antes el
     column-reverse ponía el "..." arriba del CTA principal. */
  .buddy-row { flex-wrap: wrap; }
  .buddy-actions {
    width: 100%;
    flex-direction: row;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
  }
  .rateable-row { padding: 10px; }
  .rateable-avatar { width: 38px; height: 38px; flex-basis: 38px; }
}

/* ============ Skeletons ============ */
.skel {
  display: block;
  background: linear-gradient(
    90deg,
    var(--input-bg-soft) 0%,
    var(--input-bg-hover) 50%,
    var(--input-bg-soft) 100%
  );
  background-size: 200% 100%;
  border-radius: 8px;
  animation: skelShimmer 1.4s linear infinite;
}
@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.skel-thumb { height: 180px; background: var(--input-bg-soft); }
.skel-line { height: 12px; margin: 10px 16px; border-radius: 6px; }
.skel-line.short { width: 40%; }
.skel-line.long { width: 70%; }
.skel-row { padding: 14px; display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.skel-circle { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px; background: var(--input-bg-soft); }
.skel-row .skel-stack { flex: 1; display: flex; flex-direction: column; gap: 6px; }

/* ============ Skip link (accesibilidad) ============ */
.skip-link {
  position: fixed;
  top: -100px; left: 8px;
  z-index: 9999;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  transition: top 200ms ease;
}
.skip-link:focus { top: 8px; outline: 2px solid var(--text); outline-offset: 2px; }

/* ============ Focus visible consistente ============ */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}
/* Inputs y textareas: foco con ring sin sumar al outline base. El alpha
   sube a 0.32 para que el ring sea visible incluso sobre el background
   light (#f5f5fa) donde el azul translúcido se desvanecía. */
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.32);
}
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  /* Anulamos también las custom properties de timing por si algún
     componente las usa con cubic-bezier que el override de transition-
     duration por sí solo no neutraliza correctamente. */
  :root {
    --t-fast: 0.01ms linear;
    --t-med: 0.01ms linear;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .modal { animation: none; }
}

/* ============ Offline banner ============ */
.offline-banner {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0; right: 0;
  z-index: 250;
  background: rgba(220, 38, 38, 0.96);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

/* ============ Onboarding modal ============ */
.onboarding-step {
  text-align: center;
  padding: 8px 12px;
}
.onboarding-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  display: grid; place-items: center;
  color: #fff;
}
.onboarding-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}
.onboarding-text {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px;
}
.onboarding-dots {
  display: flex; gap: 6px; justify-content: center;
  margin: 12px 0 4px;
}
.onboarding-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--input-bg-hover);
  transition: background var(--t-fast), transform var(--t-fast);
}
.onboarding-dot.is-active {
  background: var(--primary);
  transform: scale(1.2);
}

/* ============ Empty state CTA ============ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-state-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--input-bg-soft);
  display: grid; place-items: center;
  color: var(--text-mute);
}
.empty-state h3 {
  font-size: 17px;
  color: var(--text);
  margin: 0 0 6px;
}
.empty-state p { margin: 0 0 16px; font-size: 14px; }
.empty-state .btn { display: inline-flex; }

/* ============ Profile page ============ */
.profile-page {
  max-width: 720px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  gap: 16px;
}
.profile-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(236,72,153,0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.profile-hero-avatar {
  position: relative;
  width: 88px; height: 88px;
  border-radius: 50%;
  flex: 0 0 88px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: visible;
  box-shadow: 0 8px 24px rgba(99,102,241,0.30);
}
.profile-hero-avatar-inner {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 32px;
  background: var(--grad-1);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  transition: filter var(--t-fast);
}
.profile-hero-avatar:hover .profile-hero-avatar-inner { filter: brightness(0.92); }
.profile-hero-avatar-edit {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 4px 10px rgba(99,102,241,0.45);
  pointer-events: none;
}
.profile-avatar-actions {
  display: flex; gap: 12px; margin-top: 8px;
}

/* Cualquier avatar con imagen: el texto se oculta y el bg se ajusta cover. */
.topbar-avatar.has-avatar-image,
.user-menu-avatar.has-avatar-image,
.bnav-avatar.has-avatar-image,
.chat-avatar.has-avatar-image,
.buddy-avatar.has-avatar-image,
.rateable-avatar.has-avatar-image,
.notif-icon.has-avatar-image {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  /* Texto vacío (lo borramos en JS) y los pseudo-elementos no aplican aquí. */
}
.profile-hero-info { flex: 1; min-width: 0; }
.profile-hero-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px; letter-spacing: -0.02em;
  margin: 0 0 4px;
  font-weight: 700;
}
.profile-hero-meta {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-dim);
}
.profile-trust-inline { display: inline-flex; }
.trust-badge-empty {
  font-size: 12px; color: var(--text-mute);
  padding: 3px 10px;
  background: var(--input-bg-soft);
  border: 1px dashed var(--border);
  border-radius: 100px;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.profile-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
}
.profile-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px; letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.profile-card-sub {
  font-size: 13px; color: var(--text-dim);
  margin: 0 0 12px;
  line-height: 1.5;
}
.profile-bio-counter {
  font-size: 12px;
  color: var(--text-mute);
  font-weight: 500;
  flex: 0 0 auto;
}
.profile-bio {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  font-family: inherit;
  transition: border var(--t-fast), box-shadow var(--t-fast);
}
.profile-bio:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  outline: none;
}
.profile-bio-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 10px;
}
.profile-bio-status {
  font-size: 13px;
  color: var(--text-dim);
}
.profile-bio-status.is-saved { color: var(--success); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.profile-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  text-align: center;
}
.profile-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.profile-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
}

.profile-howto {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.profile-howto li {
  position: relative;
  padding: 10px 12px 10px 38px;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-dim);
  counter-increment: howto;
}
.profile-howto { counter-reset: howto; }
.profile-howto li::before {
  content: counter(howto);
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.profile-howto li strong { color: var(--text); }

.profile-account .profile-card-title { margin-bottom: 4px; }
.profile-account-list {
  display: flex; flex-direction: column;
  margin-top: 8px;
}
.profile-account-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  font-size: 14.5px;
  color: var(--text);
  background: transparent; border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--t-fast);
}
.profile-account-item:last-child { border-bottom: none; }
.profile-account-item:hover { background: var(--input-bg-soft); }
.profile-account-item svg:first-child {
  flex: 0 0 20px;
  color: var(--text-mute);
}
.profile-account-label { flex: 1; font-weight: 500; }
.profile-account-arrow {
  color: var(--text-mute);
  flex: 0 0 16px;
}
.profile-account-danger { color: var(--danger); }
.profile-account-danger svg:first-child { color: var(--danger); }
[data-theme="dark"] .profile-account-danger { color: #fca5a5; }
[data-theme="dark"] .profile-account-danger svg:first-child { color: #fca5a5; }

.profile-footer {
  text-align: center;
  margin-top: 8px;
  padding: 16px 0 0;
  color: var(--text-mute);
  font-size: 12px;
}
.profile-footer p { margin: 0 0 4px; }
.profile-footer-meta { color: var(--text-mute); }

/* Buddy-bio: aparece debajo del nombre+trust, antes de los tags. Se limita
   a 2 líneas. La nota de un buddy (más temporal) sigue debajo. */
.buddy-bio {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 540px) {
  .profile-hero {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 18px;
    gap: 14px;
  }
  .profile-hero-avatar { width: 56px; height: 56px; flex-basis: 56px; font-size: 22px; }
  .profile-hero-name { font-size: 22px; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .profile-stat { padding: 12px 8px; }
  .profile-stat-value { font-size: 22px; }
  .profile-card { padding: 16px 18px; }
}

/* ============ Required field marker ============ */
.req-mark {
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}
[data-theme="dark"] .req-mark { color: #fca5a5; }
.field input.is-invalid,
.field textarea.is-invalid,
.field select.is-invalid {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.06);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}
[data-theme="dark"] .field input.is-invalid,
[data-theme="dark"] .field textarea.is-invalid,
[data-theme="dark"] .field select.is-invalid {
  background: rgba(239, 68, 68, 0.10);
}

/* ============ FAB (añadir evento) ============ */
.fab {
  position: fixed;
  z-index: 80;
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(28px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 56px; min-width: 56px;
  padding: 0 22px 0 18px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 100px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  font-weight: 600; font-size: 15px; letter-spacing: -0.005em;
  box-shadow: 0 16px 36px rgba(99,102,241,0.42), 0 2px 4px rgba(20,20,43,0.18);
  transition: transform var(--t-fast), box-shadow var(--t-med), background var(--t-med);
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 22px 44px rgba(99,102,241,0.55); }
.fab:active { transform: translateY(0); }
.fab svg { flex: 0 0 22px; }
.fab-label { white-space: nowrap; }
@media (max-width: 720px) {
  .fab {
    height: 56px; width: 56px; min-width: 56px;
    padding: 0;
    /* Por encima del bottom-nav (68-72px) */
    bottom: calc(84px + env(safe-area-inset-bottom));
    right: calc(16px + env(safe-area-inset-right));
  }
  .fab-label { display: none; }
}

/* ============ Event detail: quick actions row ============ */
.event-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.event-quick-actions .btn {
  flex: 0 1 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.event-quick-actions .btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.event-quick-actions svg { color: var(--primary-bright); }

/* ============ Buddies: self row ============ */
.buddy-row.is-self {
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(99,102,241,0.04));
  border-color: rgba(99,102,241,0.42);
}
.buddy-row.is-self:hover { transform: none; box-shadow: none; }
.buddy-self-tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(99,102,241,0.18);
  color: var(--primary-bright);
  border: 1px solid rgba(99,102,241,0.35);
  padding: 2px 8px;
  border-radius: 100px;
}

/* ============ Chats list: request rows + section labels ============ */
.chats-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 14px 4px 4px;
}
.chats-section-label:first-child { padding-top: 4px; }
.request-row { cursor: pointer; }
.request-row.request-incoming {
  border-color: rgba(99,102,241,0.40);
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(99,102,241,0.02));
}
.request-row.request-outgoing {
  background: var(--surface-2);
  border-style: dashed;
}
.request-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: 6px;
  white-space: nowrap;
}
.request-pill-incoming {
  background: rgba(99,102,241,0.18);
  color: var(--primary-bright);
}
.request-pill-outgoing {
  background: var(--input-bg-hover);
  color: var(--text-dim);
}
.request-actions { flex-direction: row !important; align-items: center; gap: 6px; }
.request-actions .btn { white-space: nowrap; }

@media (max-width: 540px) {
  .request-row { flex-wrap: wrap; }
  .request-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }
  /* En móvil ocultamos la última línea (mensaje) en outgoing para que la fila
     no crezca demasiado — el peer + estado ya da contexto suficiente. */
  .request-row.request-outgoing .chat-row-last { display: none; }
}

/* ============ Buddy actions: more space en mobile, mejor jerarquía ============ */
.buddy-action {
  white-space: nowrap;
}
@media (max-width: 540px) {
  .buddy-action { flex: 1; }
  .buddy-row.is-self .buddy-actions { justify-content: stretch; }
  .buddy-row.is-self .buddy-action { width: 100%; }
}

/* ============ Section header (home): si no hay action button, alineamos
   el count al final con space-between para mejor balance visual ============ */
.events-section .section-header {
  align-items: center;
  margin-bottom: 16px;
}
.events-section .section-count {
  flex: 1;
  text-align: right;
}

/* ============ Tweaks misc móviles ============ */
@media (max-width: 720px) {
  /* Acciones rápidas en evento detail: que sean grandes y cómodas */
  .event-quick-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 10px 12px;
    min-height: 44px;
  }
  /* Buddies header: badge en línea con título sin saltar de línea */
  .buddies-card .card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* (Reglas antiguas .hero/.hero-search eliminadas — ya no existen.) */
