/* ==========================================================================
   Trainingsplan – Gestaltung
   Ruhige, neutrale Basis mit einer einzigen Akzentfarbe (Grün = erledigt).
   Hell- und Dunkelmodus folgen automatisch den Systemeinstellungen.
   ========================================================================== */

:root {
  --bg:          #fbfaf8;
  --surface:     #ffffff;
  --surface-2:   #f4f2ee;
  --border:      #e5e1d9;
  --border-soft: #eeebe4;
  --text:        #1a1917;
  --text-2:      #6b665e;
  --text-3:      #98928a;
  --accent:      #0f8a63;
  --accent-soft: #e7f4ee;
  --accent-text: #0b6e4f;
  --danger:      #b3402e;
  --shadow:      0 1px 2px rgba(26,25,23,.05), 0 8px 24px -12px rgba(26,25,23,.14);
  --radius:      14px;
  --radius-sm:   9px;
  --maxw:        760px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0d0f0e;
    --surface:     #161917;
    --surface-2:   #1e2220;
    --border:      #2a2f2c;
    --border-soft: #222624;
    --text:        #ecebe8;
    --text-2:      #9a9e99;
    --text-3:      #6e736e;
    --accent:      #35c48d;
    --accent-soft: #172b23;
    --accent-text: #57d6a3;
    --danger:      #e0705c;
    --shadow:      0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.7);
  }
}

:root[data-theme="dark"] {
  --bg:#0d0f0e; --surface:#161917; --surface-2:#1e2220; --border:#2a2f2c;
  --border-soft:#222624; --text:#ecebe8; --text-2:#9a9e99; --text-3:#6e736e;
  --accent:#35c48d; --accent-soft:#172b23; --accent-text:#57d6a3; --danger:#e0705c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.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;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- Login -- */

.gate {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 48px 16px;
}

.gate__inner {
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: rise .6s cubic-bezier(.2,.7,.3,1) both;
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.gate__title {
  margin: 0;
  font-size: clamp(34px, 9.5vw, 50px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.05;
}

.login { margin-top: 40px; text-align: left; }

.login__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.login__row { display: flex; gap: 8px; }

.login__input {
  flex: 1;
  min-width: 0;
  padding: 13px 15px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

.login__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login__btn {
  padding: 13px 22px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}

.login__btn:hover { opacity: .9; }
.login__btn:active { transform: scale(.98); }
.login__btn:disabled { opacity: .55; cursor: progress; }

.login__error {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--danger);
}

/* --------------------------------------------------------------- Topbar -- */

.app { animation: rise .45s cubic-bezier(.2,.7,.3,1) both; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar__id { display: flex; align-items: center; gap: 11px; min-width: 0; }

.topbar__dot {
  width: 9px; height: 9px; flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.topbar__title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.015em;
  white-space: nowrap;
}

.topbar__sub { margin: 0; font-size: 12px; color: var(--text-3); }

.topbar__actions { display: flex; gap: 6px; flex: none; }

.iconbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.iconbtn:hover { color: var(--text); border-color: var(--text-3); }

.iconbtn[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.iconbtn--quiet { padding: 8px 10px; }
.iconbtn--quiet span:not(.sr-only) { display: none; }

@media (max-width: 420px) {
  .iconbtn span:not(.sr-only) { display: none; }
  .iconbtn { padding: 8px 10px; }
}

/* ----------------------------------------------------------------- Hero -- */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 16px 4px;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat {
  padding: 14px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-3);
}

.progress__bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s cubic-bezier(.2,.7,.3,1);
}

.progress__text {
  margin: 9px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ------------------------------------------------------- Wochen-Navi --- */

.weeknav {
  position: sticky;
  top: 57px;
  z-index: 15;
  display: flex;
  gap: 7px;
  max-width: var(--maxw);
  margin: 18px auto 0;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
}

.weeknav::-webkit-scrollbar { display: none; }

.weektab {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

.weektab:hover { border-color: var(--text-3); color: var(--text); }

.weektab[aria-selected="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.weektab small {
  font-size: 10px;
  font-weight: 500;
  opacity: .72;
}

.weektab--done:not([aria-selected="true"]) {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ------------------------------------------------------ Wochen-Kopf ---- */

.weekhead {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 16px 6px;
}

.weekhead__label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.weekhead__focus {
  margin: 7px 0 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.35;
}

.weekhead__meta {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

/* ----------------------------------------------------------- Tageliste -- */

.days {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}

.day--today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.day--past:not(.day--today) { opacity: .62; }

.day__head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}

.day__weekday { font-size: 13px; font-weight: 650; }
.day__date { font-size: 12px; color: var(--text-3); }

.day__badge {
  margin-left: auto;
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 999px;
}

/* ------------------------------------------------------------- Einheit -- */

.unit { border-bottom: 1px solid var(--border-soft); }
.unit:last-child { border-bottom: 0; }

.unit__top {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 16px;
}

.check {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1.8px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: all .18s cubic-bezier(.2,.7,.3,1);
}

.check:hover { border-color: var(--accent); }

.check svg {
  width: 14px; height: 14px;
  stroke: #fff; stroke-width: 3;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .15s, transform .18s cubic-bezier(.3,1.4,.5,1);
}

.check[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.check[aria-checked="true"] svg { opacity: 1; transform: scale(1); }
.check:disabled { opacity: .5; cursor: wait; }

.unit__main { flex: 1; min-width: 0; }

.unit__titlerow { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }

.unit__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -.012em;
  transition: color .2s;
}

.unit--done .unit__title { color: var(--text-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }

.unit__metric {
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 999px;
  white-space: nowrap;
}

.unit__focus { margin: 5px 0 0; font-size: 13.5px; color: var(--text-2); }

.unit__time { margin: 5px 0 0; font-size: 12px; color: var(--text-3); }

.unit__tools { display: flex; gap: 4px; flex: none; }

.tool {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.tool:hover { color: var(--text); background: var(--surface-2); }
.tool svg { width: 16px; height: 16px; }

.unit__toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-text);
  background: none;
  border: 0;
  cursor: pointer;
}

.unit__toggle svg { width: 13px; height: 13px; transition: transform .2s; }
.unit__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.unit__body { padding: 0 16px 16px 53px; }

.unit__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }

.unit__list li {
  position: relative;
  padding-left: 17px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
}

.unit__list li::before {
  content: '';
  position: absolute;
  left: 3px; top: 9px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-3);
}

.unit__note {
  margin: 13px 0 0;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.day__add {
  width: 100%;
  padding: 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-top: 1px dashed var(--border);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.day__add:hover { color: var(--accent-text); background: var(--accent-soft); }

/* ---------------------------------------------------------------- Rest -- */

.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px 40px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* -------------------------------------------------------------- Dialog -- */

.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.4);
}

.modal::backdrop { background: rgba(10,12,11,.55); backdrop-filter: blur(3px); }

.modal__form { display: flex; flex-direction: column; max-height: 86svh; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.modal__title { margin: 0; font-size: 16px; font-weight: 650; }

.modal__close {
  width: 30px; height: 30px;
  font-size: 15px;
  color: var(--text-3);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.modal__close:hover { color: var(--text); background: var(--surface-2); }

.modal__body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field { display: block; }

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.field__label em { font-style: normal; font-weight: 400; color: var(--text-3); }

.field__input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field__input--area { resize: vertical; line-height: 1.55; font-size: 14px; }

.field__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }

@media (max-width: 480px) { .field__grid { grid-template-columns: 1fr; } }

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}

.modal__footRight { display: flex; gap: 9px; }

.btn {
  padding: 10px 17px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity .15s, background .15s, color .15s;
}

.btn--primary { color: #fff; background: var(--accent); }
.btn--primary:hover { opacity: .9; }

.btn--ghost { color: var(--text-2); background: transparent; border-color: var(--border); }
.btn--ghost:hover { color: var(--text); }

.btn--danger { color: var(--danger); background: transparent; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* --------------------------------------------------------------- Toast -- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  z-index: 60;
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--bg);
  background: var(--text);
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}

.toast--show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
