:root {
  color-scheme: light;
  --ink: #11151c;
  --muted: #4f5c6d;
  --line: #b8c4d1;
  --paper: #dfe7ee;
  --panel: #ffffff;
  --red: #bf352d;
  --teal: #166b68;
  --gold: #b87a14;
  --green: #347a43;
  --shadow: 0 20px 48px rgba(17, 24, 39, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(22, 107, 104, 0.18), transparent 42%),
    radial-gradient(circle at 80% 10%, rgba(191, 53, 45, 0.18), transparent 32%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar,
.workout-grid {
  display: grid;
  gap: 18px;
}

.topbar {
  grid-template-columns: 1fr;
  align-items: center;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.mark svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.mark .line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 4;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

.app-status {
  width: fit-content;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 850;
}

.hero-visual {
  position: relative;
  display: flex;
  min-height: 230px;
  margin: 0 0 20px;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(14, 18, 25, 0.98), rgba(23, 26, 34, 0.84)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, transparent 2px 18px);
  color: white;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 640px;
  padding: 34px;
}

.hero-copy h2 {
  margin-bottom: 12px;
  font-size: 4.15rem;
  line-height: 1;
}

.hero-copy p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.05rem;
  line-height: 1.35;
  max-width: 560px;
}

.plate-stack {
  position: absolute;
  right: 34px;
  bottom: -22px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  opacity: 0.88;
}

.plate-stack span {
  display: block;
  width: clamp(42px, 9vw, 92px);
  border: 8px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(215, 157, 43, 0.8);
}

.plate-stack span:nth-child(1) { height: 88px; }
.plate-stack span:nth-child(2) { height: 128px; background: rgba(191, 53, 45, 0.9); }
.plate-stack span:nth-child(3) { height: 164px; background: rgba(22, 107, 104, 0.9); }
.plate-stack span:nth-child(4) { height: 112px; background: rgba(52, 122, 67, 0.9); }

.day-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-page {
  margin-bottom: 18px;
}

.routine-library-page,
.exercise-library-page {
  margin-bottom: 18px;
}

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

.builder-heading h2 {
  margin-bottom: 0;
  font-size: 1.65rem;
}

.page-description {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.builder-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.builder-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.builder-card label,
.builder-session-head span,
.builder-choice-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.builder-card input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.builder-people-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(40, 124, 122, 0.24);
  border-radius: 8px;
  background: rgba(40, 124, 122, 0.08);
  padding: 10px;
}

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

.builder-card .builder-choice-grid button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 900;
}

.builder-card .builder-choice-grid button.active {
  border-color: var(--teal);
  background: rgba(40, 124, 122, 0.12);
  color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(40, 124, 122, 0.24);
}

.builder-people-panel[hidden] {
  display: none !important;
}

#builderPeopleFields {
  display: grid;
  gap: 8px;
}

#builderPeopleFields label {
  display: grid;
  gap: 5px;
}

.builder-card button {
  min-height: 42px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.builder-sessions {
  align-content: start;
}

.builder-session {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(226, 234, 241, 0.76);
  padding: 12px;
}

.builder-session + .builder-session {
  margin-top: 10px;
}

.builder-session-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 8px;
  align-items: end;
}

.builder-session-head label {
  display: grid;
  gap: 5px;
}

.builder-exercises {
  display: grid;
  gap: 8px;
}

.builder-exercise {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 76px 86px 58px 68px;
  gap: 6px;
}

.builder-timer-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 110px minmax(0, 1fr) 132px 92px;
  gap: 8px;
  align-items: end;
  border: 1px solid rgba(184, 122, 20, 0.36);
  border-radius: 8px;
  background: rgba(184, 122, 20, 0.12);
  padding: 10px;
}

.builder-timer-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.builder-timer-controls input {
  min-height: 38px;
}

.timer-sound-choice {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.timer-sound-choice button {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.timer-sound-choice button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.timer-remove-button {
  min-height: 38px;
  border-color: rgba(217, 77, 63, 0.32);
  background: white;
  color: var(--red);
}

.builder-exercise .danger {
  border-color: rgba(217, 77, 63, 0.32);
  background: white;
  color: var(--red);
}

.builder-delete-guard {
  grid-column: 1 / -1;
}

.builder-library-picker {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  border: 1px solid rgba(40, 124, 122, 0.28);
  border-radius: 8px;
  background: rgba(40, 124, 122, 0.08);
  padding: 12px;
}

.builder-library-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.builder-library-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.builder-library-head button {
  min-width: 72px;
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.builder-library-folders {
  display: grid;
  gap: 8px;
}

.builder-library-folders details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.builder-library-folders summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 950;
}

.builder-library-folders summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.builder-library-folders details div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px 8px;
}

.builder-library-folders details button {
  min-height: 36px;
  background: rgba(245, 247, 249, 0.82);
  color: var(--ink);
  border-color: var(--line);
  text-align: left;
}

.routine-library-list {
  display: grid;
  gap: 12px;
}

.routine-library-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.routine-library-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.routine-library-card h3 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.routine-library-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.routine-library-card button {
  min-height: 40px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: white;
  padding: 0 12px;
  font-weight: 900;
}

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

.routine-library-card button.danger {
  border-color: rgba(217, 77, 63, 0.28);
  background: white;
  color: var(--red);
}

.routine-library-delete-guard {
  margin: 12px 12px 0;
}

.routine-library-days {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.routine-library-days details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 247, 249, 0.74);
}

.routine-library-days summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 950;
}

.routine-library-days summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.routine-library-days ul {
  margin: 0;
  padding: 0 12px 12px 30px;
  color: var(--muted);
}

.empty-library {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
  color: var(--muted);
  font-weight: 850;
}

.home-page {
  margin-bottom: 18px;
}

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

.home-heading h2 {
  margin-bottom: 0;
  font-size: 1.65rem;
}

.home-day-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.home-workout-card {
  display: grid;
  min-height: 148px;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 16px;
  box-shadow: var(--shadow);
}

.home-day-button {
  display: grid;
  width: 100%;
  align-content: start;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.home-day-button span {
  font-size: 1.45rem;
  font-weight: 950;
}

.home-day-button b {
  display: inline-grid;
  width: fit-content;
  min-width: 50px;
  min-height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 4px 8px;
}

.home-day-button small {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.35;
}

.home-day-button:hover {
  color: var(--teal);
}

.home-workout-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-self: end;
}

.home-workout-actions button {
  width: 74px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: 900;
}

.home-workout-actions button.danger {
  border-color: rgba(217, 77, 63, 0.28);
  color: var(--red);
}

.plan-delete-guard {
  grid-template-columns: minmax(0, 1fr) 82px 58px;
}

.plan-delete-guard.final {
  grid-template-columns: repeat(3, 1fr);
  justify-content: start;
}

.plan-delete-guard.final button {
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  line-height: 1.15;
}

.plan-delete-guard.final button:first-of-type {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.plan-delete-guard.final button:nth-of-type(2) {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.plan-delete-guard.final button:last-child {
  background: white;
  color: var(--ink);
}

.calendar-page {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.calendar-heading h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.calendar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.calendar-weekday,
.calendar-day {
  min-height: 96px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
}

.calendar-weekday {
  min-height: auto;
  background: rgba(21, 23, 29, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-align: center;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 8px;
  background: white;
}

.calendar-day.muted {
  background: rgba(245, 247, 249, 0.64);
}

.calendar-day.has-entries {
  cursor: pointer;
}

.calendar-day.has-entries:hover {
  background: rgba(235, 242, 246, 0.95);
}

.calendar-day b {
  font-size: 0.9rem;
}

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

.calendar-entry {
  display: block;
  width: 100%;
  border: 1px solid rgba(22, 108, 106, 0.2);
  border-radius: 8px;
  background: rgba(40, 124, 122, 0.14);
  color: var(--teal);
  padding: 4px 6px;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: left;
  overflow-wrap: anywhere;
}

.calendar-entry strong,
.calendar-entry span {
  display: block;
}

.calendar-entry strong {
  color: var(--ink);
  font-size: 0.72rem;
}

.calendar-entry span {
  margin-top: 2px;
  color: var(--teal);
  font-size: 0.7rem;
}

.calendar-entry:hover {
  border-color: rgba(22, 108, 106, 0.42);
  background: rgba(40, 124, 122, 0.22);
}

.calendar-detail-wrap {
  padding: 16px;
}

.calendar-detail-wrap:empty {
  display: none;
}

.calendar-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calendar-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.calendar-detail-head h3 {
  margin: 0 0 4px;
  font-size: 1.45rem;
}

.calendar-detail-head p:last-child {
  color: var(--muted);
  font-weight: 800;
}

.calendar-detail-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.calendar-detail-exercise {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(235, 242, 246, 0.82);
  padding: 12px;
}

.calendar-detail-exercise h4 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.calendar-detail-exercise div {
  display: grid;
  gap: 6px;
}

.calendar-detail-exercise span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.tab-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}

.tab-button span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.tab-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.tab-button.active span {
  color: rgba(255, 255, 255, 0.74);
}

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

.exercise-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.session-actions {
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(226, 234, 241, 0.76);
  padding: 16px;
}

.session-actions button,
.create-row button,
.library-add-button,
.small-button {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.session-actions p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.create-box,
.library-box {
  padding: 18px;
}

.create-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
}

.create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

.create-row input,
.create-row select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 8px 10px;
  background: white;
}

.create-row button {
  min-height: 46px;
}

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

.library-heading h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.library-heading span {
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 950;
}

.library-list {
  display: grid;
  gap: 8px;
}

.library-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.library-section-card {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 14px;
  text-align: left;
  font-weight: 950;
}

.library-section-card b {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.library-section-open {
  display: grid;
  gap: 10px;
}

.library-section-open-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(226, 234, 241, 0.76);
  padding: 12px;
}

.library-section-open-head h3 {
  margin: 0;
  font-size: 1.35rem;
}

.library-folder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 247, 249, 0.72);
  overflow: hidden;
}

.library-folder summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 950;
}

.library-folder summary::marker {
  color: var(--teal);
}

.library-folder summary b {
  display: grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 0.78rem;
}

.library-folder-list {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
}

.library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 54px 66px;
  gap: 6px;
}

.library-name-display {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 800;
}

.library-folder-list button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  font-weight: 800;
}

.library-name-button {
  min-width: 0;
}

.library-mini-button {
  text-align: center;
  font-size: 0.78rem;
}

.library-mini-button.danger {
  border-color: rgba(217, 77, 63, 0.28);
  color: var(--red);
}

.library-folder-list button:hover {
  border-color: var(--teal);
}

.delete-guard {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) 74px 58px;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(217, 77, 63, 0.32);
  border-radius: 8px;
  background: rgba(217, 77, 63, 0.08);
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 900;
}

.delete-guard button {
  min-height: 32px;
  padding: 4px 8px;
  text-align: center;
}

.delete-guard button:first-of-type {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.delete-guard button:last-child {
  background: white;
  color: var(--ink);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.65rem;
}

.session-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.date-field {
  display: flex;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  align-items: center;
}

.date-field span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.date-field input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 6px 8px;
  font-weight: 850;
}

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

.text-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
}

.text-button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.text-button.danger {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.exercise-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.session-prep {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 14px 0;
}

.session-prep button {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(184, 122, 20, 0.48);
  border-radius: 8px;
  background: rgba(184, 122, 20, 0.22);
  color: #6f4300;
  padding: 10px 12px;
  font-weight: 950;
}

.session-prep b {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 0.76rem;
  line-height: 1;
}

.session-prep button.checked {
  border-color: rgba(52, 122, 67, 0.46);
  background: rgba(52, 122, 67, 0.2);
  color: var(--green);
}

.session-prep button.checked b::before {
  content: "✓";
}

.exercise-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

.exercise-item.done {
  border-color: rgba(52, 122, 67, 0.56);
  background: rgba(52, 122, 67, 0.12);
}

.check-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: white;
  color: transparent;
  font-size: 0.7rem;
  font-weight: 900;
}

.exercise-item.done .check-button {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.exercise-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

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

.exercise-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.exercise-actions {
  display: grid;
  grid-template-columns: 96px 74px 68px;
  gap: 8px;
  align-items: end;
}

.small-button {
  min-height: 38px;
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.small-button:hover {
  border-color: var(--teal);
}

.routine-edit-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 247, 249, 0.82);
}

.routine-edit-menu button,
.routine-lookup button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: 850;
}

.routine-edit-menu .danger {
  border-color: rgba(217, 77, 63, 0.28);
  color: var(--red);
}

.routine-delete-guard {
  margin-top: 8px;
}

.routine-lookup {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(40, 124, 122, 0.24);
  border-radius: 8px;
  background: rgba(40, 124, 122, 0.08);
}

.routine-lookup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.routine-lookup-head button {
  min-width: 66px;
}

.routine-lookup details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.routine-lookup summary {
  min-height: 36px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 950;
}

.routine-lookup details div {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
}

.exercise-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.set-selector {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.set-selector select {
  min-width: 68px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 8px;
  font-weight: 900;
}

.set-log {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.set-row {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(184, 196, 209, 0.95);
  border-radius: 8px;
  background: rgba(226, 234, 241, 0.74);
}

.set-row-head {
  display: grid;
  gap: 6px;
}

.set-number {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 950;
}

.previous-line {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.person-set-stack {
  display: grid;
  gap: 8px;
}

.person-set-line {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(92px, 120px) minmax(78px, 100px);
  gap: 8px;
  align-items: end;
}

.person-set-line.single-lifter {
  grid-template-columns: minmax(120px, 1fr) minmax(78px, 100px);
}

.person-set-line.has-timer {
  grid-template-columns: minmax(90px, 1fr) minmax(92px, 120px) minmax(78px, 100px) 110px;
}

.person-set-line.single-lifter.has-timer {
  grid-template-columns: minmax(120px, 1fr) minmax(78px, 100px) 110px;
}

.person-set-line strong {
  padding-bottom: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.set-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.set-row input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 6px 8px;
  font-weight: 850;
}

.timer-start-button {
  min-height: 36px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--gold);
  color: white;
  padding: 6px 8px;
  font-weight: 900;
}

.timer-start-button:disabled {
  opacity: 0.85;
}

.library-add-button {
  width: auto;
  min-height: 38px;
  margin-top: 10px;
  padding: 0 12px;
  border-color: rgba(184, 122, 20, 0.5);
  background: rgba(184, 122, 20, 0.22);
  color: #6f4300;
}

.prep-list {
  display: grid;
  gap: 7px;
  min-width: 120px;
}

.prep-list button {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: rgba(215, 157, 43, 0.16);
  color: #81580b;
  font-size: 0.78rem;
  font-weight: 900;
}

.prep-list b {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 0.68rem;
  line-height: 1;
}

.prep-list button.checked {
  background: rgba(75, 140, 86, 0.14);
  color: var(--green);
}

.prep-list button.checked b::before {
  content: "✓";
}

.session-finish {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  border-top: 1px solid var(--line);
  background: rgba(245, 247, 249, 0.48);
  padding: 14px;
}

.notes-box {
  display: grid;
  align-content: start;
  gap: 8px;
}

.notes-box label {
  font-weight: 900;
}

.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(40, 124, 122, 0.32);
  outline-offset: 2px;
}

@media (max-width: 840px) {
  .topbar,
  .workout-grid {
    grid-template-columns: 1fr;
  }

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

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

  .calendar-grid {
    min-width: 720px;
  }

  .calendar-page {
    overflow-x: auto;
  }

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1160px);
    padding-top: 18px;
  }

  .brand-block {
    align-items: flex-start;
  }

  .mark {
    width: 48px;
    height: 48px;
  }

  .hero-copy {
    padding: 22px;
  }

  .hero-copy h2 {
    font-size: 3rem;
  }

  .hero-copy p {
    max-width: 360px;
    font-size: 0.98rem;
  }

  .plate-stack {
    right: -18px;
    opacity: 0.42;
  }

  .day-tabs {
    grid-template-columns: 1fr;
  }

  .home-day-grid {
    grid-template-columns: 1fr;
  }

  .library-section-grid {
    grid-template-columns: 1fr;
  }

  .home-heading,
  .calendar-heading,
  .library-section-open-head {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .builder-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .routine-library-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .builder-session-head,
  .builder-exercise {
    grid-template-columns: 1fr;
  }

  .builder-timer-controls,
  .timer-sound-choice {
    grid-template-columns: 1fr;
  }

  .builder-library-head {
    flex-direction: column;
  }

  .builder-library-folders details div {
    grid-template-columns: 1fr;
  }

  .exercise-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .session-prep {
    grid-template-columns: 1fr;
  }

  .session-finish {
    grid-template-columns: 1fr;
  }

  .exercise-main,
  .set-row {
    grid-template-columns: 1fr;
  }

  .person-set-line,
  .person-set-line.single-lifter,
  .person-set-line.has-timer,
  .person-set-line.single-lifter.has-timer {
    grid-template-columns: 1fr;
  }

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

  .routine-edit-menu {
    grid-template-columns: 1fr;
  }

  .plan-delete-guard,
  .plan-delete-guard.final {
    grid-template-columns: 1fr;
  }

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

.app-dialog {
  width: min(440px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(21, 23, 29, 0.28);
}

.app-dialog::backdrop {
  background: rgba(21, 23, 29, 0.56);
}

.app-dialog-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: white;
}

.app-dialog-card h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

.app-dialog-card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.app-dialog-card p.dialog-message-strong {
  color: var(--ink);
  font-weight: 900;
}

.app-dialog-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.app-dialog-field input,
.app-dialog-field textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  font-weight: 850;
}

.app-dialog-field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

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

.app-dialog-choices[hidden] {
  display: none !important;
}

.app-dialog-choices button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 247, 249, 0.88);
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  font-weight: 900;
}

.app-dialog-choices button:hover,
.app-dialog-choices button:focus-visible {
  border-color: var(--teal);
  background: rgba(40, 124, 122, 0.1);
}

.app-dialog-choices button.active {
  border-color: var(--teal);
  background: rgba(40, 124, 122, 0.14);
  color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(40, 124, 122, 0.22);
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
