/* Dashboard-specific styles */

#dashboard-advice { margin-bottom: 18px; }

.advice-stack { display: grid; gap: 10px; }

.plan-calendar-month-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 8px;
  margin-top: 4px;
}

.plan-calendar-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #b69aff;
  background: color-mix(in srgb, var(--surface2) 90%, #20283a);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.plan-calendar-nav-btn:hover {
  border-color: #b69aff;
  background: color-mix(in srgb, var(--z5) 12%, var(--surface2));
  color: #ffffff;
}

.advice-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 12px 14px;
}

.advice-card.advice-skeleton {
  border-left-color: color-mix(in srgb, var(--border) 65%, var(--z3));
  position: relative;
  overflow: hidden;
}

.advice-card.advice-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.07) 40%, rgba(255,255,255,0.16) 52%, rgba(255,255,255,0.07) 64%, transparent 100%);
  transform: translateX(-100%);
  animation: adviceSkeletonShimmer 1.25s ease-in-out infinite;
}

.advice-card.advice-skeleton .advice-icon,
.advice-card.advice-skeleton .advice-title,
.advice-card.advice-skeleton .advice-badge,
.advice-card.advice-skeleton .advice-text {
  color: transparent;
  background: color-mix(in srgb, var(--surface2) 72%, var(--border));
  border-color: transparent;
}

.advice-card.advice-skeleton .advice-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.advice-card.advice-skeleton .advice-title {
  width: 64%;
  height: 14px;
  border-radius: 6px;
  margin: 0 0 6px;
}

.advice-card.advice-skeleton .advice-badge {
  width: 90px;
  height: 18px;
  border-radius: 999px;
  padding: 0;
}

.advice-card.advice-skeleton .advice-text {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  margin-top: 8px;
}

@keyframes adviceSkeletonShimmer {
  100% {
    transform: translateX(100%);
  }
}

.advice-icon { font-size: 20px; line-height: 1.2; }
.advice-content h4 { font-size: 14px; margin: 0 0 4px 0; }
.advice-content p { margin: 0; color: var(--text-muted); font-size: 13px; }

.advice-meta {
  margin-bottom: 4px;
}

.advice-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--z3) 45%, var(--border));
  color: color-mix(in srgb, var(--text) 86%, var(--z3));
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
}

.advice-badge--dark {
  color: #0f172a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}


.advice-action-btn {
  margin-top: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

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

.advice-info { border-left-color: var(--z3); }
.advice-warning { border-left-color: var(--z3); }
.advice-success { border-left-color: var(--z1); }
.advice-encourage { border-left-color: var(--accent); }

/* Advice cards in dark mode: keep warm yellow/green accents for readability */
:root:not([data-theme="light"]) .advice-stack .advice-card:nth-child(1) { border-left-color: var(--z1); }
:root:not([data-theme="light"]) .advice-stack .advice-card:nth-child(2) { border-left-color: var(--z3); }
:root:not([data-theme="light"]) .advice-stack .advice-card:nth-child(3) { border-left-color: var(--z2); }
:root:not([data-theme="light"]) .advice-stack .advice-card:nth-child(4) { border-left-color: var(--z3); }
:root:not([data-theme="light"]) .advice-stack .advice-card:nth-child(5) { border-left-color: var(--z2); }
:root:not([data-theme="light"]) .advice-stack .advice-card:nth-child(n+6) { border-left-color: var(--z1); }

:root:not([data-theme="light"]) .training-load-status {
  border-color: color-mix(in srgb, var(--z3) 55%, var(--border));
  color: color-mix(in srgb, var(--z3) 88%, #ffffff 12%);
}

:root:not([data-theme="light"]) .training-load-kpi {
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: var(--z1);
}

:root:not([data-theme="light"]) .training-load-kpis .training-load-kpi:nth-child(1) { border-left-color: var(--z1); }
:root:not([data-theme="light"]) .training-load-kpis .training-load-kpi:nth-child(2) { border-left-color: var(--z3); }
:root:not([data-theme="light"]) .training-load-kpis .training-load-kpi:nth-child(3) { border-left-color: var(--z5); }
:root:not([data-theme="light"]) .training-load-kpis .training-load-kpi:nth-child(4) { border-left-color: var(--z4); }
:root:not([data-theme="light"]) .training-load-kpis .training-load-kpi:nth-child(5) { border-left-color: var(--z2); }
:root:not([data-theme="light"]) .training-load-kpis .training-load-kpi:nth-child(n+6) { border-left-color: var(--z1); }

.session-row-highlight {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z3) 55%, transparent);
  background: color-mix(in srgb, var(--z3) 14%, var(--surface2));
}

.session-check-pulse {
  animation: sessionCheckPulse 0.8s ease-in-out 2;
  border-color: var(--z3);
}

@keyframes sessionCheckPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--z3) 46%, transparent);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--z3) 0%, transparent);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--z3) 0%, transparent);
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.kpi-grid.is-loading {
  opacity: 0.62;
  pointer-events: none;
}

[data-widget].is-loading {
  position: relative;
  pointer-events: none;
}

[data-widget].is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.06) 38%, rgba(255,255,255,0.14) 50%, rgba(255,255,255,0.06) 62%, transparent 100%);
  transform: translateX(-100%);
  animation: widgetLoadingShimmer 1.4s ease-in-out infinite;
}

@keyframes widgetLoadingShimmer {
  100% {
    transform: translateX(100%);
  }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.kpi.accent::before { background: var(--accent); }
.kpi.blue::before { background: var(--accent2); }
.kpi.orange::before { background: var(--accent3); }
.kpi.green::before { background: var(--z1); }

/* KPI top stripe cycles through reference zone colors */
.kpi-grid .kpi:nth-child(5n + 1)::before { background: var(--z1); }
.kpi-grid .kpi:nth-child(5n + 2)::before { background: var(--z3); }
.kpi-grid .kpi:nth-child(5n + 3)::before { background: var(--z5); }
.kpi-grid .kpi:nth-child(5n + 4)::before { background: var(--z4); }
.kpi-grid .kpi:nth-child(5n + 5)::before { background: var(--z2); }

.kpi-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.kpi-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.progress-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 28px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-label span:first-child { font-weight: 700; font-size: 15px; }

.progress-label span:last-child {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  color: var(--accent);
}

.progress-section.widget-trackable .progress-label {
  padding-right: 92px;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #5ec99a, #8de1b8);
  transition: width 0.8s ease;
}

.progress-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.plan-progress-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.plan-progress-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--surface2));
  background: color-mix(in srgb, var(--surface2) 70%, var(--surface));
}

.plan-progress-card:first-child {
  border-color: color-mix(in srgb, var(--z1) 42%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z1) 18%, transparent);
}

.plan-progress-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-progress-card-heading {
  display: grid;
  gap: 4px;
}

.plan-progress-card-title {
  font-size: 13px;
  font-weight: 700;
}

.plan-progress-card-pct {
  font-size: 12px;
  font-weight: 800;
  color: var(--z1);
  white-space: nowrap;
}

.plan-progress-card-bar {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--border) 76%, var(--surface2));
}

.plan-progress-card-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--z1), #8de1b8);
}

.plan-progress-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.plan-progress-card-action,
.plan-progress-hidden-btn,
.home-plan-module-toggle {
  border: 1px solid color-mix(in srgb, var(--accent2) 46%, var(--border));
  background: color-mix(in srgb, var(--surface2) 70%, var(--surface));
  color: color-mix(in srgb, var(--text) 92%, var(--accent2));
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.plan-progress-card-action {
  min-height: 30px;
  padding: 0 12px;
  font-size: 11px;
  white-space: nowrap;
}

.plan-progress-hidden {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.plan-progress-hidden-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.plan-progress-hidden-btn {
  justify-self: start;
  min-height: 32px;
  padding: 0 12px;
  font-size: 11px;
}

.home-plan-module {
  display: grid;
  gap: 14px;
}

.home-plan-module-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 0;
  padding: 0;
  font-size: 13px;
  border: none;
  background: transparent;
  border-radius: 0;
}

.home-plan-module-toggle-label {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}

.home-plan-module-toggle-icon {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.home-plan-module.is-collapsed .home-plan-module-toggle-icon {
  transform: rotate(-90deg);
}

.home-plan-module-content {
  display: grid;
  gap: 14px;
}

.home-plan-module-content[hidden] {
  display: none;
}

.widget-picker-wrap {
  margin-top: 26px;
  margin-bottom: 8px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--accent2) 30%, var(--border));
  background:
    radial-gradient(120% 120% at 0% -10%, color-mix(in srgb, var(--accent2) 18%, transparent), transparent 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface2) 90%, transparent), var(--surface));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--bg) 78%, transparent);
  display: grid;
  gap: 12px;
}

.widget-picker-wrap.is-collapsed .widget-picker,
.widget-picker-wrap.is-collapsed .widget-picker-title {
  display: none;
}

.widget-picker-wrap--empty {
  border-color: color-mix(in srgb, var(--border) 86%, var(--surface2));
}

.widget-picker-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent2) 52%, var(--border));
  background: color-mix(in srgb, var(--surface2) 74%, var(--surface));
  color: color-mix(in srgb, var(--text) 90%, var(--accent2));
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.widget-picker-toggle:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent2) 76%, var(--border));
  background: color-mix(in srgb, var(--accent2) 14%, var(--surface2));
}

.widget-picker-toggle:disabled {
  opacity: 0.72;
  cursor: default;
}

.widget-picker-title {
  font-size: 12px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-muted) 88%, var(--text));
  font-weight: 800;
}

.widget-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.widget-pick-card {
  --widget-tint: var(--accent2);
  position: relative;
  text-align: left;
  display: grid;
  gap: 12px;
  width: 100%;
  min-height: 186px;
  align-content: start;
  padding: 18px 16px 52px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--widget-tint) 38%, var(--border));
  color: var(--text);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--widget-tint) 22%, var(--surface2)) 0%, color-mix(in srgb, var(--widget-tint) 9%, var(--surface2)) 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface2) 92%, transparent), var(--surface2));
  cursor: pointer;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--bg) 76%, transparent);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.15s ease, box-shadow 0.2s ease;
}

.widget-pick-card:nth-child(5n + 1) { --widget-tint: #82aeda; }
.widget-pick-card:nth-child(5n + 2) { --widget-tint: #7fc8a7; }
.widget-pick-card:nth-child(5n + 3) { --widget-tint: #e8c678; }
.widget-pick-card:nth-child(5n + 4) { --widget-tint: #a088dc; }
.widget-pick-card:nth-child(5n + 5) { --widget-tint: #e9888c; }

.widget-pick-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--widget-tint) 78%, var(--border));
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--widget-tint) 28%, var(--surface2)) 0%, color-mix(in srgb, var(--widget-tint) 14%, var(--surface2)) 58%),
    linear-gradient(180deg, color-mix(in srgb, var(--widget-tint) 10%, var(--surface2)), color-mix(in srgb, var(--widget-tint) 6%, var(--surface2)));
  box-shadow: 0 14px 26px color-mix(in srgb, var(--bg) 68%, transparent);
}

.widget-pick-card:disabled {
  opacity: 0.7;
  cursor: wait;
}

.widget-pick-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent2) 75%, white);
  outline-offset: 2px;
}

.widget-pick-card--hidden {
  display: none;
}

.widget-pick-chip {
  position: absolute;
  right: 16px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--widget-tint) 60%, var(--border));
  background: color-mix(in srgb, var(--widget-tint) 22%, var(--surface));
  color: color-mix(in srgb, var(--text) 92%, var(--surface));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.widget-pick-label {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text);
}

.widget-pick-description {
  font-size: 15px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--text) 94%, var(--text-muted));
}

.widget-pick-cta {
  display: none;
}

.widget-toggle-checkbox-hidden {
  display: none;
}

.widget-trackable {
  position: relative;
}

.widget-unfollow-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border: 1px solid color-mix(in srgb, var(--accent2) 40%, var(--border));
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.widget-unfollow-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent2) 65%, var(--border));
  background: color-mix(in srgb, var(--accent2) 12%, var(--surface));
}

@media (max-width: 900px) {
  .widget-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .widget-pick-label {
    font-size: 19px;
  }
}

@media (max-width: 640px) {
  .widget-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .widget-picker-wrap {
    padding: 12px;
  }

  .widget-pick-card {
    min-height: 160px;
    padding: 14px 12px 46px;
  }

  .widget-pick-label {
    font-size: 16px;
  }

  .widget-pick-description {
    font-size: 13px;
  }

  .widget-picker-toggle {
    justify-self: stretch;
    justify-content: center;
  }
}

.plan-calendar-wrap {
  margin-bottom: 28px;
}

.plan-calendar-head {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.plan-calendar-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plan-calendar-month {
  margin-top: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.plan-calendar-summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.plan-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.plan-calendar-scroll {
  width: 100%;
  overflow: visible;
  padding-bottom: 0;
}

.plan-calendar-weekdays span {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.plan-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(130px, auto);
  gap: 8px;
}

.plan-calendar-day {
  min-height: 130px;
  height: auto;
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--border) 86%, #91a4bf);
  background: color-mix(in srgb, var(--surface2) 88%, #1e2534);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
  overflow: visible;
}

.plan-calendar-day.is-outside {
  opacity: 0.45;
}

.plan-calendar-day.is-today {
  border-color: color-mix(in srgb, var(--z5) 72%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z5) 40%, transparent);
}

.plan-calendar-day.has-items {
  background: color-mix(in srgb, var(--surface2) 92%, #202838);
}

.plan-calendar-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.plan-calendar-day-add {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #b69aff;
  background: color-mix(in srgb, var(--surface2) 88%, #243044);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 0 1px color-mix(in srgb, #ffffff 18%, transparent);
  transition: transform 0.12s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.plan-calendar-day-add:hover {
  transform: translateY(-1px);
  border-color: #ffffff;
  background: color-mix(in srgb, var(--z5) 14%, var(--surface));
  color: #ffffff;
}

.plan-calendar-day-add:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--z5) 72%, white);
  outline-offset: 1px;
}

.plan-calendar-day-num {
  font-size: 14px;
  font-weight: 800;
}

.plan-calendar-items {
  display: grid;
  align-content: start;
  min-height: auto;
  overflow: visible;
  gap: 6px;
}

.plan-calendar-item {
  padding: 7px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 82%, #2a3446);
  border-left: 3px solid var(--z1);
  overflow: visible;
}

.plan-calendar-item.is-actionable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.plan-calendar-item.is-actionable:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px color-mix(in srgb, var(--surface) 70%, transparent);
}

.plan-calendar-item.is-actionable:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--z5) 72%, transparent);
  outline-offset: 1px;
}

.plan-calendar-item.is-done {
  border-left-color: var(--z2);
  background: color-mix(in srgb, var(--z2) 18%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z2) 28%, transparent);
}

.plan-calendar-item.is-optional {
  border-left-color: var(--z3);
}

.plan-calendar-item.is-race {
  border-left-color: var(--z5);
  background: color-mix(in srgb, var(--z5) 14%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z5) 24%, transparent);
}

.plan-calendar-item.is-personal {
  border-left-color: var(--z3);
  background: color-mix(in srgb, var(--z3) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z3) 24%, transparent);
}

.plan-calendar-item.is-race.is-done {
  border-left-color: var(--z2);
  background: color-mix(in srgb, var(--z2) 24%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--z2) 34%, transparent);
}

.plan-calendar-item.is-done.is-optional {
  border-left-color: var(--z2);
  background: color-mix(in srgb, var(--z2) 18%, var(--surface));
}

/* Past sessions (not done) — yellow like km bars */
.plan-calendar-item.is-past:not(.is-done) {
  border-left-color: color-mix(in srgb, var(--z1) 68%, var(--z3));
  background: color-mix(in srgb, var(--z1) 13%, var(--surface));
}

/* Future sessions (not done) — soft green/yellow to avoid dark violet */
.plan-calendar-item.is-future:not(.is-done) {
  border-left-color: var(--z1);
  background: color-mix(in srgb, var(--z1) 14%, var(--surface));
}

.plan-calendar-item-no-log {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 4px;
  background: color-mix(in srgb, #f59e0b 20%, var(--surface));
  color: #b45309;
  border: 1px solid color-mix(in srgb, #f59e0b 50%, transparent);
}

[data-theme="dark"] .plan-calendar-item-no-log {
  background: color-mix(in srgb, #f59e0b 15%, var(--surface));
  color: #fbbf24;
  border-color: color-mix(in srgb, #f59e0b 35%, transparent);
}

.plan-calendar-item-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.plan-calendar-item-format {
  font-size: 11px;
  line-height: 1.28;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.plan-calendar-empty {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.calendar-action-sub {
  margin: -8px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.calendar-action-input {
  margin-bottom: 4px;
}

.calendar-action-input input {
  width: 100%;
}

.ef-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ef-kpi-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.ef-kpi-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin-bottom: 8px;
}

.ef-kpi-value { font-size: 22px; font-weight: 800; }
.ef-kpi-unit { font-size: 14px; }

.ef-kpi-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin-top: 4px;
}

.tone-good { color: var(--z1); }
.tone-bad { color: var(--accent3); }
.tone-accent2 { color: var(--accent2); }
.trend-up { color: var(--z1); }
.trend-down { color: var(--accent3); }
.trend-stable { color: var(--text-muted); }

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

.ef-mono { font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
.ef-strong { font-weight: 700; }

.coherence-title {
  font-size: 18px;
  margin-bottom: 16px;
}

.alert-detail-toggle {
  margin-top: 10px;
  align-self: flex-start;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent2) 46%, var(--border));
  background: color-mix(in srgb, var(--surface2) 70%, var(--surface));
  color: color-mix(in srgb, var(--text) 92%, var(--accent2));
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.alert-details {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.alert-details[hidden] {
  display: none;
}

.alert-detail-line {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 13px;
  grid-column: 1 / -1;
}

.proj-card {
  --proj-tint: var(--accent2);
  border: 1px solid color-mix(in srgb, var(--proj-tint) 45%, var(--border));
  border-left: 3px solid var(--proj-tint);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--proj-tint) 18%, var(--surface2)) 0%, color-mix(in srgb, var(--proj-tint) 8%, var(--surface2)) 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface2) 94%, transparent), var(--surface2));
}

.projections-grid .proj-card:nth-child(5n + 1) { --proj-tint: var(--z1); }
.projections-grid .proj-card:nth-child(5n + 2) { --proj-tint: var(--z3); }
.projections-grid .proj-card:nth-child(5n + 3) { --proj-tint: var(--z5); }
.projections-grid .proj-card:nth-child(5n + 4) { --proj-tint: var(--z4); }
.projections-grid .proj-card:nth-child(5n + 5) { --proj-tint: var(--z2); }

.proj-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin-bottom: 8px;
}

.proj-time {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: color-mix(in srgb, var(--proj-tint) 72%, white);
}

[data-theme="light"] .proj-time {
  color: color-mix(in srgb, var(--proj-tint) 74%, var(--text));
}

.proj-pace {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin-top: 6px;
}

.projections-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.training-load-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.training-load-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 5px 10px;
}

.training-load-ratio {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.training-load-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.training-load-kpi {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.training-load-kpi span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.training-load-kpi strong {
  font-size: 20px;
  line-height: 1;
}

.training-load-reco {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.training-load-chart {
  height: 150px;
}

.meta-small {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

.ef-chart-container {
  position: relative;
  height: 180px;
  margin-bottom: 20px;
}

.ef-bpm-chart-container {
  position: relative;
  height: 160px;
  margin-top: 4px;
}

.ef-table-wrap { overflow-x: auto; }

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

.ef-th {
  text-align: left;
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  border-bottom: 1px solid var(--border);
}

.ef-meta { margin-top: 12px; }

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .kpi {
    padding: 16px;
    border-radius: 16px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .chart-wrap,
  .progress-section,
  .widget-picker-wrap {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 16px;
  }

  .plan-progress-card-head {
    flex-direction: column;
    gap: 4px;
  }

  .plan-progress-card-action,
  .plan-progress-hidden-btn,
  .home-plan-module-toggle {
    width: 100%;
    justify-content: center;
  }

  .home-plan-module-toggle {
    padding: 0;
  }

  .home-plan-module-toggle-label {
    font-size: 16px;
  }

  .section-sub {
    margin-bottom: 18px;
  }

  .training-load-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-load-kpis .training-load-kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .projections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .proj-card {
    padding: 12px 10px;
  }

  .proj-time {
    font-size: clamp(18px, 5.2vw, 24px);
    line-height: 1.05;
  }

  .plan-calendar-head {
    gap: 8px;
  }

  .plan-calendar-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .plan-calendar-weekdays {
    display: grid;
    gap: 4px;
    margin-bottom: 6px;
  }

  .plan-calendar-weekdays span {
    padding: 0;
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.5px;
  }

  .plan-calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(76px, auto);
    gap: 4px;
  }

  .plan-calendar-scroll {
    margin: 0;
    padding: 0;
  }

  .plan-calendar-day {
    min-height: 76px;
    height: auto;
    padding: 6px 5px;
    border-radius: 8px;
    overflow: hidden;
  }

  .plan-calendar-day-head {
    margin-bottom: 3px;
    min-height: 18px;
  }

  .plan-calendar-day-num {
    font-size: 12px;
  }

  .plan-calendar-day.is-outside {
    display: flex;
    opacity: 0.28;
  }

  .plan-calendar-day-add {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  .plan-calendar-item {
    width: 6px;
    height: 6px;
    padding: 0;
    border-radius: 999px;
    border: 0;
    border-left-width: 0;
    background: var(--z1);
    box-shadow: none;
  }

  .plan-calendar-items {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 3px;
    min-height: 8px;
  }

  .plan-calendar-item:nth-child(n+4) {
    display: none;
  }

  .plan-calendar-item.is-done { background: var(--z2); }
  .plan-calendar-item.is-optional { background: color-mix(in srgb, var(--z1) 70%, var(--z3)); }
  .plan-calendar-item.is-race { background: var(--z5); }
  .plan-calendar-item.is-personal { background: var(--z3); }
  .plan-calendar-item.is-past:not(.is-done) { background: color-mix(in srgb, var(--z1) 70%, var(--z3)); }
  .plan-calendar-item.is-future:not(.is-done) { background: var(--z1); }

  .plan-calendar-item-label {
    display: none;
  }

  .plan-calendar-item-format {
    display: none;
  }

  .plan-calendar-item-no-log {
    display: none;
  }

  #calendar-action-modal {
    padding: 12px;
  }

  #calendar-action-modal .modal {
    width: min(92vw, 380px);
    max-width: min(92vw, 380px);
    max-height: 72vh;
    padding: 16px;
    border-radius: 20px;
  }

  #calendar-action-modal .modal-title {
    font-size: 15px;
    margin-bottom: 10px;
    padding-right: 20px;
  }

  #calendar-action-modal .modal-close {
    top: 12px;
    right: 12px;
    font-size: 16px;
  }

  #calendar-action-modal .calendar-action-sub {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.25;
    max-height: 3.1em;
    overflow: hidden;
  }

  #calendar-action-modal .modal-actions {
    margin-top: 10px;
    gap: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #calendar-action-modal .modal-actions .btn {
    width: 100%;
    min-height: 38px;
    padding: 7px 8px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.2;
  }
}

@media (max-width: 390px) {
  .section-title {
    font-size: 24px;
  }

  .chart-wrap,
  .progress-section,
  .widget-picker-wrap {
    padding: 12px;
    border-radius: 12px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi-label {
    font-size: 9px;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .kpi-unit {
    font-size: 11px;
  }

  .training-load-kpi strong {
    font-size: 18px;
  }

  .plan-calendar-day {
    min-height: 68px;
    padding: 3px;
  }

  .plan-calendar-item {
    width: 5px;
    height: 5px;
  }

  .plan-calendar-item-label {
    display: none;
  }

  .plan-calendar-item-format {
    display: none;
  }

  #calendar-action-modal {
    padding: 10px;
  }

  #calendar-action-modal .modal {
    width: min(94vw, 340px);
    max-width: min(94vw, 340px);
    max-height: 70vh;
    padding: 14px;
    border-radius: 18px;
  }

  #calendar-action-modal .modal-actions .btn {
    min-height: 36px;
    padding: 6px 7px;
    font-size: 11px;
  }
}

[data-theme="light"] .kpi::before {
  opacity: 0.8;
}

[data-theme="light"] #tempo-pct {
  color: #1f3f6f;
  font-weight: 700;
}

[data-theme="light"] .plan-calendar-day-add {
  border-color: #a8bbdc;
  background: #eef3fb;
  color: #2e3f5d;
  box-shadow: 0 0 0 1px rgba(138, 162, 206, 0.35);
}

[data-theme="light"] .plan-calendar-day-add:hover {
  border-color: #6f93d2;
  background: #dfeafe;
  color: #18305b;
}
