:root {
  --bg: #15171a;
  --panel: #1d2024;
  --panel-2: #262a30;
  --line: #343941;
  --text: #e8e6e1;
  --muted: #9aa0a8;
  --accent: #f2a000;      /* naranja rally */
  --accent-ink: #1a1200;
  --blue: #2f7cf6;
  --red: #e5483b;
  --paper: #fbf8f1;
  --paper-ink: #1b1b1b;
  --paper-line: #d9d2c3;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, select, input { font: inherit; }

.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: #0f1113; border-bottom: 1px solid var(--line); gap: 12px;
}
.brand { font-weight: 600; letter-spacing: .14em; font-size: 15px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand b { color: var(--accent); font-weight: 800; }
.brand .logo { width: 26px; height: 26px; display: block; }
.top-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ctl select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.status { font-size: 12px; color: var(--muted); }
.status.warn { color: var(--accent); }

.layout { display: grid; grid-template-columns: 360px 1fr auto; height: calc(100% - 52px); }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding-bottom: 24px; }
.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.tab { background: none; border: none; color: var(--muted); padding: 9px 3px; line-height: 1.2; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; font-size: 12px; letter-spacing: 0; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.pane { display: none; }
.pane.active { display: block; }

.card { margin: 12px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.card h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; line-height: 1.4; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; }
.row select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 7px 0; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.drop {
  margin: 12px; padding: 22px 12px; border: 1.5px dashed #4a515b; border-radius: 10px; display: flex;
  flex-direction: column; align-items: center; gap: 4px; cursor: pointer; text-align: center; transition: .15s;
}
.drop span { color: var(--muted); font-size: 12px; }
.drop.over, .drop:hover { border-color: var(--accent); background: rgba(242,160,0,.06); }

.btn { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; cursor: pointer; width: 100%; margin-top: 8px; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: #59616c; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.small { width: auto; margin: 0; padding: 6px 10px; font-size: 12px; }
.btns { display: flex; gap: 6px; }
.btns .btn { margin-top: 0; }

.slider-row { display: grid; grid-template-columns: 112px 1fr 84px; align-items: center; gap: 8px; font-size: 12.5px; margin: 6px 0; }
.slider-row output { font-size: 11.5px; color: var(--muted); text-align: right; }
.slider-row output.l0 { color: var(--red); }
.slider-row output.l4, .slider-row output.l5 { color: var(--accent); }
.swatch { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bars { margin-top: 10px; }
.bar { display: grid; grid-template-columns: 120px 1fr 52px; gap: 6px; align-items: center; font-size: 11.5px; margin: 3px 0; color: var(--muted); }
.bar i { display: block; height: 7px; border-radius: 4px; }
.bar b { text-align: right; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.wplist { margin: 0 0 10px; padding-left: 22px; font-size: 12.5px; color: var(--muted); max-height: 240px; overflow: auto; }
.wplist li { margin: 2px 0; font-variant-numeric: tabular-nums; }

.toast { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: #0f1113ee; border: 1px solid var(--line); padding: 9px 14px; border-radius: 8px; font-size: 13px; z-index: 5; max-width: 80%; }
.toast.err { border-color: var(--red); color: #ffb4ad; }

.legend { position: absolute; left: 10px; bottom: 26px; background: #0f1113dd; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 11.5px; z-index: 3; }
.lg-head { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); margin: 0 2px 3px; font-size: 11px; }
.lg-head b { color: var(--text); font-weight: 600; }
.lg-all { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; font-size: 11px; }
.lg-row { display: flex; align-items: center; width: 100%; background: none; border: none; color: var(--text); font-size: 11.5px; padding: 2px; margin: 0; cursor: pointer; text-align: left; border-radius: 4px; }
.lg-row:hover { background: #ffffff10; }
.lg-row.off { color: #6c727a; }
.lg-row.off .swatch { opacity: .25; }
.lg-chk { width: 12px; height: 12px; border: 1.5px solid var(--accent); border-radius: 3px; margin-right: 7px; flex-shrink: 0; background: var(--accent) no-repeat center/9px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5.2l2.3 2.3L8.5 2.6' fill='none' stroke='%231a1200' stroke-width='1.8'/%3E%3C/svg%3E"); }
.lg-row.off .lg-chk { background: none; border-color: #59616c; }

/* ---------- Roadbook (aspecto papel) ---------- */
.roadbook { width: 400px; background: var(--paper); color: var(--paper-ink); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rb-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 14px 8px; border-bottom: 2px solid var(--paper-ink); }
.rb-title { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; }
.rb-sub { font-size: 12px; color: #5d5a52; margin-top: 2px; }
.icon { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--paper-ink); }
.rb-actions { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--paper-line); flex-wrap: wrap; }
.rb-actions .btn { background: #fff; color: var(--paper-ink); border-color: #c9c1b0; }
.rb-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.rb-entry { display: grid; grid-template-columns: 96px 104px 1fr; border-bottom: 1px solid var(--paper-line); cursor: pointer; }
.rb-entry:hover { background: #f3eee2; }
.rb-entry.sel { background: #ffe9b8; }
.rb-entry > div { padding: 8px; }
.rb-km { border-right: 1px solid var(--paper-line); display: flex; flex-direction: column; justify-content: space-between; }
.rb-km.close { background: #93ff93; }
.rb-km .total { font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1; white-space: nowrap; text-align: center; margin-top: 4px; }
.rb-km .km-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 4px; }
.rb-km.w3 .total { font-size: 22px; }
.rb-km.w4 .total { font-size: 18px; }
.rb-km .partial { align-self: flex-start; font-size: 13.5px; font-weight: 700; color: #333; font-variant-numeric: tabular-nums;
  background: #fff; border: 1px solid #6b665c; border-radius: 3px; padding: 0 5px; }
.rb-km .num { font-size: 11px; font-weight: 800; background: #111; color: #fff; padding: 1px 5px; line-height: 1.3; }
.rb-tulip { border-right: 1px solid var(--paper-line); display: flex; align-items: center; justify-content: center; padding: 4px !important; }
.rb-tulip svg { width: 96px; height: 96px; }
.rb-text { font-size: 12.5px; line-height: 1.35; display: flex; flex-direction: column; gap: 4px; }
.rb-text .imp, .rb-text .dang { color: #e10600; font-weight: 700; font-size: 12px; }
.rb-text .marks { font-family: "Arial Black", Arial, sans-serif; font-weight: 900; letter-spacing: -0.05em; }
.rb-text .dist { background: #00e5ff; color: #111; padding: 0 3px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rb-text .marks { color: #e10600; }
.rb-text .capbox { margin-top: auto; align-self: flex-start; background: #ffe600; color: #111; font-weight: 900; font-size: 17px; line-height: 1;
  padding: 2px 6px; border: 1px solid #111; display: flex; align-items: baseline; gap: 3px; }
.rb-text .capbox small { font-size: 9px; font-weight: 800; }
/* notas abreviadas (estilo rally) */
.rb-text.st-pro { font-family: "Arial Narrow", Arial, sans-serif; gap: 3px; }
.pn-main { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; line-height: 1; }
.pn-ico svg { width: 26px; height: 26px; display: block; }
.pn-dir { font-family: "Arial Black", Arial, sans-serif; font-weight: 900; font-size: 22px; letter-spacing: -.02em; color: #111; }
.pn-lab { font-weight: 900; font-size: 13px; }
.pn-road { font-weight: 900; font-size: 16px; color: #111; }
.pn-ref { font-weight: 800; font-size: 11px; border: 1.5px solid #111; padding: 0 4px; background: #fff; color: #111; }
.pn-flags { font-weight: 800; font-size: 11px; color: #111; }
.pn-warn { color: #e10600; font-weight: 900; font-size: 11px; }
.pn-hz, .pn-ref-row { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 11px; line-height: 1.1; color: #111; }
.pn-hz .marks { font-family: "Arial Black", Arial, sans-serif; font-size: 14px; letter-spacing: -.05em; }
.pn-ref-row { font-weight: 600; }
.pn-sym svg { width: 24px; height: 24px; display: block; }
.pn-ref-row .pn-sym svg { width: 19px; height: 19px; }
.rb-text .note { color: #3b3833; font-size: 11.5px; }
.rb-text .ref { color: #1b1b1b; font-size: 11.5px; }
.rb-km.d2 .total { text-decoration: underline; text-decoration-color: #e10600; text-decoration-thickness: 4px; text-underline-offset: 3px; text-decoration-skip-ink: none; }
.rb-entry.d3 { outline: 3px solid #e10600; outline-offset: -3px; }

.maplibregl-popup-content { background: #1d2024; color: var(--text); font-size: 12px; border-radius: 8px; }
.maplibregl-popup-tip { border-top-color: #1d2024 !important; border-bottom-color: #1d2024 !important; }
.wp-marker { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid #111; cursor: grab; }
.wp-marker.first { background: #2bb673; }
.wp-marker.last { background: var(--red); color: #fff; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 46vh auto auto; height: auto; }
  .mapwrap { grid-row: 1; min-height: 46vh; }
  .sidebar { grid-row: 2; border-right: none; }
  .roadbook { grid-row: 3; width: 100%; max-height: 80vh; }
  .top-controls .status { display: none; }
  .brand { font-size: 13px; }
  /* barra superior en dos líneas para que «Apoyar» y «?» siempre se vean */
  .topbar { height: auto; min-height: 52px; flex-wrap: wrap; padding: 8px 12px; row-gap: 8px; }
  .top-controls { gap: 10px; }
  .help { top: 0; z-index: 70; }
}

.num-in { width: 64px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.roll { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #5d5a52; }
.roll select { background: #fff; border: 1px solid #c9c1b0; border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.nowrap { white-space: nowrap; flex-shrink: 0; }
.text-in { width: 100%; box-sizing: border-box; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; }
.save-row { display: flex; gap: 6px; margin-top: 10px; }
.save-row input { flex: 1; min-width: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.save-row .btn.small { background: var(--panel); color: var(--text); border-color: var(--line); }
.io-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.io-row .btn.small { background: var(--panel); color: var(--text); border-color: var(--line); width: 100%; }
.link { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; font-size: 12px; display: block; margin-top: 4px; }
.wplist .leg { font-size: 11.5px; color: var(--muted); margin: 1px 0 3px; display: flex; align-items: center; gap: 6px; }
.legc { display: inline-block; width: 14px; height: 4px; border-radius: 2px; }
.wplist .err { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.grid2 .btn { margin-top: 0; font-size: 12px; padding: 7px 6px; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.edit-sel { font-size: 12px; background: var(--panel); border: 1px dashed var(--line); border-radius: 6px; padding: 6px 8px; color: var(--text); }
.simp-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.simp-row .btn { width: auto; margin-top: 0; }
.badge { font-size: 10px; background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 1px 5px; vertical-align: middle; letter-spacing: 0; }
.gpx-wpt { width: 16px; height: 22px; cursor: pointer; background: no-repeat center/contain
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 22'%3E%3Cpath d='M2 21V1' stroke='%23111' stroke-width='2'/%3E%3Cpath d='M3 2h11l-3 4 3 4H3z' fill='%23ff2d87' stroke='%23111'/%3E%3C/svg%3E"); }
.gpx-wpt.editable { filter: drop-shadow(0 0 3px #ffd400); }
.wpt-pop input { display: block; width: 180px; margin: 0 0 6px; background: #262a30; color: #eee; border: 1px solid #444; border-radius: 5px; padding: 5px 7px; }
.wpt-pop .btns .btn { width: auto; }

/* ---------- Editor GPX ---------- */
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-head h3 { margin: 0; }
.card-head .btn.small { background: var(--panel); color: var(--text); border-color: var(--line); }
.ed-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 300px; overflow-y: auto; }
.ed-file { display: grid; grid-template-columns: auto auto 1fr auto auto auto auto; gap: 6px; align-items: center; padding: 6px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.ed-file:hover { background: var(--panel); }
.ed-file.active { border-color: var(--accent); background: var(--panel); }
.ed-file.off .ed-main { opacity: .45; }
.ed-chk { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.ed-color { width: 22px; height: 22px; padding: 0; border: none; background: none; cursor: pointer; }
.ed-main { min-width: 0; }
.ed-name { width: 100%; background: transparent; border: 1px solid transparent; color: var(--text); font-weight: 600; font-size: 12.5px; padding: 1px 4px; border-radius: 4px; }
.ed-name:focus, .ed-name:hover { border-color: var(--line); background: var(--panel-2); outline: none; }
.ed-meta { font-size: 11px; color: var(--muted); padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-ic { background: none; border: 1px solid transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.ed-ic:hover:not(:disabled) { border-color: var(--line); color: var(--text); }
.ed-ic:disabled { opacity: .25; cursor: default; }
.ed-active-name { color: var(--text); text-transform: none; letter-spacing: 0; }
.segs { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.seg { background: var(--panel); color: var(--muted); border: none; border-right: 1px solid var(--line); padding: 8px 2px; font-size: 12px; font-weight: 600; cursor: pointer; }
.seg:last-child { border-right: none; }
.seg.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Perfil de altimetría ---------- */
.mapwrap.with-profile #map { bottom: 196px; }
.mapwrap.with-profile .legend { bottom: 222px; }
.pf-toggle { position: absolute; top: 10px; left: 10px; z-index: 4; background: #0f1113dd; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pf-toggle.active { border-color: var(--accent); color: var(--accent); }
.profile { position: absolute; left: 0; right: 0; bottom: 0; height: 196px; background: var(--panel); border-top: 1px solid var(--line); z-index: 4; display: flex; flex-direction: column; }
.pf-head { display: flex; align-items: center; gap: 14px; padding: 6px 12px 0; font-size: 12px; min-height: 26px; flex-wrap: wrap; }
.pf-title { max-width: 30%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-stats { display: flex; gap: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-stats span { white-space: nowrap; }
.pf-stats .up { color: #f07d1a; }
.pf-stats .down { color: #4fa3ff; }
.pf-stats.sel { color: var(--text); background: #ffd40022; border: 1px solid #ffd40066; border-radius: 6px; padding: 1px 8px; }
.pf-stats.sel:empty { display: none; }
.pf-lab { color: #ffd400; }
.pf-legend { margin-left: auto; color: var(--muted); font-size: 10.5px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pf-legend i { display: inline-block; width: 10px; height: 8px; border-radius: 2px; margin-left: 4px; }
.profile .icon { color: var(--muted); font-size: 22px; }
.pf-chart { position: relative; flex: 1; min-height: 0; cursor: crosshair; user-select: none; }
.pf-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pf-chart svg text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.pf-chart svg .grid { stroke: #343941; stroke-width: 1; }
.pf-chart svg .ln { fill: none; stroke: #e8e6e1; stroke-width: 1.6; stroke-linejoin: round; }
.pf-chart svg .sel { fill: #ffd400; opacity: .18; stroke: #ffd400; stroke-opacity: .6; }
.pf-chart svg .cursor { stroke: #ffd400; stroke-width: 1.2; }
.pf-chart svg .cursor.hidden { display: none; }
.pf-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; }
.pf-tip { position: absolute; top: 4px; background: #0f1113ee; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 11.5px; pointer-events: none; white-space: nowrap; }
.pf-attr { font-size: 10px; color: #6c727a; padding: 0 12px 3px; text-align: right; }
@media (max-width: 900px) {
  .pf-legend { display: none; }
  .pf-title { max-width: 100%; }
}
@media (max-width: 900px) {
  .mapwrap.with-profile { min-height: calc(46vh + 196px); }
}
.ed-ic.del { display: flex; align-items: center; }
.ed-ic.del:hover { color: var(--red); border-color: var(--red); }

/* ---------- Apoyo en Patreon ---------- */
.support-btn { color: var(--accent); border: 1.5px solid var(--accent); border-radius: 15px; padding: 4px 11px; font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.support-btn:hover { background: var(--accent); color: var(--accent-ink); }
.support-btn.events-btn { border-color: #5a626c; color: inherit; }
.support-btn.events-btn:hover { border-color: var(--accent); background: none; color: var(--accent); }
.welcome { position: fixed; inset: 0; z-index: 60; background: #000b; display: flex; align-items: center; justify-content: center; padding: 16px; }
.welcome-card { width: 440px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 14px; padding: 26px 26px 18px; text-align: center; box-shadow: 0 30px 80px #000c; }
.welcome-card img { margin: 0 auto 10px; }
.welcome-card h2 { margin: 0 0 10px; font-size: 21px; }
.welcome-card p { color: var(--muted); font-size: 14.5px; line-height: 1.55; margin: 0 0 18px; }
.welcome-card p b { color: var(--text); }
.welcome-card .btn { display: block; text-decoration: none; padding: 11px 12px; font-size: 14.5px; }
.welcome-card .btn.primary { margin-top: 0; }
.welcome-card .welcome-coverage { font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin: -6px 0 16px; }
.welcome-card .welcome-coverage a, .welcome-card .welcome-coverage a:link, .welcome-card .welcome-coverage a:visited { color: #ffc94d; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; display: inline-block; white-space: nowrap; }
.welcome-card .welcome-coverage a:hover { color: #fff; }
.welcome-never { justify-content: center; color: var(--muted); font-size: 12.5px; margin-top: 14px; }
@media (max-width: 900px) { .support-btn { padding: 3px 8px; font-size: 12px; } }

/* ---------- Modo ayuda ---------- */
a.brand { color: var(--text); text-decoration: none; }
.help-btn { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--accent); background: none; color: var(--accent); font-weight: 800; font-size: 15px; cursor: pointer; flex-shrink: 0; }
.help-btn:hover, .help-btn.active { background: var(--accent); color: var(--accent-ink); }
.help { position: fixed; top: 52px; right: 0; bottom: 0; width: 380px; max-width: 100%; background: var(--panel); border-left: 2px solid var(--accent); z-index: 30; display: flex; flex-direction: column; box-shadow: -12px 0 30px #0008; }
.help-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 6px; }
.help-head b { color: var(--accent); letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }
.help .icon { color: var(--muted); }
.help-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.help-tabs button { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.help-tabs button.active { border-color: var(--accent); color: var(--accent); }
.help-body { flex: 1; overflow-y: auto; padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.help-intro { margin: 0 0 12px; color: var(--text); }
.help-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.help-steps li { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; display: grid; gap: 3px; }
.help-steps li b { color: var(--text); }
.help-steps li span { color: var(--muted); font-size: 12.5px; }
.help-point { justify-self: start; margin-top: 3px; background: none; border: 1px solid var(--line); color: var(--accent); border-radius: 12px; padding: 1px 9px; font-size: 11.5px; cursor: pointer; }
.help-point:hover { border-color: var(--accent); }
.help-tips { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.help-tips b { color: var(--text); }
.help-tips ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.help-foot { padding: 8px 14px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.help-foot a { color: var(--accent); }
.help-foot kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
@keyframes helpflash { 0%, 100% { box-shadow: 0 0 0 0 #f2a00000; } 25%, 75% { box-shadow: 0 0 0 4px #f2a000cc; } 50% { box-shadow: 0 0 0 9px #f2a00055; } }
.help-flash { animation: helpflash 1.2s ease-in-out 2; border-radius: 8px; position: relative; z-index: 6; }

/* avance de la generación del roadbook */
.rb-progress { margin: 2px 0 10px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.rb-progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 7px; }
.rb-progress-head span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-progress-head b { color: var(--accent); font-variant-numeric: tabular-nums; }
.rb-progress-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.rb-progress-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .2s ease-out; }

/* ---------------- Editor de roadbook ---------------- */
.rbe-drop { margin: 10px 0 0; }
.rbe-stats { font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.rbe-b { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 9px; letter-spacing: .02em; text-transform: none; vertical-align: 1px; }
.rbe-b.edit { background: #163a5c; color: #8fcaff; }
.rbe-b.new { background: #12442c; color: #8ce0b5; }
.segs.segs2 { grid-template-columns: 1fr 1fr; }
.rbe-addkm { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0 2px; }
.rbe-addkm .num-in { width: 76px; }
.rbe-addkm .btn.small { background: var(--panel); color: var(--text); border-color: var(--line); }
.rbe-legend { display: flex; align-items: center; gap: 6px; margin-bottom: 0; }
.rbe-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #111; }
.rbe-dot.auto { background: #f2a000; } .rbe-dot.edit { background: #3fa7ff; } .rbe-dot.new { background: #2bb673; }
.rbe-form h4 { margin: 14px 0 6px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.rbe-form .card-head h3 { display: flex; align-items: center; gap: 8px; }
.rbe-nav .icon, .rbe-li .icon, .rbe-item .icon { color: var(--text); font-size: 20px; padding: 0 6px; }
.rbe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 6px 0; }
.rbe-grid label, .rbe-full { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.rbe-full { margin: 8px 0; }
.rbe-form select, .rbe-form textarea, .rbe-in, .rbe-num { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 12.5px; min-width: 0; }
.rbe-form textarea { resize: vertical; width: 100%; box-sizing: border-box; }
.rbe-num { width: 64px; }
.rbe-num.w { width: 100%; box-sizing: border-box; }
.rbe-ro { color: var(--text); font-size: 15px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.rbe-cap { flex-direction: row !important; align-items: center; color: var(--text) !important; font-size: 13px !important; margin: 0; align-self: end; }
.rbe-cap .rbe-num { width: 58px; background: #ffe600; color: #111; font-weight: 800; border-color: #b6a400; }
.rbe-cap .rbe-num:disabled { background: var(--panel); color: var(--muted); font-weight: 400; }
.hint-in { color: #6d737b; }
.rbe-tulip-wrap { position: relative; display: flex; justify-content: center; }
.rbe-tulip { width: 230px; height: 230px; background: #fff; border-radius: 8px; touch-action: none; user-select: none; }
.rbe-tulip .guide { fill: none; stroke: #2f7cf6; stroke-opacity: .25; stroke-width: .6; stroke-dasharray: 2 2; }
.rbe-tulip .pv { stroke: #f2a000; stroke-width: 1.2; stroke-dasharray: 2 1.5; }
.rbe-tulip .h { cursor: grab; stroke: #111; stroke-width: 1.2; }
.rbe-tulip .h:active { cursor: grabbing; }
.rbe-tulip .h.out { fill: #f2a000; }
.rbe-tulip .h.br { fill: #fff; }
.rbe-tulip .h.ref { fill: #2bb673; }
.rbe-tulip .h.on { stroke: #f2a000; stroke-width: 2.4; }
.rbe-tulip-wrap[data-ang]::after { content: attr(data-ang); position: absolute; top: 6px; right: calc(50% - 110px); background: #111c; color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
.rbe-th { margin: 8px 0 4px; }
.rbe-th .k-out { color: #f2a000; } .rbe-th .k-br { color: #fff; } .rbe-th .k-ref { color: #2bb673; }
.rbe-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 8px; font-size: 12.5px; }
.rbe-item label { display: flex; align-items: center; gap: 4px; margin: 0; }
.rbe-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.rbe-row select { flex: 1; }
.rbe-row .btn.small { background: var(--panel); color: var(--text); border-color: var(--line); white-space: nowrap; }
.rbe-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.chip { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 12px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rbe-sub { font-size: 11px; color: var(--muted); margin: 6px 0 2px; }
.rbe-li { display: flex; align-items: center; gap: 6px; margin: 4px 0; font-size: 12px; }
.rbe-li.on { outline: 1px solid var(--accent); border-radius: 6px; }
.rbe-li .rbe-in { flex: 1; }
.rbe-li .rbe-num { width: 58px; }
.rbe-li select { padding: 4px 3px; }
.rbe-ico { width: 30px; height: 30px; background: #fff; border-radius: 5px; flex: none; display: flex; align-items: center; justify-content: center; }
.rbe-ico svg { width: 26px; height: 26px; display: block; }
.rbe-lvl { color: #ff6b5e !important; font-weight: 900; }
.rbe-side { font-size: 11px; font-weight: 800; color: var(--muted); width: 18px; }
.rbe-dest-opts { display: flex; gap: 14px; align-items: center; font-size: 12.5px; margin: 4px 0; }
.rbe-dest-opts label { display: flex; align-items: center; gap: 5px; }
.rbe-dest-opts select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.rbe-pal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rbe-pal.off { opacity: .45; }
.pal { background: #fff; border: 1px solid #fff; border-radius: 7px; padding: 5px 2px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #222; font-size: 9.5px; line-height: 1.1; text-align: center; min-height: 64px; }
.pal:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.pal svg { width: 32px; height: 32px; display: block; flex: none; }
.pal span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rb-entry.src-edit { box-shadow: inset 4px 0 0 #3fa7ff; }
.rb-entry.src-new { box-shadow: inset 4px 0 0 #2bb673; }
.rbe-tag { align-self: center; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 0 4px; border-radius: 3px; color: #fff; }
.rbe-tag.edit { background: #2a86d8; } .rbe-tag.new { background: #22995f; }
.rbe-tip { position: absolute; z-index: 6; pointer-events: none; background: #0f1113ee; color: #fff; border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rbe-modal { text-align: left; }
.rbe-modal p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.rbe-modal-btns .btn { display: block; }
.rb-actions .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rbe-grid > * { min-width: 0; }
.rbe-grid select, .rbe-grid .rbe-in, .rbe-full .rbe-in { width: 100%; box-sizing: border-box; }
.rbe-form .rbe-item select { max-width: 150px; }
