/* Look A: clean and light, like a training log, in the club's colours and layout (from Mit-FTT).
   Colours are tokens; dark mode swaps them in one place. */
:root {
  color-scheme: light;
  --tint: #246DB4;               /* club blue = action colour */
  --swim: #2F6DB5;               /* swim = blue, bike = yellow, run = red (club logo) */
  --bike: #F6C90E;
  --run: #D7263D;
  --other: #1AA7A0;               /* walks, hikes, skiing ... (teal: stays apart from red for colour-blind viewers) */
  --rest: #C7C7CC;               /* rest days and anything without a sport */
  --tri-stripe: linear-gradient(90deg, var(--swim) 0 33.33%, var(--bike) 33.33% 66.66%, var(--run) 66.66% 100%);
  --accent: var(--tint);
  --page: #F2F2F7;
  --surface: #FFFFFF;
  --ink: #111111;
  --ink2: #4D535A;
  --muted: #666C73;
  --grid: #E5E5EA;
  --axis: #C7C7CC;
  --ring: rgba(60, 60, 67, 0.14);
  --wash: rgba(60, 60, 67, 0.07);
  --seg-bg: rgba(118, 118, 128, 0.12);
  --good: #166A33;
  --bad: #A3151A;
  --z1: #86b6ef; --z2: #5598e7; --z3: #2a78d6; --z4: #1c5cab; --z5: #0d366b;
  --c-hr: #D7263D; --c-pace: #2F6DB5; --c-pow: #1E9E55; --c-cad: #E8A800; --c-ele: #6250D6;
  --ok-bg: rgba(52, 199, 89, 0.15); --ok-ink: #166A33;
  --warn-bg: #FFF1CC; --warn-ink: #7A5200;
  --danger-bg: #FDE7E8; --danger-ink: #A3151A;
  --tint-bg: #EAF2FB;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --tint: #4A9BE8; --accent: #4A9BE8; --other: #1FA39C; --rest: #636366;
    --page: #000000; --surface: #1C1C1E; --ink: #F5F5F7; --ink2: #A5AAB1; --muted: #959BA3;
    --grid: #2C2C2E; --axis: #48484A; --ring: rgba(235, 235, 245, 0.16); --wash: rgba(235, 235, 245, 0.08);
    --seg-bg: rgba(118, 118, 128, 0.24); --good: #6FE08F; --bad: #FF8A80;
    --z1: #184f95; --z2: #256abf; --z3: #3987e5; --z4: #6da7ec; --z5: #9ec5f4;
    --c-hr: #FF6B7A; --c-pace: #4A9BE8; --c-pow: #3DD17A; --c-cad: #F6C90E; --c-ele: #9085E9;
    --ok-bg: rgba(52, 199, 89, 0.2); --ok-ink: #6FE08F; --warn-bg: rgba(255, 204, 0, 0.18); --warn-ink: #FFD866;
    --danger-bg: rgba(255, 69, 58, 0.2); --danger-ink: #FF8A80; --tint-bg: rgba(74, 155, 232, 0.2);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --tint: #4A9BE8; --accent: #4A9BE8; --other: #1FA39C; --rest: #636366;
  --page: #000000; --surface: #1C1C1E; --ink: #F5F5F7; --ink2: #A5AAB1; --muted: #959BA3;
  --grid: #2C2C2E; --axis: #48484A; --ring: rgba(235, 235, 245, 0.16); --wash: rgba(235, 235, 245, 0.08);
  --seg-bg: rgba(118, 118, 128, 0.24); --good: #6FE08F; --bad: #FF8A80;
    --z1: #184f95; --z2: #256abf; --z3: #3987e5; --z4: #6da7ec; --z5: #9ec5f4;
    --c-hr: #FF6B7A; --c-pace: #4A9BE8; --c-pow: #3DD17A; --c-cad: #F6C90E; --c-ele: #9085E9;
    --ok-bg: rgba(52, 199, 89, 0.2); --ok-ink: #6FE08F; --warn-bg: rgba(255, 204, 0, 0.18); --warn-ink: #FFD866;
    --danger-bg: rgba(255, 69, 58, 0.2); --danger-ink: #FF8A80; --tint-bg: rgba(74, 155, 232, 0.2);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
}
main, .top-in { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
html { scroll-padding-top: 84px; }
main { padding-bottom: 48px; }
.tristripe { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: 5px; background: var(--tri-stripe); pointer-events: none; }
h1 { font-size: 36px; line-height: 1.1; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 36px 0 12px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 2px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); margin-bottom: 6px; }

.top { position: sticky; top: 0; z-index: 50; padding-top: 5px; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px); border-bottom: 1px solid var(--grid); margin-bottom: 18px; }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; flex: none; }
.brand img { width: 42px; height: 42px; flex: none; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text h1 { font-size: 18px; letter-spacing: -0.01em; }
.brand-text .muted { font-size: 12.5px; }
.top .tabs { margin: 0 auto; }
button { font: inherit; color: var(--ink); cursor: pointer; }
button:focus-visible, summary:focus-visible, .hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card {
  background: var(--surface); border-radius: 22px; padding: 20px;
  margin-bottom: 16px; min-width: 0;
}
.card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.empty { text-align: center; padding: 48px 18px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; padding: 24px; }
.hero-figure { font-size: 64px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; }
.hero-figure span { font-size: 18px; font-weight: 500; letter-spacing: 0; color: var(--ink2); }
.leg { margin-top: 12px; }
.leg-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 5px; }
.meter { height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 8px; }
.tile { margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.tile .label { font-size: 13px; color: var(--ink2); }
.tile .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.delta { font-size: 12.5px; margin-top: 4px; color: var(--ink2); }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.spark { margin-top: auto; padding-top: 10px; height: 46px; }
.spark svg { display: block; }

/* Filters and segmented buttons */
.filters { display: flex; align-items: center; gap: 10px; margin: 24px 0 0; }
.seg { display: inline-flex; background: var(--seg-bg); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { background: transparent; border: 0; border-radius: 8px; padding: 6px 12px; font-size: 13.5px; color: var(--ink2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }

/* Layout */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }

/* Charts */
.chart { margin-top: 10px; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font: 11.5px system-ui, -apple-system, sans-serif; fill: var(--muted); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; outline: none; }
.chart .hover { fill: var(--wash); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; color: var(--ink2); }
.legend i, .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.tip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 150px; max-width: 260px;
  background: var(--surface); color: var(--ink); border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 0 0 1px var(--ring), 0 6px 24px rgba(0, 0, 0, 0.14); font-size: 13px;
}
.tip[hidden] { display: none; }
.tip .t { color: var(--ink2); margin-bottom: 6px; }
.tip .r { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tip .r b { margin-left: auto; padding-left: 12px; font-weight: 650; }
.tip .r i { display: inline-block; width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tip .r span { color: var(--ink2); }

/* Tables */
.scroll { overflow-x: auto; }
.scroll.tall { max-height: 280px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.data th, table.data td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data thead th { font-size: 12px; font-weight: 500; color: var(--ink2); }
table.data tbody th { font-weight: 500; }
table.data tr.total th, table.data tr.total td { font-weight: 650; border-bottom: 0; }
table.data td.num { white-space: nowrap; }
.tv { margin-top: 8px; font-size: 13px; }
.tv summary { cursor: pointer; color: var(--ink2); }

/* Phone */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  .hide-s { display: none; }
  .weektable th, .weektable td { white-space: nowrap; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .hero-figure { font-size: 54px; }
  .card { padding: 16px; }
  h1 { font-size: 30px; }
  h2 { margin-top: 28px; }
}

/* ---------- Plan page ---------- */
.notice { background: var(--ok-bg); color: var(--ok-ink); border-radius: 12px; padding: 10px 14px; margin: 12px 0 0; font-weight: 500; }
code { background: var(--wash); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
button.primary, button.secondary { border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 600; margin-top: 10px; }
button.primary { background: var(--tint); color: #fff; }
button.secondary { background: var(--seg-bg); color: var(--ink); }
button.link { background: none; border: 0; padding: 4px 0; color: var(--tint); font-size: 13px; text-decoration: underline; }
.disclaimer { margin-top: 14px; }

.today-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "ready session" "facts session"; gap: 14px 28px; margin-top: 8px; align-items: start; }
.t-ready { grid-area: ready; } .t-session { grid-area: session; } .t-facts { grid-area: facts; }
.more-facts summary { display: none; cursor: pointer; color: var(--tint); font-size: 14px; font-weight: 600; padding: 4px 0; list-style: none; }
.more-facts summary::before { content: "▸ "; }
.more-facts[open] summary::before { content: "▾ "; }
.more-facts summary::-webkit-details-marker { display: none; }
.pop-note { margin: 0; padding: 8px 14px 6px; font-size: 12.5px; color: var(--ink2); }
#week { scroll-margin-top: 12px; }
#planview.loading .days, #planview.loading .weeknav-mid, #planview.loading .mv-grid, #calview.loading { opacity: 0.55; transition: opacity .15s; }
.card > h2:first-child { margin-top: 0; }
.badge { display: inline-block; border-radius: 999px; padding: 6px 14px; font-weight: 650; }
.badge.good, .chip.done { background: var(--ok-bg); color: var(--ok-ink); }
.badge.caution, .chip.partial { background: var(--warn-bg); color: var(--warn-ink); }
.badge.rest, .chip.missed { background: var(--danger-bg); color: var(--danger-ink); }
.reasons { margin: 10px 0 0; padding-left: 20px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 14px 0; }
.facts dt { font-size: 12.5px; color: var(--ink2); }
.facts dd { margin: 0; font-weight: 600; }
.session-title { font-weight: 650; font-size: 16px; margin: 2px 0; }
.session-title.struck { text-decoration: line-through; color: var(--ink2); }
.hint { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; margin-top: 10px; font-size: 14px; }


.phases { display: flex; gap: 4px; margin: 14px 0 6px; }
.phase { border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 108px; background: var(--tint-bg); }
.phase span { font-weight: 650; font-size: 13px; overflow-wrap: normal; }
.phase small { color: var(--ink2); }
.phase.build { background: color-mix(in srgb, var(--tint) 22%, var(--surface)); }
.phase.peak { background: color-mix(in srgb, var(--tint) 38%, var(--surface)); }
.phase.taper { background: var(--wash); }
.allweeks summary { cursor: pointer; list-style: none; }
.allweeks summary h3 { display: inline; }
.allweeks summary::before { content: "▸ "; }
.allweeks[open] summary::before { content: "▾ "; }
tr.is-today th, tr.is-today td { background: var(--tint-bg); }

.est-total { font-size: 48px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

/* ---------- Days as cards ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 15px; height: 15px; flex: none; }
.days { display: grid; gap: 10px; margin-top: 10px; }
.day { position: relative; display: grid; grid-template-columns: 64px 1fr 44px; gap: 14px; align-items: start;
  background: var(--surface); border-radius: 20px; padding: 14px 12px 14px 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 1px var(--ring); transition: box-shadow .18s, transform .18s; }
/* The card with an open menu must sit above the cards after it, or they cover the menu */
.day.menu-open, .day:has(.pop[open]) { z-index: 40; transform: none; }
.day.is-today { box-shadow: 0 0 0 2px var(--tint), 0 8px 26px color-mix(in srgb, var(--tint) 22%, transparent); }
.day.missed { opacity: 0.85; }

.datetile { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; padding: 8px 0; border-radius: 14px; background: var(--wash); }
.is-today .datetile { background: var(--tint); color: #fff; }
.dt-wd { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
.dt-num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0; }
.dt-mo { font-size: 11.5px; opacity: 0.8; }

.day-main { min-width: 0; padding-top: 2px; }
.rowbtn { display: block; width: 100%; padding: 0; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rowbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.session-title { font-weight: 650; font-size: 17px; letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
.session-title.quiet { color: var(--ink2); font-weight: 550; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill, .chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; background: var(--wash); color: var(--ink2); }
.pill .key { margin: 0; width: 9px; height: 9px; border-radius: 50%; }
.chip.today { background: var(--tint); color: #fff; }
.chip.extra { background: var(--tint-bg); color: var(--ink); }
.done-strip { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: var(--ok-bg); color: var(--ink); font-size: 13.5px; }
.done-strip .ico { color: var(--ok-ink); margin-top: 2px; }
.how { margin-top: 10px; font-size: 14.5px; line-height: 1.5; background: var(--wash); border-radius: 12px; padding: 10px 14px; animation: fade-in .2s ease; }

/* Day menu: hamburger button and dropdown (same pattern as Budgetark) */
.pop { position: relative; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.hamb { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.hamb:hover, .pop[open] > .hamb { background: var(--wash); }
.hamb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hamb span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink2); transition: transform .2s, opacity .2s; }
.pop[open] > .hamb span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.pop[open] > .hamb span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.pop[open] > .hamb span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.pop-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 270px; background: var(--surface);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--ring); overflow: hidden; padding: 6px; animation: pop-in .14s ease; transform-origin: top right; }
.pop-menu.up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.pop-menu { overflow-y: auto; overscroll-behavior: contain; }
.pop-menu form { margin: 0; }
.pop-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 10px; text-align: left; font: inherit; font-size: 14.5px; color: var(--ink); background: none; border: 0; cursor: pointer; white-space: nowrap; }
a.pop-item { text-decoration: none; box-sizing: border-box; }
.pop-item:hover, .pop-item:focus-visible { background: var(--wash); outline: none; }
.pop-item .ico { width: 18px; height: 18px; color: var(--ink2); }
.pop-item .key { width: 12px; height: 12px; border-radius: 50%; margin: 0 3px; }
.pop-divider { height: 1px; background: var(--grid); margin: 6px 4px; }

/* Dialogs */
dialog.dialog { border: 0; border-radius: 26px; padding: 24px; width: calc(100% - 32px); max-width: 460px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4); animation: dialog-in .22s cubic-bezier(.2, .9, .3, 1.1); }
dialog.dialog::backdrop { background: rgba(10, 14, 22, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in .2s ease; }
dialog.dialog form { display: grid; gap: 14px; min-width: 0; }
dialog.dialog form > *, dialog.dialog label { min-width: 0; }
dialog.dialog { overflow-x: hidden; }
dialog.dialog h3 { font-size: 20px; letter-spacing: -0.015em; }
dialog.dialog label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink2); }
dialog.dialog select, dialog.dialog input[type="number"] { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; font: inherit; color: var(--ink); background: var(--page); border: 1px solid transparent; border-radius: 12px; padding: 11px 12px; transition: border-color .15s, box-shadow .15s; }
dialog.dialog select:focus, dialog.dialog input:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 25%, transparent); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.dialog-actions button { margin-top: 0; flex: 0 1 auto; }

.change { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.change > div { background: var(--wash); border-radius: 16px; padding: 12px 14px; min-width: 0; }
.change > div.after { background: var(--tint-bg); box-shadow: inset 0 0 0 1.5px var(--tint); }
.change .lab { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink2); }
.change p { margin: 4px 0 0; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.change .arrow { display: flex; align-items: center; color: var(--ink2); background: none; padding: 0; }
.change .arrow .ico { width: 20px; height: 20px; }
.ripple { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ripple li { background: var(--wash); border-radius: 12px; padding: 9px 12px; font-size: 13.5px; }
.ripple b { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.weektotal { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--wash); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.weektotal strong { font-size: 15px; }
.confirm-error { background: var(--danger-bg); color: var(--danger-ink); border-radius: 14px; padding: 12px 14px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 900px) {
  .today-grid { grid-template-columns: 1fr; grid-template-areas: "ready" "session" "facts"; gap: 14px; }
}
@media (max-width: 640px) {
  .item { padding: 10px 8px 10px 16px; }
  .session-title { font-size: 16px; }
  .dt-num { font-size: 22px; }
  .change { grid-template-columns: 1fr; }
  .change .arrow { justify-content: center; transform: rotate(90deg); }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .phases { flex-wrap: wrap; }
  .phase { flex-basis: 40% !important; }
  .est-total { font-size: 40px; }
}

/* ---------- Editing days, browsing weeks ---------- */
.weeknav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 12px 0 14px; }
.weeknav-left { display: flex; gap: 8px; align-items: center; justify-self: start; }
.weeknav > .wk-next { justify-self: end; }
.btn.wk-prev, .btn.wk-next { min-width: 128px; justify-content: center; text-align: center; }
.weeknav-mid { text-align: center; min-width: 0; }
.btn.btn-accent { display: inline-flex; align-items: center; gap: 8px; background: var(--tint); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 12px color-mix(in srgb, var(--tint) 30%, transparent); }
.btn.btn-accent:hover { filter: brightness(1.08); }
.btn.btn-accent:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.btn.btn-accent .ico { width: 17px; height: 17px; }
.weeknav-label { font-weight: 650; font-size: 16px; }
.btn { display: inline-block; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 9px 14px; text-decoration: none; font-weight: 600; white-space: nowrap; box-shadow: 0 0 0 1px var(--ring); }
.btn.off { opacity: 0.35; }
a.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--tint); }
.mine { display: inline-block; background: var(--tint-bg); color: var(--tint); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.notice.error { background: var(--danger-bg); color: var(--danger-ink); }
@media (max-width: 640px) {
  .weeknav { grid-template-columns: 1fr 1fr; grid-template-areas: "mid mid" "prev next" "today today"; gap: 8px; }
  .weeknav-mid { grid-area: mid; margin-bottom: 4px; }
  .weeknav-left { display: contents; }
  .wk-prev { grid-area: prev; } .wk-next { grid-area: next; } .wk-today { grid-area: today; }
  .weeknav .btn { justify-content: center; text-align: center; }
}

/* ---------- Activity pages ---------- */
.done-strip { text-decoration: none; color: var(--ink); }
.done-strip:hover { background: color-mix(in srgb, var(--ok-bg) 70%, var(--ok-ink) 12%); }
.done-strip > span:nth-child(2) { flex: 1; min-width: 0; }
.go { margin-left: auto; color: var(--tint); font-weight: 600; white-space: nowrap; }
.backlink { margin: 14px 0 0; }
.backlink a { text-decoration: none; font-weight: 600; }
.act-hero { position: relative; margin-top: 10px; padding-left: 28px; }
.act-hero::before { content: ""; position: absolute; left: 11px; top: 20px; bottom: 20px; width: 4px; border-radius: 4px; background: var(--day-accent); }
.act-title { margin: 2px 0 4px; font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; }
.eyebrow .key { margin-right: 6px; vertical-align: 0; }
.plannedbox { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 9px 12px; border-radius: 12px; background: var(--tint-bg); font-size: 14px; }
.plannedbox .ico { margin-top: 3px; color: var(--tint); }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.statgrid .tile { margin: 0; }
.curves { margin-bottom: 16px; }
.curves .grid2 { margin-top: 12px; }
.zonebar { display: flex; gap: 3px; height: 14px; margin: 14px 0 12px; }
.zonebar i { border-radius: 7px; min-width: 6px; }
.zonelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.zonelist li { display: grid; grid-template-columns: 14px 1fr auto 46px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.zonelist li:last-child { border-bottom: 0; }
.zonelist li i { width: 12px; height: 12px; border-radius: 4px; }
.zonelist li .muted { text-align: right; }
.neighbours { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 0; }
.neighbours .btn { line-height: 1.35; }

.filterchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; box-shadow: 0 0 0 1px var(--ring); }
.fchip .key { margin: 0; width: 10px; height: 10px; border-radius: 50%; }
.fchip.on { background: var(--ink); color: var(--surface); box-shadow: none; }
.fchip.on .muted { color: inherit; opacity: 0.7; }
.monthfold { margin-top: 14px; }
.monthhead { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 2px; font-size: 15px; font-weight: 700; cursor: pointer; list-style: none; border-bottom: 1px solid var(--grid); }
.monthhead:hover { color: var(--tint); }
.monthhead::-webkit-details-marker { display: none; }
.monthhead > span:first-of-type { text-transform: capitalize; }
.monthhead svg { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform .15s; flex: none; }
.monthfold[open] > .monthhead svg { transform: none; }
.alist { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.alist { display: grid; gap: 8px; }
/* Activity list: one card per day, the activities inside it */
.aday { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: start; padding: 12px 12px 12px 14px; background: var(--surface); border-radius: 20px; box-shadow: 0 0 0 1px var(--ring); }
.aday .datetile { margin-top: 2px; }
.aday-items { display: grid; min-width: 0; }
.aitem { position: relative; display: grid; grid-template-columns: 1fr 14px; grid-template-areas: "main go" "side go"; gap: 2px 14px; align-items: center; padding: 10px 6px 10px 18px; border-radius: 12px; text-decoration: none; color: var(--ink); transition: background .15s; }
.aitem + .aitem { border-top: 1px solid var(--grid); border-radius: 0 0 12px 12px; }
.aitem::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--day-accent); }
.aitem:hover { background: var(--wash); }
.aitem:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.arow-main { display: grid; min-width: 0; }
.arow-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow-side { text-align: left; white-space: nowrap; }
.arow-side:empty { display: none; }
.small-tile { padding: 6px 0; }
.small-tile .dt-num { font-size: 20px; }
@media (max-width: 900px) { .statgrid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .statgrid { grid-template-columns: 1fr 1fr; }
  .act-title { font-size: 24px; }
  .aday { grid-template-columns: 46px 1fr; gap: 10px; }
  .aitem { grid-template-columns: 1fr 14px; }
  .arow-side { display: none; }
  .neighbours { flex-direction: column; }
}

/* The page tabs: a rounded bar, the current tab is the white one, with room down to the content */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 14px; background: var(--seg-bg); }
.tabs a { color: var(--ink2); text-decoration: none; padding: 8px 16px; border-radius: 11px; font-weight: 550; transition: background .15s, color .15s; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 640px) {
  .tabs { display: flex; width: 100%; }
  .tabs a { flex: 1; text-align: center; padding: 8px 6px; font-size: 14px; }
}

/* In dark mode the chosen tab or segment must be lighter than the bar it sits in */
html[data-theme="dark"] .tabs a[aria-current="page"],
html[data-theme="dark"] .seg button[aria-pressed="true"] { background: #48484A; color: #F5F5F7; box-shadow: none; }

/* ---------- Header: theme switch and the update menu ---------- */
.top-actions { display: flex; align-items: center; gap: 10px; }
.themebtn, .iconbtn { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--seg-bg); color: var(--ink); cursor: pointer; transition: background .15s, transform .15s; }
.themebtn:hover, .iconbtn:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); }
.themebtn:active, .iconbtn:active { transform: scale(0.94); }
.themebtn:focus-visible, .iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.themebtn .ico { grid-area: 1 / 1; width: 20px; height: 20px; display: none; }
html[data-theme-pref="light"] .themebtn .i-light, html[data-theme-pref="dark"] .themebtn .i-dark, html[data-theme-pref="system"] .themebtn .i-system { display: block; }
.pop-item.two { display: flex; align-items: center; gap: 12px; padding: 10px 14px; white-space: normal; }
.pop-item.two > span { display: grid; gap: 1px; }
.pop-item.two small { color: var(--ink2); font-size: 12.5px; }
.pop-item.two .ico { width: 20px; height: 20px; color: var(--tint); }

/* The update dialog */
.consequences { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14.5px; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.steps li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 14.5px; }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: "○"; color: var(--muted); }
.steps li[data-state="now"]::before { content: "●"; color: var(--tint); animation: blink 1s ease-in-out infinite; }
.steps li[data-state="done"]::before { content: "✓"; color: var(--good); font-weight: 700; }
.steps li[data-state="error"]::before { content: "✕"; color: var(--bad); font-weight: 700; }
.steps li[data-state="now"] .s-name { font-weight: 650; }
.bar { height: 10px; border-radius: 6px; background: var(--wash); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--tint); transition: width .3s ease; }
@keyframes blink { 50% { opacity: 0.35; } }


/* A training inside a day card */
.day-main { display: grid; gap: 10px; align-content: start; }
.item { position: relative; padding: 10px 12px 10px 18px; border-radius: 14px; background: var(--wash); transition: box-shadow .15s, background .15s, opacity .15s; }
.item::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--item-accent, var(--rest)); }
.item[data-how] { cursor: pointer; }
.item[data-how]:hover { box-shadow: 0 0 0 1px var(--ring), 0 4px 14px rgba(0, 0, 0, 0.08); }
.item.extra { background: color-mix(in srgb, var(--tint-bg) 55%, transparent); }
.item.missed { opacity: 0.85; }
.item-head { display: flex; align-items: flex-start; gap: 8px; }
.item-head .rowbtn { flex: 1; min-width: 0; }
.item .pills { margin-top: 6px; }
.item .done-strip { background: var(--ok-bg); }
.itembtn { display: grid; place-items: center; flex: none; width: 32px; height: 32px; margin: -4px -4px 0 0; border: 0; border-radius: 10px; background: transparent; color: var(--ink2); cursor: pointer; }
.itembtn:hover, .itembtn:focus-visible { background: var(--surface); color: var(--ink); outline: none; box-shadow: 0 0 0 1px var(--ring); }
.itembtn .ico { width: 17px; height: 17px; }
.itembtn.grip { touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.itembtn.grip:active { cursor: grabbing; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 2000; pointer-events: none; max-width: 78vw; padding: 10px 14px; border-radius: 14px; background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28), 0 0 0 2px var(--tint); }
.drag-ghost small { display: block; font-weight: 500; color: var(--ink2); font-size: 12px; }
.today-item { position: relative; padding-left: 16px; margin-bottom: 14px; }
.today-item::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 4px; background: var(--item-accent, var(--rest)); }

/* The (i) help tip, like in Budgetark */
.heading-row { display: flex; align-items: center; gap: 10px; margin: 36px 0 12px; }
.heading-row h2 { margin: 0; }
.help-btn { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--axis); background: var(--surface); color: var(--ink2); font-weight: 700; font-size: 13px; font-style: normal; cursor: pointer; list-style: none; transition: background .15s, color .15s, border-color .15s; }
.help-btn::-webkit-details-marker { display: none; }
.help-btn:hover, .helptip[open] > .help-btn { background: var(--tint); border-color: var(--tint); color: #fff; }
.help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pop-menu.help-pop { left: 0; right: auto; min-width: 280px; width: max-content; max-width: min(380px, calc(100vw - 32px)); padding: 14px 16px; border-top: 2px solid var(--tint); }
.help-pop .help-title { font-weight: 650; margin-bottom: 8px; }
.help-pop ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; font-size: 14px; line-height: 1.5; }

/* Drag and drop of sessions */
.item[draggable="true"] { cursor: grab; }
.item.dragging { opacity: 0.45; transform: scale(0.99); }
.day.drop-ok { box-shadow: 0 0 0 2px var(--tint), 0 10px 30px color-mix(in srgb, var(--tint) 25%, transparent); background: var(--tint-bg); }
.day.drop-ok::after { content: "Slip her"; position: absolute; right: 64px; top: 50%; transform: translateY(-50%); font-weight: 700; font-size: 13px; color: var(--tint); }
.change-pair { display: grid; gap: 8px; margin-top: 6px; }
.change-pair .session-title { font-size: 15px; }
.weektotals { display: grid; gap: 6px; margin-top: 14px; }
.weektotals .weektotal { margin: 0; }
.weektotal span:first-child { color: var(--ink2); font-size: 13.5px; }

/* Route map */
.routemap { height: 380px; border-radius: 16px; overflow: hidden; margin: 12px 0 10px; background: var(--wash); z-index: 0; }
[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9); }
.leaflet-container { font: inherit; }
@media (max-width: 640px) { .routemap { height: 300px; } }

/* A day is a card: the date and its menu in a row on top, the trainings below. Used at every width. */
.day { grid-template-columns: 1fr auto; grid-template-areas: "tile menu" "main main"; gap: 8px 8px; padding: 12px 12px 12px 14px; align-items: center; }
.day .datetile { grid-area: tile; flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 8px; padding: 0; background: none; justify-self: start; }
.day .datetile .dt-wd { font-size: 12px; }
.day .datetile .dt-num { font-size: 20px; margin: 0; }
.day .datetile .dt-mo { font-size: 13px; opacity: 0.7; }
.day.is-today .datetile { background: var(--tint); color: #fff; padding: 3px 12px; border-radius: 999px; }
.day .day-main { grid-area: main; }
.day > .pop { grid-area: menu; justify-self: end; align-self: center; }
.day .hamb { width: 36px; height: 36px; }
.days { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 641px) { .days { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .days { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.day { align-content: start; }
.day .item .pills { margin-top: 6px; }
.day .done-strip { font-size: 13px; padding: 7px 10px; }

/* "Ugen i tal": the eighth card in the week grid */
.weeksum { display: grid; gap: 12px; align-content: start; padding: 16px 16px 18px; border-radius: 20px; background: color-mix(in srgb, var(--tint-bg) 55%, var(--surface)); box-shadow: 0 0 0 1px var(--ring); }
.weeksum h3 { margin: 0; font-size: 16px; }
.ws-row { display: grid; gap: 5px; }
.ws-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.ws-head .key { margin-right: 7px; }
.ws-total { margin-top: 2px; padding-top: 12px; border-top: 1px solid var(--grid); }

/* Phone rules that must come last, after the base rules they adjust */
@media (max-width: 640px) {
  .heading-row { position: relative; }
  .helptip { position: static; }
  .pop-menu.help-pop { left: 0; right: 0; width: auto; min-width: 0; max-width: none; }
  .item { padding: 10px 6px 10px 16px; }
  .pills { gap: 5px; }
  .pill, .chip { padding: 3px 8px; font-size: 12px; gap: 4px; }
  .pill-sport { display: none; } /* the title and the coloured edge already show the sport */
  /* A slim top: the week should not start a whole screen down */
  html { scroll-padding-top: 118px; }
  .top { margin-bottom: 12px; }
  .top-in { flex-wrap: wrap; gap: 6px 10px; min-height: 0; padding-top: 6px; padding-bottom: 8px; }
  .brand { flex: 1; min-width: 0; }
  .brand img { width: 34px; height: 34px; }
  .brand-text h1 { font-size: 17px; }
  .brand-text .muted { display: none; }
  .top .tabs { order: 3; flex-basis: 100%; margin: 0; }
  .themebtn { width: 38px; height: 38px; }
  .heading-row { margin-top: 22px; }
  .more-facts summary { display: block; }
  .more-facts[open] summary { margin-bottom: 4px; }
  .today-grid .facts { margin-top: 6px; }
  .card { padding: 14px; }
  .t-ready .badge { font-size: 14px; padding: 5px 12px; }
  .weeknav .wk-prev, .weeknav .wk-next, .weeknav .wk-today { justify-self: stretch; min-width: 0; display: flex; align-items: center; justify-content: center; }
}

/* ---------- View switch (Uge | Måned, Liste | Måned) ---------- */
.heading-row .viewseg { margin-left: auto; }
.seg a { padding: 6px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink2); text-decoration: none; }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
html[data-theme="dark"] .seg a[aria-current="true"] { background: #48484A; color: #F5F5F7; box-shadow: none; }
.seg a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Month view (same idea as Mit-FTT): week numbers, a tile per day, a dot per training ---------- */
.mv { padding: 16px 18px 18px; }
.mv-head { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.mv-head strong { flex: 1; letter-spacing: -0.01em; }
.mv-right { display: flex; align-items: center; gap: 6px; }
.mv-today-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--tint-bg); color: var(--tint); font-size: 14px; font-weight: 600; text-decoration: none; }
.cal-nav { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--wash); color: var(--ink2); text-decoration: none; transition: background .15s; }
a.cal-nav:hover { background: var(--seg-bg); color: var(--ink); }
.cal-nav .ico { width: 18px; height: 18px; }
.cal-nav.off { opacity: 0.25; }
.mv-summary { margin: 4px 0 14px; }
.mv-grid { display: grid; grid-template-columns: 26px repeat(7, 1fr); gap: 4px; }
.mv-wn { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); text-decoration: none; }
a.mv-wn:hover { color: var(--tint); }
.mv-wd { display: flex; align-items: center; justify-content: center; height: 24px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mv-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; min-height: 64px; padding: 6px 0; border: 0; border-radius: 12px; background: var(--wash); font: inherit; color: var(--ink); cursor: pointer; transition: filter .15s, box-shadow .15s; }
.mv-day b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mv-day.has b { font-weight: 800; }
.mv-day:not(.has) { background: color-mix(in srgb, var(--wash) 55%, transparent); }
.mv-day:not(.has) b { color: var(--muted); }
.mv-day:hover { filter: brightness(0.96); }
.mv-day.out { visibility: hidden; }
.mv-day.past { opacity: 0.7; }
.mv-day.today b { box-shadow: inset 0 0 0 2px var(--tint); color: var(--tint); }
.mv-day.on { box-shadow: inset 0 0 0 2px var(--tint); }
.mv-day.on b { background: var(--tint); color: #fff; box-shadow: none; }
.mv-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mv-dots { display: flex; align-items: center; justify-content: center; gap: 3px; min-height: 9px; flex-wrap: wrap; }
.mv-dots small { font-size: 11px; font-weight: 700; line-height: 1; color: var(--ink2); }
.mv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px var(--surface); }
.mv-dot.upcoming, .mv-dot.today, .mv-dot.missed { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.mv-dot.partial { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); box-shadow: inset 0 0 0 2px var(--c); }
.mv-dot.missed { opacity: 0.55; }
.mv-legend { display: flex; gap: 16px; list-style: none; margin: 12px 0 0; padding: 0; }
.mv-legend li { display: flex; align-items: center; gap: 6px; }
.mv-selected { margin-top: 16px; display: grid; gap: 10px; }
.mv-detail { display: grid; gap: 10px; }
.mv-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 650; }
.mv-open { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--tint); }
.mv-item { margin: 0; }
.mv-item .session-title { margin: 0; }
.mv-item .done-strip { margin-top: 8px; }
/* Wide screens: a compact calendar on the left and the pressed day beside it, instead of one huge grid */
@media (min-width: 900px) {
  .mv { display: grid; grid-template-columns: minmax(380px, 440px) minmax(0, 1fr); column-gap: 36px; align-items: start;
    grid-template-areas: "head sel" "sum sel" "grid sel" "legend sel"; grid-template-rows: auto auto auto 1fr; }
  .mv-head { grid-area: head; }
  .mv-summary { grid-area: sum; }
  .mv-grid { grid-area: grid; }
  .mv-legend { grid-area: legend; }
  .mv-selected { grid-area: sel; margin-top: 0; align-self: stretch; align-content: start; padding: 20px 22px; border-radius: 18px; background: color-mix(in srgb, var(--wash) 70%, transparent); min-height: 260px; }
  .mv-day { min-height: 54px; padding: 5px 0; }
  .mv-hint { text-align: center; margin-top: 60px; }
}
@media (min-width: 641px) and (max-width: 899px) { .mv-grid { max-width: 540px; } }
@media (max-width: 640px) {
  .mv { padding: 12px 10px 14px; }
  .mv-grid { gap: 3px; grid-template-columns: 22px repeat(7, 1fr); }
  .mv-day { min-height: 52px; padding: 4px 0; border-radius: 10px; }
  .mv-day b { width: 26px; height: 26px; font-size: 14px; }
  .mv-dot { width: 8px; height: 8px; }
  .mv-head { font-size: 17px; }
}

/* The coloured edge on the activity heading needs its room on every screen size, also where .card gets less padding */
.card.act-hero { padding-left: 28px; }
@media (max-width: 640px) { .card.act-hero { padding: 14px 14px 14px 28px; } }
@media (forced-colors: active) {
  .meter i, .legend i, .key { forced-color-adjust: none; }
}

.more-months { margin: 16px 0 0; text-align: center; }

.aitem .arow-main { grid-area: main; }
.aitem .arow-side { grid-area: side; }
.aitem .go { grid-area: go; }

.basis { display: grid; gap: 0; margin: 10px 0 0; }
.basis > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--grid); }
.basis dt { color: var(--muted); font-size: 13px; }
.basis dd { margin: 0; display: grid; gap: 2px; }
@media (max-width: 640px) { .basis > div { grid-template-columns: 1fr; gap: 2px; } }

/* Helbred og form */
.grid3 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.grid3 > .card { margin: 0; }
.health .grid2 { margin-bottom: 16px; }
.bigval { margin: 4px 0 2px; font-size: 30px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.bigval small { font-size: 13px; font-weight: 500; color: var(--ink2); letter-spacing: 0; }
.facts { margin: 12px 0 0; display: grid; grid-template-columns: 1fr; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--grid); font-size: 14px; }
.facts dt { color: var(--ink2); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.facts dt { flex: none; }
.bar { height: 8px; border-radius: 8px; background: var(--grid); overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--tint); border-radius: 8px; }
@media (max-width: 640px) { .grid3 { grid-template-columns: 1fr; } }

/* ---------- Coach: marked sessions and the coach's card ---------- */
.adj { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 650; vertical-align: 1px; white-space: nowrap; }
.adj-down { background: var(--warn-bg); color: var(--warn-ink); }
.adj-up { background: var(--ok-bg); color: var(--ok-ink); }
.adj-back { background: var(--tint-bg); color: var(--tint); }
.adj-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; border-left: 4px solid currentColor; }
.adj-note-down { background: var(--warn-bg); color: var(--warn-ink); }
.adj-note-up { background: var(--ok-bg); color: var(--ok-ink); }
.adj-note .muted { color: inherit; opacity: 0.8; }
.coach-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.coach-head h2 { margin: 0; }
.coach-headline { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin: 8px 0 4px; }
.coach-changes { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.adjrow { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 14px; background: var(--wash); }
.adjrow .adj { justify-self: start; text-align: center; }
.adjrow p { margin: 0; }
.adj-day { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chg { margin: 2px 0 4px; }
.coach-more { margin-top: 12px; }
.coach-more summary { cursor: pointer; color: var(--tint); font-size: 14px; font-weight: 600; padding: 4px 0; }
.coach-rules { margin: 8px 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.5; }
@media (max-width: 600px) { .adjrow { grid-template-columns: 1fr; gap: 6px; } }
.iconbtn .ico { width: 20px; height: 20px; }
.iconbtn.spin .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.coach-refresh { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 2px; }
.coach-refresh button { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Tell the coach ---------- */
.inp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 12px; }
.inp-block { min-width: 0; padding: 14px; border-radius: 16px; background: var(--wash); }
.inp-block h3 { margin: 0 0 8px; font-size: 16px; }
.inp-form { display: grid; gap: 10px; }
.inp-form label { display: grid; gap: 4px; font-size: 13px; color: var(--ink2); }
.inp-form input[type="text"], .inp-form input[type="date"], .inp-form input[type="number"], .inp-form input[type="tel"], .inp-form select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--ring); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.inp-form input:focus, .inp-form select:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 25%, transparent); }
.feelrow { display: flex; flex-wrap: wrap; gap: 6px; }
.feelchip { display: inline-flex !important; }
.feelchip input { position: absolute; opacity: 0; pointer-events: none; }
.feelchip span { display: inline-block; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--ring); font-weight: 600; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.feelchip input:checked + span { background: var(--tint); border-color: var(--tint); color: #fff; }
.feelchip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.datepair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.eventlist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.eventlist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); }
.eventlist form { margin: 0; }
button.small { padding: 5px 10px; font-size: 12.5px; }
.drift { margin: 10px 0; }
.drift p { margin: 0 0 8px; }
@media (max-width: 900px) { .inp-grid { grid-template-columns: 1fr; } }
.autobanner { margin: 12px 0 0; }
.inp-form [hidden] { display: none !important; }
.done-strip .rate { display: flex; align-items: center; gap: 10px; margin-top: 5px; color: var(--ink2); }
.rate-face, .rate-bars { width: 20px; height: 20px; flex: none; }
.rate-face { color: var(--tint); }
.rate-face .face-bg { fill: var(--surface); stroke: var(--tint); stroke-width: 1.4; }
.rate-bars { width: 22px; }

/* ---------- Tabs on the plan page ---------- */
.subtabs { display: flex; width: 100%; margin: 14px 0 12px; }
.subtabs a { flex: 1; text-align: center; padding: 9px 10px; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tabbadge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; font-weight: 700; }
.coachstrip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 0; padding: 6px 8px 6px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-left: 4px solid var(--tint); }
.coachstrip.tone-down { border-left-color: var(--warn-ink); }
.coachstrip.tone-up { border-left-color: var(--ok-ink); }
.coachstrip p { margin: 0; font-size: 14.5px; flex: 1; min-width: 0; padding: 4px 0; }
.coachstrip .pop { flex: none; }
.coachstrip a.pop-item { text-decoration: none; }

/* Keep room for the scrollbar on every page, so a short page and a long page line up (no sideways jump when switching tabs) */
html { scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }

/* ---------- Activity page: your rating ---------- */
.rating-row { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 12px 0 8px; }
.rating-item { display: flex; align-items: center; gap: 12px; }
.rating-item svg { width: 44px; height: 44px; flex: none; }
.rating-item svg.rate-bars { width: 48px; }
.rating-item .label { margin: 0; font-size: 13px; color: var(--ink2); }
.rating-item .value { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.rating-item p.small { margin: 0; }
.rating-item.plain { padding-left: 0; }
.plannedbox + .adj-note { margin-top: 8px; }

/* ---------- Workout text for the watch ---------- */
.how p { margin: 0; }
.watchtext { margin-top: 10px; }
.watchtext summary { cursor: pointer; color: var(--tint); font-size: 13.5px; font-weight: 600; }
.watchtext pre { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.card .scroll + h3 { margin-top: 20px; }
.ftp-now { font-size: 22px; letter-spacing: -0.01em; }
.ftp-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.ftp-form label { max-width: 240px; }

/* ---------- Login page ---------- */
.loginbox { max-width: 420px; margin: 12vh auto 0; padding: 0 16px; }
.loginbox .card { display: grid; gap: 10px; justify-items: start; }
.loginbox h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.loginbox .inp-form { width: 100%; }
.loginbox .inp-form input { font-size: 18px; }
.loginlink { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 14px; }

/* ---- Formularer på Indstillinger og Brugere (samme udtryk som Mit FTT: store felter, iOS-kontakter) ---- */
.sf { display: grid; gap: 16px; margin-top: 14px; }
.sf .field > label, .sf .field > .fl { display: block; margin: 0 0 6px 4px; font-size: 14px; font-weight: 600; }
.sf .input { display: block; width: 100%; box-sizing: border-box; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--ring); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; -webkit-appearance: none; appearance: none; }
.sf .input:focus { outline: none; border-color: var(--tint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 22%, transparent); }
.sf select.input { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.sf .note { margin: 6px 4px 0; font-size: 13px; color: var(--ink2); }
.sf .cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .sf .cols3 { grid-template-columns: minmax(0, 1fr); } }
.sf .btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 170px)); gap: 10px; }
.sf .btns button { margin-top: 0; min-height: 46px; padding: 0 12px; font-size: 15px; width: 100%; }
.sf button.danger { background: transparent; color: var(--bad, #C0362C); box-shadow: inset 0 0 0 1.5px currentColor; }
.keystate { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 0; font-weight: 600; font-size: 14px; }
.keystate::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rest, #8E8E93); }
.keystate.ok::before { background: #2E9E5B; }
.sw-list { border-radius: 14px; background: var(--wash); overflow: hidden; }
.sw-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; }
.sw-row + .sw-row { border-top: 1px solid var(--ring); }
.sw-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sw-text strong { font-size: 15px; font-weight: 600; }
.sw-text small { font-size: 13px; color: var(--ink2); }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: rgba(120, 120, 128, .32); transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + i { background: var(--tint); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.ulist { list-style: none; margin: 12px 0 0; padding: 0; border-radius: 14px; background: var(--wash); }
.ulist li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.ulist li + li { border-top: 1px solid var(--ring); }
.ulist .u-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ulist .u-main small { font-size: 13px; color: var(--ink2); }
.ulist form { margin: 0; }
.ulist button { margin-top: 0; padding: 8px 14px; font-size: 14px; }
.tagpill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--wash); font-size: 12px; font-weight: 600; color: var(--ink2); vertical-align: 1px; }
.pop-item.danger, .pop-item.danger .ico { color: var(--bad, #C0362C); }
button.primary.danger-fill { background: var(--bad, #C0362C); }
.ulist .pop-menu { min-width: 240px; }
dialog.dialog .sf { margin-top: 0; }
dialog.dialog .sf label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }

/* ---- Hovedmenuen øverst til højre ---- */
.menubtn { width: 42px; height: 42px; border-radius: 12px; background: var(--seg-bg); }
.menubtn:hover, .mainmenu[open] > .menubtn { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); }
.mainmenu .pop-menu { min-width: 290px; max-width: calc(100vw - 24px); }
.pop-item .grow { flex: 1; }
.pop-item[aria-current="page"] { font-weight: 650; background: var(--wash); }
details.sub > summary { list-style: none; }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary .ico:last-child { width: 16px; height: 16px; transition: transform .2s; }
details.sub[open] > summary .ico:last-child { transform: rotate(180deg); }
details.sub[open] > summary { background: var(--wash); }
.sub-body { margin: 4px 0 6px 14px; padding-left: 10px; border-left: 2px solid var(--grid); }
.sub-body .pop-note { padding-left: 4px; }
.testres { margin: 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.testres.ok { background: color-mix(in srgb, #2E9E5B 16%, transparent); color: #1F7A44; }
.testres.bad { background: var(--danger-bg); color: var(--danger-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .testres.ok { color: #6FD39A; } }
:root[data-theme="dark"] .testres.ok { color: #6FD39A; }

/* ---- Træningsugen på Indstillinger ---- */
.weekgrid { display: grid; gap: 10px; }
.wd { border-radius: 14px; background: var(--wash); padding: 12px 14px; display: grid; gap: 12px; }
.wd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg3 { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--seg-bg); gap: 2px; }
.seg3 label { position: relative; margin: 0; }
.seg3 input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; width: 100%; height: 100%; }
.seg3 span { display: block; padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink2); }
.seg3 input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); }
.seg3 input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.wd .wd-open, .wd .wd-fixed { display: none; }
.wd[data-mode="open"] .wd-open, .wd[data-mode="fixed"] .wd-fixed { display: grid; }
.wd[data-mode="off"] .wd-head strong { color: var(--ink2); }
.wd .field.wide { grid-column: 1 / -1; }
.wd .input { background: var(--surface); }
.minor { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.minor li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.minor .tagpill { margin-left: 0; }
.sf .tgroup { display: none; }   /* more specific than .sf .cols3, so a group that is not chosen stays hidden */
.sf[data-type="run"] .tgroup[data-type="run"], .sf[data-type="bike"] .tgroup[data-type="bike"] { display: block; }
.sf[data-type="tri"] .tgroup[data-type="tri"], .sf[data-type="du"] .tgroup[data-type="du"] { display: grid; }
.sf .runonly { display: none; }
.sf[data-type="run"] .runonly { display: block; }
.typesel { display: flex; width: 100%; }
.typesel label { flex: 1; }
.typesel span { text-align: center; }

/* ---- Dropdowns (select.js) and the question dialog (confirm.js) ---- */
.dd { position: relative; min-width: 0; }
.dd-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dd-btn { display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 12px 0 14px; border-radius: 12px; border: 1.5px solid var(--ring); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sf .dd-btn.input { display: flex; min-height: 48px; padding: 0 12px 0 14px; }
.dd-btn:disabled { opacity: .5; cursor: default; }
.dd-btn:focus-visible, .dd-btn[aria-expanded="true"] { outline: none; border-color: var(--tint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 22%, transparent); }
.dd-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn .ico, .dd-opt .ico { width: 18px; height: 18px; flex: none; color: var(--ink2); }
.dd-btn .dd-chev { width: 16px; height: 16px; transition: transform .2s; }
.dd-btn[aria-expanded="true"] .dd-chev { transform: rotate(180deg); }
dialog.dialog .dd-btn { background: var(--page); border: 1px solid transparent; font-size: 14.5px; min-height: 42px; border-radius: 12px; }
dialog.dialog .dd-btn:focus-visible, dialog.dialog .dd-btn[aria-expanded="true"] { border-color: var(--tint); }
.dd-list { position: fixed; z-index: 1000; margin: 0; padding: 6px; box-sizing: border-box; background: var(--surface); border-radius: 16px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--ring); overflow-y: auto; overscroll-behavior: contain; animation: pop-in .14s ease; font-size: 14.5px; }
.dd-list[hidden] { display: none; }
.dd-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--ink); font-weight: 450; }
.dd-opt.act { background: var(--wash); }
.dd-opt[aria-selected="true"] { font-weight: 650; }
.dd-opt[aria-disabled="true"] { opacity: .4; cursor: default; }
.dd-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.dd-desc { font-size: 12.5px; font-weight: 400; color: var(--ink2); }
.dd-check { width: 16px; height: 16px; color: var(--tint) !important; visibility: hidden; }
.dd-opt[aria-selected="true"] .dd-check { visibility: visible; }
.dd-group { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink2); }
.dd-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; margin: 0 3px; }
.dd-btn .dd-dot { margin: 0 2px; }
dialog.confirm-ui { max-width: 400px; }
.confirm-ui .cu-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint); }
.confirm-ui .cu-icon .ico { width: 24px; height: 24px; }
.confirm-ui.danger .cu-icon { background: var(--danger-bg); color: var(--danger-ink); }
.confirm-ui h3 { margin: 4px 0 0; }
.confirm-ui p { margin: 0; color: var(--ink2); line-height: 1.45; }
.confirm-ui .dialog-actions { margin-top: 10px; }
.confirm-ui .dialog-actions button { min-height: 44px; padding: 0 20px; }
@media (max-width: 480px) { .confirm-ui .dialog-actions { flex-direction: column-reverse; } .confirm-ui .dialog-actions button { width: 100%; } }
.verdict { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.verdict.ok { background: color-mix(in srgb, #2E9E5B 14%, transparent); color: var(--ink); }
.verdict.tight { background: color-mix(in srgb, #F6C90E 22%, transparent); color: var(--ink); }
.verdict.short { background: var(--danger-bg); color: var(--danger-ink); }

/* ---- Feedback on a session, and progress in the programme ---- */
.fb { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.4; background: var(--wash); color: var(--ink); }
.fb-good { background: color-mix(in srgb, #2E9E5B 14%, transparent); }
.fb-warn { background: color-mix(in srgb, #F6C90E 22%, transparent); }
section.feedback { border-left: 4px solid #2E9E5B; }
section.feedback.fb-warn { border-left-color: #E0A800; background: var(--surface); }
section.feedback.fb-good { background: var(--surface); }
.fb-lines { margin: 8px 0 12px; padding-left: 18px; display: grid; gap: 6px; }
.journey-log { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.journey-log li { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--wash); font-size: 14px; }
.journey-log .jl-week { font-weight: 600; }
.journey-log .jl-out { color: var(--ink2); }
.journey-log li.advance .jl-out { color: #1F7A44; }
.journey-log li.repeat .jl-out, .journey-log li.back .jl-out { color: var(--danger-ink); }
