:root {
  --paper: #f2f4f1;
  --surface: #ffffff;
  --ink: #17201c;
  --ink-2: #56635c;
  --line: #d6ddd7;
  --pine: #2f5d50;
  --pine-soft: #dfe9e4;
  --green: #3f8a5c;
  --amber: #b9821a;
  --red: #b0443a;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121815;
    --surface: #1a221e;
    --ink: #e6ece8;
    --ink-2: #9aa8a0;
    --line: #2c3731;
    --pine: #7fb8a5;
    --pine-soft: #22332c;
    --green: #6cbf8a;
    --amber: #e0aa45;
    --red: #e07a6f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
}
#app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }

h1, h2 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0 0 8px; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 6px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.num { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

.primary {
  background: var(--pine); color: var(--paper); border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 600;
}
.primary:disabled { opacity: 0.5; cursor: default; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; color: var(--ink); }
input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.error { color: var(--red); }
.ok { color: var(--green); }
.banner { padding: 10px 12px; border-left: 3px solid var(--red); background: var(--surface); margin: 12px 0; }

/* Header + tabs */
.top { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 8px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.01em; color: var(--pine); }
.sync { font-size: 0.85rem; }
.tabs {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 4px; padding: 8px 0; background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1; background: none; border: 0; padding: 8px 4px; border-radius: 6px;
  font-family: var(--display); font-size: 1.05rem; font-weight: 600; color: var(--ink-2);
}
.tabs button[aria-current="page"] { color: var(--ink); background: var(--pine-soft); }

.page { padding-top: 16px; display: grid; gap: 20px; }
.block h2 { margin-bottom: 10px; }

/* The bib: today's session, the one loud element */
.bib {
  --lvl: var(--ink-2);
  display: grid; grid-template-columns: 10px 1fr; background: var(--surface);
  border: 2px solid var(--ink); border-radius: 14px; overflow: hidden;
}
.lvl-green { --lvl: var(--green); }
.lvl-amber { --lvl: var(--amber); }
.lvl-red { --lvl: var(--red); }
.bib-strip { background: var(--lvl); }
.bib-body { padding: 16px 18px 18px; }
.bib-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 0.9rem; color: var(--ink-2); }
.bib-session {
  font-family: var(--display); font-weight: 700; font-size: clamp(2.1rem, 9vw, 3.4rem); line-height: 0.98;
  letter-spacing: -0.01em; margin: 12px 0 10px; text-wrap: balance;
}
.bib-extra { margin: 0 0 6px; padding: 0; list-style: none; color: var(--ink-2); }
.bib-detail { color: var(--ink-2); font-size: 0.9rem; }
.bib-count { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.bib-count .num { font-size: 2rem; line-height: 1; color: var(--pine); }

.status { border-left: 4px solid var(--lvl, var(--ink-2)); padding: 4px 0 4px 14px; }
.status h2 { font-family: var(--body); font-size: 1.05rem; font-weight: 600; margin: 0; }
.status ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; margin: 0; }
@media (min-width: 560px) { .metrics { grid-template-columns: repeat(4, 1fr); } }
.metrics dt { font-size: 0.85rem; color: var(--ink-2); }
.metrics dd { margin: 0; font-family: var(--display); font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.metrics small { font-family: var(--body); font-size: 0.8rem; font-weight: 400; color: var(--ink-2); }

.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; margin: 8px 0 10px; }
.scale button {
  padding: 8px 0; border: 1px solid var(--line); background: var(--surface); border-radius: 6px;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
}
.scale button.warn { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); }
.scale button.stop { border-color: color-mix(in srgb, var(--red) 50%, var(--line)); }
.scale button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.scale button.on.warn { background: var(--amber); border-color: var(--amber); color: #fff; }
.scale button.on.stop { background: var(--red); border-color: var(--red); color: #fff; }
.row { display: flex; gap: 8px; }

.plain, .acts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item { display: grid; grid-template-columns: 4.4em 1fr; gap: 8px; align-items: baseline; }
.kind {
  display: inline-block; font-family: var(--display); font-weight: 600; font-size: 0.95rem;
  color: var(--ink-2);
}
.k-quality, .k-race, .k-test { color: var(--pine); }

/* Week */
.weekhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wk-title { text-align: center; flex: 1; }
.weekhead h1 { margin: 0; }
.note { background: var(--pine-soft); padding: 8px 12px; border-radius: 8px; font-size: 0.92rem; }
.totals { display: flex; gap: 24px; }
.totals .num { font-size: 2rem; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: -8px; }
.progress span { display: block; height: 100%; background: var(--pine); }
.days { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.days li {
  display: grid; grid-template-columns: 3.2rem 1fr; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.days li.isToday .dname span { color: var(--pine); }
.dname { grid-row: span 2; display: flex; flex-direction: column; font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.1; }
.dplan p, .dactual p { margin: 0; }
.dactual { font-size: 0.95rem; }
.dactual .act strong { font-family: var(--display); font-size: 1.05rem; }
.miss { color: var(--amber); }
@media (min-width: 560px) {
  .days li { grid-template-columns: 3.2rem 1.4fr 1fr; }
  .dname { grid-row: auto; }
}

/* Charts */
.chart { margin: 0; }
.chart figcaption { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--pine); opacity: 0.85; }
.chart .bar.soft { opacity: 0.45; }
.chart .bar.short { fill: var(--amber); opacity: 0.9; }
.chart .plan { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 3 3; }
.chart .axis { stroke: var(--line); }
.chart .line { fill: none; stroke: var(--pine); stroke-width: 2; stroke-linejoin: round; }
.chart .band { fill: var(--pine-soft); }
.chart .val { font: 600 11px var(--display); fill: var(--ink-2); text-anchor: middle; }
.chart .lbl { font: 12px var(--body); fill: var(--ink-2); }
.legend { display: flex; align-items: center; gap: 6px; color: var(--ink-2); margin-top: 6px; }
.sw { display: inline-block; width: 14px; height: 10px; }
.sw.bar { background: var(--pine); opacity: 0.85; }
.sw.plan { border-top: 2px dashed var(--ink); height: 0; margin-left: 10px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 6px 10px; font-size: 0.9rem; }
.seg button[aria-pressed="true"] { background: var(--pine-soft); font-weight: 600; }

/* Plan */
.paces { border-collapse: collapse; width: 100%; max-width: 360px; }
.paces caption { text-align: left; font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-bottom: 4px; }
.paces th, .paces td { padding: 4px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.paces td { text-align: right; font-variant-numeric: tabular-nums; }
.weeks { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.weeks li { padding: 10px 0 10px 12px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.weeks li.current { border-left-color: var(--pine); background: var(--pine-soft); }
.wk-head { display: flex; align-items: baseline; gap: 10px; }
.wk-head .km { margin-left: auto; font-size: 1.2rem; padding-right: 8px; }
.weeks p { margin: 2px 0; }

.foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Login */
.login { max-width: 360px; margin: 18vh auto 0; display: grid; gap: 10px; }
.login form { display: grid; gap: 10px; }
.login label { font-weight: 500; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
