/* ==========================================================================
   BiciQuedadas · estilos base (vanilla, responsive, sin build)
   ========================================================================== */

:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #d9f1ec;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --surface-3: #e2eae7;
  --text: #10201d;
  --muted: #5b6b67;
  --muted-2: #7c8b87;
  --border: #dbe4e0;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --success: #067647;
  --success-soft: #dcfae6;
  --warning: #b54708;
  --warning-soft: #fef0c7;
  --info: #175cd3;
  --info-soft: #d1e9ff;
  --shadow-sm: 0 1px 2px rgba(16, 32, 29, 0.06), 0 1px 3px rgba(16, 32, 29, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 32, 29, 0.08), 0 2px 6px rgba(16, 32, 29, 0.04);
  --shadow-lg: 0 24px 60px rgba(16, 32, 29, 0.16);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --maxw: 1120px;
  --header-h: 70px;
  --bottom-nav-h: 64px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --transition: 180ms ease;
}

[data-theme="dark"] {
  --brand: #2dd4bf;
  --brand-dark: #14b8a6;
  --brand-soft: #103b36;
  --accent: #fbbf24;
  --accent-soft: #3b2f10;
  --bg: #0b1412;
  --surface: #111c19;
  --surface-2: #172521;
  --surface-3: #20312c;
  --text: #e8f2ef;
  --muted: #a4b7b1;
  --muted-2: #849a94;
  --border: #293d37;
  --danger: #ffb4ab;
  --danger-soft: #451a16;
  --success: #75e0a7;
  --success-soft: #0f3a27;
  --warning: #fec84b;
  --warning-soft: #3d2c0a;
  --info: #84caff;
  --info-soft: #123a5c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 480px at 8% -8%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 68%),
    radial-gradient(900px 420px at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    var(--bg);
  transition: background-color var(--transition), color var(--transition);
  padding-bottom: 0;
  overflow-x: hidden;
}

[data-theme="dark"] .icon {
  filter: brightness(1.5) saturate(1.05);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-dark);
}

h1, h2, h3, h4, h5, p {
  margin: 0;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.15rem; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 80%, white);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: color-mix(in srgb, var(--brand) 28%, transparent);
}

main {
  flex: 1;
}

main:focus,
main:focus-visible {
  outline: none;
}

.container {
  width: min(var(--maxw), calc(100% - 2rem));
  margin-inline: auto;
}

.app-root {
  min-height: 58vh;
  padding-block: 1.5rem 3.5rem;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: 1rem;
}

.icon {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.muted { color: var(--muted); }
.tiny { font-size: 0.78rem; }
.small { font-size: 0.875rem; }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 650;
  color: var(--brand);
}
.text-center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  flex-shrink: 0;
}

.brand:hover { color: var(--text); }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: inline-grid;
  place-items: center;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--brand) 88%, white), var(--brand-dark));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), var(--shadow-sm);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  width: 13px;
  height: 13px;
  bottom: 9px;
}

.brand-mark::before { left: 7px; }
.brand-mark::after { right: 7px; }
.brand-mark {
  background-image:
    linear-gradient(145deg, color-mix(in srgb, var(--brand) 88%, white), var(--brand-dark));
}

.brand-mark-small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.brand-mark-small::before,
.brand-mark-small::after {
  width: 10px;
  height: 10px;
  bottom: 7px;
  border-width: 1.5px;
}

.brand-mark-small::before { left: 6px; }
.brand-mark-small::after { right: 6px; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.12rem;
  letter-spacing: -0.035em;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  margin-top: 0.18rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background var(--transition), color var(--transition);
}

.main-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.main-nav a.active {
  color: var(--brand);
  background: var(--brand-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.25rem;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.28rem 0.6rem 0.28rem 0.3rem;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-2);
  font-weight: 650;
  font-size: 0.88rem;
}

.header-user:hover { background: var(--surface-3); color: var(--text); }

.header-user-name {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
}

.icon-btn:active { transform: scale(0.97); }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.68rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.1;
  text-align: center;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:hover { color: inherit; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--brand-dark);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-primary .icon,
.btn-danger .icon,
.admin-nav a.active .icon,
.chip.active .icon {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] .btn-primary .icon,
[data-theme="dark"] .btn-danger .icon,
[data-theme="dark"] .admin-nav a.active .icon,
[data-theme="dark"] .chip.active .icon {
  filter: brightness(0) saturate(100%);
}

[data-theme="dark"] .btn-primary { color: #042f2a; }

.btn-accent {
  background: var(--accent);
  color: #2b1d00;
}

.btn-accent:hover { background: color-mix(in srgb, var(--accent) 85%, #000); color: #2b1d00; }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover { color: #fff; filter: brightness(0.92); }
[data-theme="dark"] .btn-danger { color: #3d0703; }

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.btn-outline-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  min-height: 36px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 10px;
}

.btn-lg {
  min-height: 52px;
  padding: 0.85rem 1.4rem;
  font-size: 1rem;
  border-radius: 14px;
}

.btn-block { width: 100%; }

.is-busy { pointer-events: none; }

/* ---------- Badges / chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.015em;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}

.badge-soft {
  background: var(--surface-2);
  color: var(--muted);
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-on-media {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  background: rgba(8, 20, 17, 0.72);
  color: #fff;
  backdrop-filter: blur(8px);
}

.badge-difficulty { background: var(--brand-soft); color: var(--brand-dark); }
[data-theme="dark"] .badge-difficulty { color: var(--brand); }
.diff-facil { background: var(--success-soft); color: var(--success); }
.diff-media { background: var(--warning-soft); color: var(--warning); }
.diff-dificil { background: var(--danger-soft); color: var(--danger); }
.diff-experta { background: var(--info-soft); color: var(--info); }

.status-float {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
}

/* ---------- Formularios ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.2rem;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 0.83rem;
  font-weight: 750;
  color: var(--text);
}

.field-hint {
  font-size: 0.76rem;
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input::placeholder,
.textarea::placeholder { color: var(--muted-2); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand) 65%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}

.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(1.2em + 2px),
    calc(100% - 13px) calc(1.2em + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.3rem;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.form-check input {
  width: 18px;
  height: 18px;
  margin-top: 0.14rem;
  accent-color: var(--brand);
}

.form-check label {
  font-size: 0.88rem;
  color: var(--muted);
}

.form-error {
  display: none;
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
}

.form-error.show { display: block; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin-top: 1.25rem;
}

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.form-section + .form-section { margin-top: 1rem; }

.form-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-section-head h2,
.form-section-head h3 {
  font-size: 1.12rem;
}

.form-section-head p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* ---------- Tarjetas genéricas ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 1.25rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h1,
.section-head h2 { margin: 0; }

.section-head p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ---------- Inicio ---------- */

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 1.5rem;
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid color-mix(in srgb, var(--brand) 17%, var(--border));
  border-radius: var(--radius-lg);
  background:
    radial-gradient(520px 280px at 90% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--surface));
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  border: 44px solid color-mix(in srgb, var(--brand) 8%, transparent);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

[data-theme="dark"] .eyebrow { color: var(--brand); }

.hero h1 {
  max-width: 14ch;
  font-weight: 800;
}

.hero h1 em {
  font-style: normal;
  color: var(--brand);
}

.hero-lead {
  margin-top: 0.9rem;
  max-width: 56ch;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.4vw, 1.08rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.hero-art {
  position: relative;
  min-height: 250px;
  display: grid;
  place-items: center;
}

.hero-bike {
  width: min(100%, 340px);
  aspect-ratio: 1;
  border-radius: 32%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--surface) 65%, transparent), transparent 50%),
    linear-gradient(145deg, color-mix(in srgb, var(--brand) 85%, #052e29), var(--brand-dark));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: rotate(-3deg);
}

.hero-bike .icon {
  width: 52% !important;
  height: 52% !important;
  filter: brightness(0) invert(1) opacity(0.94);
}

.hero-stat {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  color: var(--muted);
  z-index: 2;
}

.hero-stat strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.05;
}

.hero-stat-a { top: 7%; left: -4%; }
.hero-stat-b { bottom: 8%; right: -3%; }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  flex-shrink: 0;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  margin-top: 0.1rem;
}

.home-section { margin-top: 2.4rem; }

.home-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-section-head h2 { font-size: clamp(1.25rem, 2.4vw, 1.7rem); }
.home-section-head p { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.how-card {
  padding: 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.how-number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  margin-bottom: 0.8rem;
}

[data-theme="dark"] .how-number { color: #042f2a; }
.how-card h3 { font-size: 1.02rem; margin-bottom: 0.3rem; }
.how-card p { color: var(--muted); font-size: 0.86rem; }

/* ---------- Rutas ---------- */

.route-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.route-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
  color: var(--text);
}

.route-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}

.route-card-media img:not(.icon) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.route-card:hover .route-card-media img:not(.icon) { transform: scale(1.035); }

.route-media-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(240px 120px at 80% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 15%, var(--surface-2)), var(--surface-2));
  color: var(--brand);
}

.route-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  flex: 1;
}

.route-card-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.route-card h3 {
  font-size: 1.08rem;
  line-height: 1.25;
}

.route-card-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.route-card-footer {
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.route-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.route-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.mini-user {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 48%;
  overflow: hidden;
}

.mini-user span:not(.avatar) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-chip {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  min-width: 46px;
  padding: 0.28rem 0.45rem;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow-md);
  line-height: 1;
}

.date-chip strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 850;
}

.date-chip span {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 750;
  margin-top: 0.16rem;
}

.route-card-locked .route-card-body { gap: 0.55rem; }
.route-card-locked .route-media-fallback { color: var(--warning); }
.route-card.is-unpublished { opacity: 0.92; }

.filters-bar {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.2rem;
}

.filters-form {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, minmax(0, 1fr)) auto;
  gap: 0.65rem;
  align-items: end;
}

.filters-form .field > label { font-size: 0.74rem; }
.filters-form .input,
.filters-form .select { min-height: 42px; padding-block: 0.5rem; font-size: 0.88rem; }
.filters-actions { display: flex; gap: 0.4rem; }
.filter-check {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.filter-check input { accent-color: var(--brand); width: 17px; height: 17px; }

.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  min-width: 38px;
  min-height: 38px;
  padding: 0.35rem 0.65rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 650;
}

.pagination .current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pagination .disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- Detalle de ruta ---------- */

.detail-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.3rem;
}

.detail-cover {
  position: relative;
  aspect-ratio: 21 / 8;
  min-height: 190px;
  background: var(--surface-2);
  overflow: hidden;
}

.detail-cover img:not(.icon) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-cover-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(500px 200px at 80% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    linear-gradient(130deg, color-mix(in srgb, var(--brand) 24%, var(--surface-2)), var(--surface-2));
  color: var(--brand);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1.35rem;
}

.detail-title-wrap { min-width: 0; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.55rem; }
.detail-head h1 { font-size: clamp(1.55rem, 3.2vw, 2.35rem); }
.detail-subtitle {
  color: var(--muted);
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.8rem;
  font-size: 0.9rem;
}
.detail-subtitle span { display: inline-flex; align-items: center; gap: 0.3rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  gap: 1.2rem;
  align-items: start;
}

.detail-main { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 1.1rem; }

.content-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.content-card h2 {
  font-size: 1.12rem;
  margin-bottom: 0.7rem;
}

.prose {
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.fact {
  padding: 0.75rem;
  border-radius: 11px;
  background: var(--surface-2);
}

.fact-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.fact-value {
  margin-top: 0.18rem;
  font-weight: 700;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.lock-panel {
  padding: clamp(1.5rem, 5vw, 3rem);
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--warning) 45%, var(--border));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--warning-soft) 55%, var(--surface));
}

.lock-panel .lock-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.9rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lock-panel h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.lock-panel p { color: var(--muted); max-width: 48ch; margin: 0.6rem auto 1.1rem; }

.map-panel {
  position: relative;
  overflow: hidden;
  min-height: 160px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, color-mix(in srgb, var(--brand) 9%, transparent) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, color-mix(in srgb, var(--brand) 9%, transparent) 23px 24px),
    linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--brand) 8%, var(--surface-2)));
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1rem;
  text-align: center;
}

.map-pin {
  width: 44px;
  height: 44px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
}

.map-pin .icon {
  transform: rotate(45deg);
  filter: brightness(0) invert(1);
}

.map-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.map-attribution {
  font-size: 0.68rem;
  color: var(--muted-2);
}

.participant-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.participant {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.participant-info { min-width: 0; }
.participant-name {
  font-weight: 700;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.participant-meta { color: var(--muted); font-size: 0.73rem; }

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-soft);
  flex-shrink: 0;
}

.avatar-initials {
  display: inline-grid;
  place-items: center;
  color: var(--brand-dark);
  font-weight: 800;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .avatar-initials { color: var(--brand); }

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.comment {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 0.65rem;
}

.comment-body {
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 0 12px 12px 12px;
  background: var(--surface-2);
}

.comment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.25rem;
}

.comment-author { font-weight: 750; font-size: 0.84rem; }
.comment-date { color: var(--muted); font-size: 0.72rem; }
.comment-text { font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-delete {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.1rem 0.2rem;
}
.comment-delete:hover { color: var(--danger); }

.comment-form { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.comment-form .textarea { min-height: 86px; }
.comment-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }

/* ---------- Auth ---------- */

.auth-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1.5rem;
  align-items: center;
  max-width: 920px;
  margin: 1.5rem auto;
}

.auth-aside {
  padding: clamp(1.5rem, 4vw, 2.6rem);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(300px 220px at 80% 10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    linear-gradient(150deg, var(--brand-dark), color-mix(in srgb, var(--brand-dark) 70%, #041f1b));
  box-shadow: var(--shadow-md);
}

.auth-aside h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.auth-aside p { margin-top: 0.7rem; color: rgba(255, 255, 255, 0.8); font-size: 0.92rem; }
.auth-aside .icon { filter: brightness(0) invert(1); }
.auth-bike {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.12);
  margin-bottom: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-card {
  padding: clamp(1.3rem, 4vw, 2.2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-card h2 { font-size: 1.45rem; }
.auth-card .auth-lead { color: var(--muted); font-size: 0.88rem; margin: 0.35rem 0 1.2rem; }
.auth-card form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-switch { margin-top: 1rem; text-align: center; font-size: 0.86rem; color: var(--muted); }
.auth-switch a { font-weight: 700; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 4.2rem; }
.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.45rem;
}

/* ---------- Anuncios / locales ---------- */

.ad-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.ad-card.is-inactive { opacity: 0.75; }
.ad-media {
  position: relative;
  aspect-ratio: 16 / 8;
  background: var(--surface-2);
  overflow: hidden;
}
.ad-media img:not(.icon) { width: 100%; height: 100%; object-fit: cover; }
.ad-media-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(220px 120px at 20% 10%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--surface-2)), var(--surface-2));
  color: var(--brand);
}
.ad-inactive-badge { left: auto; right: 0.7rem; }
.ad-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.ad-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.ad-heading h3 { font-size: 1.05rem; }
.ad-body p { color: var(--muted); font-size: 0.84rem; }
.ad-address { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem !important; }
.ad-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.4rem; padding-top: 0.5rem; }
.ad-priority { color: var(--accent); }
[data-theme="dark"] .ad-priority .icon { filter: none; }
.ad-card-compact .ad-media { aspect-ratio: 16 / 6; }

.place-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 650;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .chip.active { color: #042f2a; }

/* ---------- Perfil ---------- */

.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--surface) 60%);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.2rem;
}
.profile-avatar { flex-shrink: 0; }
.profile-avatar .avatar { width: 92px !important; height: 92px !important; border: 4px solid var(--surface); box-shadow: var(--shadow-md); }
.profile-title { min-width: 0; flex: 1; }
.profile-title h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.profile-title p { color: var(--muted); font-size: 0.88rem; margin-top: 0.3rem; }
.profile-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.profile-stat {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.profile-stat strong { display: block; font-family: var(--font-display); font-size: 1.45rem; line-height: 1.1; }
.profile-stat span { color: var(--muted); font-size: 0.78rem; font-weight: 650; }

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.8fr);
  gap: 1.2rem;
  align-items: start;
}
.profile-column { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }

.my-route-list { display: flex; flex-direction: column; gap: 0.65rem; }
.my-route {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
.my-route:hover { border-color: var(--brand); color: var(--text); }
.my-route-date {
  width: 48px;
  flex-shrink: 0;
  text-align: center;
  padding: 0.3rem;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  line-height: 1.05;
}
[data-theme="dark"] .my-route-date { color: var(--brand); }
.my-route-date strong { display: block; font-size: 1rem; }
.my-route-date span { display: block; font-size: 0.62rem; text-transform: uppercase; font-weight: 700; }
.my-route-info { min-width: 0; flex: 1; }
.my-route-info strong { display: block; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-route-info span { color: var(--muted); font-size: 0.74rem; }

.image-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
}
.image-preview {
  width: 96px;
  height: 76px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.image-preview img:not(.icon) { width: 100%; height: 100%; object-fit: cover; }
.image-inputs { display: flex; flex-direction: column; gap: 0.4rem; }
.file-input { font-size: 0.78rem; }

/* ---------- Administración ---------- */

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.3rem;
  align-items: start;
}
.admin-nav {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.7rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav a.active { background: var(--brand); color: #fff; }
[data-theme="dark"] .admin-nav a.active { color: #042f2a; }
.admin-content { min-width: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-head h1 { font-size: clamp(1.4rem, 2.8vw, 2rem); }
.admin-head p { color: var(--muted); font-size: 0.86rem; margin-top: 0.2rem; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}
.admin-stat {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.admin-stat strong { display: block; font-family: var(--font-display); font-size: 1.3rem; line-height: 1.1; }
.admin-stat span { color: var(--muted); font-size: 0.73rem; font-weight: 650; }

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 640px;
}
.data-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.table-user { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.table-user div { min-width: 0; }
.table-user strong { display: block; font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-user span:not(.avatar) { display: block; color: var(--muted); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty { padding: 2rem; text-align: center; color: var(--muted); }
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.table-search { display: flex; gap: 0.4rem; flex: 1; min-width: 220px; max-width: 430px; }
.table-search .input { min-height: 40px; }

.config-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  word-break: break-all;
  color: var(--muted);
}
.config-pre {
  margin: 0;
  padding: 1rem;
  max-height: 480px;
  overflow: auto;
  border-radius: 11px;
  background: #0b1714;
  color: #d8f3ec;
  font-size: 0.75rem;
  line-height: 1.5;
}
/* Envolvemos los JSON con un contenedor de superficie clara para no romper el tema. */
.config-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 1rem; }

.bar-chart { display: flex; flex-direction: column; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 42px; gap: 0.6rem; align-items: center; font-size: 0.78rem; }
.bar-track { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--accent))); }
.bar-count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Footer / bottom nav ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: 2rem 0 calc(2rem + env(safe-area-inset-bottom));
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 0.7rem; }
.footer-brand strong { font-family: var(--font-display); }
.footer-brand p { color: var(--muted); font-size: 0.78rem; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 0.82rem; font-weight: 650; }
.footer-links a:hover { color: var(--brand); }
.footer-meta { color: var(--muted-2); font-size: 0.72rem; width: 100%; }

.bottom-nav {
  display: none;
  position: fixed;
  z-index: 70;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: var(--bottom-nav-h);
  padding: 0.3rem max(0.4rem, env(safe-area-inset-left)) calc(0.3rem + env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  justify-content: space-around;
  align-items: stretch;
  gap: 0.1rem;
  box-shadow: 0 -4px 16px rgba(16, 32, 29, 0.05);
}
.bottom-nav a {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.16rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem;
}
.bottom-nav a.active { color: var(--brand); background: var(--brand-soft); }
.bottom-nav a span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Estados ---------- */

.route-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 4rem 1rem;
  color: var(--muted);
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--brand) 22%, transparent);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 15px; height: 15px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  padding: 2.6rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  text-align: center;
}
.empty-icon {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.9rem;
  background: var(--brand-soft);
  color: var(--brand);
}
.empty-state h2,
.empty-state h3 { font-size: 1.15rem; }
.empty-state p { color: var(--muted); font-size: 0.88rem; max-width: 44ch; margin: 0.35rem auto 0.9rem; }

.error-block {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}
.error-block h2 { font-size: 1.05rem; }
.error-block p { font-size: 0.86rem; margin: 0.25rem 0 0.7rem; }

.skeleton-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
.skeleton-media { aspect-ratio: 16 / 9; }
.skeleton-lines { padding: 1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.skeleton-line { height: 10px; border-radius: 999px; }
.skeleton-line.short { width: 38%; }
.skeleton-line.medium { width: 68%; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  padding: 0.5rem 1rem;
  text-align: center;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}

/* ---------- Toasts / modales ---------- */

.toast-region {
  position: fixed;
  z-index: 120;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast-in { opacity: 1; transform: none; }
.toast-out { opacity: 0; transform: translateY(6px) scale(0.98); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.1rem;
}
.toast-success { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.toast-success .icon { filter: none; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 16, 13, 0.55);
  opacity: 0;
  transition: opacity 160ms ease;
  overflow-y: auto;
}
.modal-overlay.open { opacity: 1; }
.modal-overlay.closing { opacity: 0; }
.modal {
  width: min(560px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.985);
  transition: transform 180ms ease;
}
.modal-overlay.open .modal { transform: none; }
.modal-wide { width: min(820px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem 0.7rem;
}
.modal-head h2 { font-size: 1.15rem; }
.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--surface-2);
}
.modal-content {
  padding: 0.4rem 1.15rem 1rem;
  overflow-y: auto;
}
.modal-message { color: var(--muted); font-size: 0.92rem; white-space: pre-wrap; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.modal .form-grid { grid-template-columns: 1fr; }
.modal .form-grid .span-2 { grid-column: auto; }
.modal .form-actions { margin-top: 0.9rem; }

/* ---------- Responsive ---------- */

@media (max-width: 1099px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 190px; }
  .hero-bike { width: 200px; }
  .hero h1 { max-width: 20ch; }
  .hero-stat-a { left: 4%; }
  .hero-stat-b { right: 4%; }
  .detail-layout,
  .profile-layout { grid-template-columns: 1fr; }
  .detail-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 180px minmax(0, 1fr); }
  .main-nav a { padding: 0.55rem; }
  .main-nav a > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .filters-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters-form .field:first-child { grid-column: 1 / -1; }
}

@media (max-width: 759px) {
  :root { --header-h: 64px; }
  .container { width: calc(100% - 1.5rem); }
  .app-root { padding-block: 1rem 2rem; }

  .main-nav { display: none; }
  .bottom-nav { display: flex; }
  .header-inner { gap: 0.5rem; }
  .header-actions .btn-ghost { display: none; }
  .header-actions .btn-primary { padding-inline: 0.75rem; }
  .brand-text strong { font-size: 1.02rem; white-space: nowrap; }
  .header-user-name { display: none; }
  .brand-text small { display: none; }
  .header-user { padding: 0.2rem; background: transparent; }
  .header-actions { margin-left: auto; gap: 0.35rem; }
  .header-actions .btn { padding-inline: 0.7rem; }
  .site-footer { padding-bottom: calc(1.4rem + var(--bottom-nav-h) + env(safe-area-inset-bottom)); margin-top: 1.2rem; }
  .footer-links { display: none; }

  .hero { padding: 1.3rem; border-radius: var(--radius); }
  .hero h1 { font-size: clamp(1.75rem, 8vw, 2.5rem); }
  .hero-art { display: none; }
  .hero-actions .btn { flex: 1; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 0.8rem; gap: 0.55rem; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 1.18rem; }
  .how-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .home-section-head { align-items: center; }
  .home-section-head .btn { padding-inline: 0.7rem; }

  .filters-form { grid-template-columns: 1fr 1fr; }
  .filters-form .field:first-child { grid-column: 1 / -1; }
  .filters-form .filters-actions { grid-column: 1 / -1; }
  .filters-actions .btn { flex: 1; }
  .filter-check { grid-column: 1 / -1; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .form-section { padding: 1rem; }
  .form-actions { align-items: stretch; }
  .form-actions .btn { flex: 1; }

  .detail-head { flex-direction: column; padding: 1.05rem; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1; }
  .detail-cover { aspect-ratio: 16 / 9; min-height: 0; }
  .detail-side { grid-template-columns: 1fr; }
  .facts-grid { grid-template-columns: 1fr 1fr; }
  .comment-form-footer { flex-direction: column; align-items: stretch; }
  .comment-form-footer .btn { width: 100%; }

  .auth-wrap { grid-template-columns: 1fr; margin: 0.5rem auto; }
  .auth-aside { display: none; }

  .profile-hero { flex-wrap: wrap; padding: 1.1rem; }
  .profile-avatar .avatar { width: 70px !important; height: 70px !important; }
  .profile-actions { width: 100%; }
  .profile-actions .btn { flex: 1; }
  .profile-stats { grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
  .profile-stat { padding: 0.7rem; }
  .profile-stat strong { font-size: 1.15rem; }

  .image-field { grid-template-columns: 72px minmax(0, 1fr); }
  .image-preview { width: 72px; height: 64px; }

  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.35rem;
    scrollbar-width: thin;
  }
  .admin-nav a { white-space: nowrap; padding: 0.55rem 0.7rem; }
  .admin-nav a span { display: inline; }
  .admin-content { overflow: hidden; }
  .table-wrap { border-radius: 12px; }
  .table-search { max-width: none; }

  .toast-region {
    left: max(0.75rem, env(safe-area-inset-left));
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 0.7rem);
    width: auto;
  }
  .modal-overlay { padding: 0.6rem; align-items: end; }
  .modal { max-height: 88vh; border-radius: 20px; }
}

@media (max-width: 420px) {
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .filters-form { grid-template-columns: 1fr; }
  .filters-form .field:first-child { grid-column: auto; }
  .filters-form .filters-actions,
  .filter-check { grid-column: auto; }
  .profile-stats { grid-template-columns: 1fr; }
  .facts-grid { grid-template-columns: 1fr; }
  .brand-text strong { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .route-card:hover,
  .route-card:hover .route-card-media img { transform: none; }
}

@media print {
  .site-header,
  .site-footer,
  .bottom-nav,
  .toast-region,
  .modal-overlay { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .container { width: 100%; }
}
