.plan-list {
  display: grid;
  gap: 10px;
}
.plan-row {
  display: grid;
  grid-template-columns: 34px minmax(210px, 1fr) 82px 92px 110px 104px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.plan-name strong {
  display: block;
  font-size: 14px;
}
.plan-name small {
  display: block;
  margin-top: 3px;
  color: var(--ink-500);
  font-size: var(--type-caption);
}
.plan-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
@media (max-width: 1100px) {
  .plan-row {
    grid-template-columns: 34px minmax(190px, 1fr) 75px 82px 98px 88px;
  }
}
@media (max-width: 760px) {
  .plan-row {
    grid-template-columns: 32px 1fr 54px 66px;
    gap: 7px;
  }
}
@media (max-width: 760px) {
  .plan-row .unit-cell {
    grid-column: 2 / 4;
  }
}
@media (max-width: 760px) {
  .plan-row .row-actions {
    grid-area: 1 / 4 / 3;
    align-self: stretch;
    flex-direction: column;
  }
}
@media (max-width: 760px) {
  .plan-name strong {
    font-size: 13px;
  }
}
@media (max-width: 760px) {
  .plan-footer {
    align-items: stretch;
    flex-direction: column;
  }
}
@media (max-width: 760px) {
  .plan-footer .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 430px) {
  .plan-row {
    grid-template-columns: 30px 1fr 52px;
  }
}
@media (max-width: 430px) {
  .plan-row .amount-cell {
    grid-column: 3;
  }
}
@media (max-width: 430px) {
  .plan-row .unit-cell {
    grid-column: 2 / 4;
  }
}
@media (max-width: 430px) {
  .plan-row .row-actions {
    grid-area: auto / 1 / auto / 4;
    flex-direction: row;
    justify-content: flex-end;
  }
}
.plan-metrics {
  grid-template-columns: repeat(2, minmax(0px, 1fr));
}
.exercise-session-dialog.large {
  border: 1px solid var(--line);
  color: var(--ink-900);
  width: min(800px, 100% - 28px);
  max-height: calc(100dvh - 40px);
}
.exercise-session-dialog::backdrop {
  background: var(--surface);
  backdrop-filter: blur(5px);
}
.exercise-session-dialog h3 {
  font-size: 14px;
  margin: 0px 0px 6px;
}
.saved-session-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
  margin: 0px;
  color: var(--ink-700);
}
.exercise-session-dialog li {
  font-size: 13px;
  margin: 7px 0px;
}
.exercise-session-dialog .exercise-results {
  min-width: 430px;
}
body:has(.exercise-session-dialog[open]) {
  overflow: hidden;
}
.plan-pocket-label {
  display: block;
  font-size: var(--type-caption);
  color: var(--ink-500);
  margin-top: 8px;
}
.plan-pocket {
  display: block;
  margin-top: 4px;
  max-width: 100%;
}
.plan-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0px;
  font-size: 13px;
  color: var(--muted);
}
.plan-field input {
  width: 100%;
}
.plan-row {
  grid-template-columns: 28px minmax(100px, 1fr) 70px 80px 90px 104px;
  gap: 8px;
}
.plan-name {
  min-width: 0px;
  overflow-wrap: anywhere;
}
@media (max-width: 1099px) {
  .plan-row {
    grid-template-columns: 28px minmax(0px, 1fr) minmax(0px, 1fr);
    gap: 8px;
  }
}
@media (max-width: 1099px) {
  .plan-row .plan-name {
    grid-column: 2 / 4;
  }
}
@media (max-width: 1099px) {
  .plan-row .plan-field {
    grid-area: auto / 2;
  }
}
@media (max-width: 1099px) {
  .plan-row .amount-cell {
    grid-column: 3;
  }
}
@media (max-width: 1099px) {
  .plan-row .unit-cell {
    grid-column: 2 / 4;
  }
}
@media (max-width: 1099px) {
  .plan-row .row-actions {
    grid-area: auto / 1 / auto / 4;
    flex-direction: row;
  }
}
@media (max-width: 1099px) {
  .plan-footer {
    flex-wrap: wrap;
  }
}
@media (max-width: 1099px) {
  .plan-footer .button-row {
    flex-wrap: wrap;
  }
}
@media (max-width: 759px) {
  .plan-footer .button-row {
    display: flex;
  }
}
@media (max-width: 759px) {
  .plan-footer .button-row > * {
    flex: 1 1 0%;
  }
}

/* Start Session: the plan is the primary action; saved sources stay secondary. */
.start-session-page {
  --plan-dock-height: 88px;
  --plan-nav-height: 0px;
  min-width: 0;
}
.start-session-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}
.plan-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.plan-card {
  padding: 20px;
  min-width: 0;
}
.plan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.plan-card-head h2 {
  margin: 0;
}
.plan-next-focus {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.plan-compact-row {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
}
.plan-open-row {
  flex: 1;
  min-width: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px;
  border-radius: 12px;
}
.plan-row-number {
  color: var(--muted);
  font-size: 13px;
  min-width: 18px;
  text-align: center;
}
.plan-row-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.plan-row-copy strong {
  font-size: 15px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.plan-row-copy small {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.plan-add {
  margin-top: 12px;
  width: 100%;
  border: 1px dashed var(--line);
  background: transparent;
}
.plan-use-routine {
  width: 100%;
  margin-top: 10px;
}
.plan-empty {
  text-align: center;
  color: var(--muted);
  margin: 20px 0 28px;
}
.plan-start-bar {
  position: sticky;
  bottom: 12px;
  z-index: 8;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.plan-start-bar > span {
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  overflow-wrap: anywhere;
}
.plan-start-bar .cd-btn {
  min-height: 56px;
  flex-shrink: 0;
}
.plan-sources {
  padding: 16px;
  min-width: 0;
}
.plan-source-tabs {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
}
.plan-source-tabs button {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}
.plan-source-tabs button[aria-pressed='true'] {
  background: var(--raised);
  color: var(--text);
}
.plan-routine-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.plan-source-row {
  display: grid;
  gap: 5px;
  min-width: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 16px 4px;
  text-align: left;
  border-radius: 8px;
}
.plan-source-row strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.plan-source-row span,
.plan-source-row small {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.plan-routine-row > .icon-button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
}
.plan-new-routine {
  width: 100%;
  margin-top: 12px;
}
.plan-source-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 4px;
}
.plan-sheet {
  max-width: 540px;
}
.plan-sheet .modal-head h2 {
  font-size: 22px;
  overflow-wrap: anywhere;
}
.plan-sheet .modal-head .icon-button {
  flex-shrink: 0;
}
.plan-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.plan-number-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.plan-number-stepper .cd-btn {
  padding: 0;
  flex: 0 0 44px;
  min-height: 48px;
}
.plan-number-stepper input {
  width: 100%;
  min-width: 0;
  text-align: center;
  padding: 8px;
}
.plan-editor-actions,
.plan-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.plan-sheet-actions {
  flex-direction: column;
}
.plan-editor-actions > * {
  flex: 1 1 auto;
}
.plan-sheet select {
  width: 100%;
}
@media (max-width: 1099px) {
  .start-session-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .start-session-page {
    padding-bottom: calc(var(--plan-dock-height) + 24px);
  }
  .plan-start-bar {
    position: fixed;
    bottom: var(--plan-nav-height);
    left: calc(var(--sidebar) + var(--page-gutter));
    right: var(--page-gutter);
    margin: 0;
    border-radius: 14px 14px 0 0;
  }
}
@media (max-width: 759px) {
  .plan-card {
    padding: 16px;
  }
  .plan-editor-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .plan-open-row {
    gap: 8px;
    padding: 10px 6px;
  }
  .plan-start-bar .cd-btn {
    padding-inline: 16px;
  }
}

.routine-item-sheet .plan-number-stepper {
  min-height: 40px;
  gap: 0;
  background: var(--raised);
  border-radius: var(--radius-full);
}
:root body .routine-item-sheet .plan-number-stepper .cd-btn,
:root body .routine-item-sheet .plan-number-stepper input {
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 40px;
  padding: 0;
}
:root body .routine-item-sheet .plan-number-stepper .cd-btn {
  min-width: 44px;
  font-size: 20px;
}
:root body .routine-item-sheet .plan-number-stepper input {
  appearance: textfield;
  font: 700 22px var(--font-number);
}
:root body .routine-item-sheet .plan-number-stepper input::-webkit-inner-spin-button {
  appearance: none;
}
.routine-item-order,
.routine-item-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.routine-item-order > span {
  margin-inline-end: auto;
}
:root body .routine-item-order .cd-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
}
.routine-item-footer {
  justify-content: space-between;
  flex-wrap: wrap;
}
.routine-item-footer .remove-plan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--bad-text, var(--bad));
  font: inherit;
}

.plan-sources-flat {
  padding-inline: 0;
}
.plan-sources-flat .library-folder {
  padding-block: 0;
  border-radius: 0;
}
.plan-sources-flat .library-folder summary,
.plan-sources-flat .library-item {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}
.plan-sources-flat .library-item {
  align-items: center;
  padding-bottom: 0;
}
.plan-sources-flat .plan-routine-row {
  border-bottom: 0;
}
:root body .plan-sources-flat :is(.library-item-tools, .library-folder-controls) > button {
  border: 0;
  background: transparent;
}

.exercise-session-dialog [data-set-duration] {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.straight-scoresheet td:first-child > small {
  display: block;
  font: 500 12px/16px var(--font-text);
  color: var(--ink-muted);
  white-space: nowrap;
}
