/* Coach-dashboard look (founder, 2026-11-12): the dashboard gets the same look as the Core coach
   dashboard prototype (~/improvr-coach-dashboard) and the website: near-black, mint as the only
   accent, Gilroy, pill buttons and tabs, 16px cards. Loaded last on every page (and on the login
   page) and only overrides the look: same ids, same markup hooks, no logic changes. */
@font-face { font-family: "Gilroy"; src: url("/static/Gilroy-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("/static/Gilroy-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("/static/Gilroy-Bold.woff") format("woff"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("/static/Gilroy-ExtraBold.woff") format("woff"); font-weight: 800; font-display: swap; }

:root {
  color-scheme: dark;
  /* the old names both stylesheets read, remapped to the prototype tokens */
  --bg: #09090a;
  --panel: #14131a;
  --panel2: #1d1c26;
  --line: #2a2934;
  --fg: #f5f5f7;
  --dim: #9a99a3;
  --teal: #5de9d0;
  --teal-ink: #061614;
  --teal-soft: rgba(93, 233, 208, 0.1);
  --red: #ff5d6c;
  --red-soft: rgba(255, 93, 108, 0.12);
  --yellow: #f5c542;
  --green: #3ddc84;
  --radius: 16px;
  /* prototype tokens */
  --line-strong: #3a3946;
  --text-2: #d2d2d7;
  --mint-hover: #9af3e3;
  --mint-line: rgba(93, 233, 208, 0.45);
  --font: "Gilroy", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

body { font-family: var(--font); font-weight: 500; -webkit-font-smoothing: antialiased; background: var(--bg); }
body, .table, .panel input, .panel select { font-size: 15px; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
a { color: var(--teal); }

/* ---------- header: logo, small caps title, tabs, actions ---------- */
.topbar, .top {
  min-height: 64px;
  background: rgba(9, 9, 10, 0.86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.topbar { padding: 10px 24px; flex-wrap: wrap; }
.top { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px; flex-wrap: wrap; }
.top.scrolled { box-shadow: none; }
.brand { gap: 14px; }
.brand .logo { width: 112px; height: auto; flex: none; display: block; }
.brand h1, .topbar h1 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); line-height: 1.3;
}
.brand p, .topbar .sub { font-size: 12px; color: var(--dim); margin: 1px 0 0; }
.dot { display: none; }

.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 14px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 15px;
  text-decoration: none; white-space: nowrap; transition: background-color 160ms ease, color 160ms ease;
}
.tab:hover { color: var(--fg); background: var(--panel); }
.tab.is-on { color: var(--teal-ink); background: var(--teal); }
.actions, .top-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- buttons, badges, chips ---------- */
.btn {
  min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--fg); font-weight: 700; font-size: 14px; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease-out;
}
.btn:hover { border-color: var(--mint-line); background: var(--teal-soft); color: var(--fg); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.btn.primary:hover { background: var(--mint-hover); border-color: var(--mint-hover); color: var(--teal-ink); filter: none; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.block { min-height: 48px; font-size: 16px; }
select.btn { padding-right: 12px; }
.split .btn { border-radius: 999px 0 0 999px; }
.split select.btn { border-radius: 0 999px 999px 0; border-left: 1px solid var(--line-strong); padding: 0 12px; color: var(--dim); }
.pill { background: var(--teal); color: var(--teal-ink); }
.badge { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.badge.live { color: var(--green); border-color: rgba(61, 220, 132, 0.45); background: rgba(61, 220, 132, 0.08); }
.badge.local { color: var(--yellow); border-color: rgba(245, 197, 66, 0.45); }
.chip { border-radius: 999px; font-weight: 600; }
.chip.done { border-color: var(--mint-line); }
.chip.focus { border-color: var(--mint-line); }

/* ---------- page width, headings, labels ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 24px 24px 64px; }
.stats { max-width: 1440px; margin: 0 auto; padding: 24px 24px 0; gap: 12px; }
.wrap.wide { max-width: 1216px; }
.eyebrow, .sect {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal);
}
.sect { margin: 28px 0 12px; }
.card h2, .detail-head h2 { font-weight: 800; letter-spacing: -0.01em; }
.card h3 { font-weight: 700; }
.muted, .dim { color: var(--dim); }

/* ---------- filter panel (index) ---------- */
.panel { max-width: 1392px; margin: 16px auto 0; border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
@media (max-width: 1440px) { .panel { margin: 16px 24px 0; } }
.panel label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.panel input, .panel select, .apps-filters input, textarea, .as-select {
  min-height: 42px; border-radius: 12px; border: 1px solid var(--line-strong); background: #0e0e12; color: var(--fg);
}
.panel input:focus, .panel select:focus, .apps-filters input:focus, textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft);
}
.check input { accent-color: var(--teal); }

/* ---------- stat tiles (KPI tiles in the prototype) ---------- */
.stat { border-radius: 16px; padding: 16px 18px; min-width: 150px; display: grid; gap: 6px; align-content: start; }
.stat .k { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--dim); }
.stat .v { font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; margin: 0; }

/* ---------- tables (the squad table in the prototype) ---------- */
.table { border-radius: 16px; font-size: 15px; }
.table th { background: transparent; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--dim); padding: 12px 14px; }
.th-btn { padding: 12px 14px; font-weight: 700; }
.table td { padding: 12px 14px; }
.table tbody tr { transition: background-color 160ms ease; }
.table tbody tr[data-player]:hover { background: var(--panel2); }
.table .name { font-weight: 700; }
.sort-arrows .arr { fill: var(--dim); }
.bar { height: 6px; border-radius: 3px; background: var(--line); }

/* ---------- cards, notes, banners ---------- */
.card { border-radius: 16px; padding: 20px; }
.note { border: 1px solid var(--line); border-radius: 12px; background: var(--teal-soft); }
.raw { border-radius: 16px; }
.banner { border-radius: 12px; }
.error { border-radius: 12px; }
.game { border-left: 0; padding: 10px 12px; border-radius: 12px; background: var(--panel2); }
.st-new { border-left: 1px solid var(--mint-line); border-color: var(--mint-line); }
.plan-badge { border-color: var(--mint-line); }
.fchip { border-radius: 999px; font-weight: 600; }
.fchip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.seg button { border-radius: 999px; font-weight: 700; }
.toast { border-radius: 999px; }
.fab { background: rgba(20, 19, 26, 0.9); }

/* ---------- login ---------- */
.wrap > form { border-radius: 16px; padding: 32px; }
.wrap > form h1.logo img { width: 150px; }
.wrap > form input { border-radius: 12px; min-height: 44px; background: #0e0e12; border-color: var(--line-strong); }
.wrap > form input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.wrap > form .btn.primary { min-height: 46px; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .topbar { padding: 10px 16px 6px; gap: 8px 12px; }
  .topbar .tabs, .top .tabs { order: 3; flex-basis: 100%; margin: 0 -4px; }
  .tab { padding: 7px 12px; font-size: 14px; }
  .brand .logo { width: 96px; }
  .stats { padding: 16px 16px 0; }
  main { padding: 16px 16px 56px; }
  .stat { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .stat .v { font-size: 24px; }
  .panel { margin: 12px 16px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .tab, .table tbody tr { transition: none; }
  .btn:active { transform: none; }
}

/* The players table has 10 columns: on narrow screens it scrolls inside its own box, the page stays put. */
#list-view { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; }
#list-view .table { min-width: 960px; }

/* ---------- players view, like the prototype's squad view (2026-11-19) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.toolbar .search { position: relative; flex: 1 1 280px; max-width: 380px; }
.toolbar .search .ic { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--dim); pointer-events: none; }
.toolbar .search input { width: 100%; min-height: 44px; padding: 0 14px 0 42px; border-radius: 12px; border: 1px solid var(--line-strong); background: #0e0e12; color: var(--fg); font-size: 15px; }
.toolbar .search input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: #0e0e12; }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-weight: 700; font-size: 14px; cursor: pointer; transition: background-color 160ms ease, color 160ms ease; }
.seg button:hover { color: var(--fg); }
.seg button[aria-checked="true"] { background: var(--teal); color: var(--teal-ink); }
.legend { margin: 0 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--dim); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg.green { background: var(--green); } .lg.yellow { background: var(--yellow); } .lg.red { background: var(--red); }

#players td { vertical-align: middle; }
.who { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.who > span:last-child { display: grid; min-width: 0; }
.av { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--mint-line); background: var(--teal-soft); color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.av--lg { width: 52px; height: 52px; font-size: 17px; border-width: 2px; }
.name-btn { padding: 0; border: 0; background: none; color: var(--fg); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.name-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
tr[data-player]:hover .name-btn { color: var(--teal); }
.sub { display: block; font-size: 13px; color: var(--dim); font-weight: 500; white-space: nowrap; }
td.ov { min-width: 120px; }
.ov-v { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.meter { display: block; width: 72px; height: 5px; margin: 6px 0 0 auto; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; }
.meter.green i { background: var(--green); } .meter.yellow i { background: var(--yellow); } .meter.red i { background: var(--red); }
td.tr { white-space: nowrap; }
td.tr .spark { display: inline-block; vertical-align: middle; margin-left: 8px; }
.chip-t { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-t.up { color: var(--green); background: rgba(61, 220, 132, 0.1); }
.chip-t.down { color: var(--red); background: var(--red-soft); }
.spark { width: 72px; height: 22px; overflow: visible; }
.spark path { fill: none; stroke: var(--teal); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark circle.green { fill: var(--green); } .spark circle.yellow { fill: var(--yellow); } .spark circle.red { fill: var(--red); } .spark circle.dim { fill: var(--dim); }
td.last { white-space: nowrap; }
td.last .recent { color: var(--teal); font-weight: 700; }
td.last .recent::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--teal); vertical-align: 1px; }

/* player detail: header, tiles grid, charts */
.detail-head { gap: 14px; }
.detail-head h2 { font-size: 26px; line-height: 1.1; }
.detail-head > div > span { display: block; margin-top: 2px; font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cards .stat { min-width: 0; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 4px 0 8px; }
.chart-card { padding: 18px 20px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); min-width: 0; }
.chart-card .sect { margin: 0 0 10px; }
.chart-wrap { width: 100%; min-height: 200px; }
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--dim); font: 600 11px var(--font); }
.chart .ln { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { stroke: var(--panel); stroke-width: 2; }
.c-ov { stroke: var(--teal); fill: var(--teal); }
.chart .ln.c1, .chart-legend .c1 { stroke: #5de9d0; background: #5de9d0; }
.chart .ln.c2, .chart-legend .c2 { stroke: #c7b8ff; background: #c7b8ff; }
.chart .ln.c3, .chart-legend .c3 { stroke: #f5c542; background: #f5c542; }
.chart .ln.c4, .chart-legend .c4 { stroke: #ff9f85; background: #ff9f85; }
.chart .ln.c5, .chart-legend .c5 { stroke: #7cc4ff; background: #7cc4ff; }
.chart .ln.c-ov { fill: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; font-size: 13px; color: var(--dim); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }

@media (max-width: 960px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .legend { margin: 0; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  /* players table becomes cards on phones */
  #list-view { overflow: visible; }
  #list-view .table { min-width: 0; border: 0; background: none; }
  #players thead { display: none; }
  #players, #players tbody, #players tr, #players td { display: block; }
  #players tr[data-player] { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
  #players td { padding: 0; border: 0; text-align: left; }
  #players td[data-l]::before { content: attr(data-l); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
  #players td.who { grid-column: 1 / -1; min-width: 0; }
  #players td.who::before { content: none; }
  #players .meter { margin-left: 0; }
  #players td.empty { text-align: center; }
  .detail-head .spacer { display: none; }
}
/* fixes after the first players-view pass */
.topbar .brand { min-width: 0; }
.topbar .brand > div { min-width: 0; }
.topbar .sub { white-space: normal; }
#players th .th-btn, #players td { padding-left: 12px; padding-right: 12px; }
#list-view .table { min-width: 0; }
@media (max-width: 1100px) { #list-view .table { min-width: 1040px; } }
@media (max-width: 760px) { #list-view .table { min-width: 0; } }
@media (max-width: 760px) { #players td.who { display: flex; } }

/* Filter-panel hint was 10.5px: below the 11px floor for functional text. */
.hint { font-size: 12px; opacity: 1; color: var(--dim); }

/* ---------- Spieler-Ansicht (athlete page) polish + motion (2026-11-19) ---------- */
/* "Heute" reads as the main card */
#today h2 { font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; margin: 2px 0 8px; }
#today .btn.primary.block { min-height: 52px; font-size: 16px; margin-top: 6px; }
#progress-card h3 { font-size: 18px; line-height: 1.35; }
/* progress bar, added by motion.js under "x von y Einheiten erledigt" */
.pbar { height: 8px; margin: 2px 0 18px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: inherit; background: var(--teal); transform-origin: left center; transform: scaleX(var(--p, 0)); }
/* room at the end so the floating coach button never covers the last card */
body:has(#coach-fab) .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
/* accordion: + turns into × and the answer opens smoothly */
details.explain summary::after { content: "+"; font-size: 20px; line-height: 1; transition: transform 250ms var(--ease-out); }
details.explain[open] summary::after { content: "+"; transform: rotate(45deg); }
@supports selector(::details-content) {
  details.explain { interpolate-size: allow-keywords; }
  details.explain::details-content { block-size: 0; overflow: clip; opacity: 0; transition: block-size 350ms var(--ease-out), opacity 250ms ease, content-visibility 350ms allow-discrete; }
  details.explain[open]::details-content { block-size: auto; opacity: 1; }
}
/* coach button slides away while scrolling down (motion.js) */
.fab { transition: transform 100ms ease-out, translate 300ms var(--ease-out), opacity 200ms ease; }
.fab.is-away { translate: 0 calc(100% + 32px); opacity: 0; pointer-events: none; }

/* Motion, only when motion.js runs and reduced motion is off (html.mo) */
html.mo .rv { opacity: 0; translate: 0 18px; transition: opacity 600ms var(--ease-out), translate 800ms var(--ease-out); transition-delay: calc(var(--rv-i, 0) * 80ms); }
html.mo .rv.is-in { opacity: 1; translate: none; }
html.mo .rv .pbar i { transform: scaleX(0); }
html.mo .rv.is-in .pbar i { transform: scaleX(var(--p, 0)); transition: transform 1100ms var(--ease-out) 250ms; }
html.mo #progress-card.rv .sdot { opacity: 0; scale: 0.5; }
html.mo #progress-card.rv.is-in .sdot {
  opacity: 1; scale: 1;
  transition: opacity 300ms ease, scale 450ms cubic-bezier(0.34, 1.56, 0.64, 1), transform 100ms ease-out, background-color 200ms ease, border-color 200ms ease;
  transition-delay: calc(var(--d, 0) * 28ms + 200ms), calc(var(--d, 0) * 28ms + 200ms), 0s, 0s, 0s;
}
html.mo #progress-card.rv.is-in .sdot.current::before {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--teal); pointer-events: none;
  animation: dot-ring 1.4s var(--ease-out) 2; animation-delay: calc(var(--d, 0) * 28ms + 700ms);
}
@keyframes dot-ring { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.7); opacity: 0; } }
html.mo #today.rv .plan .chip { opacity: 0; scale: 0.85; }
html.mo #today.rv.is-in .plan .chip { opacity: 1; scale: 1; transition: opacity 300ms ease 250ms, scale 400ms cubic-bezier(0.34, 1.56, 0.64, 1) 250ms; }
@media (prefers-reduced-motion: reduce) {
  details.explain::details-content { transition: none; }
  details.explain summary::after, .fab { transition: none; }
}

/* header a bit more solid so mint buttons do not bleed through while scrolling */
.topbar, .top { background: rgba(9, 9, 10, 0.94); }
