/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --sidebar-width: 240px;
  --topbar-height: 52px;
  --radius-card: 12px;
  --radius-input: 8px;
  --radius-btn: 8px;
  --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-sidebar-bg: #18181b;
  --color-sidebar-text: #a1a1aa;
  --color-sidebar-text-active: #ffffff;
  --color-sidebar-hover: rgba(255,255,255,.06);
  --color-sidebar-active: rgba(255,255,255,.10);
  --color-body: #f4f4f5;
  --color-surface: #ffffff;
  --color-border: #e4e4e7;
  --color-text: #18181b;
  --color-text-muted: #71717a;
}

/* ============================================================
   Reset / Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* ============================================================
   App shell
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-body);
}

/* ============================================================
   Sidebar — permanent on desktop, slide-in on mobile
   ============================================================ */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  /* Desktop: always visible */
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

/* Mobile: hidden off-screen to the left */
@media (max-width: 1023px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(calc(-1 * var(--sidebar-width)));
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: none;
  }
  .app-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,.35);
  }
}

.sidebar-header {
  padding: 1.25rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--color-sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--color-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--color-sidebar-active); color: var(--color-sidebar-text-active); }
.nav-item-icon { width: 1rem; text-align: center; font-size: 0.875rem; flex-shrink: 0; }

/* Quick profile switcher: a list in the sidebar, a dropdown in the mobile bar. */
.sidebar-nav:has(+ .sidebar-profiles) { flex: 0 0 auto; }
.sidebar-profiles { border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-sidebar-text);
  opacity: 0.6;
  padding: 0.25rem 0.75rem;
}
.topbar-switcher { position: relative; }
.topbar-switcher > summary { list-style: none; cursor: pointer; }
.topbar-switcher > summary::-webkit-details-marker { display: none; }
.topbar-switcher-panel {
  position: absolute;
  right: -2.5rem;
  top: calc(100% + 0.5rem);
  z-index: 60;
  width: min(18rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-sidebar-bg);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.topbar-switcher-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
}
.topbar-switcher-item:hover { background: var(--color-sidebar-hover); }

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #d4d4d8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-signout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.4375rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 7px;
  color: #a1a1aa;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.sidebar-signout-btn:hover { background: rgba(255,255,255,.06); color: #e4e4e7; }

/* ============================================================
   Mobile topbar (hidden on desktop)
   ============================================================ */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-height);
  background: var(--color-sidebar-bg);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

@media (max-width: 1023px) {
  .mobile-topbar { display: flex; }
}

.mobile-topbar-logo {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.topbar-hamburger {
  background: none;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  padding: 0.4375rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}
.topbar-hamburger:hover { color: #fff; background: rgba(255,255,255,.08); }
.topbar-hamburger svg { display: block; }

/* ============================================================
   Sidebar overlay (mobile only)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 45;
  cursor: pointer;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   Main wrapper + content area
   ============================================================ */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* In a flex column, `mx-auto` makes a child shrink to its content —
   page wrappers (.max-w-xl.mx-auto …) must still take the full width. */
.main-content > .mx-auto,
.main-content > .page-header,
.main-content > .page-content { width: 100%; }
/* Room under the last thing on a page for the round home / "+ Záznam"
   buttons floating at the bottom — they used to sit on top of it. */
.main-content { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
html.workout-page .main-content { padding-bottom: 0; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 1.25rem;
}

/* Collapsible exercise cards on the workout run page — <summary> keeps only
   the browser-native disclosure behaviour, its default marker is replaced
   by a rotating chevron icon. */
.workout-exercise > summary {
  cursor: pointer;
}
.workout-exercise > summary::-webkit-details-marker {
  display: none;
}
.workout-exercise-chevron {
  transition: transform 0.15s ease;
}
.workout-exercise[open] .workout-exercise-chevron {
  transform: rotate(180deg);
}

/* Workout run page: pinned progress bar on top, controls at the bottom,
   numbered exercises (✓ once done) and a "what's next" line. Nothing on it
   may widen the page sideways on a narrow phone (clip keeps sticky working,
   unlike overflow: hidden). */
.workout-run { overflow-x: clip; }
.workout-topbar {
  top: 0;
  background: var(--color-body, #f9fafb);
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.workout-segment {
  height: 0.4rem;
  border-radius: 9999px;
  background: var(--color-border, #e5e7eb);
  transition: background 0.3s ease;
}
.workout-segment.is-done { background: #16a34a; }
.workout-segment.is-current { background: #4f46e5; }
.workout-segment.has-units { display: flex; gap: 2px; background: transparent; }
.workout-unit { flex: 1; border-radius: 9999px; background: var(--color-border, #e5e7eb); transition: background 0.3s ease; }
.workout-unit.is-done { background: #16a34a; }
.workout-unit.is-current { background: #4f46e5; }
.workout-run.is-running .workout-segment.is-current:not(.has-units),
.workout-run.is-running .workout-unit.is-current { animation: workout-pulse 1.6s ease-in-out infinite; }
@keyframes workout-pulse { 50% { opacity: 0.45; } }
.workout-exercise, .workout-cockpit { scroll-margin-top: 6.5rem; }
@media (max-width: 1023px) {
  /* below the app's own sticky mobile bar */
  .workout-topbar { top: var(--topbar-height); }
  .workout-exercise, .workout-cockpit { scroll-margin-top: calc(6.5rem + var(--topbar-height)); }
  html.workout-kiosk .workout-topbar { top: 0; }
}
.workout-bar {
  height: 0.75rem;
  border-radius: 9999px;
  /* the track must read on the dark card too, not only the fill */
  background: color-mix(in srgb, currentColor 18%, transparent);
  overflow: hidden;
}
.workout-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  background: #4f46e5;
  transition: width 0.3s linear, background 0.3s ease;
}
.workout-exercise.is-current .workout-exercise-title {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
}
.workout-exercise.is-done { opacity: 0.6; }
.workout-run.is-finished .workout-exercise.is-done { opacity: 1; }
.workout-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--color-border, #e5e7eb);
  color: #4b5563;
}
.workout-exercise.is-current .workout-num { background: #4f46e5; color: #fff; }
.workout-exercise.is-done .workout-num { background: #16a34a; color: #fff; }
.workout-controls {
  background: linear-gradient(to top, var(--color-body, #f9fafb) 80%, transparent);
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
/* Kid's day split into parts (dashboard/kid): the chevron turns when open. */
.kid-part-chevron { transition: transform 0.15s ease; }
.kid-part[open] .kid-part-chevron { transform: rotate(180deg); }
.kid-part > summary::-webkit-details-marker { display: none; }

/* A long activity description: the start, "více", and all of it when open. */
.plan-description > summary { list-style: none; }
.plan-description > summary::-webkit-details-marker { display: none; }
.plan-description[open] > summary .plan-description-short { display: none; }

/* Activity history grid (workout_plans/_heatmap): green = done, a frame =
   planned that day, frame + red tint = planned and missed, stripes = skipped. */
.workout-heatmap { overflow-x: auto; }
.workout-heatmap-grid {
  display: grid;
  grid-template-columns: auto repeat(var(--weeks), 1rem);
  gap: 3px;
  align-items: center;
  width: max-content;
}
.workout-heatmap-month { font-size: 0.625rem; line-height: 1; color: var(--color-text-muted, #71717a); white-space: nowrap; overflow: visible; width: 1rem; }
.workout-heatmap-wday { font-size: 0.625rem; line-height: 1; color: var(--color-text-muted, #71717a); padding-right: 0.25rem; }
.workout-heatmap-cell {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  background: var(--color-border, #e5e7eb);
}
.workout-heatmap-cell.is-done { background: #16a34a; }
.workout-heatmap-cell.is-missed { background: color-mix(in srgb, #dc2626 30%, var(--color-border, #e5e7eb)); }
.workout-heatmap-cell.is-skipped { background: repeating-linear-gradient(45deg, var(--color-border, #e5e7eb) 0 3px, #a1a1aa 3px 5px); }
.workout-heatmap-cell.is-planned { box-shadow: inset 0 0 0 2px #52525b; }
.workout-heatmap-cell.is-future { opacity: 0.45; }
.workout-heatmap-cell.is-today { outline: 2px solid var(--color-primary, #4f46e5); outline-offset: 1px; }
.workout-heatmap-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin-top: 0.75rem; font-size: 0.75rem; color: var(--color-text-muted, #71717a); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .workout-heatmap-cell.is-planned { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9); }
}
:root[data-theme="dark"] .workout-heatmap-cell.is-planned { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9); }

/* Under the thumb: big, and only one main button at a time (see
   workout-timer#renderControls) — timed: ⏮ | ▶/⏸ | ⏭, reps: ⏮ | ✓ Hotovo. */
.workout-controls-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0.5rem;
}
.workout-controls-grid[data-mode="reps"] { grid-template-columns: 1fr 3fr; }
.workout-ctl {
  min-width: 0;
  min-height: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0.25rem;
  border-radius: 1rem;
  border: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-surface, #fff);
  color: var(--color-text, #111827);
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.15s ease;
}
.workout-ctl:active { transform: scale(0.96); }
.workout-ctl[hidden] { display: none; }
.workout-ctl[disabled] { opacity: 0.35; cursor: default; }
.workout-ctl-icon { font-size: 1.4rem; line-height: 1; }
.workout-ctl-label { font-size: 0.8rem; }
.workout-ctl.is-main {
  flex-direction: row;
  gap: 0.5rem;
  background: var(--color-primary, #4f46e5);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.workout-ctl.is-main .workout-ctl-icon { font-size: 1.5rem; }
.workout-ctl.is-main .workout-ctl-label { font-size: 1.35rem; font-weight: 700; }
.workout-ctl.is-done { background: #16a34a; box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35); }

/* TV / sound / big mode — small icon buttons in the top bar. */
.workout-tool {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-surface, #fff);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.workout-tool[hidden] { display: none; }
.workout-tool.is-on { border-color: var(--color-primary, #4f46e5); box-shadow: inset 0 0 0 1px var(--color-primary, #4f46e5); }

/* The run page shows only what the step needs. */
html.workout-page [data-controller~="install-banner"] { display: none !important; }
.workout-run.is-started .hide-once-started,
.workout-run.is-running .hide-while-running,
.workout-run.is-finished .hide-when-finished { display: none !important; }
.workout-howto > summary { list-style: none; }
.workout-howto > summary::-webkit-details-marker { display: none; }

/* The clock is a button (tap = pause / go on, or done for reps). */
.workout-clock { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; border-radius: 1rem; }
.workout-clock:focus-visible { outline: 2px solid var(--color-primary, #4f46e5); outline-offset: 4px; }
.workout-display { font-size: clamp(3.5rem, 17vw, 5rem); line-height: 1; transition: color 0.3s ease; }
.workout-cockpit.is-ending [data-workout-timer-target="display"] { animation: workout-ending 1s ease-in-out infinite; }
.workout-cockpit.is-ending { background: color-mix(in srgb, #dc2626 10%, transparent); transition: background 0.3s ease; }
@keyframes workout-ending { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  .workout-cockpit.is-ending [data-workout-timer-target="display"] { animation: none; }
}

/* During a rest: "+15 s" and what it leads into. */
.workout-rest-extra { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.workout-rest-extra[hidden] { display: none; }
.workout-add-time {
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  border: 1px solid #f59e0b;
  color: #b45309;
  font-weight: 700;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}
.workout-then { font-size: 1rem; font-weight: 600; color: var(--color-text-muted, #6b7280); }
.workout-run.is-finished [data-workout-timer-target="controls"] { display: none; }

/* Kiosk mode on the workout run page — large, minimal display for when the
   phone is propped up across the room during exercise (or mirrored to a
   TV): exercise name, big countdown, what's next, controls. */
/* The big mode takes the whole screen: no app bars, sidebar or banners. */
html.workout-kiosk .app-sidebar,
html.workout-kiosk .mobile-topbar,
html.workout-kiosk [data-controller~="install-banner"] { display: none !important; }
html.workout-kiosk .main-content { margin-left: 0 !important; padding-top: 0 !important; }
.workout-run.kiosk-mode { max-width: 64rem; }
.kiosk-mode .workout-topbar-name { display: none; }
.kiosk-mode .kiosk-hide {
  display: none !important;
}
.kiosk-mode .workout-exercise { box-shadow: none; border: 0; background: transparent; }
.kiosk-mode .workout-cockpit { box-shadow: none; border: 0; background: transparent; }
.kiosk-mode [data-workout-timer-target="exName"] { font-size: clamp(1.75rem, 7vw, 3rem); line-height: 1.1; }
.kiosk-show { display: none; }
.kiosk-mode .kiosk-show { display: block; }
.kiosk-mode .workout-next { font-size: 0.95rem; }
.kiosk-mode .workout-bar { height: 1rem; }
.kiosk-mode [data-workout-timer-target="display"] {
  font-size: clamp(5rem, 27vw, 9rem) !important;
  line-height: 1 !important;
}
/* Big mode upright: the timer fills the middle and the buttons sit at the
   bottom edge, under the thumb — not halfway up with an empty screen below. */
@media (orientation: portrait) {
  .workout-run.kiosk-mode .workout-cockpit > .card-body {
    min-height: calc(100dvh - 14rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .workout-run.kiosk-mode .workout-ctl { min-height: 5.5rem; }
}
.kiosk-mode [data-workout-timer-target="phase"] {
  font-size: 1.5rem !important;
}
.kiosk-mode [data-workout-timer-target="progress"] {
  font-size: 1rem !important;
}
@media (orientation: landscape) and (max-height: 640px) {
  .workout-run.kiosk-mode .workout-cockpit > .card-body {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 2rem;
    align-items: center;
    text-align: left;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  .workout-run.kiosk-mode .workout-cockpit .workout-clock {
    grid-column: 1;
    grid-row: 1 / span 3;
    min-width: 14rem;
    text-align: center;
  }
  .workout-run.kiosk-mode .workout-topbar { padding-top: 0.25rem; padding-bottom: 0.25rem; }
  .workout-run.kiosk-mode [data-workout-timer-target="display"] { font-size: clamp(2.5rem, 13vh, 5rem) !important; }
  .workout-run.kiosk-mode [data-workout-timer-target="exName"] { font-size: clamp(1.5rem, 9vh, 2.5rem); }
  .workout-run.kiosk-mode .workout-cockpit-head,
  .workout-run.kiosk-mode .workout-cockpit [data-workout-timer-target="videoWrap"] { grid-column: 2; margin-top: 0; }
  .workout-run.kiosk-mode .workout-controls { padding-top: 0.25rem; padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)); }
  .workout-run.kiosk-mode .workout-ctl { min-height: 3.25rem; }
  .workout-run.kiosk-mode .workout-next { margin-bottom: 0.25rem; }
}

/* ============================================================
   Buttons
   ============================================================ */
/* In the components layer so Tailwind utilities (py-5, text-xl, rounded-xl…)
   on a button win over these defaults (unlayered rules beat every layer). */
@layer components {
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, box-shadow 0.12s;
  box-shadow: 0 1px 2px rgba(79,70,229,.2);
  line-height: 1.25;
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--color-surface);
  color: #3f3f46;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  line-height: 1.25;
}
.btn-secondary:hover { background: #f4f4f5; }
.btn-secondary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-btn);
  border: 1px solid #fecaca;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  line-height: 1.25;
}
.btn-danger:hover { background: #fecaca; }
}

/* ============================================================
   Form elements
   ============================================================ */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #3f3f46;
  margin-bottom: 0.375rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid #d4d4d8;
  border-radius: var(--radius-input);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-input::placeholder { color: #a1a1aa; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash-notice {
  padding: 0.625rem 1.25rem;
  background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.875rem;
}

.flash-alert {
  padding: 0.625rem 1.25rem;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.875rem;
}

/* ============================================================
   Section divider + headings (used inside pages)
   ============================================================ */
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* ============================================================
   Accessibility
   ============================================================ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: 0 0 8px 0;
  font-size: 0.875rem;
}
.skip-link:focus {
  left: 0;
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .nav-item,
  .btn-primary,
  .btn-secondary,
  .form-input {
    transition: none !important;
  }
}

/* ============================================================
   Dark mode
   ============================================================
   The views use plain Tailwind light-palette utilities; rather than adding
   dark: variants to every template, this block remaps the design tokens and
   the utilities actually used in the codebase. app.css loads after the
   Tailwind build and unlayered rules beat @layer utilities, so these win. */
:root {
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-body: #101013;
    --color-surface: #1b1b1f;
    --color-border: #2c2c33;
    --color-text: #f4f4f5;
    --color-text-muted: #9d9da7;
    --shadow-card: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
  }

  /* --- Neutral surfaces --- */
  .bg-white { background-color: var(--color-surface); }
  .bg-gray-50 { background-color: #222227; }
  .bg-gray-100 { background-color: #27272d; }
  .bg-gray-200 { background-color: #2f2f36; }
  .bg-gray-300 { background-color: #3a3a42; }
  .hover\:bg-gray-50:hover { background-color: #26262c; }
  .hover\:bg-gray-100:hover { background-color: #2c2c33; }
  .hover\:bg-gray-200:hover { background-color: #33333a; }

  /* --- Neutral text --- */
  .text-gray-900 { color: #f4f4f5; }
  .text-gray-800 { color: #e7e7ea; }
  .text-gray-700 { color: #d4d4d8; }
  .text-gray-600 { color: #b0b0b9; }
  .text-gray-500 { color: #93939e; }
  .text-gray-400 { color: #74747e; }
  .text-gray-300 { color: #55555e; }
  .hover\:text-gray-700:hover { color: #e7e7ea; }
  .hover\:text-gray-600:hover { color: #d4d4d8; }
  .hover\:text-gray-500:hover { color: #b0b0b9; }

  /* --- Neutral borders / dividers --- */
  .border-gray-100, .border-gray-200, .border-gray-300 { border-color: var(--color-border); }
  .border-white { border-color: var(--color-surface); }
  .divide-gray-50 > :not([hidden]) ~ :not([hidden]),
  .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
  .divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--color-border); }

  /* --- Indigo (primary accent) --- */
  .bg-indigo-50 { background-color: rgba(99,102,241,.14); }
  .bg-indigo-100 { background-color: rgba(99,102,241,.20); }
  .hover\:bg-indigo-50:hover { background-color: rgba(99,102,241,.18); }
  .hover\:bg-indigo-100:hover { background-color: rgba(99,102,241,.26); }
  .hover\:border-indigo-200:hover, .hover\:border-indigo-300:hover { border-color: rgba(99,102,241,.55); }
  .text-indigo-900, .text-indigo-800, .text-indigo-700 { color: #a5b4fc; }
  .text-indigo-600, .text-indigo-500 { color: #818cf8; }
  .hover\:text-indigo-600:hover, .hover\:text-indigo-800:hover { color: #a5b4fc; }
  .border-indigo-100, .border-indigo-200, .border-indigo-300 { border-color: rgba(99,102,241,.4); }
  .ring-indigo-300 { --tw-ring-color: rgba(99,102,241,.45); }

  /* --- Red / danger --- */
  .bg-red-50 { background-color: rgba(239,68,68,.10); }
  .bg-red-100 { background-color: rgba(239,68,68,.18); }
  .hover\:bg-red-50:hover { background-color: rgba(239,68,68,.16); }
  .text-red-800, .text-red-700 { color: #fca5a5; }
  .text-red-600, .text-red-500 { color: #f87171; }
  .hover\:text-red-700:hover, .hover\:text-red-600:hover, .hover\:text-red-500:hover { color: #fca5a5; }
  .border-red-100, .border-red-200, .border-red-400 { border-color: rgba(239,68,68,.35); }

  /* --- Amber / warning --- */
  .bg-amber-50 { background-color: rgba(245,158,11,.10); }
  .bg-amber-100, .hover\:bg-amber-100:hover { background-color: rgba(245,158,11,.18); }
  .text-amber-900, .text-amber-800, .text-amber-700 { color: #fcd34d; }
  .text-amber-600, .text-amber-500 { color: #fbbf24; }
  .border-amber-100, .border-amber-200, .border-amber-300, .border-amber-400 { border-color: rgba(245,158,11,.35); }

  /* --- Yellow --- */
  .bg-yellow-50, .bg-yellow-100 { background-color: rgba(234,179,8,.12); }
  .border-yellow-200, .border-yellow-300 { border-color: rgba(234,179,8,.35); }
  .text-yellow-800, .text-yellow-700, .text-yellow-600 { color: #facc15; }

  /* --- Green / success --- */
  .bg-green-50, .bg-green-100 { background-color: rgba(34,197,94,.12); }
  .text-green-800, .text-green-700 { color: #86efac; }
  .text-green-600, .text-green-500 { color: #4ade80; }
  .border-green-100, .border-green-200, .border-green-300 { border-color: rgba(34,197,94,.4); }

  /* --- Blue --- */
  .bg-blue-50, .bg-blue-100 { background-color: rgba(59,130,246,.12); }
  .text-blue-800, .text-blue-700, .text-blue-600 { color: #93c5fd; }
  .text-blue-500 { color: #60a5fa; }
  .hover\:text-blue-500:hover { color: #93c5fd; }
  .hover\:bg-blue-100:hover { background-color: rgba(59,130,246,.2); }

  /* --- Sky (checklists) --- */
  .bg-sky-50 { background-color: rgba(14,165,233,.12); }
  .text-sky-700 { color: #7dd3fc; }
  .border-sky-100, .border-sky-200 { border-color: rgba(14,165,233,.35); }
  .border-blue-100, .border-blue-200, .border-blue-300, .border-blue-400 { border-color: rgba(59,130,246,.35); }

  /* --- Pink / rose (cycle UI) --- */
  .bg-pink-50 { background-color: rgba(236,72,153,.12); }
  .text-pink-800, .text-pink-700, .text-pink-600 { color: #f9a8d4; }
  .text-rose-600, .text-rose-500 { color: #fda4af; }
  .border-pink-200 { border-color: rgba(236,72,153,.35); }

  /* --- Purple / teal / orange accents --- */
  .bg-purple-100 { background-color: rgba(168,85,247,.16); }
  .text-purple-800 { color: #d8b4fe; }
  .text-teal-800 { color: #5eead4; }
  .bg-teal-100 { background-color: rgba(20,184,166,.16); }
  .bg-orange-50 { background-color: rgba(249,115,22,.12); }
  .text-orange-600, .text-orange-500 { color: #fb923c; }
  .border-orange-200, .border-orange-300 { border-color: rgba(249,115,22,.4); }

  /* --- Components with light colors compiled in (Tailwind @apply or app.css) --- */
  .card-title { color: var(--color-text); }
  .card-footer { background: #222227; }
  .btn-secondary { color: #d4d4d8; }
  .btn-secondary:hover { background: #26262c; }
  .btn-danger { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.35); }
  .btn-danger:hover { background: rgba(239,68,68,.22); }
  .btn-ghost { color: #b0b0b9; }
  .btn-ghost:hover { background: #27272d; }
  .form-label { color: #d4d4d8; }
  .form-input, .form-select { border-color: var(--color-border); color: var(--color-text); background: var(--color-surface); }
  .form-hint { color: var(--color-text-muted); }
  .flash-notice { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #86efac; }
  .flash-alert { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }
  .badge-green { background: rgba(34,197,94,.15); color: #86efac; }
  .badge-yellow { background: rgba(234,179,8,.15); color: #facc15; }
  .badge-red { background: rgba(239,68,68,.15); color: #fca5a5; }
  .badge-blue { background: rgba(59,130,246,.15); color: #93c5fd; }
  .badge-gray { background: #27272d; color: #d4d4d8; }
  .badge-purple { background: rgba(168,85,247,.16); color: #d8b4fe; }
  .page-title { color: var(--color-text); }
}

/* ============================================================
   Quick record — "＋ Zaznamenat" buttons, measurement / symptom tiles
   (forms unfold inside them), the toast with undo, profile section tiles
   ============================================================ */
.sidebar-record-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin: .75rem .75rem 0; padding: .55rem .75rem;
  background: var(--color-primary); color: #fff; border-radius: var(--radius-btn);
  font-weight: 600; font-size: .875rem;
}
.sidebar-record-btn:hover { background: var(--color-primary-hover); }
.topbar-record-btn {
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  border-radius: 9999px; background: var(--color-primary); color: #fff;
}
.record-fab {
  position: fixed; right: 1rem; z-index: 40;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .5rem;
  height: 3.5rem; padding: 0 1.25rem; border-radius: 9999px;
  background: var(--color-primary); color: #fff; font-weight: 700;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.record-fab:hover { background: var(--color-primary-hover); }
.card-record-btn {
  width: 2rem; height: 2rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 9999px; border: 1px solid var(--color-border); color: var(--color-primary);
}
.card-record-btn:hover { background: rgba(99,102,241,.1); }

.quick-heading {
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-muted); margin-bottom: .5rem;
}
.quick-more { font-size: .875rem; font-weight: 600; color: var(--color-primary); cursor: pointer; list-style: none; }
.quick-more::-webkit-details-marker { display: none; }
.quick-chip {
  display: inline-flex; align-items: center; gap: .375rem; padding: .5rem .875rem;
  border-radius: 9999px; border: 1px solid var(--color-border); background: var(--color-surface);
  font-size: .875rem; color: var(--color-text);
}
.quick-chip:hover { border-color: rgba(99,102,241,.55); }
.quick-person {
  display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .5rem;
  border-radius: var(--radius-card); border: 1px solid var(--color-border); background: var(--color-surface);
  min-width: 0;
}
.quick-person:hover { border-color: rgba(99,102,241,.55); }
.quick-switch { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .25rem; }
.quick-switch-item {
  display: inline-flex; align-items: center; gap: .375rem; flex-shrink: 0;
  padding: .25rem .75rem .25rem .25rem; border-radius: 9999px;
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: .875rem; color: var(--color-text);
}
.quick-switch-item.is-current { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); font-weight: 600; }

.qtile-grid { display: grid; gap: .625rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .qtile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qtile {
  display: block; min-width: 0; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-card);
  scroll-margin: calc(var(--topbar-height) + .5rem);
}
/* An open tile takes the whole row so its form has room. */
.qtile.is-open { grid-column: 1 / -1; border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.qtile-head {
  display: flex; align-items: flex-start; gap: .625rem; width: 100%; padding: .75rem;
  background: transparent; border: 0; text-align: left; color: inherit; cursor: pointer; font: inherit;
}
.qtile-open-always .qtile-head { cursor: default; padding-bottom: .375rem; }
.qtile-icon { font-size: 1.5rem; line-height: 1.75rem; flex-shrink: 0; }
.qtile-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qtile-label { font-size: .8125rem; font-weight: 600; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The number never breaks; its unit drops to the next line when the tile
   is narrow (128/82 mmHg on a phone). */
.qtile-value { font-size: 1.375rem; font-weight: 800; color: var(--color-text); line-height: 1.2; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .25rem; }
.qtile-number-text { white-space: nowrap; }
.qtile-value small { font-size: .75rem; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.qtile-trend { font-size: 1rem; color: var(--color-text-muted); margin-left: .25rem; }
.qtile-when { font-size: .75rem; color: var(--color-text-muted); }
.qtile-plus, .qtile-history {
  width: 1.75rem; height: 1.75rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 9999px; color: var(--color-primary); background: rgba(99,102,241,.1); font-size: .75rem;
}
.qtile-history { background: transparent; color: var(--color-text-muted); }
.qtile.is-open .qtile-plus { transform: rotate(45deg); }
.qtile-spark { flex-shrink: 0; align-self: center; }
.qtile-body { padding: 0 .75rem .75rem; display: flex; flex-direction: column; gap: .625rem; }
.qtile-body[hidden] { display: none; }
.qtile-body form:not(.contents) { display: flex; flex-direction: column; gap: .625rem; }
.qtile-body form.qtile-inputs { flex-direction: row; }
.qtile-inputs { display: flex; align-items: center; gap: .5rem; }
/* Inputs shrink to fit, the unit beside them never squeezes out. */
.qtile-inputs .qtile-number { flex: 1 1 0; min-width: 0; max-width: 6.5rem; width: auto !important; }
.qtile-inputs .qtile-number-wide { max-width: 10rem; }
.qtile-unit, .qtile-sep { flex-shrink: 0; }
.qtile-number { font-size: 1.5rem !important; font-weight: 700; text-align: center; width: 6.5rem !important; padding: .5rem !important; }
.qtile-number-wide { flex: 1; max-width: 10rem; }
.qtile-sep { font-size: 1.5rem; color: var(--color-text-muted); }
.qtile-unit { font-size: .875rem; font-weight: 600; color: var(--color-text-muted); }
.qtile-extra { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--color-text-muted); }
.qtile-extra .qtile-number { font-size: 1.125rem !important; width: 5rem !important; }
.qtile-hint {
  font-size: .875rem; padding: .5rem .625rem; border-radius: var(--radius-input);
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
}
.qtile-hint[hidden] { display: none; }
.qtile-hint-fix { font-weight: 700; text-decoration: underline; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; }
.qtile-note summary { font-size: .8125rem; color: var(--color-primary); cursor: pointer; list-style: none; }
.qtile-note summary::-webkit-details-marker { display: none; }
.qtile-actions { display: flex; gap: .5rem; }
.qtile-scale { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: .25rem; }
.qtile-scale-btn {
  min-height: 2.75rem; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-btn); border: 1px solid var(--color-border); background: var(--color-surface);
  font-weight: 700; font-size: 1rem; color: var(--color-text); cursor: pointer;
}
.qtile-scale-btn:hover { border-color: var(--color-primary); }
.qtile-scale-btn.is-current, .qtile-scale-radio:has(input:checked) { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.qtile-scale-radio:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.qtile-yes.is-current { background: #16a34a; border-color: #16a34a; }
.qtile-no.is-current { background: #dc2626; border-color: #dc2626; }

.when-field-toggle {
  display: inline-flex; align-items: center; gap: .375rem; padding: 0; background: none; border: 0;
  font-size: .875rem; color: var(--color-text); cursor: pointer; font-weight: 600; align-self: flex-start;
}
.when-field-toggle[hidden] { display: none; }
.when-field-change { font-weight: 400; color: var(--color-primary); }
.when-field-change::before { content: "·"; margin: 0 .25rem; color: var(--color-text-muted); }

.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(5rem + env(safe-area-inset-bottom)); width: min(28rem, calc(100% - 2rem));
}
.toast {
  display: flex; align-items: center; gap: .625rem; padding: .75rem 1rem; border-radius: 12px;
  background: #18181b; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: .9375rem;
}
.toast-undo { background: none; border: 0; color: #a5b4fc; font-weight: 700; cursor: pointer; padding: 0 .25rem; }

.section-grid { display: grid; gap: .5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .section-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.section-tile {
  display: flex; align-items: flex-start; gap: .625rem; padding: .75rem; min-width: 0;
  border-radius: var(--radius-card); border: 1px solid var(--color-border); background: var(--color-surface);
}
.section-tile:hover { border-color: rgba(99,102,241,.55); }
.section-tile.is-empty { background: transparent; }
.section-tile-icon { color: var(--color-primary); width: 1.25rem; text-align: center; margin-top: .125rem; flex-shrink: 0; }
.section-tile.is-empty .section-tile-icon { color: var(--color-text-muted); }
.section-tile-label { display: block; font-size: .875rem; font-weight: 600; color: var(--color-text); }
.section-tile-summary { display: block; font-size: .75rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (prefers-color-scheme: dark) {
  .qtile-hint { background: rgba(245,158,11,.12); color: #fcd34d; border-color: rgba(245,158,11,.35); }
  .toast { background: #f4f4f5; color: #18181b; }
  .toast-undo { color: #4f46e5; }
}

/* Field errors (config/initializers/field_errors.rb) */
[aria-invalid="true"] { border-color: #dc2626 !important; }
.field-error { display: block; flex-basis: 100%; }
.qtile-inputs { flex-wrap: wrap; }
.qtile.qtile-wide { grid-column: 1 / -1; }

/* Narrow phones: the "+" sits in the tile's corner so the value gets the
   whole width under the label; scale buttons drop their padding. */
.qtile { position: relative; }
.qtile-head .qtile-plus { position: absolute; top: .625rem; right: .625rem; }
button.qtile-head .qtile-label { padding-right: 2rem; }
.qtile-value { font-size: clamp(1.125rem, 5.5vw, 1.375rem); }
.qtile-scale-btn { padding: 0; font-size: .9375rem; min-width: 0; }
.quick-card-body { padding: .75rem; }
@media (min-width: 640px) { .quick-card-body { padding: 1.25rem; } }

/* ============================================================
   Celebration — reward screen after finishing something (confetti
   canvas sits above it), see shared/_celebration + celebrate.js
   ============================================================ */
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 91; }
.celebration {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(15, 23, 42, .45); opacity: 0; transition: opacity .25s ease; cursor: pointer;
}
.celebration.is-shown { opacity: 1; }
.celebration.is-leaving { opacity: 0; }
.celebration-card {
  width: min(22rem, 100%); text-align: center; padding: 1.75rem 1.5rem 1.25rem; border-radius: 24px;
  background: linear-gradient(160deg, #fff 0%, #fffbeb 100%); border: 3px solid #fcd34d;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); transform: scale(.6); transition: transform .45s cubic-bezier(.2, 1.6, .4, 1);
}
.celebration.is-shown .celebration-card { transform: scale(1); }
.celebration-burst { font-size: 4rem; line-height: 1; animation: celebration-bounce 1s ease .2s 2; }
.celebration-title { margin-top: .75rem; font-size: 1.375rem; font-weight: 800; color: #111827; }
.celebration-earned { margin-top: .75rem; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #92400e; }
.celebration-gains { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .375rem; }
.celebration-gain {
  display: inline-block; padding: .375rem 1rem; border-radius: 9999px; background: #f59e0b; color: #fff;
  font-size: 1.75rem; font-weight: 900; text-shadow: 0 1px 0 rgba(0,0,0,.15); box-shadow: 0 4px 0 #b45309;
  opacity: 0; animation: celebration-pop .5s cubic-bezier(.2, 1.8, .4, 1) forwards;
}
.celebration-note { margin-top: .75rem; font-size: .9375rem; color: #4b5563; }
.celebration-close {
  margin-top: 1.25rem; width: 100%; padding: .75rem; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--color-primary, #4f46e5); color: #fff; font-size: 1.0625rem; font-weight: 800;
}
@keyframes celebration-pop { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes celebration-bounce { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-14px) scale(1.15); } }
@media (prefers-reduced-motion: reduce) {
  .celebration-card, .celebration-gain, .celebration-burst { animation: none; transition: none; transform: none; opacity: 1; }
}
@media (prefers-color-scheme: dark) {
  .celebration { background: rgba(0,0,0,.6); }
  .celebration-card { background: linear-gradient(160deg, #1f1f23 0%, #2a2112 100%); border-color: #b45309; }
  .celebration-title { color: #f4f4f5; }
  .celebration-earned { color: #fcd34d; }
  .celebration-note { color: #a1a1aa; }
}

/* ============================================================
   Workout plan form — exercise cards (workout_plans/_exercise_fields)
   ============================================================ */
.mini-label { display: block; font-size: .6875rem; line-height: 1rem; font-weight: 600; color: #6b7280; margin-bottom: .125rem; }
.exercise-list { display: flex; flex-direction: column; gap: .75rem; counter-reset: exercise; }
.exercise-card {
  counter-increment: exercise; display: flex; flex-direction: column; gap: .625rem;
  padding: .75rem; border: 1px solid #e5e7eb; border-radius: 14px; background: #f9fafb;
}
.exercise-handle { cursor: grab; touch-action: none; user-select: none; color: #9ca3af; font-size: 1.125rem; line-height: 1; padding: .25rem; background: none; border: 0; }
.exercise-number {
  flex-shrink: 0; width: 1.625rem; height: 1.625rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center;
  background: #e0e7ff; color: #4338ca; font-size: .8125rem; font-weight: 800;
}
.exercise-number::before { content: counter(exercise); }
.exercise-remove {
  flex-shrink: 0; width: 2.25rem; height: 2.25rem; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 0; background: none; color: #9ca3af; cursor: pointer;
}
.exercise-remove:hover { background: #fee2e2; color: #dc2626; }
.exercise-types { display: flex; padding: 3px; gap: 3px; border-radius: 10px; background: #e5e7eb; }
.exercise-type { flex: 1; cursor: pointer; }
.exercise-type span {
  display: block; text-align: center; padding: .375rem .25rem; border-radius: 8px;
  font-size: .8125rem; font-weight: 600; color: #4b5563; white-space: nowrap;
}
.exercise-type input:checked + span { background: #fff; color: #4338ca; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.exercise-type input:focus-visible + span { outline: 2px solid #6366f1; outline-offset: 1px; }
.exercise-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; }
.exercise-numbers .form-input { padding-top: .375rem; padding-bottom: .375rem; }
.exercise-video summary { font-size: .75rem; font-weight: 600; color: #6366f1; cursor: pointer; list-style: none; }
.exercise-video summary::before { content: "▸ "; }
.exercise-video[open] summary::before { content: "▾ "; }
.exercise-add {
  display: block; text-align: center; padding: .75rem; border: 2px dashed #c7d2fe; border-radius: 14px;
  color: #4f46e5; font-weight: 700; font-size: .875rem;
}
.exercise-add:hover { background: #eef2ff; }
@media (prefers-color-scheme: dark) {
  .mini-label { color: #a1a1aa; }
  .exercise-card { background: #1c1c20; border-color: #2e2e34; }
  .exercise-number { background: rgba(99,102,241,.2); color: #a5b4fc; }
  .exercise-remove:hover { background: rgba(239,68,68,.15); color: #fca5a5; }
  .exercise-types { background: #27272d; }
  .exercise-type span { color: #a1a1aa; }
  .exercise-type input:checked + span { background: #3f3f46; color: #e0e7ff; }
  .exercise-add { border-color: rgba(99,102,241,.35); color: #a5b4fc; }
  .exercise-add:hover { background: rgba(99,102,241,.1); }
}

/* ============================================================
   Video activities — YouTube player, TV remote, thumbnails
   (workout_plans/run_video, show, _form)
   ============================================================ */
.video-player { aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.video-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-tv-panel { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.video-tv-thumb { width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.video-tv-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; color: #fff; }
.video-card { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.video-card img { width: 100%; height: 100%; object-fit: cover; }
.video-card-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 4rem; height: 4rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center; background: rgba(220, 38, 38, .92); color: #fff; font-size: 1.5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.video-card:hover .video-card-play { transform: translate(-50%, -50%) scale(1.08); }
.video-preview { width: 100%; max-width: 20rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }

/* Exercise catalog: variant chips (level number + name) and the
   easier/harder switch on the run screen. */
.exercise-variant-chip {
  display: inline-flex; align-items: center; gap: .375rem; padding: .125rem .5rem .125rem .125rem;
  border-radius: 9999px; border: 1px solid #e5e7eb; font-size: .75rem; color: #4b5563; background: #fff;
}
.exercise-variant-chip.is-base { border-color: #a5b4fc; color: #3730a3; }
.exercise-variant-level {
  flex-shrink: 0; width: 1.25rem; height: 1.25rem; border-radius: 9999px; display: inline-flex; align-items: center;
  justify-content: center; background: #e0e7ff; color: #4338ca; font-size: .6875rem; font-weight: 800;
}
.exercise-variant-switch { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }
.exercise-variant-switch button {
  padding: .375rem .75rem; border-radius: 9999px; border: 1px solid #e5e7eb; background: #fff; font-size: .8125rem; color: #374151;
}
.exercise-variant-switch button:disabled { opacity: .35; }
.exercise-variant-switch .exercise-variant-current { flex: 1; text-align: center; font-size: .8125rem; color: #6b7280; }
.goal-test-banner {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 14px;
  background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .exercise-variant-chip,
  :root:not([data-theme="light"]) .exercise-variant-switch button { background: #1c1c20; border-color: #2e2e34; color: #d4d4d8; }
  :root:not([data-theme="light"]) .exercise-variant-level { background: rgba(99,102,241,.2); color: #a5b4fc; }
  :root:not([data-theme="light"]) .goal-test-banner { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.35); color: #c7d2fe; }
}
:root[data-theme="dark"] .exercise-variant-chip,
:root[data-theme="dark"] .exercise-variant-switch button { background: #1c1c20; border-color: #2e2e34; color: #d4d4d8; }
:root[data-theme="dark"] .exercise-variant-level { background: rgba(99,102,241,.2); color: #a5b4fc; }
:root[data-theme="dark"] .goal-test-banner { background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.35); color: #c7d2fe; }

/* VR games hub cards */
.vr-game-card {
  display: flex; flex-direction: column; gap: .625rem; padding: 1rem; border-radius: 16px;
  background: #fff; border: 1px solid #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.vr-game-icon {
  flex-shrink: 0; width: 2.5rem; height: 2.5rem; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; background: #eef2ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .vr-game-card { background: #1c1c20; border-color: #2e2e34; }
  :root:not([data-theme="light"]) .vr-game-icon { background: rgba(99,102,241,.18); }
}
:root[data-theme="dark"] .vr-game-card { background: #1c1c20; border-color: #2e2e34; }
:root[data-theme="dark"] .vr-game-icon { background: rgba(99,102,241,.18); }
