/* ===========================
   FitPlan — shell OptimeFlow(s)
   Header + footer adaptados desde ECOnTROLl
   PWA de entrenamiento con rutinas, temporizador, sesiones y overlays
   =========================== */

:root {
  color-scheme: dark;

  --font-stack: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, Arial, "Noto Sans", sans-serif;

  --bg: #04150f;
  --panel: #071c13;
  --ink: #eafff3;
  --muted: #93b6a4;
  --muted-strong: #c9e6d5;

  --primary: #22c55e;
  --primary-strong: #047857;
  --accent: #84cc16;
  --danger: #fb7185;
  --danger-strong: #be123c;
  --success: #10b981;
  --warning: #facc15;

  --ghost: #0b1a15;
  --field: #071812;
  --border: #047857;
  --line: rgba(255, 255, 255, 0.10);
  --border-subtle: color-mix(in srgb, var(--border) 48%, transparent);

  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.10);
  --surface-solid: #071c13;
  --surface-card: linear-gradient(145deg, rgba(4, 12, 9, 0.94), rgba(5, 18, 13, 0.80));

  --text: var(--ink);
  --text-soft: var(--muted);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --glass: blur(18px) saturate(1.18);

  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --content-max: 820px;

  --bg-blob-1: #22c55e;
  --bg-blob-2: #84cc16;
  --bg-blob-3: #10b981;
  --bg-blob-4: #0ea5e9;

  --ambient-opacity: 0.66;
  --ambient-blur: 64px;
  --ambient-sat: 1.14;

  --stage-opacity: 0.99;
  --stage-radius: 26px;
  --stage-tint-1: color-mix(in srgb, #020617 84%, var(--bg-blob-1));
  --stage-tint-2: color-mix(in srgb, #020617 84%, var(--bg-blob-2));
  --stage-tint-3: color-mix(in srgb, #020617 84%, var(--bg-blob-3));
  --stage-tint-4: color-mix(in srgb, #020617 84%, var(--bg-blob-4));
  --stage-base-1: color-mix(in srgb, rgba(2, 6, 23, 0.96) 82%, var(--stage-tint-2) 18%);
  --stage-base-2: color-mix(in srgb, rgba(2, 6, 23, 0.86) 90%, var(--stage-tint-1) 10%);
  --stage-border: color-mix(in srgb, var(--stage-tint-2) 30%, rgba(255, 255, 255, 0.12));

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  --header-h: 56px;
  --footer-h: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: -22vmax;
  pointer-events: none;
  z-index: -3;
  background:
    radial-gradient(900px 700px at 14% 14%, color-mix(in srgb, var(--bg-blob-1) 48%, transparent) 0%, transparent 64%),
    radial-gradient(900px 700px at 90% 10%, color-mix(in srgb, var(--bg-blob-2) 46%, transparent) 0%, transparent 66%),
    radial-gradient(950px 720px at 78% 90%, color-mix(in srgb, var(--bg-blob-3) 44%, transparent) 0%, transparent 68%),
    radial-gradient(1100px 820px at 18% 92%, color-mix(in srgb, var(--bg-blob-4) 40%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.88), rgba(2, 6, 23, 0.58));
  filter: blur(var(--ambient-blur)) saturate(var(--ambient-sat)) contrast(1.02);
  opacity: var(--ambient-opacity);
  transform: translate3d(0, 0, 0);
  will-change: transform;
  animation: ambientDrift 18s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  left: calc(10px + var(--safe-left));
  right: calc(10px + var(--safe-right));
  top: calc(var(--header-h) + 10px + var(--safe-top));
  bottom: calc(var(--footer-h) + 10px + var(--safe-bottom));
  pointer-events: none;
  z-index: -2;
  border-radius: var(--stage-radius);
  background:
    radial-gradient(1200px 360px at 50% 0%, rgba(255, 255, 255, 0.08) 0%, transparent 74%),
    radial-gradient(900px 680px at 12% 18%, color-mix(in srgb, var(--stage-tint-1) 54%, transparent) 0%, transparent 69%),
    radial-gradient(860px 660px at 88% 18%, color-mix(in srgb, var(--stage-tint-2) 50%, transparent) 0%, transparent 70%),
    radial-gradient(940px 720px at 76% 92%, color-mix(in srgb, var(--stage-tint-3) 46%, transparent) 0%, transparent 72%),
    radial-gradient(1040px 760px at 18% 94%, color-mix(in srgb, var(--stage-tint-4) 42%, transparent) 0%, transparent 74%),
    radial-gradient(140% 120% at 50% 52%, transparent 46%, rgba(0, 0, 0, 0.64) 100%),
    linear-gradient(150deg,
      color-mix(in srgb, var(--stage-base-1) 94%, #020617) 0%,
      color-mix(in srgb, var(--stage-base-2) 92%, #020617) 48%,
      color-mix(in srgb, var(--stage-tint-3) 28%, #020617) 100%
    );
  border: 1px solid var(--stage-border);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 54px color-mix(in srgb, var(--bg-blob-2) 12%, transparent),
    0 0 28px rgba(0, 0, 0, 0.58) inset;
  backdrop-filter: blur(20px) saturate(1.15) contrast(1.03);
  opacity: var(--stage-opacity);
}

@keyframes ambientDrift {
  0% { transform: translate3d(-1.5%, -1.2%, 0) scale(1.02) rotate(-1deg); }
  100% { transform: translate3d(1.5%, 1.2%, 0) scale(1.05) rotate(1deg); }
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  min-width: 0;
}

select,
input[type="date"] {
  color-scheme: dark;
}

select option {
  background: var(--surface-solid);
  color: var(--text);
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.page-root {
  height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 0;
}

.page-root::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(760px 420px at 50% -12%, rgba(255, 255, 255, 0.06), transparent 76%),
    radial-gradient(900px 520px at 50% 112%, color-mix(in srgb, var(--bg-blob-2) 7%, transparent), transparent 74%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 34%, rgba(0, 0, 0, 0.24));
  opacity: 0.68;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* ===========================
   Botones base
   =========================== */

.btn,
.button,
.text-button,
.icon-button,
.card-button {
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.18s ease, transform 0.08s ease, filter 0.16s ease, opacity 0.16s ease;
}

.btn {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.78));
  color: var(--text);
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.btn:hover,
.btn:focus-visible {
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.26), transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg-blob-2) 22%, rgba(15, 23, 42, 0.92)), rgba(15, 23, 42, 0.78));
  border-color: color-mix(in srgb, var(--accent) 65%, white);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.62),
    0 0 22px color-mix(in srgb, var(--bg-blob-1) 28%, transparent);
  transform: translateY(-1px);
  filter: brightness(1.03);
  outline: none;
}

.btn.ghost,
.button--ghost,
.card-button {
  background:
    radial-gradient(circle at 30% 0%, rgba(148, 163, 184, 0.18), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.90), rgba(15, 23, 42, 0.74));
  border: 1px solid var(--border-subtle);
  color: var(--text);
}

.button {
  min-height: 54px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  font-weight: 950;
  letter-spacing: -0.01em;
}

.button:active,
.btn:active,
.card-button:active {
  transform: scale(0.98);
  filter: brightness(0.98);
}

.button--primary {
  color: #03120a;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.34) 0, transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--primary) 78%, white), var(--primary), var(--primary-strong));
  border-color: color-mix(in srgb, var(--primary) 80%, white);
  box-shadow:
    0 14px 42px color-mix(in srgb, var(--primary) 26%, transparent),
    0 0 0 1px color-mix(in srgb, var(--primary-strong) 60%, transparent) inset,
    0 0 40px color-mix(in srgb, var(--primary) 20%, transparent);
}

.button:hover,
.button:focus-visible,
.card-button:hover,
.card-button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.04);
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 65%, white);
}

.text-button {
  border: 0;
  color: color-mix(in srgb, var(--primary) 82%, white);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 950;
  padding: 10px 0 10px 10px;
}

.text-button:hover,
.text-button:focus-visible {
  color: color-mix(in srgb, var(--accent) 86%, white);
  outline: none;
}

.text-button--danger {
  color: var(--danger);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.90), rgba(15, 23, 42, 0.72));
  color: var(--text);
  flex-shrink: 0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.icon-button:hover,
.icon-button:focus-visible {
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg-blob-2) 18%, rgba(15, 23, 42, 0.92)), rgba(15, 23, 42, 0.72));
  border-color: color-mix(in srgb, var(--accent) 65%, white);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48), 0 0 20px color-mix(in srgb, var(--bg-blob-1) 24%, transparent);
  transform: translateY(-1px);
  filter: brightness(1.03);
  outline: none;
}

.icon-gear {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.55);
  position: relative;
}

.icon-gear::before,
.icon-gear::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.75);
}

.icon-gear::after {
  inset: 7px;
  border-width: 3px;
  border-color: color-mix(in srgb, var(--bg-blob-1) 65%, white);
}

/* ===========================
   Header OptimeFlow(s)
   =========================== */

.app-header {
  padding: 24px;
}

.brand-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding:
    calc(6px + var(--safe-top))
    calc(14px + var(--safe-right))
    6px
    calc(14px + var(--safe-left));
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--bg-blob-1) 14%, transparent), transparent 56%),
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--bg-blob-2) 12%, transparent), transparent 56%),
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--bg-blob-3) 8%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(5, 10, 24, 0.94), rgba(5, 10, 24, 0.72));
  backdrop-filter: var(--glass);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  min-height: 40px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.16s ease;
}

.brand-home-link:hover,
.brand-home-link:focus-visible {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.04);
}

.brand-home-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--bg-blob-1) 72%, white);
  outline-offset: 3px;
}

.brand-logo {
  height: clamp(32px, 5vw, 48px);
  width: clamp(32px, 5vw, 48px);
  border-radius: 10px;
  object-fit: contain;
  background: transparent;
  border: none;
}

.heat {
  filter:
    url(#heat-waves)
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.35))
    drop-shadow(0 0 18px color-mix(in srgb, var(--bg-blob-1) 35%, transparent));
}

.brand-word {
  font-weight: 800;
  font-size: clamp(1.6rem, 2.8vw, 2rem);
  letter-spacing: 0.2px;
}

.brand-neon {
  color: #eaf6ff;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.22),
    0 0 22px color-mix(in srgb, var(--bg-blob-1) 25%, transparent),
    0 0 34px color-mix(in srgb, var(--bg-blob-3) 18%, transparent);
  animation: hue 12s linear infinite, glow 3.2s ease-in-out infinite;
}

@supports (-webkit-background-clip: text) {
  .brand-neon {
    background: conic-gradient(from 90deg, var(--bg-blob-1), var(--bg-blob-2), var(--bg-blob-3), var(--bg-blob-4), var(--bg-blob-1));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

@keyframes hue {
  from { filter: hue-rotate(0); }
  to { filter: hue-rotate(360deg); }
}

@keyframes glow {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 255, 255, 0.22), 0 0 14px color-mix(in srgb, var(--bg-blob-1) 28%, transparent); }
  50% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.42), 0 0 24px color-mix(in srgb, var(--bg-blob-2) 34%, transparent); }
}

.tagline {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  pointer-events: none;
  text-align: center;
}

.tagline-fitplan {
  animation: fitFloat 6.4s ease-in-out infinite;
}

.fit-glyph {
  display: inline-block;
  line-height: 1;
  transform-origin: center bottom;
}

.fit-core {
  font-weight: 950;
  font-size: 1.72rem;
  color: #ecfff4;
  text-shadow:
    0 0 8px rgba(180, 255, 212, 0.55),
    0 0 18px color-mix(in srgb, var(--bg-blob-1) 34%, transparent),
    0 0 34px color-mix(in srgb, var(--bg-blob-2) 22%, transparent);
  animation: fitHue 10s linear infinite;
}

.fit-soft {
  font-weight: 900;
  font-size: 1.56rem;
  color: #ffffff;
  opacity: 0.94;
  text-shadow:
    0 0 7px rgba(255, 255, 255, 0.20),
    0 0 16px color-mix(in srgb, var(--bg-blob-3) 24%, transparent),
    0 0 26px color-mix(in srgb, var(--bg-blob-1) 18%, transparent);
  animation: fitPulse 4.8s ease-in-out infinite;
}

.fit-ln {
  margin: 0 1px;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-weight: 950;
  font-style: italic;
  font-size: 1.82rem;
  color: #d1fae5;
  text-shadow:
    0 0 10px rgba(209, 250, 229, 0.42),
    0 0 24px color-mix(in srgb, var(--success) 34%, transparent),
    0 0 36px color-mix(in srgb, var(--bg-blob-2) 22%, transparent);
}

@supports (-webkit-background-clip: text) {
  .fit-ln {
    background: conic-gradient(from 90deg, var(--success), var(--bg-blob-1), var(--bg-blob-2), var(--bg-blob-4), var(--success));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

@keyframes fitFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-2px); }
}

@keyframes fitHue {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}

@keyframes fitPulse {
  0%, 100% { opacity: 0.78; transform: translateY(0); }
  50% { opacity: 0.98; transform: translateY(-2px); }
}

.wobble {
  animation: wobble 2.6s ease-in-out infinite;
  transform-origin: 50% 70%;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-1px); }
}

.pulse {
  animation: pulseUp 2.4s ease-in-out infinite;
}

@keyframes pulseUp {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.04); }
}

.quick-controls {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===========================
   Stage / contenido
   =========================== */

.app-main {
  position: fixed;
  left: calc(10px + var(--safe-left));
  right: calc(10px + var(--safe-right));
  top: calc(var(--header-h) + 10px + var(--safe-top));
  bottom: calc(var(--footer-h) + 10px + var(--safe-bottom));
  z-index: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  clip-path: inset(0 round var(--stage-radius));
  border-radius: var(--stage-radius);
  padding:
    16px
    calc(16px + var(--safe-right))
    calc(24px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 40%, transparent) transparent;
}

.app-main::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.app-main::-webkit-scrollbar-track {
  background: transparent;
}

.app-main::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 30%, rgba(255, 255, 255, 0.10));
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.stage-shell {
  width: min(var(--content-max), 100%);
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 2px;
}

.content,
main {
  display: grid;
  gap: 16px;
}

.panel,
.stat-card,
.exercise-card,
.empty-state,
.session-card,
.overlay .box {
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--bg-blob-1) 8%, transparent), transparent 54%),
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--bg-blob-3) 7%, transparent), transparent 52%),
    var(--surface-card);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: var(--glass);
}

.panel {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero {
  display: grid;
  gap: 20px;
  padding: clamp(20px, 5vw, 28px);
  position: relative;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -22% auto auto -10%;
  width: 48%;
  height: 70%;
  background: radial-gradient(circle, color-mix(in srgb, var(--bg-blob-2) 22%, transparent), transparent 72%);
  filter: blur(36px);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}

.hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -72px;
  top: -72px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 26%, transparent), transparent 68%);
  z-index: -1;
}

.hero h2,
.section-heading h2 {
  margin: 0;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.hero h2 {
  max-width: 12ch;
  margin-top: 8px;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.95;
}

.hero p:not(.eyebrow) {
  margin-top: 12px;
  max-width: 48ch;
}

.hero__actions {
  display: grid;
  gap: 10px;
}

.eyebrow {
  display: inline-flex;
  color: color-mix(in srgb, var(--primary) 78%, white);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
  margin-bottom: 5px;
}

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

.stat-card {
  min-width: 0;
  border-radius: 22px;
  padding: 14px 12px;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--bg-blob-1) 8%, transparent), transparent 54%),
    rgba(0, 0, 0, 0.16);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.15rem, 5vw, 1.7rem);
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px) 0;
}

.section-heading h2 {
  font-size: clamp(1.35rem, 6vw, 2.15rem);
  line-height: 1.05;
}

.exercise-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px);
}

.field {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 850;
}

.field--full {
  grid-column: 1 / -1;
}

.field span {
  color: var(--muted-strong);
  font-weight: 850;
}

.field small,
.muted {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.field input,
.field select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: rgba(0, 0, 0, 0.24);
  padding: 0 14px;
}

.field input:focus,
.field select:focus {
  border-color: color-mix(in srgb, var(--primary) 60%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.form-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

#repsFields {
  grid-template-columns: 1fr 1fr;
}

.form-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.empty-state {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin: 18px clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px);
  padding: 30px 20px 34px;
  text-align: center;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--bg-blob-1) 8%, transparent), transparent 54%),
    rgba(0, 0, 0, 0.16);
}

.empty-state div {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 1.8rem;
}

.exercise-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px);
  list-style: none;
}

.exercise-card {
  display: grid;
  gap: 14px;
  border-radius: var(--radius-lg);
  padding: 16px;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--bg-blob-1) 8%, transparent), transparent 54%),
    rgba(0, 0, 0, 0.16);
}

.exercise-card__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.exercise-card__title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.exercise-card__title h3 {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.badge {
  width: max-content;
  max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px;
  padding: 5px 9px;
  color: #b7ffd2;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.exercise-card__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.exercise-card__actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.card-button {
  min-height: 42px;
  border-radius: 14px;
  font-weight: 950;
}

.card-button--danger {
  color: var(--danger);
}

/* ===========================
   Footer OptimeFlow(s)
   =========================== */

.brand-footer {
  background:
    radial-gradient(circle at 0% 100%, color-mix(in srgb, var(--bg-blob-1) 10%, transparent), transparent 58%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--bg-blob-2) 9%, transparent), transparent 58%),
    linear-gradient(0deg, rgba(5, 10, 24, 0.96), rgba(5, 10, 24, 0.76));
  border-top: 1px solid var(--border-subtle);
  padding:
    4px
    calc(12px + var(--safe-right))
    calc(4px + var(--safe-bottom))
    calc(12px + var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.50);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  backdrop-filter: var(--glass);
}

.brand-footer strong {
  color: var(--ink);
}

.brand-footer .sep {
  opacity: 0.6;
}

.brand-footer .btn.ghost {
  background: rgba(15, 23, 42, 0.70);
  border: 1px solid var(--border-subtle);
  color: var(--ink);
  height: 26px;
  border-radius: 7px;
  padding: 0 10px;
  font-weight: 850;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  min-width: 0;
}

.f-left-row1,
.f-left-row2 {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

#footerAppName {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
}

.footer-author-link {
  color: #c89a33;
  text-decoration: none;
  font-weight: 750;
  transition: color 0.14s ease, text-shadow 0.14s ease;
}

.footer-author-link:hover,
.footer-author-link:focus-visible {
  color: #e3ba60;
  text-shadow: 0 0 12px rgba(227, 186, 96, 0.24);
  text-decoration: underline;
}

.footer-author-link:focus-visible {
  outline: none;
}

.footer-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
}

.footer-logo-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.14s ease, transform 0.08s ease, filter 0.14s ease, border-color 0.12s ease, background-color 0.12s ease;
  box-shadow: none;
}

.footer-logo-btn:hover,
.footer-logo-btn:focus-visible {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.70));
  border-color: color-mix(in srgb, var(--accent) 60%, white);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  outline: none;
}

.footer-logo-btn:active {
  transform: scale(0.97);
}

.footer-logo {
  height: clamp(28px, 6vw, 36px);
  width: clamp(28px, 6vw, 36px);
  object-fit: contain;
  border-radius: 10px;
}

.tag-logo {
  object-fit: contain;
  transform-origin: center center;
  animation: sway 5.5s ease-in-out infinite;
  filter:
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.28))
    drop-shadow(0 0 16px color-mix(in srgb, var(--bg-blob-1) 22%, transparent));
}

@keyframes sway {
  0% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
  100% { transform: rotate(-3deg); }
}

/* ===========================
   Overlays
   =========================== */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--bg-blob-2) 12%, transparent), transparent 58%),
    radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--bg-blob-1) 10%, transparent), transparent 62%),
    rgba(3, 7, 18, 0.76);
  backdrop-filter: blur(22px) saturate(1.12);
  z-index: 90;
}

.overlay[hidden] {
  display: none;
}

.overlay.is-visible {
  display: flex !important;
}

.overlay .box {
  border-radius: 18px;
  max-width: min(640px, 100% - 32px);
  max-height: min(80vh, 640px);
  padding: 16px 16px 14px;
  overflow: auto;
  font-size: 0.86rem;
}

.overlay .box h2 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.overlay .box .small {
  font-size: 0.86rem;
  color: var(--text-soft);
  line-height: 1.55;
}

.overlay .box .small p {
  margin: 0 0 0.85rem;
}

.overlay .box .small p:last-child {
  margin-bottom: 0;
}

.settings-fields {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.overlay-actions {
  margin-top: 12px;
  text-align: right;
}

.license-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  background: rgba(15, 23, 42, 0.70);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
}

body.overlay-open {
  overflow: hidden;
}

body.overlay-open .app-main {
  overflow: hidden;
}

/* ===========================
   Sesión de entrenamiento
   =========================== */

body.session-open {
  overflow: hidden;
}

.session-screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  min-height: 100svh;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 25%, transparent), transparent 30rem),
    rgba(4, 10, 18, 0.96);
}

.session-screen[hidden] {
  display: none;
}

.session-card {
  display: grid;
  align-content: space-between;
  gap: 24px;
  width: min(100%, 620px);
  min-height: calc(100svh - 32px - var(--safe-top) - var(--safe-bottom));
  margin: 0 auto;
  border-radius: 32px;
  padding: 20px;
}

.session-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.session-header h2 {
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: clamp(1.6rem, 7vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.session-header .icon-button {
  flex: 0 0 46px;
  width: 46px;
  border-radius: 17px;
  font-size: 1.4rem;
}

.session-set-info,
.session-hint {
  text-align: center;
}

.timer-ring {
  --progress: 0;
  display: grid;
  width: min(78vw, 360px);
  aspect-ratio: 1;
  place-items: center;
  margin: 0 auto;
  border-radius: 999px;
  background:
    conic-gradient(var(--primary) calc(var(--progress) * 1%), rgba(255, 255, 255, 0.09) 0),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 80px color-mix(in srgb, var(--primary) 14%, transparent);
}

.timer-ring__inner {
  display: grid;
  place-items: center;
  width: 78%;
  aspect-ratio: 1;
  border-radius: inherit;
  background: #081320;
  text-align: center;
}

.timer-ring__inner strong {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.2rem, 18vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.timer-ring__inner span {
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(0.9rem, 4vw, 1.15rem);
  font-weight: 900;
}

.session-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===========================
   Responsive
   =========================== */

@media (min-width: 700px) {
  .form-actions,
  .hero__actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1024px) and (orientation: portrait) {
  .brand {
    justify-content: space-between;
    flex-wrap: nowrap;
    min-height: 46px;
  }

  .brand-word {
    display: none;
  }

  .brand-home-link,
  .quick-controls {
    position: relative;
    z-index: 1;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .tagline {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: calc(100% - 132px);
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
  }

  .fit-core { font-size: 1.46rem; }
  .fit-soft { font-size: 1.36rem; }
  .fit-ln { font-size: 1.56rem; }
  .quick-controls { margin-left: auto; }
}

@media (max-width: 680px) {
  .brand-header {
    padding-left: calc(10px + var(--safe-left));
    padding-right: calc(10px + var(--safe-right));
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .tagline {
    max-width: calc(100% - 124px);
  }

  .fit-core { font-size: 1.34rem; }
  .fit-soft { font-size: 1.26rem; }
  .fit-ln { font-size: 1.42rem; }

  .app-main {
    padding:
      12px
      calc(12px + var(--safe-right))
      calc(20px + var(--safe-bottom))
      calc(12px + var(--safe-left));
  }

  .summary-grid,
  .exercise-form,
  #repsFields {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .section-heading .text-button {
    justify-self: start;
    padding-left: 0;
  }

  .stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .stat-card strong {
    margin-top: 0;
  }

  .brand-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    padding-top: 3px;
    padding-right: calc(10px + var(--safe-right));
    padding-bottom: calc(3px + var(--safe-bottom));
    padding-left: calc(10px + var(--safe-left));
    column-gap: 6px;
  }

  .footer-left {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    justify-self: flex-start;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    row-gap: 0;
    column-gap: 0;
    text-align: left;
    font-size: 0.72rem;
    line-height: 1.12;
  }

  .f-left-row1,
  .f-left-row2 {
    display: contents;
  }

  .f-left-row1 strong {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .f-left-row1 .sep,
  .f-left-row2 .sep {
    display: none;
  }

  #footerAppName {
    grid-column: 1;
    grid-row: 2;
    display: inline;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #f-year {
    grid-column: 2;
    grid-row: 2;
    white-space: nowrap;
  }

  #f-year::before {
    content: "•";
    display: inline-block;
    margin: 0 4px;
    color: var(--muted);
    opacity: 0.6;
  }

  .footer-author-link {
    grid-column: 1 / -1;
    grid-row: 3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .footer-center {
    position: static;
    transform: none;
    justify-self: center;
  }

  .footer-right {
    justify-self: flex-end;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
  }

  .brand-footer .btn.ghost {
    height: 24px;
    padding: 0 8px;
    font-size: 0.74rem;
  }

  .footer-logo-btn {
    padding: 1px;
  }

  .footer-logo {
    height: clamp(38px, 11vw, 54px);
    width: clamp(38px, 11vw, 54px);
  }
}

@media (max-width: 440px) {
  .brand-header {
    padding-left: calc(8px + var(--safe-left));
    padding-right: calc(8px + var(--safe-right));
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .tagline {
    max-width: calc(100% - 118px);
  }

  .fit-core { font-size: 1.18rem; }
  .fit-soft { font-size: 1.12rem; }
  .fit-ln { font-size: 1.28rem; }

  .hero h2 {
    font-size: clamp(2.1rem, 14vw, 4.1rem);
  }

  .exercise-card__actions {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  body::before,
  .tag-logo,
  .tagline-fitplan,
  .brand-neon,
  .fit-core,
  .fit-soft,
  .fit-ln,
  .wobble,
  .pulse {
    animation: none;
  }
}

/* ===========================
   Upgrade — secciones, biblioteca, tablas y analítica
   =========================== */

button,
input,
select,
textarea {
  font: inherit;
}

textarea {
  min-width: 0;
  resize: vertical;
}

.field textarea {
  width: 100%;
  min-height: 108px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: rgba(0, 0, 0, 0.24);
  padding: 12px 14px;
  line-height: 1.45;
}

.field textarea:focus {
  border-color: color-mix(in srgb, var(--primary) 60%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.section-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  position: sticky;
  top: 0;
  z-index: 15;
  flex: 0 0 auto;
  min-height: calc(44px + 16px + 2px);
  align-items: stretch;
}

.section-tab {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted-strong);
  background: transparent;
  font-weight: 950;
  letter-spacing: -0.01em;
}

.section-tab:hover,
.section-tab:focus-visible {
  outline: none;
  color: var(--text);
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.06);
}

.section-tab.is-active {
  color: #03120a;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.34), transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--primary) 78%, white), var(--primary), var(--primary-strong));
  border-color: color-mix(in srgb, var(--primary) 80%, white);
  box-shadow: 0 12px 34px color-mix(in srgb, var(--primary) 22%, transparent);
}

.section-view {
  display: grid;
  gap: 16px;
}

.section-view[hidden] {
  display: none !important;
}

.section-copy {
  margin-top: 8px;
  max-width: 58ch;
  font-size: 0.92rem;
}

.hero--compact h2 {
  max-width: 16ch;
}

.library-tools,
.table-builder,
.analytics-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 0.8fr);
  gap: 14px;
  padding: 18px clamp(18px, 5vw, 24px) 0;
  align-items: end;
}

.table-builder,
.analytics-controls {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(160px, 0.7fr);
  padding-bottom: 18px;
}

.analytics-controls {
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 1fr) minmax(160px, 0.8fr);
}

.workout-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px clamp(18px, 5vw, 24px) 0;
  align-items: start;
}

.workout-config-grid .field input:disabled,
.workout-config-grid .field select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.group-preview {
  display: grid;
  gap: 14px;
  padding: 18px clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px);
}

.group-preview__heading {
  display: grid;
  gap: 6px;
}

.group-preview__heading h3 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.group-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.group-preview-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 54%),
    rgba(0, 0, 0, 0.16);
}

.group-preview-card--sequential {
  grid-column: 1 / -1;
}

.group-preview-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.group-preview-card__header strong {
  color: var(--muted-strong);
  font-size: 0.9rem;
  text-align: right;
  line-height: 1.25;
}

.group-preview-sequence {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.4;
}

.group-preview-sequence li::marker {
  color: var(--primary);
  font-weight: 950;
}

.inline-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.14);
}

.inline-empty[hidden] {
  display: none;
}

.inline-empty span {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 1.25rem;
}

.library-detail {
  padding: 18px clamp(18px, 5vw, 24px) 0;
}

.library-detail-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.18);
}

.library-detail-card__body,
.library-detail-card__title {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.library-detail-card__title h3 {
  font-size: clamp(1.3rem, 5vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-grid > div,
.detail-list-block {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.detail-grid strong,
.detail-list-block strong {
  color: var(--muted-strong);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-list-block ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  padding: 18px clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px);
}

.library-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.16);
  transition: border-color 0.16s ease, transform 0.08s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.library-card.is-selected {
  border-color: color-mix(in srgb, var(--primary) 72%, white);
  background:
    radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 58%),
    rgba(0, 0, 0, 0.22);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--primary) 12%, transparent);
}

.library-card__select {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.library-card__select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 70%, white);
  outline-offset: 4px;
  border-radius: 18px;
}

.library-card__content {
  display: grid;
  gap: 7px;
  min-width: 0;
  align-content: start;
}

.library-card__content strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.library-card__content small {
  color: var(--muted);
  font-weight: 850;
}

.library-card__add {
  width: 100%;
}

.exercise-card--rich .exercise-card__top {
  align-items: stretch;
  justify-content: flex-start;
}

.exercise-card__badges,
.muscle-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.muscle-tags--wrap,
.exercise-card__badges {
  flex-wrap: wrap;
}

.muscle-tags--stacked {
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
}

.muscle-tags--stacked .muscle-tag {
  justify-content: flex-start;
  width: fit-content;
  max-width: 100%;
  text-align: left;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  writing-mode: horizontal-tb;
}

.badge--ghost {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.muscle-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #d7ffe6;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.muscle-tag--empty {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.10);
}

.exercise-card__description {
  max-width: 64ch;
  font-size: 0.88rem;
}

.muscle-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.13);
}

.muscle-fieldset legend {
  padding: 0 8px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 850;
}

.chip-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-strong);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.08s ease;
}

.chip-check:hover,
.chip-check:focus-within {
  border-color: color-mix(in srgb, var(--accent) 64%, white);
  background: rgba(255, 255, 255, 0.08);
}

.chip-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.chip-check:has(input:checked) {
  color: #03120a;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.34), transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--primary) 78%, white), var(--primary));
  border-color: color-mix(in srgb, var(--primary) 78%, white);
}

.weekly-table-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 0 clamp(18px, 5vw, 24px) clamp(18px, 5vw, 24px);
}

.week-day-card,
.chart-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.16);
}

.week-day-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.week-day-card__header h3,
.chart-card h3 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.week-day-card__header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.week-day-list,
.analytics-history-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-day-empty,
.empty-chart {
  color: var(--muted);
  line-height: 1.45;
}

.week-plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.week-plan-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.week-plan-item p {
  margin-bottom: 8px;
  font-size: 0.84rem;
}

.week-plan-item__actions {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  gap: 6px;
}

.week-plan-item__actions .card-button {
  min-height: 38px;
  border-radius: 12px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 clamp(18px, 5vw, 24px) 18px;
}

.analytics-stat strong {
  font-size: clamp(1rem, 4vw, 1.55rem);
}

.chart-card--wide {
  grid-column: 1 / -1;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-row__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 850;
}

.bar-row__label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bar-row__track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar-row__track span {
  display: block;
  width: var(--bar-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 20px color-mix(in srgb, var(--primary) 24%, transparent);
}

.analytics-history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.analytics-history-list strong {
  color: var(--text);
}

.analytics-history-list span {
  color: var(--muted);
  text-align: right;
  line-height: 1.35;
}

@media (max-width: 820px) {
  .library-tools,
  .table-builder,
  .analytics-controls,
  .workout-config-grid,
  .library-detail-card,
  .detail-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .table-builder,
  .analytics-controls {
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .section-nav {
    position: static;
    border-radius: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-tab {
    min-height: 42px;
  }

  .library-card__select,
  .exercise-card--rich .exercise-card__top,
  .week-plan-item {
    grid-template-columns: 1fr;
  }

  .library-grid,
  .weekly-table-grid,
  .dashboard-grid,
  .group-preview-list {
    grid-template-columns: 1fr;
  }

  .week-plan-item__actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-history-list li {
    display: grid;
    justify-items: start;
  }

  .analytics-history-list span {
    text-align: left;
  }
}
