/* ============================================================
   Sam's Training Journal — styles.css
   Mobile-first. White. Clean. Apple-ish.
   Desktop: ~430–480px centered, phone-in-browser feel.
   ============================================================ */


/* ================================================================
   DESIGN TOKENS
   ================================================================ */

:root {
  /* --- Palette --- */
  --color-bg-page:       #f2f2f7;   /* iOS system background (light grey) */
  --color-bg-surface:    #ffffff;   /* Cards, panels, nav bar */
  --color-bg-surface-2:  #f2f2f7;   /* Inset / grouped sections */
  --color-border:        #e5e5ea;   /* Dividers, card borders */
  --color-border-strong: #c7c7cc;   /* Input borders, separators */

  --color-text-primary:  #1c1c1e;   /* Main body text */
  --color-text-secondary:#636366;   /* Labels, captions */
  --color-text-tertiary: #aeaeb2;   /* Placeholders, disabled */
  --color-text-on-accent:#ffffff;   /* Text on accent buttons */

  --color-accent:        #007aff;   /* iOS blue — primary actions */
  --color-accent-hover:  #0062cc;
  --color-accent-subtle: #e8f0fe;   /* Accent tint for backgrounds */

  --color-danger:        #ff3b30;   /* Destructive actions */
  --color-success:       #34c759;   /* Confirmations */
  --color-warning:       #ff9f0a;   /* Warnings */

  /* --- Typography --- */
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                  "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Type scale */
  --text-xs:   0.75rem;   /* 12px — captions */
  --text-sm:   0.875rem;  /* 14px — secondary labels */
  --text-base: 1rem;      /* 16px — body */
  --text-md:   1.0625rem; /* 17px — iOS default body */
  --text-lg:   1.25rem;   /* 20px — section titles */
  --text-xl:   1.5rem;    /* 24px — screen headings */
  --text-2xl:  1.875rem;  /* 30px — hero / display */

  /* Font weights */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* --- Spacing --- */
  --space-1:  0.25rem;   /* 4px  */
  --space-2:  0.5rem;    /* 8px  */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */

  /* --- Radii --- */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* --- Shadows --- */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-nav:  0 -1px 0 var(--color-border);

  /* --- Layout --- */
  --app-max-width:  480px;
  --header-height:  52px;
  --nav-height:     64px;    /* bottom nav bar */
  --nav-height-safe: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}


/* ================================================================
   RESET
   ================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-page);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* ================================================================
   PAGE-LEVEL LAYOUT
   Desktop: grey page behind the centered phone container.
   Mobile: the phone container IS the full viewport.
   ================================================================ */

#app {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  height: 100%;
  background-color: var(--color-bg-page);
}

/* On desktop, add subtle depth around the phone shell */
@media (min-width: 600px) {
  #app {
    padding: var(--space-8) var(--space-4);
    align-items: center;
    min-height: 100vh;
  }
}


/* ================================================================
   APP SHELL — the phone-width container
   ================================================================ */

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max-width);
  min-height: 100vh;
  background-color: var(--color-bg-page);
  /* On mobile: stretch full height so nav always hugs the bottom of the screen */
}

/* view-app must be a flex column filling the full shell height
   so that app-main can grow and push app-nav to the very bottom */
#view-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;        /* fill viewport on mobile */
  width: 100%;
}

/* On desktop: fill the fixed-height shell */
@media (min-width: 600px) {
  #view-app {
    min-height: 100%;
    height: 100%;
  }
}


/* On desktop: give it a phone-like card appearance */
@media (min-width: 600px) {
  .app-shell {
    min-height: min(812px, 90vh);
    max-height: 90vh;
    height: 90vh;           /* fixed height so inner flex children fill it */
    border-radius: var(--radius-xl);
    box-shadow:
      0 0 0 1px rgba(0,0,0,0.06),
      0 8px 32px rgba(0,0,0,0.10),
      0 32px 64px rgba(0,0,0,0.06);
    overflow: hidden;       /* clips border-radius on desktop */
  }
  /* app-main must scroll within the fixed-height shell on desktop */
  .app-main {
    overflow-y: auto;
  }
}


/* ================================================================
   HEADER
   ================================================================ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--header-height);
  padding: 0 var(--space-4);
  background-color: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.app-header-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}


/* ================================================================
   MAIN CONTENT AREA
   Fills the space between header and nav bar.
   ================================================================ */

.app-main {
  flex: 1 1 auto;          /* fill space between header and nav */
  min-height: 0;           /* allow flex shrink */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--nav-height-safe);
}


/* ================================================================
   BOTTOM NAVIGATION BAR
   ================================================================ */

.app-nav {
  position: sticky;
  bottom: 0;
  z-index: 100;
  flex-shrink: 0;    /* prevent nav from squishing */
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height-safe);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background-color: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-nav);
  flex-shrink: 0;
}


/* ================================================================
   PLACEHOLDER SCREENS (Prompt 02 only — replaced in later prompts)
   ================================================================ */

.placeholder-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 300px;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.placeholder-screen-label {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

.placeholder-screen-sub {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.nav-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--nav-height);
}

.nav-placeholder-text {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  letter-spacing: 0.01em;
}


/* ================================================================
   CARD — reusable surface component
   ================================================================ */

.card {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
}

.card + .card {
  margin-top: var(--space-3);
}


/* ================================================================
   BUTTON SYSTEM
   ================================================================ */

/* Base button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  transition: opacity 0.15s ease, background-color 0.15s ease;
  min-height: 48px; /* accessible touch target */
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Primary — filled accent */
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-text-on-accent);
}

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

.btn-primary:active {
  opacity: 0.85;
}

/* Secondary — outlined */
.btn-secondary {
  background-color: var(--color-bg-surface);
  color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
}

.btn-secondary:hover {
  background-color: var(--color-accent-subtle);
}

/* Ghost — text only */
.btn-ghost {
  background-color: transparent;
  color: var(--color-accent);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.btn-ghost:hover {
  background-color: var(--color-accent-subtle);
}

/* Danger */
.btn-danger {
  background-color: var(--color-danger);
  color: var(--color-text-on-accent);
}

/* Full width */
.btn-block {
  width: 100%;
}

/* Disabled state */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* ================================================================
   TYPOGRAPHY UTILITIES
   ================================================================ */

.text-xs       { font-size: var(--text-xs); }
.text-sm       { font-size: var(--text-sm); }
.text-base     { font-size: var(--text-base); }
.text-lg       { font-size: var(--text-lg); }
.text-xl       { font-size: var(--text-xl); }
.text-2xl      { font-size: var(--text-2xl); }

.weight-regular  { font-weight: var(--weight-regular); }
.weight-medium   { font-weight: var(--weight-medium); }
.weight-semibold { font-weight: var(--weight-semibold); }
.weight-bold     { font-weight: var(--weight-bold); }

.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }
.text-accent    { color: var(--color-accent); }
.text-danger    { color: var(--color-danger); }

.text-center { text-align: center; }
.text-left   { text-align: left; }


/* ================================================================
   SPACING UTILITIES
   ================================================================ */

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-4  { padding: var(--space-4); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }


/* ================================================================
   LAYOUT UTILITIES
   ================================================================ */

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-1       { flex: 1; }
.w-full       { width: 100%; }


/* ================================================================
   SECTION WRAPPER — consistent screen padding
   ================================================================ */

.screen {
  padding: var(--space-4);
}

.screen-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}


/* ================================================================
   DIVIDER
   ================================================================ */

.divider {
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-4) 0;
}


/* ================================================================
   FORM ELEMENTS
   ================================================================ */

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface);
  transition: border-color 0.15s ease;
  min-height: 48px;
}

.input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-group + .form-group {
  margin-top: var(--space-4);
}

/* ================================================================
   TAB SCREENS — each tab is a full-height section
   Only the active tab is visible; others are hidden.
   ================================================================ */

.tab-screen {
  /* Each screen fills the full scrollable main area */
  min-height: 100%;
  animation: tab-fade-in 0.18s ease;
}

.tab-screen.hidden {
  display: none;
}

@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ================================================================
   NAV TAB BUTTONS
   Five equal-width buttons across the bottom bar.
   ================================================================ */

.nav-tab {
  /* Fill bar evenly */
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  /* Reset */
  background: none;
  border: none;
  padding: var(--space-2) 0 var(--space-1);
  cursor: pointer;
  color: var(--color-text-tertiary);

  /* Smooth color transition on active/hover */
  transition: color 0.15s ease;

  /* Accessible touch target */
  min-height: var(--nav-height);
  -webkit-tap-highlight-color: transparent;
}

.nav-tab:hover {
  color: var(--color-text-secondary);
}

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

/* Focus ring — keyboard accessible */
.nav-tab:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}


/* ================================================================
   NAV ICONS
   ================================================================ */

.nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  /* Stroke weight shift on active — makes icon feel "filled" */
  transition: stroke-width 0.15s ease;
}

.nav-tab.active .nav-icon path,
.nav-tab.active .nav-icon circle,
.nav-tab.active .nav-icon rect {
  stroke-width: 2.25;
}


/* ================================================================
   NAV LABELS
   ================================================================ */

.nav-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  line-height: 1;
  transition: font-weight 0.1s ease;
}

.nav-tab.active .nav-label {
  font-weight: var(--weight-semibold);
}


/* ================================================================
   TAB PLACEHOLDER CONTENT (Prompt 03 only)
   Replaced screen by screen in later prompts.
   ================================================================ */

.tab-placeholder-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-top: var(--space-2);
  max-width: 320px;
}

.tab-placeholder-badge {
  display: inline-block;
  margin-top: var(--space-4);
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
}


/* ================================================================
   UTILITY — hidden
   ================================================================ */

.hidden {
  display: none !important;
}

/* ================================================================
   LANDING VIEW
   Full-height layout for logged-out welcome screen.
   ================================================================ */

.landing-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--color-bg-surface);
}

/* On desktop shell, fill the shell height */
@media (min-width: 600px) {
  .landing-view {
    min-height: min(812px, 90vh);
    max-height: 90vh;
  }
}

/* Landing header — minimal wordmark only */
.landing-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
  flex-shrink: 0;
}

.landing-header-wordmark {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text-tertiary);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Landing main — centered, padded */
.landing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-6) var(--space-6) var(--space-10);
  gap: var(--space-10);
}

/* Hero block */
.landing-hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.landing-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, var(--text-2xl));
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.landing-promise {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* CTA buttons */
.landing-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.landing-feed-btn {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.landing-feed-btn:hover {
  background-color: var(--color-bg-surface-2);
  color: var(--color-text-primary);
}

/* Footer note */
.landing-footer-note {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: center;
  letter-spacing: 0.01em;
}


/* ================================================================
   AUTH VIEWS — Sign Up and Log In screens
   ================================================================ */

.auth-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--color-bg-surface);
}

@media (min-width: 600px) {
  .auth-view {
    min-height: min(812px, 90vh);
    max-height: 90vh;
  }
}

/* Auth header with back button */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-2) 0 var(--space-3);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.auth-back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-2);
  min-height: 44px;
}

.auth-header-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

/* Spacer keeps title centered */
.auth-header-spacer {
  width: 72px; /* mirrors back button width */
}

/* Auth main content */
.auth-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-form-wrap {
  padding: var(--space-8) var(--space-6) var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 400px;
  margin: 0 auto;
}

.auth-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-2);
}

/* Auth error message */
.auth-error {
  font-size: var(--text-sm);
  color: var(--color-danger);
  background-color: #fff2f1;
  border: 1px solid #ffd0ce;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  line-height: 1.5;
}

/* Auth screen switch link */
.auth-switch-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  margin-top: var(--space-6);
}

/* Inline text-link button */
.btn-text-link {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-text-link:hover {
  color: var(--color-accent-hover);
}

.btn-text-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}


/* ================================================================
   LOGIN PROMPT MODAL
   Sheet that slides up when a logged-out user tries to access
   an auth-required tab while viewing the public feed.
   ================================================================ */

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  z-index: 200;
}

.modal-overlay.hidden {
  display: none;
}

.modal-sheet {
  width: 100%;
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6) var(--space-6) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Drag handle hint */
.modal-sheet::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  background-color: var(--color-border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-3);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  text-align: center;
}

.modal-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.6;
  margin-bottom: var(--space-2);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ================================================================
   HOME TAB
   ================================================================ */

.home-screen {
  padding: var(--space-4) var(--space-4) 0;
}

/* ── Primary action — Start Training ─────────────────────── */

.home-primary-action {
  padding: var(--space-2) 0 var(--space-5);
}

.home-start-btn {
  /* Slightly larger than a normal btn to be visually dominant */
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  padding: var(--space-4) var(--space-5);
  min-height: 56px;
  border-radius: var(--radius-lg);
  letter-spacing: -0.01em;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.28);
}

.home-start-btn:hover {
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.34);
  transform: translateY(-1px);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.home-start-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}


/* ── Section wrapper ─────────────────────────────────────── */

.home-section {
  margin-bottom: var(--space-5);
}

.home-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-2);
}


/* ── Generic Home card ───────────────────────────────────── */

.home-card {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
}

/* Cards that are tappable */
.home-card-action {
  cursor: pointer;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.home-card-action:hover {
  background-color: #fafafa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.home-card-action:active {
  background-color: var(--color-bg-surface-2);
}

.home-card-action:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}


/* ── Draft / Continue Session card ──────────────────────── */

.home-section-draft {
  margin-top: calc(-1 * var(--space-2));
}

.home-draft-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-color: var(--color-accent);
  border-width: 1.5px;
  background-color: var(--color-accent-subtle);
}

.home-draft-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-accent);
  flex-shrink: 0;
  /* Subtle pulse to signal "in progress" */
  animation: home-draft-pulse 2s ease-in-out infinite;
}

@keyframes home-draft-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.home-draft-text {
  flex: 1;
  min-width: 0;
}

.home-draft-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  line-height: 1.3;
}

.home-draft-meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.home-draft-chevron {
  color: var(--color-accent);
  flex-shrink: 0;
}


/* ── Last Session card ───────────────────────────────────── */

.home-card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.home-card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  line-height: 1.3;
}

.home-card-meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.home-rating-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 3px var(--space-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.home-exercise-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-3);
}

.home-exercise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.home-exercise-name {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-weight: var(--weight-medium);
}

.home-exercise-top-set {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.home-session-more {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

.home-session-skipped {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.home-session-notes {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: var(--space-2);
  line-height: 1.5;
}

.home-card-cta-hint {
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: var(--weight-medium);
}


/* ── Stats row ───────────────────────────────────────────── */

.home-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-2) 0 var(--space-3);
}

.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.home-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.home-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-align: center;
}

.home-stat-divider {
  width: 1px;
  height: 32px;
  background-color: var(--color-border);
  flex-shrink: 0;
}

/* Shortcut link below stats / feed */
.home-shortcut-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: var(--weight-medium);
  cursor: pointer;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-3);
}

.home-shortcut-link:hover {
  color: var(--color-accent-hover);
}

.home-shortcut-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}


/* ── Recent Feed preview ─────────────────────────────────── */

.home-feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.home-feed-item {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-card);
}

.home-feed-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.home-feed-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
}

/* Preset avatar colours */
.avatar-color-blue   { background-color: #007aff; }
.avatar-color-green  { background-color: #34c759; }
.avatar-color-orange { background-color: #ff9f0a; }
.avatar-color-purple { background-color: #af52de; }
.avatar-color-red    { background-color: #ff3b30; }

.home-feed-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.home-feed-username {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.home-feed-session {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-feed-time {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

.home-feed-caption {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.5;
  margin-bottom: var(--space-2);
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-feed-counts {
  display: flex;
  gap: var(--space-4);
}

.home-feed-count {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}


/* ── Empty states ────────────────────────────────────────── */

.home-empty-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border-style: dashed;
  box-shadow: none;
  background-color: transparent;
}

.home-empty-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  text-align: center;
  line-height: 1.5;
}


/* ── Bottom padding ─────────────────────────────────────── */

.home-bottom-pad {
  height: var(--space-6);
}

/* ================================================================
   PROFILE STUB (Prompt 07)
   Temporary display of logged-in user in Profile tab.
   Full profile UI replaces this in Prompt 12.
   ================================================================ */

.auth-profile-stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-4) var(--space-6);
  gap: var(--space-2);
}

.auth-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: var(--color-accent);
  color: #fff;
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.auth-profile-username {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.auth-profile-email {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.auth-profile-actions {
  padding: 0 var(--space-4) var(--space-6);
}

.auth-profile-note {
  padding: var(--space-4) var(--space-4);
  text-align: center;
}

/* ================================================================
   PROFILE TAB — Prompt 12
   Profile main view, Edit Profile, and Settings.
   ================================================================ */

.profile-screen {
  padding: var(--space-4);
  padding-bottom: var(--space-12);
}


/* ── Profile main view ───────────────────────────────────── */

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.profile-avatar-circle {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.profile-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-username {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.profile-display-name {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.profile-bio {
  font-size: var(--text-base);
  color: var(--color-text-primary);
  line-height: 1.55;
  margin-bottom: var(--space-4);
}

.profile-bio-empty {
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Stats */
.profile-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: var(--space-4) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.profile-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.profile-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.profile-stat-divider {
  width: 1px;
  height: 28px;
  background-color: var(--color-border);
  flex-shrink: 0;
}

/* Action buttons */
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.profile-divider {
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-2) 0 var(--space-4);
}

/* Section */
.profile-section {
  margin-bottom: var(--space-5);
}

.profile-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

/* Shared posts */
.profile-posts-placeholder {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-empty-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  line-height: 1.5;
}

.profile-post-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-card);
}

.profile-post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.profile-post-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.profile-post-rating {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
}

.profile-post-caption {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Logout */
.profile-logout-section {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.profile-logout-btn {
  color: var(--color-danger);
  width: 100%;
  justify-content: center;
}

.profile-logout-btn:hover {
  background-color: rgba(255, 59, 48, 0.06);
}


/* ── Edit Profile & Settings shared header ───────────────── */

.profile-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.profile-back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  min-height: 44px;
  padding: var(--space-2);
}

.profile-edit-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.profile-edit-spacer {
  width: 72px;
}


/* ── Edit Profile ─────────────────────────────────────────── */

.profile-edit-section {
  margin-bottom: var(--space-5);
}

.profile-edit-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.profile-edit-hint {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

.profile-bio-input {
  resize: none;
  height: auto;
  min-height: 84px;
  font-family: inherit;
  line-height: 1.5;
}


/* ── Avatar picker ───────────────────────────────────────── */

.avatar-picker {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.avatar-option {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.avatar-option:hover {
  transform: scale(1.08);
}

.avatar-option.selected {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 2px var(--color-bg-surface), 0 0 0 4px var(--color-text-primary);
}

.avatar-option:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}


/* ── Settings ─────────────────────────────────────────────── */

.settings-section {
  margin-bottom: var(--space-6);
}

.settings-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-4);
}

.settings-row:first-of-type {
  border-top: 1px solid var(--color-border);
}

.settings-row-label {
  font-size: var(--text-base);
  color: var(--color-text-primary);
  flex: 1;
}

.settings-row-readonly .settings-row-value {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.settings-select {
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  min-width: 120px;
}

.settings-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.settings-save-msg {
  font-size: var(--text-sm);
  color: var(--color-success);
  font-weight: var(--weight-medium);
  text-align: center;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
}

.settings-danger-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-delete-btn {
  color: var(--color-danger);
  justify-content: center;
  font-size: var(--text-sm);
}

.settings-delete-btn:hover {
  background-color: rgba(255, 59, 48, 0.06);
}

.settings-delete-note {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: center;
  line-height: 1.5;
}

/* ================================================================
   TRAINING TAB — Prompt 13
   Default view, Change Training Plan, plan cards.
   ================================================================ */

.training-screen {
  padding: var(--space-4);
  padding-bottom: var(--space-12);
}

.training-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.training-loading-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* ── Start Training button (biggest action) ──────────────── */

.training-primary-action {
  padding: var(--space-2) 0 var(--space-5);
}

.training-start-btn {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  padding: var(--space-4) var(--space-5);
  min-height: 56px;
  border-radius: var(--radius-lg);
  letter-spacing: -0.01em;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.28);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.training-start-btn:hover {
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.34);
  transform: translateY(-1px);
}

.training-start-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

/* ── Draft continue wrap ─────────────────────────────────── */

.training-draft-wrap {
  margin-bottom: var(--space-4);
}

/* ── Active plan summary ─────────────────────────────────── */

.training-plan-summary {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-card);
}

.training-plan-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.training-plan-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.training-plan-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.training-plan-change-btn {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  flex-shrink: 0;
}

/* Day chips */
.training-day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.training-day-chip {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 3px var(--space-3);
  white-space: nowrap;
}

.training-plan-no-days {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.training-plan-empty {
  border-style: dashed;
  box-shadow: none;
  background-color: transparent;
}

.training-plan-empty-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: 3px;
}

.training-plan-empty-sub {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* ── Secondary action rows ───────────────────────────────── */

.training-secondary-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-card);
}

.training-action-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.training-action-row:last-child {
  border-bottom: none;
}

.training-action-row:hover {
  background-color: var(--color-bg-surface-2);
}

.training-action-row:active {
  background-color: var(--color-border);
}

.training-action-row:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.training-action-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--color-accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-accent);
}

.training-action-label {
  flex: 1;
  min-width: 0;
}

.training-action-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  line-height: 1.3;
}

.training-action-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.training-action-chevron {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

.training-bottom-pad {
  height: var(--space-6);
}


/* ── Change Plan header / back button ────────────────────── */

.training-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.training-back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  min-height: 44px;
  padding: var(--space-2);
}

.training-edit-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.training-edit-spacer {
  width: 72px;
}

/* ── Placeholder header (for sub-screens not yet built) ──── */

.training-placeholder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.training-placeholder-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}


/* ── Plan creation row ───────────────────────────────────── */

.plan-create-section {
  margin-bottom: var(--space-6);
}

.plan-create-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.plan-name-input {
  flex: 1;
  min-width: 0;
}

.plan-create-btn {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  min-height: 48px;
}


/* ── Plan section ────────────────────────────────────────── */

.plan-section {
  margin-bottom: var(--space-5);
}

.plan-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

.plan-empty-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  padding: var(--space-3) 0;
}


/* ── Plan cards ──────────────────────────────────────────── */

.plan-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-card);
}

.plan-card-active {
  border-color: var(--color-accent);
  border-width: 1.5px;
}

.plan-card-archived {
  opacity: 0.7;
}

.plan-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.plan-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.plan-active-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  word-break: break-word;
}

.plan-card-name-archived {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.plan-card-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.plan-action-btn {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  background: none;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-full);
  padding: 4px var(--space-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
}

.plan-action-btn:hover {
  background-color: var(--color-accent-subtle);
}

.plan-action-btn:active {
  opacity: 0.75;
}

.plan-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.plan-action-activate {
  color: var(--color-success);
  border-color: var(--color-success);
}

.plan-action-activate:hover {
  background-color: rgba(52, 199, 89, 0.08);
}

.plan-action-archive {
  color: var(--color-text-secondary);
  border-color: var(--color-border-strong);
}

.plan-action-archive:hover {
  background-color: var(--color-bg-surface-2);
}

/* ================================================================
   TRAINING DAY EDITOR — Prompt 14
   Day cards, add day row, inline edit form.
   ================================================================ */

/* ── Add day section ─────────────────────────────────────── */

.day-add-section {
  margin-bottom: var(--space-6);
}

.day-add-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.day-name-input {
  flex: 1;
  min-width: 0;
}

.day-add-btn {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  min-height: 48px;
}

/* ── Day sections ────────────────────────────────────────── */

.day-section {
  margin-bottom: var(--space-5);
}

.day-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

/* ── Empty state ─────────────────────────────────────────── */

.day-empty-state {
  padding: var(--space-4) 0;
}

.day-empty-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: 3px;
}

.day-empty-sub {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}


/* ── Day cards ───────────────────────────────────────────── */

.day-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-card);
}

.day-card-archived {
  opacity: 0.65;
}

.day-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.day-card-info {
  flex: 1;
  min-width: 0;
}

.day-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
  word-break: break-word;
}

.day-card-name-archived {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.day-card-rules {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;         /* preserve line breaks from day_rules */
}

.day-card-rules-empty {
  color: var(--color-text-tertiary);
  font-style: italic;
}

.day-card-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
}


/* ── Day action buttons ──────────────────────────────────── */

.day-action-btn {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  background: none;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-full);
  padding: 4px var(--space-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
  min-width: 64px;
  text-align: center;
}

.day-action-btn:hover {
  background-color: var(--color-accent-subtle);
}

.day-action-btn:active {
  opacity: 0.75;
}

.day-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.day-action-archive {
  color: var(--color-text-secondary);
  border-color: var(--color-border-strong);
}

.day-action-archive:hover {
  background-color: var(--color-bg-surface-2);
}

.day-action-restore {
  color: var(--color-success);
  border-color: var(--color-success);
}

.day-action-restore:hover {
  background-color: rgba(52, 199, 89, 0.08);
}


/* ── Exercise placeholder (Prompt 15 slot) ───────────────── */

.day-exercises-placeholder {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.day-exercises-placeholder-text {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}


/* ── Inline day edit form ────────────────────────────────── */

.day-edit-form {
  background-color: var(--color-bg-surface);
  border: 1.5px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-4) 0;
  box-shadow: 0 2px 12px rgba(0, 122, 255, 0.12);
}

.day-edit-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.day-edit-cancel-btn {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-1) var(--space-2);
}

.day-rules-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}

/* Edit Days plan action button */
.plan-action-edit-days {
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.plan-action-edit-days:hover {
  background-color: var(--color-bg-surface-2);
}

/* ================================================================
   EXERCISE LIBRARY & TRAINING DAY EXERCISES — Prompt 15
   ================================================================ */

/* ── Day exercise slot (inside day cards) ────────────────── */

.day-exercises-slot {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.day-exercises-loading-text {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.day-exercises-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* Individual exercise row inside a day card */
.day-ex-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.day-ex-row:last-child {
  border-bottom: none;
}

.day-ex-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-ex-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.day-ex-type {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.day-ex-note {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.day-ex-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.day-ex-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.day-ex-btn:hover {
  background-color: var(--color-bg-surface-2);
}

.day-ex-remove {
  color: var(--color-danger);
  border-color: rgba(255, 59, 48, 0.3);
}

.day-ex-remove:hover {
  background-color: rgba(255, 59, 48, 0.06);
}

.day-ex-btn-spacer {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.day-ex-empty {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
  padding: var(--space-1) 0;
}

/* Manage Exercises button at bottom of day slot */
.day-manage-ex-btn {
  display: block;
  width: 100%;
  background: none;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}

.day-manage-ex-btn:hover {
  background-color: var(--color-accent-subtle);
  border-color: var(--color-accent);
}


/* ── Exercise library view ───────────────────────────────── */

.ex-lib-context {
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
}

.ex-lib-context-text {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: var(--weight-medium);
}

.ex-lib-context-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.ex-lib-section {
  margin-bottom: var(--space-5);
}

/* Create exercise section */
.ex-create-section {
  margin-bottom: var(--space-6);
}

.ex-create-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.ex-name-input {
  flex: 1;
  min-width: 0;
}

.ex-add-btn {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  min-height: 48px;
}

.ex-create-options {
  /* Slides in when name is typed */
  margin-top: var(--space-3);
  padding: var(--space-4);
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.ex-load-type-select {
  width: 100%;
  max-width: 100%;
}

.ex-note-toggle {
  display: flex;
  align-items: center;
}

.ex-note-toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.ex-note-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-accent);
}

.ex-confirm-create-btn {
  margin-top: var(--space-3);
}


/* ── Exercise cards ──────────────────────────────────────── */

.ex-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-card);
}

.ex-card-assigned {
  border-color: var(--color-success);
  border-width: 1.5px;
}

.ex-card-archived {
  opacity: 0.65;
}

.ex-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

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

.ex-card-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.ex-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.ex-card-name-archived {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.ex-assigned-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-success);
  background-color: rgba(52, 199, 89, 0.1);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
  white-space: nowrap;
}

.ex-card-type {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.ex-card-note {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
  margin-top: 2px;
}

.ex-card-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
  align-items: flex-end;
}

/* Add / Remove toggle button */
.ex-card-toggle {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  padding: 5px var(--space-3);
  cursor: pointer;
  border: 1.5px solid;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
  white-space: nowrap;
}

.ex-toggle-add {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: none;
}

.ex-toggle-add:hover {
  background-color: var(--color-accent-subtle);
}

.ex-toggle-remove {
  color: var(--color-danger);
  border-color: rgba(255, 59, 48, 0.4);
  background: none;
}

.ex-toggle-remove:hover {
  background-color: rgba(255, 59, 48, 0.06);
}

.ex-card-toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================================================================
   START TRAINING FLOW — Prompt 16
   ================================================================ */

/* ── Section labels ──────────────────────────────────────── */

.start-section {
  margin-bottom: var(--space-5);
}

.start-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

/* ── Training day list ───────────────────────────────────── */

.start-day-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-card);
}

.start-day-btn,
.start-custom-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 64px;
}

.start-day-btn:last-child {
  border-bottom: none;
}

.start-day-btn:hover,
.start-custom-btn:hover {
  background-color: var(--color-bg-surface-2);
}

.start-day-btn:active,
.start-custom-btn:active {
  background-color: var(--color-border);
}

.start-day-btn:focus-visible,
.start-custom-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.start-day-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.start-day-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.start-day-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  line-height: 1.3;
}

.start-day-rules {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.start-day-chevron {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

/* ── Custom session button ───────────────────────────────── */

.start-custom-btn {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-card);
}

.start-custom-btn .start-day-name {
  color: var(--color-accent);
}

.start-custom-btn .start-day-rules {
  color: var(--color-text-tertiary);
}

/* ── No plan / no days empty states ─────────────────────── */

.start-no-days {
  padding: var(--space-4);
  background-color: var(--color-bg-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
}

.start-no-days-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: 3px;
}

.start-no-days-sub {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* ── Draft warning ───────────────────────────────────────── */

.start-draft-warning {
  background-color: #fff8e6;
  border: 1.5px solid #ff9f0a;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

.start-draft-warning-inner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.start-draft-warning-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1.3;
}

.start-draft-warning-text {
  flex: 1;
}

.start-draft-warning-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: #7a4a00;
  margin-bottom: 2px;
}

.start-draft-warning-sub {
  font-size: var(--text-xs);
  color: #7a4a00;
  line-height: 1.5;
  opacity: 0.85;
}

/* ── Status / error message ──────────────────────────────── */

.start-status {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  padding: var(--space-3) 0;
}


/* ── Active session stub (placeholder for Prompt 17) ─────── */

.active-session-stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.active-session-stub-icon {
  font-size: 3rem;
  line-height: 1;
}

.active-session-stub-date {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.active-session-stub-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.active-session-stub-prev {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-width: 280px;
}

.active-session-stub-badge {
  display: inline-block;
  background-color: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}

.active-session-stub-id {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-family: monospace;
}

/* ================================================================
   ACTIVE TRAINING SESSION UI — Prompt 17
   Gym-first: large touch targets, readable sets, clear hierarchy.
   ================================================================ */

.active-session-screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ── Session header ─────────────────────────────────────── */

.active-session-header {
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.active-session-header-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
}

.active-session-back-btn {
  color: var(--color-accent);
  padding: var(--space-2);
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.active-session-header-info {
  flex: 1;
  min-width: 0;
}

.active-session-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-session-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.active-finish-btn-top {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  min-height: 40px;
  border-radius: var(--radius-full);
}

/* Day rules */
.active-session-rules {
  padding: var(--space-2) 0 var(--space-3);
  border-top: 1px solid var(--color-border);
}

.active-session-rules-text {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
  font-style: italic;
  white-space: pre-wrap;
}


/* ── Exercise list ──────────────────────────────────────── */

.active-exercise-list {
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.active-no-exercises {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.active-no-exercises-sub {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-2);
}


/* ── Exercise card ──────────────────────────────────────── */

.active-ex-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.active-ex-card-skipped {
  opacity: 0.6;
  border-style: dashed;
}

.active-ex-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.active-ex-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  flex: 1;
  min-width: 0;
  letter-spacing: -0.01em;
}

.active-ex-name-skipped {
  text-decoration: line-through;
  color: var(--color-text-secondary);
}

.active-ex-skipped-label {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
  margin-bottom: var(--space-2);
}

.active-ex-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.active-ex-action-btn {
  background: none;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 4px var(--space-2);
  cursor: pointer;
  min-height: 32px;
  min-width: 44px;
  white-space: nowrap;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.active-ex-action-btn:hover {
  background-color: var(--color-bg-surface-2);
}

.active-ex-skip-btn {
  color: var(--color-warning);
  border-color: rgba(255, 159, 10, 0.4);
}

.active-ex-skip-btn:hover {
  background-color: rgba(255, 159, 10, 0.08);
}

.active-ex-unskip-btn {
  color: var(--color-success);
  border-color: rgba(52, 199, 89, 0.4);
}

.active-ex-remove-btn {
  color: var(--color-danger);
  border-color: rgba(255, 59, 48, 0.3);
  padding: 4px 8px;
}

.active-ex-remove-btn:hover {
  background-color: rgba(255, 59, 48, 0.06);
}


/* ── Exercise notes ─────────────────────────────────────── */

.active-ex-default-note {
  font-size: var(--text-xs);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.active-ex-note-wrap {
  margin-bottom: var(--space-2);
}

.active-ex-note-input {
  font-size: var(--text-sm);
  resize: none;
  min-height: 52px;
}

.active-ex-note-save-btn {
  display: inline-block;
  margin-top: var(--space-1);
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
}


/* ── Previous sets ──────────────────────────────────────── */

.prev-sets-block {
  margin-bottom: var(--space-3);
}

.prev-sets-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.prev-sets-none {
  color: var(--color-text-tertiary);
  font-style: italic;
  text-transform: none;
  font-weight: var(--weight-regular);
}

.prev-sets-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.prev-set-chip {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px var(--space-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}


/* ── Today's sets ───────────────────────────────────────── */

.active-sets-today {
  /* Clear top line between prev and today */
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.active-sets-today-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.active-sets-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}


/* ── Set input row ──────────────────────────────────────── */

.active-set-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.active-set-num {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  width: 20px;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.active-set-inputs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.active-set-field {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Base set input — large touch target for gym use */
.active-set-input {
  width: 72px;
  padding: var(--space-2) var(--space-2);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface);
  text-align: center;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.active-set-input::-webkit-inner-spin-button,
.active-set-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.active-set-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background-color: var(--color-accent-subtle);
}

/* Smaller input for reps (narrower) */
.active-set-input-sm {
  width: 56px;
}

.active-set-unit {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.active-set-x {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-weight: var(--weight-medium);
}

.active-set-delete-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color 0.1s, background-color 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.active-set-delete-btn:hover {
  color: var(--color-danger);
  background-color: rgba(255, 59, 48, 0.06);
}


/* ── Add Set button ─────────────────────────────────────── */

.active-add-set-btn {
  display: block;
  width: 100%;
  background: none;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  cursor: pointer;
  text-align: center;
  min-height: 40px;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.active-add-set-btn:hover {
  background-color: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.active-add-set-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ── Add Exercise button ────────────────────────────────── */

.active-add-ex-wrap {
  padding: 0 var(--space-4) var(--space-4);
}

.active-add-ex-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  background-color: var(--color-bg-surface);
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  cursor: pointer;
  min-height: 48px;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.active-add-ex-btn:hover {
  background-color: var(--color-accent-subtle);
  border-color: var(--color-accent);
}


/* ── Overall section ────────────────────────────────────── */

.active-overall-section {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg-surface);
  margin: 0 var(--space-4) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.active-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

.active-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.active-rating-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.active-rating-select {
  min-width: 80px;
}

.active-notes-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.active-notes-textarea {
  resize: none;
  font-size: var(--text-sm);
  min-height: 72px;
}

.active-overall-save-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.active-save-status {
  font-size: var(--text-sm);
  color: var(--color-success);
  font-weight: var(--weight-medium);
}


/* ── Finish Session ─────────────────────────────────────── */

.active-finish-wrap {
  padding: 0 var(--space-4) var(--space-6);
}

.active-finish-btn {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  min-height: 52px;
  border-radius: var(--radius-lg);
  letter-spacing: -0.01em;
}


/* ── Add Exercise picker overlay ────────────────────────── */

.add-ex-picker {
  position: absolute;
  inset: 0;
  background-color: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 150;
}

.add-ex-picker-sheet {
  width: 100%;
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 70vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.add-ex-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background-color: var(--color-bg-surface);
}

.add-ex-picker-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.add-ex-picker-list {
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.add-to-session-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  min-height: 52px;
  text-align: left;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.add-to-session-btn:hover:not([disabled]) {
  background-color: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.add-to-session-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.add-to-session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.add-to-session-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.add-to-session-type {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.add-to-session-status {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  white-space: nowrap;
}

.add-to-session-btn[disabled] .add-to-session-status {
  color: var(--color-success);
}

/* ================================================================
   SET TRACKING COMPLETION INDICATOR — Prompt 18
   Visual feedback when a set has data saved.
   ================================================================ */

/* Completed set row — subtle green left border */
.active-set-row-done {
  border-left: 3px solid var(--color-success);
  padding-left: calc(var(--space-2) - 3px);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Completed set number — green accent */
.active-set-row-done .active-set-num {
  color: var(--color-success);
}

/* Completed set input — subtle success tint on focus */
.active-set-row-done .active-set-input:focus {
  border-color: var(--color-success);
  background-color: rgba(52, 199, 89, 0.06);
}

/* ================================================================
   AUTO-SAVE TOAST — Prompt 19
   Brief "Saved ✓" confirmation shown after any auto-save.
   ================================================================ */

.auto-save-toast {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-success);
  text-align: center;
  padding: var(--space-1) 0 var(--space-2);
  opacity: 0;
  transition: opacity 0.2s ease;
  letter-spacing: 0.02em;
}

.auto-save-toast-visible {
  opacity: 1;
}

/* ================================================================
   AUTO-SAVE TOAST — Prompt 19
   Brief "Saved ✓" indicator in the active session header.
   ================================================================ */

.auto-save-toast {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-success);
  text-align: center;
  padding: var(--space-1) 0 var(--space-2);
  opacity: 0;
  transition: opacity 0.2s ease;
  letter-spacing: 0.02em;
}

.auto-save-toast-visible {
  opacity: 1;
}

/* ================================================================
   FINISH SESSION FLOW — Prompt 20
   ================================================================ */

.finish-session-screen {
  /* inherits .training-screen padding */
}

/* ── Session summary card ────────────────────────────────── */

.finish-summary-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.finish-summary-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.finish-summary-date {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.finish-summary-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.finish-summary-stat {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.finish-summary-sep {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

.finish-summary-rating {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
}


/* ── Finish options ──────────────────────────────────────── */

.finish-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.finish-options-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-1);
}

.finish-option-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  background-color: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 72px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.finish-option-btn:hover {
  background-color: var(--color-bg-surface-2);
}

.finish-option-btn:active {
  background-color: var(--color-border);
}

.finish-option-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.finish-option-selected {
  border-color: var(--color-accent);
  border-width: 2px;
  background-color: var(--color-accent-subtle);
}

.finish-option-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.finish-option-icon-private {
  background-color: rgba(142, 142, 147, 0.15);
  color: #8e8e93;
}

.finish-option-icon-share {
  background-color: var(--color-accent-subtle);
  color: var(--color-accent);
}

.finish-option-icon-draft {
  background-color: rgba(255, 159, 10, 0.12);
  color: var(--color-warning);
}

.finish-option-text {
  flex: 1;
  min-width: 0;
}

.finish-option-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.finish-option-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.finish-option-default-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.finish-status {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  padding: var(--space-2) 0;
  margin-top: var(--space-2);
}


/* ── Share Preview ───────────────────────────────────────── */

.share-preview-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-card);
}

.share-preview-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.share-preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
}

.share-preview-meta {
  flex: 1;
  min-width: 0;
}

.share-preview-username {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.share-preview-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.share-preview-rating {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 3px var(--space-2);
  white-space: nowrap;
}

.share-preview-session-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.share-preview-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-preview-summary-line {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}


/* ── Caption input ───────────────────────────────────────── */

.share-caption-section {
  margin-bottom: var(--space-4);
}

.share-caption-input {
  resize: none;
  font-size: var(--text-base);
  min-height: 80px;
}


/* ── Share actions ───────────────────────────────────────── */

.share-preview-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}


/* ── Success banner (shown on Training tab after finish) ─── */

.finish-success-banner {
  background-color: var(--color-success);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-align: center;
  padding: var(--space-3) var(--space-4);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.2s ease;
}

.finish-success-banner-visible {
  opacity: 1;
  max-height: 48px;
}

/* ================================================================
   TRAINING HISTORY — Prompt 21
   ================================================================ */

/* ── Filters ─────────────────────────────────────────────── */

.history-filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-3);
}

.history-filter-select {
  flex: 1;
  min-width: 120px;
  font-size: var(--text-sm);
}

.history-clear-btn {
  background: none;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
  transition: background-color 0.12s ease;
}

.history-clear-btn:hover {
  background-color: var(--color-bg-surface-2);
}

.history-count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}


/* ── Session list ─────────────────────────────────────────── */

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.history-empty {
  padding: var(--space-6) 0;
  text-align: center;
}

.history-empty-text {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.history-empty-sub {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}


/* ── Session card ─────────────────────────────────────────── */

.history-session-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.history-session-card:hover {
  background-color: var(--color-bg-surface-2);
}

.history-session-card:active {
  background-color: var(--color-border);
}

.history-session-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.history-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.history-card-info {
  flex: 1;
  min-width: 0;
}

.history-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.history-card-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.history-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}

.history-card-rating {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
}

.history-card-visibility {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
}

.history-card-shared {
  color: var(--color-success);
  background-color: rgba(52, 199, 89, 0.1);
}

.history-card-private {
  color: var(--color-text-tertiary);
  background-color: var(--color-bg-surface-2);
}

.history-card-notes {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: var(--space-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-card-chevron {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
}


/* ── History Detail ───────────────────────────────────────── */

.detail-meta-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-card);
}

.detail-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-4);
}

.detail-meta-row:last-of-type {
  border-bottom: none;
}

.detail-meta-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.detail-meta-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  text-align: right;
}

.detail-meta-rating {
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
}

.detail-meta-shared {
  color: var(--color-success);
  font-weight: var(--weight-semibold);
}

.detail-meta-private {
  color: var(--color-text-secondary);
}

.detail-meta-notes {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-2);
}

.detail-notes-text {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.55;
  margin-top: var(--space-1);
}

.detail-section {
  margin-bottom: var(--space-5);
}

.detail-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}

.detail-exercise-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.detail-ex-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-card);
}

.detail-ex-card-skipped {
  opacity: 0.6;
  border-style: dashed;
}

.detail-ex-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.detail-ex-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  flex: 1;
}

.detail-ex-name-skipped {
  text-decoration: line-through;
  color: var(--color-text-secondary);
}

.detail-ex-skipped-badge {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-sets-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.detail-set-chip {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px var(--space-2);
  font-variant-numeric: tabular-nums;
}

.detail-ex-note {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: var(--space-1);
}


/* ── Detail actions ───────────────────────────────────────── */

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.detail-view-post-btn {
  color: var(--color-accent);
}

.detail-delete-btn {
  color: var(--color-danger);
}

.detail-delete-btn:hover {
  background-color: rgba(255, 59, 48, 0.06);
}

/* ================================================================
   EDIT SESSION — Prompt 22
   Editing banner and "edited after posting" note.
   Reuses active-session-screen styles from Prompt 17.
   ================================================================ */

/* Editing banner — shown in the sticky header */
.edit-session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0 var(--space-3);
  border-top: 1px solid var(--color-border);
}

.edit-session-banner-text {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  flex: 1;
  line-height: 1.4;
}

.edit-session-edited-note {
  color: var(--color-warning);
  font-weight: var(--weight-medium);
}

.edit-session-banner-tag {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--color-success);
  background-color: rgba(52, 199, 89, 0.1);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* ================================================================
   FEED TAB — Prompt 24
   Instagram-style feed. Newest first. Public posts.
   ================================================================ */

.feed-screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ── Feed header ─────────────────────────────────────────── */

.feed-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-bg-surface);
  position: sticky;
  top: 0;
  z-index: 40;
}

.feed-header-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

/* ── Empty state ─────────────────────────────────────────── */

.feed-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.feed-empty-text {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.feed-empty-sub {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* ── Feed list ───────────────────────────────────────────── */

.feed-list {
  display: flex;
  flex-direction: column;
}


/* ── Feed card ───────────────────────────────────────────── */

.feed-card {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-bg-surface);
}

.feed-card:last-child {
  border-bottom: none;
}

/* Card header: avatar + meta + rating */
.feed-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Avatars */
.feed-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
  font-size: var(--text-sm);
  width: 40px;
  height: 40px;
}

.feed-avatar-lg {
  width: 48px;
  height: 48px;
  font-size: var(--text-base);
}

.feed-avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.feed-avatar-xs {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.feed-avatar-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
}

.feed-card-meta {
  flex: 1;
  min-width: 0;
}

.feed-card-meta-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.feed-username-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.feed-time-ago {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.feed-session-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
}

.feed-session-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 1px;
}

.feed-rating-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  padding: 3px var(--space-2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Caption */
.feed-caption {
  font-size: var(--text-base);
  color: var(--color-text-primary);
  line-height: 1.55;
  margin-bottom: var(--space-3);
}

/* Card actions row */
.feed-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.feed-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  padding: var(--space-1) 0;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  min-height: 36px;
  font-weight: var(--weight-medium);
  transition: color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.feed-action-btn:hover {
  color: inherit;   /* no colour shift on hover */
}

/* like icon size now set on .feed-like-icon globally */

.feed-liked {
  opacity: 0.7;
}

.feed-like-count,
.feed-comment-count {
  font-variant-numeric: tabular-nums;
}

.feed-view-btn {
  margin-left: auto;
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
}


/* ── Feed Detail ─────────────────────────────────────────── */

.feed-detail-screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.feed-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background-color: var(--color-bg-surface);
  z-index: 40;
}

.feed-detail-content {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.feed-detail-author {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.feed-detail-author-info {
  flex: 1;
  min-width: 0;
}

.feed-detail-username {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.feed-detail-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.feed-detail-caption {
  font-size: var(--text-base);
  color: var(--color-text-primary);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.feed-detail-exercises {
  margin-bottom: var(--space-3);
}

.feed-detail-exercises-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.feed-detail-exercise-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.feed-detail-skipped {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.feed-detail-session-notes {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.feed-detail-likes-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.feed-detail-like-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}


/* ── Comments section ────────────────────────────────────── */

.feed-detail-comments-section {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.feed-detail-comments-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.feed-detail-comments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.feed-no-comments {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.feed-comment {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.feed-comment-content {
  flex: 1;
  min-width: 0;
}

.feed-comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.feed-comment-username {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.feed-comment-time {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.feed-comment-delete-btn {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 0 0 0 var(--space-1);
  margin-left: auto;
  min-height: 20px;
  line-height: 1;
}

.feed-comment-delete-btn:hover {
  color: var(--color-danger);
}

.feed-comment-body {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.5;
  word-break: break-word;
}

/* Comment input row */
.feed-comment-input-wrap {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.feed-comment-input-row {
  flex: 1;
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.feed-comment-input {
  flex: 1;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  background-color: var(--color-bg-surface-2);
  min-height: 40px;
}

.feed-comment-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background-color: var(--color-bg-surface);
}

.feed-comment-submit-btn {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  padding: var(--space-2);
  min-height: 40px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.feed-comment-submit-btn:disabled {
  opacity: 0.4;
}

.feed-comment-login-prompt {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* ================================================================
   PROGRESS TAB — Prompt 25
   Exercise-first strength progress. Completed sessions only.
   ================================================================ */

.progress-screen {
  display: flex;
  flex-direction: column;
  padding-bottom: var(--space-12);
}

/* ── Header ──────────────────────────────────────────────── */

.progress-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-bg-surface);
  position: sticky;
  top: 0;
  z-index: 40;
}

.progress-header-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

/* ── Section ─────────────────────────────────────────────── */

.progress-section {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.progress-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: var(--space-3);
}


/* ── Stats grid ──────────────────────────────────────────── */

.progress-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.progress-stat-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-card);
}

.progress-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.progress-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.progress-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-card);
}

.progress-rating-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.progress-rating-value {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
}


/* ── Exercise search + list ──────────────────────────────── */

.progress-search-wrap {
  margin-bottom: var(--space-3);
}

.progress-search-input {
  /* Inherits .input but full-width search field */
}

.progress-ex-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-card);
}

.progress-ex-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}

.progress-ex-btn:last-child {
  border-bottom: none;
}

.progress-ex-btn:hover {
  background-color: var(--color-bg-surface-2);
}

.progress-ex-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  flex: 1;
}

.progress-ex-type {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.progress-ex-chevron {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}


/* ── Personal Records ────────────────────────────────────── */

.progress-pr-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.progress-pr-card {
  flex: 1;
  min-width: 80px;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.progress-pr-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.progress-pr-unit {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

.progress-pr-label {
  font-size: 10px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}


/* ── Chart ───────────────────────────────────────────────── */

.progress-chart-wrap {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

.progress-chart-placeholder {
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.progress-chart-placeholder-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  font-style: italic;
}


/* ── Session-by-session list ─────────────────────────────── */

.progress-session-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.progress-session-row {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-card);
}

.progress-session-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.progress-session-day {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-right: var(--space-2);
}

.progress-session-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.progress-session-sets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.progress-skipped-badge {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.progress-no-data {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.progress-session-note {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: var(--space-2);
}


/* ── Empty state ─────────────────────────────────────────── */

.progress-empty {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

.progress-empty-text {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.progress-empty-sub {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* ================================================================
   ADMIN CONTROLS — Prompt 26
   Only visible to users with is_admin = true on their profile.
   DB-level enforcement is in rls_policies.sql (is_admin() function).
   ================================================================ */

.admin-actions {
  margin: var(--space-3) 0;
  padding: var(--space-3) var(--space-4);
  background-color: rgba(255, 59, 48, 0.04);
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: var(--radius-md);
}

.admin-delete-btn {
  background: none;
  border: none;
  color: var(--color-danger);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
  width: 100%;
  text-align: left;
  min-height: 36px;
}

.admin-delete-btn:hover {
  text-decoration: underline;
}

/* ================================================================
   PUBLIC PROFILES — Prompt 27
   Accessible from Feed by tapping avatar or username.
   Shows shared posts only. No private sessions. No friends/follows.
   Viewable by logged-out users.
   ================================================================ */

/* ── Profile identity block ──────────────────────────────── */

.pub-profile-identity {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.pub-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.pub-profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pub-profile-display-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.pub-profile-username {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.pub-profile-bio {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-top: var(--space-1);
}


/* ── Public stats ────────────────────────────────────────── */

.pub-profile-stats {
  display: flex;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-6);
}

.pub-profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pub-profile-stat-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pub-profile-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}


/* ── Shared posts list ───────────────────────────────────── */

.pub-profile-posts-section {
  padding-top: var(--space-4);
}

.pub-profile-posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4);
}

.pub-profile-post-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.pub-profile-post-card:hover {
  background-color: var(--color-bg-surface-2);
}

.pub-profile-post-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.pub-profile-post-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.pub-profile-post-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.pub-profile-post-date {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.pub-profile-post-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}

.pub-profile-post-likes {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.pub-profile-post-caption {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ================================================================
   FINAL MOBILE POLISH — Prompt 28
   Polish-only. No new features. No redesign.
   Targets: consistency, touch targets, spacing, empty/error states.
   ================================================================ */


/* ── Active session: auto-save toast text ────────────────── */
/* Make sure the toast element inside the header shows text properly */
.auto-save-toast {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-success);
  text-align: center;
  padding: 0 var(--space-4) var(--space-2);
  opacity: 0;
  transition: opacity 0.2s ease;
  letter-spacing: 0.02em;
  line-height: 1;
  min-height: 0;
  overflow: hidden;
}
.auto-save-toast-visible {
  opacity: 1;
}


/* ── Active session header: tighter spacing on small screens ─ */
@media (max-width: 380px) {
  .active-session-name {
    font-size: var(--text-base);
  }
  .active-finish-btn-top {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}


/* ── Loading states: consistent across all views ────────────
   Used by: training-loading, feed-loading, progress-loading   */
.training-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: var(--space-8) var(--space-4);
}
.training-loading-text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  letter-spacing: 0.01em;
}


/* ── Button disabled: consistent feel ───────────────────────
   Belt-and-suspenders in case pointer-events:none is bypassed */
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ── Input: consistent touch height for gym use ─────────────
   min-height already set but ensure textarea and select match */
textarea.input {
  min-height: 80px;
  line-height: 1.5;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

select.input,
select.settings-select {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23636366' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}


/* ── Error state: consistent inline error messages ──────────
   .auth-error already exists but other error divs are ad-hoc */
.auth-error {
  background-color: rgba(255, 59, 48, 0.07);
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: var(--radius-sm);
  color: var(--color-danger);
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
  line-height: 1.45;
}


/* ── Empty states: consistent across all tabs ───────────────
   Ensure every empty state has enough vertical breathing room */
.feed-empty,
.history-empty,
.progress-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
  padding: var(--space-8) var(--space-4);
  gap: var(--space-2);
}


/* ── Cards: consistent border on interactive cards ──────────
   Add active/pressed state to tappable cards for tactile feel */
.home-card-action:active,
.history-session-card:active,
.pub-profile-post-card:active,
.feed-card:active {
  background-color: var(--color-bg-surface-2);
  transition: background-color 0s; /* instant on press */
}


/* ── Home screen: ensure bottom pad clears nav bar ──────────
   .home-bottom-pad already exists but confirm it's generous */
.home-bottom-pad {
  height: var(--space-8);
}


/* ── Training bottom pad: same ──────────────────────────────
   .training-bottom-pad already exists; ensure it's big enough */
.training-bottom-pad {
  height: var(--space-12);
}


/* ── Finish session screen: bottom pad ──────────────────────
   Ensure the Finish button clears the nav bar */
.active-finish-wrap {
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
}


/* ── Feed screen: bottom pad ────────────────────────────────
   Feed list and detail need to clear the nav bar */
.feed-screen {
  padding-bottom: var(--space-12);
}

.feed-detail-screen {
  padding-bottom: var(--space-12);
}


/* ── Progress: bottom pad ───────────────────────────────────
   Progress already has padding-bottom: var(--space-12) via
   .progress-screen — confirmed consistent */


/* ── Profile screen: ensure settings page doesn't clip ─────
   .profile-screen has bottom padding — add extra for safety */
.profile-screen {
  padding-bottom: calc(var(--space-12) + var(--space-4));
}


/* ── Desktop: tighten the shell appearance ──────────────────
   The outer shell already has border-radius and shadow.
   Smooth off the content areas at the top edge. */
@media (min-width: 600px) {
  .app-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .landing-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .app-nav {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding-bottom: var(--space-3);
  }
}


/* ── Landing page: slightly warmer hero ─────────────────────
   The promise text had no margin — add breathing room */
.landing-promise {
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-top: var(--space-3);
}

.landing-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.landing-footer-note {
  margin-top: var(--space-6);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: center;
}


/* ── Active exercise card: highlight when data present ──────
   The hasData green border sometimes needs more breathing room */
.active-set-row-done {
  padding-left: calc(var(--space-2) - 3px);
  margin-left: 0;
  border-left-width: 3px;
}


/* ── Sticky headers in active session: ensure they don't overlap ── */
.active-session-header {
  z-index: 60; /* above the feed-detail-header z-index of 40 */
}


/* ── Feed detail: ensure comments scroll properly ───────────
   On small screens the comment input was floating over content */
.feed-detail-comments-section {
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
}


/* ── Finish session options: active state feedback ──────────
   When tapping an option the blue border jumps in — add visual */
.finish-option-btn:active {
  transform: scale(0.99);
  transition: transform 0.05s ease;
}


/* ── Share preview card: visual hierarchy ───────────────────
   Caption and summary need more separation */
.share-preview-card {
  margin-bottom: var(--space-5);
}


/* ── Edit session: clear distinction from active session ────
   The banner already differentiates but needs consistent spacing */
.edit-session-banner {
  margin-bottom: var(--space-2);
}


/* ── History filters: ensure mobile doesn't overflow ────────
   On very narrow screens the selects were squishing */
@media (max-width: 360px) {
  .history-filters {
    flex-direction: column;
  }
  .history-filter-select {
    width: 100%;
  }
}


/* ── Progress chart: prevent overflow on narrow screens ─────
   SVG already scales but the container needs overflow guard */
.progress-chart-wrap {
  overflow: hidden;
}


/* ── Public profile: bottom padding ────────────────────────
   Posts list had content clipping behind the nav bar */
.pub-profile-posts-list {
  padding-bottom: var(--space-12);
}


/* ── nav tab icon: active fill treatment ────────────────────
   The training icon (dumbbell) has paths that respond better
   to the stroke-width bump; ensure all icons get it */
.nav-tab.active .nav-icon {
  opacity: 1;
}
.nav-tab:not(.active) .nav-icon {
  opacity: 0.65;
}


/* ── Form focus ring: global refinement ─────────────────────
   All .input elements get a subtle accent ring on focus      */
.input:focus {
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}


/* ── btn-text-link (auth screens) ───────────────────────────
   Already has styling but confirm it's accessible */
.btn-text-link {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.btn-text-link:hover {
  color: var(--color-accent-hover);
}


/* ── Screen — generic wrapper for non-JS-rendered screens ── */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: var(--space-8) var(--space-4);
  text-align: center;
  gap: var(--space-3);
}

.screen-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}


/* ── Scrollbar: hide in WebKit for cleaner mobile look ──────
   Scrollbars visible on desktop in some browsers; hide them   */
.app-main::-webkit-scrollbar,
.add-ex-picker-sheet::-webkit-scrollbar,
.feed-detail-screen::-webkit-scrollbar {
  display: none;
}
.add-ex-picker-sheet,
.feed-detail-screen {
  scrollbar-width: none;
}


/* ── Final consistency pass: ensure home stat badge matches ─
   .home-rating-badge was defined in the Home section          */
.home-rating-badge {
  display: inline-block;
  background-color: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  padding: 3px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

/* ================================================================
   PERFORMANCE & FEEL — reduce jank on tab switch
   ================================================================ */

/* Tab screens: instant show/hide, no layout flash */
.tab-screen {
  /* Already has display:none via .hidden — ensure no transition delay */
  contain: layout style; /* hint to browser: tab contents are independent */
}

/* Smooth content appearance when a tab loads */
.tab-screen:not(.hidden) {
  animation: tab-fade-in 0.12s ease;
}

@keyframes tab-fade-in {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

/* Nav taps: instant visual response */
.nav-tab {
  -webkit-tap-highlight-color: transparent;
  transition: color 0.1s ease, opacity 0.1s ease;
}

/* Prevent text/layout reflow on font load */
.app-shell,
.app-main {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* ================================================================
   SKELETON SCREENS — instant perceived loading
   ================================================================ */

.skeleton-wrap {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skeleton-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg,
    var(--color-bg-surface-2) 25%,
    #e8e8ed 50%,
    var(--color-bg-surface-2) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-shimmer 1.4s infinite;
  width: 100%;
}

.skeleton-line-short { width: 40%; height: 12px; }
.skeleton-line-med   { width: 65%; height: 12px; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Like / dislike / comment SVG icons ─────────────────────── */

.feed-like-icon svg,
.feed-dislike-icon svg,
.feed-comment-icon svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

/* Active state — fill the icon */
.feed-liked .feed-like-icon svg,
.feed-disliked .feed-dislike-icon svg {
  fill: currentColor;
  stroke: currentColor;
}

.feed-liked   { color: var(--color-accent); }
.feed-disliked { color: var(--color-danger); }

/* ── Comment votes ───────────────────────────────────────────── */

.comment-vote-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.comment-vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 2px 0;
  min-height: 28px;
  transition: color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.comment-vote-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.comment-vote-btn:hover {
  color: var(--color-text-secondary);
}

.comment-vote-btn.comment-vote-active[data-vote="up"] {
  color: var(--color-accent);
}

.comment-vote-btn.comment-vote-active[data-vote="up"] svg {
  fill: var(--color-accent);
  stroke: var(--color-accent);
}

.comment-vote-btn.comment-vote-active[data-vote="down"] {
  color: var(--color-danger);
}

.comment-vote-btn.comment-vote-active[data-vote="down"] svg {
  fill: var(--color-danger);
  stroke: var(--color-danger);
}

/* ── Discard Session button ──────────────────────────────────── */
.active-discard-btn {
  color: var(--color-danger);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  min-height: 40px;
}

.active-discard-btn:hover {
  background-color: rgba(255, 59, 48, 0.06);
}

/* ── Plan delete button ───────────────────────────────────────── */
.plan-action-delete {
  color: var(--color-danger);
}

/* ── Drag and drop exercise reordering ───────────────────────── */


.day-ex-drag-handle {
  padding: var(--space-2);
  color: var(--color-text-tertiary);
  cursor: grab;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  touch-action: none;
}

.day-ex-drag-handle:active {
  cursor: grabbing;
}

.day-ex-dragging {
  opacity: 0.4;
}

.day-ex-drag-over {
  border-top: 2px solid var(--color-accent);
}

/* ── Delete day button ───────────────────────────────────────── */
.day-action-delete-day {
  color: var(--color-danger);
}

/* ── Day collapsed list (drill-down pattern) ─────────────────── */

.day-collapsed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.day-collapsed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) var(--space-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-align: left;
  min-height: 52px;
  gap: var(--space-3);
  transition: background-color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.day-collapsed-row:last-child {
  border-bottom: none;
}

.day-collapsed-row:active {
  background-color: var(--color-bg-surface-2);
}

.day-collapsed-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  flex: 1;
}

.day-collapsed-name-archived {
  color: var(--color-text-tertiary);
  font-weight: var(--weight-regular);
}

.day-archived-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.day-archived-row:last-child {
  border-bottom: none;
}

/* ── Day detail view ─────────────────────────────────────────── */

.day-detail-edit-section {
  padding: var(--space-4);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: var(--space-4);
}

.day-detail-save-wrap {
  padding: var(--space-4);
  padding-bottom: var(--space-2);
}

.day-detail-danger-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
}

.day-detail-danger-btn {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
}

.day-detail-delete-btn {
  color: var(--color-danger);
  border-color: rgba(255, 59, 48, 0.3);
}

/* ── Feed detail owner actions ───────────────────────────────── */
.feed-detail-owner-actions {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-2) 0;
}

.feed-detail-delete-btn {
  font-size: var(--text-sm);
  color: var(--color-danger);
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  border: 1px solid rgba(255, 59, 48, 0.25);
  border-radius: var(--radius-full);
}
