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

:root {
  --bg:           #0b1120;
  --surface:      #162032;
  --surface-2:    #1e2f47;
  --border:       #253550;
  --border-light: #2e4368;
  --text:         #f1f5f9;
  --text-muted:   #7e96b3;
  --muted:        #7e96b3;   /* alias used by garage */
  --accent:       #f97316;
  --accent-hover: #ea6c0a;
  --accent-dim:   rgba(249,115,22,.12);
  --accent-2:     #22d3ee;
  --accent-2-dim: rgba(34,211,238,.10);
  --green:        #4ade80;
  --red:          #f87171;
  --radius:       14px;
  --radius-sm:    9px;
  --radius-xs:    6px;
  --shadow-sm:    0 2px 8px rgba(0,0,0,.35);
  --shadow-md:    0 6px 24px rgba(0,0,0,.45);
  --shadow-lg:    0 16px 52px rgba(0,0,0,.55);
  --glow-accent:  0 0 0 1px rgba(249,115,22,.4), 0 4px 20px rgba(249,115,22,.18);
  --glow-cyan:    0 0 0 1px rgba(34,211,238,.35), 0 4px 18px rgba(34,211,238,.14);
}

.hidden { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(249,115,22,.07), transparent);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* HEADER */
header {
  background: rgba(22,32,50,.82);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,.03), var(--shadow-sm);
}

.header-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-home {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.brand-home:hover .brand-title { color: var(--accent); }
.header-title { min-width: 0; }

.btn-history {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  position: relative;
}

.btn-history:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(249,115,22,.08);
}
.nav-star {
  color: #facc15;
  font-size: 0.95rem;
  line-height: 1;
}

.history-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.logo-icon {
  width: 40px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
}

header .subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: .02em;
}

/* MAIN */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* STEPS */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.step-number {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all .3s;
  background: var(--bg);
}

.step span {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color .3s;
  letter-spacing: .02em;
}

.step.active .step-number {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(249,115,22,.18);
}

.step.active span { color: var(--text); font-weight: 600; }

.step.done .step-number {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.step.done .step-number::after { content: "✓"; font-size: 0.85rem; }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 0.75rem;
  margin-bottom: 1.25rem;
  border-radius: 1px;
  transition: background .4s;
}

.step-line.done { background: linear-gradient(90deg, var(--accent), rgba(249,115,22,.4)); }

/* PANELS */
.panel { animation: fadeIn .35s cubic-bezier(.22,.68,0,1.2); }
.panel.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  letter-spacing: -.02em;
}

.panel-desc {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* BUTTONS */
.btn {
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .18s;
  letter-spacing: .01em;
}

.btn-primary {
  background: linear-gradient(135deg, #fb923c 0%, #f97316 50%, #ea6c0a 100%);
  color: #fff;
  border-color: #ea6c0a;
  box-shadow: 0 2px 10px rgba(249,115,22,.3), inset 0 1px 0 rgba(255,255,255,.15);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f97316 0%, #ea6c0a 100%);
  box-shadow: 0 4px 18px rgba(249,115,22,.45), inset 0 1px 0 rgba(255,255,255,.15);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-secondary:hover { background: var(--border); border-color: var(--border-light); }

.btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(249,115,22,.35);
}
.btn-accent:hover { background: rgba(249,115,22,.2); border-color: var(--accent); }

/* BIKE TYPE CARDS */
.bike-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
}

.bike-card input { display: none; }

.bike-card .card-inner {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  transition: all .22s;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.bike-card .card-inner svg {
  width: 64px;
  height: 36px;
  color: var(--text-muted);
  transition: color .2s;
}

.bike-card .card-inner strong { font-size: 0.92rem; font-weight: 700; }
.bike-card .card-inner small { color: var(--text-muted); font-size: 0.73rem; line-height: 1.4; }

.bike-card input:checked + .card-inner {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--glow-accent);
}

.bike-card input:checked + .card-inner svg { color: var(--accent); }

.bike-card .card-inner:hover {
  border-color: rgba(249,115,22,.5);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* MEASUREMENT FORM */
.measurement-guide {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  align-items: start;
}

.body-diagram {
  width: 160px;
  height: 320px;
  position: sticky;
  top: 5rem;
}

.form-fields { display: flex; flex-direction: column; gap: 1.25rem; }

.field-group { display: flex; flex-direction: column; gap: 0.3rem; }

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-yellow  { background: #f59e0b; }
.dot-cyan    { background: #22d3ee; }
.dot-pink    { background: #f472b6; }
.dot-purple  { background: #a78bfa; }
.dot-green   { background: #4ade80; }
.dot-orange  { background: #fb923c; }

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}

.input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  padding: 0.625rem 0.875rem;
  width: 100%;
}

.input-wrap input::placeholder { color: var(--text-muted); }

/* Remove number arrows */
.input-wrap input::-webkit-inner-spin-button,
.input-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap input[type=number] { -moz-appearance: textfield; }

.unit {
  padding: 0 0.875rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.field-group small { color: var(--text-muted); font-size: 0.75rem; line-height: 1.4; }

/* FLEXIBILITY */
.flexibility-section {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.flexibility-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.flex-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
}

.flex-card input { display: none; }

.flex-inner {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 0.875rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  text-align: center;
  transition: all .2s;
}

.flex-icon { font-size: 1.75rem; }
.flex-inner strong { font-size: 0.875rem; }
.flex-inner small { color: var(--text-muted); font-size: 0.72rem; line-height: 1.4; }

.flex-card input:checked + .flex-inner {
  border-color: var(--accent-2);
  background: var(--accent-2-dim);
  box-shadow: var(--glow-cyan);
}

.flex-inner:hover { border-color: rgba(34,211,238,.5); transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* DIAGRAM */
.diagram-section {
  margin-bottom: 2rem;
  background: linear-gradient(160deg, #152033 0%, #0f1726 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 0.85rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.diagram-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 110%, rgba(249,115,22,.05), transparent);
  pointer-events: none;
}

.diagram-section h3 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 0.85rem;
}

.cyclist-svg-wrap {
  width: 100%;
  overflow: hidden;
}
.cyclist-svg-wrap svg {
  max-width: 680px;
  margin: 0 auto;
}
.position-empty {
  margin: 0.75rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px dashed rgba(34,211,238,.38);
  background: rgba(34,211,238,.08);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.position-empty.hidden { display: none; }

/* RECOMMENDATIONS */
.recs-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.recs-header {
  margin-bottom: 1.25rem;
}

.recs-section h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  letter-spacing: -.01em;
}

.recs-subhead {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recs-subhead span {
  color: var(--accent-2);
  font-weight: 600;
}

.recs-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rec-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}

.rec-card:hover {
  border-color: rgba(249,115,22,.4);
  box-shadow: 0 4px 18px rgba(0,0,0,.4);
  transform: translateX(2px);
}

.rec-card.rec-top {
  border-color: rgba(249,115,22,.6);
  background: linear-gradient(135deg, rgba(249,115,22,.09) 0%, rgba(249,115,22,.03) 100%);
  box-shadow: var(--glow-accent);
}

.rec-rank {
  font-size: 1.4rem;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.rec-body { flex: 1; min-width: 0; }

.rec-brand {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.rec-model {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-year {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.rec-size-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.rec-size {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(249,115,22,0.12);
  padding: 0.1rem 0.5rem;
  border-radius: 100px;
}

.rec-geo { font-size: 0.75rem; color: var(--text-muted); }

.rec-deltas {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.delta {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-weight: 500;
}

.delta-ok { background: rgba(74,222,128,0.12); color: #4ade80; }
.delta-off { background: rgba(248,113,113,0.12); color: #f87171; }

.rec-score-wrap {
  text-align: center;
  flex-shrink: 0;
  min-width: 72px;
}

.rec-score {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.score-great { color: #4ade80; }
.score-good  { color: var(--accent); }
.score-ok    { color: #f87171; }

.rec-score-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.rec-price {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.recs-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem 0;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.04);
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color .2s;
}

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

.modal-body {
  overflow-y: auto;
  padding: 1rem 1.5rem;
  flex: 1;
}

.history-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem 0;
  text-align: center;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.history-item:last-child { border-bottom: none; }

.history-info { flex: 1; min-width: 0; }

.history-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.history-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.history-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }

.btn-danger {
  background: rgba(248,113,113,0.15);
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.3);
}

.btn-danger:hover { background: rgba(248,113,113,0.25); }

/* RESULTS */
.results-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.bike-type-badge {
  padding: 0.25rem 0.75rem;
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

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

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  box-shadow: var(--shadow-sm);
}

.result-card--wide {
  grid-column: 1 / -1;
  border-color: rgba(249,115,22,.35);
}

.result-card:hover {
  border-color: rgba(249,115,22,.4);
  box-shadow: 0 4px 16px rgba(0,0,0,.35), 0 0 0 1px rgba(249,115,22,.15);
  transform: translateY(-1px);
}

.result-card.primary {
  border-color: rgba(249,115,22,.5);
  background: linear-gradient(135deg, rgba(249,115,22,.1) 0%, rgba(249,115,22,.04) 100%);
  grid-column: span 2;
  box-shadow: var(--glow-accent);
}

.result-icon { font-size: 1.1rem; margin-bottom: 0.15rem; opacity: .9; }

.result-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Icono de ayuda con burbuja explicativa (hover en escritorio, toque/foco en móvil) */
.info-ico {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(34,211,238,.28);
  background: rgba(34,211,238,.07);
  color: var(--accent-2);
  cursor: help;
  opacity: 0.9;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .16s, background .16s, color .16s, transform .16s;
  vertical-align: -0.15em;
}
.info-ico svg {
  width: 100%;
  height: 100%;
  display: block;
}
.info-ico circle,
.info-ico path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.info-ico:hover, .info-ico:focus {
  opacity: 1;
  outline: none;
  border-color: rgba(34,211,238,.62);
  background: rgba(34,211,238,.14);
  color: #67e8f9;
  transform: translateY(-1px);
}
.info-ico::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 0.55rem 0.7rem;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s;
  z-index: 20;
  pointer-events: none;
}
.info-ico:hover::after, .info-ico:focus::after { opacity: 1; visibility: visible; }

.result-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 0.25rem 0;
}

.result-card.primary .result-value { font-size: 2.5rem; }

.result-unit { font-size: 0.72rem; color: var(--text-muted); }

.result-value--sm {
  font-size: 1rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

.result-method {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* TIPS */
.tips-section {
  margin-top: 2rem;
  background: linear-gradient(135deg, rgba(34,211,238,.06) 0%, transparent 60%), var(--surface);
  border: 1px solid rgba(34,211,238,.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.tips-section h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--accent-2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.tips-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tips-list li::before {
  content: "→";
  color: var(--accent-2);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ANGLES */
.angles-section {
  margin-top: 1.75rem;
}

.angles-section h3 {
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
  letter-spacing: -.01em;
}

.angles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.angle-card {
  background: linear-gradient(160deg, rgba(34,211,238,.05) 0%, transparent 70%), var(--surface);
  border: 1px solid rgba(34,211,238,.18);
  border-radius: var(--radius-sm);
  padding: 1.1rem 0.85rem;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}

.angle-card:hover {
  border-color: rgba(34,211,238,.4);
  box-shadow: var(--glow-cyan);
}

.angle-name { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: .05em; }
.angle-value { font-size: 1.45rem; font-weight: 800; color: var(--accent-2); line-height: 1; }
.angle-range { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.25rem; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-size: 0.875rem;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transition: opacity .3s;
}

.toast.hidden { display: none; }

/* FOOTER */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(to top, rgba(0,0,0,.2), transparent);
  letter-spacing: .02em;
}

/* PRINT — solo se imprime la plantilla de informe (#print-report),
   nunca la app en sí. Cada botón "Exportar PDF" la rellena antes de imprimir. */
.print-report { display: none; }

.print-page {
  color: #0f172a;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.print-page .print-header {
  text-align: left;
  border: 1px solid #d7dee8;
  border-left: 7px solid #ea6c0a;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff7ed 0%, #f8fafc 55%, #ecfeff 100%);
}
.print-page .print-brand {
  display: block;
  font-size: 0.72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #ea6c0a;
  font-weight: 800;
}
.print-page .print-header h1 {
  margin: 4px 0;
  color: #0f172a;
  font-size: 1.65rem;
}
.print-page .print-meta { color: #64748b; font-size: 0.88rem; }
.print-page .print-disclaimer {
  border-top: 1px solid #cbd5e1;
  color: #64748b;
}

@media print {
  @page { margin: 14mm 12mm; }
  body { background: #fff; color: #111; }
  .app, .toast, .modal-overlay { display: none !important; }
  .print-report { display: block !important; }

  .print-page { max-width: 100%; }

  .print-header {
    text-align: center;
    border-bottom: 2px solid #ea6c0a;
    padding-bottom: 0.6rem;
    margin-bottom: 1.2rem;
    break-after: avoid;
  }
  .print-brand { font-size: 0.8rem; letter-spacing: .08em; text-transform: uppercase; color: #555; }
  .print-header h1 { margin: 0.2rem 0 0.3rem; font-size: 1.5rem; color: #111; }
  .print-meta { font-size: 0.85rem; color: #555; margin: 0; }

  .print-disclaimer {
    margin-top: 1.2rem;
    padding-top: 0.6rem;
    border-top: 1px solid #ccc;
    font-size: 0.72rem;
    color: #666;
    break-inside: avoid;
  }

  /* Nunca partir una tarjeta o fila entre dos páginas. */
  .result-card, .rec-card, .compare-row, .reco-banner,
  .tips-section, .angles-section, .diagram-section, .recs-section,
  .compare-header-info, .compare-sizes > * {
    break-inside: avoid;
  }
  h3, .compare-size-head { break-after: avoid; }

  .result-value, .rec-score { color: #ea6c0a !important; }
  .results-grid { grid-template-columns: repeat(3, 1fr); }
  .result-card.primary { grid-column: span 1; }
  .cyclist-svg-wrap svg { filter: invert(1) hue-rotate(180deg); }

  /* Los componentes reutilizados de pantalla vienen con tema oscuro; en el
     informe simple (#print-report → .print-page) los forzamos a tema claro
     legible. Se scopea bajo .print-report para ganar en especificidad a las
     reglas base (que aparecen más abajo en la hoja). */
  .print-report .result-card, .print-report .rec-card, .print-report .compare-row,
  .print-report .reco-banner, .print-report .tips-section, .print-report .angles-section,
  .print-report .diagram-section, .print-report .recs-section, .print-report .compare-header-info,
  .print-report .tuner, .print-report .tuner-readout {
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
  }
  .print-report .compare-row--best { border-color: rgba(21,128,61,.45) !important; background: #f0fdf4 !important; }
  .print-report h3, .print-report .compare-size-name, .print-report .tuner-title { color: #0f172a !important; }
  .print-report p, .print-report li, .print-report small,
  .print-report .compare-recs, .print-report .reco-score-label, .print-report .tuner-sub,
  .print-report .compare-size-sub, .print-report .tuner-k, .print-report .tuner-arrow { color: #334155 !important; }
  .print-report .rec-score, .print-report .result-value, .print-report .reco-size,
  .print-report .tuner-eff, .print-report strong { color: #ea6c0a !important; }
  .print-report .delta { background: #eef2f7 !important; color: #334155 !important; }
  .print-report .fit-verdict.ok, .print-report .delta-ok { color: #15803d !important; }
  .print-report .fit-verdict.bad { color: #b91c1c !important; }
  .print-report .fit-verdict.mid { color: #a16207 !important; }
  .print-report .fit-verdict.warn { color: #c2410c !important; }
  .print-report .geo-k { color: #334155 !important; }
  .print-report .geo-bike { color: #0f172a !important; font-weight: 700; }
  .print-report .geo-arrow { color: #475569 !important; }
  /* Controles interactivos del tuner no aportan en papel. */
  .print-report .tuner-sliders, .print-report #tuner-auto { display: none !important; }
  /* La cabecera del informe simple: la regla genérica header{} la pintaba
     de azul oscuro. Forzamos fondo claro y buen contraste. */
  .print-report .print-header {
    background: #fff !important; backdrop-filter: none !important;
    border-bottom: 2px solid #ea6c0a; box-shadow: none !important;
  }
  .print-report .print-header h1 { color: #0f172a !important; }
  .print-report .print-brand, .print-report .print-meta { color: #64748b !important; }
}

/* ── BODY SCANNER CTA (step 2) ── */
.scan-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, rgba(34,211,238,.12) 0%, rgba(249,115,22,.08) 100%), var(--surface);
  border: 1.5px solid rgba(34,211,238,.35);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.scan-cta:hover { border-color: var(--accent-2); transform: translateY(-2px); box-shadow: var(--glow-cyan); }
.scan-cta-icon {
  flex-shrink: 0;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(34,211,238,.15);
  color: var(--accent-2);
}
.scan-cta-text { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.scan-cta-text strong { font-size: 0.95rem; font-weight: 700; }
.scan-cta-text small { font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }
.scan-cta-arrow { font-size: 1.3rem; color: var(--accent-2); flex-shrink: 0; }

.scan-divider {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--text-muted); font-size: 0.75rem;
  margin-bottom: 1.75rem;
}
.scan-divider::before, .scan-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── BODY SCANNER OVERLAY ── */
.scanner {
  position: fixed; inset: 0; z-index: 200;
  background: #05080f;
  display: flex; flex-direction: column;
  color: var(--text);
  overscroll-behavior: contain;
}
.scanner.hidden { display: none; }

.scanner-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.1rem;
  background: rgba(5,8,15,.6);
  z-index: 3;
}
.scanner-step-label { font-size: 0.85rem; font-weight: 700; letter-spacing: .02em; }
.scanner-close {
  background: rgba(255,255,255,.08); border: none; color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.scanner-close:hover { background: rgba(255,255,255,.18); }

.scanner-stage { flex: 1; position: relative; overflow: hidden; }
.scanner-stage video,
.scanner-stage canvas.scan-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.scanner-stage video { transform: scaleX(-1); }       /* mirror like a selfie */
.scanner-stage canvas.scan-overlay { transform: scaleX(-1); pointer-events: none; }

.scan-silhouette {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 2;
}
.scan-silhouette svg { height: 82%; opacity: .5; }
.scan-silhouette.ok svg { opacity: .85; }

.scan-feedback {
  position: absolute; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  z-index: 4; text-align: center; width: min(92%, 460px);
}
.scan-feedback-pill {
  display: inline-block;
  background: rgba(5,8,15,.82);
  border: 1px solid var(--border-light);
  padding: 0.6rem 1.1rem; border-radius: 100px;
  font-size: 0.95rem; font-weight: 600;
  backdrop-filter: blur(8px);
  transition: all .2s;
}
.scan-feedback-pill.ok { border-color: var(--green); color: var(--green); background: rgba(8,30,18,.85); }
.scan-feedback-pill.warn { border-color: var(--accent); }

.scan-countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 5; pointer-events: none;
}
.scan-countdown span {
  font-size: 7rem; font-weight: 900; color: #fff;
  text-shadow: 0 4px 30px rgba(0,0,0,.6);
  animation: cdPulse .9s ease-out;
}
@keyframes cdPulse { from { transform: scale(1.6); opacity: 0; } 40% { opacity: 1; } to { transform: scale(.8); opacity: .2; } }

.scan-progress {
  position: absolute; left: 50%; bottom: 4.5rem; transform: translateX(-50%);
  width: min(70%, 320px); height: 8px; z-index: 4;
  background: rgba(255,255,255,.18); border-radius: 100px; overflow: hidden;
}
.scan-progress-bar { height: 100%; width: 0; background: var(--green); transition: width .12s linear; }

.scan-flash { position: absolute; inset: 0; background: #fff; z-index: 6; opacity: 0; pointer-events: none; }
.scan-flash.fire { animation: flash .45s ease-out; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* Intro / review screens share a centered card layout */
.scan-screen {
  position: absolute; inset: 0; z-index: 7;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1.5rem; gap: 1rem;
  background: radial-gradient(ellipse 70% 50% at 50% 30%, rgba(34,211,238,.08), transparent), #05080f;
  overflow-y: auto;
}
.scan-screen.hidden { display: none; }
.scan-screen h3 { font-size: 1.4rem; font-weight: 800; }
.scan-screen p { color: var(--text-muted); font-size: 0.9rem; max-width: 360px; line-height: 1.55; }
.pedal-calib-stage {
  position: relative; width: 100%; max-width: 460px; flex: 1 1 auto;
  min-height: 200px; border-radius: 12px; overflow: hidden;
  background: #0a0f1a; touch-action: none;
}
.pedal-calib-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.scan-checklist { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 0.6rem; max-width: 320px; }
.scan-checklist li { display: flex; gap: 0.6rem; font-size: 0.9rem; }
.scan-checklist li::before { content: "✓"; color: var(--accent-2); font-weight: 800; }
.pose-guide {
  width: 118px;
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: rgba(34,211,238,.06);
}
.pose-guide svg {
  width: 82px;
  height: 190px;
}
.scan-height-field { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.scan-height-field input {
  width: 140px; text-align: center; font-size: 1.3rem; font-weight: 700;
  background: var(--surface); border: 1.5px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text); padding: 0.6rem; outline: none;
}
.scan-height-field input:focus { border-color: var(--accent-2); }

.scan-review-list { width: min(100%, 380px); display: flex; flex-direction: column; gap: 0.5rem; }
.scan-review-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 0.95rem;
}
.scan-review-row label { font-size: 0.85rem; color: var(--text-muted); }
.scan-review-row .rv-input { display: flex; align-items: center; gap: 0.3rem; }
.scan-review-row input {
  width: 70px; text-align: right; background: transparent; border: none;
  color: var(--accent-2); font-size: 1.05rem; font-weight: 700; outline: none;
}
.scan-review-row .rv-unit { font-size: 0.75rem; color: var(--text-muted); }
.scan-disclaimer {
  font-size: 0.78rem; color: var(--text-muted); max-width: 380px;
  background: rgba(249,115,22,.08); border: 1px solid rgba(249,115,22,.25);
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; line-height: 1.5;
}
.scan-height-check {
  width: min(100%, 380px); font-size: 0.8rem; line-height: 1.5;
  border-radius: var(--radius-sm); padding: 0.65rem 0.9rem; margin-bottom: 0.6rem;
  background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.3);
  color: var(--text-muted);
}
.scan-height-check b { color: var(--accent-2); }
.scan-height-check.warn {
  background: rgba(249,115,22,.1); border-color: rgba(249,115,22,.45);
}
.scan-height-check.warn b { color: #fb923c; }

.scan-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.scan-thumbs { display: flex; gap: 0.6rem; }
.scan-thumbs img { width: 64px; height: 90px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border); }
.scan-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BIKE PHOTO MEASURER ── */
.bikescan { position: fixed; inset: 0; z-index: 200; background: #05080f; display: flex; flex-direction: column; color: var(--text); }
.bikescan.hidden { display: none; }
.bikescan-top { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; }
.bikescan-top strong { font-size: 0.9rem; }
.bikescan-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; }
.bikescan-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bikescan-bottom {
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: rgba(5,8,15,.92); border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.7rem;
}
.bikescan-instruction { font-size: 0.92rem; font-weight: 600; text-align: center; min-height: 1.2em; }
.bikescan-instruction .hint { display: block; font-size: 0.76rem; font-weight: 400; color: var(--text-muted); margin-top: 0.2rem; }
.bikescan-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center; }
.bikescan-chip {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 0.45rem 0.8rem; border-radius: 100px; font-size: 0.8rem; cursor: pointer;
}
.bikescan-chip.sel { border-color: var(--accent-2); background: var(--accent-2-dim); color: var(--accent-2); }
.bikescan-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.bikescan-num { width: 6.5rem; padding: 0.5rem 0.6rem; border-radius: 8px; border: 1px solid var(--border, #2a3550); background: var(--bg-elev, #0e1626); color: var(--text); font-size: 1rem; text-align: center; }
.bikescan-review { display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; }
.bikescan-review .rv { text-align: center; }
.bikescan-review .rv label { display: block; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.bikescan-review .rv input {
  width: 90px; text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--accent-2);
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 0.4rem; outline: none; margin-top: 0.2rem;
}
.bikescan-warn { font-size: 0.75rem; color: var(--text-muted); text-align: center; max-width: 420px; margin: 0 auto; }

/* RESPONSIVE */
@media (max-width: 640px) {
  main { padding: 1.5rem 1rem 4rem; }

  .header-inner { gap: 0.6rem; }
  #btn-favorites-nav {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  #btn-favorites-nav span:not(.history-count):not(.nav-star) { display: none; }
  #btn-favorites-nav .nav-star { font-size: 1.05rem; }

  .measurement-guide { grid-template-columns: 1fr; }
  .body-diagram { display: none; }
  .bike-types { grid-template-columns: repeat(2, 1fr); }
  .flex-options { grid-template-columns: 1fr; }

  .diagram-section { padding: 1rem 0.75rem 0.65rem; margin-left: -0.25rem; margin-right: -0.25rem; }
  .cyclist-svg-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cyclist-svg-wrap svg { min-width: 520px; }
  .result-card.primary { grid-column: span 1; }
  .results-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .result-card--wide { grid-column: span 1; }
  .panel-footer { flex-direction: column; align-items: stretch; }
  .panel-footer .btn { width: 100%; }

  .steps { gap: 0; }
  .step span { display: none; }

  .rec-card { flex-wrap: wrap; }
  .rec-score-wrap { width: 100%; display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
  .rec-score { font-size: 1.1rem; }

  .history-item { flex-direction: column; align-items: flex-start; }
  .history-actions { align-self: flex-end; }
}

/* ════════════════════════════════════════════════════════════
   Rediseño: hub de acciones, perfil, búsqueda paginada, ajuste
   ════════════════════════════════════════════════════════════ */

/* ── Cabecera de vista con botón volver ── */
.view-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.view-head h2 { margin: 0; }

/* ── Control segmentado (tipo de bici / origen) ── */
.seg-control {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.35rem; margin: 0.5rem 0 1rem;
}
.seg-btn {
  flex: 1 1 auto; min-width: 96px; cursor: pointer;
  background: transparent; border: none; color: var(--muted);
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  padding: 0.5rem 0.7rem; border-radius: var(--radius-xs);
  transition: background .16s, color .16s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #fff; }

/* ── Resumen de perfil (hub) ── */
.profile-summary {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.profile-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.profile-summary-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.profile-summary-sub { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 0.15rem; }
.profile-summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}
.profile-summary-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem;
}
.psg-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.6rem 0.5rem; text-align: center;
}
.psg-val { display: block; font-size: 1.15rem; font-weight: 800; color: var(--text); }
.psg-val small { font-size: 0.65rem; color: var(--muted); margin-left: 2px; font-weight: 600; }
.psg-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Tarjetas del hub ── */
.hub-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 0.5rem; }
.hub-card {
  display: flex; flex-direction: column; gap: 0.4rem; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.25rem;
  font-family: inherit; color: var(--text); text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.hub-card:hover { border-color: rgba(249,115,22,.55); box-shadow: var(--glow-accent); transform: translateY(-3px); }
.hub-icon { font-size: 1.9rem; }
.hub-card strong { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.hub-card small { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }

/* ── Búsqueda ── */
.search-controls { display: flex; flex-direction: column; gap: 0.4rem; }
.search-filters { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.search-filters input[type="search"], .search-filters input[type="text"], .search-filters select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.85rem;
  outline: none; font-family: inherit; transition: border-color .18s, box-shadow .18s;
}
.search-filters input[type="search"], .search-filters input[type="text"] { flex: 1; min-width: 180px; }
.search-filters select { cursor: pointer; }
.search-filters input:focus, .search-filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }
.price-filter {
  --price-left: 0%;
  --price-right: 100%;
  display: grid;
  grid-template-columns: auto minmax(160px, 220px) 26px;
  align-items: center;
  gap: 0.75rem;
  min-height: 39px;
  padding: 0.36rem 0.42rem 0.36rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)), var(--bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.price-filter:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12), inset 0 1px 0 rgba(255,255,255,.04);
}
.price-filter-head {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 6.2rem;
}
.price-filter-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.price-filter-head strong {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.price-range {
  position: relative;
  width: 100%;
  height: 28px;
}
.price-range-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 13px;
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(
      to right,
      rgba(148,163,184,.25) 0 var(--price-left),
      var(--accent) var(--price-left) var(--price-right),
      rgba(148,163,184,.25) var(--price-right) 100%
    );
}
.price-range input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}
.price-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
}
.price-range input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  cursor: grab;
  pointer-events: auto;
}
.price-range input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.price-range input[type="range"]::-moz-range-track {
  height: 4px;
  background: transparent;
}
.price-range input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  cursor: grab;
  pointer-events: auto;
}
.price-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.price-clear:hover {
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.search-meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.75rem; }
.favorites-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0.25rem 0 0.85rem;
}

@media (max-width: 640px) {
  .price-filter {
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: 1fr 26px;
  }
  .price-filter-head { grid-column: 1 / -1; }
  .price-range { grid-column: 1; }
  .favorites-toolbar { justify-content: stretch; }
}

/* ── Botón "cómo ajustarla" en card de búsqueda ── */
.rec-adjust-btn { margin-top: 0.6rem; align-self: flex-start; }
.rec-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.rec-actions .rec-adjust-btn { margin-top: 0; }

/* ── Paginación ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.pagination-info { font-size: 0.82rem; color: var(--muted); font-weight: 600; }

/* ── Navegar modelos ── */
.browse-toolbar {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 1.2fr minmax(300px, 1.35fr);
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}
.browse-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.browse-field span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.browse-field select,
.browse-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}
.browse-field select:focus,
.browse-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.browse-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
.browse-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.browse-card-main { min-width: 0; }
.browse-card-top,
.adjust-model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.adjust-model-head h3 { margin: 0; }
.favorite-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.favorite-btn:hover {
  color: #facc15;
  border-color: rgba(250,204,21,.45);
  background: rgba(250,204,21,.08);
}
.favorite-btn.active {
  color: #facc15;
  border-color: rgba(250,204,21,.55);
  background: rgba(250,204,21,.12);
}
.browse-card-meta,
.browse-sizes,
.browse-best {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.browse-best strong { color: var(--text); }
.browse-card-side {
  min-width: 128px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35rem;
}
.browse-card-side .btn {
  width: 100%;
  justify-content: center;
  margin-top: 0;
}

/* ── Ajuste: paneles de origen ── */
.adjust-pane { margin-bottom: 1rem; }
.adjust-pane.hidden { display: none; }
.adjust-pane select, .adjust-pane input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.85rem;
  outline: none; font-family: inherit;
}
.adjust-pane select { cursor: pointer; min-width: 160px; }
.manual-form { display: flex; flex-direction: column; gap: 0.7rem; }
.manual-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.manual-row input, .manual-row select { flex: 1; min-width: 120px; }
.manual-sizes { display: flex; flex-direction: column; gap: 0.5rem; }
.adjust-result { margin-top: 1.25rem; }
#photo-type { margin: 0 0.5rem 0.75rem 0; }

/* ── Clases portadas del garaje (usadas por la vista Ajuste) ── */
.custom-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; background: rgba(249,115,22,.15); color: var(--accent);
  border: 1px solid rgba(249,115,22,.25);
}
.size-row { display: grid; grid-template-columns: 80px 1fr 1fr 1fr auto; gap: 0.5rem; align-items: center; }
.size-row input { padding: 0.42rem 0.55rem; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); font-family: inherit; min-width: 0; }
.btn-remove-size { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 0.3rem; line-height: 1; border-radius: var(--radius-xs); transition: color .15s; }
.btn-remove-size:hover { color: #f87171; }

.compare-header-info { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.compare-header-info h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.4rem; letter-spacing: -.01em; }
.compare-header-info p { font-size: 0.8rem; color: var(--muted); margin: 0.2rem 0; }
.adjust-change-model { margin-top: 0.65rem; }
.compare-ideal {
  color: var(--text) !important; font-size: 0.85rem !important; margin-top: 0.5rem !important;
  background: var(--accent-dim); border: 1px solid rgba(249,115,22,.2);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; display: inline-block;
}
.pedal-linked-measure {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 0.65rem; padding: 0.65rem 0.75rem; border: 1px solid rgba(34,211,238,.26);
  background: rgba(34,211,238,.07); border-radius: var(--radius-sm); color: var(--text);
}
.compare-header-info .pedal-linked-measure span { color: var(--text); font-size: 0.86rem; }
.pedal-linked-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.pedal-linked-actions select {
  min-width: 190px; max-width: 100%; padding: 0.45rem 0.6rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; font-size: 0.82rem;
}
.pedal-linked-actions select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(34,211,238,.12); outline: none; }
.compare-sizes { display: flex; flex-direction: column; gap: 0.85rem; }
.compare-sizes--filtered { margin-bottom: 0.85rem; }
.compare-sizes--filtered .compare-row { border-color: rgba(34,211,238,.34); background: rgba(34,211,238,.045); }
.compare-row { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem 1rem; transition: border-color .18s; }
.compare-row:hover { border-color: var(--border-light); }
.compare-row--best { border-color: rgba(74,222,128,.5); background: rgba(74,222,128,.04); }
.fit-verdict { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-left: auto; white-space: nowrap; }
.fit-verdict.ok { background: rgba(74,222,128,.12); color: #4ade80; border: 1px solid rgba(74,222,128,.28); }
.fit-verdict.mid { background: rgba(250,204,21,.12); color: #facc15; border: 1px solid rgba(250,204,21,.28); }
.fit-verdict.warn { background: rgba(251,146,60,.12); color: #fb923c; border: 1px solid rgba(251,146,60,.28); }
.fit-verdict.bad { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.28); }
.compare-size-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.compare-size-name { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.compare-deltas { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.compare-geo { margin-bottom: 0.55rem; display: flex; flex-direction: column; gap: 0.3rem; }
.compare-geo .geo-line { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; font-size: 0.82rem; }
.compare-geo .geo-k { min-width: 3.2rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: 0.72rem; }
.compare-geo .geo-bike { font-weight: 700; color: var(--text); }
.compare-geo .geo-arrow { color: var(--muted); }
.compare-recs { margin: 0; padding-left: 1.1rem; font-size: 0.79rem; color: var(--muted); }
.compare-recs li { margin: 0.2rem 0; line-height: 1.5; }
.adjust-manual {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(34,211,238,.28);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(34,211,238,.07), rgba(249,115,22,.04)), var(--surface);
}
.adjust-manual-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.adjust-manual-head h3 { margin: 0.1rem 0 0; font-size: 1rem; }
.manual-steps { margin: 0 0 0.9rem; padding-left: 1.15rem; color: var(--text); font-size: 0.86rem; }
.manual-steps li { margin: 0.45rem 0; line-height: 1.5; }
.manual-measure-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.manual-measure-grid > div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.65rem 0.7rem;
}
.manual-measure-grid strong { display: block; color: var(--text); font-size: 0.78rem; margin-bottom: 0.25rem; }
.manual-measure-grid span { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.manual-warnings { margin-top: 0.4rem; }
.rec-info > summary { list-style: none; cursor: pointer; display: inline; }
.rec-info > summary::-webkit-details-marker { display: none; }
.rec-info-ico { display: inline-flex; align-items: center; justify-content: center; margin-left: 0.35rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; font-size: 0.72rem; color: var(--accent-2, #22d3ee); border: 1px solid currentColor; opacity: 0.85; vertical-align: baseline; }
.rec-info[open] .rec-info-ico { opacity: 1; }
.rec-info-detail { display: block; margin-top: 0.3rem; padding-left: 0.6rem; border-left: 2px solid var(--border, #2a3550); color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

/* ── Móvil ── */
@media (max-width: 720px) {
  .hub-actions { grid-template-columns: 1fr; }
  .profile-summary-head { flex-direction: column; }
  .profile-summary-actions { width: 100%; justify-content: stretch; }
  .profile-summary-actions .btn { flex: 1 1 140px; }
  .profile-summary-grid { grid-template-columns: repeat(3, 1fr); }
  .browse-toolbar { grid-template-columns: 1fr 1fr; }
  .browse-field--search { grid-column: 1 / -1; }
  .price-filter--browse { grid-column: 1 / -1; }
  .browse-card { flex-direction: column; }
  .browse-card-side { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .browse-card-side .btn { width: auto; min-width: 110px; }
  .manual-measure-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .size-row { grid-template-columns: 1fr 1fr; }
  .seg-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg-btn { min-width: 0; width: 100%; flex-basis: auto; white-space: normal; line-height: 1.2; }
  .profile-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .history-item-actions { width: 100%; }
  .history-item-actions .btn { flex: 1; }
}

/* ── Análisis de pedaleo ── */
.hub-tag {
  font-size: 0.6rem; font-weight: 700; vertical-align: middle;
  padding: 1px 6px; border-radius: 20px; margin-left: 0.3rem;
  background: rgba(34,211,238,.14); color: #22d3ee; border: 1px solid rgba(34,211,238,.3);
  text-transform: uppercase; letter-spacing: .04em;
}
.pedal-howto {
  background: rgba(11,17,32,.7); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 0.6rem 1.1rem; margin-bottom: 1.1rem;
}
.pedal-howto ol { margin: 0; padding-left: 1.2rem; font-size: 0.84rem; color: var(--muted); }
.pedal-howto li { margin: 0.45rem 0; line-height: 1.5; }
.pedal-howto strong { color: var(--text); }
.pedal-result { margin-top: 1.25rem; }
.pedal-live {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 4.5rem;
  background: rgba(9,14,25,.85); color: var(--text); border: 1px solid var(--border-light);
  border-radius: 20px; padding: 0.35rem 0.9rem; font-size: 0.82rem; white-space: nowrap;
}
.pedal-live b { color: var(--accent); }
.pedal-type-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin: 0.25rem 0 0; }

/* ── Banner de talla recomendada ── */
.reco-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--accent-dim); border: 1px solid rgba(249,115,22,.35);
  border-radius: var(--radius-sm); padding: 0.8rem 1.1rem; margin-bottom: 0.9rem;
}
.reco-label { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.reco-size { display: block; font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.1; }
.reco-score-wrap { text-align: right; }
.reco-score-wrap .rec-score { font-size: 1.5rem; }
.reco-score-label { display: block; font-size: 0.68rem; color: var(--muted); }
.owned-size-picker {
  display: grid; gap: 0.65rem; margin: 0 0 1rem; padding: 0.9rem;
  border: 1px solid rgba(34,211,238,.24); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(34,211,238,.08), rgba(34,211,238,.035));
}
.owned-size-main { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(160px, 240px) auto; align-items: center; gap: 0.75rem; }
.owned-kicker { display: block; color: var(--accent-2); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 0.15rem; }
.owned-size-picker label { color: var(--text); font-size: 1rem; font-weight: 850; letter-spacing: -.01em; }
.owned-size-picker select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-xs); padding: 0.58rem 2rem 0.58rem 0.7rem;
  font: inherit; font-size: 0.9rem; font-weight: 750;
  min-height: 40px; min-width: 0; width: 100%;
}
.owned-size-status {
  display: grid; gap: 0.2rem; padding-top: 0.65rem; border-top: 1px solid rgba(255,255,255,.08);
}
.owned-size-status strong { color: var(--text); font-size: 0.88rem; }
.owned-size-status span { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }

@media (max-width: 640px) {
  .owned-size-main { grid-template-columns: 1fr auto; }
  .owned-size-main > div { grid-column: 1 / -1; }
  .owned-size-picker select { min-width: 0; }
}

/* ═══════════════ Login / cuenta / histórico (backend) ═══════════════ */

/* Overlay de autenticación */
.bf-auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 18, 0.82);
  backdrop-filter: blur(6px);
}
.bf-auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
}
.bf-auth-title { margin: 0 0 4px; font-size: 1.4rem; }
.bf-auth-sub { margin: 0 0 20px; color: var(--text-muted); font-size: 0.9rem; }
.bf-auth-tabs {
  display: flex; gap: 6px; margin-bottom: 18px;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px;
}
.bf-auth-tab {
  flex: 1; padding: 8px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border-radius: var(--radius-xs); font-size: 0.9rem; font-weight: 600;
}
.bf-auth-tab.active { background: var(--accent); color: #fff; }
.bf-auth-field { display: block; margin-bottom: 14px; }
.bf-auth-field span { display: block; margin-bottom: 6px; font-size: 0.82rem; color: var(--text-muted); }
.bf-auth-field input {
  width: 100%; box-sizing: border-box; padding: 11px 12px;
  background: var(--surface-2); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem;
}
.bf-auth-field input:focus { outline: none; border-color: var(--accent); }
.bf-auth-error { min-height: 18px; margin: 0 0 10px; color: var(--red); font-size: 0.82rem; }
.bf-auth-submit { width: 100%; }

/* Chip de cuenta en la cabecera */
.bf-account { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.bf-account-email {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.82rem; color: var(--text-muted);
}
@media (max-width: 520px) { .bf-account-email { display: none; } }

/* Vista histórico */
.history-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: -0.6rem 0 1.25rem;
}
.history-flow-step {
  background: linear-gradient(180deg, rgba(34,211,238,.07), rgba(249,115,22,.04)), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
}
.history-flow-step strong {
  display: block;
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}
.history-flow-step span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}
.history-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.history-empty { color: var(--text-muted); background: var(--surface-2);
  border: 1px dashed var(--border-light); border-radius: var(--radius); padding: 20px; }
.history-item {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.history-item--active {
  border-color: rgba(74,222,128,.55);
  background: linear-gradient(180deg, rgba(74,222,128,.07), rgba(34,211,238,.035)), var(--surface-2);
  box-shadow: 0 0 0 1px rgba(74,222,128,.08), var(--shadow-sm);
}
.history-item-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.history-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.history-alias-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}
.history-active-badge {
  flex: 0 0 auto;
  color: var(--green);
  border: 1px solid rgba(74,222,128,.34);
  background: rgba(74,222,128,.09);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.history-alias {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  padding: 4px 6px;
  width: 100%;
  box-sizing: border-box;
}
.history-alias.hidden { display: none; }
.history-edit {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: border-color .16s, color .16s, background .16s;
}
.history-edit:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(249,115,22,.08);
}
.history-item--editing .history-edit {
  border-color: rgba(74,222,128,.45);
  color: var(--green);
  background: rgba(74,222,128,.08);
}
.history-alias:focus { outline: none; box-shadow: 0 0 0 3px rgba(249,115,22,.12); }
.history-date { font-size: 0.78rem; color: var(--text-muted); }
.history-meta { font-size: 0.82rem; color: var(--accent-2); }
.history-use-hint {
  display: block;
  max-width: 72ch;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
}
.history-details {
  margin-top: 0.65rem;
}
.history-details summary {
  width: max-content;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.32rem 0.58rem;
  background: rgba(255,255,255,.03);
}
.history-details summary::-webkit-details-marker { display: none; }
.history-details summary::after {
  content: " +";
  color: var(--accent-2);
}
.history-details[open] summary::after { content: " −"; }
.history-data-section {
  margin-top: 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.history-data-section h3 {
  margin: 0 0 0.55rem;
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.history-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.history-data-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.6rem;
  min-width: 0;
}
.history-data-value {
  display: block;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-data-value small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}
.history-data-label {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.history-item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
}

@media (max-width: 720px) {
  .history-flow { grid-template-columns: 1fr; }
}

/* ═══════════════ Modal de opciones del informe ═══════════════ */
.report-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 8, 18, 0.82); backdrop-filter: blur(6px);
}
.report-overlay.hidden { display: none; }
.report-dialog {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px;
}
.report-dialog-title { margin: 0 0 4px; font-size: 1.25rem; }
.report-dialog-sub { margin: 0 0 18px; color: var(--text-muted); font-size: 0.88rem; }
.report-field-label { display: block; margin-bottom: 8px; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.report-opts { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 22px; }
.report-opt { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; cursor: pointer; }
.report-opt input { width: 17px; height: 17px; accent-color: var(--accent); }
.report-hint { color: var(--text-muted); font-size: 0.8rem; }
.report-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Modal de alias de medición */
.alias-modal-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem;
  font-size: 0.95rem; font-family: inherit; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.alias-modal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }
.alias-modal-error { min-height: 1.1em; margin: 8px 0 16px; color: #f87171; font-size: 0.82rem; }
.alias-modal-error:empty { margin: 8px 0 16px; }

/* ═══════════════ Informe PDF profesional ═══════════════ */
/* En pantalla el informe está oculto (.print-report{display:none} ya definido). */
.report {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.5;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.rp-cover {
  text-align: left; padding: 18px 20px; margin-bottom: 20px;
  border: 1px solid #d7dee8;
  border-left: 7px solid #ea6c0a;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff7ed 0%, #f8fafc 52%, #ecfeff 100%);
}
.rp-brand { font-size: 0.72rem; letter-spacing: .18em; color: #ea6c0a; font-weight: 800; }
.rp-title { margin: 6px 0 4px; font-size: 1.7rem; color: #0f172a; letter-spacing: -.01em; }
.rp-subtitle { margin: 0; color: #64748b; font-size: 0.92rem; }
.rp-section { margin-bottom: 20px; }
.rp-h2 {
  font-size: 1.05rem; color: #0f172a; margin: 0 0 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #dbe3ee; padding-bottom: 6px;
}
.rp-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #ea6c0a; color: #fff; font-size: 0.8rem; font-weight: 700;
}
.rp-note { color: #475569; font-size: 0.82rem; margin: 10px 0 0; }
/* Perfil corporal — rejilla */
.rp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rp-cell {
  border: 1px solid #dbe3ee; border-radius: 8px; padding: 10px 8px;
  text-align: center; background: linear-gradient(180deg, #fff, #f8fafc);
}
.rp-cell-val { display: block; font-size: 1.25rem; font-weight: 800; color: #0f172a; }
.rp-cell-val small { font-size: 0.62rem; font-weight: 600; color: #94a3b8; margin-left: 2px; }
.rp-cell-label { font-size: 0.72rem; color: #64748b; }
/* Posición ideal — diagrama + specs */
.rp-posture { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; align-items: start; }
.rp-diagram { border: 1px solid #dbe3ee; border-radius: 10px; padding: 10px; background: #f8fafc; }
.rp-diagram svg { width: 100%; height: auto; }
.rp-specs { display: flex; flex-direction: column; gap: 6px; }
.rp-spec {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  gap: 4px 10px; border-bottom: 1px dashed #dbe3ee; padding: 5px 0;
}
.rp-spec-label { color: #334155; font-weight: 600; }
.rp-spec-val { color: #ea6c0a; font-weight: 800; font-size: 1rem; text-align: right; }
.rp-spec-note { grid-column: 1 / -1; color: #94a3b8; font-size: 0.72rem; }
.rp-angles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.rp-angle {
  text-align: center; border: 1px solid #dbe3ee; border-radius: 8px;
  padding: 8px; background: #fff;
}
.rp-angle b { display: block; color: #0f172a; font-size: 0.95rem; }
.rp-angle span { color: #64748b; font-size: 0.72rem; }
.rp-foot {
  margin-top: 18px; padding-top: 10px; border-top: 1px solid #cbd5e1;
  color: #64748b; font-size: 0.72rem;
}

@media print {
  @page { margin: 12mm 12mm; }
  /* El informe nuevo trae su propio estilo claro; garantizamos cortes limpios. */
  .report { color: #0f172a; }
  /* No forzamos la sección entera a una sola página (dejaba la 1ª medio vacía):
     protegemos solo los bloques internos que no deben partirse. */
  .rp-avoid, .rp-cell, .rp-angle, .rp-diagram, .rp-grid, .rp-posture, .rp-angles,
  .report .compare-row, .report .compare-header-info { break-inside: avoid; }
  .rp-h2, .rp-cover { break-after: avoid; }
  /* Compactar un poco al imprimir para que el informe de posición
     quepa en una sola página (evita una 2ª hoja casi vacía). */
  .report .rp-cover { padding-bottom: 10px; margin-bottom: 14px; }
  .report .rp-section { margin-bottom: 10px; }
  .report .rp-h2 { margin-bottom: 8px; }
  .report .rp-note { margin-top: 6px; }
  .report .rp-specs { gap: 4px; }
  .report .rp-spec { padding: 3px 0; }
  .report .rp-cell { padding: 8px; }
  .report .rp-angles { margin-top: 8px; }
  .report .rp-angle { padding: 6px; }
  .report .rp-foot { margin-top: 8px; padding-top: 6px; }
  /* La sección de pedaleo empieza en página nueva (informe de 2 páginas). */
  .rp-page { break-before: page; }
  /* Diagrama del ciclista: en el informe claro NO invertir colores. */
  .report .cyclist-svg-wrap svg, .rp-diagram svg { filter: none !important; }
  /* Bloques del pedaleo reutilizados: fondo claro legible al imprimir. */
  .report .compare-row, .report .compare-header-info {
    border: 1px solid #e2e8f0 !important; background: #f8fafc !important;
    color: #0f172a !important; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  }
  .report .compare-recs, .report .compare-size-name, .report .delta { color: #334155 !important; }
  .report .fit-verdict.ok { color: #15803d !important; }
  .report .fit-verdict.bad { color: #b91c1c !important; }
  .report .fit-verdict.mid { color: #a16207 !important; }
  .report .fit-verdict.warn { color: #c2410c !important; }
  .report .rec-score { color: #ea6c0a !important; }
}

/* ═══════════════ Cockpit tuner (ajuste iterativo) ═══════════════ */
.tuner {
  margin-top: 1.25rem;
  background: linear-gradient(180deg, rgba(34,211,238,.06), rgba(249,115,22,.04)), var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.tuner-head {
  display: flex; align-items: flex-start; gap: 1rem;
  justify-content: space-between; margin-bottom: 1.1rem;
}
.tuner-title { margin: 0 0 .25rem; font-size: 1.05rem; }
.tuner-sub { margin: 0; font-size: .82rem; color: var(--text-muted); line-height: 1.5; max-width: 46ch; }
#tuner-auto { flex-shrink: 0; white-space: nowrap; }

.tuner-sliders { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.1rem; }
.tuner-slider { display: flex; flex-direction: column; gap: .5rem; }
.tuner-slider-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .82rem; color: var(--text-muted);
}
.tuner-slider-label b { color: var(--accent-2); font-size: .9rem; font-variant-numeric: tabular-nums; }

.tuner-slider input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--surface-2); outline: none; cursor: pointer;
}
.tuner-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s;
}
.tuner-slider input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.tuner-slider input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface); cursor: pointer;
}

.tuner-readout {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem;
}
.tuner-score-wrap { display: flex; align-items: center; gap: .6rem; }
.tuner-score-wrap .rec-score { font-size: 1.6rem; }
.tuner-lines { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-width: 220px; }
.tuner-line {
  display: grid; grid-template-columns: 52px auto 1fr auto; align-items: baseline;
  gap: .5rem; font-size: .85rem;
}
.tuner-k { color: var(--text-muted); font-weight: 600; }
.tuner-eff { font-weight: 700; font-variant-numeric: tabular-nums; }
.tuner-arrow { color: var(--text-muted); font-size: .78rem; }

@media (max-width: 560px) {
  .tuner-head { flex-direction: column; }
  #tuner-auto { width: 100%; }
}

/* ═══════════════ Finishing touches — consistencia y accesibilidad ═══════════════ */

/* Selección de texto con el acento de marca */
::selection { background: rgba(249,115,22,.32); color: #fff; }

/* Anillo de foco accesible y uniforme en todo lo interactivo */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible,
.hub-card:focus-visible, .seg-btn:focus-visible, .result-card:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
input[type="range"]:focus-visible { outline-offset: 6px; }
/* No mostramos el anillo al hacer clic con ratón, solo con teclado */
:focus:not(:focus-visible) { outline: none; }

/* Cifras alineadas (tabular) en todos los valores numéricos */
.result-value, .rec-score, .psg-val, .tuner-eff, .tuner-slider-label b,
.geo-bike, .delta, .rp-cell-val, .rp-spec-val, .compare-size-name,
.reco-size, .garage-card-price {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Iconos del hub como badge circular consistente (los emojis quedan alineados) */
.hub-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(34,211,238,.12), rgba(249,115,22,.10));
  border: 1px solid var(--border-light);
  font-size: 1.5rem; line-height: 1; margin-bottom: 0.35rem;
}
.hub-card:hover .hub-icon { border-color: rgba(249,115,22,.4); }

/* Botón secundario: estado deshabilitado coherente con el primario */
.btn:disabled, .btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary:active:not(:disabled) { transform: translateY(1px); }

/* Chip de cuenta: aprovechar más ancho en escritorio */
@media (min-width: 640px) { .bf-account-email { max-width: 220px; } }

/* Evitar desbordes horizontales en móvil por rejillas rígidas */
@media (max-width: 380px) {
  .rp-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Respetar la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ════════ Vista Navegar: tarjeta clicable + modal de perfil de bici ════════ */
.browse-card--clickable { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.browse-card--clickable:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.browse-card--clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.browse-card-hint { margin-top: 8px; font-size: .78rem; color: var(--accent); font-weight: 600; opacity: 0; transition: opacity .15s; }
.browse-card--clickable:hover .browse-card-hint { opacity: 1; }

.bike-dialog {
  position: relative; width: 100%; max-width: 760px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px;
}
.bike-dialog-close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: rgba(0,0,0,.25); color: #cbd5e1; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.bike-dialog-close:hover { color: #fff; border-color: var(--accent); }
.bike-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-right: 36px; }
.bike-dialog-brand { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.bike-dialog-model { margin: 2px 0 4px; font-size: 1.4rem; }
.bike-dialog-meta { color: #94a3b8; font-size: .9rem; }
.bike-colors { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.bike-color-chip { font-size: .78rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.04); }
.bike-fit-banner { margin: 14px 0; padding: 10px 14px; border-radius: 10px; background: rgba(249,115,22,.08); border: 1px solid rgba(249,115,22,.25); font-size: .9rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bike-fit-ranking { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.reco-alternatives { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.fit-rank-chip {
  display: inline-grid; grid-template-columns: auto auto auto; align-items: center; gap: 6px;
  padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(255,255,255,.035); color: inherit; font: inherit; font-size: .78rem; cursor: pointer;
}
.fit-rank-chip:hover { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.065); }
.fit-rank-chip strong { color: var(--text); font-size: .9rem; }
.fit-rank-chip em { color: var(--muted); font-style: normal; }
.fit-rank-chip b { font-size: .75rem; line-height: 1; padding: 2px 6px; border-radius: 999px; }
.fit-rank-primary { border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.08); }
.fit-rank-compatible { border-color: rgba(59,130,246,.38); }
.fit-rank-borderline { border-color: rgba(250,204,21,.36); }
.fit-rank-bad { opacity: .62; }
.bike-section-title { margin: 20px 0 8px; font-size: 1rem; color: #e2e8f0; }
.bike-geo-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.bike-geo-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 380px; }
.bike-geo-table th, .bike-geo-table td { padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bike-geo-table thead th { background: rgba(255,255,255,.03); font-weight: 600; }
.bike-geo-table .geo-label { text-align: left; color: #94a3b8; }
.bike-geo-table .geo-best { background: rgba(249,115,22,.14); color: #fdba74; font-weight: 700; }
.bike-geo-table .geo-fit-primary { background: rgba(34,197,94,.09); }
.bike-geo-table .geo-fit-compatible { background: rgba(59,130,246,.08); }
.bike-geo-table .geo-fit-borderline { background: rgba(250,204,21,.08); }
.bike-geo-table .geo-fit-bad { opacity: .58; }
.geo-size-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: inherit; font: inherit; font-weight: 800; cursor: pointer; padding: 0; }
.geo-size-btn small { color: var(--muted); font-size: .68rem; font-weight: 700; }
.geo-size-btn:hover span { text-decoration: underline; }
.bike-specs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.bike-spec { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.02); }
.bike-spec-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: #94a3b8; }
.bike-spec-v { font-size: .88rem; margin-top: 2px; }
.bike-specs-empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  font-size: .86rem;
}
.bike-dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; }
@media (max-width: 560px) { .bike-dialog { padding: 18px; } .bike-dialog-model { font-size: 1.2rem; } }

/* ── Garage page ── */
/* ── Garage layout ── */
.garage-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }

.garage-topbar {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.75rem; flex-wrap: wrap;
}
.garage-topbar h1 {
  font-size: 1.5rem; font-weight: 800; flex: 1; letter-spacing: -.02em;
}
.garage-count {
  font-size: 0.78rem; color: var(--muted); margin-left: 0.5rem;
  font-weight: 400;
}

/* ── Filter bar ── */
.filter-bar {
  display: flex; gap: 0.65rem; flex-wrap: wrap; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin-bottom: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.filter-bar input[type="search"],
.filter-bar select {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 0.45rem 0.75rem;
  font-size: 0.83rem; outline: none; transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
.filter-bar input[type="search"] { flex: 1; min-width: 180px; }
.filter-bar select { cursor: pointer; }
.filter-bar input[type="search"]:focus,
.filter-bar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.filter-custom-wrap {
  display: flex; align-items: center; gap: 0.4rem; cursor: pointer;
  font-size: 0.8rem; color: var(--muted); white-space: nowrap; user-select: none;
}

/* ── Bike grid ── */
.bike-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem;
}
.garage-empty { text-align: center; padding: 4rem 2rem; color: var(--muted); font-size: 0.9rem; }

/* ── Bike card ── */
.garage-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.15rem 1.2rem 1rem;
  display: flex; flex-direction: column; gap: 0.7rem;
  transition: border-color .22s, box-shadow .22s, transform .22s;
  box-shadow: var(--shadow-sm);
}
.garage-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  transform: translateY(-2px);
}
.garage-card--custom { border-color: rgba(249,115,22,.2); }
.garage-card--custom:hover { border-color: rgba(249,115,22,.55); box-shadow: var(--glow-accent); }

.garage-card-top {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.garage-card-price {
  margin-left: auto; font-size: 0.8rem; color: var(--muted); white-space: nowrap; font-weight: 500;
}
.custom-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; background: rgba(249,115,22,.15); color: var(--accent);
  border: 1px solid rgba(249,115,22,.25);
}
.garage-fit-badge {
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.garage-fit-badge.score-great { background: rgba(34,211,238,.12); color: #22d3ee; border: 1px solid rgba(34,211,238,.25); }
.garage-fit-badge.score-good  { background: rgba(74,222,128,.12); color: #4ade80; border: 1px solid rgba(74,222,128,.25); }
.garage-fit-badge.score-ok    { background: rgba(250,204,21,.12); color: #facc15; border: 1px solid rgba(250,204,21,.25); }

.garage-card-name {
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 0.55rem;
}
.garage-brand  { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.garage-model  { color: var(--muted); font-size: 0.88rem; }
.garage-year   { font-size: 0.72rem; color: var(--muted); margin-left: auto; }

.garage-sizes-wrap { overflow-x: auto; }
.garage-size-table { width: 100%; border-collapse: collapse; font-size: 0.79rem; }
.garage-size-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 0.25rem 0.5rem 0.35rem; border-bottom: 1px solid var(--border);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: .05em;
}
.garage-size-table td { padding: 0.3rem 0.5rem; }
.garage-size-table tbody tr:hover { background: rgba(255,255,255,.035); }

.garage-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.15rem; }

/* ── Type badges ── */
.type-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; letter-spacing: .02em;
}
.type-road       { background: rgba(249,115,22,.14); color: #f97316; border: 1px solid rgba(249,115,22,.28); }
.type-mtb        { background: rgba(74,222,128,.14); color: #4ade80; border: 1px solid rgba(74,222,128,.28); }
.type-gravel     { background: rgba(250,204,21,.14); color: #facc15; border: 1px solid rgba(250,204,21,.28); }
.type-triathlon  { background: rgba(167,139,250,.14); color: #a78bfa; border: 1px solid rgba(167,139,250,.28); }

/* ── Modals ── */
.modal-lg { max-width: 680px; }
.modal-xl { max-width: 880px; }

/* Form styles */
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.form-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.9rem; }
.form-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.3rem; display: block; letter-spacing: .01em; }
.form-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 0.5rem 0.8rem;
  font-size: 0.875rem; outline: none; box-sizing: border-box;
  transition: border-color .18s, box-shadow .18s; font-family: inherit;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.form-section-title {
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 1.25rem 0 0.65rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

/* Size rows */
#sizes-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.65rem; }
.size-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 1fr auto;
  gap: 0.5rem; align-items: center;
}
.size-row input { padding: 0.42rem 0.55rem; }
.btn-remove-size {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 1rem; padding: 0 0.3rem; line-height: 1;
  border-radius: var(--radius-xs); transition: color .15s;
}
.btn-remove-size:hover { color: #f87171; }

/* Measure guide toggle */
.measure-guide-btn {
  font-size: 0.78rem; color: var(--accent); background: none; border: none;
  cursor: pointer; padding: 0; display: flex; align-items: center; gap: 0.4rem;
  font-weight: 600;
}
.measure-guide-btn:hover { color: #fb923c; }
#measure-guide {
  background: rgba(11,17,32,.7); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 0.75rem;
}
.measure-guide-content { display: flex; gap: 1.25rem; align-items: flex-start; }
.measure-guide-content svg { flex-shrink: 0; }
.measure-list { margin: 0; padding-left: 0; list-style: none; font-size: 0.8rem; color: var(--muted); }
.measure-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); line-height: 1.5; }
.measure-list li:last-child { border: none; }
.measure-list strong { color: var(--text); }

/* Compare modal */
.compare-header-info {
  margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.compare-header-info h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.4rem; letter-spacing: -.01em; }
.compare-header-info p  { font-size: 0.8rem; color: var(--muted); margin: 0.2rem 0; }
.compare-ideal {
  color: var(--text) !important; font-size: 0.85rem !important;
  margin-top: 0.5rem !important;
  background: var(--accent-dim); border: 1px solid rgba(249,115,22,.2);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; display: inline-block;
}
.compare-sizes { display: flex; flex-direction: column; gap: 0.85rem; max-height: 55vh; overflow-y: auto; padding-right: 0.25rem; }
.compare-row {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.9rem 1rem;
  transition: border-color .18s;
}
.compare-row:hover { border-color: var(--border-light); }
.compare-row--best { border-color: rgba(74,222,128,.5); background: rgba(74,222,128,.04); }
.fit-verdict { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-left: auto; white-space: nowrap; }
.fit-verdict.ok { background: rgba(74,222,128,.12); color: #4ade80; border: 1px solid rgba(74,222,128,.28); }
.fit-verdict.bad { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.28); }
.compare-size-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.compare-size-name { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.compare-deltas { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.compare-recs { margin: 0; padding-left: 1.1rem; font-size: 0.79rem; color: var(--muted); }
.compare-recs li { margin: 0.2rem 0; line-height: 1.5; }

/* Header back button */
.btn-back {
  display: flex; align-items: center; gap: 0.35rem;
  color: var(--muted); font-size: 0.82rem; text-decoration: none;
  padding: 0.42rem 0.8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  transition: all .18s;
}
.btn-back:hover { color: var(--text); border-color: rgba(249,115,22,.5); background: rgba(249,115,22,.07); }

/* Inline form error */
.form-error {
  margin: 1rem 0 0; color: #f87171; font-size: 0.85rem; font-weight: 600;
  background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3);
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem;
}
.form-error.hidden { display: none; }

@media (max-width: 640px) {
  /* Evitar desbordes horizontales del modal en móvil */
  .modal-overlay { padding: 0.6rem; }
  .modal { max-width: 100%; }
  .modal-body { overflow-x: hidden; }
  .form-grid2, .form-grid3 { grid-template-columns: 1fr; }
  .bike-grid { grid-template-columns: 1fr; }
  .form-input, .size-row input { min-width: 0; }

  /* Filas de talla como tarjetas apiladas (evita aplastar 4 campos) */
  .sizes-header { display: none !important; }
  .size-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.7rem 0.7rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.02);
    position: relative;
  }
  .size-row .sz-name { grid-column: 1 / -1; }
  .size-row input { padding: 0.55rem 0.6rem; font-size: 0.9rem; }
  .btn-remove-size {
    position: absolute; top: 0.45rem; right: 0.55rem;
    font-size: 1.1rem; padding: 0.1rem 0.35rem;
    background: var(--surface-2); border-radius: var(--radius-xs);
  }
  .sz-name { padding-right: 2rem !important; }

  /* Guía de medición: apilar imagen y lista */
  .measure-guide-content { flex-direction: column; gap: 0.75rem; }
  .measure-guide-content svg { width: 100%; height: auto; max-width: 240px; margin: 0 auto; }

  /* Cabecera de sección con dos botones: que respiren */
  .form-section-title { flex-wrap: wrap; gap: 0.4rem; }

  /* año/precio: mantener 2 columnas aunque el resto sea 1 */
  .form-grid2 .form-grid2 { grid-template-columns: 1fr 1fr; }
}

/* Utilidad y hints añadidos */
.muted { color: var(--muted); }
.measure-missing { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--muted); }
.measure-missing.hidden { display: none; }
.garage-compare-hint { font-size: 0.75rem; color: var(--muted); line-height: 1.4; align-self: center; }

.garage-empty-actions { display: flex; gap: 0.75rem; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 1rem; }

/* ── Check-in de confort / ajustes dinámicos ── */
.feedback-result { background: rgba(74,222,128,.07); border: 1px solid rgba(74,222,128,.25); border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin: 0.75rem 0; font-size: 0.85rem; }
.feedback-result ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.feedback-result li { margin-bottom: 0.25rem; }
.feedback-current { font-size: 0.8rem; color: var(--muted); margin: 0.6rem 0 0.2rem; }
.profile-dynamic-note { margin-top: 0.7rem; font-size: 0.8rem; color: var(--accent, #f97316); background: rgba(249,115,22,.08); border: 1px solid rgba(249,115,22,.22); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; }
