:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #121722;
  --muted: #5e6778;
  --line: #d4dae5;
  --blue: #1c5de7;
  --blue-deep: #1647af;
  --red: #d82342;
  --red-deep: #ad1830;
  --green: #147b68;
  --warning: #a55318;
  --shadow: 0 12px 28px rgba(18, 23, 34, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

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

body {
  background:
    linear-gradient(135deg, rgba(216, 35, 66, 0.08), transparent 18rem),
    linear-gradient(225deg, rgba(28, 93, 231, 0.1), transparent 24rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.42;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

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

button,
.button {
  align-items: center;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 0.35rem;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  transition: background 120ms ease, border 120ms ease, color 120ms ease, transform 120ms ease;
}

button:hover,
.button:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
}

button:active,
.button:active {
  transform: translateY(1px);
}

button.blue,
.button.blue {
  background: var(--blue);
  border-color: var(--blue);
}

button.blue:hover,
.button.blue:hover {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

button.ghost,
.button.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

button.ghost:hover,
.button.ghost:hover {
  background: var(--surface-2);
  border-color: #aeb8ca;
}

#dashboard [data-quick-log="Legs"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

#dashboard [data-quick-log="Legs"]:hover {
  background: #090c12;
  border-color: #090c12;
}

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

button.danger:not(.ghost) {
  color: #fff;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #bcc6d7;
  border-radius: 7px;
  color: var(--ink);
  max-width: 100%;
  min-height: 2.6rem;
  padding: 0.58rem 0.68rem;
  width: 100%;
}

input[type="search"]::-webkit-search-cancel-button {
  appearance: none;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(28, 93, 231, 0.25);
  outline-offset: 1px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 0.35rem;
}

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

h1 {
  font-size: clamp(1.55rem, 1.55rem, 1.55rem);
  line-height: 1.12;
  margin-bottom: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.22;
  margin-bottom: 0;
}

h3 {
  font-size: 0.98rem;
  margin-bottom: 0;
}

small {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  margin-top: 0.1rem;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  color: var(--blue-deep);
  font-size: 0.76rem;
  font-weight: 900;
  margin-bottom: 0.18rem;
  text-transform: uppercase;
}

.brand-logo {
  background: #fff;
  border-radius: 7px;
  display: block;
  object-fit: contain;
}

.login-logo {
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(18, 23, 34, 0.08);
  height: auto;
  width: min(10rem, 42vw);
}

.header-logo {
  border: 1px solid rgba(255, 255, 255, 0.16);
  height: 3.1rem;
  width: 3.1rem;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 1rem;
  place-items: center;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
  max-width: 24rem;
  padding: 1.5rem;
  width: 100%;
}

.login-panel h1 {
  margin-bottom: 0.2rem;
}

.login-error,
.notice.error {
  background: #fff0f2;
  border: 1px solid #efb5c0;
  border-radius: 8px;
  color: var(--red-deep);
  margin: 0;
  padding: 0.8rem;
}

.topbar {
  align-items: center;
  background: rgba(18, 23, 34, 0.96);
  color: #fff;
  display: flex;
  gap: 1rem;
  height: 4.35rem;
  justify-content: space-between;
  left: 0;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  color: #fff;
  display: inline-flex;
  flex: 1 1 auto;
  gap: 0.72rem;
  min-width: 0;
  text-decoration: none;
}

.brand strong {
  overflow-wrap: anywhere;
}

.top-actions,
.button-row,
.row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
}

.logout-link {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  color: #fff;
  font-weight: 800;
  min-height: 2.35rem;
  padding: 0.48rem 0.72rem;
  text-decoration: none;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  min-height: calc(100vh - 4.35rem);
  min-width: 0;
}

.sidebar {
  align-content: space-between;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--line);
  display: grid;
  gap: 1rem;
  min-height: calc(100vh - 4.35rem);
  padding: 1rem;
  position: sticky;
  top: 4.35rem;
}

.nav-list {
  display: grid;
  gap: 0.28rem;
}

.nav-list a {
  border-radius: 7px;
  color: var(--ink);
  font-weight: 800;
  padding: 0.72rem 0.76rem;
  text-decoration: none;
}

.nav-list a.active {
  background: var(--blue);
  color: #fff;
}

.timezone-pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0;
  padding: 0.68rem;
}

.workspace {
  max-width: 100%;
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
}

.view {
  display: none;
  max-width: 100%;
  min-width: 0;
}

.view.active {
  display: block;
}

.view-head,
.section-head,
.dialog-head,
.draft-head {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  min-width: 0;
}

.view-head {
  margin-bottom: 1rem;
}

.section-head {
  margin-bottom: 0.72rem;
}

.section-head a {
  color: var(--blue-deep);
  font-weight: 800;
}

.head-search {
  min-width: min(17rem, 100%);
  width: auto;
}

.search-control {
  min-width: 0;
  position: relative;
}

.search-control input {
  padding-right: 2.8rem;
}

.search-clear {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  height: 2.1rem;
  min-height: 0;
  padding: 0.42rem;
  position: absolute;
  right: 0.28rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
}

.search-clear:hover {
  background: var(--surface-2);
  border: 0;
  color: var(--ink);
  transform: translateY(-50%);
}

.search-clear svg,
.icon-button svg {
  display: block;
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 100%;
}

.exercises-toolbar {
  align-items: center;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: minmax(11rem, 19rem) auto;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  width: 100%;
}

.library-tools {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-self: end;
}

.compact-button {
  min-height: 2.35rem;
  padding: 0.42rem 0.65rem;
}

.exercise-search-control {
  width: 100%;
}

.panel,
.history-card,
.draft-exercise,
.picker-panel,
.entry-panel,
.exercise-library,
.table-wrap {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
  min-width: 0;
}

.panel,
.picker-panel,
.entry-panel {
  padding: 1rem;
}

.dashboard-grid,
.records-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
  max-width: 100%;
  min-width: 0;
}

.dashboard-grid > *,
.records-grid > *,
.metric-grid > *,
.logger-grid > *,
.weight-layout > *,
.form-grid > * {
  min-width: 0;
}

.wide {
  grid-column: span 2;
}

.metric-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 100%;
  min-width: 0;
}

.metric-grid.compact {
  margin-bottom: 1rem;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  min-height: 5.35rem;
  overflow: hidden;
  padding: 0.8rem;
}

.metric:nth-child(2n) {
  border-left-color: var(--red);
}

.metric span {
  color: var(--ink);
  display: block;
  font-size: 1.28rem;
  font-weight: 950;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.metric p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0.25rem 0 0;
  text-transform: uppercase;
}

.latest-summary,
.summary-lines {
  display: grid;
  gap: 0.38rem;
}

.latest-summary p {
  color: var(--muted);
  margin-bottom: 0;
}

.summary-lines span {
  background: var(--surface-2);
  border-radius: 6px;
  overflow-wrap: anywhere;
  padding: 0.34rem 0.48rem;
}

.compact-list {
  display: grid;
  gap: 0.42rem;
}

.compact-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 7px;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  min-height: 2.75rem;
  min-width: 0;
  padding: 0.5rem 0.58rem;
}

.compact-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.compact-row span {
  color: var(--muted);
  text-align: right;
}

.chart-frame {
  align-items: center;
  display: grid;
  min-height: 13.5rem;
  overflow: hidden;
}

.chart-frame.tall {
  min-height: 16rem;
}

.chart-frame svg {
  display: block;
  height: auto;
  overflow: visible;
  width: 100%;
}

.chart-grid line {
  stroke: #d9dfe9;
  stroke-width: 1;
}

.chart-grid text,
.chart-label,
.chart-unit {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-line.blue,
.chart-dot.blue {
  stroke: var(--blue);
}

.chart-line.red,
.chart-dot.red {
  stroke: var(--red);
}

.chart-dot {
  fill: #fff;
  stroke-width: 3;
}

.type-bar {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0.8rem;
  min-width: 0;
}

.type-bar button {
  background: var(--surface);
  border-color: #b9c5da;
  color: var(--ink);
  font-size: 1rem;
  min-height: 4rem;
}

.type-bar button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 0.72rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.span-two {
  grid-column: span 2;
}

.workout-meta {
  align-items: end;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 8px;
  grid-template-columns: minmax(12rem, 16rem) minmax(9rem, 10.5rem) minmax(8rem, 9.5rem);
  justify-content: start;
  margin-bottom: 1rem;
  padding: 0.8rem;
}

.workout-meta .span-two {
  grid-column: auto;
}

.workout-notes {
  grid-column: 1 / 3;
  max-width: 32rem;
}

.workout-copy-action {
  align-self: end;
  justify-self: start;
}

.logger-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(16rem, 0.76fr) minmax(0, 1.35fr);
  min-width: 0;
}

.exercise-picker {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.72rem;
  max-height: 58rem;
  overflow: auto;
}

.pick-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  font-size: 0.92rem;
  font-weight: 700;
  gap: 0.56rem;
  grid-template-columns: 1.2rem minmax(0, 1fr);
  min-height: 3.25rem;
  padding: 0.55rem;
}

.pick-row:has(input:checked) {
  background: #e9f0ff;
  border-color: #a7c1fb;
}

.pick-row input {
  min-height: 1rem;
  padding: 0;
}

.pick-row small {
  overflow-wrap: anywhere;
}

.count-chip,
.chip,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 900;
  justify-content: center;
  line-height: 1.05;
  padding: 0.32rem 0.5rem;
  white-space: nowrap;
}

.count-chip {
  background: var(--blue);
  color: #fff;
  min-width: 1.75rem;
}

.chip {
  background: #e7efff;
  color: var(--blue-deep);
}

.muted-chip {
  background: #eceef2;
  color: var(--muted);
}

.workout-exercises {
  display: grid;
  gap: 0.8rem;
}

.draft-exercise {
  padding: 0.82rem;
}

.draft-head {
  align-items: start;
  margin-bottom: 0.62rem;
}

.draft-head p {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.12rem 0 0;
  overflow-wrap: anywhere;
}

.set-table {
  display: grid;
  gap: 0.38rem;
  min-width: 0;
}

.set-header,
.set-row {
  align-items: center;
  display: grid;
  gap: 0.38rem;
  grid-template-columns: minmax(4.4rem, 0.72fr) minmax(5.5rem, 0.82fr) minmax(4.3rem, 0.62fr) minmax(8.8rem, 1fr) minmax(8rem, 1.25fr) 2.6rem;
}

.time-duration-set-row,
.set-header:has(+ .time-duration-set-row) {
  grid-template-columns: minmax(5.5rem, 0.8fr) minmax(8.8rem, 1fr) minmax(8rem, 1.25fr) 2.6rem;
}

.set-header {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  min-height: 1.1rem;
  text-transform: uppercase;
}

.set-row input,
.set-row select {
  min-height: 2.35rem;
  min-width: 0;
  padding: 0.42rem 0.5rem;
}

.set-flags {
  align-items: center;
  display: grid;
  gap: 0.34rem;
  grid-template-columns: 1fr minmax(3.6rem, 0.7fr);
}

.set-flags label,
.check-field {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 0.78rem;
  gap: 0.28rem;
  white-space: nowrap;
}

.set-flags input[type="checkbox"],
.check-field input {
  min-height: 1rem;
  width: 1rem;
}

.draft-foot {
  align-items: end;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: auto 10rem minmax(8rem, 1fr);
  margin-top: 0.62rem;
}

.exercise-note {
  min-width: 0;
}

.save-workout {
  margin-top: 0.8rem;
  width: 100%;
}

.empty-state {
  background: var(--surface-2);
  border: 1px dashed #bcc6d7;
  border-radius: 8px;
  color: var(--muted);
  margin: 0;
  padding: 1rem;
}

.icon-button {
  aspect-ratio: 1;
  font-size: 1.25rem;
  line-height: 1;
  min-height: 2.3rem;
  padding: 0;
  width: 2.3rem;
}

.exercise-actions {
  flex-wrap: nowrap;
}

.exercise-actions .icon-button {
  flex: 0 0 1.95rem;
  height: 1.95rem;
  padding: 0.34rem;
  width: 1.95rem;
}

.set-remove-button {
  min-height: 2rem;
  padding: 0.42rem;
  width: 2rem;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  min-width: 34rem;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.68rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #e9edf5;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
  position: sticky;
  text-transform: uppercase;
  top: 0;
}

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

td {
  overflow-wrap: anywhere;
}

td strong {
  display: block;
}

.exercise-library {
  display: grid;
  overflow: hidden;
}

.library-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  min-width: 0;
  padding: 0.8rem;
}

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

.library-row > div:first-child {
  min-width: 0;
}

.library-row p {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0.18rem 0 0;
  overflow-wrap: anywhere;
}

.title-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.segmented {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
}

.segmented button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  min-height: 2.45rem;
}

.segmented button.active {
  background: var(--blue);
  color: #fff;
}

.exercise-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0.8rem;
}

.status.new_pr {
  background: var(--red);
  color: #fff;
}

.status.progress {
  background: var(--blue);
  color: #fff;
}

.status.same {
  background: #e6e9ef;
  color: #404858;
}

.status.less {
  background: #fff0df;
  color: var(--warning);
}

.status.not_compared {
  background: #dff4ef;
  color: var(--green);
}

.history-list {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}

.history-card {
  overflow: hidden;
}

.history-card summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  list-style-position: inside;
  padding: 0.88rem;
}

.history-card summary strong,
.history-card summary span {
  display: block;
}

.history-card summary span {
  color: var(--muted);
  font-size: 0.83rem;
}

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  justify-content: end;
}

.summary-stats span {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 0.28rem 0.4rem;
}

.history-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.72rem;
  padding: 0.88rem;
}

.workout-note {
  color: var(--muted);
  margin-bottom: 0;
}

.history-exercise {
  background: var(--surface-2);
  border-radius: 7px;
  padding: 0.62rem;
}

.history-exercise .section-head {
  margin-bottom: 0.48rem;
}

.set-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.34rem;
}

.set-chips span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.44rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-self: start;
}

.history-delete {
  justify-self: start;
}

.weight-layout {
  align-items: stretch;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(0, 1.2fr);
  margin-bottom: 1rem;
  min-width: 0;
}

.weight-form {
  align-content: start;
  display: grid;
  gap: 0.82rem;
}

.weight-entry-grid {
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
}

.weight-entry-grid label {
  min-width: 0;
}

.weight-context-field {
  grid-column: auto;
}

.weight-form > button {
  justify-self: stretch;
  width: 100%;
}

.weight-notes {
  grid-column: 1 / -1;
  max-width: none;
}

.weight-table {
  margin-top: 1rem;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 2rem);
  max-width: 42rem;
  padding: 0;
  width: calc(100% - 1rem);
}

dialog::backdrop {
  background: rgba(18, 23, 34, 0.55);
}

dialog form {
  display: grid;
  gap: 0.88rem;
  padding: 1rem;
}

.dialog-actions {
  display: flex;
  gap: 0.56rem;
  justify-content: end;
}

#exercise-progress-select {
  max-width: 18rem;
}

#toast {
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  bottom: 1rem;
  box-shadow: var(--shadow);
  color: #fff;
  left: 50%;
  max-width: calc(100vw - 2rem);
  opacity: 0;
  padding: 0.72rem 0.9rem;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 1rem);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 30;
}

#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-nav {
  display: none;
}

@media (min-width: 1041px) {
  #log .workout-form {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(18rem, 0.76fr) minmax(0, 1.35fr);
  }

  #log .type-bar {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0;
    width: 100%;
  }

  #log .type-bar button {
    min-height: 3.3rem;
    padding-inline: 1rem;
  }

  #log .workout-meta {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
    max-width: 100%;
    width: 100%;
  }

  #log .workout-notes {
    grid-column: 1 / 3;
    max-width: none;
  }

  #log .workout-copy-action {
    justify-self: stretch;
    width: 100%;
  }

  #log .logger-grid {
    display: contents;
  }

  #log .picker-panel {
    grid-column: 1;
    grid-row: 3;
  }

  #log .entry-panel {
    align-self: stretch;
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

@media (max-width: 1040px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workout-meta {
    grid-template-columns: minmax(12rem, 16rem) minmax(9rem, 10.5rem) minmax(8rem, 9.5rem);
    justify-content: start;
  }

  .workout-meta .span-two {
    grid-column: 1 / -1;
  }

  .logger-grid,
  .weight-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 4.4rem;
  }

  .topbar {
    height: 4rem;
    padding-inline: 0.72rem;
  }

  .app-shell {
    display: block;
    min-height: calc(100vh - 4rem);
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 0.78rem;
  }

  .view-head {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row {
    width: 100%;
  }

  .workout-editor-actions {
    width: auto;
  }

  .button-row > *,
  .head-search {
    flex: 1 1 7.3rem;
    min-width: 0;
    width: 100%;
  }

  #last-time-filter.head-search {
    flex-basis: auto;
    height: 2.6rem;
    min-height: 2.6rem;
  }

  .workout-editor-actions > * {
    flex: 0 0 auto;
    width: auto;
  }

  .exercises-toolbar {
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .exercises-toolbar #new-exercise {
    white-space: nowrap;
  }

  .library-tools {
    justify-content: flex-end;
  }

  .dashboard-grid,
  .records-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .metric-grid {
    gap: 0.55rem;
  }

  .metric {
    min-height: 4.8rem;
    padding: 0.62rem;
  }

  .type-bar {
    gap: 0.42rem;
  }

  .type-bar button {
    min-height: 3.55rem;
    padding-inline: 0.35rem;
  }

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

  .workout-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: stretch;
    justify-content: stretch;
    margin-inline: 0;
    max-width: none;
    width: 100%;
  }

  .workout-type-field {
    grid-column: 1 / -1;
  }

  .workout-type-field {
    max-width: none;
  }

  .workout-copy-action {
    grid-column: 2 / 3;
    align-self: end;
    justify-self: stretch;
    width: 100%;
  }

  .weight-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: stretch;
    justify-content: stretch;
    max-width: none;
    width: 100%;
  }

  .weight-form > button {
    justify-self: stretch;
    width: 100%;
  }

  .weight-context-field,
  .weight-notes {
    grid-column: 1 / -1;
  }

  .weight-context-field {
    max-width: none;
  }

  .span-two,
  .workout-meta .span-two {
    grid-column: auto;
  }

  .workout-notes {
    grid-column: 1 / 2;
    max-width: 100%;
  }

  .weight-notes {
    grid-column: 1 / -1;
    max-width: 100%;
  }

  .picker-panel,
  .entry-panel,
  .panel {
    padding: 0.72rem;
  }

  .set-header {
    display: none;
  }

  .set-row {
    background: var(--surface-2);
    border-radius: 7px;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 2.35rem;
    padding: 0.42rem;
  }

  .time-duration-set-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 2.35rem;
  }

  .set-flags {
    grid-column: span 2;
  }

  .set-row > input:nth-of-type(3) {
    grid-column: span 3;
  }

  .time-duration-set-row > input[data-set-field="notes"] {
    grid-column: span 2;
  }

  .draft-foot {
    grid-template-columns: 1fr;
  }

  .draft-foot button,
  .draft-foot select {
    width: 100%;
  }

  .history-card summary,
  .compact-row {
    align-items: stretch;
    flex-direction: column;
  }

  .library-row {
    align-items: center;
    flex-direction: row;
  }

  .row-actions > button {
    flex: 1 1 7rem;
  }

  .exercise-actions {
    align-self: center;
    justify-content: flex-end;
  }

  .exercise-actions > button {
    flex: 0 0 1.95rem;
  }

  .history-card summary {
    display: flex;
  }

  .summary-stats {
    justify-content: start;
  }

  .segmented {
    width: 100%;
  }

  table {
    min-width: 31rem;
  }

  .chart-frame {
    min-height: 11.6rem;
  }

  .mobile-nav {
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    left: 0;
    position: fixed;
    right: 0;
    z-index: 15;
  }

  .mobile-nav a {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 950;
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 0.68rem 0.25rem;
    text-align: center;
    text-decoration: none;
  }

  .mobile-nav a.active {
    box-shadow: inset 0 3px 0 var(--red);
    color: var(--ink);
  }
}
