:root {
  color-scheme: light;
  /* Apple-like system palette — categorical slots validated for CVD separation
     and lightness band (see scripts/validate_palette). Orange sits at 2.8:1 on
     white (relief: zone segments carry direct labels + a legend). */
  --bg: #fbfbfd;
  --panel: #f5f5f7;
  --text: #1d1d1f;
  --muted: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #007aff;
  --blue-light: #3b9dff;
  --pink: #ff2d55;
  --pink-light: #ff5f7e;
  --orange: #ea7f00;
  --orange-light: #ffa41c;
  --orange-text: #c86a00;
  --green: #248a3d;
  --green-light: #34c759;
  --purple: #af52de;
  --red-text: #d31a45;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must always win, even over classes that set display
   (this bit us twice: the login overlay and the invite-code row). */
[hidden] {
  display: none !important;
}

/* Aurora background: two big blurred color fields drifting on a ~2 minute
   loop — slow enough to feel calm, visible enough to make the page breathe. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  will-change: transform;
}

body::before {
  top: -18vmax;
  right: -12vmax;
  opacity: 0.14;
  background: radial-gradient(circle at 35% 35%, #00c6fb, var(--blue) 60%, transparent 75%);
  animation: aurora-drift-a 90s ease-in-out infinite alternate;
}

body::after {
  bottom: -22vmax;
  left: -14vmax;
  opacity: 0.1;
  background: radial-gradient(circle at 60% 55%, var(--purple), var(--pink) 65%, transparent 78%);
  animation: aurora-drift-b 110s ease-in-out infinite alternate;
}

@keyframes aurora-drift-a {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-6vmax, 4vmax, 0) scale(1.08);
  }
  100% {
    transform: translate3d(3vmax, -2vmax, 0) scale(0.96);
  }
}

@keyframes aurora-drift-b {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(7vmax, -5vmax, 0) scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
  }
}

/* apple.com type scale (SF Pro tokens):
   hero      48–80px / 700 / lh 1.05 / ls -0.015em   (typography-headline-super)
   section   24px    / 600 / lh 1.17 / ls -0.01em    (typography-label)
   intro     21px    / 400 / lh 1.38                 (typography-intro)
   body      17px    / 400 / lh 1.47 / ls -0.022em   (typography-body)
   secondary 14px    / 400 / lh 1.42                 (typography-body-reduced)
   caption   12px    / 400 / lh 1.33                 (typography-caption)
   Ratios: hero:section ≈ 3:1, section:body ≈ 1.4:1 — big jump between
   headline and copy, tight headings, airy body. */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

/* apple.com-style frosted sticky nav */
.glass-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 251, 253, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.glass-nav-inner {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-actions button {
  min-height: 28px;
  padding: 0 14px;
  font-size: 13px;
}

.nav-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Full-screen login gate */
body.scroll-locked {
  overflow: hidden;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 251, 253, 0.92);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.login-card {
  width: min(380px, calc(100% - 32px));
  background: #ffffff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}

.login-card h2 {
  margin: 0 0 20px;
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.login-card input {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}

.login-error {
  margin: 0;
  min-height: 1em;
  font-size: 13px;
  color: #d70015;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  margin: 48px 0 56px;
}

.intro .summary {
  max-width: 680px;
  font-size: 21px;
  line-height: 1.38;
  letter-spacing: 0.011em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(48px, 6.5vw, 80px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.gradient-text {
  background: linear-gradient(92deg, var(--blue), var(--purple) 25%, var(--pink) 50%, var(--purple) 75%, var(--blue) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--blue);
  animation: gradient-cycle 14s ease-in-out infinite alternate;
}

@keyframes gradient-cycle {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gradient-text {
    animation: none;
  }
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.17;
  letter-spacing: -0.01em;
}

.panel-header p {
  font-size: 14px;
  line-height: 1.42;
  letter-spacing: 0;
}

.summary {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.summary-spaced {
  margin-top: 12px;
}

/* apple.com bento tile */
.panel {
  margin-bottom: 22px;
  padding: 30px 32px;
  border: none;
  border-radius: 28px;
  background: var(--panel);
  box-shadow: none;
}

/* Foldable panels: click the title to collapse to just the header,
   hover a collapsed panel to peek inside without pinning it open. */
.panel-foldable h2 {
  cursor: pointer;
  user-select: none;
}

.panel-foldable h2::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.4;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.2s ease;
}

.panel-collapsed h2::after {
  transform: translateY(0) rotate(-45deg);
}

.panel-collapsed:not(:hover) > *:not(.panel-keep),
.panel-collapsed.panel-no-peek > *:not(.panel-keep) {
  display: none;
}

.panel-collapsed:not(:hover) .panel-keep,
.panel-collapsed.panel-no-peek .panel-keep {
  margin-bottom: 0;
}

.panel-dark {
  background: #1d1d1f;
  color: #f5f5f7;
}

.panel-dark h2 {
  color: #f5f5f7;
}

.panel-dark .guidelines li {
  color: #a1a1a6;
}

.panel-dark .guidelines li strong {
  color: #f5f5f7;
}

.panel-header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 16px;
}

.panel-header p,
.muted p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

/* apple.com flat pill button */
button {
  min-height: 36px;
  padding: 0 18px;
  border: none;
  border-radius: 980px;
  background: #0071e3;
  color: #ffffff;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s ease;
}

button:hover {
  background: #0077ed;
}

button:active {
  background: #006edb;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button[data-action],
#block-cancel {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  box-shadow: none;
}

button[data-action]:hover,
#block-cancel:hover {
  background: rgba(0, 0, 0, 0.09);
  filter: none;
}

.chart-wrap {
  position: relative;
  height: clamp(360px, 48vw, 520px);
}

.chart-footnote {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--muted);
  max-width: 760px;
}

.chart-footnote summary {
  cursor: pointer;
  user-select: none;
}

.chart-footnote p {
  margin: 8px 0 0;
}

.chart-wrap-compact {
  height: clamp(280px, 34vw, 390px);
}

.chart {
  width: 100%;
  height: 100%;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.axis-label,
.tick-label,
.axis-title,
.legend-label,
.legend-date,
.status {
  fill: var(--muted);
  font-size: 12px;
}

.axis-title {
  font-size: 13px;
}

.fitness-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.fatigue-line {
  fill: none;
  stroke: var(--pink);
  stroke-width: 2;
  stroke-linecap: round;
}

.form-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.form-projection-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 7 6;
}

.form-plan-projection-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-dasharray: 3 4;
}

.fresh-band {
  fill: rgba(0, 122, 255, 0.06);
}

.neutral-band {
  fill: rgba(0, 0, 0, 0.035);
}

.productive-band {
  fill: rgba(52, 199, 89, 0.09);
}

.fatigue-band {
  fill: rgba(255, 159, 10, 0.1);
}

.risk-marker {
  fill: var(--pink);
}

.load-bar,
.load-swatch {
  fill: url(#grad-load);
}

.load-swatch {
  fill: rgba(0, 122, 255, 0.35);
}

.ramp-bar-up {
  fill: url(#grad-ramp-up);
}

.ramp-bar-down {
  fill: url(#grad-ramp-down);
}

.ramp-bar-risk {
  fill: url(#grad-ramp-risk);
}

.power-curve-area {
  fill: url(#grad-power-curve-area);
}

.power-curve-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.power-curve-dot {
  fill: #ffffff;
  stroke: var(--blue);
  stroke-width: 2.5;
}

.ctl-area {
  fill: url(#grad-ctl-area);
}

.fitness-dot {
  fill: var(--blue);
}

.fatigue-dot {
  fill: var(--pink);
}

.legend-title {
  fill: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.legend-value {
  fill: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.blue {
  fill: var(--blue);
}

.purple,
.pink {
  fill: var(--pink);
}

.green {
  fill: var(--green);
}

.orange {
  fill: var(--orange-text);
}

.red {
  fill: var(--red-text);
}

.empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  color: var(--muted);
}

/* Loading skeletons */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.055);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-stack {
  display: grid;
  gap: 12px;
}

.loading-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
  }
}

.fitness-profile {
  min-height: 140px;
}

.zone-bar {
  display: flex;
  gap: 3px;
  height: 30px;
  flex: 1;
}

.zone-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zone-bar-row + .zone-bar-row {
  margin-top: 8px;
}

.zone-bar-label {
  width: 48px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

.zone-bar-target {
  height: 18px;
  opacity: 0.4;
}

.zone-bar-target .zone-segment {
  font-size: 10px;
}

.zone-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

/* Vibrant angled gradients (Apple Fitness style) */
.zone-aerobic {
  background: linear-gradient(135deg, #00c6fb 0%, #0a84ff 100%);
}

.zone-threshold {
  background: linear-gradient(135deg, #ffb800 0%, #f76a00 100%);
}

.zone-anaerobic {
  background: linear-gradient(135deg, #ff375f 0%, #bf5af2 100%);
}

.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
}

.zone-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.zone-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.zone-recommendation {
  margin-top: 16px;
  margin-bottom: 0;
  color: var(--text);
  line-height: 1.5;
}

.zone-delta {
  font-weight: 700;
  color: var(--orange-text);
}

.zone-delta-ok {
  color: var(--green);
}

.zone-target-source {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 12px;
  color: var(--muted);
}

/* segmented tab control, centered below the hero */
.tabs {
  display: flex;
  justify-content: center;
  gap: 2px;
  width: fit-content;
  margin: 0 auto 28px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 980px;
}

.tab {
  border: none;
  background: none;
  box-shadow: none;
  padding: 8px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 980px;
  min-height: 0;
  transition: none;
}

.tab:hover {
  background: none;
  color: var(--text);
}

.tab.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.availability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.availability-day {
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.availability-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.availability-day-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.availability-hours {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
}

.availability-hours-zero {
  color: var(--muted);
  font-weight: 500;
}

.availability-total {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
}

/* Apple-style range slider; the gradient fill is set inline from JS */
.availability-day input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.08);
  outline: none;
  margin: 0;
  padding: 0;
  border: none;
  cursor: pointer;
}

.availability-day input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22), 0 0 1px rgba(0, 0, 0, 0.12);
}

.availability-day input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22), 0 0 1px rgba(0, 0, 0, 0.12);
}

.plan-controls {
  display: flex;
  gap: 14px;
}

.plan-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.plan-controls select {
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 12px; background: #ffffff;
  border-radius: 6px;
  font-size: 13px;
}

.plan-summary-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.plan-stat {
  display: flex;
  flex-direction: column;
}

.plan-stat-value {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.plan-stat-value.red {
  color: var(--red-text);
}

.plan-stat-value.green {
  color: var(--green);
}

.plan-stat-label {
  font-size: 12px;
  color: var(--muted);
}

.plan-stat-sub {
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}

/* The advice tile holds words, not a number — smaller type, same baseline. */
.plan-stat-advice {
  font-size: 24px;
  line-height: 1.8;
}

.plan-stat-value.orange {
  color: var(--orange-text);
}

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

.plan-day {
  border: none;
  border-radius: 18px;
  background: #ffffff;
  padding: 18px 20px;
}

.plan-day-hard {
  border-left: 4px solid var(--pink);
}

.plan-day-rest {
  background: rgba(255, 255, 255, 0.55);
}

.plan-day-today {
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--blue);
}

.plan-today-badge {
  display: inline-block;
  background: linear-gradient(180deg, var(--blue-light), var(--blue));
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

.plan-day-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.plan-day-name {
  font-weight: 700;
}

.plan-day-date {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

.plan-day-form {
  font-size: 13px;
  color: var(--muted);
}

.plan-rest-label {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.plan-workout {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.plan-workout-name {
  font-size: 16px;
  font-weight: 700;
}

.plan-workout-meta {
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.plan-export {
  min-height: 28px;
  padding: 0 14px;
  font-size: 12px;
}

.plan-export-done {
  background: var(--green);
  cursor: default;
}

.plan-export-done:hover {
  background: var(--green);
}

.plan-export-stale {
  margin: -4px 0 10px;
  font-size: 12px;
  color: var(--orange-text);
}

.plan-focus {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  margin-right: 6px;
}

.plan-focus-aerobic {
  background: linear-gradient(135deg, #00c6fb, #0a84ff);
}

.plan-focus-threshold {
  background: linear-gradient(135deg, #ffb800, #f76a00);
}

.plan-focus-anaerobic {
  background: linear-gradient(135deg, #ff375f, #bf5af2);
}

.plan-focus-recovery {
  background: linear-gradient(135deg, #30d158, #0aa851);
}

.plan-workout-description {
  margin: 6px 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.workout-profile {
  display: block;
  width: 100%;
  height: 64px;
  margin: 2px 0 12px;
}

.workout-profile rect {
  transition: filter 0.1s ease, opacity 0.1s ease;
}

.workout-profile:has(rect:hover) rect {
  opacity: 0.55;
}

.workout-profile rect:hover {
  opacity: 1;
  filter: brightness(1.08);
}

.chart-tooltip.profile-tooltip {
  position: fixed;
}

.profile-tooltip-zone {
  font-weight: 700;
}

.profile-tooltip-recovery {
  color: #6e7e8a;
}

.profile-tooltip-aerobic {
  color: var(--blue);
}

.profile-tooltip-threshold {
  color: var(--orange-text);
}

.profile-tooltip-anaerobic {
  color: var(--pink);
}

.chart-tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14), 0 0 1px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--text);
  pointer-events: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 2px;
}

.chart-tooltip span {
  display: block;
  color: var(--muted);
}

.chart-tooltip b {
  color: var(--text);
}

.chart-crosshair {
  stroke: rgba(0, 0, 0, 0.28);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.plan-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  font-size: 13.5px;
}

.plan-step-label {
  color: var(--muted);
  margin-left: 6px;
}

.guidelines {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
}

.guidelines li {
  color: var(--muted);
  line-height: 1.55;
}

.guidelines li strong {
  color: var(--text);
}

.block-progress {
  min-height: 32px;
  margin-bottom: 20px;
}

.block-progress-status {
  margin: 0 0 10px;
  font-weight: 700;
}

.block-progress-guidance {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.block-progress-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.block-form {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.goal-block-form {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.block-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.block-form label,
.goal-block-form label,
.checkin-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.checkbox-label {
  justify-content: end;
}

.checkbox-label input {
  width: fit-content;
}

.block-notes-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.block-form input,
.block-form select,
.block-form textarea,
.goal-block-form input,
.checkin-form select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  color: var(--text);
  background: #ffffff;
}

.checkin-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.compliance-list {
  display: grid;
  gap: 10px;
}

/* Plan vs actual: per day, two aligned bars — grey "plan" vs a "done" bar
   colored by outcome — so a match (or miss) is visible at a glance. */
.cmp-day {
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
}

.cmp-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.cmp-date {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.cmp-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.cmp-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 10px;
  white-space: nowrap;
}

.cmp-status-completed,
.cmp-status-rest {
  background: rgba(52, 199, 89, 0.15);
  color: var(--green);
}

.cmp-status-partial {
  background: rgba(234, 127, 0, 0.14);
  color: var(--orange-text);
}

.cmp-status-missed,
.cmp-status-unplanned {
  background: rgba(255, 45, 85, 0.12);
  color: var(--pink);
}

.cmp-status-pending {
  background: rgba(0, 122, 255, 0.12);
  color: var(--blue);
}

.cmp-bars {
  display: grid;
  gap: 4px;
}

.cmp-bar-row {
  display: grid;
  grid-template-columns: 36px 1fr 40px;
  align-items: center;
  gap: 8px;
}

.cmp-bar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.cmp-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.cmp-fill {
  height: 100%;
  border-radius: 4px;
}

.cmp-fill-plan {
  background: rgba(0, 0, 0, 0.24);
}

.cmp-fill-completed,
.cmp-fill-rest {
  background: linear-gradient(90deg, var(--green-light), var(--green));
}

.cmp-fill-partial {
  background: linear-gradient(90deg, var(--orange-light), var(--orange));
}

.cmp-fill-missed,
.cmp-fill-unplanned {
  background: linear-gradient(90deg, var(--pink-light), var(--pink));
}

.cmp-fill-pending {
  background: linear-gradient(90deg, #00c6fb, var(--blue));
}

.cmp-val {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}

.block-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.block-form-error {
  color: var(--red-text);
  font-size: 13px;
}

.blocks-list {
  margin-top: 20px;
  overflow-x: auto;
}

.blocks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.blocks-table th,
.blocks-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.blocks-table th {
  color: var(--muted);
  font-weight: 650;
}

.blocks-table button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  margin-right: 6px;
}

@media (orientation: landscape) and (max-height: 520px) {
  .chart-wrap {
    height: 324px;
  }

  .chart-wrap-compact {
    height: 252px;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100% - 20px);
    padding: 14px 0;
  }

  .glass-nav-inner {
    width: calc(100% - 20px);
    height: auto;
    min-height: 48px;
    padding: 8px 0;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .nav-actions {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  /* The logged-in email costs too much width next to the buttons. */
  #nav-user {
    display: none;
  }

  .intro {
    margin: 18px 0 24px;
    gap: 8px;
  }

  h1 {
    font-size: clamp(34px, 11vw, 48px);
  }

  .summary {
    font-size: 16px;
  }

  .panel {
    padding: 18px 16px;
    border-radius: 20px;
    margin-bottom: 14px;
  }

  .panel-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
  }

  .chart-wrap {
    height: 290px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .chart-wrap-compact {
    height: 230px;
  }

  .chart {
    min-width: 760px;
  }

  .chart-wrap-compact .chart {
    min-width: 680px;
  }

  .cmp-name {
    display: none;
  }

  .plan-summary-stats {
    gap: 16px;
  }

  .plan-day {
    padding: 14px 14px;
  }
}
