/* Mondrian-inspired theme: functional rectangles, primary color, and black rules. */

html[data-theme="mondrian"] {
  --paper: #f5f5f2;
  --paper-shade: #e9e9e6;
  --ink: #111111;
  --ink-mid: #353535;
  --ink-light: #646464;
  --ink-faint: #a8a8a3;
  --rule: #111111;
  --red: #e31919;
  --red-light: #bd1111;
  --flavour-blue: #0752b8;
  --flavour-vermillion: #e31919;
  --flavour-green: #0752b8;
  --flavour-purple: #111111;
  --flavour-orange: #ffd21a;
  --flavour-sky: #f5f5f2;
  --cardio: var(--flavour-vermillion);
  --strength: var(--flavour-blue);
  --core: var(--flavour-purple);
  --mobility: var(--flavour-orange);
  --restore: var(--flavour-blue);
  --shadow: none;
  --font-main: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", "SF Mono", monospace;
  --mondrian-line: 4px;
  --mondrian-red: #e31919;
  --mondrian-blue: #0752b8;
  --mondrian-yellow: #ffd21a;
  --mondrian-white: #f5f5f2;
}

html[data-theme="mondrian"] body {
  color: var(--ink);
  background: #20201f;
  font-size: 18px;
}

html[data-theme="mondrian"] .app-shell::before {
  display: none;
}

html[data-theme="mondrian"] button,
html[data-theme="mondrian"] input {
  font-family: inherit;
}

html[data-theme="mondrian"] .view-home,
html[data-theme="mondrian"] .view-preview,
html[data-theme="mondrian"] .view-settings,
html[data-theme="mondrian"] .view-history,
html[data-theme="mondrian"] .view-favourites,
html[data-theme="mondrian"] .view-done,
html[data-theme="mondrian"] .view-run,
html[data-theme="mondrian"] .view-rest {
  width: min(100%, 680px);
  margin-right: auto;
  margin-left: auto;
  color: var(--ink);
  background: var(--mondrian-white);
  border-right: var(--mondrian-line) solid var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .view-home,
html[data-theme="mondrian"] .view-history,
html[data-theme="mondrian"] .view-favourites,
html[data-theme="mondrian"] .view-settings {
  padding-bottom: calc(92px + var(--safe-bottom));
}

html[data-theme="mondrian"] .view-home {
  padding-right: 0;
  padding-left: 0;
}

/* Home header: red rail | wordmark | link cell, then date. */

html[data-theme="mondrian"] .home-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 94px 54px 54px;
  grid-template-rows: minmax(150px, auto) 72px;
  padding: var(--safe-top) 0 0;
  border-top: var(--mondrian-line) solid var(--ink);
  border-bottom: var(--mondrian-line) solid var(--ink);
  animation: none;
}

html[data-theme="mondrian"] .home-header::before {
  content: "";
  grid-row: 1 / 3;
  grid-column: 1;
  background: var(--mondrian-red);
  border-right: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .home-header h1 {
  grid-row: 1;
  grid-column: 2;
  align-self: end;
  min-width: 0;
  margin: 0;
  padding: 34px 28px 25px;
  font-family: var(--font-main);
  font-size: clamp(72px, 20vw, 102px);
  font-weight: 700;
  font-style: normal;
  line-height: 0.78;
  letter-spacing: -0.08em;
  text-align: left;
  text-transform: lowercase;
}

html[data-theme="mondrian"] .home-header .x {
  color: var(--mondrian-red);
  transform: none;
}

html[data-theme="mondrian"] .home-header-actions {
  position: relative;
  z-index: 2;
  top: auto;
  right: auto;
  display: grid;
  grid-row: 1;
  grid-column: 3 / 6;
  grid-template-columns: 94px 54px 54px;
  align-self: stretch;
  align-items: stretch;
  justify-self: stretch;
  height: auto;
  gap: 0;
  padding: 0;
  border: 0;
  border-left: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
  background: var(--mondrian-white);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

html[data-theme="mondrian"] .home-link-button {
  position: static;
  z-index: 2;
  width: auto;
  height: auto;
  align-self: stretch;
  justify-self: stretch;
  justify-content: center;
  color: var(--ink);
  background: var(--mondrian-white);
  border: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

html[data-theme="mondrian"] .home-link-button svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.8;
}

html[data-theme="mondrian"] .global-settings-button,
html[data-theme="mondrian"] .global-help-button {
  width: 54px;
  height: 64px;
  color: var(--ink);
  background: var(--mondrian-white);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html[data-theme="mondrian"] .home-header-actions .global-settings-button,
html[data-theme="mondrian"] .home-header-actions .global-help-button {
  width: auto;
  height: auto;
  align-self: stretch;
  justify-self: stretch;
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .global-settings-button[aria-expanded="true"],
html[data-theme="mondrian"] .global-help-button[aria-expanded="true"] {
  color: #ffffff;
  background: var(--mondrian-blue);
}

html[data-theme="mondrian"] .global-settings-button svg,
html[data-theme="mondrian"] .global-help-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

html[data-theme="mondrian"] .date-lockup {
  position: relative;
  grid-row: 2;
  grid-column: 2 / 6;
  display: flex;
  align-items: center;
  min-height: 0;
  margin: 0;
  padding: 0 28px;
  border-top: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .date {
  width: auto;
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-size: clamp(12px, 3.5vw, 16px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .date::after {
  display: none;
}

/* Workout-size grid. */

html[data-theme="mondrian"] .picker {
  position: relative;
  margin: 0;
  padding-left: 48px;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .picker::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 48px;
  background: var(--mondrian-white);
  border-right: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .size-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 0;
  padding: 0;
  border: 0;
}

html[data-theme="mondrian"] .size-buttons {
  display: grid;
  grid-column: 1;
  grid-template-columns: 58px repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  justify-self: stretch;
}

html[data-theme="mondrian"] .size-bubble,
html[data-theme="mondrian"] .size-bubble[data-size="3"] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 166px;
  padding: 0 4px;
  color: var(--ink);
  background: var(--mondrian-white);
  border: 0;
  border-left: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font-main);
  font-size: clamp(48px, 14vw, 68px);
  font-weight: 600;
  font-style: normal;
  line-height: 0.85;
  transform: none;
}

html[data-theme="mondrian"] .custom-workout-toggle + .size-bubble {
  border-left: 0;
}

html[data-theme="mondrian"] .size-bubble[data-size="3"] {
  background: var(--mondrian-yellow);
}

html[data-theme="mondrian"] .size-bubble::after {
  display: block;
  margin-top: 18px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .size-bubble[data-size="1"]::after { content: "session"; }
html[data-theme="mondrian"] .size-bubble[data-size="3"]::after,
html[data-theme="mondrian"] .size-bubble[data-size="5"]::after { content: "sessions"; }
html[data-theme="mondrian"] .size-bubble:hover,
html[data-theme="mondrian"] .size-bubble:active {
  border-color: var(--ink);
  box-shadow: none;
  transform: none;
}

html[data-theme="mondrian"] .more-link,
html[data-theme="mondrian"] .custom-workout-toggle {
  grid-row: 1;
  grid-column: 2;
  align-self: stretch;
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  color: #ffffff;
  background: var(--mondrian-blue);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .custom-workout-toggle {
  grid-row: 1;
  grid-column: 1;
  border-right: var(--mondrian-line) solid var(--ink);
  border-left: 0;
}

html[data-theme="mondrian"] .more-link svg,
html[data-theme="mondrian"] .custom-workout-toggle svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.8;
}

/* Today summary and session table. */

html[data-theme="mondrian"] .today-panel {
  position: relative;
  margin: 0 0 0 calc(48px - var(--mondrian-line));
  padding: 0;
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .panel-head {
  min-height: 92px;
  padding: 30px 34px 18px;
  align-items: center;
}

html[data-theme="mondrian"] .section-label {
  color: var(--ink);
  background: transparent;
  padding: 0;
  clip-path: none;
  font-family: var(--font-main);
  font-size: clamp(28px, 8vw, 39px);
  font-weight: 600;
  letter-spacing: 0.08em;
  transform: none;
}

html[data-theme="mondrian"] .section-meta,
html[data-theme="mondrian"] .archive-meta,
html[data-theme="mondrian"] .archive-month-meta,
html[data-theme="mondrian"] .archive-date,
html[data-theme="mondrian"] .preview-sub,
html[data-theme="mondrian"] .done-stats,
html[data-theme="mondrian"] .settings-count,
html[data-theme="mondrian"] .preview-workout-stats,
html[data-theme="mondrian"] .day-group-stats {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .today-spark {
  position: relative;
  min-height: 122px;
  gap: 12px;
  padding: 4px 180px 32px 34px;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .today-spark::after {
  content: "";
  position: absolute;
  right: 34px;
  bottom: 28px;
  width: 92px;
  height: 74px;
  background-image: radial-gradient(circle, var(--ink) 1.6px, transparent 1.8px);
  background-size: 14px 14px;
}

html[data-theme="mondrian"] .spark-bar {
  width: 14px;
  min-height: 12px;
  border: 0;
  animation-timing-function: steps(5, end);
}

html[data-theme="mondrian"] .spark-bar-archive { width: 8px; }
html[data-theme="mondrian"] .spark-bar-done { width: 16px; }

html[data-theme="mondrian"] .spark-empty {
  align-self: center;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .today-sessions {
  margin: 0;
  border: 0;
  counter-reset: mondrian-snack;
}

html[data-theme="mondrian"] .today-sessions .day-group {
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .today-sessions .day-group-time {
  grid-row: 1;
  grid-column: 1;
  align-self: stretch;
  width: auto;
  margin: 0;
  padding: 16px 18px;
  color: #ffffff;
  background: var(--ink);
  border: 0;
  clip-path: none;
  font-size: 12px;
  transform: none;
}

html[data-theme="mondrian"] .today-sessions .day-group-stats {
  grid-row: 1;
  grid-column: 2;
  margin: 0;
  padding: 16px 20px;
  border-top: var(--mondrian-line) solid var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .today-sessions .day-group-stats::before {
  content: "current session  /  ";
  color: var(--ink-light);
}

html[data-theme="mondrian"] .today-sessions .workout-stats-row {
  gap: 0;
  margin: 0;
  border-top: var(--mondrian-line) solid var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .today-sessions .workout-stats-row .day-group-stats {
  flex: 1 1 auto;
  padding: 16px 20px 16px 4px;
  border: 0;
}

html[data-theme="mondrian"] .today-sessions .workout-favourite-button {
  width: 42px;
  height: 42px;
  margin-left: 8px;
  color: var(--ink);
}

html[data-theme="mondrian"] .workout-favourite-button.is-favourite {
  color: var(--mondrian-red);
}

html[data-theme="mondrian"] .today-sessions .day-group-snacks {
  grid-row: 2;
  grid-column: 1 / 3;
  gap: 0;
}

html[data-theme="mondrian"] .today-sessions .day-snack {
  counter-increment: mondrian-snack;
  display: grid;
  grid-template-columns: 42px 72px minmax(0, 1fr) 68px;
  align-items: stretch;
  min-height: 82px;
  gap: 0;
  border-top: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .today-sessions .day-snack::before {
  content: counter(mondrian-snack, decimal-leading-zero);
  grid-row: 1;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: var(--mondrian-line) solid var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

html[data-theme="mondrian"] .today-sessions .day-snack::after {
  content: "";
  grid-row: 1;
  grid-column: 4;
  width: 26px;
  height: 26px;
  place-self: center;
  background-image: radial-gradient(circle, var(--ink) 2px, transparent 2.2px);
  background-size: 9px 9px;
}

html[data-theme="mondrian"] .today-sessions .day-bar {
  grid-row: 1;
  grid-column: 1;
  align-self: stretch;
  width: 100%;
  height: auto;
  border-right: var(--mondrian-line) solid var(--ink);
  background: currentColor;
}

html[data-theme="mondrian"] .today-sessions .day-snack-name {
  grid-row: 1;
  grid-column: 3;
  align-self: center;
  min-width: 0;
  padding: 12px 20px;
  overflow-wrap: anywhere;
  font-family: var(--font-main);
  font-size: clamp(23px, 6vw, 31px);
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .today-panel::after {
  content: "";
  display: block;
  height: 176px;
  background:
    linear-gradient(var(--ink), var(--ink)) 44% 0 / var(--mondrian-line) 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 62% / 100% var(--mondrian-line) no-repeat,
    linear-gradient(var(--ink), var(--ink)) 83% 100% / var(--mondrian-line) 38% no-repeat,
    linear-gradient(var(--mondrian-white), var(--mondrian-white)) 0 100% / 83% 38% no-repeat,
    linear-gradient(var(--mondrian-red), var(--mondrian-red)) 100% 0 / 56% 62% no-repeat,
    linear-gradient(var(--mondrian-blue), var(--mondrian-blue)) 100% 100% / 17% 38% no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='70'%3E%3Cdefs%3E%3Cpattern id='p' width='14' height='14' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='3' cy='3' r='1.5' fill='%23111111'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='112' height='70' fill='url(%23p)'/%3E%3C/svg%3E") 28px 24px / 112px 70px no-repeat,
    var(--mondrian-white);
  border-bottom: var(--mondrian-line) solid var(--ink);
}

/* Full-width, labeled navigation. */

html[data-theme="mondrian"] .bottom-toolbar {
  position: fixed;
  z-index: 30;
  right: auto;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 680px);
  gap: 0;
  padding: 0 0 var(--safe-bottom);
  overflow: hidden;
  color: var(--ink);
  background: var(--mondrian-white);
  border: var(--mondrian-line) solid var(--ink);
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: translateX(-50%);
}

html[data-theme="mondrian"] .bottom-toolbar[hidden] {
  display: none;
}

html[data-theme="mondrian"] .toolbar-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 88px;
  gap: 9px;
  padding: 10px 4px 8px;
  color: var(--ink);
  background: var(--mondrian-white);
  border-left: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
}

html[data-theme="mondrian"] .toolbar-button:first-child {
  border-left: 0;
}

html[data-theme="mondrian"] .toolbar-button::after {
  content: attr(aria-label);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .toolbar-button svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.4;
}

html[data-theme="mondrian"] .toolbar-button.active {
  color: var(--mondrian-red);
  background:
    linear-gradient(var(--mondrian-red), var(--mondrian-red)) 0 0 / 100% 8px no-repeat,
    var(--mondrian-white);
  box-shadow: none;
}

html[data-theme="mondrian"] .toolbar-button[data-tab="history"].active {
  color: #ffffff;
  background: var(--ink);
}

html[data-theme="mondrian"] .toolbar-button[data-tab="settings"].active {
  color: #ffffff;
  background: var(--mondrian-blue);
}

/* Secondary-screen frames and headings. */

html[data-theme="mondrian"] .view-preview,
html[data-theme="mondrian"] .view-history,
html[data-theme="mondrian"] .view-favourites,
html[data-theme="mondrian"] .view-settings,
html[data-theme="mondrian"] .view-done {
  min-height: 100dvh;
  padding: 0 0 calc(108px + var(--safe-bottom));
}

html[data-theme="mondrian"] .preview-header {
  min-height: calc(138px + var(--safe-top));
  padding: calc(54px + var(--safe-top)) 28px 24px 88px;
  border-top: var(--mondrian-line) solid var(--ink);
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .preview-header::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 48px;
  height: 48px;
  background: var(--mondrian-yellow);
  border-top: var(--mondrian-line) solid var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .preview-title,
html[data-theme="mondrian"] .done-title,
html[data-theme="mondrian"] .bottom-panel-head h2,
html[data-theme="mondrian"] .settings-dialog-title {
  margin: 0;
  font-family: var(--font-main);
  font-weight: 700;
  font-style: normal;
  line-height: 0.95;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .preview-title,
html[data-theme="mondrian"] .done-title {
  font-size: clamp(42px, 12vw, 66px);
}

html[data-theme="mondrian"] .preview-sub,
html[data-theme="mondrian"] .preview-workout-stats {
  margin-top: 12px;
}

html[data-theme="mondrian"] .back-btn {
  position: absolute;
  z-index: 2;
  top: var(--safe-top);
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  min-height: 68px;
  padding: 0;
  margin: 0;
  color: #ffffff;
  background: var(--mondrian-red);
  border: 0;
  border-right: var(--mondrian-line) solid var(--ink);
  border-bottom: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

html[data-theme="mondrian"] .back-btn.back-btn-floating {
  position: fixed;
  z-index: 30;
  top: calc(12px + var(--safe-top));
  left: max(14px, calc((100vw - 680px) / 2 + 14px));
  width: 52px;
  height: 52px;
  min-height: 52px;
  color: #ffffff;
  background: var(--mondrian-red);
  border: var(--mondrian-line) solid var(--ink);
  box-shadow: 5px 6px 0 rgba(17, 17, 17, 0.16);
  animation: back-button-lift 220ms var(--ease) both;
}

html[data-theme="mondrian"] .library-header-actions,
html[data-theme="mondrian"] .preview-header-actions,
html[data-theme="mondrian"] .history-header-actions,
html[data-theme="mondrian"] .favourites-header-actions,
html[data-theme="mondrian"] .done-header-actions {
  position: absolute;
  z-index: 3;
  top: var(--safe-top);
  right: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 54px;
  height: 68px;
  gap: 0;
  padding: 0;
  background: var(--mondrian-white);
  border: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

html[data-theme="mondrian"] .library-header-actions > button,
html[data-theme="mondrian"] .preview-header-actions > button,
html[data-theme="mondrian"] .history-header-actions > button,
html[data-theme="mondrian"] .favourites-header-actions > button,
html[data-theme="mondrian"] .done-header-actions > button {
  width: 54px;
  height: 64px;
  color: var(--ink);
  border: 0;
}

html[data-theme="mondrian"] .header-actions > button + button {
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .header-actions > button[hidden] + button {
  border-left: 0;
}

html[data-theme="mondrian"] .library-icon-button[aria-expanded="true"] {
  color: #ffffff;
  background: var(--mondrian-blue);
}

html[data-theme="mondrian"] .header-actions.header-actions-floating {
  position: fixed;
  z-index: 30;
  top: calc(12px + var(--safe-top));
  right: max(14px, calc((100vw - 680px) / 2 + 14px));
  display: flex;
  width: auto;
  height: 52px;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: var(--mondrian-white);
  border: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
  box-shadow: 5px 6px 0 rgba(17, 17, 17, 0.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: back-button-lift 220ms var(--ease) both;
}

html[data-theme="mondrian"] .header-actions.header-actions-floating > button {
  width: 48px;
  height: auto;
  min-height: 0;
  align-self: stretch;
  border: 0;
  box-shadow: none;
}

html[data-theme="mondrian"] .header-actions.header-actions-floating > button + button {
  border-left: var(--mondrian-line) solid var(--ink);
}

/* Preview and done rows. */

html[data-theme="mondrian"] .preview-list,
html[data-theme="mondrian"] .done-summary {
  margin: 0;
  border: 0;
}

html[data-theme="mondrian"] .favourites-list {
  margin-top: 0;
  border-top: 0;
}

html[data-theme="mondrian"] .favourite-card {
  grid-template-columns: minmax(0, 1fr) 56px 56px;
  gap: 0;
  padding: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .favourite-copy {
  padding: 25px 28px;
}

html[data-theme="mondrian"] .favourite-exercises {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .favourite-settings {
  color: var(--ink-mid);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .favourite-card-star {
  align-self: stretch;
  width: 56px;
  height: 100%;
  min-height: 92px;
  color: var(--mondrian-red);
  background: var(--mondrian-yellow);
  border: 0;
  border-left: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
}

html[data-theme="mondrian"] .favourite-card-star:hover {
  color: #ffffff;
  background: var(--mondrian-red);
}

html[data-theme="mondrian"] .done-favourite-button {
  color: var(--ink);
  background: var(--mondrian-yellow);
  border: var(--mondrian-line) solid var(--ink);
  border-radius: 0;
}

html[data-theme="mondrian"] .done-favourite-button.is-favourite {
  color: #ffffff;
  background: var(--mondrian-red);
}

html[data-theme="mondrian"] .preview-item {
  grid-template-columns: 70px minmax(0, 1fr) 62px;
  gap: 0;
  min-height: 98px;
  padding: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .preview-item .idx {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  border-right: var(--mondrian-line) solid var(--ink);
  font-size: 15px;
  font-weight: 700;
}

html[data-theme="mondrian"] .preview-item .body {
  align-self: center;
  min-width: 0;
  padding: 14px 18px;
}

html[data-theme="mondrian"] .preview-name-row {
  gap: 14px;
}

html[data-theme="mondrian"] .preview-item .name,
html[data-theme="mondrian"] .settings-card .name,
html[data-theme="mondrian"] .settings-dialog-name,
html[data-theme="mondrian"] .done-list-item {
  font-family: var(--font-main);
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .preview-item .name,
html[data-theme="mondrian"] .settings-card .name {
  font-size: clamp(22px, 6vw, 29px);
}

html[data-theme="mondrian"] .preview-retry {
  align-self: stretch;
  justify-content: center;
  width: auto;
  height: auto;
  color: var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .preview-retry:hover {
  color: #ffffff;
  background: var(--mondrian-blue);
}

html[data-theme="mondrian"] .preview-workout-stats {
  margin: 0;
  padding: 18px 22px;
  text-align: right;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .preview-actions {
  right: 50%;
  bottom: calc(96px + var(--safe-bottom));
  left: auto;
  gap: 0;
  transform: translateX(50%);
}

html[data-theme="mondrian"] .btn-begin {
  width: 64px;
  height: 58px;
  justify-content: center;
  color: var(--ink);
  background: var(--mondrian-yellow);
  border: var(--mondrian-line) solid var(--ink);
  font-style: normal;
}

html[data-theme="mondrian"] .btn-begin + .btn-begin {
  color: #ffffff;
  background: var(--mondrian-red);
  border-left: 0;
}

html[data-theme="mondrian"] .done-wrap {
  padding: 36px 24px 0;
}

html[data-theme="mondrian"] .done-summary {
  margin-top: 32px;
  padding: 28px;
  border: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .done-list-item {
  padding: 12px 0;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
}

/* History grid. */

html[data-theme="mondrian"] .history-list {
  margin: 0;
  border: 0;
}

html[data-theme="mondrian"] .archive-month-toggle {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  padding: 20px 22px;
  border-top: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .archive-month-title {
  font-family: var(--font-main);
  font-size: 29px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .archive-month-toggle::before,
html[data-theme="mondrian"] .history-day-toggle::before {
  color: var(--mondrian-red);
  font-size: 18px;
  font-weight: 800;
}

html[data-theme="mondrian"] .history-day {
  border: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .history-day-toggle {
  grid-template-columns: 22px max-content minmax(70px, 1fr) auto;
  gap: 10px;
  min-height: 76px;
  padding: 14px 20px;
}

html[data-theme="mondrian"] .history-day-toggle .archive-date {
  padding-right: 8px;
}

html[data-theme="mondrian"] .history-day:nth-child(3n + 1) .history-day-toggle {
  box-shadow: inset 14px 0 0 var(--mondrian-red);
  padding-left: 26px;
}

html[data-theme="mondrian"] .history-day:nth-child(3n + 2) .history-day-toggle {
  box-shadow: inset 14px 0 0 var(--mondrian-blue);
  padding-left: 26px;
}

html[data-theme="mondrian"] .history-day:nth-child(3n) .history-day-toggle {
  box-shadow: inset 14px 0 0 var(--mondrian-yellow);
  padding-left: 26px;
}

html[data-theme="mondrian"] .history-day-details {
  padding: 0;
  border-top: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .history-day-details .day-group {
  padding: 18px 22px;
  border-bottom: 2px solid var(--ink);
}

/* Library rows. */

html[data-theme="mondrian"] .settings-summary {
  margin: 0;
  padding: 18px 22px;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .settings-list {
  margin: 0;
}

html[data-theme="mondrian"] .settings-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px 56px;
  gap: 0;
  min-height: 92px;
  padding: 0;
  border: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .settings-card:last-child {
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .settings-card-button {
  padding: 15px 18px;
}

html[data-theme="mondrian"] .settings-card .day-bar {
  align-self: center;
  width: 14px;
  min-height: 0;
  background: currentColor;
}

html[data-theme="mondrian"] .settings-card .day-bar[data-intensity="1"] { height: 20px; }
html[data-theme="mondrian"] .settings-card .day-bar[data-intensity="2"] { height: 38px; }
html[data-theme="mondrian"] .settings-card .day-bar[data-intensity="3"] { height: 56px; }

html[data-theme="mondrian"] .settings-go-btn,
html[data-theme="mondrian"] .settings-enabled-toggle {
  align-self: stretch;
  width: 56px;
  height: auto;
  color: var(--ink);
  border-left: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .settings-go-btn:hover {
  color: #ffffff;
  background: var(--mondrian-red);
}

html[data-theme="mondrian"] .settings-enabled-toggle:hover {
  color: #ffffff;
  background: var(--mondrian-blue);
}

html[data-theme="mondrian"] .settings-empty {
  padding: 32px 22px;
  color: var(--ink);
  border-top: 0;
  border-bottom: var(--mondrian-line) solid var(--ink);
  font-style: normal;
  text-transform: uppercase;
}

/* Timer, rest, and completion states. */

html[data-theme="mondrian"] .view-run,
html[data-theme="mondrian"] .view-rest {
  min-height: 100dvh;
  padding: calc(18px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  border-top: var(--mondrian-line) solid var(--ink);
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .view-run {
  background:
    linear-gradient(var(--mondrian-red), var(--mondrian-red)) 0 0 / 54px 26% no-repeat,
    linear-gradient(var(--mondrian-blue), var(--mondrian-blue)) 100% 100% / 68px 24% no-repeat,
    var(--mondrian-white);
}

html[data-theme="mondrian"] .view-rest {
  background:
    linear-gradient(var(--mondrian-yellow), var(--mondrian-yellow)) 0 0 / 100% 86px no-repeat,
    var(--mondrian-white);
}

html[data-theme="mondrian"] .timer-step,
html[data-theme="mondrian"] .timer-round,
html[data-theme="mondrian"] .timer-category,
html[data-theme="mondrian"] .rest-label {
  color: var(--ink);
  font-weight: 700;
}

html[data-theme="mondrian"] .timer-name {
  max-width: 560px;
  font-family: var(--font-main);
  font-size: clamp(50px, 15vw, 94px);
  font-weight: 700;
  font-style: normal;
  line-height: 0.88;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .timer-seconds,
html[data-theme="mondrian"] .rest-seconds {
  color: var(--ink);
  font-family: var(--font-main);
  font-weight: 600;
  font-style: normal;
}

html[data-theme="mondrian"] .timer-progress,
html[data-theme="mondrian"] .rest-bar {
  height: 14px;
  background: var(--mondrian-white);
  border: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .timer-stack {
  gap: 0;
  border: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .timer-stack-item {
  min-width: min(360px, 72vw);
  padding: 8px 14px;
  color: var(--ink-light);
  background: var(--mondrian-white);
  border-top: 2px solid var(--ink);
  font-style: normal;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .timer-stack-item:first-child { border-top: 0; }
html[data-theme="mondrian"] .timer-stack-item.is-current {
  color: #ffffff;
  background: var(--ink);
}

html[data-theme="mondrian"] .timer-icon-btn {
  color: var(--ink);
  background: var(--mondrian-white);
  border: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .timer-top-actions .global-settings-button,
html[data-theme="mondrian"] .timer-top-actions .global-help-button {
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--mondrian-white);
  border: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .timer-bottom,
html[data-theme="mondrian"] .rest-bottom {
  gap: 0;
}

html[data-theme="mondrian"] .timer-bottom .timer-icon-btn + .timer-icon-btn,
html[data-theme="mondrian"] .rest-bottom .timer-icon-btn + .timer-icon-btn {
  border-left: 0;
}

/* Sheets, dialogs, form controls, and theme picker. */

html[data-theme="mondrian"] .bottom-sheet-scrim,
html[data-theme="mondrian"] .settings-overlay-scrim {
  background: rgba(17, 17, 17, 0.66);
}

html[data-theme="mondrian"] .bottom-panel,
html[data-theme="mondrian"] .import-dialog {
  color: var(--ink);
  background: var(--mondrian-white);
  border: var(--mondrian-line) solid var(--ink);
  border-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html[data-theme="mondrian"] .import-dialog {
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .bottom-panel-head {
  padding-bottom: 18px;
  border-bottom: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .bottom-panel-close,
html[data-theme="mondrian"] .settings-remove,
html[data-theme="mondrian"] .settings-save {
  color: var(--ink);
  border: 2px solid var(--ink);
}

html[data-theme="mondrian"] .bottom-panel-close {
  align-items: center;
  justify-content: center;
  padding: 0;
}

html[data-theme="mondrian"] .bottom-panel-close svg {
  display: block;
  flex: 0 0 auto;
  margin: 0;
}

html[data-theme="mondrian"] .custom-workout-list {
  border-top: var(--mondrian-line) solid var(--ink);
}

html[data-theme="mondrian"] .custom-workout-option {
  padding-right: 12px;
  padding-left: 12px;
  border-bottom: 2px solid var(--ink);
}

html[data-theme="mondrian"] .custom-workout-option:hover,
html[data-theme="mondrian"] .custom-workout-option.is-selected {
  background: var(--mondrian-yellow);
}

html[data-theme="mondrian"] .custom-workout-option-name {
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .custom-workout-confirm {
  border: 2px solid var(--ink);
}

html[data-theme="mondrian"] .help-section {
  border-color: var(--ink);
  border-width: 2px;
}

html[data-theme="mondrian"] .help-section h3 {
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .chip,
html[data-theme="mondrian"] .btn-muted,
html[data-theme="mondrian"] .import-mode span,
html[data-theme="mondrian"] .theme-option {
  color: var(--ink);
  background: var(--mondrian-white);
  border: 2px solid var(--ink);
  border-radius: 0;
  font-family: var(--font-mono);
  font-style: normal;
  text-transform: uppercase;
}

html[data-theme="mondrian"] .chip {
  padding: 8px 11px;
}

html[data-theme="mondrian"] .chip.active,
html[data-theme="mondrian"] .import-mode input:checked + span,
html[data-theme="mondrian"] .theme-option[aria-pressed="true"] {
  color: var(--ink);
  background: var(--mondrian-yellow);
  border-color: var(--ink);
}

html[data-theme="mondrian"] .chip-row,
html[data-theme="mondrian"] .admin-section + .admin-section,
html[data-theme="mondrian"] .settings-dialog-preview,
html[data-theme="mondrian"] .import-section {
  border-color: var(--ink);
}

html[data-theme="mondrian"] .settings-input,
html[data-theme="mondrian"] .link-code-box,
html[data-theme="mondrian"] .link-url-box {
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 0;
}

html[data-theme="mondrian"] .theme-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

html[data-theme="mondrian"] .theme-option {
  padding: 8px;
}

html[data-theme="mondrian"] .toast {
  color: #ffffff;
  background: var(--ink);
  border: 3px solid var(--mondrian-white);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

@media (max-width: 560px) {
  html[data-theme="mondrian"] .home-header {
    grid-template-columns: 42px minmax(0, 1fr) 68px 46px 46px;
    grid-template-rows: minmax(132px, auto) 64px;
  }

  html[data-theme="mondrian"] .home-header h1 {
    padding: 30px 18px 22px;
    font-size: clamp(66px, 22vw, 88px);
  }

  html[data-theme="mondrian"] .home-header-actions {
    grid-template-columns: 68px 46px 46px;
  }

  html[data-theme="mondrian"] .date-lockup {
    padding: 0 18px;
  }

  html[data-theme="mondrian"] .picker {
    padding-left: 42px;
  }

  html[data-theme="mondrian"] .picker::before {
    width: 42px;
  }

  html[data-theme="mondrian"] .size-actions {
    grid-template-columns: minmax(0, 1fr) 46px;
  }

  html[data-theme="mondrian"] .size-buttons {
    grid-template-columns: 46px repeat(3, minmax(0, 1fr));
  }

  html[data-theme="mondrian"] .size-bubble,
  html[data-theme="mondrian"] .size-bubble[data-size="3"] {
    height: 146px;
  }

  html[data-theme="mondrian"] .size-bubble::after {
    margin-top: 14px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  html[data-theme="mondrian"] .today-panel {
    margin-left: calc(42px - var(--mondrian-line));
  }

  html[data-theme="mondrian"] .panel-head {
    padding-right: 20px;
    padding-left: 20px;
  }

  html[data-theme="mondrian"] .today-spark {
    gap: 8px;
    padding-right: 118px;
    padding-left: 20px;
  }

  html[data-theme="mondrian"] .today-spark::after {
    right: 16px;
    width: 72px;
  }

  html[data-theme="mondrian"] .today-sessions .day-group {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  html[data-theme="mondrian"] .today-sessions .day-group-time,
  html[data-theme="mondrian"] .today-sessions .day-group-stats {
    padding: 13px 12px;
    font-size: 9px;
  }

  html[data-theme="mondrian"] .today-sessions .workout-stats-row .day-group-stats {
    padding: 13px 10px 13px 2px;
  }

  html[data-theme="mondrian"] .today-sessions .workout-favourite-button {
    width: 34px;
    height: 34px;
    margin-left: 5px;
  }

  html[data-theme="mondrian"] .today-sessions .day-group-stats::before {
    content: "session  /  ";
  }

  html[data-theme="mondrian"] .today-sessions .day-snack {
    grid-template-columns: 34px 54px minmax(0, 1fr) 42px;
    min-height: 74px;
  }

  html[data-theme="mondrian"] .today-sessions .day-snack::before {
    font-size: 12px;
  }

  html[data-theme="mondrian"] .today-sessions .day-snack::after {
    width: 22px;
    height: 22px;
    background-size: 8px 8px;
  }

  html[data-theme="mondrian"] .today-sessions .day-snack-name {
    padding: 10px 12px;
    font-size: clamp(20px, 6.4vw, 26px);
  }

  html[data-theme="mondrian"] .toolbar-button {
    height: 78px;
    gap: 7px;
  }

  html[data-theme="mondrian"] .toolbar-button::after {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  html[data-theme="mondrian"] .preview-header {
    padding-right: 18px;
    padding-left: 78px;
  }

  html[data-theme="mondrian"] .library-header-actions,
  html[data-theme="mondrian"] .preview-header-actions,
  html[data-theme="mondrian"] .history-header-actions,
  html[data-theme="mondrian"] .favourites-header-actions,
  html[data-theme="mondrian"] .done-header-actions {
    grid-auto-columns: 46px;
  }

  html[data-theme="mondrian"] .global-settings-button,
  html[data-theme="mondrian"] .global-help-button {
    width: 46px;
  }

  html[data-theme="mondrian"] .header-actions.header-actions-floating > button {
    width: 46px;
  }

  html[data-theme="mondrian"] .library-header-actions > button,
  html[data-theme="mondrian"] .preview-header-actions > button,
  html[data-theme="mondrian"] .history-header-actions > button,
  html[data-theme="mondrian"] .favourites-header-actions > button,
  html[data-theme="mondrian"] .done-header-actions > button {
    width: 46px;
  }

  html[data-theme="mondrian"] .history-day-toggle {
    grid-template-columns: 18px max-content minmax(52px, 1fr);
  }

  html[data-theme="mondrian"] .history-day-toggle .archive-meta {
    grid-column: 2 / 4;
    text-align: left;
  }

  html[data-theme="mondrian"] .settings-card {
    grid-template-columns: minmax(0, 1fr) 48px 48px;
  }

  html[data-theme="mondrian"] .settings-go-btn,
  html[data-theme="mondrian"] .settings-enabled-toggle {
    width: 48px;
  }

  html[data-theme="mondrian"] .theme-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  html[data-theme="mondrian"] {
    --mondrian-line: 3px;
  }

  html[data-theme="mondrian"] .home-header {
    grid-template-columns: 36px minmax(0, 1fr) 58px 46px;
  }

  html[data-theme="mondrian"] .home-header-actions {
    grid-template-columns: 58px 46px;
  }

  html[data-theme="mondrian"] .picker {
    padding-left: 36px;
  }

  html[data-theme="mondrian"] .picker::before {
    width: 36px;
  }

  html[data-theme="mondrian"] .today-panel {
    margin-left: calc(36px - var(--mondrian-line));
  }

  html[data-theme="mondrian"] .size-bubble,
  html[data-theme="mondrian"] .size-bubble[data-size="3"] {
    font-size: 44px;
  }

  html[data-theme="mondrian"] .today-sessions .day-snack {
    grid-template-columns: 30px 46px minmax(0, 1fr) 34px;
  }

  html[data-theme="mondrian"] .today-sessions .day-snack-name {
    padding-right: 8px;
    padding-left: 9px;
    font-size: 19px;
  }
}
