/* =========================================================
   AngelsPlan – Design-System
   ========================================================= */
:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e9e9f1;
  --border: #e5e5ee;
  --border-strong: #d4d4e0;
  --text: #11121c;
  --text-2: #565870;
  --text-3: #8b8da3;
  --accent: #6d4aff;
  --accent-hover: #5b38f0;
  --accent-soft: #efeaff;
  --accent-text: #5634e8;
  --on-accent: #ffffff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --heat-1: #bbf7d0;
  --heat-3: #16a34a;
  --brand: linear-gradient(135deg, #8b5cf6 0%, #ec4899 55%, #f97316 100%);
  --shadow-sm: 0 1px 2px rgba(16, 17, 30, .05);
  --shadow-md: 0 4px 16px -4px rgba(16, 17, 30, .08), 0 1px 3px rgba(16, 17, 30, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 17, 30, .25);
  --radius-lg: 16px;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b12; --surface: #14141d; --surface-2: #1b1b27; --surface-3: #242433;
    --border: #262635; --border-strong: #34344a;
    --text: #ececf3; --text-2: #a4a5ba; --text-3: #6e7087;
    --accent: #8b74ff; --accent-hover: #9d8aff; --accent-soft: #241f45; --accent-text: #b3a5ff; --on-accent: #ffffff;
    --success: #22c55e; --success-soft: #0f2e1c; --warning: #f59e0b; --warning-soft: #33250b;
    --danger: #f87171; --danger-soft: #3a1416; --info: #38bdf8; --info-soft: #0c2a3a;
    --heat-1: #14532d; --heat-3: #22c55e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 16px -4px rgba(0,0,0,.5);
    --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b12; --surface: #14141d; --surface-2: #1b1b27; --surface-3: #242433;
  --border: #262635; --border-strong: #34344a;
  --text: #ececf3; --text-2: #a4a5ba; --text-3: #6e7087;
  --accent: #8b74ff; --accent-hover: #9d8aff; --accent-soft: #241f45; --accent-text: #b3a5ff; --on-accent: #ffffff;
  --success: #22c55e; --success-soft: #0f2e1c; --warning: #f59e0b; --warning-soft: #33250b;
  --danger: #f87171; --danger-soft: #3a1416; --info: #38bdf8; --info-soft: #0c2a3a;
  --heat-1: #14532d; --heat-3: #22c55e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 16px -4px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; transition: background-color .2s, color .2s;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; height: 44px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  display: inline-grid; place-items: center; color: var(--text-2); padding: 0; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.error { color: var(--danger); font-size: 13px; min-height: 20px; margin: -4px 0 12px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-brand { display: none; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.auth-theme { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; }
.auth-card { width: 100%; max-width: 400px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo img { width: 44px; height: 44px; border-radius: 12px; }
.logo .name { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.logo .by { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; margin: 32px 0 6px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 24px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; height: 34px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-card .segmented { margin-bottom: 24px; }
.auth-note { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-3); }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth-brand {
    display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff;
    background: radial-gradient(800px 500px at 0% 0%, rgba(255,255,255,.18), transparent 60%), var(--brand);
  }
  .auth-brand .logo .by { color: rgba(255,255,255,.75); }
  .auth-brand h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin: 0 0 16px; max-width: 460px; }
  .auth-brand p { font-size: 17px; opacity: .92; max-width: 440px; margin: 0 0 32px; }
  .features { display: grid; gap: 14px; }
  .feature { display: flex; gap: 12px; align-items: center; font-weight: 600; }
  .feature .tile { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
  .auth-brand small { opacity: .75; }
  .auth-main .logo { display: none; }
  .auth-card h1 { margin-top: 0; }
}

/* ---------- App-Layout ---------- */
.sidebar { display: none; }
.content { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1000px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; margin: 0 -16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--border);
}
.topbar .logo { gap: 10px; }
.topbar .logo img { width: 32px; height: 32px; border-radius: 9px; }
.topbar .logo .name { font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; background: var(--brand); color: #fff;
  font-weight: 700; font-size: 14px; display: grid; place-items: center; flex: none;
}
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill-warn { background: var(--warning-soft); color: var(--warning); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--border);
}
.tabbar button { border: 0; background: transparent; display: grid; justify-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--text-3); border-radius: 10px; }
.tabbar button .ic { width: 22px; height: 22px; }
.tabbar button.active { color: var(--accent-text); }

.fab {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25;
  width: 56px; height: 56px; border-radius: 16px; border: 0; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.fab .ic { width: 24px; height: 24px; }
.desk-only { display: none !important; }

@media (min-width: 960px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
    padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--border);
  }
  .sidebar .logo { padding: 4px 8px 24px; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav button {
    display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; text-align: left;
  }
  .side-nav button:hover { background: var(--surface-2); color: var(--text); }
  .side-nav button.active { background: var(--accent-soft); color: var(--accent-text); }
  .side-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 22px 12px 8px; }
  .side-cats { display: grid; gap: 2px; overflow-y: auto; align-content: start; }
  .side-cats button { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 14px; text-align: left; }
  .side-cats button:hover { background: var(--surface-2); color: var(--text); }
  .side-cats .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
  .side-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
  .user-btn { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; width: 100%; }
  .user-btn:hover { background: var(--surface-2); }
  .user-btn .meta { min-width: 0; flex: 1; }
  .user-btn b { display: block; font-size: 14px; }
  .user-btn small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { margin-left: var(--sidebar); }
  .content { padding: 32px 40px 48px; }
  .topbar, .tabbar, .fab { display: none !important; }
  .desk-only { display: inline-flex !important; }
}

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 24px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -.025em; margin: 0; line-height: 1.2; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; align-items: center; }
@media (min-width: 960px) { .page-head { margin-top: 0; } .page-head h1 { font-size: 30px; } }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); min-height: 56px; }
.card-head h2 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h2 .ic { color: var(--text-3); }
.card-head .sub { font-size: 13px; color: var(--text-3); font-weight: 500; }
.stack { display: grid; gap: 16px; align-content: start; }
.dash { display: grid; gap: 16px; }
@media (min-width: 960px) { .dash { grid-template-columns: 1.4fr 1fr; align-items: start; } }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } .kpis.three { grid-template-columns: repeat(3, 1fr); } }
.kpis.three > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 720px) { .kpis.three > :last-child:nth-child(odd) { grid-column: auto; } }
.kpi { padding: 16px; display: grid; gap: 10px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .lbl { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.kpi .val small { font-size: 15px; color: var(--text-3); font-weight: 600; }
.tile { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.tile .ic { width: 17px; height: 17px; }
.t-accent { background: var(--accent-soft); color: var(--accent-text); }
.t-success { background: var(--success-soft); color: var(--success); }
.t-warning { background: var(--warning-soft); color: var(--warning); }
.t-info { background: var(--info-soft); color: var(--info); }
.t-danger { background: var(--danger-soft); color: var(--danger); }

.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--accent); transition: width .35s ease; }
.progress.success > div { background: var(--success); }
.progress-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.progress-row .progress { flex: 1; }
.progress-row b { color: var(--text); }

/* ---------- Listen & Aufgaben ---------- */
.rows > * + * { border-top: 1px solid var(--border); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; transition: background .12s; }
.task:hover { background: var(--surface-2); }
.check {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; padding: 0; display: grid; place-items: center;
  border: 2px solid var(--c, var(--border-strong)); background: transparent; color: #fff; transition: background .15s, transform .1s;
}
.check:hover { background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); }
.check:active { transform: scale(.9); }
.check .ic { width: 13px; height: 13px; stroke-width: 3; opacity: 0; }
.done .check { background: var(--c, var(--success)); border-color: var(--c, var(--success)); }
.done .check .ic { opacity: 1; }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.t-title { font-weight: 550; overflow-wrap: anywhere; }
.done .t-title { color: var(--text-3); text-decoration: line-through; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.empty { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 36px 20px; color: var(--text-3); font-size: 14px; }
.empty .tile { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); color: var(--text-3); margin-bottom: 6px; }
.empty .tile .ic { width: 22px; height: 22px; }
.empty b { color: var(--text); font-weight: 600; }

/* Wochenplaner */
.weeknav { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.weeknav .label { flex: 1; font-weight: 650; font-size: 14px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 12px; }
.day {
  border: 0; background: transparent; border-radius: 12px; padding: 8px 0 7px; display: grid; justify-items: center; gap: 2px;
  font-size: 11.5px; font-weight: 600; color: var(--text-3); transition: background .12s;
}
.day:hover { background: var(--surface-2); }
.day b { font-size: 17px; font-weight: 700; color: var(--text); }
.day.today b { color: var(--accent-text); }
.day.active { background: var(--accent); color: color-mix(in srgb, var(--on-accent) 80%, transparent); }
.day.active b { color: var(--on-accent); }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.day.active .dots i { background: var(--on-accent); opacity: .85; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; margin: 0 -2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface)); color: var(--text); }
.chip-wrap { flex-wrap: wrap; overflow: visible; margin: 0; }

/* ---------- Kategorien ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 480px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
.cat {
  position: relative; overflow: hidden; text-align: left; padding: 18px; display: grid; gap: 14px; cursor: pointer;
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.cat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.cat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.cat .emo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.cat b { display: block; font-size: 15px; overflow-wrap: anywhere; }
.cat small { color: var(--text-3); font-size: 13px; }
.cat .bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.cat .bar div { height: 100%; background: var(--c); border-radius: 99px; }
.cat.add { border-style: dashed; box-shadow: none; justify-items: center; align-content: center; text-align: center; color: var(--text-2); min-height: 160px; background: transparent; }
.cat.add::before { display: none; }
.cat.add .emo { background: var(--surface-2); color: var(--text-2); }

.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; font-size: 18px; padding: 0; }
.emoji-grid button:hover { background: var(--surface-2); }
.emoji-grid button.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
@media (max-width: 480px) { .emoji-grid { grid-template-columns: repeat(6, 1fr); } .swatches { grid-template-columns: repeat(6, 1fr); } }
.preview { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 18px; }
.preview .emo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.preview b { flex: 1; }
.color-input { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.color-input input { width: 36px; height: 28px; border: 1px solid var(--border); border-radius: 6px; padding: 0; background: none; }

/* ---------- Training ---------- */
.plan-bar { display: flex; gap: 6px; align-items: center; }
.plan-bar select { min-width: 0; width: 220px; }
@media (max-width: 600px) { .page-head .actions.plan-bar { width: 100%; } .plan-bar select { flex: 1; width: auto; } }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.weekdays button {
  position: relative; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 650; font-size: 13px; color: var(--text-2); box-shadow: var(--shadow-sm); padding: 0;
}
.weekdays button:hover { border-color: var(--border-strong); color: var(--text); }
.weekdays button.has::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--success); }
.weekdays button.today { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.weekdays button.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.weekdays button.active::after { background: var(--bg); }
.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; }
.day-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.day-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.ex { display: flex; align-items: center; gap: 14px; padding: 14px 20px; }
.ex:hover { background: var(--surface-2); }
.ex .num { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); flex: none; }
.ex .body { flex: 1; min-width: 0; cursor: pointer; }
.ex .stats-inline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.ex .check { --c: var(--success); width: 26px; height: 26px; margin: 0; }
.ex.done .num { background: var(--success-soft); color: var(--success); border-color: transparent; }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat .h { font-size: 11px; font-weight: 600; color: var(--text-3); text-align: center; }
.heat .c { aspect-ratio: 1; max-height: 44px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 11px; color: var(--text-3); }
.heat .c.l1 { background: var(--heat-1); border-color: transparent; color: var(--text); }
.heat .c.l2 { background: var(--heat-3); border-color: transparent; color: #fff; }
.heat .c.today { box-shadow: 0 0 0 2px var(--accent); }
.heat .c.future { opacity: .4; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-top: 14px; flex-wrap: wrap; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); }
.legend i.l1 { background: var(--heat-1); border: 0; } .legend i.l2 { background: var(--heat-3); border: 0; }
.legend span + i { margin-left: 8px; }
.today-train { display: flex; gap: 14px; align-items: center; padding: 18px 20px; cursor: pointer; }
.today-train:hover { background: var(--surface-2); }
.today-train .tile { width: 44px; height: 44px; border-radius: 12px; }
.today-train .grow { flex: 1; min-width: 0; }
.today-train b { display: block; }
.today-train .progress { margin-top: 10px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(8, 8, 16, .5); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { width: 100%; max-width: 540px; max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); animation: up .2s ease-out; }
.modal form { display: contents; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 20px 20px; }
.modal-foot .spacer { flex: 1; }
@media (min-width: 640px) { .modal-back { align-items: center; padding: 24px; } .modal { border-radius: 20px; } .modal-foot { padding-bottom: 14px; } }
@media (max-width: 639px) { .modal-foot { border-radius: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Menü & Toast ---------- */
.menu {
  position: fixed; z-index: 50; top: calc(58px + env(safe-area-inset-top)); right: 12px; width: 264px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; animation: fade .12s;
}
@media (min-width: 960px) { .menu { top: auto; right: auto; left: 14px; bottom: 76px; width: calc(var(--sidebar) - 28px); } }
.menu .who { padding: 10px 10px 12px; }
.menu .who b { display: block; }
.menu .who small { color: var(--text-3); overflow-wrap: anywhere; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 14px; color: var(--text); }
.menu .item .ic { color: var(--text-3); }
.menu .item:hover { background: var(--surface-2); }
.menu .item.danger, .menu .item.danger .ic { color: var(--danger); }
.menu .theme { padding: 6px 4px 8px; }
.menu .theme .label { display: block; padding: 0 6px 6px; font-size: 12px; }

#toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 80; transform: translate(-50%, 12px);
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 960px) { #toast { left: auto; right: 24px; bottom: 24px; transform: translateY(12px); } #toast.show { transform: none; } }

/* ---------- Überlauf-Schutz & mobile Feinheiten ---------- */
.dash > *, .stack > *, .kpis > * { min-width: 0; }
.day-head { flex-wrap: wrap; }
.day-head > div:first-child { min-width: 0; flex: 1 1 180px; }
@media (max-width: 480px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .topbar { padding-left: 12px; padding-right: 12px; margin: 0 -12px; }
  .task, .ex, .progress-row, .card-head { padding-left: 16px; padding-right: 16px; }
  .day-head { padding: 16px 16px 12px; }
  .kpi .val { font-size: 22px; }
}
.side-foot, .user-btn { min-width: 0; }
.user-btn .meta { overflow: hidden; }
.user-btn > .ic { color: var(--text-3); }
@media (max-width: 480px) {
  .kpi { padding: 14px; gap: 6px; }
  .kpi .tile { width: 28px; height: 28px; }
  .kpi .lbl { font-size: 12.5px; line-height: 1.3; }
}

/* =========================================================
   Training: Workout, Pausen-Timer, Verlauf, Vorlagen
   ========================================================= */
.ic-xs { width: 12px; height: 12px; }
.small { font-size: 13px; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.next { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.next .ic { width: 14px; height: 14px; }
.next.up { color: var(--success); }
.next.down { color: var(--warning); }
.next.start { color: var(--accent-text); }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); }
.today-train { cursor: default; }
.today-train:hover { background: transparent; }
.today-train .muted { display: block; }
.active-banner { display: flex; align-items: center; gap: 14px; padding: 14px 20px; margin-bottom: 16px; border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.active-banner .grow { flex: 1; min-width: 0; }
.active-banner b { display: block; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.weekdays button .ic { position: absolute; top: 4px; right: 4px; width: 11px; height: 11px; color: var(--success); stroke-width: 3; }
.weekdays button.active .ic { color: var(--bg); }
.live-timer { font-variant-numeric: tabular-nums; }

.wk { max-width: 780px; padding-bottom: 72px; }
.wk-sum { display: flex; align-items: center; gap: 24px; padding: 14px 20px; margin-bottom: 16px; }
.wk-sum span { display: block; font-size: 12px; color: var(--text-3); }
.wk-sum b { font-size: 20px; font-variant-numeric: tabular-nums; }
.wk-sum b small { font-size: 13px; color: var(--text-3); }
.wk-sum .grow { flex: 1; }
.wk-title { min-width: 0; }
.wk-title h2 { font-size: 16px; }
.wk-title .sub { display: block; margin-top: 1px; }
.sets { padding: 8px 12px 2px; }
.set { display: grid; grid-template-columns: 34px minmax(0, 1fr) 76px 64px 36px; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 10px; transition: background .15s; }
.sets.nw .set { grid-template-columns: 34px minmax(0, 1fr) 84px 36px; }
.set.head { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; padding-bottom: 2px; }
.set.head span:nth-child(n+3) { text-align: center; }
.set .no { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); }
.set .prev { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.set-in { height: 36px; padding: 0 4px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.set .check { --c: var(--success); width: 34px; height: 34px; border-radius: 9px; margin: 0; justify-self: end; }
.set .check .ic { width: 16px; height: 16px; }
.set.done { background: var(--success-soft); }
.set.done .set-in { background: transparent; border-color: transparent; box-shadow: none; }
.set.done .no { background: var(--success); color: #fff; }
.wk-foot { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 12px 12px; }
.btn-dashed { margin-top: 16px; border-style: dashed; box-shadow: none; background: transparent; color: var(--text-2); }

.restbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 35; max-width: 560px; margin: 0 auto;
  background: var(--text); color: var(--bg); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); animation: up .2s ease-out;
}
@media (min-width: 960px) { .restbar { left: calc(var(--sidebar) + 40px); right: 40px; bottom: 24px; } }
.rb-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 55%, transparent); transition: width .25s linear; }
.rb-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; }
.rb-row b { font-size: 19px; font-variant-numeric: tabular-nums; margin-right: auto; }
.restbar .btn { background: color-mix(in srgb, var(--bg) 18%, transparent); border-color: transparent; color: inherit; box-shadow: none; }
.restbar .btn-primary { background: var(--accent); color: #fff; }

.sess-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 20px; border: 0; background: transparent; text-align: left; color: inherit; }
.sess-row:hover { background: var(--surface-2); }
.sess-row .grow { flex: 1; min-width: 0; }
.sess-row b { display: block; font-size: 14px; }
.sess-row small { color: var(--text-3); }
.sess-row > .ic { color: var(--text-3); }

.celebrate { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--brand); color: #fff; margin-bottom: 16px; }
.celebrate > .ic { width: 34px; height: 34px; flex: none; }
.celebrate b { display: block; font-size: 16px; }
.celebrate span { display: block; font-size: 13px; opacity: .9; }
.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.sum-grid.two { grid-template-columns: 1fr 1fr; }
.sum-grid div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.sum-grid span { display: block; font-size: 12px; color: var(--text-3); }
.sum-grid b { font-size: 17px; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .sum-grid { grid-template-columns: 1fr 1fr; } }
.pr-list { display: grid; gap: 6px; margin-bottom: 12px; }
.pr-list div { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--warning-soft); font-size: 14px; }
.pr-list .ic { color: var(--warning); }
.sum-ex > div { padding: 10px 0; border-top: 1px solid var(--border); }
.sum-ex b { display: block; font-size: 14px; }
.sum-ex span { font-size: 13px; color: var(--text-2); }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart text { fill: var(--text-3); font-size: 9px; font-family: inherit; }

.tpl-list { display: grid; gap: 8px; }
.tpl { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.tpl:hover { border-color: var(--border-strong); }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tpl input { margin-top: 4px; accent-color: var(--accent); }
.tpl b { display: block; }
.tpl small { display: block; color: var(--text-2); font-size: 13px; }
.tpl em { display: block; font-style: normal; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.checkline { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text-2); margin-top: 14px; }
.checkline input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 12.5px; color: var(--text-3); }
.hint .ic { margin-top: 2px; color: var(--success); }
@media (max-width: 480px) {
  .set { grid-template-columns: 30px minmax(0, 1fr) 64px 52px 34px; gap: 6px; padding: 5px 4px; }
  .sets.nw .set { grid-template-columns: 30px minmax(0, 1fr) 72px 34px; }
  .sets { padding: 8px 8px 2px; }
  .wk-sum { gap: 16px; padding: 12px 16px; }
}
.set-in::placeholder { color: var(--text-3); font-weight: 600; opacity: 1; }
