/* === SUPERCOACH DASHBOARD — Pico CSS Overrides & Extensions === */

/* ─── Pico Variable Overrides ─────────────────────────────────────── */
:root {
  --pico-background-color: #F8F9FA;
  --pico-color: #1e293b;
  --pico-text-selection-color: rgba(45, 106, 79, 0.15);
  --pico-primary: #2D6A4F;
  --pico-primary-background: #2D6A4F;
  --pico-primary-border: #2D6A4F;
  --pico-primary-underline: rgba(45, 106, 79, 0.5);
  --pico-primary-hover: #1B4332;
  --pico-primary-hover-background: #1B4332;
  --pico-primary-hover-border: #1B4332;
  --pico-primary-focus: rgba(45, 106, 79, 0.25);
  --pico-primary-inverse: #fff;
  --pico-secondary: #495057;
  --pico-secondary-background: #e9ecef;
  --pico-secondary-border: #dee2e6;
  --pico-secondary-hover: #343a40;
  --pico-secondary-hover-background: #dee2e6;
  --pico-secondary-hover-border: #ced4da;
  --pico-card-background-color: #fff;
  --pico-card-sectioning-background-color: #fff;
  --pico-card-border-color: transparent;
  --pico-muted-color: #868e96;
  --pico-muted-border-color: #dee2e6;

  /* Eigene Layout-Variablen */
  --accent: #2D6A4F;
  --accent-hover: #1B4332;
  --accent-bg: rgba(45, 106, 79, 0.1);
  --accent-bg-hover: rgba(45, 106, 79, 0.15);
  --bg-primary: #F8F9FA;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f5;
  --text-primary: #1e293b;
  --text-secondary: #495057;
  --text-muted: #868e96;
  --border: #dee2e6;
  --border-hover: #ced4da;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
  --transition: all 0.2s ease;
}

/* ─── Layout ──────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
}

/* ─── Top Navigation ──────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: var(--shadow);
}

.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo { font-size: 24px; line-height: 1; }

.brand-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.top-nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav-menu::-webkit-scrollbar { display: none; }

.top-nav-menu .nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: var(--transition);
  user-select: none;
}

.top-nav-menu .nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.top-nav-menu .nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.top-nav-right {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Mobile Hamburger */
.top-nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
}

.top-nav-page-title { display: none; }

.top-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: var(--transition);
}

.top-nav-mobile {
  display: none;
  position: fixed;
  top: 56px; left: 0; right: 0;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 8px;
  flex-direction: column;
  gap: 2px;
  z-index: 99;
  box-shadow: var(--shadow);
}

.top-nav-mobile.open { display: flex; }

.top-nav-mobile .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.top-nav-mobile .nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.top-nav-mobile .nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ─── Content ─────────────────────────────────────────────────────── */
.content {
  padding: 80px 28px 24px;
  background: var(--bg-primary);
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ─── Metrics ─────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.metric-card:hover {
  box-shadow: var(--shadow-hover);
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  flex-shrink: 0;
}

.metric-icon svg { width: 20px; height: 20px; }

.metric-info { display: flex; flex-direction: column; }

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-unit {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Dashboard Widgets ───────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-widget {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.widget-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.widget-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 0;
  text-align: center;
}

.widget-list { list-style: none; }

.widget-list-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.widget-list-item:last-child { border-bottom: none; }

.widget-list-item .label { color: var(--text-secondary); }
.widget-list-item .value { color: var(--text-primary); font-weight: 500; }

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.quick-action-btn:hover {
  background: var(--border-hover);
  color: var(--text-primary);
}

/* ─── Cards (Pico override) ───────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ─── Forms ───────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.tracking-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Range Slider override */
input[type="range"] {
  accent-color: var(--accent);
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  padding: 10px 18px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--border-hover);
  color: var(--text-primary);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  opacity: 0.6;
  transition: var(--transition);
}

.btn-icon:hover { opacity: 1; }

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Chips ───────────────────────────────────────────────────────── */
.computed-chips {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.chip {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
  min-width: 80px;
}

.chip-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chip-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Heute Training Chips */
.heute-training-chip {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px;
}

.heute-training-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.heute-training-fokus {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ─── Tabs ────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab-btn {
  padding: 6px 14px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 500;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Tables ──────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td { border-bottom: none; }

/* Spaltenausrichtung: Übung (1) linksbündig, Sätze/Wdh./Gewicht/Pause/RPE (2–6) zentriert */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
  text-align: left !important;
}

.data-table th:nth-child(n+2):nth-child(-n+6),
.data-table td:nth-child(n+2):nth-child(-n+6) {
  text-align: left !important;
}

/* ─── Charts ──────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 250px;
  margin-top: 12px;
}

.chart-placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* Fix for Chart.js infinite growth when no data */
.dashboard-widget canvas {
  max-height: 250px;
}

/* ─── Alerts ──────────────────────────────────────────────────────── */
.alert-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #c92a2a;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.alert-info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.range-value {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

/* ─── Session Cards ───────────────────────────────────────────────── */
.session-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}

.session-card.completed {
  border-left-color: var(--accent);
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.session-date { font-weight: 600; font-size: 13px; }

.session-type {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
}

.session-status { font-size: 14px; }

.session-details {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Stats Row ───────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-item {
  text-align: center;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── PR Items ────────────────────────────────────────────────────── */
.pr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}

.pr-type { font-weight: 600; font-size: 13px; }
.pr-value { font-size: 14px; font-weight: 700; color: var(--accent); }
.pr-date { font-size: 11px; color: var(--text-muted); }

/* ─── Test History ────────────────────────────────────────────────── */
.test-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.test-history-item:last-child { border-bottom: none; }

.test-date { color: var(--text-muted); width: 80px; }
.test-type { flex: 1; font-weight: 500; }
.test-result { font-weight: 600; color: var(--accent); }

/* ─── Leistungsübersicht ──────────────────────────────────────────── */

/* Per-category color tokens */
.leistung-category[data-cat="kraft"]        { --cat-color: #2D6A4F; --cat-bg: rgba(45,106,79,0.07); --cat-bg-strong: rgba(45,106,79,0.13); }
.leistung-category[data-cat="ausdauer"]     { --cat-color: #1d6fcf; --cat-bg: rgba(29,111,207,0.07); --cat-bg-strong: rgba(29,111,207,0.13); }
.leistung-category[data-cat="calisthenics"] { --cat-color: #c97a00; --cat-bg: rgba(201,122,0,0.07); --cat-bg-strong: rgba(201,122,0,0.13); }
.leistung-category[data-cat="koerper"]      { --cat-color: #6d3ebd; --cat-bg: rgba(109,62,189,0.07); --cat-bg-strong: rgba(109,62,189,0.13); }

.leistung-category {
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.leistung-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  background: var(--cat-bg);
  border: none;
  border-left: 4px solid var(--cat-color);
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  transition: background 0.15s ease;
}
.leistung-cat-header:hover { background: var(--cat-bg-strong); }

.leistung-cat-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leistung-cat-emoji { font-size: 16px; line-height: 1; }

.leistung-cat-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--cat-color);
  letter-spacing: 0.01em;
}

.leistung-cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--cat-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  line-height: 1;
}

.leistung-cat-chevron {
  font-size: 11px;
  color: var(--cat-color);
  opacity: 0.7;
}

.leistung-cat-body { background: var(--bg-secondary); }

.leistung-empty {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.leistung-row {
  display: grid;
  grid-template-columns: 1fr auto 72px 28px;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 20px;
  border-top: 1px solid var(--border);
  transition: background 0.12s ease;
  cursor: default;
}
.leistung-row:hover { background: var(--cat-bg); }

.leistung-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.leistung-pr {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 3px 10px;
  background: var(--cat-bg-strong);
  color: var(--cat-color);
  font-size: 13px;
  font-weight: 700;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid var(--cat-bg-strong);
}

.leistung-unit {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.75;
}

.leistung-date {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.leistung-trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.leistung-trend[data-trend="up"]      { background: rgba(45,106,79,0.12);  color: #2D6A4F; }
.leistung-trend[data-trend="down"]    { background: rgba(201,42,42,0.1);   color: #c92a2a; }
.leistung-trend[data-trend="neutral"] { background: rgba(134,142,150,0.1); color: var(--text-muted); }

@media (max-width: 480px) {
  .leistung-row { grid-template-columns: 1fr auto 28px; }
  .leistung-date { display: none; }
}

/* ─── Widget List Container ───────────────────────────────────────── */
.widget-list-container {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 16px;
}

/* ─── Error Banner ────────────────────────────────────────────────── */
.error-banner {
  display: none;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-sm);
  color: #c92a2a;
  font-size: 13px;
  margin-bottom: 16px;
}

.error-banner.visible { display: block; }

/* ─── Plan Parser ─────────────────────────────────────────────────── */
.plan-day {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.plan-day-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.plan-day-fokus {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 8px;
}

.plan-uebung {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.plan-uebung:last-child { border-bottom: none; }

/* ─── Wochenkacheln ───────────────────────────────────────────────── */
.wochen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.wochen-kachel {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: var(--transition);
  min-width: 0;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.wochen-kachel:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.wochen-kachel.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.woche-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.woche-phase {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Loading & Spinner ───────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 249, 250, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-overlay.active { display: flex; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pdf-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 249, 250, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  gap: 16px;
}

.pdf-loading-overlay.active { display: flex; }

/* ─── Tage-Grid (7-Tage-Übersicht) ──────────────────────────────── */
.tage-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.tage-kachel {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: var(--transition);
  min-height: 100px;
}

.tage-kachel:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.tage-kachel.rest-day {
  background: var(--bg-tertiary);
  opacity: 0.7;
}

.tage-kachel.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.tage-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tage-fokus {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.tage-uebungen {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ─── Modal (Tag-Details) ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-content {
  background: #fff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px;
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Navigation */
  .top-nav-menu { display: none; }
  .top-nav-toggle { display: flex; order: -1; }
  .top-nav-right { display: none; }
  .top-nav-brand { display: none; }
  .top-nav-page-title {
    display: block;
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Layout */
  .content { padding: 72px 16px 16px; }
  .metrics-grid { grid-template-columns: 1fr; width: 100%; box-sizing: border-box; }
  .metric-card { min-width: 0; width: 100%; box-sizing: border-box; }
  .metric-card > div { min-width: 0; overflow: hidden; }
  .metric-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Grids */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .tracking-form-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }

  /* Tage-Grid: 7 → 3 Spalten */
  .tage-grid { grid-template-columns: repeat(3, 1fr); }

  /* Plan-Bereich: kein horizontales Scrollen, linksbündig */
  #tages-content, #plan-roh-content { overflow-x: hidden; text-align: left; }
  #plan-roh-content * { text-align: left !important; }
  #tages-content .data-table,
  #plan-roh-content .data-table { width: 100%; table-layout: fixed; word-break: break-word; }

  /* Vorheriger/Heute/Nächster stapeln */
  .plan-nav-buttons { flex-direction: column !important; width: 100%; }
  .plan-nav-buttons .btn-secondary { width: 100%; }

  /* Touch-freundliche Mindesthöhe (WCAG 2.5.5: 44px) */
  .btn-primary,
  .btn-secondary,
  .quick-action-btn,
  .tab-btn,
  .btn-save-all { min-height: 44px; }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  input[type="email"],
  select { min-height: 44px; }

  /* Charts */
  .chart-container { height: 200px; }
  .dashboard-widget canvas { max-height: 200px; }

  /* Tabellen → Karten-Layout */
  .table-wrapper,
  .table-responsive { overflow-x: visible; }

  .data-table thead { display: none; }

  .data-table tbody tr {
    display: block;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 4px 0;
    text-align: left;
    font-size: 13px;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-right: 8px;
    flex-shrink: 0;
    text-align: left;
  }

  /* Aktions-Spalte (Löschen-Button) ohne Label */
  .data-table td[data-label=""] {
    justify-content: flex-end;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }
  .data-table td[data-label=""]::before { display: none; }

  /* Desktop-Ausrichtung für alle Spalten auf Mobile aufheben */
  .data-table th:nth-child(n+2):nth-child(-n+6),
  .data-table td:nth-child(n+2):nth-child(-n+6) {
    text-align: left !important;
  }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .tage-grid { grid-template-columns: repeat(2, 1fr); }
  .wochen-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* ─── Print ───────────────────────────────────────────────────────── */
@media print {
  .top-nav, .action-row, .btn-primary, .btn-secondary { display: none !important; }
  .content { padding: 0; }
  .card { break-inside: avoid; }
}

/* === RPE BUTTONS === */
.rpe-btn-group {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  margin-top: 4px;
}

.rpe-btn {
  min-height: 44px;
  flex: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
}

.rpe-btn.rpe-green {
  background: rgba(45, 106, 79, 0.1);
  color: #2D6A4F;
  border-color: rgba(45, 106, 79, 0.2);
}
.rpe-btn.rpe-green:hover,
.rpe-btn.rpe-green.active {
  background: #2D6A4F;
  color: #fff;
  border-color: #2D6A4F;
}

.rpe-btn.rpe-orange {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.2);
}
.rpe-btn.rpe-orange:hover,
.rpe-btn.rpe-orange.active {
  background: #f59e0b;
  color: #fff;
  border-color: #f59e0b;
}

.rpe-btn.rpe-red {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.2);
}
.rpe-btn.rpe-red:hover,
.rpe-btn.rpe-red.active {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* === PLAN NOTE HINT === */
.ex-note-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
  letter-spacing: 0.1px;
}

/* === EXERCISE ACCORDION === */
.ex-accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ex-accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
  transition: border-color 0.15s;
}

.ex-accordion-item.open {
  border-color: var(--accent);
}

.ex-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
  transition: background 0.15s;
}

.ex-accordion-header:hover {
  background: var(--bg-tertiary);
}

.ex-accordion-info {
  flex: 1;
  min-width: 0;
}

.ex-accordion-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-accordion-summary {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-accordion-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ex-accordion-chevron {
  font-size: 10px;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  display: inline-block;
  transition: transform 0.2s ease;
}

.ex-accordion-item.open .ex-accordion-chevron {
  transform: rotate(180deg);
}

.ex-accordion-panel {
  display: none;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.ex-accordion-item.open .ex-accordion-panel {
  display: block;
}

.ex-accordion-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.ex-accordion-save {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .ex-accordion-fields { grid-template-columns: repeat(2, 1fr); }
}

/* === EXERCISE EDIT MODE === */
.ex-edit-input {
  width: 100%;
  min-width: 48px;
  padding: 2px 6px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
}

/* === SAVE-ALL BUTTON === */
.btn-save-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 16px;
  background: #2D6A4F;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save-all:hover { opacity: 0.85; }

/* === MONITORING === */
.mon-baseline-card {
  font-size: 14px;
  color: var(--text-muted);
  padding: 8px 0;
}
.mon-baseline-card strong { color: var(--text); font-size: 16px; }
.mon-baseline-date { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.mon-baseline-empty { font-style: italic; }

.mon-hrv-preview {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-height: 36px;
}

.mon-status-cell { font-size: 18px; text-align: center; }
.mon-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.mon-delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.08); }
.mon-empty { text-align: center; color: var(--text-muted); font-style: italic; padding: 20px 0; }

/* Dashboard HRV Widget */
.metric-icon.hrv { background: rgba(99,102,241,0.15); color: #6366f1; }
.mon-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  flex-wrap: wrap;
  margin-top: 2px;
}
.mon-widget-emoji { font-size: 20px; line-height: 1; }
.mon-widget-label { font-weight: 500; font-size: 12px; color: var(--text-muted); }
.mon-widget-rmssd { font-size: 11px; color: var(--text-muted); width: 100%; }

/* ─── Landscape Phone (Querformat) ───────────────────────────────── */
/* Phones im Landscape: Breite ~667–932px, Höhe ~375–430px → max-height 500px trifft nur Phones */
@media (orientation: landscape) and (max-height: 500px) {
  .top-nav-menu { display: none; }
  .top-nav-toggle { display: flex; order: -1; }
  .top-nav-right { display: none; }
  .top-nav-page-title {
    display: block;
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* === BOTTOM NAVIGATION === */
.bottom-nav,
.bottom-nav-overlay { display: none; }

@media (max-width: 768px) {
  /* Content bekommt Platz für die Bottom Nav */
  .content { padding-bottom: 70px; }

  /* Bottom Nav Bar */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 58px;
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 98;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    padding: 6px 4px 4px;
    transition: color 0.15s;
    user-select: none;
    background: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item.active {
    color: var(--accent);
  }

  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
  }

  .bottom-nav-icon {
    font-size: 18px;
    line-height: 1;
  }

  .bottom-nav-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
  }

  /* Mehr-Overlay */
  .bottom-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .bottom-nav-overlay.open {
    pointer-events: auto;
    opacity: 1;
  }

  .bottom-nav-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
  }

  .bottom-nav-overlay-panel {
    position: absolute;
    bottom: 58px; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 16px 8px;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    max-height: 60vh;
    overflow-y: auto;
  }

  .bottom-nav-overlay.open .bottom-nav-overlay-panel {
    transform: translateY(0);
  }

  .bottom-nav-overlay-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  .bottom-nav-overlay-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    user-select: none;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-overlay-item:last-child { border-bottom: none; }
  .bottom-nav-overlay-item:active { background: var(--bg-tertiary); }
}

/* === PLAN TODAY CARD (Fix 3) === */
.plan-today-card,
.last-training-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  margin-bottom: 10px;
  overflow: hidden;
}

.plan-today-summary,
.last-training-summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border);
}

.plan-today-summary::-webkit-details-marker,
.last-training-summary::-webkit-details-marker { display: none; }

.plan-today-summary::after,
.last-training-summary::after {
  content: '▼';
  font-size: 10px;
  margin-left: auto;
  opacity: 0.5;
  transition: transform 0.2s;
}

details.plan-today-card:not([open]) .plan-today-summary::after,
details.last-training-card:not([open]) .last-training-summary::after {
  transform: rotate(-90deg);
}

.plan-today-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.plan-today-table th {
  text-align: left;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.plan-today-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.plan-today-table tr:last-child td { border-bottom: none; }

.last-training-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* === RPE DOT (Fix 4) === */
.rpe-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* === PLAN REST HINT (Fix 2) === */
.plan-rest-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #2D6A4F;
  font-weight: 500;
}

/* === RUNNING MODULE === */
.running-session-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid #e67e22;
}

.running-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.running-session-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.running-session-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  align-items: center;
}

.running-session-notes {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.run-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

@media (max-width: 480px) {
  .running-session-stats { gap: 10px; font-size: 12px; }
}

/* === WOCHE IM BLICK (Zone 4) === */
.woche-blick-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.woche-blick-tag {
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  text-align: center;
  border: 2px solid var(--border);
  background: var(--bg-tertiary);
  transition: var(--transition);
}

.woche-blick-tag.today {
  border-color: #f97316;
}

.wbt-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  letter-spacing: 0.4px;
}

.wbt-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.wbt-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin: 0 auto;
  background: var(--border);
}

.woche-blick-tag.done .wbt-dot    { background: #22c55e; }
.woche-blick-tag.planned .wbt-dot { background: #f87171; }
.woche-blick-tag.rest .wbt-dot    { background: #93c5fd; }

.woche-blick-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  padding-top: 4px;
}

.wbs-sep { color: var(--border-hover); }
.wbs-item strong { color: var(--text-primary); }

@media (max-width: 480px) {
  .woche-blick-grid { gap: 4px; }
  .wbt-name { font-size: 9px; }
  .wbt-dot { width: 14px; height: 14px; }
  .woche-blick-stats { font-size: 12px; }
}
