/* =========================================================================
   Trainingslog — Tokens, Layout, Komponenten, Animation
   ========================================================================= */

:root {
  color-scheme: light;

  --page:            #f9f9f7;
  --surface-1:       #fcfcfb;
  --surface-2:       #f2f1ed;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --muted:           #898781;
  --grid:            #e1e0d9;
  --axis:            #c3c2b7;
  --border:          rgba(11, 11, 11, .10);
  --border-strong:   rgba(11, 11, 11, .18);
  --shadow:          0 1px 2px rgba(11,11,11,.05), 0 8px 24px -12px rgba(11,11,11,.14);
  --shadow-lg:       0 24px 70px -20px rgba(11,11,11,.35);

  /* Kategoriale Slots in fester Reihenfolge (Muskelgruppen) */
  --series-1: #2a78d6;   /* blau    – Brust      */
  --series-2: #eb6834;   /* orange  – Rücken     */
  --series-3: #1baf7a;   /* aqua    – Beine      */
  --series-4: #eda100;   /* gelb    – Schultern  */
  --series-5: #e87ba4;   /* magenta – Arme       */

  --accent:      var(--series-1);
  --accent-ink:  #ffffff;
  --accent-soft: rgba(42, 120, 214, .12);

  --good:     #0ca30c;
  --good-ink: #006300;
  --critical: #d03b3b;

  --radius:    16px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --surface-2:      #232322;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --muted:          #898781;
    --grid:           #2c2c2a;
    --axis:           #383835;
    --border:         rgba(255,255,255,.10);
    --border-strong:  rgba(255,255,255,.18);
    --shadow:         0 1px 2px rgba(0,0,0,.4), 0 16px 40px -20px rgba(0,0,0,.7);
    --shadow-lg:      0 30px 80px -24px rgba(0,0,0,.85);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;

    --accent:      var(--series-1);
    --accent-soft: rgba(57, 135, 229, .16);
    --good-ink:    #0ca30c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface-1:      #1a1a19;
  --surface-2:      #232322;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --muted:          #898781;
  --grid:           #2c2c2a;
  --axis:           #383835;
  --border:         rgba(255,255,255,.10);
  --border-strong:  rgba(255,255,255,.18);
  --shadow:         0 1px 2px rgba(0,0,0,.4), 0 16px 40px -20px rgba(0,0,0,.7);
  --shadow-lg:      0 30px 80px -24px rgba(0,0,0,.85);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;

  --accent:      var(--series-1);
  --accent-soft: rgba(57, 135, 229, .16);
  --good-ink:    #0ca30c;
}

/* ---- Grundlagen --------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* Muss die display-Regeln der Komponenten schlagen, sonst bleibt [hidden] wirkungslos. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.012em; }
p { margin: 0; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; }

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.struck { text-decoration: line-through; opacity: .65; }

/* ---- Knöpfe ------------------------------------------------------------- */
.primary-btn, .secondary-btn, .ghost-btn {
  appearance: none; cursor: pointer; font: inherit;
  border-radius: 10px; padding: .5rem .9rem;
  transition: background .2s, border-color .2s, color .2s, transform .15s, opacity .2s;
}
.primary-btn {
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink);
  font-weight: 550;
}
.primary-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.primary-btn.compact { padding: .4rem .8rem; font-size: .85rem; }
.secondary-btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary);
  font-weight: 500;
}
.secondary-btn:hover:not(:disabled) { border-color: var(--accent); }
.secondary-btn:disabled { opacity: .45; cursor: not-allowed; }
.ghost-btn {
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  padding: .3rem .7rem; font-size: .8rem;
}
.ghost-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.ghost-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text-primary); }
.ghost-btn.danger:hover { color: var(--critical); border-color: var(--critical); }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-1); color: var(--text-secondary);
  cursor: pointer; transition: border-color .2s, color .2s, transform .2s;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.ghost { border-color: transparent; background: transparent; font-size: 1rem; }

/* ---- Anmeldung ---------------------------------------------------------- */
.auth-screen {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--page);
}
.auth-card {
  width: min(380px, 100%);
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 2rem 1.8rem 1.8rem;
  display: flex; flex-direction: column; gap: .8rem;
  animation: rise .5s cubic-bezier(.2,.7,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-card h1 { font-size: 1.3rem; }
.auth-hint { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.auth-error { color: var(--critical); font-size: .82rem; min-height: 1.2em; }
.auth-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--text-secondary); }
.brand-mark.big { width: 46px; height: 46px; border-radius: 14px; margin-bottom: .4rem; }
.brand-mark.big svg { width: 26px; height: 26px; }

/* ---- Formularfelder ----------------------------------------------------- */
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="file"], select, textarea {
  width: 100%; font: inherit; color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: .5rem .65rem;
  transition: border-color .18s, box-shadow .18s;
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, summary:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; color: var(--text-secondary); }
.field.grow { flex: 1 1 200px; }
.field-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 160px; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--text-secondary); cursor: pointer; }
.check input { width: auto; }
.select-inline {
  width: auto; max-width: 180px; padding: .35rem .55rem; font-size: .85rem;
  border-radius: 10px; background: var(--surface-1);
}

/* ---- Kopfzeile ---------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 11px; background: var(--accent-soft); color: var(--accent);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text h1 { font-size: 1.05rem; }
.brand-text p { font-size: .78rem; color: var(--muted); }
.header-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }

.ico-moon { display: none; }
:root[data-theme="dark"] .ico-sun { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun { display: none; }
  :root:not([data-theme="light"]) .ico-moon { display: block; }
}

/* ---- Filterleiste ------------------------------------------------------- */
.filterbar-outer {
  position: sticky; top: 60px; z-index: 30;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.filterbar { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1.5rem; padding: .7rem 0; }
.filter-group { display: flex; align-items: center; gap: .6rem; }
.filter-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.filter-hint { margin-left: auto; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.segmented { display: flex; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: 10px; }
.segmented.wrapping { flex-wrap: wrap; }
.segmented button {
  display: inline-flex; align-items: center; gap: .35rem;
  appearance: none; border: 0; background: transparent;
  padding: .34rem .68rem; border-radius: 8px;
  font: inherit; font-size: .82rem; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap;
  transition: background .22s, color .22s;
}
.segmented button:hover { color: var(--text-primary); }
.segmented button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.segmented.small button { font-size: .78rem; padding: .3rem .6rem; }

@media (max-width: 680px) {
  .filterbar-outer { position: static; }
  .filter-group { flex-direction: column; align-items: flex-start; gap: .3rem; width: 100%; }
  .filter-hint { margin-left: 0; }
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .chart-toolbar { align-items: flex-start; }
  .chart-toolbar .ghost-btn { margin-left: 0; }
}

/* ---- Vollseiten (Erfassung, Einstellungen) ------------------------------ */
.page, .page > form {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - 61px);
}
.page > form { flex: 1; }

.page-head {
  position: sticky; top: 60px; z-index: 25;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.page-head-inner { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; }
.page-title h2 { font-size: 1.15rem; }
.page-title .mode-hint { margin-top: .1rem; }

.page-body { flex: 1; padding: 1.4rem 0 2rem; display: flex; flex-direction: column; gap: 1rem; }
.page-body > h3 { font-size: .95rem; margin-top: .3rem; }

.page-foot {
  position: sticky; bottom: 0; z-index: 25;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.page-foot-inner { display: flex; justify-content: flex-end; gap: .6rem; padding: .8rem 0; }

.settings-body { gap: .9rem; }
.settings-card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .7rem;
}
.settings-card h3 { font-size: .98rem; }
.settings-card > form { display: flex; flex-direction: column; gap: .7rem; }
.derived-note { font-size: .78rem; color: var(--muted); }

@media (max-width: 680px) {
  .page-head { position: static; }
  .page-foot-inner { padding: .7rem 0; }
  .page-foot-inner .primary-btn { flex: 1; }
}

/* ---- Abschnitte / Karten ------------------------------------------------ */
main { padding-block: 2rem 3rem; }
.section { margin-top: 3rem; }
.section-head { margin-bottom: 1rem; }
.section-head h2 { font-size: 1.28rem; }
.section-sub { font-size: .87rem; color: var(--muted); margin-top: .2rem; }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---- Hero --------------------------------------------------------------- */
.hero {
  margin-top: 1.5rem; display: grid; gap: 1rem;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.9fr);
}
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }

.hero-figure {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem; position: relative; overflow: hidden;
}
.hero-figure::after {
  content: ""; position: absolute; inset: auto -30% -60% auto;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}
.hero-label { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.hero-value { font-size: clamp(2.6rem, 7vw, 3.6rem); font-weight: 650; line-height: 1.05; margin-top: .35rem; letter-spacing: -.03em; }
.hero-unit { font-size: .34em; font-weight: 500; color: var(--muted); margin-left: .35rem; letter-spacing: 0; }
.hero-sub { font-size: .85rem; color: var(--text-secondary); margin-top: .5rem; }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 520px) { .stat-grid { grid-template-columns: 1fr; } }
.stat {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; display: flex; flex-direction: column; justify-content: space-between;
}
.stat-label { font-size: .78rem; color: var(--muted); }
.stat-value { font-size: 1.9rem; font-weight: 620; letter-spacing: -.02em; margin-top: .25rem; }
.stat-note { font-size: .78rem; color: var(--text-secondary); margin-top: .3rem; }

/* ---- PR-Karten ---------------------------------------------------------- */
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: .85rem; }
.pr-card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.05rem 1.05rem;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: .55rem;
  transition: transform .22s cubic-bezier(.2,.7,.2,1), border-color .22s;
}
.pr-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.pr-top { display: flex; align-items: center; gap: .45rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pr-name { font-size: .86rem; font-weight: 550; }
.pr-kind { font-size: .72rem; color: var(--muted); margin-left: auto; }
.pr-value { font-size: 1.55rem; font-weight: 620; letter-spacing: -.02em; }
.pr-value small { font-size: .55em; font-weight: 500; color: var(--muted); margin-left: .2rem; }
.pr-meta { display: flex; align-items: center; gap: .5rem; font-size: .76rem; color: var(--muted); }
.pr-spark { display: block; height: 34px; margin-top: -.15rem; }

.delta { display: inline-flex; align-items: center; gap: .18rem; font-weight: 550; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good-ink); }
.delta.flat { color: var(--muted); }

/* ---- Diagrammkarte ------------------------------------------------------ */
.chart-card { padding: 1.1rem 1.2rem 1.2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .34rem .7rem; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  font: inherit; font-size: .8rem; color: var(--text-secondary);
  cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.chip:hover { color: var(--text-primary); transform: translateY(-1px); }
.chip.on { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-strong); }
.chip .dot { width: 8px; height: 8px; }
.chip-count { font-size: .72rem; color: var(--muted); }

.chart-toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.chart-toolbar .ghost-btn { margin-left: auto; }
.chart-caption { font-size: .84rem; color: var(--text-secondary); margin-top: .9rem; }
.chart-foot { font-size: .76rem; color: var(--muted); margin-top: .7rem; }
.chart-host { margin-top: .4rem; position: relative; }
.chart-host svg { display: block; width: 100%; height: auto; overflow: visible; }

.grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.axis-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.tick-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.series-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-area { fill: var(--accent); opacity: .10; }
.series-dot { fill: var(--accent); stroke: var(--surface-1); stroke-width: 2; }
.series-bar { fill: var(--accent); }
.pr-ring { fill: none; stroke: var(--good); stroke-width: 2; }
.point-label { fill: var(--text-primary); font-size: 11.5px; font-weight: 600; }
.crosshair { stroke: var(--axis); stroke-width: 1; opacity: 0; }
.crosshair.on { opacity: 1; }
.hit-layer { fill: transparent; }

.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
.draw.in { stroke-dashoffset: 0; transition: stroke-dashoffset 1s cubic-bezier(.3,.7,.2,1); }
.fade { opacity: 0; }
.fade.in { opacity: 1; transition: opacity .5s ease .55s; }
.series-area.fade.in { opacity: .10; }

/* ---- Tabelle ------------------------------------------------------------ */
.table-host { margin-top: .9rem; max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left;
  padding: .5rem .75rem; font-weight: 550; color: var(--text-secondary); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: .45rem .75rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* ---- Kleine Vielfache --------------------------------------------------- */
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: .85rem; }
.sm-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .9rem 1rem 1rem; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
  display: flex; flex-direction: column;
  transition: transform .22s cubic-bezier(.2,.7,.2,1), border-color .22s;
}
.sm-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.sm-head { display: flex; align-items: center; gap: .4rem; }
.sm-name { font-size: .82rem; font-weight: 550; }
.sm-val { font-size: 1.1rem; font-weight: 600; letter-spacing: -.01em; }
.sm-val small { font-size: .6em; color: var(--muted); font-weight: 500; margin-left: .15rem; }
.sm-chart { display: block; height: 52px; margin-top: .4rem; }
.sm-foot { font-size: .72rem; color: var(--muted); margin-top: .4rem; }

/* ---- Kalender ----------------------------------------------------------- */
.freq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.freq-tile {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .9rem 1.05rem;
}
.freq-value { font-size: 1.7rem; font-weight: 620; letter-spacing: -.02em; line-height: 1.1; }
.freq-label { font-size: .8rem; color: var(--text-secondary); margin-top: .1rem; }
.freq-note { font-size: .74rem; color: var(--muted); margin-top: .25rem; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .76rem; color: var(--muted); margin-bottom: 1rem; }
.cal-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.lg-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-dot.done { background: var(--accent-soft); border: 1px solid var(--accent); }
.lg-dot.pr { background: color-mix(in srgb, var(--good) 16%, transparent); border: 1px solid var(--good); }
.lg-bar { width: 22px; height: 4px; border-radius: 2px; background: var(--accent); display: inline-block; }

.cal-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem; }
.cal-month {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .9rem 1rem 1.1rem;
}
.cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.cal-head h3 { font-size: .95rem; }
.cal-sum { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { font-size: .68rem; color: var(--muted); text-align: center; padding-bottom: .2rem; }

.cal-cell {
  position: relative; aspect-ratio: 1; border-radius: 8px;
  border: 1px solid transparent; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: inherit; color: var(--muted); padding: 2px;
}
.cal-cell.empty { background: transparent; }
.cal-num { font-size: .7rem; font-variant-numeric: tabular-nums; line-height: 1; }
.cal-cell.today { outline: 2px solid var(--axis); outline-offset: 1px; }

.cal-cell.done {
  cursor: pointer; color: var(--text-primary);
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .16s cubic-bezier(.2,.7,.2,1), border-color .16s;
}
.cal-cell.done:hover { transform: translateY(-2px) scale(1.04); border-color: var(--accent); }
.cal-cell.done .cal-num { font-weight: 600; }
.cal-cell.pr { background: color-mix(in srgb, var(--good) 13%, transparent); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.cal-dots { display: flex; gap: 2px; }
.cal-dots i { width: 4px; height: 4px; border-radius: 50%; display: block; }
.cal-bar { width: 76%; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--text-primary) 12%, transparent); overflow: hidden; }
.cal-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.cal-star { position: absolute; top: 1px; right: 3px; font-size: .55rem; color: var(--good); line-height: 1; }

/* Geplante, noch nicht absolvierte Tage: umrissen statt gefüllt. */
.cal-cell.planned {
  cursor: pointer; background: transparent; color: var(--text-secondary);
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .16s cubic-bezier(.2,.7,.2,1), background .16s;
}
.cal-cell.planned:hover { transform: translateY(-2px) scale(1.04); background: var(--accent-soft); }
.cal-cell.planned.sport { border-color: color-mix(in srgb, var(--series-3) 60%, transparent); }
.cal-plan { font-size: .52rem; line-height: 1; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dots i.act, .dot.act { background: var(--series-3); }
.dot.act { width: 9px; height: 9px; border-radius: 50%; }
.lg-dot.planned { background: transparent; border: 1px dashed var(--accent); }

.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; padding: .12rem .45rem; border-radius: 6px; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; }
.badge-pr {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; font-weight: 600; padding: .1rem .4rem; border-radius: 6px;
  color: var(--good-ink); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent);
  background: color-mix(in srgb, var(--good) 10%, transparent); white-space: nowrap;
}
.badge-fail {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; font-weight: 600; padding: .1rem .4rem; border-radius: 6px;
  color: var(--critical); border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent);
  background: color-mix(in srgb, var(--critical) 10%, transparent); white-space: nowrap;
}

.tl-row {
  display: grid; grid-template-columns: minmax(140px, 190px) 1fr auto;
  gap: .5rem 1rem; padding: .45rem 0; border-top: 1px solid var(--border); align-items: baseline;
}
.tl-row-name { display: flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 500; }
.tl-sets { font-size: .84rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.tl-sets .top-set { color: var(--text-primary); font-weight: 600; }
.tl-note { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.tl-row:first-child { border-top: 0; }
@media (max-width: 620px) { .tl-row { grid-template-columns: 1fr auto; } }

.row-del {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 8px;
  width: 26px; height: 26px; line-height: 1; font-size: 1rem; flex: none;
  transition: color .2s, border-color .2s, background .2s;
}
.row-del:hover { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }

/* ---- Modale ------------------------------------------------------------- */
dialog.modal {
  padding: 0; border: 0; background: transparent;
  max-width: min(680px, calc(100vw - 1.5rem));
  width: 100%; max-height: calc(100dvh - 2rem);
  color: var(--text-primary);
}
dialog.modal.wide { max-width: min(820px, calc(100vw - 1.5rem)); }
dialog.modal::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: rise .28s cubic-bezier(.2,.7,.2,1); }
.modal-inner {
  display: flex; flex-direction: column; max-height: calc(100dvh - 2rem);
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.05rem; }
.modal-body { padding: 1.1rem 1.2rem; overflow-y: auto; display: flex; flex-direction: column; gap: .9rem; }
.modal-body h3 { font-size: .92rem; margin-top: .4rem; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: .6rem;
  padding: .9rem 1.2rem; border-top: 1px solid var(--border); background: var(--surface-2);
}
.mode-hint { font-size: .78rem; color: var(--muted); }

.entry-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .8rem; background: var(--page); }
.prefill-hint { font-size: .76rem; color: var(--muted); min-height: 1em; }

.set-input { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.stepper-label { font-size: .78rem; color: var(--text-secondary); display: block; margin-bottom: .3rem; }
.stepper-row { display: flex; align-items: stretch; gap: .35rem; }
.stepper-row button {
  appearance: none; cursor: pointer; font: inherit; font-size: 1.25rem; line-height: 1;
  width: 46px; flex: none; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface-2); color: var(--text-primary);
  transition: border-color .18s, background .18s;
}
.stepper-row button:hover { border-color: var(--accent); }
.stepper-row input { text-align: center; font-size: 1.05rem; font-weight: 600; padding: .5rem .3rem; }

.set-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.set-list { display: flex; flex-wrap: wrap; gap: .4rem; min-height: 32px; align-items: center; font-size: .82rem; }
.set-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  appearance: none; cursor: pointer; font: inherit; font-size: .8rem;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-1); color: var(--text-primary);
  padding: .25rem .5rem .25rem .7rem; font-variant-numeric: tabular-nums;
  transition: border-color .18s, color .18s;
}
.set-chip .x { color: var(--muted); }
.set-chip:hover { border-color: var(--critical); }
.set-chip:hover .x { color: var(--critical); }
.set-chip.failed { text-decoration: line-through; color: var(--muted); }

.raw-toggle summary { cursor: pointer; font-size: .82rem; color: var(--text-secondary); }
.raw-toggle > *:not(summary) { margin-top: .6rem; }

/* ---- Trainingsvorschlag ------------------------------------------------- */
.suggest-box {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: var(--radius); padding: .8rem 1rem;
}
.suggest-box > summary {
  cursor: pointer; font-size: .88rem; font-weight: 550; color: var(--text-primary);
  display: flex; align-items: center; gap: .45rem; list-style: none;
}
.suggest-box > summary::-webkit-details-marker { display: none; }
.sparkle { color: var(--accent); }
.suggest-inner { display: flex; flex-direction: column; gap: .7rem; margin-top: .8rem; }
.suggest-result { display: flex; flex-direction: column; gap: .7rem; }
.suggest-focus { font-weight: 600; font-size: .95rem; }
.suggest-reason { font-size: .84rem; color: var(--text-secondary); }
.suggest-warn { margin: 0; padding-left: 1.1rem; font-size: .82rem; color: var(--critical); }
.suggest-note { font-size: .78rem; color: var(--muted); margin-top: .1rem; }

.suggest-ex { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .7rem; background: var(--surface-1); }
.suggest-ex-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.suggest-ex-actions { display: flex; gap: .4rem; margin-left: auto; flex-wrap: wrap; }

.new-ex-box {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: .8rem; display: flex; flex-direction: column; gap: .7rem;
  background: var(--surface-1);
}
.suggest-sets { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.suggest-set { display: flex; align-items: center; gap: .4rem; }
.suggest-set input { width: 72px; text-align: center; padding: .3rem .2rem; font-variant-numeric: tabular-nums; }
.s-x { color: var(--muted); }
.suggest-set .s-ok {
  margin-left: auto; appearance: none; cursor: pointer; font: inherit; font-size: .76rem;
  border: 1px solid color-mix(in srgb, var(--good) 45%, transparent); border-radius: 999px;
  background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--good-ink);
  padding: .25rem .7rem; transition: background .18s, transform .15s;
}
.suggest-set .s-ok:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 20%, transparent); transform: translateY(-1px); }
.suggest-set .s-ok:disabled { cursor: default; opacity: .8; }
.suggest-set.done { opacity: .55; }
.suggest-set.done .s-ok { border-color: transparent; background: transparent; }

.plate-hint-line { font-size: .78rem; color: var(--accent); font-variant-numeric: tabular-nums; min-height: 1.1em; }
.plate-hint { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.inline-add { display: flex; gap: .35rem; }
.inline-add .secondary-btn { flex: none; padding: .4rem .7rem; }

#settingsForm { display: flex; flex-direction: column; gap: .8rem; }
#settingsForm h3 { margin-top: .4rem; }

.prompt-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; margin-bottom: .5rem; }
.prompt-item summary { cursor: pointer; font-size: .85rem; font-weight: 550; }
.prompt-item textarea { margin-top: .6rem; font-size: .78rem; }
.prompt-actions { display: flex; gap: .5rem; margin-top: .5rem; }

.working { display: flex; align-items: center; gap: .6rem; font-size: .84rem; color: var(--text-secondary); }
.spinner {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err-box {
  font-size: .84rem; color: var(--critical);
  border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent);
  background: color-mix(in srgb, var(--critical) 8%, transparent);
  border-radius: var(--radius-sm); padding: .6rem .8rem;
}

.plan-week { margin-bottom: .8rem; }
.plan-week h4 { font-size: .82rem; color: var(--text-secondary); margin-bottom: .35rem; }

.llm-state { font-size: .82rem; padding: .45rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.llm-state.ok { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.llm-state.off { color: var(--muted); }
.auth-foot { font-size: .74rem; color: var(--muted); text-align: center; margin-top: .3rem; }

.draft-title { font-size: .92rem; }
.draft-list, .admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.draft-list li, .admin-list li {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .45rem .6rem; font-size: .82rem;
}
.draft-list li.muted, .admin-list li.muted { border-style: dashed; }
.draft-name { font-weight: 550; }
.draft-sets { color: var(--text-secondary); font-variant-numeric: tabular-nums; margin-left: auto; text-align: right; }
.admin-list li .muted { margin-left: auto; font-size: .76rem; }
.admin-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.admin-form .field { flex: 1 1 130px; }
.admin-form button { flex: none; }

.import-result { display: flex; flex-direction: column; gap: .6rem; }
.import-summary { font-size: .88rem; }
.import-list, .map-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; }
.import-list li { border-left: 2px solid var(--accent); padding: .3rem .6rem; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.import-list.err li { border-left-color: var(--critical); }
.map-list li { display: flex; align-items: center; gap: .6rem; }
.map-list select { width: auto; flex: 1 1 180px; margin-left: auto; }

.snippet {
  margin: 0; padding: .8rem 1rem; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .78rem; line-height: 1.6;
  color: var(--text-secondary);
}

@media (max-width: 560px) {
  .set-input { grid-template-columns: 1fr; }
  .modal-body { padding: 1rem; }
  .header-tools .select-inline { max-width: 130px; }
}

/* ---- Tooltip & Meldung -------------------------------------------------- */
.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: .55rem .7rem; font-size: .8rem; max-width: 260px;
  transform: translate(-50%, calc(-100% - 12px));
}
.tt-date { font-weight: 600; margin-bottom: .2rem; }
.tt-val { font-variant-numeric: tabular-nums; }
.tt-sets { color: var(--muted); font-size: .76rem; margin-top: .25rem; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 200;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--good);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: .7rem 1rem; font-size: .85rem; max-width: min(420px, calc(100vw - 2rem));
  transition: opacity .25s, transform .25s cubic-bezier(.2,.7,.2,1);
}
.toast.err { border-left-color: var(--critical); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Fußzeile ----------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0 2.5rem; margin-top: 3rem; color: var(--text-secondary); font-size: .82rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---- Einblend-Animation ------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.stagger { opacity: 0; transform: translateY(12px); }
.stagger.in { opacity: 1; transform: none; transition: opacity .5s ease var(--d, 0ms), transform .5s cubic-bezier(.2,.7,.2,1) var(--d, 0ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal, .stagger, .fade, .draw { opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; }
  .series-area.fade { opacity: .10 !important; }
}
