/* Seven week rows, Monday first, with a narrow week rail on the left. Races are the only colour. */
:root {
  --bg: #eef1f0;
  --surface: #ffffff;
  --ink: #15211d;
  --muted: #66736e;
  --line: #d3dad7;
  --today: #15211d;
  --hyrox: #c96a00;
  --hyrox-soft: #fdeed8;
  --half: #1f4fd1;
  --half-soft: #e3eafc;
  --z2: #1baf7a;
  --run: #6250d6;
  --swim: #2a78d6;
  --gym: #e87ba4;
  --am: #eda100;
  --pred: #848f8b;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101614; --surface: #19211e; --ink: #e8eeeb; --muted: #94a19c; --line: #2c3833;
    --today: #e8eeeb; --hyrox: #f2a340; --hyrox-soft: #3a2a10; --half: #86a6ff; --half-soft: #1a2750; --z2: #199e70; --run: #9085e9; --swim: #3987e5; --gym: #d55181; --am: #c98500; --pred: #75827d;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101614; --surface: #19211e; --ink: #e8eeeb; --muted: #94a19c; --line: #2c3833;
  --today: #e8eeeb; --hyrox: #f2a340; --hyrox-soft: #3a2a10; --half: #86a6ff; --half-soft: #1a2750; --z2: #199e70; --run: #9085e9; --swim: #3987e5; --gym: #d55181; --am: #c98500; --pred: #75827d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.4; }
main { max-width: 1280px; margin: 0 auto; padding: 28px 20px 48px; display: flex; flex-direction: column; gap: 24px; }

header { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between; }
h1 { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; margin: 0; text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; }
.sub { color: var(--muted); margin: 6px 0 0; }
.countdowns { display: flex; flex-wrap: wrap; gap: 12px; }
.count { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; border-left: 4px solid; }
.count.hyrox { background: var(--hyrox-soft); border-color: var(--hyrox); }
.count.half { background: var(--half-soft); border-color: var(--half); }
.count.maybe { border-left-style: dashed; background: transparent; outline: 1px dashed var(--line); outline-offset: -1px; }
.count { padding: 8px 12px; }
.count b { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.count span { font-size: 13px; }
.count span strong { display: block; font-weight: 600; font-size: 14px; }

.dows, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week { display: flex; flex-direction: column; gap: 6px; }
.dows div { font-family: var(--display); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px; }
.cal { display: flex; flex-direction: column; gap: 18px; }
.rail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 0 8px; font-family: var(--display); text-transform: uppercase; letter-spacing: .05em; }
.rail b { font-size: 20px; font-weight: 600; }
.rail span { font-size: 13px; color: var(--muted); }

.day { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 88px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.day .head { display: flex; align-items: baseline; gap: 6px; }
.flag { flex: none; align-self: center; width: 18px; height: 12px; border-radius: 2px; overflow: hidden; opacity: .5; box-shadow: 0 0 0 1px rgb(0 0 0 / .14); }
.flag svg { display: block; width: 18px; height: 12px; }
.day .dow { display: none; font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.day .num { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.day .mon { font-family: var(--display); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.day.past { background: transparent; }
.day.past .num { color: var(--muted); }
.day.out { background: transparent; border-style: dashed; }
.day.out .num { color: var(--muted); }
.day.today { border: 2px solid var(--today); padding: 7px; }
.day.today .head::after { content: "Today"; margin-left: auto; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.day.hyrox { border-color: var(--hyrox); background: var(--hyrox-soft); }
.day.half { border-color: var(--half); background: var(--half-soft); }
.items { display: flex; flex-direction: column; gap: 4px; }
.item { font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.item.race { font-weight: 600; }
.item small { display: block; font-weight: 400; color: var(--muted); }
.habits { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--muted); }
.habits b { color: var(--ink); font-weight: 600; }
.item.rest { color: var(--muted); font-weight: 500; }
.item.travel, .item.tech { font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.slots { display: flex; flex-direction: column; gap: 2px; }
.slot { display: flex; flex-direction: column; align-items: flex-start; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; font-size: 13px; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip svg { flex: none; }
.chip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Each chip sets --c to its activity colour from plan.json. */
.chip { color: var(--c, currentColor); }
.chip span { color: var(--ink); }
.chip.home span { font-weight: 500; }
.chip.z2.big { box-shadow: inset 0 0 0 1.5px var(--c); padding: 0 8px 0 5px; margin-left: 0; }
.chip.am { gap: 3px; min-height: 20px; }
.head .chip.am { margin-left: auto; align-self: center; }
.chip.am svg { width: 18px; height: 18px; }
.day.today .head .chip.am + * , .day.today .head:has(.chip.am)::after { margin-left: 8px; }
.chip.warm { font-size: 12px; font-weight: 500; gap: 2px; }
.chip.warm svg { width: 16px; height: 16px; }
.slotrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.chip.long span { color: #fff; }
.chip.long { background: var(--c); color: #fff; padding: 0 7px 0 5px; border-radius: 6px; }
.chip.off { color: var(--line); }
.chipnote { font-size: 12px; color: var(--muted); padding-left: 24px; overflow-wrap: anywhere; }
.keyitem { display: inline-flex; align-items: center; gap: 6px; }
.rail .railnote { font-family: var(--body); font-size: 13px; text-transform: none; letter-spacing: 0; }
.rail .km { font-weight: 600; }
.item.tech { border-left: 3px solid var(--line); padding-left: 6px; }
.item.gym { font-weight: 600; border-left: 3px solid var(--ink); padding-left: 6px; }
.item.z2 { font-weight: 600; color: var(--z2); border-left: 3px solid var(--z2); padding-left: 6px; }
.hyrox .item.race { color: var(--hyrox); }
.half .item.race { color: var(--half); }

h2 { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1; margin: 0; text-transform: uppercase; letter-spacing: .02em; }
#monthTotals, #monthView, #overview { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .big { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }

.stat ul { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.stat ul b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--display); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td small { color: var(--muted); font-size: 13px; }
.bikecell span, .bikecell small { display: block; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.tabgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tabgroup .year { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--muted); margin-right: 4px; font-variant-numeric: tabular-nums; }
.tab { font-family: var(--display); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; color: var(--ink); padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.tab.has-race::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--hyrox); margin-left: 6px; vertical-align: middle; }
.monthnote { margin: 0; padding: 10px 14px; border-left: 4px solid var(--hyrox); background: var(--hyrox-soft); border-radius: 8px; font-size: 14px; }
.day.maybe { border: 1px dashed var(--hyrox); }
.item.maybe { font-weight: 600; color: var(--hyrox); }
.tab:hover { border-color: var(--ink); }
.tab[aria-current] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--half); outline-offset: 2px; }
.day.out .items { opacity: .5; }
.rail .wk { font-weight: 600; }
.rail .gy { font-weight: 600; }
.empty { margin: 0; color: var(--muted); }

#monthView { gap: 24px; margin-top: 0; }
#overview[hidden], #monthView[hidden], #racesView[hidden], .logstatus[hidden] { display: none; }
#racesView { display: flex; flex-direction: column; gap: 16px; }
#racesView a { color: inherit; }
#racesView td small.pen { display: block; }
#racesView th, #racesView td { padding: 9px 8px; }
#racesView table { font-size: 13px; }
#racesView th { font-size: 13px; letter-spacing: .03em; }
#raceBars, #stationBars { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
#raceBars h3 { margin: 8px 0 2px; font-family: var(--display); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#raceBars h3:first-child { margin-top: 0; }
.racerow { display: grid; grid-template-columns: 170px minmax(0, 1fr) 100px; align-items: center; gap: 10px; font-size: 13px; }
.racerow .who { line-height: 1.25; }
.racerow .who small { display: block; color: var(--muted); }
.racerow .track { display: flex; gap: 2px; height: 22px; }
.racerow .seg { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: #0b0b0b; }
.racerow .seg.runs { background: var(--run); color: #fff; }
.racerow .seg.stations { background: var(--gym); }
.racerow .seg.rox { background: var(--am); border-radius: 0 4px 4px 0; }
.racerow .total { font-weight: 600; font-variant-numeric: tabular-nums; }
.racerow .track.empty { border: 1px dashed var(--line); border-radius: 0 4px 4px 0; }
.racerow.next .total { font-weight: 400; color: var(--muted); font-size: 12px; }
.racerow.goal .total { font-weight: 600; color: var(--ink); font-size: 13px; }
.racerow .total small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.racerow .seg.tgt { color: var(--ink); font-weight: 500; }
.racerow .seg.tgt.runs { background: color-mix(in srgb, var(--muted) 46%, var(--surface)); }
.racerow .seg.tgt.stations { background: color-mix(in srgb, var(--muted) 30%, var(--surface)); }
.racerow .seg.tgt.rox { background: color-mix(in srgb, var(--muted) 16%, var(--surface)); }
.racerow .total { white-space: nowrap; }
.racerow.station .pair { display: flex; flex-direction: column; gap: 2px; }
.racerow.station .track { height: 17px; }
.racerow.station .seg { justify-content: flex-start; padding-left: 8px; border-radius: 0 4px 4px 0; min-width: 46px; }
.st1 { background: color-mix(in srgb, var(--gym) 42%, var(--surface)); }
.st2 { background: color-mix(in srgb, var(--gym) 70%, var(--surface)); }
.st3 { background: var(--gym); }
.tg1, .legend .k.box.tg1 { background: color-mix(in srgb, var(--muted) 24%, var(--surface)); }
.tg2, .legend .k.box.tg2 { background: color-mix(in srgb, var(--muted) 50%, var(--surface)); }
.racerow.station .total { font-weight: 600; }
#stationBars { gap: 12px; }
tr.next td { color: var(--muted); }
.racerow.best .total::after { content: " PB"; font-size: 11px; color: var(--muted); }
.legend { margin: -6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .k { width: 18px; height: 0; border-top: 2.5px solid var(--muted); }
.legend .k.dash { border-top: 2px dashed var(--pred); }
.legend .k.colours { height: 2.5px; border: 0; background: linear-gradient(90deg, var(--run) 0 20%, var(--z2) 20% 40%, var(--swim) 40% 60%, var(--gym) 60% 80%, var(--am) 80%); }
.legend .k.faint.colours { height: 1.5px; }
.legend .k.box.colours { background: conic-gradient(var(--run) 0 25%, var(--z2) 0 50%, var(--swim) 0 75%, var(--am) 0); }
.legend .k.box.grey { background: var(--pred); }
.legend span[hidden] { display: none; }
.legend .k.faint { border-top-width: 1.5px; opacity: .4; }
.legend .k.box { width: 10px; height: 10px; border: 0; border-radius: 2px; background: var(--muted); }
.legend .k.box.light { opacity: .5; }
#overview { gap: 16px; margin-top: 0; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 8px; }
.chartcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chartcard h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chartcard h3 i { width: 14px; height: 3px; border-radius: 2px; }
.chartcard .big { font-family: var(--display); font-weight: 700; font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.chartcard .note { font-size: 13px; color: var(--muted); }
.plot { position: relative; margin-top: 6px; }
.plot svg { display: block; max-width: 100%; outline: none; touch-action: pan-y; }
.plot svg:focus-visible { outline: 2px solid var(--half); outline-offset: 2px; border-radius: 4px; }
.plot .ax { fill: var(--muted); font-size: 11px; font-family: var(--body); font-variant-numeric: tabular-nums; }
.plot .mk { fill: var(--muted); font-size: 10px; font-family: var(--body); }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .rule { stroke: var(--muted); stroke-width: 1; opacity: .45; }
.plot .band { fill: var(--muted); opacity: .16; }
.plot .hair { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 12px; line-height: 1.35; white-space: nowrap; box-shadow: 0 2px 8px rgb(0 0 0 / .12); }
.tip b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.tip span { display: block; color: var(--muted); }
.plot .predline { fill: none; stroke: var(--pred); stroke-width: 2; stroke-linejoin: round; stroke-dasharray: 5 4; }
.plot .predfill { fill: var(--pred); opacity: .12; }
.plot .predband { fill: var(--pred); opacity: .26; }
.plot .predbar { fill: var(--pred); }
.plot .predcap { fill: var(--pred); opacity: .3; }
.emptyplot { display: flex; align-items: center; min-height: 120px; color: var(--muted); font-size: 14px; }
tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
.tab.all { margin-right: 4px; }
.sechead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.modetoggle { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.modebtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.modebtn:hover { color: var(--ink); }
.modebtn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.modebtn[aria-pressed="true"]::before { content: ""; width: 9px; height: 5px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-2px) rotate(-45deg); }
.modebtn:focus-visible { outline: 2px solid var(--half); outline-offset: 2px; }

.logstatus { margin: -10px 0 0; font-size: 13px; color: var(--muted); }
button.chip { border: 0; background: none; font-family: inherit; cursor: pointer; padding: 0 5px 0 2px; margin-left: -2px; border-radius: 6px; }
button.chip:hover, .racebtn:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
button.chip:focus-visible, .racebtn:focus-visible, dialog button:focus-visible { outline: 2px solid var(--half); outline-offset: 1px; }
.chip.done { background: color-mix(in srgb, currentColor 18%, transparent); }
.chip .tick, .racebtn .tick { width: 12px; height: 12px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.chip.long .tick { stroke: #fff; }
.chip.long.done { background: var(--c); }
.chip.skip { position: relative; }
.chip.skip svg { opacity: .45; }
.chip.skip span { color: var(--muted); text-decoration: line-through; }
.chip.skip::before { content: ""; position: absolute; left: 1px; top: 50%; width: 22px; border-top: 1.5px solid var(--muted); transform: rotate(-35deg); }
.chip.due::after { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--hyrox); flex: none; }
.racebtn { display: block; width: 100%; text-align: left; border: 0; background: none; font-family: inherit; font-size: 13px; line-height: 1.3; cursor: pointer; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; }
.racebtn .tick { display: inline-block; margin-left: 5px; vertical-align: -1px; }
.badge { margin-left: auto; font-family: var(--body); font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.stat h3 { display: flex; align-items: center; gap: 8px; }
.day { cursor: pointer; }
.daybtn { display: inline-flex; align-items: baseline; gap: 6px; border: 0; background: none; padding: 0 2px; margin: 0 -2px; font: inherit; color: inherit; cursor: pointer; border-radius: 4px; }
.daybtn:focus-visible, .reviewbtn:focus-visible { outline: 2px solid var(--half); outline-offset: 1px; }
.chip .noteglyph, .racebtn .noteglyph { width: 11px; height: 11px; fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-linejoin: round; flex: none; }
.racebtn .noteglyph { display: inline-block; margin-left: 4px; vertical-align: -1px; }
.reviewbtn { font-family: var(--body); font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; min-height: 30px; cursor: pointer; }
.reviewbtn:hover { border-color: var(--ink); }

/* The sheet. A side panel on laptop and a bottom sheet on phone. */
#sheet { border: 0; padding: 0; margin: 0; max-width: none; max-height: none; background: var(--surface); color: var(--ink); font-family: var(--body); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 0 24px rgb(0 0 0 / .18); }
#sheet::backdrop { background: rgb(0 0 0 / .4); }
@media (min-width: 720px) {
  #sheet { inset: 0 0 0 auto; width: min(460px, 100vw); height: 100dvh; border-left: 1px solid var(--line); }
}
@media (max-width: 719.98px) {
  #sheet { inset: auto 0 0 0; width: 100%; max-height: 88dvh; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; }
}
.sheethead { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheethead h2 { font-size: 26px; outline: none; }
.sheetmeta { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; font-size: 13px; color: var(--muted); }
.sheetmeta .where { display: inline-flex; align-items: center; gap: 6px; }
.sheetmeta .flag { opacity: 1; }
.sheetbody { padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.btn { font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:focus-visible, #sheet input:focus-visible { outline: 2px solid var(--half); outline-offset: 1px; }
.btn[hidden] { display: none; }
.btn.close { flex: none; padding: 0; }
.btn.close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.daynotes { display: flex; flex-direction: column; gap: 6px; }
.daynote { margin: 0; font-size: 14px; padding: 8px 12px; border-radius: 8px; border-left: 4px solid var(--line); background: var(--bg); }
.daynote.race.hyrox, .daynote.maybe { border-color: var(--hyrox); background: var(--hyrox-soft); }
.daynote.race.half { border-color: var(--half); background: var(--half-soft); }
.entries { display: flex; flex-direction: column; gap: 10px; }
.entry { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.entrytop { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; }
.entryicon { color: var(--c); padding-top: 1px; }
.entryicon svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.entrytext h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.entrynote { margin: 2px 0 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.entryplan { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.entrystate { margin: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.entrystate.done { background: color-mix(in srgb, var(--c) 18%, transparent); border-color: transparent; }
.entrystate.skipped span { text-decoration: line-through; color: var(--muted); }
.entrystate.missed { color: var(--hyrox); border-color: currentColor; }
.entrystate.open { color: var(--muted); }
.entrystate .tick { width: 12px; height: 12px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.entryactions, .editactions { display: flex; flex-wrap: wrap; gap: 8px; }
.entryactions .btn { flex: 1 1 0; }
.editor { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.editlabel { margin: 0; font-size: 13px; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.presets .btn { flex: 1 1 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.editrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .btn.step { font-size: 20px; padding: 0; width: 44px; }
.stepper input, .notefield input { font: inherit; font-size: 16px; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.stepper input { width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.stepper input[aria-invalid="true"] { border-color: var(--hyrox); }
.stepper .unit { font-size: 14px; color: var(--muted); min-width: 24px; }
.notefield { display: flex; gap: 8px; }
.notefield input { flex: 1; min-width: 0; }
.addsec { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.addsec > h3, .reviewday > h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: .05em; }
.addpick { display: flex; flex-wrap: wrap; gap: 8px; }
.addbtn svg { width: 20px; height: 20px; fill: none; stroke: var(--c); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.addbtn[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.reviewtop { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.reviewtop p, .alldone { margin: 0; font-size: 14px; }
.reviewtop .hint { color: var(--muted); font-size: 13px; }
.reviewday { display: flex; flex-direction: column; gap: 10px; }
.alldone { font-weight: 600; }

@media (max-width: 720px) {
  h1 { font-size: 34px; }
  .dows { display: none; }
  .cal { gap: 20px; }
  .days { grid-template-columns: 1fr; gap: 4px; }
  .rail { padding: 0 2px; }
  .day { min-height: 0; flex-direction: row; align-items: baseline; gap: 12px; padding: 10px 12px; }
  .day.today { padding: 9px 11px; }
  .day .head { flex: 0 0 156px; }
  .day .dow { display: inline; width: 34px; }
  .day.today .head::after { display: none; }
  .day.today .num { text-decoration: underline; text-underline-offset: 4px; }
  .items { flex: 1; }
  .slots { flex-direction: row; flex-wrap: wrap; gap: 2px 14px; }
  .racerow { grid-template-columns: minmax(0, 1fr) 100px; }
  .racerow .who { grid-column: 1 / -1; }
  .modebtn { min-height: 44px; }
  #monthTable thead { display: none; }
  #monthTable, #monthTable tbody, #monthTable td { display: block; }
  #monthTable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  #monthTable td { padding: 0; border: 0; white-space: normal; }
  #monthTable td:first-child { grid-column: 1 / -1; font-weight: 600; }
  #monthTable td:empty { display: none; }
  #monthTable td[data-label]::before { content: attr(data-label); display: block; font-family: var(--display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  #monthTable tr.total { border-top: 2px solid var(--line); border-bottom: 0; }
  #monthTable tr:first-child td:first-child::after { content: " · done / planned"; font-weight: 400; color: var(--muted); }
}
