/* base styles - desktop first, works on the phone */
/* Roboto + Roboto Mono embedded (static/fonts, OFL licence): the same font on Windows, Android and iOS */
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/roboto-latin.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 100 700; font-display: swap; src: url("fonts/roboto-mono-latin.woff2") format("woff2"); }
:root { --font: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif; --mono: "Roboto Mono", ui-monospace, Consolas, monospace; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.4 var(--font); color: #222; background: #f6f7f9; }
a { color: inherit; text-decoration: none; }
.muted { color: #888; }
.small { font-size: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.pad { padding: 12px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---------- left sidebar ---------- */
.side { position: fixed; top: 0; left: 0; bottom: 0; width: 176px; background: #fff; color: #495057; z-index: 30;
  border-right: 1px solid #e6e8ec;
  display: flex; flex-direction: column; }
.side .brand { display: block; padding: 14px 16px; font-weight: 700; letter-spacing: .08em; color: #1d2330; font-size: 15px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: #495057; }
.side nav a:hover { background: #f1f3f5; color: #1d2330; }
.side nav a.on { background: #edf2ff; color: #3b5bdb; font-weight: 600; box-shadow: inset 3px 0 0 #3b5bdb; }
.side svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.page { margin-left: 176px; min-height: 100vh; }
.scrim { display: none; }
.menu { display: none; background: none; border: 0; color: #fff; font-size: 20px; padding: 0 6px; cursor: pointer; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px; background: #fff; border-bottom: 1px solid #e6e8ec; min-height: 44px; }
.title { font-weight: 600; }
.title .muted { font-weight: 400; }
.years, .calnav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.years a, .calnav a { padding: 2px 9px; border-radius: 4px; color: #445; border: 1px solid transparent; }
.years a.on, .years a:hover, .calnav a:hover { background: #eef1f6; border-color: #dde2ea; }
.calnav a { font-size: 15px; }
.calnav .month { font-weight: 600; font-size: 15px; min-width: 128px; text-align: center; }
.calnav a.today { border-color: #dde2ea; font-size: 13px; margin-left: 6px; }

.wrap { max-width: 1500px; margin: 0 auto; padding: 12px 16px 40px; }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.grid th, .grid td { padding: 6px 10px; border-bottom: 1px solid #eef0f3; text-align: left; }
.grid th { font-size: 12px; color: #667; font-weight: 600; background: #fafbfc; }
.grid .r { text-align: right; font-variant-numeric: tabular-nums; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: #f1f5ff; }
.grid tbody tr.on { background: #e3ecff; }

/* ---------- summary cards ---------- */
.summary { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: baseline; padding: 10px 14px; margin-bottom: 8px;
  background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.summary div { display: flex; flex-direction: column; }
.summary b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary span { font-size: 11px; color: #778; text-transform: uppercase; letter-spacing: .03em; }
.summary.metrics b { font-size: 16px; }

.zones { display: flex; height: 18px; border-radius: 4px; overflow: hidden; margin: 0 0 8px; font-size: 10px; color: #fff; }
.zones .z { display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; min-width: 2px; }
.z0 { background: #adb5bd; } .z1 { background: #74c0fc; } .z2 { background: #51cf66; } .z3 { background: #fcc419; color: #333; }
.z4 { background: #ff922b; } .z5 { background: #f03e3e; } .z6 { background: #c2255c; } .z7 { background: #862e9c; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.toolbar button, .toolbar select { font: inherit; padding: 4px 10px; border: 1px solid #ccd; border-radius: 4px; background: #fff; cursor: pointer; }
.toolbar button:disabled { color: #aaa; cursor: default; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button.on { background: #3b5bdb; border-color: #3b5bdb; color: #fff; }
.hint { font-size: 12px; color: #889; }
.dd { position: relative; }
.ddmenu { position: absolute; top: 100%; left: 0; z-index: 2000; margin-top: 4px; background: #fff; border: 1px solid #d6dae2;
  border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 6px 10px; min-width: 260px; max-height: 70vh; overflow: auto; }
.ddmenu label { display: block; padding: 3px 0; white-space: nowrap; cursor: pointer; }
.ddgroup { font-size: 11px; color: #667; text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 2px; }
.ddgroup:first-child { margin-top: 2px; }
.ddfoot { border-top: 1px solid #eee; margin-top: 6px; padding-top: 6px; font-size: 12px; }
.ddfoot a { color: #3b5bdb; }

/* ---------- selection + charts ---------- */
.sel .summary { background: #eef3ff; }
.selhead { font-size: 12px; font-weight: 600; color: #3b5bdb; margin: 0 0 4px 2px; display: flex; align-items: center; gap: 8px; }
.sel { margin: 0 0 8px; }
.lapnav { font: inherit; font-size: 16px; line-height: 1; padding: 2px 10px; border: 1px solid #ccd; border-radius: 4px; background: #fff; cursor: pointer; color: #3b5bdb; }
.lapnav:hover { background: #eef3ff; }
.charts { background: #fff; border-radius: 6px; padding: 6px 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); overflow: hidden; }
.chart { margin: 0; position: relative; border-top: 1px solid #f1f3f5; }
.chart:first-child { border-top: 0; }
/* y axis room of each chart: name (vertical) + max / average / min (activity.js yLabels) */
.ylab { position: absolute; left: 0; top: 0; bottom: 0; pointer-events: none; font: 11px/14px Roboto, system-ui, sans-serif;
  font-variant-numeric: tabular-nums; color: #868e96; }
.ylab > span { position: absolute; right: 6px; white-space: nowrap; }
.ylab .yn { left: 0; right: auto; width: 14px; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center;
  font-size: 10px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ylab .yavg { font-size: 13px; line-height: 18px; font-weight: 700; }
.ylab .yavg.at { text-decoration: underline dotted; text-underline-offset: 3px; }  /* value at the cursor, not the average */
/* readout above the charts: time and clock under the cursor, else the part shown */
.cread { display: flex; align-items: baseline; gap: 8px; padding: 2px 10px 4px; min-height: 22px; font-variant-numeric: tabular-nums; }
.cread b { font-size: 16px; }
.cread span { color: #868e96; font-size: 12px; }
.chart .uplot { position: relative; }
.uplot .u-legend { position: absolute; top: 0; left: 56px; z-index: 5; font-size: 12px; text-align: left; margin: 0;
  padding: 0 6px; background: rgba(255,255,255,.85); border-radius: 3px; pointer-events: none; }
.uplot .u-legend tr { display: inline-block; }
.uplot .u-legend th, .uplot .u-legend td { padding: 0 4px; }
.chart:not(:first-child) .uplot .u-legend tr:first-child { display: none; }
.uplot .u-legend .u-marker { width: 10px; height: 3px; }
.u-select { background: rgba(59,91,219,.13); }

.lapstrip { position: relative; height: 24px; margin: 0 0 6px; }
.lap { position: absolute; top: 0; height: 22px; background: #f1f3f7; border-radius: 3px; cursor: pointer; overflow: hidden;
  font-size: 11px; line-height: 19px; padding: 0 2px; text-align: center; color: #495057; border-bottom: 3px solid #c5cbd6; }
.lap.alt { background: #e8ebf1; }
.lap:hover { background: #dfe6f7; }
.lap.on { background: #dbe4ff; border-bottom-color: #3b5bdb; }
.lap b, .lap i { display: block; font-style: normal; white-space: nowrap; }
.lap i { color: #1971c2; }
.lap i.w { color: #7048e8; }
.lap i.h { color: #e03131; }
h3 { margin: 20px 0 8px; font-size: 15px; }

/* zone lists (Garmin style), below the charts */
.zlist { background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06); padding: 2px 14px 10px; margin-top: 12px; }
.zlist h3 { margin: 10px 0 6px; }
.zrow { display: grid; grid-template-columns: 1fr 70px 46px; grid-template-areas: "head head head" "bar time pct"; gap: 2px 10px;
  align-items: center; padding: 4px 0; }
.zhead { grid-area: head; font-size: 13px; }
.zbar { grid-area: bar; height: 10px; background: #eceef2; border-radius: 5px; overflow: hidden; }
.zbar i { display: block; height: 100%; border-radius: 5px; min-width: 2px; }
.ztime { grid-area: time; text-align: right; font-variant-numeric: tabular-nums; }
.zpct { grid-area: pct; text-align: right; color: #667; font-variant-numeric: tabular-nums; }

/* ---------- calendar (week rows, Monday first) ---------- */
.cal { background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06); overflow: hidden; }
.calhead, .calweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 150px; }
.calhead div { font-size: 12px; color: #667; font-weight: 600; padding: 6px 8px; background: #fafbfc; border-bottom: 1px solid #e6e8ec; }
.calweek { border-bottom: 1px solid #e6e8ec; min-height: 96px; }
.calday { padding: 4px 5px 6px; border-right: 1px solid #f0f1f4; min-width: 0; }
.calday.othermo { background: #fbfbfc; }
.calday.today { background: #f3f7ff; box-shadow: inset 0 2px 0 #3b5bdb; }
.dnum { font-size: 12px; color: #667; margin-bottom: 3px; }
.dname { display: none; }
/* activity card: pale tint + thin border, both mixed from the sport colour (--c from dbo.Sport.Color) */
.card { display: block; background: color-mix(in srgb, var(--c) 9%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff);
  border-radius: 5px; padding: 4px 6px; margin-bottom: 5px; font-size: 12px; line-height: 15px; overflow: hidden; }
.card:hover { background: color-mix(in srgb, var(--c) 16%, #fff); border-color: color-mix(in srgb, var(--c) 55%, #fff); }
.card b { font-weight: 600; }
.cnums { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wkcol { background: #fafbfc; border-right: 0; }
.wkbig { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- phone ---------- */
@media (max-width: 800px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  body.open .side { transform: none; }
  body.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .page { margin-left: 0; }
  .menu { display: block; color: #333; }
  .hide-s { display: none; }
  .wrap { padding: 8px 6px 30px; }
  .summary b { font-size: 17px; }
  .grid th, .grid td { padding: 6px 6px; }
  .hint { width: 100%; }
  .uplot .u-legend { left: 42px; }
  .lap { font-size: 10px; }
  /* calendar becomes a list of days */
  .calhead { display: none; }
  .calweek { display: block; min-height: 0; }
  /* day number + name on the same line as the wellness row; notes, plans and cards full width below (no side column) */
  .calday { border-right: 0; border-bottom: 1px solid #f0f1f4; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; }
  .calday:not(.hasitems):not(.wkcol) { padding-top: 1px; padding-bottom: 1px; } /* empty days: one line with the + (tap to add) */
  .calday:not(.hasitems):not(.wkcol) .dnum { color: #adb5bd; }
  .dnum { grid-column: 1; grid-row: 1; margin: 0; white-space: nowrap; }
  .ditems { display: contents; }
  .ditems > * { grid-column: 1 / -1; min-width: 0; }
  .ditems > .dwell { grid-column: 2; grid-row: 1; margin: 0; }
  .dname { display: inline; margin-left: 4px; }
  .card { grid-column: 1 / -1; margin: 0; }
  .wkcol { display: block; background: #eef1f6; }
}
/* laps chart */
.lapsec { background: #fff; border-radius: 6px; padding: 8px 10px 4px; margin: 10px 0; }
.lapsec h3 { margin: 2px 0 6px; }
.lapsec .u-over { cursor: pointer; }
.coll { cursor: pointer; user-select: none; }
.coll .caret::before { content: "\25BE"; display: inline-block; width: 16px; color: #868e96; transition: transform .15s; }
.closed > .coll .caret::before { transform: rotate(-90deg); }
.lapsec.closed > #lapcharts, .lapc.closed > .lapplot, .closed > .collbody { display: none; }
.laplist { margin: 10px 0; }
.lapch { font-weight: 600; font-size: 13px; padding: 6px 0 2px; border-top: 1px solid #f1f3f5; }
.lapc:first-child .lapch { border-top: 0; }
/* details: one line per item, grouped (Garmin style) */
.details { background: #fff; border-radius: 6px; padding: 8px 12px; margin: 10px 0; }
.dgroups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 28px; }
.dgroup h4 { margin: 10px 0 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #868e96; }
.drow { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid #f1f3f5; font-size: 14px; }
.drow span { color: #495057; }
.drow b { font-weight: 600; white-space: nowrap; }
.drow i { font-style: normal; font-weight: 400; font-size: 12px; }
/* map (Leaflet + OpenStreetMap tiles) */
.mapsec { background: #fff; border-radius: 6px; padding: 8px 10px; margin: 10px 0; }
.mapsec h3 { margin: 2px 0 6px; }
#map { height: 320px; border-radius: 4px; position: relative; z-index: 0; isolation: isolate; } /* keep Leaflet layers (z-index 400-1000) inside the map, under menus */
@media (max-width: 700px) { #map { height: 240px; } }
/* workout names */
.cwkt { font-size: 12px; font-weight: 600; color: #343a40; margin: 1px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actname { margin: 4px 0 8px; font-size: 18px; }
/* sport icons (Tabler, inline) */
.sicon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -4px; margin-right: 6px; flex: none; }
.card .sicon { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.show-s { display: none; }
@media (max-width: 800px) { .show-s { display: block; } }

/* activity list filter */
.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.filter .seg a { padding: 4px 11px; border: 1px solid #ccd; background: #fff; margin-left: -1px; color: #445; }
.filter .seg a:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.filter .seg a:last-child { border-radius: 0 4px 4px 0; }
.filter .seg a.on { background: #3b5bdb; border-color: #3b5bdb; color: #fff; }
.filter input[type=search] { font: inherit; padding: 4px 8px; border: 1px solid #ccd; border-radius: 4px; min-width: 200px; }
.filter button { font: inherit; padding: 4px 10px; border: 1px solid #ccd; border-radius: 4px; background: #fff; cursor: pointer; }

/* settings */
pre.cfg { background: #f8f9fb; border: 1px solid #eceef2; border-radius: 4px; padding: 10px; overflow: auto; font-size: 12px; line-height: 1.45; }

/* sidebar: bottom group (settings, collapse) + desktop mini mode (icons only) */
.side nav.navbottom { margin-top: auto; padding-bottom: 8px; }
.side .bmini { display: none; }
@media (min-width: 801px) {
  .mini .side { width: 56px; }
  .mini .page { margin-left: 56px; }
  .mini .side nav a { justify-content: center; padding: 10px 0; }
  .mini .side nav a span, .mini .side .bfull { display: none; }
  .mini .side .bmini { display: inline; }
  .mini .side .brand { text-align: center; padding: 14px 0; }
  .mini .side .collapse .cl { transform: rotate(180deg); transform-origin: 14px 12px; }
}
@media (max-width: 800px) { .side .collapse { display: none; } }
/* calendar track thumbnails */
.cthumb { display: block; width: 100%; max-width: 160px; height: auto; aspect-ratio: 1; border-radius: 3px; margin: 3px 0 2px;
  border: 1px solid #c5c9d0; box-sizing: border-box; }

/* ---------- home ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.kpi { background: #fff; border: 1px solid #dfe3e8; border-radius: 10px; padding: 12px 16px; }
.kpi b { display: block; font-size: 34px; font-weight: 700; line-height: 1.1; padding-bottom: 6px; border-bottom: 2px solid currentColor;
  font-variant-numeric: tabular-nums; }
.kpi b i { font-style: normal; font-size: 18px; font-weight: 400; vertical-align: 6px; }
.kpi span { display: block; margin-top: 6px; font-size: 15px; color: #445; }
.k-fit { color: #2f4fd6; } .k-form { color: #e8590c; border-color: #f0a060; } .k-fat { color: #d6336c; }
.ready .rhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ready .rhead span { font-size: 15px; color: #6b4a1e; }
.ready .rhead b { font-size: 22px; color: #e8590c; }
.rbar { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 22px 0 6px; }
.rseg { height: 12px; border-radius: 6px; }
.r0 { background: #f76707; } .r1 { background: #ff922b; } .r2 { background: #ffb37a; } .r3 { background: #ffd4b0; } .r4 { background: #fff0e4; }
.rseg.on { outline: 2px solid #e8590c; outline-offset: 1px; }
.rmark { position: absolute; top: -14px; width: 0; height: 0; margin-left: -8px; border: 8px solid transparent; border-top: 10px solid #e8590c; }
.rlab { display: flex; justify-content: space-between; font-size: 13px; color: #778; }
.ffdays { display: inline-flex; margin-left: 10px; font-weight: 400; font-size: 12px; }
#ffchart { width: 100%; }
.vo2s { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.vo2 { border: 1px solid color-mix(in srgb, var(--c, #adb5bd) 35%, #fff); background: color-mix(in srgb, var(--c, #adb5bd) 6%, #fff);
  border-radius: 8px; padding: 8px 12px; min-width: 0; }
.vo2 .vhead { display: flex; align-items: center; gap: 6px; font-weight: 600; color: #445; }
.vo2 .vhead .sicon { width: 18px; height: 18px; }
.vo2 > b { display: block; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vo2.lab { border-style: dashed; }
.vspark { width: 100%; margin-top: 4px; }
.hact { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; padding: 7px 4px; border-top: 1px solid #f0f1f3; }
.hact:first-of-type { border-top: 0; }
.hact:hover { background: #f6f8fb; }
.hact .sicon { width: 18px; height: 18px; }
.hact .hload { margin-left: auto; color: #556; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .kpis { gap: 6px; }
  .kpi { padding: 10px; }
  .kpi b { font-size: 26px; }
  .kpi span { font-size: 13px; }
  .hact .muted { flex-basis: 100%; order: 3; font-size: 12px; }
}

/* ---------- workout popup (workout.js) ---------- */
.wktlink { cursor: pointer; text-decoration: underline dotted #adb5bd; text-underline-offset: 3px; }
.wktlink:hover { color: #3b5bdb; text-decoration-color: #3b5bdb; }
#wktpop { position: fixed; inset: 0; z-index: 3000; background: rgba(20, 24, 33, .45); display: flex; align-items: center; justify-content: center; padding: 12px; }
#wktpop .wkbox { background: #fff; border-radius: 10px; width: min(640px, 100%); max-height: 92vh; overflow: auto; padding: 12px 16px 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
#wktpop .wkhead { display: flex; align-items: baseline; gap: 10px; }
#wktpop .wkhead b { font-size: 17px; }
#wktpop .wkx { margin-left: auto; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: #868e96; padding: 0 4px; }
#wktpop .wkchart { display: block; width: 100%; height: 150px; margin: 10px 0 6px; background: #fff; border: 1px solid #eceef1; border-radius: 4px; touch-action: pan-y; }
#wktpop .wktext { font: 13px/1.55 var(--mono); background: #f8f9fa; border: 1px solid #eceef1; border-radius: 6px;
  padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; }
#wktpop .wkabs { color: #a0a6ad; }
#wktpop .wkfoot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#wktpop .wkcopy { margin-left: auto; border: 1px solid #3b5bdb; background: #3b5bdb; color: #fff; border-radius: 6px; padding: 5px 16px; cursor: pointer; font: inherit; }

/* ---------- calendar day: + button, wellness, note, planned workout (day.js) ---------- */
.calday[data-day] { cursor: pointer; }
.dnum { position: relative; }
.dadd { float: right; border: 0; background: none; color: #adb5bd; font-size: 16px; line-height: 1; padding: 0 3px; cursor: pointer; opacity: 0; }
.calday:hover .dadd, .calday.today .dadd { opacity: 1; }
.dadd:hover { color: #3b5bdb; }
@media (hover: none) { .dadd { opacity: 1; } }
.dwell { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 7px; font-size: 12px; color: #343a40; margin: 1px 0 4px;
  font-variant-numeric: tabular-nums; }
.dwell > span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.dwell .micon, .dwell .sicon { width: 13px; height: 13px; flex: none; margin: 0; vertical-align: 0; }
.dwell .wkg { color: #a6884a; }
.dwell .wvo2 { color: #1c7ed6; }
.dwell:hover { background: #f6f8fb; border-radius: 4px; }
.dnote { font-size: 12px; padding: 2px 6px; margin: 2px 0 3px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--n) 14%, #fff); color: color-mix(in srgb, var(--n) 70%, #000); }
.dplan { display: block; border: 1px dashed color-mix(in srgb, var(--c) 60%, #fff); border-radius: 5px; padding: 3px 5px; margin: 2px 0 4px;
  font-size: 12px; background: #fff; }
.dplan:hover { background: color-mix(in srgb, var(--c) 7%, #fff); }
/* moving a planned workout / note: drag & drop (desktop), press and hold + tap the day (phone) */
.dplan[draggable], .dnote[draggable] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dragging { opacity: .45; }
.calday.dropok { background: #e7f0ff; box-shadow: inset 0 0 0 2px #3b5bdb; }
.picked { outline: 2px solid #3b5bdb; outline-offset: 1px; background: #e7f0ff; }
#movebar { position: fixed; left: 8px; right: 8px; bottom: 12px; z-index: 50; padding: 12px 14px; border-radius: 8px;
  background: #3b5bdb; color: #fff; font-size: 14px; font-weight: 600; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.dplan .sicon { width: 15px; height: 15px; margin-right: 3px; vertical-align: -3px; }
#daypop { position: fixed; inset: 0; z-index: 3000; background: rgba(20, 24, 33, .45); display: flex; align-items: center; justify-content: center; padding: 10px; }
#daypop .dpbox { background: #fff; border-radius: 10px; width: min(600px, 100%); max-height: 94vh; overflow: auto; padding: 12px 16px 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
#daypop .wkhead { display: flex; align-items: baseline; gap: 10px; }
#daypop .wkhead b { font-size: 17px; }
#daypop .wkx { margin-left: auto; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: #868e96; }
#daypop .dpbox > .wkhead { margin-bottom: 6px; }
#daymenu { position: fixed; z-index: 3000; background: #fff; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
  padding: 4px; min-width: 190px; }
#daymenu .dmhead { font-size: 12px; color: #868e96; padding: 4px 10px 6px; }
#daymenu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; font: inherit;
  text-align: left; cursor: pointer; border-radius: 5px; color: #222; }
#daymenu button:hover { background: #edf2ff; color: #3b5bdb; }
#daymenu .dmi { width: 18px; text-align: center; color: #868e96; }
.dpbox label { display: block; font-size: 12px; color: #6c757d; margin: 6px 0; }
.dpbox input, .dpbox textarea, .dpbox select { display: block; width: 100%; margin-top: 3px; padding: 6px 8px; border: 1px solid #ced4da; border-radius: 6px;
  font: 14px/1.4 var(--font); color: #222; background: #fff; }
.dpbox textarea.mono { font: 13px/1.55 var(--mono); }
.dprow { display: flex; gap: 10px; } .dprow .grow { flex: 1; }
.dpgrid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dpgrid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.dpcolors { display: flex; gap: 8px; margin: 6px 0; }
.dpcolors span { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }
.dpcolors span.on { outline: 2px solid #343a40; outline-offset: 2px; }
.dpchart { display: block; width: 100%; height: 140px; margin-top: 8px; background: #fff; border: 1px solid #eceef1; border-radius: 4px; touch-action: pan-y; }
.dpstat { margin-top: 4px; min-height: 18px; }
.dpstat .ok { color: #2f9e44; } .dpstat .bad { color: #e03131; }
.dpfoot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.dperr { color: #e03131; font-size: 13px; margin-left: auto; }
.dpsave { border: 1px solid #3b5bdb; background: #3b5bdb; color: #fff; border-radius: 6px; padding: 6px 16px; cursor: pointer; font: inherit; }
.dpdel { border: 1px solid #ffc9c9; background: #fff; color: #e03131; border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; }
@media (max-width: 520px) { .dpgrid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dpgrid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .ditems .card { margin: 0 0 4px; } }

/* workout builder help box (day.js) */
.dphelpbar { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; color: #6c757d; margin: 8px 0 3px; }
.dphelpbtn { color: #3b5bdb; font-size: 12px; white-space: nowrap; }
.dphelp { background: #f8f9fb; border: 1px solid #e6e9ef; border-radius: 6px; padding: 8px 10px; font-size: 12px; color: #343a40; margin-bottom: 6px; }
.dphelp p { margin: 2px 0 6px; }
.dphelp dl { display: grid; grid-template-columns: 78px 1fr; gap: 4px 8px; margin: 0; }
.dphelp dt { color: #6c757d; padding-top: 2px; }
.dphelp dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.dphelp code { font: 12px var(--mono); background: #fff; border: 1px solid #dee2e6; border-radius: 4px; padding: 1px 6px; cursor: pointer; }
.dphelp code:hover { border-color: #3b5bdb; color: #3b5bdb; }
.dpbox label.nolabel { margin-top: 0; }

/* Garmin Sync page */
.gsbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0; }
.btn { font: inherit; padding: 6px 14px; border: 1px solid #ccd; border-radius: 4px; background: #fff; cursor: pointer; }
.btn.primary { background: #3b5bdb; border-color: #3b5bdb; color: #fff; font-weight: 500; }
.btn:disabled { opacity: .55; cursor: default; }
.gslog { max-height: 360px; overflow: auto; }
.gstable { width: auto; min-width: 420px; }
.bad { color: #e03131; }

/* DUP pill: the same activity recorded on two devices (sql\011) - ENDURANCE orange (#f08c00 family) */
.duppill { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #fff4e6;
  border: 1px solid #ffd8a8; color: #e8590c; font-size: 10px; font-weight: 600; letter-spacing: .04em; line-height: 15px;
  vertical-align: 1px; text-decoration: none; white-space: nowrap; }
a.duppill:hover { background: #ffe8cc; }

/* altitude toggle (sql\012): original / alternative, orange like the DUP pill when the alternative is on */
.altgrp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin-left: 4px; }  /* label + toggle wrap together */
.altseg button[data-alt="1"].on { background: #e8590c; border-color: #e8590c; }
.summary .altkpi b, .drow b.altval { color: #e8590c; }
.cdev { font-size: 11px; color: #e8590c; }  /* device of a DUP copy on the calendar card */

/* excluded / deleted activities (sql\013) */
.xpill { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #f1f3f5; border: 1px solid #ced4da;
  color: #495057; font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 2px; text-decoration: none; letter-spacing: .3px; }
.xpill.del { background: #fff5f5; border-color: #ffc9c9; color: #c92a2a; }
.stgrp { display: inline-flex; align-items: center; gap: 6px; }
button.danger { color: #c92a2a; }
button.danger:hover { background: #fff5f5; border-color: #ffa8a8; }
.xtabs { margin-left: 12px; }
.xtabs .btn { padding: 3px 12px; text-decoration: none; color: inherit; }
.xtabs .btn.on { background: #3b5bdb; border-color: #3b5bdb; color: #fff; }
.xgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: start; }
.xday .card { margin: 0 0 6px; }
.xdate { font-size: 12px; font-weight: 600; color: #495057; margin: 0 0 4px; }
.cnote { font-size: 11px; color: #868e96; font-style: italic; }
.dels button.restore { padding: 2px 10px; font-size: 12px; }

/* multisport session card on the calendar (session.go) */
.card.sess { cursor: default; }
.slegs { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.sleg { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 3px; text-decoration: none; color: inherit;
  background: color-mix(in srgb, var(--c) 10%, #fff); border-left: 3px solid var(--c); font-size: 12px; flex-wrap: wrap; column-gap: 4px; row-gap: 0; }
.sleg:hover { background: color-mix(in srgb, var(--c) 20%, #fff); }
.sleg .sicon { width: 14px; height: 14px; margin: 0; flex: none; }
.sleg .slab { font-weight: 600; }
.sleg .snum { margin-left: auto; font-variant-numeric: tabular-nums; color: #495057; }
.sleg.strans { background: transparent; border-left-color: #ced4da; color: #868e96; font-size: 11px; padding-top: 0; padding-bottom: 0; }
.sleg .sdev { font-size: 10px; color: #e8590c; margin-left: 4px; }

/* multisport box on the activity page (sql\014) */
.msbox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0; padding: 6px 10px; border-radius: 6px;
  background: #f3f0ff; border: 1px solid #d0bfff; }
.mstitle { display: inline-flex; align-items: center; gap: 4px; }
.mstitle .sicon { width: 18px; height: 18px; }
.mslegs { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.msleg { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 999px; font-size: 12px; text-decoration: none;
  color: inherit; background: color-mix(in srgb, var(--c) 12%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }
.msleg .sicon { width: 14px; height: 14px; margin: 0; }
.msleg.cur { outline: 2px solid var(--c); font-weight: 600; }
.msleg.off { opacity: .45; text-decoration: line-through; }
button.mslink { border: 0; background: none; padding: 0; color: #5f3dc4; font-size: 12px; cursor: pointer; text-decoration: underline; }
#msadd { min-width: 280px; padding: 8px; }
.mscand { display: flex; align-items: center; gap: 4px; padding: 3px 0; font-size: 13px; }
.mscand .sicon { width: 14px; height: 14px; }
.mspill { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #f3f0ff; border: 1px solid #d0bfff;
  color: #5f3dc4; font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 1px; }
/* calendar "Group as multisport" dialog: checkbox before each activity (the dialog's inputs are full width) */
.dpbox label.mscand { display: flex; align-items: center; gap: 6px; font-size: 13px; color: inherit; margin: 4px 0; }
.dpbox label.mscand input { display: inline-block; width: auto; margin: 0; padding: 0; }
.sleg.ssim { border-left-style: dashed; font-style: italic; cursor: default; }  /* simulated transition: no activity behind it */
.msleg.ssim { border-style: dashed; font-style: italic; color: #868e96; background: #fff; }

/* calendar card: done activity = map (or the workout miniature when there is no map) + numbers;
   planned workout = its miniature at full width. Picture boxes: light grey, frame in the card's colour */
.cbody { margin: 3px 0 2px; }
.cbody .cthumb { margin: 0 0 3px; object-fit: cover; }
.cwktbox { display: flex; align-items: center; width: 100%; max-width: 160px; aspect-ratio: 1; cursor: pointer; margin: 0 0 3px;
  background: #f1f3f5; border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); border-radius: 3px; padding: 4px; box-sizing: border-box; }
.cwktpic { flex: 1; min-width: 0; }
.cwktmini { display: block; width: 100%; height: auto; aspect-ratio: 2.5; }  /* wide like the workout popup */
.dplanpic { background: #f1f3f5; border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); border-radius: 3px; padding: 4px; margin: 3px 0 1px; }
.chead, .cwkt { text-align: center; }
@media (max-width: 800px) {
  /* phone: square picture on the left (half the card), the numbers one per line beside it, bigger */
  .cbody { display: flex; align-items: center; gap: 10px; }
  .cbody .cthumb, .cbody .cwktbox { flex: 0 0 50%; max-width: none; margin: 0; }
  .cstats { flex: 1; min-width: 0; font-size: 16px; line-height: 22px; }
  .cstats .cnums.muted { font-size: 14px; line-height: 20px; }
  .cstats .cv { display: block; }
  .cstats .csep { display: none; }
  .cwkt { font-size: 14px; margin: 2px 0 4px; }
  .dplan { font-size: 14px; }
  /* bigger activity / session / planned workout names */
  .chead, .card.sess > b, .dplan > b, .sghead b { font-size: 17px; line-height: 23px; }
  .chead .sicon, .card.sess > .sicon, .dplan > .sicon, .sghead .sicon { width: 20px; height: 20px; vertical-align: -4px; }
}

/* RPE badge and Feel face (rpefeel.go): calendar card under the numbers, activity page above the summary */
.crf { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.rpe { display: inline-block; color: #fff; font-weight: 700; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 8px; white-space: nowrap; }
svg.feel { width: 18px; height: 18px; flex: none; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arf { margin: 2px 0 10px; font-size: 15px; gap: 8px; }
.arf .rpe { font-size: 13px; line-height: 20px; padding: 0 8px; border-radius: 10px; }
.arf svg.feel { width: 22px; height: 22px; }
.rfsep { color: #ced4da; }
@media (max-width: 800px) {
  .crf { margin-top: 5px; }
  .crf .rpe { font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 9px; }
  .crf svg.feel { width: 22px; height: 22px; }
}

/* "Show on calendar" button (activity header) and the card it points at on the calendar */
.summary .calgo { margin-left: auto; align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border: 1px solid #3b5bdb; border-radius: 6px; color: #3b5bdb; font-size: 13px; font-weight: 600; white-space: nowrap; }
.summary .calgo:hover { background: #3b5bdb; color: #fff; }
.summary button.idlink { margin-left: 6px; font-family: inherit; background: transparent; cursor: pointer; }
.calgo svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cflash { 0%, 60% { box-shadow: 0 0 0 3px #3b5bdb; } 100% { box-shadow: 0 0 0 3px transparent; } }
.card.flash { animation: cflash 2.5s ease-out; }

/* sidebar logo (rpefeel.go brandLogo): sport-coloured letters on a light card, heartbeat line under them */
.side .brand { letter-spacing: 0; text-align: center; }  /* logo centred in the sidebar */
.logo { display: inline-block; background: #f1f3f5; border: 1px solid #dde2ea; border-radius: 9px; padding: 3px 12px 2px; }
.logot { display: block; font: 800 26px/1 Roboto, system-ui, sans-serif; letter-spacing: .01em; }
.side svg.logow { display: block; width: 100%; height: 7px; margin-top: 1px; fill: none; stroke: #e03131; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.logom { display: block; margin-top: 4px; font: 500 10px/12px Roboto, system-ui, sans-serif; color: #868e96; letter-spacing: .01em; }

/* multisport session on the calendar: the legs' own cards (map, numbers, RPE...) inside a purple frame
   with the session total on top; transitions as thin rows between them */
.sgroup { border: 2px solid color-mix(in srgb, var(--c) 45%, #fff); border-radius: 7px; padding: 3px 4px 0; margin-bottom: 5px;
  background: color-mix(in srgb, var(--c) 5%, #fff); }
.sghead { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; padding: 2px 2px 4px; font-size: 12px; line-height: 15px; }
.sghead b { font-weight: 600; }
.sghead .sicon { width: 16px; height: 16px; margin: 0; }
.sghead .sgnums { color: #495057; font-variant-numeric: tabular-nums; }
.sgroup .card { margin: 0 0 3px; }
.sgtrans { display: flex; align-items: center; gap: 4px; padding: 0 6px 3px; font-size: 11px; color: #868e96; text-decoration: none; }
.sgtrans .sicon { width: 12px; height: 12px; margin: 0; }
.sgtrans .snum { margin-left: auto; font-variant-numeric: tabular-nums; }
.sgtrans.ssim { font-style: italic; }
@media (max-width: 800px) { .sghead { font-size: 14px; justify-content: center; } .sgtrans { font-size: 13px; } }
