:root {
  --bg: #121212;
  /* Dark background */
  --fg: #e5e5e5;
  /* Light foreground text */
  --button-fg: #fff;
  /* Dark text on bright button */
  --button-bg: #3b82f6;
  /* Keep primary blue */
  --button-bg-hover: #1e40af;
  /* Darker, muted blue */
  --button-bg-disabled: #555555;
  /* Gray for disabled state */
  --tab-active-bg: #1e293b;
  /* Subtle dark highlight */
  --border: #444;
  --bg-profit: #4caf50;
  --bg-unsold: #3c46a6;
  /* Soft, low-contrast border */
  --bg-contrast: #1a1a1a;
  /* Slightly lighter than bg */
  --bg-contrast-hard: #222;
  /* More distinct dark block */
  --anchor: #91b4ff;
  /* Lighter blue for dark bg */
  --border-radius: 6px;
  /* Same as light mode */
  --focus-color: #60a5fa;
  /* Bright focus indicator */
}

* {
  border-color: var(--border);
  color: var(--fg);
  border-radius: var(--border-radius);
  border-style: solid;
  border-width: 0px;
}

body {
  height: 100vh;
  background: var(--bg);
  margin: 0;
  padding: 0;
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

#app {
  max-width: 100%;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 0.25rem 0.75rem;
  gap: 0.5rem;
  display: flex;
  flex-direction: column;
}

a:link,
a:visited {
  color: inherit;
}

nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5em;
}

.settings-link {
  text-decoration: none;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 1rem 0.75rem;
}

.auth-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .auth-card {
    padding: 2.5rem 2rem;
  }
}

.auth-toggle {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.auth-card form {
  width: 100%;
}

.inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;

  span {
    font-weight: bold;
    font-size: 14px;
  }

  input {
    flex: 1;
  }
}

select,
input[type="text"],
input[type="search"],
input[type="password"],
input[type="date"],
input[type="checkbox"],
textarea {
  padding: 6px 6px;
  font-size: 14px;
  border-width: 1px;
  transition: border-color 0.2s ease-in-out;
  min-width: 0;
  background-color: var(--bg-contrast-hard);
}

input[type="checkbox"] {
  appearance: none;
  width: 28px;
  height: 28px;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

input[type="checkbox"]:checked {
  background-color: var(--button-bg);
  border-color: var(--button-bg);
}

input[type="checkbox"]:checked::after {
  content: "✓";
  color: var(--button-fg);
  font-weight: bold;
}

input[type="checkbox"]:focus,
input[type="checkbox"]:hover {
  border-color: var(--focus-color);
  outline: none;
}

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

.inputs button {
  margin-top: 15px;
}

button {
  padding: 5px 10px;
  color: var(--button-fg);
  background-color: var(--button-bg);
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
  text-decoration: none;
  text-align: center;
}

button:hover {
  background: var(--button-bg-hover);
}

button:disabled {
  background: var(--button-bg-disabled);
}

progress {
  height: 1rem;
  appearance: none;
}

.loading {
  display: flex;
  align-items: center;
  flex: 1;
}

.dots {
  --size: 10px;
  display: inline-flex;
  gap: calc(var(--size) / 1.2);
  align-items: center;
  justify-content: center;
  height: calc(var(--size) * 2);
  flex: 1;
  margin: 2rem;
}

.dots span {
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--fg);
  display: inline-block;
  transform: translateY(0);
  animation: bounce 0.6s ease-in-out infinite;
}

.dots span:nth-child(2) {
  animation-delay: 0.12s;
}

.dots span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.6;
  }

  40% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/** ======================== non-generic styles start ==================== **/

/* ---- Onboarding ---- */

.onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  min-height: 0;
  padding: 1rem 0.75rem;
  gap: 1rem;
  animation: onboarding-fadein 0.5s ease-out;
}

@media (min-width: 480px) {
  .onboarding {
    justify-content: center;
    padding: 2rem 1.5rem;
    gap: 2rem;
  }
}

@keyframes onboarding-fadein {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.onboarding-progress {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-dot.active {
  background: var(--button-bg);
}

.progress-dot.current {
  width: 28px;
  border-radius: 5px;
  background: var(--button-bg);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

.onboarding-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1rem;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  animation: card-enter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .onboarding-card {
    flex: 0 1 auto;
    border-radius: 16px;
    padding: 2.5rem 2rem;
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.onboarding-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.onboarding-step-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.onboarding-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0;
  animation: icon-pulse 2s ease-in-out infinite;
}

@media (min-width: 480px) {
  .onboarding-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
  }
}

@keyframes icon-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.onboarding-icon.done-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  font-size: 2rem;
  color: #fff;
  animation: done-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes done-pop {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.onboarding-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #e5e5e5, #a0aec0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (min-width: 480px) {
  .onboarding-title {
    font-size: 1.75rem;
  }
}

.onboarding-subtitle {
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 0;
  max-width: 300px;
  line-height: 1.4;
}

.onboarding-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  min-height: 0;
  margin-top: 0.25rem;
  flex: 1;
}

@media (min-width: 480px) {
  .onboarding-fields {
    gap: 1.25rem;
    margin-top: 0.5rem;
  }
}

.onboarding-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.field-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-unit {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 500;
}

/* Sex picker toggle / side switch */

.side-switch {
  display: flex;
  gap: 0.5rem;
}

.sex-picker {
  display: flex;
  gap: 0.5rem;
}

.sex-option {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-contrast-hard);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sex-option:hover {
  border-color: var(--focus-color);
}

.sex-option.selected {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.onboarding-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-contrast-hard);
  color: var(--fg);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.number-input {
  box-sizing: border-box;
}

.field-input-row .number-input {
  padding: 0.85rem 1rem;
  font-size: 16px;
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.onboarding-input:focus {
  outline: none;
  border-color: var(--button-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.onboarding-nav {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  margin-top: auto;
  padding-top: 0.75rem;
}

.onboarding-btn {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.onboarding-btn.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.onboarding-nav .onboarding-btn.primary {
  flex: 1;
}

.onboarding-btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.onboarding-btn.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.onboarding-btn.ghost {
  background: transparent;
  color: #9ca3af;
  border: 1px solid var(--border);
}

.onboarding-btn.ghost:hover {
  background: var(--bg-contrast-hard);
  color: var(--fg);
}

.onboarding-btn.danger {
  background: #dc2626;
  color: #fff;
}

.onboarding-btn.danger:hover {
  background: #b91c1c;
}

/* Goal toggle buttons */

.goal-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-contrast-hard);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-align: left;
}

.goal-option:hover {
  border-color: var(--focus-color);
  background: rgba(59, 130, 246, 0.05);
}

.goal-option.selected {
  border-color: var(--button-bg);
  background: rgba(59, 130, 246, 0.1);
  box-shadow:
    0 0 0 1px var(--button-bg),
    0 2px 8px rgba(59, 130, 246, 0.15);
}

.goal-option-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.goal-option-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

.focus-body-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 380px;
  overflow: hidden;
}

.focus-body-picker svg {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

@media (max-width: 479px) {
  .focus-fields {
    flex: 1 1 0;
    min-height: 0;
  }

  .focus-body-picker {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
  }
}

/* Training days chip picker */

.training-days-picker {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.day-chip {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-contrast-hard);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 380px) {
  .training-days-picker {
    gap: 0.35rem;
  }

  .day-chip {
    width: 2.25rem;
    height: 2.25rem;
    flex-basis: 2.25rem;
  }
}

.day-chip:hover {
  border-color: var(--focus-color);
}

.day-chip.selected {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ---- Exercises ---- */

.exercise-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.exercise-list-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-bottom: 0.75rem;
}

.exercise-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exercise-picker-header h2 {
  margin: 0;
}

.search-field {
  flex: 1;
  min-width: 12rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-contrast);
  color: var(--fg);
  font-size: 0.9rem;
}

.search-field::placeholder {
  color: #9ca3af;
}

.muscle-filter {
  flex: 0 1 10rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--bg-contrast);
  color: var(--fg);
  text-transform: capitalize;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

@media (min-width: 768px) {
  .exercise-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(0, 300px));
    align-content: start;
  }
}

.exercise-item.clickable,
.workout-item.clickable {
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.exercise-item.clickable:hover,
.workout-item.clickable:hover {
  border-color: var(--focus-color);
}

.exercise-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .exercise-item {
    padding: 1.5rem;
  }
}

.exercise-item h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.exercise-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.exercise-item p {
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 0;
  line-height: 1.4;
}

.exercise-details {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.exercise-tags {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.exercise-body-views {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.exercise-body-views .lazy-body {
  width: 48px;
  min-height: 96px;
}

.plan-muscle-overview {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.exercise-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-contrast-hard);
  border: 1px solid var(--border);
  color: #9ca3af;
  text-transform: capitalize;
}

/* Exercise Form */

.exercise-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .exercise-form {
    padding: 1.5rem;
  }
}

.exercise-form h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.exercise-form-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exercise-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.exercise-form-field span {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.exercise-form-checks {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.exercise-form-checks label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.exercise-form-body {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.exercise-form-actions {
  display: flex;
  gap: 0.75rem;
}

/* ---- Workouts ---- */

.workout-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.workout-list-header {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-bottom: 0.75rem;
}

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

@media (min-width: 768px) {
  .workout-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(0, 300px));
    align-content: start;
  }
}

.workout-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
}

.workout-item h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.workout-entries {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

@media (max-width: 767px) {
  .workout-list .workout-entries {
    display: none;
  }
}

.workout-entry-name {
  font-weight: 600;
}

.workout-entry-detail {
  color: #9ca3af;
}

.workout-entry-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.workout-entry-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.workout-entry-form + .workout-entry-form {
  padding-top: 1rem;
}

.workout-entry-form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.workout-entry-exercise {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
}

.workout-entry-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.workout-entry-field span {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #9ca3af;
}

.workout-entry-field input {
  width: 100%;
  box-sizing: border-box;
}

.workout-entry-remove {
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  background: #dc2626;
  color: #fff;
  border: 1px solid #dc2626;
  border-radius: 8px;
}

.workout-entry-remove:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.workout-entry-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.workout-entry-sets {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: 0.75rem;
}

.workout-sets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.workout-set-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.workout-set-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.workout-set-row .number-input {
  flex: 1 1 0;
  padding: 0.35rem 0.45rem;
  min-width: 0;
  text-align: center;
}

.workout-set-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workout-set-fields {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.workout-set-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  flex: 0 0 auto;
}

.workout-set-unit,
.workout-set-separator {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  flex: 0 0 auto;
}

.workout-set-delete {
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  background: #dc2626;
  color: #fff;
  border: 1px solid #dc2626;
  border-radius: 8px;
  flex: 0 0 auto;
}

.workout-set-delete:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.workout-add-set {
  align-self: flex-start;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: transparent;
  color: #9ca3af;
  border: 1px solid var(--border);
}

.workout-add-set:hover {
  color: var(--fg);
  border-color: var(--focus-color);
  background: transparent;
}

.workout-pause-info {
  font-size: 0.75rem;
  color: #9ca3af;
}

.workout-pause-override {
  margin-top: 0.4rem;
}

.workout-pause-override input {
  width: 100%;
  box-sizing: border-box;
}

.app-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.bottom-tabs {
  display: flex;
  padding: 0.2rem 0;
  gap: 0;
  flex-shrink: 0;
}

.bottom-tab {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.35rem 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #6b7280;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s ease;
  text-decoration: none;
}

.bottom-tab span {
  font-size: 0.9rem;
  font-weight: 600;
  color: inherit;
}

.bottom-tab:hover {
  color: var(--fg);
  background: transparent;
}

.bottom-tab.active {
  color: var(--fg);
}

.bottom-tab.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 1.4rem;
  height: 2px;
  border-radius: 0;
  background: var(--fg);
}

/* ---- Home Tab ---- */

.home-tab {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.home-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
  text-align: center;
}

.home-card.placeholder {
  border-style: dashed;
}

.home-card-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.home-card p {
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 0;
  line-height: 1.5;
  max-width: 280px;
}

.home-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  flex-wrap: wrap;
}

.home-card-header strong {
  font-size: 1rem;
}

.home-card-date {
  margin-left: auto;
  font-size: 0.75rem;
  color: #9ca3af;
}

.home-workout-exercises {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}

.home-workout-exercise {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.home-workout-exercise-name {
  color: var(--fg);
}

.home-workout-exercise-sets {
  color: #9ca3af;
  font-size: 0.8rem;
}

.home-card-clickable {
  cursor: pointer;
}

.home-body-viz {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.home-body-svg {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 280px;
}

.home-card-expanded {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
  padding-bottom: 0.75rem;
}

.home-workout-detail {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 0 1rem 1rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

.home-detail-exercise {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.home-detail-exercise:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.home-detail-exercise:first-child {
  padding-top: 0;
}

.home-detail-exercise-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.home-detail-sets {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-left: 0.5rem;
}

.home-detail-set {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.home-detail-set-num {
  color: #6b7280;
  min-width: 1.2rem;
}

.home-detail-set-info {
  font-variant-numeric: tabular-nums;
}

/* ---- Workout Session ---- */

.workout-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.workout-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.workout-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.workout-edit-btn {
  background: var(--bg-contrast-hard);
  color: #9ca3af;
  border: 1px solid var(--border);
}

.workout-edit-btn:hover {
  color: var(--fg);
  border-color: var(--focus-color);
}

.workout-play-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.workout-play-btn:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}

.workout-session {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  height: 100%;
  box-sizing: border-box;
  justify-content: flex-start;
  overflow: hidden;
}

.workout-session-list-mode {
  gap: 0;
  padding: 0;
  align-items: stretch;
}

@media (min-width: 768px) {
  .workout-session.workout-session-list-mode {
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }
}

.workout-session > * {
  flex-shrink: 0;
}

.workout-session-topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 0 0.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-radius: 0px;
}

.workout-session-topbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
}

.workout-session-finish {
  flex: 0 0 auto;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: 1px solid #2563eb;
  font-weight: 700;
}

.workout-session-finish:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #1d4ed8;
}

.workout-session-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.35rem 0 0.75rem;
}

.workout-session-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.85rem 0;
  box-sizing: border-box;
  box-shadow: none;
}

.workout-session-card + .workout-session-card {
  padding-top: 1rem;
}

.workout-session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.workout-session-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.workout-session-card-header span {
  flex: 0 0 auto;
  font-size: 0.8rem;
  color: #9ca3af;
}

.workout-session-card-sets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.workout-session-set-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.workout-session-set-row .number-input {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  text-align: center;
}

.workout-session-set-row.done {
  opacity: 0.65;
}

.workout-session-set-row.done .workout-set-label {
  text-decoration: line-through;
}

.workout-hold-timer {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  background: var(--bg-contrast-hard);
  color: #9ca3af;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.workout-hold-timer.active {
  color: var(--fg);
  border-color: var(--focus-color);
}

.workout-session-set-toggle {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  background: var(--bg-contrast-hard);
  color: #9ca3af;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.workout-session-set-row.done .workout-session-set-toggle {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border-color: #16a34a;
}

.workout-session-timerbar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.workout-session-timer-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 0 0 auto;
}

.workout-session-timerbar-display {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.workout-session-header {
  text-align: center;
  width: 100%;
}

.workout-session-main {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow-y: auto;
}

.workout-session-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-top: auto;
}

.workout-session-action {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}

.workout-session-action-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
}

.workout-session-action-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.workout-session-action-ghost {
  background: transparent;
  color: #9ca3af;
}

.workout-session-action-ghost:hover {
  background: var(--bg-contrast-hard);
  color: var(--fg);
}

.workout-session-action-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.workout-session-action-danger:hover {
  background: #b91c1c;
}

.workout-session-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.workout-session-progress {
  font-size: 0.8rem;
  color: #9ca3af;
}

.workout-session-exercise {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

.workout-session-exercise-icon {
  font-size: 2rem;
}

.workout-session-exercise h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.workout-session-sets {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

.workout-session-set {
  font-size: 0.85rem;
  color: #9ca3af;
}

.workout-session-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

.workout-session-timer-display {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.workout-session-timer-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  justify-content: flex-end;
}

.workout-timer-adjust {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-contrast-hard);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.workout-timer-adjust:hover {
  border-color: var(--focus-color);
  background: var(--bg-contrast-hard);
}

.workout-session-set.done {
  text-decoration: line-through;
  opacity: 0.5;
}

.workout-session-set.current {
  color: var(--fg);
  font-weight: 600;
}

.workout-preview-sets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-self: stretch;
  background: var(--bg-contrast);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}
