/* 📜 Historie a srovnání (historie.js) — barvy přes tokeny hubu, tmavý režim přes body.mu-dark automaticky */
.mu-hist { max-width: 1100px; }
.mu-hist__tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 14px; }
.mu-hist__tab { border: 1px solid hsl(var(--mu-border)); background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.mu-hist__tab.is-on { background: hsl(var(--mu-accent)); color: hsl(var(--mu-accent-text)); border-color: transparent; font-weight: 600; }
.mu-hist__cnt { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); font-size: 12px; margin-left: 4px; }
.mu-hist__card { margin: 0 0 14px; }
.mu-hist__card .mu-card-title { margin-bottom: 8px; }

/* sloupce km/rok */
.mu-hist__bars { display: flex; gap: 6px; align-items: stretch; height: 160px; }   /* flex, ne grid: 8 roků se nikdy nezalomí do druhé řady (na 320 px by se schovaly) */
.mu-hist__bar { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.mu-hist__bar-val { font-size: 11px; color: hsl(var(--mu-text-muted)); margin-bottom: 3px; white-space: nowrap; }
@media (max-width: 480px) { .mu-hist__bar-val { font-size: 9px; letter-spacing: -.3px; } .mu-hist__bar-y { font-size: 10px; } .mu-hist__bars { gap: 3px; } }
.mu-hist__bar-fill { display: block; width: 70%; max-width: 44px; background: hsl(var(--mu-accent)); border-radius: 6px 6px 0 0; min-height: 3px; transition: height .3s; }
.mu-hist__bar:hover .mu-hist__bar-fill { opacity: .8; }
.mu-hist__bar-y { font-size: 12px; margin-top: 4px; color: hsl(var(--mu-text)); }

/* tabulky */
.mu-hist__tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 14px; border: 1px solid hsl(var(--mu-border)); border-radius: 12px; background: hsl(var(--mu-card)); }
.mu-hist__table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.mu-hist__table th, .mu-hist__table td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid hsl(var(--mu-border)); }
.mu-hist__table th:first-child, .mu-hist__table td:first-child { text-align: left; position: sticky; left: 0; background: hsl(var(--mu-card)); }
.mu-hist__table thead th { font-weight: 600; color: hsl(var(--mu-text-muted)); font-size: 12px; background: hsl(var(--mu-card)); position: sticky; top: 0; }
.mu-hist__table tbody tr:last-child td, .mu-hist__table tbody tr:last-child th { border-bottom: 0; }
.mu-hist__table tr.is-work td { color: hsl(var(--mu-text)); font-weight: 600; }
.mu-hist__table tr.is-rec td { color: hsl(var(--mu-text-muted)); }
.mu-hist__ylink { border: 0; background: none; font: inherit; font-weight: 700; color: hsl(var(--mu-blue-text)); cursor: pointer; padding: 0; text-decoration: underline dotted; }
.mu-hist__ylink small { font-weight: 400; color: hsl(var(--mu-text-muted)); }

/* tempo při stejném tepu */
.mu-hist__prog { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.mu-hist__prog-y { border: 1px solid hsl(var(--mu-border)); border-radius: 10px; padding: 8px; text-align: center; min-width: 0; }
.mu-hist__prog-p { display: block; font-size: 20px; font-weight: 700; color: hsl(var(--mu-text)); }
.mu-hist__prog-y small { color: hsl(var(--mu-text-muted)); font-size: 11px; }

/* filtr */
.mu-hist__filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.mu-hist__sel, .mu-hist__q { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid hsl(var(--mu-border)); border-radius: 10px; background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); min-width: 0; }
.mu-hist__q { flex: 1 1 160px; }
.mu-hist__hid { font-size: 13px; color: hsl(var(--mu-text-muted)); display: flex; gap: 5px; align-items: center; }
.mu-hist__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.mu-hist__chips--fam { font-size: 13px; }
.mu-hist__chip { border: 1px solid hsl(var(--mu-border)); background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.mu-hist__chip small { color: hsl(var(--mu-text-muted)); }
.mu-hist__chip.is-on { background: hsl(var(--mu-text)); color: hsl(var(--mu-bg)); border-color: transparent; }
.mu-hist__chip.is-on small { color: inherit; opacity: .7; }
.mu-hist__count { font-size: 13px; color: hsl(var(--mu-text-muted)); margin: 6px 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mu-hist__mini { border: 1px solid hsl(var(--mu-border)); background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); border-radius: 8px; padding: 4px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.mu-hist__mini.is-danger { color: hsl(var(--mu-danger-text, 0 72% 45%)); }
.mu-hist__more { display: block; width: 100%; margin: 10px 0; padding: 10px; border: 1px dashed hsl(var(--mu-border)); border-radius: 10px; background: none; color: hsl(var(--mu-text)); font: inherit; cursor: pointer; }

/* řádek seznamu */
.mu-hist__list { display: flex; flex-direction: column; gap: 6px; }
.mu-hist__row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: stretch; border: 1px solid hsl(var(--mu-border)); border-radius: 12px; background: hsl(var(--mu-card)); overflow: hidden; }
.mu-hist__row.is-sel { border-color: hsl(var(--mu-accent)); box-shadow: 0 0 0 1px hsl(var(--mu-accent)); }
.mu-hist__row.is-hidden { opacity: .55; }
.mu-hist__pick { display: flex; align-items: center; justify-content: center; cursor: pointer; border-right: 1px solid hsl(var(--mu-border)); font-size: 14px; }
.mu-hist__pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mu-hist__pick span { opacity: .35; }
.mu-hist__pick input:checked + span { opacity: 1; }
.mu-hist__pick:focus-within { outline: 2px solid hsl(var(--mu-accent)); }
.mu-hist__main { text-align: left; border: 0; background: none; color: inherit; font: inherit; padding: 9px 10px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mu-hist__main:hover { background: hsl(var(--mu-subtle)); }
.mu-hist__menu { border: 0; border-left: 1px solid hsl(var(--mu-border)); background: none; color: hsl(var(--mu-text-muted)); font-size: 18px; cursor: pointer; }
.mu-hist__l1 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: hsl(var(--mu-text-muted)); }
.mu-hist__date { font-weight: 600; color: hsl(var(--mu-text)); }
.mu-hist__l2 { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.mu-hist__l3 { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: hsl(var(--mu-text-muted)); }
.mu-hist__segs { font-size: 12px; color: hsl(var(--mu-text-muted)); overflow-wrap: anywhere; }
.mu-hist__src { font-size: 12px; }
.mu-hist__manual { font-size: 11px; margin-left: 2px; }
.mu-hist__kind { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: hsl(var(--mu-subtle)); color: hsl(var(--mu-text)); }
.mu-hist__kind--tempo { background: hsl(25 95% 92%); color: hsl(20 80% 32%); }
.mu-hist__kind--intervals { background: hsl(0 85% 93%); color: hsl(0 70% 38%); }
.mu-hist__kind--fartlek { background: hsl(280 70% 93%); color: hsl(280 50% 38%); }
.mu-hist__kind--hills { background: hsl(35 60% 90%); color: hsl(30 60% 30%); }
.mu-hist__kind--long { background: hsl(210 90% 93%); color: hsl(215 70% 35%); }
.mu-hist__kind--race { background: hsl(48 95% 88%); color: hsl(40 80% 28%); }
.mu-hist__kind--easy { background: hsl(142 60% 92%); color: hsl(145 60% 25%); }
.mu-hist__kind--recovery { background: hsl(200 20% 92%); color: hsl(200 20% 35%); }
body.mu-dark .mu-hist__kind--tempo { background: hsl(25 60% 22%); color: hsl(25 90% 80%); }
body.mu-dark .mu-hist__kind--intervals { background: hsl(0 50% 24%); color: hsl(0 90% 85%); }
body.mu-dark .mu-hist__kind--fartlek { background: hsl(280 40% 26%); color: hsl(280 80% 86%); }
body.mu-dark .mu-hist__kind--hills { background: hsl(35 40% 24%); color: hsl(35 80% 80%); }
body.mu-dark .mu-hist__kind--long { background: hsl(215 50% 26%); color: hsl(210 90% 85%); }
body.mu-dark .mu-hist__kind--race { background: hsl(45 60% 24%); color: hsl(48 95% 80%); }
body.mu-dark .mu-hist__kind--easy { background: hsl(145 40% 20%); color: hsl(142 70% 80%); }
body.mu-dark .mu-hist__kind--recovery { background: hsl(200 15% 26%); color: hsl(200 20% 82%); }

/* srovnání */
.mu-hist__slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mu-hist__slot { border: 1px solid hsl(var(--mu-border)); border-radius: 12px; background: hsl(var(--mu-card)); padding: 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mu-hist__slot--empty { border-style: dashed; color: hsl(var(--mu-text-muted)); }
.mu-hist__slot-h { display: flex; align-items: center; gap: 8px; }
.mu-hist__slot-h b { font-size: 18px; }
.mu-hist__slot-t { border: 0; background: none; font: inherit; font-size: 16px; font-weight: 700; color: hsl(var(--mu-text)); text-align: left; padding: 0; cursor: pointer; text-decoration: underline dotted; overflow-wrap: anywhere; }
.mu-hist__x { margin-left: auto; border: 0; background: none; font-size: 20px; color: hsl(var(--mu-text-muted)); cursor: pointer; line-height: 1; padding: 0 4px; }
.mu-hist__tot { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.mu-hist__tot > div { border: 1px solid hsl(var(--mu-border)); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.mu-hist__tot small { display: block; color: hsl(var(--mu-text-muted)); font-size: 11px; }
.mu-hist__tot b { font-size: 16px; }
.mu-hist__d { font-weight: 700; }
.mu-hist__d--good { color: hsl(145 60% 32%); }
.mu-hist__d--bad { color: hsl(0 70% 42%); }
.mu-hist__d--none { color: hsl(var(--mu-text-muted)); font-weight: 400; }
body.mu-dark .mu-hist__d--good { color: hsl(142 70% 70%); }
body.mu-dark .mu-hist__d--bad { color: hsl(0 90% 78%); }
.mu-hist__cmp td { position: relative; }
.mu-hist__pbar { position: absolute; left: 4px; right: 4px; bottom: 2px; height: 3px; border-radius: 2px; background: hsl(var(--mu-accent)); width: var(--w, 0); right: auto; max-width: calc(100% - 8px); opacity: .6; }
.mu-hist__pbar--b { background: hsl(var(--mu-blue-text)); }
.mu-hist__cand { display: block; width: 100%; text-align: left; border: 1px solid hsl(var(--mu-border)); border-radius: 10px; background: hsl(var(--mu-card)); color: inherit; font: inherit; font-size: 13px; padding: 8px 10px; cursor: pointer; overflow-wrap: anywhere; }
.mu-hist__cand:hover { background: hsl(var(--mu-subtle)); }

/* ⋯ menu a výběr druhu */
.mu-hist__pop { position: absolute; z-index: 1200; width: 260px; background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); border: 1px solid hsl(var(--mu-border)); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: flex; flex-direction: column; }
.mu-hist__pop button { text-align: left; border: 0; background: none; color: inherit; font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.mu-hist__pop button:hover { background: hsl(var(--mu-subtle)); }
.mu-hist__pop button.is-danger { color: hsl(0 70% 42%); }
body.mu-dark .mu-hist__pop button.is-danger { color: hsl(0 90% 78%); }
.mu-hist__kp { position: fixed; inset: 0; z-index: 1300; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; padding: 10px; }
@media (min-width: 640px) { .mu-hist__kp { align-items: center; } }
.mu-hist__kp-card { width: 100%; max-width: 420px; max-height: min(85vh, 85dvh); overflow-y: auto; background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); border-radius: 16px; padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.mu-hist__kp-h { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.mu-hist__kp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 10px 0; }
.mu-hist__kp-list button { border: 1px solid hsl(var(--mu-border)); background: hsl(var(--mu-card)); color: hsl(var(--mu-text)); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.mu-hist__kp-list button.is-on { background: hsl(var(--mu-accent)); color: hsl(var(--mu-accent-text)); border-color: transparent; }
.mu-hist__kp-list button small { opacity: .7; }

/* detail */
.mu-hist__modal { max-width: 860px; width: calc(100% - 20px); max-height: min(92vh, 92dvh); overflow-y: auto; padding: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.mu-hist__modal, .mu-hist__modal .mu-card-title { color: hsl(var(--mu-text)); }
body.mu-dark .mu-hist__modal { background: hsl(var(--mu-card)); }
.mu-hist__mh h3 { margin: 4px 0 8px; font-size: 20px; overflow-wrap: anywhere; }
.mu-hist__kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.mu-hist__kpi { border: 1px solid hsl(var(--mu-border)); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.mu-hist__kpi small { display: block; color: hsl(var(--mu-text-muted)); font-size: 11px; }
.mu-hist__kpi b { font-size: 15px; overflow-wrap: anywhere; }
.mu-hist__race { background: hsl(48 95% 90%); color: hsl(40 80% 25%); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
body.mu-dark .mu-hist__race { background: hsl(45 60% 22%); color: hsl(48 95% 82%); }
.mu-hist__chart { margin: 12px 0; min-height: 60px; }
.mu-hist__txt { white-space: pre-wrap; font-size: 14px; }
.mu-hist__laps summary { cursor: pointer; font-weight: 600; margin: 8px 0; }

@media (max-width: 400px) {
  .mu-hist__row { grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .mu-hist__main { padding: 8px; }
  .mu-hist__l2 { font-size: 14px; }
  .mu-hist__tab { padding: 7px 10px; font-size: 13px; }
  .mu-hist__bars { height: 120px; }
  .mu-hist__bar-val { font-size: 10px; }
}
