:root {
  color-scheme: light;
  --bg: #eef4f2;
  --surface: #ffffff;
  --surface-soft: #f4f8f6;
  --surface-strong: rgba(255, 255, 255, 0.94);
  --control-bg: #ffffff;
  --canvas-bg: #fbfefc;
  --canvas-bg-strong: #ffffff;
  --body-start: #f8fbf8;
  --body-end: #e8f0ef;
  --body-mobile-start: #f7fbf8;
  --ink: #16211f;
  --muted: #66736f;
  --line: #d8e2de;
  --line-soft: rgba(216, 226, 222, 0.9);
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff3ee;
  --accent-top: #12877e;
  --accent-chip-top: #13887f;
  --gold: #c98a18;
  --gold-soft: #fff3d7;
  --danger: #c2414b;
  --danger-soft: #fff0f1;
  --danger-line: #f2c7cc;
  --on-accent: #ffffff;
  --shadow: 0 18px 45px rgba(22, 33, 31, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101716;
  --surface: #17211f;
  --surface-soft: #1e2b28;
  --surface-strong: rgba(23, 33, 31, 0.96);
  --control-bg: #111b19;
  --canvas-bg: #111b19;
  --canvas-bg-strong: #162320;
  --body-start: #0b1110;
  --body-end: #14201e;
  --body-mobile-start: #0d1413;
  --ink: #edf7f4;
  --muted: #a6b7b2;
  --line: #31413d;
  --line-soft: rgba(68, 88, 82, 0.9);
  --accent: #25b8a8;
  --accent-strong: #1e968b;
  --accent-soft: #183b37;
  --accent-top: #2cc7b6;
  --accent-chip-top: #28bdae;
  --gold: #e5b755;
  --gold-soft: #3d321d;
  --danger: #ff7a87;
  --danger-soft: #3b1d23;
  --danger-line: #66343d;
  --on-accent: #071211;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(15, 118, 110, 0.12), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(201, 138, 24, 0.12), transparent 24%),
    linear-gradient(160deg, var(--body-start) 0%, var(--bg) 48%, var(--body-end) 100%),
    var(--bg);
  color: var(--ink);
}

body.show-auth .topbar,
body.show-auth .app-shell {
  display: none;
}

body.show-app .auth-shell {
  display: none;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(420px, 0.95fr);
  min-height: 100vh;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: clamp(40px, 7vw, 110px);
  overflow: hidden;
  background: #0a211b;
  color: #f1f7f4;
}

.auth-brand-mark,
.auth-mobile-brand span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: #2dd4b3;
  color: #06130f;
}

.auth-brand-mark svg,
.auth-mobile-brand svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-copy h1 {
  margin: 12px 0 20px;
  font-size: clamp(2.65rem, 5vw, 4.6rem);
  line-height: 1.02;
}

.auth-copy > p:last-child {
  max-width: 520px;
  margin: 0;
  color: #abc0b9;
  font-size: 1.125rem;
  line-height: 1.55;
}

.auth-bars {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  gap: 10px;
  height: 90px;
}

.auth-bars i {
  width: 28px;
  border-radius: 3px 3px 0 0;
  background: #2dd4b3;
  opacity: 0.75;
}

.auth-bars i:nth-child(1) { height: 25%; }
.auth-bars i:nth-child(2) { height: 52%; }
.auth-bars i:nth-child(3) { height: 42%; }
.auth-bars i:nth-child(4) { height: 78%; }
.auth-bars i:nth-child(5) { height: 100%; }

.auth-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 32px;
  background: var(--surface);
}

.auth-card {
  display: grid;
  gap: 20px;
  width: min(420px, 100%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 2.125rem;
  line-height: 1.1;
}

.auth-card .eyebrow,
.auth-copy .eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.auth-copy .eyebrow {
  color: #2dd4b3;
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.auth-mobile-brand span {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: var(--on-accent);
}

.auth-mobile-brand svg {
  width: 22px;
  height: 22px;
}

.auth-mobile-brand strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form input {
  min-height: 48px;
  padding: 11px 13px;
  border-radius: 5px;
}

.auth-form button {
  min-height: 48px;
  margin-top: 2px;
  border-radius: 5px;
}

.auth-form .form-message:empty {
  display: none;
}

@media (max-width: 800px) {
  body.show-auth {
    padding: 0;
    background: var(--surface);
  }

  .auth-shell {
    display: block;
    min-height: 100svh;
    overflow-y: auto;
    background: var(--surface);
  }

  .auth-visual {
    display: none;
  }

  .auth-panel {
    display: grid;
    place-items: center;
    min-height: 100svh;
    padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  }

  .auth-card {
    gap: 18px;
    width: min(420px, 100%);
  }

  .auth-card h1 {
    font-size: clamp(1.85rem, 9vw, 2.3rem);
  }

  .auth-mobile-brand {
    display: flex;
    margin-bottom: 4px;
  }

  .auth-form input {
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .auth-panel {
    padding-inline: 14px;
  }
}

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

button {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  color: var(--on-accent);
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

button:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

button.ghost {
  background: var(--control-bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

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

button.danger-primary {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

button.danger-primary:hover {
  border-color: #9f2f3a;
  background: #9f2f3a;
}

button.ghost:hover {
  background: var(--surface-soft);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.panel > label + label {
  margin-top: 12px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--ink);
  padding: 8px 10px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.topbar {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 18px;
  padding: 28px clamp(16px, 3vw, 42px) 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-badge {
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.page-nav {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-tab {
  min-height: 36px;
  padding: 0 12px;
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 0.8rem;
}

.nav-tab:hover {
  background: var(--surface-soft);
}

.nav-tab.active {
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  color: var(--on-accent);
  border-color: var(--accent);
}

.app-shell {
  width: 100%;
  min-width: 0;
  padding: 0 clamp(16px, 3vw, 42px) 38px;
}

.page {
  display: none;
}

.page.active {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.workout-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 330px);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

.workout-mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.workout-mode-button:hover {
  background: var(--surface-soft);
}

.workout-mode-button.active,
.workout-mode-button.active:hover {
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  color: var(--on-accent);
}

.workout-mode-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 520px) {
  .workout-mode-switch {
    width: 100%;
  }
}

.training-entry {
  max-width: 760px;
  min-width: 0;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.filters-panel {
  max-width: 760px;
}

.filter-grid,
.management-grid {
  display: grid;
  gap: 14px;
}

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

.management-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.panel {
  background: var(--surface-strong);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading span,
#tableCount {
  color: var(--muted);
  font-size: 0.86rem;
}

.person-list,
.exercise-list,
.group-list,
.member-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.person-chip,
.exercise-chip,
.group-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.person-chip.active,
.exercise-chip.active,
.group-chip.active {
  background: linear-gradient(180deg, var(--accent-chip-top), var(--accent));
  border-color: var(--accent);
  color: var(--on-accent);
}

.exercise-list {
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.exercise-chip {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.exercise-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  min-width: 0;
}

.exercise-admin-row.without-delete {
  grid-template-columns: minmax(0, 1fr);
}

.exercise-admin-row .exercise-chip {
  min-width: 0;
}

.exercise-delete {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.inline-form {
  display: grid;
  gap: 8px;
}

.cardio-activity-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: stretch;
}

.cardio-distance-check {
  min-height: 40px;
  white-space: nowrap;
}

.cardio-activity-form-grid > button {
  min-width: 96px;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.user-row > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-row strong,
.user-row small {
  overflow-wrap: anywhere;
}

.user-row small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.inline-controls {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.exercise-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.7fr);
  gap: 8px;
  align-items: stretch;
}

.exercise-form-grid > * {
  min-width: 0;
}

.exercise-bodyweight-check,
.exercise-barbell-check {
  min-height: 40px;
  white-space: nowrap;
}

.exercise-category-options,
.exercise-form-actions {
  grid-column: 1 / -1;
}

.exercise-category-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.exercise-category-options legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.exercise-category-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.exercise-category-options input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.exercise-form-actions {
  display: flex;
  gap: 8px;
}

.exercise-form-actions button:first-child {
  flex: 1;
  width: 100%;
}

.table-weight-note {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 0.68rem;
  line-height: 1.2;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-form {
  margin-bottom: 18px;
}

.profile-name-card {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 13px;
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 8px;
  background: rgba(96, 165, 250, 0.08);
}

.profile-name-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.profile-name-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.profile-name-form label,
.profile-name-form input {
  min-width: 0;
  width: 100%;
}

.cardio-panel,
.cardio-history-panel {
  max-width: 760px;
  margin-bottom: 18px;
}

.cardio-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.cardio-form label,
.cardio-form input,
.cardio-form select {
  min-width: 0;
  width: 100%;
}

.cardio-form input,
.cardio-form select,
.cardio-form button {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
}

.cardio-form input,
.cardio-form select {
  padding: 0 10px;
  line-height: 42px;
  vertical-align: middle;
}

.cardio-duration-field {
  display: grid;
  gap: 6px;
}

.cardio-duration-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.cardio-duration-inputs input {
  min-width: 0;
  text-align: center;
}

.cardio-form input[type="date"]::-webkit-date-and-time-value,
.cardio-form input[type="date"]::-webkit-datetime-edit {
  min-height: 42px;
  margin: 0;
  padding: 0;
  line-height: 42px;
}

.cardio-actions {
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.cardio-actions > button:first-child {
  flex: 1;
}

.cardio-actions > button {
  min-width: 0;
}

.cardio-form .form-message {
  grid-column: 1 / -1;
  margin: 0;
}

.cardio-history {
  width: 100%;
  min-width: 0;
}

.cardio-table {
  display: grid;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.cardio-row {
  display: grid;
  grid-template-columns: minmax(68px, 0.82fr) minmax(110px, 1.55fr) minmax(44px, 0.55fr) minmax(58px, 0.7fr) minmax(48px, 0.62fr) minmax(44px, 0.55fr) 66px;
  align-items: center;
  min-width: 0;
  gap: 6px;
  min-height: 48px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.cardio-row:first-child {
  border-top: 0;
}

.cardio-row strong {
  color: var(--ink);
}

.cardio-head {
  min-height: 34px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.cardio-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.cardio-row-actions .icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.training-status-card {
  margin-bottom: 14px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: none;
}

.training-status-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.training-status-stats span {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 76px;
  padding: 12px 14px 12px 0;
}

.training-status-stats span + span {
  padding-right: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.training-status-stats strong {
  color: var(--ink);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.training-status-stats small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.history-difficulty-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 1.05rem;
}

.history-difficulty-legend span {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.password-profile-form,
.measurement-form,
.mcp-token-card {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mcp-token-card {
  display: grid;
  gap: 12px;
}

.mcp-token-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.mcp-token-status {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
}

.mcp-token-output {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 2px solid rgba(95, 196, 127, 0.7);
  border-radius: 8px;
  background: rgba(95, 196, 127, 0.14);
}

.mcp-token-value {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 800 0.86rem/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
}

.mcp-copy-token {
  justify-self: start;
}

.mcp-token-output small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.mcp-token-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.mcp-token-dialog.visible {
  display: grid;
}

.mcp-token-dialog-card {
  display: grid;
  width: min(560px, 100%);
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mcp-token-dialog-card h3,
.mcp-token-dialog-card p {
  margin: 0;
}

.mcp-token-dialog-card textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font: 800 0.9rem/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mcp-token-dialog-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.exercise-delete-dialog-card {
  width: min(430px, 100%);
}

.exercise-delete-dialog-card .form-actions {
  justify-content: flex-end;
}

.profile-grid,
.measurement-grid {
  display: grid;
  gap: 8px;
}

.profile-grid {
  grid-template-columns: minmax(0, 1fr);
}

.measurement-grid {
  grid-template-columns: minmax(0, 1fr);
}

.profile-grid label,
.measurement-grid input {
  min-width: 0;
  max-width: 100%;
}

.profile-grid input,
.measurement-grid input,
input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

.measurement-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.measurement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.measurement-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.measurement-row span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.measurement-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.measurement-row button,
.measurement-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.group-dashboard-panel {
  max-width: 1120px;
}

.group-dashboard-filters {
  margin-bottom: 16px;
}

.dashboard-range-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-width: 520px;
  margin-bottom: 12px;
}

.dashboard-range-presets button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 0.76rem;
}

.dashboard-range-presets button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

@media (max-width: 520px) {
  .dashboard-range-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }
}

.group-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.group-volume-chart {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: 1fr auto auto;
  gap: 8px 10px;
  min-height: 390px;
  margin-bottom: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.chart-y-axis {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
  text-align: right;
}

.chart-y-axis > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.chart-x-label {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
  text-align: center;
}

.group-volume-bars {
  display: flex;
  align-items: end;
  gap: 20px;
  min-width: 0;
  min-height: 330px;
  padding: 12px 4px 0;
  border-left: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background-color: transparent;
  background-image: repeating-linear-gradient(
    to top,
    rgba(127, 139, 133, 0.2) 0,
    rgba(127, 139, 133, 0.2) 1px,
    transparent 1px,
    transparent 25%
  );
  overflow-x: auto;
}

.group-volume-month {
  display: grid;
  grid-template-rows: minmax(250px, 1fr) 24px;
  flex: 1 0 112px;
  min-width: 104px;
  max-width: 180px;
  gap: 6px;
  align-items: end;
  text-align: center;
}

.group-volume-month-bars {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 3px;
  height: 100%;
  min-height: 250px;
  padding: 0 4px;
  background: transparent;
}

.group-volume-member-bar {
  position: relative;
  display: flex;
  align-items: end;
  width: min(30px, 44%);
  min-width: 20px;
  max-width: 36px;
  height: 100%;
  outline: 0;
}

.group-volume-member-bar i {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  min-height: 2px;
  border: 2px solid rgba(5, 24, 21, 0.72);
  border-radius: 0;
  background: var(--accent-soft);
  box-shadow: none;
}

.group-volume-member-bar::after {
  position: absolute;
  z-index: 4;
  top: 8px;
  left: 50%;
  width: max-content;
  max-width: 190px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--ink);
  color: var(--surface);
  content: attr(data-tooltip);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 850;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, -4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.group-volume-member-bar:hover::after,
.group-volume-member-bar:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.group-volume-member-bar:focus i {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.group-volume-month > span {
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 950;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-volume-legend {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  padding-top: 6px;
}

.group-volume-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.group-volume-legend i {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(5, 24, 21, 0.72);
  border-radius: 1px;
}

.group-dashboard-card {
  display: grid;
  width: 100%;
  min-height: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 12px 13px 12px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--member-color, var(--accent));
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
  text-align: left;
}

.group-dashboard-card:hover,
.group-dashboard-card:focus-visible {
  border-color: var(--member-color, var(--accent));
  background: var(--surface-soft);
}

.group-dashboard-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--member-color, var(--accent)) 30%, transparent);
  outline-offset: 2px;
}

.group-dashboard-card.active {
  border-color: var(--member-color, var(--accent));
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--member-color, var(--accent));
}

.group-dashboard-rank {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid var(--member-color, var(--accent));
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 950;
}

.group-dashboard-card-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.group-dashboard-card-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.group-dashboard-metrics span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px 0 0;
}

.group-dashboard-metrics span + span {
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.group-dashboard-metrics small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.group-dashboard-metrics strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-member-detail {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
}

.dashboard-member-detail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-member-detail-heading div {
  display: grid;
  gap: 2px;
}

.dashboard-member-detail-heading span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-member-detail-heading h3,
.dashboard-member-detail-heading strong {
  margin: 0;
  color: var(--ink);
}

.dashboard-member-detail-heading h3 {
  font-size: 1rem;
}

.dashboard-member-detail-heading strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.dashboard-exercise-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
}

.dashboard-exercise-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 120px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.dashboard-exercise-row:last-child {
  border-bottom: 0;
}

.dashboard-exercise-row > :not(:first-child) {
  text-align: right;
}

.dashboard-exercise-row strong {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
  overflow-wrap: anywhere;
}

.dashboard-exercise-row strong small {
  color: var(--muted);
  font-size: 0.62rem;
  white-space: nowrap;
}

.dashboard-exercise-head {
  min-height: 30px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-bars {
  display: grid;
  gap: 7px;
}

.dashboard-bar-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.dashboard-bar-row div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.dashboard-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.dashboard-bar-row.duration i {
  background: var(--gold);
}

.check-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--ink);
}

.check-row input {
  width: auto;
  min-height: auto;
}

.member-row {
  justify-content: flex-start;
}

.member-row span {
  display: grid;
  gap: 2px;
}

.member-row small,
.muted {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.group-member-form {
  margin-top: 16px;
}

.password-note {
  margin: -4px 0 14px;
}

.admin-password-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.calendar-panel {
  overflow: hidden;
}

.calendar-heading {
  align-items: center;
}

.calendar-heading > div {
  display: grid;
  gap: 5px;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-controls strong {
  min-width: 170px;
  text-align: center;
  text-transform: capitalize;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.top-actions .icon-button {
  flex: 0 0 40px;
}

.theme-toggle {
  font-size: 1.15rem;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 84px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.calendar-day.empty {
  min-height: 84px;
  background: transparent;
  border: 0;
}

.calendar-day:disabled {
  cursor: default;
  opacity: 0.72;
}

.calendar-day.today {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.14);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.calendar-day.has-training {
  background: linear-gradient(180deg, var(--accent-soft), var(--surface-soft));
  color: var(--ink);
  border-color: var(--accent);
}

.calendar-day.today.has-training {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}

.calendar-day.has-training:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
}

.calendar-day.selected {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.calendar-date {
  font-size: 0.86rem;
  font-weight: 900;
}

.calendar-day strong {
  font-size: 1.35rem;
  line-height: 1;
}

.calendar-activity-label {
  min-width: 0;
  overflow: hidden;
  font-size: 0.74rem;
  font-weight: 800;
}

.calendar-activity-label-short {
  display: none;
}

@media (min-width: 721px) and (max-width: 1200px) {
  .calendar-activity-label-full {
    display: none;
  }

  .calendar-activity-label-short {
    display: inline;
  }
}

.history-day-panel {
  max-width: 1120px;
}

.history-section-title {
  margin: 16px 0 8px;
  color: var(--ink);
  font-size: 0.9rem;
}

.history-section-title:first-of-type {
  margin-top: 0;
}

.history-cardio-table {
  display: grid;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-cardio-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.5fr) minmax(40px, 0.5fr) minmax(58px, 0.68fr) minmax(44px, 0.55fr) minmax(44px, 0.55fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.history-cardio-row:first-child {
  border-top: 0;
}

.history-cardio-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.history-cardio-head {
  min-height: 34px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

@media (max-width: 520px) {
  .history-cardio-row {
    grid-template-columns: minmax(68px, 1.35fr) 30px 44px 34px 34px;
    gap: 4px;
    padding: 6px;
    font-size: 0.7rem;
  }

  .history-cardio-head {
    font-size: 0.56rem;
  }

  .cardio-table .cardio-head {
    display: none;
  }

  .cardio-table .cardio-row:not(.cardio-head) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 56px;
    grid-template-rows: repeat(3, auto);
    gap: 8px 6px;
    min-height: 0;
    padding: 10px;
    font-size: 0.78rem;
  }

  .cardio-table .cardio-row:not(.cardio-head) > :is(span, strong):not(.cardio-row-actions) {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .cardio-table .cardio-row:not(.cardio-head) > :is(span, strong):not(.cardio-row-actions)::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.56rem;
    font-weight: 950;
    text-transform: uppercase;
  }

  .cardio-table .cardio-row-actions {
    grid-column: 3;
    grid-row: 1 / -1;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
  }
}

.history-pivot-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-pivot-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.history-pivot-table th,
.history-pivot-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.history-pivot-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-pivot-table td:last-child,
.history-pivot-table th:last-child {
  text-align: left;
}

.history-pivot-table tr:last-child td {
  border-bottom: 0;
}

.history-pivot-table td:first-child {
  min-width: 120px;
  color: var(--ink);
  font-weight: 900;
}

.history-pivot-table td strong {
  overflow-wrap: anywhere;
}

.set-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.35;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: normal;
  color: var(--ink);
}

.set-difficulty-emoji {
  font-size: 0.95rem;
  line-height: 1;
}

.work-area {
  display: grid;
  grid-template-columns: minmax(280px, 430px) 1fr;
  gap: 18px;
}

.entry-form {
  display: grid;
  grid-template-columns: 58px 58px repeat(4, minmax(0, 1fr));
  gap: 13px;
  overflow: hidden;
}

.entry-form label {
  min-width: 0;
}

.entry-form > label:not(.wide):not(.entry-line) {
  grid-column: span 3;
}

.entry-form .entry-line {
  grid-column: span 2;
}

.entry-form .entry-number-line,
.entry-form .entry-set-line {
  grid-column: span 1;
  width: 58px;
  max-width: 58px;
}

.entry-form .entry-number-line input,
.entry-form .entry-set-line input {
  max-width: 58px;
  padding-inline: 6px;
  text-align: center;
  font-size: 0.88rem;
}

.entry-form .entry-value-line input {
  font-size: 0.76rem;
}

.entry-form .entry-value-line input::placeholder {
  font-size: 0.68rem;
}

.entry-form input,
.entry-form select {
  max-width: 100%;
  min-width: 0;
}

.entry-form input:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.entry-form input.readonly-field {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: default;
}

.difficulty-scale {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.difficulty-scale legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.difficulty-options {
  display: flex;
  width: 100%;
  min-width: 0;
  gap: 7px;
}

.difficulty-options label {
  position: relative;
  display: grid;
  flex: 1 1 0;
  grid-column: auto;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 38px;
  place-items: center;
  padding: 5px 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
}

.difficulty-options label[data-tooltip]::after,
.history-difficulty-legend [data-tooltip]::after {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 7px);
  left: 50%;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink);
  color: var(--panel);
  content: attr(data-tooltip);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  text-transform: none;
  transform: translate(-50%, 3px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.difficulty-options label[data-tooltip]:hover::after,
.difficulty-options label[data-tooltip]:focus-within::after,
.difficulty-options label[data-tooltip]:active::after,
.history-difficulty-legend [data-tooltip]:hover::after,
.history-difficulty-legend [data-tooltip]:focus::after,
.history-difficulty-legend [data-tooltip]:active::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.history-difficulty-legend [data-tooltip] {
  position: relative;
  outline: none;
}

.difficulty-options input {
  position: absolute;
  width: 1px !important;
  min-width: 0;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.difficulty-options span {
  font-size: 1.2rem;
  line-height: 1;
}

.difficulty-options label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(95, 196, 127, 0.16);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.entry-form input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

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

.hidden {
  display: none !important;
}

.last-value-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent-soft), var(--surface-soft));
}

.last-set-list {
  display: grid;
  gap: 5px;
}

.last-set-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.last-set-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.last-set-table th,
.last-set-table td {
  padding: 6px 5px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.last-set-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.last-set-table th:nth-child(1),
.last-set-table td:nth-child(1) {
  width: 34%;
}

.last-set-table th:nth-child(2),
.last-set-table td:nth-child(2) {
  width: 18%;
}

.last-set-table th:nth-child(3),
.last-set-table td:nth-child(3),
.last-set-table th:nth-child(4),
.last-set-table td:nth-child(4) {
  width: 24%;
}

.last-set-table tr:last-child td {
  border-bottom: 0;
}

.last-set-table td {
  font-weight: 900;
}

.last-set-entry {
  display: block;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.last-set-entry.difficulty-green {
  color: var(--accent);
}

.last-set-entry.difficulty-yellow {
  color: #ca8a04;
}

.last-set-entry.difficulty-blue {
  color: #2563eb;
}

.last-set-entry.difficulty-orange {
  color: #ea580c;
}

.last-set-entry.difficulty-red {
  color: var(--danger);
}

.last-set-entry.difficulty-max {
  color: #dc2626;
}

.last-set-entry.difficulty-neutral {
  color: var(--ink);
}

.last-set-table tr.difficulty-green td {
  color: var(--accent);
}

.last-set-table tr.difficulty-yellow td {
  color: #ca8a04;
}

.last-set-table tr.difficulty-blue td {
  color: #2563eb;
}

.last-set-table tr.difficulty-orange td {
  color: #ea580c;
}

.last-set-table tr.difficulty-red td {
  color: var(--danger);
}

.last-set-table tr.difficulty-max td {
  color: #dc2626;
}

.last-set-table tr.difficulty-neutral td {
  color: var(--ink);
}

.last-set-table td:first-child {
  color: var(--ink);
}

.last-set-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  font-size: 0.78rem;
}

.last-set-row {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(34px, 0.52fr) minmax(36px, 0.55fr) minmax(48px, 0.78fr) minmax(32px, 0.42fr);
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.last-set-row:last-child {
  border-bottom: 0;
}

.last-set-row span {
  min-width: 0;
  padding: 7px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.last-set-head {
  background: var(--surface-soft);
}

.last-set-head span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.last-set-row:not(.last-set-head) span {
  color: var(--ink);
}

.last-set-difficulty {
  text-align: center;
  font-size: 0.92rem;
}

.training-timer-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.training-timer-bar.timer-expired {
  animation: timerExpiredPulse 0.8s ease-in-out infinite;
  border-color: rgba(239, 68, 68, 0.72);
}

@keyframes timerExpiredPulse {
  0%,
  100% {
    background: var(--surface);
  }

  50% {
    background: rgba(239, 68, 68, 0.26);
  }
}

.timer-segment {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.timer-segment > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timer-segment strong {
  margin-left: auto;
  min-width: 64px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.rest-segment {
  justify-content: flex-start;
}

.timer-duration {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: none;
}

.timer-duration input {
  width: 76px;
  min-height: 30px;
  padding: 0 7px;
  text-align: center;
}

.timer-chips {
  display: flex;
  flex: 1 0 100%;
  gap: 7px;
  min-width: 0;
}

.timer-button,
.timer-chip {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.timer-button.timer-start {
  background: linear-gradient(180deg, #32a96d, #218554);
  color: #ffffff;
}

.timer-button.timer-start:hover {
  background: linear-gradient(180deg, #218554, #17663f);
}

.timer-button.timer-pause,
.timer-button.timer-stop {
  background: linear-gradient(180deg, #df5862, var(--danger));
  color: #ffffff;
}

.timer-button.timer-pause:hover,
.timer-button.timer-stop:hover {
  background: linear-gradient(180deg, var(--danger), #9f2f3a);
}

.timer-button.timer-reset {
  border-color: #d59b16;
  background: linear-gradient(180deg, #f7c84b, #dfa51f);
  color: #211704;
}

.timer-button.timer-reset:hover {
  border-color: #bd8210;
  background: linear-gradient(180deg, #eeb632, #cb8e13);
}

.timer-chip {
  min-width: 58px;
  padding-inline: 7px;
  white-space: nowrap;
}

.last-value-title {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.last-value-text {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.last-session-date {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.last-set-list {
  display: grid;
  gap: 4px;
}

.last-set-list strong {
  color: var(--accent-strong);
}

.training-suggestions {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(229, 183, 85, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--gold-soft), var(--surface-soft));
}

.training-suggestions.hidden {
  display: none;
}

.training-suggestions-text {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.training-suggestions-text div {
  display: grid;
  gap: 2px;
}

.training-suggestions-text strong {
  color: var(--accent-strong);
}

.training-suggestions-text span {
  color: var(--muted);
}

.ai-inline-suggestion {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(20, 184, 166, 0.28);
}

.ai-inline-suggestion > strong {
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.ai-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.ai-form label {
  min-width: 0;
}

.ai-form textarea,
.ai-form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.ai-form textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.45;
}

.ai-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-mode-toggle button {
  min-height: 40px;
}

.ai-mode-toggle button.active {
  color: var(--on-accent);
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  box-shadow: 0 10px 22px rgba(20, 184, 166, 0.18);
}

.ai-result {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent-soft), var(--surface-soft));
}

.ai-result-meta {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-result-text {
  display: grid;
  gap: 10px;
  color: var(--ink);
  line-height: 1.55;
}

.ai-result-text h2,
.ai-result-text h3 {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.ai-result-text h2:first-child,
.ai-result-text h3:first-child {
  margin-top: 0;
}

.ai-result-text p {
  margin: 0;
}

.ai-result-text ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.ai-result-text li::marker {
  color: var(--accent);
}

.ai-result-text strong {
  color: var(--accent-strong);
}

.ai-result-text em {
  color: var(--muted);
  font-style: normal;
}

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

.ai-plan-list h3 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.ai-plan-table-wrap {
  margin-top: 2px;
}

.ai-plan-table {
  min-width: 560px;
}

.ai-plan-table th,
.ai-plan-table td {
  white-space: normal;
}

.ai-plan-table td:last-child,
.ai-plan-table th:last-child {
  text-align: left;
}

.ai-plan-table td strong {
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-actions .entry-save-button {
  width: auto;
  min-width: 0;
}

.form-actions .entry-save-button.save-success,
.form-actions .entry-save-button.save-success:hover {
  border-color: #168347;
  background: #1f9d55;
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(31, 157, 85, 0.28);
}

#entryMessage:empty {
  display: none;
}

.entry-input-groups {
  display: grid;
  grid-template-columns: 129px minmax(0, 1fr);
  gap: 13px;
  min-width: 0;
}

.entry-identifiers,
.entry-performance-fields {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.entry-identifiers {
  grid-template-columns: repeat(2, 58px);
}

.entry-performance-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-input-groups .entry-line {
  grid-column: auto;
  min-width: 0;
}

@media (max-width: 720px) {
  .form-actions .entry-save-button {
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    padding: 0 14px;
    font-size: 1rem;
    box-shadow: 0 7px 16px rgba(15, 118, 110, 0.2);
  }
}

/* V2-style application navigation */
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
}

.app-brand-mark svg,
.page-nav svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-brand strong {
  color: var(--ink);
  font-size: 1.15rem;
  white-space: nowrap;
}

.mobile-more-nav {
  display: none;
}

@media (min-width: 761px) {
  body.show-app {
    --desktop-nav-width: 220px;
  }

  body.show-app .topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: calc(100% - var(--desktop-nav-width));
    min-height: 76px;
    margin-left: var(--desktop-nav-width);
    padding: 14px clamp(18px, 3vw, 38px);
    border-bottom: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(16px);
  }

  body.show-app .app-brand {
    position: fixed;
    z-index: 32;
    top: 0;
    left: 0;
    width: var(--desktop-nav-width);
    height: 76px;
    padding: 0 18px;
    border-right: 1px solid var(--line-soft);
    background: var(--surface-strong);
  }

  body.show-app .page-nav {
    position: fixed;
    z-index: 30;
    inset: 76px auto 0 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    width: var(--desktop-nav-width);
    padding: 12px 12px 24px;
    overflow-y: auto;
    border-right: 1px solid var(--line-soft);
    background: var(--surface-strong);
  }

  body.show-app .page-nav > .nav-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: left;
  }

  body.show-app .page-nav > .nav-tab:hover {
    background: var(--surface-soft);
    color: var(--ink);
  }

  body.show-app .page-nav > .nav-tab.active,
  body.show-app .page-nav > .nav-tab.active:hover {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: inset 3px 0 var(--accent);
  }

  body.show-app .app-shell {
    width: calc(100% - var(--desktop-nav-width));
    margin-left: var(--desktop-nav-width);
    padding-top: 24px;
  }
}

@media (max-width: 760px) {
  body.show-app {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  body.show-app .topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    grid-template-columns: none;
    align-items: center;
    width: 100%;
    min-height: 66px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(16px);
  }

  body.show-app .app-brand {
    position: static;
    margin-right: auto;
  }

  body.show-app .app-brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  body.show-app .app-brand-mark svg {
    width: 19px;
    height: 19px;
  }

  body.show-app .app-brand strong {
    font-size: 1rem;
  }

  body.show-app .top-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  body.show-app .user-badge {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.show-app .page-nav {
    position: fixed;
    z-index: 60;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    height: calc(70px + env(safe-area-inset-bottom));
    padding: 6px max(4px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    overflow: visible;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(18px);
  }

  body.show-app .page-nav > .nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    padding: 3px 1px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 0.62rem;
    line-height: 1;
  }

  body.show-app .page-nav > .nav-tab:nth-of-type(n + 4) {
    display: none;
  }

  body.show-app .page-nav > .nav-tab:hover {
    background: transparent;
  }

  body.show-app .page-nav > .nav-tab.active {
    background: transparent;
    color: var(--accent);
    border-color: transparent;
  }

  body.show-app .page-nav svg {
    width: 20px;
    height: 20px;
  }

  body.show-app .mobile-more-nav {
    position: relative;
    display: block;
    min-width: 0;
  }

  body.show-app .mobile-more-nav summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 54px;
    padding: 3px 1px;
    border-radius: 5px;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    list-style: none;
  }

  body.show-app .mobile-more-nav summary::-webkit-details-marker {
    display: none;
  }

  body.show-app .mobile-more-nav.active summary,
  body.show-app .mobile-more-nav[open] summary {
    color: var(--accent);
  }

  body.show-app .mobile-more-menu {
    position: absolute;
    right: 6px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    display: grid;
    gap: 5px;
    width: min(250px, calc(100vw - 20px));
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
  }

  body.show-app .mobile-more-menu button {
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink);
    text-align: left;
  }

  body.show-app .mobile-more-menu button.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  body.show-app .app-shell {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 390px) {
  body.show-app .user-badge {
    display: none;
  }
}

@media (max-width: 520px) {
  .training-entry .entry-input-groups {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .training-entry .entry-identifiers {
    grid-template-columns: repeat(2, 48px);
    gap: 8px;
  }

  .training-entry .entry-performance-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .training-entry .entry-number-line,
  .training-entry .entry-set-line,
  .training-entry .entry-number-line input,
  .training-entry .entry-set-line input {
    width: 48px;
    max-width: 48px;
  }

  .training-entry .entry-value-line input {
    min-height: 46px;
    font-size: 0.82rem;
    padding-inline: 8px;
  }

  .training-entry .entry-value-line input::placeholder {
    font-size: 0.68rem;
  }
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--accent);
}

.chart-panel {
  min-width: 0;
}

.mini-chart {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mini-chart > div {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

.mini-chart h3 {
  margin: 0;
  font-size: 0.94rem;
}

.mini-chart span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

canvas {
  width: 100%;
  height: 300px;
  display: block;
  background: linear-gradient(180deg, var(--canvas-bg), var(--canvas-bg-strong));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-heading {
  align-items: end;
}

.table-heading > div {
  display: grid;
  gap: 5px;
}

.table-heading input {
  max-width: 260px;
}

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

.table-actions input {
  min-width: min(260px, 48vw);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: var(--surface);
}

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

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td:last-child,
th:last-child {
  text-align: right;
}

.row-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.edit-row,
.delete-row {
  min-height: 30px;
  padding: 0 10px;
}

.edit-row {
  background: var(--surface-soft);
  color: var(--accent);
  border: 1px solid rgba(20, 184, 166, 0.28);
}

.delete-row {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-line);
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 26px;
}

@media (max-width: 1200px) {
  .training-entry .entry-form {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .training-entry .entry-form label,
  .training-entry .entry-form .wide {
    grid-column: 1 / -1;
  }

  .training-entry .entry-form > label:not(.wide):not(.entry-line) {
    grid-column: span 3;
  }

  .training-entry .entry-form .entry-line {
    grid-column: span 2;
  }

  .training-entry .entry-form .entry-number-line,
  .training-entry .entry-form .entry-set-line {
    grid-column: span 1;
  }
}

/* Training follows the same responsive panel model as Cardio. This rule stays last
   so older form-specific breakpoints cannot make only this page wider than the viewport. */
.page[data-page="training"] {
  min-width: 0;
  max-width: 100%;
}

.training-entry {
  width: auto !important;
  max-width: 760px !important;
  min-width: 0 !important;
}

/* Final iPhone override: this must remain after all responsive form rules. */
html.phone-layout,
html.phone-layout body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html.phone-layout .page[data-page="training"],
html.phone-layout .training-entry {
  width: 100%;
  max-width: none;
  min-width: 0;
}

html.phone-layout .training-entry .entry-form {
  grid-template-columns: 1fr;
  min-width: 0;
}

html.phone-layout .training-entry .entry-form > label,
html.phone-layout .training-entry .entry-form > .wide {
  grid-column: 1 / -1;
}

html.phone-layout .training-entry .entry-form .entry-input-groups {
  grid-template-columns: 1fr;
  min-width: 0;
}

html.phone-layout .training-entry .entry-form .entry-identifiers {
  grid-template-columns: repeat(2, 58px);
  gap: 10px;
}

html.phone-layout .training-entry .entry-form .entry-performance-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

html.phone-layout .training-entry .entry-form .entry-line {
  grid-column: auto;
}

html.phone-layout .training-timer-bar,
html.phone-layout .last-value-box,
html.phone-layout .last-set-table-wrap,
html.phone-layout .last-set-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* iOS can report a desktop viewport when a browser requests the desktop site. */
@media (hover: none), (max-device-width: 480px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .page[data-page="training"],
  .training-entry {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .training-entry .entry-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .training-entry .entry-form > label,
  .training-entry .entry-form > .wide {
    grid-column: 1 / -1;
  }

  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .training-entry .entry-form .entry-identifiers {
    grid-template-columns: repeat(2, 58px);
  }

  .training-entry .entry-form .entry-performance-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-entry .entry-form .entry-line {
    grid-column: auto;
  }

  .training-timer-bar,
  .last-value-box,
  .last-set-table-wrap,
  .last-set-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .training-status-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .management-grid,
  .filter-grid,
  .entry-form,
  .ai-form,
  .measurement-grid,
  .profile-layout,
  .work-area {
    grid-template-columns: 1fr;
  }

  .entry-form label,
  .entry-form .wide,
  .ai-form label,
  .ai-form .wide {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .entry-form input,
  .entry-form select,
  .ai-form textarea,
  .ai-form select {
    min-width: 0;
  }

}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(180deg, var(--body-mobile-start) 0%, var(--bg) 100%),
      var(--bg);
  }

  button,
  input,
  select,
  textarea {
    min-height: 46px;
    font-size: 16px;
  }

  .topbar,
  .management-grid,
  .filter-grid,
  .user-form-grid,
  .profile-grid,
  .measurement-grid,
  .entry-form,
  .ai-form {
    grid-template-columns: 1fr;
  }

  .cardio-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cardio-form input,
  .cardio-form select,
  .cardio-form button {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
  }

  .cardio-form input,
  .cardio-form select,
  .cardio-form input[type="date"]::-webkit-date-and-time-value,
  .cardio-form input[type="date"]::-webkit-datetime-edit {
    min-height: 46px;
    line-height: 46px;
  }

  .cardio-actions,
  .cardio-form .form-message {
    grid-column: 1 / -1;
  }

  .cardio-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cardio-actions > button {
    width: 100%;
  }

  .cardio-table {
    min-width: 0;
  }

  .cardio-row {
    grid-template-columns: 52px minmax(62px, 1fr) 28px 40px 32px 32px 56px;
    gap: 4px;
    min-height: 44px;
    padding: 6px;
    font-size: 0.72rem;
  }

  .cardio-head {
    min-height: 30px;
    font-size: 0.56rem;
  }

  .cardio-row-actions .icon-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
  }

  .topbar {
    display: grid;
    gap: 14px;
    padding: 20px 14px 14px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .top-actions,
  .form-actions {
    justify-content: stretch;
  }

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

  .user-row {
    grid-template-columns: 1fr;
  }

  .measurement-row {
    grid-template-columns: 1fr;
  }

  .measurement-actions {
    justify-content: stretch;
  }

  .measurement-actions button {
    flex: 1 1 120px;
  }

  .group-dashboard-card {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .group-volume-chart {
    min-height: 320px;
    padding: 10px;
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .group-volume-bars {
    min-height: 260px;
    gap: 10px;
    padding-top: 8px;
  }

  .group-volume-month {
    flex-basis: 98px;
    min-width: 92px;
    grid-template-rows: minmax(200px, 1fr) 22px;
  }

  .group-volume-month-bars {
    min-height: 200px;
    gap: 4px;
  }

  .group-volume-member-bar {
    min-width: 16px;
  }

  .group-volume-month > span {
    font-size: 0.6rem;
  }

  .group-dashboard-rank {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
  }

  .group-dashboard-metrics {
    gap: 5px;
  }

  .group-dashboard-metrics span {
    font-size: 0.68rem;
    padding: 4px 6px;
  }

  .dashboard-bar-row {
    grid-template-columns: 42px minmax(0, 1fr) 24px;
    gap: 6px;
    font-size: 0.66rem;
  }

  .user-actions {
    justify-content: stretch;
  }

  .user-actions button {
    flex: 1;
  }

  .nav-tab {
    min-height: 34px;
    padding: 0 5px;
    font-size: 0.72rem;
  }

  .app-shell {
    gap: 14px;
    overflow-x: hidden;
    padding: 0 12px 24px;
  }

  .page.active,
  .management-grid,
  .filter-grid,
  .work-area {
    gap: 14px;
  }

  .panel {
    padding: 14px;
  }

  .panel {
    box-shadow: 0 10px 28px rgba(22, 33, 31, 0.08);
  }

  .person-list,
  .exercise-list {
    display: flex;
    gap: 8px;
    margin: 0 -14px 14px;
    overflow-x: auto;
    padding: 0 14px 6px;
    scroll-snap-type: x proximity;
  }

  .person-chip,
  .exercise-chip {
    flex: 0 0 auto;
    min-width: 138px;
    width: auto;
    scroll-snap-align: start;
  }

  .exercise-admin-row {
    flex: 0 0 auto;
    min-width: 180px;
    scroll-snap-align: start;
  }

  .exercise-admin-row .exercise-chip {
    width: 100%;
  }

  .exercise-list {
    max-height: none;
  }

  .inline-controls {
    grid-template-columns: 1fr 48px;
  }

  .entry-form,
  .training-entry .entry-form {
    gap: 8px;
    grid-template-columns: 42px 42px minmax(78px, 1fr) minmax(78px, 1fr);
  }

  .entry-form label,
  .entry-form .wide,
  .training-entry .entry-form label,
  .training-entry .entry-form .wide {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .entry-form .entry-line,
  .training-entry .entry-form .entry-line {
    grid-column: span 1;
    gap: 5px;
    font-size: 0.72rem;
  }

  .entry-form .entry-value-line,
  .training-entry .entry-form .entry-value-line {
    width: auto;
    max-width: none;
  }

  .entry-form .entry-number-line,
  .entry-form .entry-set-line,
  .training-entry .entry-form .entry-number-line,
  .training-entry .entry-form .entry-set-line {
    width: 42px;
    max-width: 42px;
  }

  .entry-form .entry-number-line input,
  .entry-form .entry-set-line input,
  .training-entry .entry-form .entry-number-line input,
  .training-entry .entry-form .entry-set-line input {
    max-width: 42px;
    padding-inline: 4px;
    font-size: 0.78rem;
  }

  .entry-form .entry-value-line input,
  .training-entry .entry-form .entry-value-line input {
    font-size: 0.66rem;
    padding-inline: 4px;
    text-align: left;
  }

  .entry-form .entry-value-line input::placeholder,
  .training-entry .entry-form .entry-value-line input::placeholder {
    font-size: 0.58rem;
  }

  .entry-form .difficulty-options,
  .training-entry .entry-form .difficulty-options {
    display: flex;
    gap: 5px;
  }

  .entry-form .difficulty-options label,
  .training-entry .entry-form .difficulty-options label {
    flex: 1 1 0;
    width: auto;
    max-width: none;
    min-height: 34px;
    padding: 4px 2px;
  }

  .entry-form .difficulty-options span,
  .training-entry .entry-form .difficulty-options span {
    font-size: 1.08rem;
  }

  .entry-form input,
  .entry-form select {
    min-width: 0;
  }

  .entry-form .entry-line input {
    padding-inline: 7px;
    text-align: center;
  }

  .training-timer-bar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 7px;
  }

  .timer-segment,
  .rest-segment {
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
  }

  .timer-button,
  .timer-chip {
    min-width: 0;
    min-height: 34px;
    padding-inline: 8px;
    font-size: 0.76rem;
  }

  .timer-segment strong {
    min-width: 62px;
    font-size: 0.95rem;
  }

  .timer-duration {
    flex: 0 0 auto;
  }

  .timer-duration input {
    width: 72px;
    padding-inline: 6px;
  }

  .timer-segment > span {
    flex: 0 0 auto;
    min-width: 48px;
  }

  .timer-button {
    flex: 0 0 auto;
  }

  .timer-chip {
    flex: 0 0 58px;
    padding-inline: 0;
  }

  .last-value-box {
    padding: 12px;
  }

  .timer-chips {
    display: flex;
    flex: 1 0 100%;
    gap: 6px;
    min-width: 0;
  }

  .calendar-heading {
    display: grid;
    align-items: stretch;
  }

  .calendar-controls {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
  }

  .calendar-controls strong {
    min-width: 0;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 5px;
  }

  .calendar-day,
  .calendar-day.empty {
    min-height: 58px;
    padding: 7px;
  }

  .calendar-day strong {
    font-size: 1rem;
  }

  .calendar-activity-label {
    display: none;
  }

  canvas {
    height: 260px;
  }

  .table-heading {
    display: grid;
    align-items: stretch;
  }

  .table-heading input,
  .table-actions input {
    max-width: none;
    min-width: 0;
  }

  .table-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  .history-pivot-wrap {
    overflow-x: hidden;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .ai-plan-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .ai-plan-table {
    min-width: 0;
    width: 100%;
  }

  .history-pivot-table {
    display: table;
    table-layout: fixed;
    min-width: 0;
    width: 100%;
    background: var(--surface);
  }

  .history-pivot-table thead {
    display: table-header-group;
  }

  .history-pivot-table tbody {
    display: table-row-group;
  }

  .history-pivot-table tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }

  .history-pivot-table th,
  .history-pivot-table td {
    display: table-cell;
    padding: 7px 5px;
    border-bottom: 1px solid var(--line);
    font-size: 0.72rem;
    vertical-align: top;
  }

  .history-pivot-table th:first-child,
  .history-pivot-table td:first-child {
    width: 42%;
  }

  .history-pivot-table th:not(:first-child),
  .history-pivot-table td:not(:first-child) {
    width: 19.33%;
    text-align: center;
  }

  .history-pivot-table td::before {
    content: none;
    display: none;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  table {
    min-width: 0;
    background: transparent;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 10px;
  }

  td {
    display: grid;
    grid-template-columns: minmax(88px, 38%) 1fr;
    gap: 10px;
    padding: 7px 2px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    text-align: left;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  td:last-child {
    border-bottom: 0;
    text-align: left;
  }

  td:last-child::before {
    content: "";
  }

  .history-pivot-table td:first-child {
    width: auto;
  }

  .history-pivot-table td:last-child::before {
    content: attr(data-label);
  }

  .history-pivot-table td {
    grid-template-columns: minmax(64px, 30%) minmax(0, 1fr);
  }

  .history-pivot-table td[data-label="Übung"] {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .history-pivot-table td[data-label="Übung"]::before {
    content: "";
    display: none;
  }

  .history-pivot-table td[data-label="Übung"] strong {
    font-size: 1rem;
  }

  .row-actions {
    display: grid;
    width: 100%;
  }

  .edit-row,
  .delete-row {
    width: 100%;
  }

  .top-actions button:not(.icon-button),
  .form-actions button {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px;
    align-items: center;
    justify-content: stretch;
  }

  .top-actions .user-badge,
  .top-actions .icon-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    box-sizing: border-box;
  }

  .top-actions .user-badge {
    width: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 430px) {
  .cardio-form {
    grid-template-columns: 1fr;
  }

  .cardio-actions,
  .cardio-form .form-message {
    grid-column: 1 / -1;
  }

  .history-pivot-table tr {
    padding: 9px;
  }

  .history-pivot-table td {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 7px 0;
  }

  .history-pivot-table td::before {
    font-size: 0.72rem;
  }

  .set-value {
    gap: 1px;
  }
}

@media (max-width: 820px) {
  .history-pivot-wrap {
    overflow-x: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .history-pivot-table {
    display: table;
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    background: var(--surface);
  }

  .history-pivot-table thead {
    display: table-header-group;
  }

  .history-pivot-table tbody {
    display: table-row-group;
  }

  .history-pivot-table tr {
    display: table-row;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .history-pivot-table th,
  .history-pivot-table td {
    display: table-cell;
    grid-template-columns: none;
    gap: 0;
    padding: 7px 5px;
    border-bottom: 1px solid var(--line);
    font-size: 0.72rem;
    line-height: 1.25;
    vertical-align: top;
  }

  .history-pivot-table th:first-child,
  .history-pivot-table td:first-child,
  .history-pivot-table td[data-label="Übung"] {
    width: 42%;
    min-width: 0;
    color: var(--ink);
    text-align: left;
  }

  .history-pivot-table th:not(:first-child),
  .history-pivot-table td:not(:first-child) {
    width: 19.33%;
    text-align: center;
  }

  .history-pivot-table td::before,
  .history-pivot-table td[data-label="Übung"]::before {
    content: none;
    display: none;
  }

  .history-pivot-table td[data-label="Übung"] strong {
    font-size: 0.78rem;
    line-height: 1.25;
  }

.set-value {
  display: inline;
  font-size: 0.7rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}
}

/* Keep the grouped entry fields independent from the older form grid rules. */
.training-entry .entry-input-groups .entry-line {
  grid-column: auto;
}

@media (max-width: 520px) {
  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .training-entry .entry-form .entry-identifiers {
    grid-template-columns: repeat(2, 48px);
    gap: 8px;
  }

  .training-entry .entry-form .entry-performance-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .training-entry .entry-form .entry-number-line,
  .training-entry .entry-form .entry-set-line,
  .training-entry .entry-form .entry-number-line input,
  .training-entry .entry-form .entry-set-line input {
    width: 48px;
    max-width: 48px;
  }

  .training-entry .entry-form .entry-value-line input {
    min-height: 46px;
    font-size: 0.82rem;
    padding-inline: 8px;
  }

  .training-entry .entry-form .entry-value-line input::placeholder {
    font-size: 0.68rem;
  }
}

/* Some iOS browsers expose a desktop-like viewport width on phones. Keep touch layouts usable there. */
@media (max-width: 1200px) and (pointer: coarse) {
  .topbar {
    display: grid;
    gap: 14px;
    padding: 20px 14px 14px;
  }

  .page-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }

  .nav-tab {
    min-height: 40px;
    padding-inline: 6px;
  }

  .app-shell {
    padding: 0 12px 24px;
  }

  .page.active,
  .training-entry {
    width: 100%;
  }

  .training-entry {
    max-width: none;
  }

  .training-entry .entry-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .training-entry .entry-form > label,
  .training-entry .entry-form > .wide {
    grid-column: 1 / -1;
  }

  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .training-entry .entry-form .entry-identifiers {
    grid-template-columns: repeat(2, 58px);
    gap: 10px;
  }

  .training-entry .entry-form .entry-performance-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .training-entry .entry-form .entry-line {
    grid-column: auto;
  }

  .training-entry .entry-form .entry-number-line,
  .training-entry .entry-form .entry-set-line,
  .training-entry .entry-form .entry-number-line input,
  .training-entry .entry-form .entry-set-line input {
    width: 58px;
    max-width: 58px;
  }

  .training-timer-bar {
    padding: 8px;
  }

  .timer-chips {
    display: flex;
    flex: 1 0 100%;
    gap: 6px;
  }
}

/* The training form must use the full available width, even in browsers with a desktop-sized phone viewport. */
@media (max-width: 1200px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .page[data-page="training"],
  .training-entry {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .training-entry .entry-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .training-entry .entry-form > label,
  .training-entry .entry-form > .wide {
    grid-column: 1 / -1;
  }

  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .training-entry .entry-form .entry-identifiers {
    grid-template-columns: repeat(2, 58px);
  }

  .training-entry .entry-form .entry-performance-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-entry .entry-form .entry-line {
    grid-column: auto;
  }

  .training-timer-bar,
  .last-value-box,
  .last-set-table-wrap,
  .last-set-grid {
    max-width: 100%;
    min-width: 0;
  }
}

/* iOS zooms the entire page when a focused form control uses text below 16px.
   Training had smaller value fields than Cardio, which caused the empty area on the right. */
@media (hover: none) and (pointer: coarse) {
  .training-entry input,
  .training-entry select {
    font-size: 16px !important;
  }
}

/* Keep all four set inputs in one row. The wrapper elements only group the
   markup; the outer grid controls their shared alignment. */
.training-entry .entry-form .entry-input-groups {
  grid-template-columns: 58px 58px repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.training-entry .entry-identifiers,
.training-entry .entry-performance-fields {
  display: contents;
}

.training-entry .entry-input-groups .entry-line {
  grid-column: auto !important;
}

@media (max-width: 720px) {
  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 40px 40px repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .training-entry .entry-number-line,
  .training-entry .entry-set-line,
  .training-entry .entry-number-line input,
  .training-entry .entry-set-line input {
    width: 40px !important;
    max-width: 40px !important;
  }
}

/* Compact pause timer with presets, main action and editable countdown. */
.training-timer-bar .rest-segment {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(104px, 140px) minmax(110px, 150px);
  grid-template-rows: minmax(64px, auto);
  gap: 7px;
  align-items: stretch;
  width: 100%;
}

.training-timer-bar .rest-segment > .timer-main-action {
  grid-column: 2;
  grid-row: 1;
  min-height: 64px;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 950;
}

.training-timer-bar .rest-segment > #restTimerDisplay {
  grid-column: 3;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  margin-left: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font-size: 1.9rem;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.training-timer-bar .rest-segment > #restTimerDisplay[readonly] {
  cursor: default;
  color: var(--ink);
}

.training-timer-bar .rest-segment > .timer-chips {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
}

.training-timer-bar .rest-segment .timer-chip {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding-inline: 9px;
}

@media (max-width: 720px) {
  .training-timer-bar .rest-segment {
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: 34px 58px;
    gap: 6px;
  }

  .training-timer-bar .rest-segment > .timer-main-action {
    grid-column: 1;
    grid-row: 2;
    min-height: 58px;
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    padding-inline: 6px;
    font-size: 0.82rem;
  }

  .training-timer-bar .rest-segment > #restTimerDisplay {
    grid-column: 2;
    grid-row: 2;
    min-height: 58px;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
    padding-inline: 4px;
    font-size: 1.3rem;
  }

  .training-timer-bar .rest-segment > .timer-chips {
    grid-column: 1 / 3;
    grid-row: 1;
    gap: 5px;
    justify-content: stretch;
  }

  .training-timer-bar .rest-segment .timer-chip {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 7px;
    font-size: 0.7rem;
  }
}

/* Tablet layout: Training uses the same available page width as the navigation. */
@media (min-width: 721px) and (max-width: 1200px) and (pointer: coarse) {
  .page-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-tab {
    min-height: 34px;
    padding-inline: 8px;
    font-size: 0.72rem;
  }

  .page.active,
  .page.active > .panel,
  .page.active > .profile-layout,
  .page.active > .management-grid,
  .cardio-panel,
  .cardio-history-panel,
  .group-dashboard-panel,
  .calendar-panel,
  .history-day-panel,
  .filters-panel,
  .ai-panel {
    width: 100% !important;
    max-width: none !important;
  }

  .page[data-page="training"],
  .training-entry {
    width: 100% !important;
    max-width: none !important;
  }

  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 58px 58px repeat(2, minmax(0, 1fr));
    gap: 13px;
  }

  .training-entry .entry-identifiers,
  .training-entry .entry-performance-fields {
    display: contents;
  }

  .training-entry .form-actions,
  .training-entry .entry-save-button {
    width: 100%;
  }

  .training-entry .entry-save-button {
    min-height: 44px;
  }
}

@media (max-width: 720px) {
  .group-dashboard-metrics {
    gap: 0;
  }

  .group-dashboard-metrics span {
    padding: 6px 6px 0 0;
  }

  .group-dashboard-metrics span + span {
    padding-left: 6px;
  }

  .cardio-activity-form-grid {
    grid-template-columns: 1fr;
  }

  .cardio-activity-form-grid > button {
    width: 100%;
  }

  .exercise-form-grid {
    grid-template-columns: 1fr;
  }

  .exercise-category-options,
  .exercise-form-actions {
    grid-column: auto;
  }

  .exercise-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .exercise-form-actions button {
    width: 100%;
  }

  .dashboard-member-detail {
    padding: 10px;
  }

  .dashboard-exercise-row {
    grid-template-columns: minmax(82px, 1fr) 92px;
    gap: 4px;
    padding: 6px;
    font-size: 0.7rem;
  }

  .dashboard-exercise-row strong {
    display: grid;
    gap: 1px;
  }

  .dashboard-exercise-row strong small {
    font-size: 0.55rem;
  }
}

/* Final navigation precedence over legacy tablet and iOS layout rules. */
@media (min-width: 761px) {
  body.show-app .topbar {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    width: calc(100% - var(--desktop-nav-width));
    min-height: 76px;
    margin-left: var(--desktop-nav-width);
    padding: 14px clamp(18px, 3vw, 38px);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--bg);
  }

  body.show-app .page-nav {
    display: flex;
    grid-template-columns: none;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    width: var(--desktop-nav-width);
    padding: 12px 12px 24px;
  }

  body.show-app .page-nav > .nav-tab {
    display: flex;
    min-height: 46px;
    padding: 0 13px;
    font-size: 0.86rem;
  }

  body.show-app .app-shell {
    width: calc(100% - var(--desktop-nav-width));
    margin-left: var(--desktop-nav-width);
    padding: 24px clamp(16px, 3vw, 42px) 38px;
  }
}

@media (max-width: 760px) {
  body.show-app .topbar {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 66px;
    margin-left: 0;
    padding: 10px 12px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--bg);
  }

  body.show-app .top-actions {
    justify-content: flex-end;
  }

  body.show-app .page-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    padding: 6px max(4px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  }

  body.show-app .page-nav > .nav-tab {
    min-height: 54px;
    padding: 3px 1px;
    font-size: 0.62rem;
  }

  body.show-app .page-nav > .nav-tab:nth-of-type(n + 4) {
    display: none;
  }

  body.show-app .app-shell {
    width: 100%;
    margin-left: 0;
    padding: 18px 12px 24px;
  }
}

/* Final precedence for the number-in-exercise layout. */
.training-entry .entry-form .entry-input-groups {
  grid-template-columns: 58px repeat(2, minmax(0, 1fr));
}

.training-entry .entry-form .entry-input-groups.editing-number {
  grid-template-columns: 58px 58px repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .training-entry .entry-form .entry-input-groups {
    grid-template-columns: 40px repeat(2, minmax(0, 1fr));
  }

  .training-entry .entry-form .entry-input-groups.editing-number {
    grid-template-columns: 40px 40px repeat(2, minmax(0, 1fr));
  }
}

/* Align the mobile timer controls to the same three-column rhythm. */
@media (max-width: 720px) {
  .training-timer-bar .rest-segment {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 34px 58px;
    gap: 6px;
  }

  .training-timer-bar .rest-segment > .timer-chips {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .training-timer-bar .rest-segment .timer-chip {
    width: 100%;
    min-width: 0;
  }

  .training-timer-bar .rest-segment > .timer-main-action {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .training-timer-bar .rest-segment > #restTimerDisplay {
    grid-column: 2 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}
