/* ============================================================
   Peptide Planner — page styles
   ------------------------------------------------------------
   Uses theme tokens from shared.css. No new CSS variables
   introduced. Components built here:
     - .calc-shell--xwide  (wider variant for the planner)
     - .compound-grid      (compound selector tiles)
     - .vial-row           (vial-size + bac-water + concentration)
     - .schedule-table     (the editable phases table)
     - .summary-strip      (totals readout)
     - .pk-section         (chart wrapper + caption)
     - .pk-note            (caveat panel for non-PK compounds)
     - .info-card--compound (compound-specific notes + sources)
   ============================================================ */

/* ---------- Wider shell for the planner ---------- */
.calc-shell.calc-shell--xwide {
  max-width: 920px;
}

@media (max-width: 600px) {
  .calc-shell.calc-shell--xwide {
    margin-top: 80px;
    padding: 0 12px;
  }
}

/* ---------- Section rhythm ---------- */
/* Each step (Compound / Vial setup / Titration schedule) needs vertical
   separation from the section above it; without this the schedule header and
   its controls butt against the vial setup. */
.step { margin-top: 26px; }
.step:first-of-type { margin-top: 18px; }

/* ---------- Compound selector grid ---------- */
/* The big group (GLP-1) takes its own full-width row; the small groups size to
   their content and flow left-to-right, packing as many per row as fit. */
.compound-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 18px;
  align-items: flex-start;
}

.compound-group-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.compound-group-card--wide { flex: 1 1 100%; }

.compound-group__label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

/* Small groups: fixed-width tiles in a row, so each block sizes to its content. */
.compound-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.compound-tile { width: 152px; box-sizing: border-box; }

/* Big group: tiles stretch to fill its full-width row. */
.compound-group-card--wide .compound-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 8px;
}
.compound-group-card--wide .compound-tile { width: auto; }

@media (max-width: 600px) {
  .compound-grid { gap: 12px; }
  .compound-group-card,
  .compound-group-card--wide { flex: 1 1 100%; }
}

.compound-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  min-height: 110px;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}

.compound-tile:hover {
  border-color: var(--accent);
  background: var(--bg-subtle);
}

.compound-tile:active { transform: translateY(1px); }

.compound-tile.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.compound-tile__name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.compound-tile__brands {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.compound-tile.selected .compound-tile__brands { color: var(--accent); opacity: 0.85; }

.compound-tile__class {
  font-size: 0.66rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-top: 5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.compound-tile.selected .compound-tile__class {
  color: var(--accent);
  opacity: 0.7;
}

/* ---------- Vial setup row ---------- */
.vial-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

@media (max-width: 600px) {
  .vial-row {
    grid-template-columns: 1fr 1fr;
  }
  .vial-field--derived { grid-column: 1 / -1; }
}

.vial-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vial-field label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.vial-field__input-wrap {
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  transition: border-color 0.12s ease;
}

.vial-field__input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.vial-field__input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 10px 0 10px 12px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1rem;
  font-weight: 500;
  /* hide number-input spinners */
  -moz-appearance: textfield;
}

.vial-field__input-wrap input::-webkit-outer-spin-button,
.vial-field__input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.vial-field__unit {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9rem;
  border-left: 1px solid var(--border);
  margin: 4px 0;
}

.vial-field--derived {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 160px;
}

.vial-field__derived-label {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.vial-field__derived-value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

/* ---------- Schedule editor ---------- */
.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 8px;
}

.schedule-header .step__label { margin-bottom: 0; }

/* Right-side controls: dose-mode toggle + reset button, evenly spaced and
   vertically aligned to a common height. */
.schedule-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ghost {
  font-family: inherit;
  font-size: 0.82rem;
  height: 30px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.schedule-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.schedule-table thead {
  background: var(--bg-subtle);
}

.schedule-table th {
  text-align: left;
  padding: 10px 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-bottom: 1.5px solid var(--border-strong);
  white-space: nowrap;
}

.schedule-table .schedule-table__derived-col { color: var(--text-muted); }

/* The derived values are right-aligned, so right-align their headers too,
   otherwise the (left-aligned) label sits away from the number under it. */
.schedule-table th.schedule-table__derived-col { text-align: right; }

.schedule-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.schedule-table tbody tr:last-child td { border-bottom: none; }

.schedule-table tbody tr:hover { background: var(--bg-subtle); }

/* Inline editable inputs in table cells */
.schedule-cell-input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  -moz-appearance: textfield;
}

.schedule-cell-input:hover { border-color: var(--border); }
.schedule-cell-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

.schedule-cell-input::-webkit-outer-spin-button,
.schedule-cell-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

.schedule-cell-weeks {
  display: flex;
  align-items: center;
  gap: 4px;
}

.schedule-cell-weeks input {
  width: 56px;
  text-align: right;
}

.schedule-cell-weeks .dash {
  color: var(--text-faint);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.schedule-cell-dose {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.schedule-cell-dose input { width: 64px; text-align: right; }

.schedule-cell-dose .unit {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.schedule-cell-freq select {
  width: 100%;
  padding: 6px 6px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.schedule-cell-freq select:hover { border-color: var(--border); }
.schedule-cell-freq select:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus-ring); }

.schedule-cell-derived {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.btn-delete-row {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-faint);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease, background 0.12s ease;
}

.btn-delete-row:hover { color: var(--danger); background: var(--danger-soft); }

.btn-delete-row svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.btn-add-row {
  margin-top: 10px;
  padding: 9px 14px;
  background: transparent;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.btn-add-row:hover {
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-add-row span {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  margin-right: 4px;
}

/* ---------- Schedule warnings ---------- */
.schedule-warnings {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--danger-soft);
  border-left: 3px solid var(--danger);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--danger);
}

.schedule-warnings ul { margin: 0; padding-left: 18px; }
.schedule-warnings li { margin: 2px 0; }
.schedule-warnings.hidden { display: none; }

/* ---------- Summary stats strip ---------- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 22px;
  padding: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
}

.summary-stat__label {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.summary-stat__value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.summary-stat--primary .summary-stat__value { color: var(--accent); }

@media (max-width: 600px) {
  .summary-stat__value { font-size: 1.15rem; }
}

/* ---------- PK chart section ---------- */
.pk-section {
  margin-top: 22px;
  padding: 16px 16px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pk-section.hidden { display: none; }

.pk-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.pk-section__caption {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.pk-chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}

@media (max-width: 600px) {
  .pk-chart-wrap { height: 220px; }
}

.pk-note {
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--text-faint);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.pk-note.hidden { display: none; }
.pk-note strong { color: var(--text); }

/* Plain-language explainer beneath the PK chart */
.pk-explainer {
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-faint);
}

.pk-explainer strong { color: var(--text-muted); }

/* ---------- Actions row ---------- */
/* ---------- Share (matches the other calculators' calc.css exactly) ---------- */
.share-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.share-btn:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.share-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.share-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-url-wrapper {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  word-break: break-all;
}

.share-url-wrapper.hidden { display: none; }

.share-url-wrapper .share-url-text {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--accent);
  display: block;
  padding-right: 60px;
}

.share-url-wrapper .copy-confirmation {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

.share-url-wrapper .copy-confirmation.show {
  animation: copy-fade 1.6s ease-in-out;
}

@keyframes copy-fade {
  0% { opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- Compound info card ---------- */
.info-card--compound {
  margin-top: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.info-card--compound summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.12s ease;
}

.info-card--compound summary::-webkit-details-marker { display: none; }
.info-card--compound summary:hover { background: var(--bg-subtle); }

.info-card--compound summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-faint);
  flex-shrink: 0;
}

.info-card--compound[open] summary::after { content: "−"; }

.info-card__body {
  padding: 4px 18px 18px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.info-card__body p { margin: 0 0 12px; }

.info-card__sources {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
  font-size: 0.82rem;
}

.info-card__sources-title {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  display: block;
  margin-bottom: 6px;
}

.info-card__sources ul {
  margin: 0;
  padding-left: 18px;
}

.info-card__sources li {
  margin: 2px 0;
  font-style: italic;
}

/* ---------- Mobile schedule table ---------- */
/* On narrow screens the 7-column table can't fit, so instead of hiding the
   derived values we reflow each phase into a stacked card: editable inputs and
   computed values each on their own labeled line. */
@media (max-width: 720px) {
  .schedule-wrap {
    overflow-x: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }

  .schedule-table { font-size: 0.9rem; }
  .schedule-table thead { display: none; }
  .schedule-table,
  .schedule-table tbody { display: block; width: 100%; }

  .schedule-table tr {
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2px 14px;
    margin-bottom: 10px;
  }
  .schedule-table tbody tr:hover { background: var(--bg-elevated); }

  .schedule-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 0;
    border: none;
    border-bottom: 1px solid var(--border);
  }
  .schedule-table tr td:last-child { border-bottom: none; }

  /* Column name as a left-hand label, drawn from each cell's data-label. */
  .schedule-table td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
  }

  /* Derived columns are visible again in this layout. */
  .schedule-table__derived-col { display: flex; }
  .schedule-cell-derived { text-align: right; }
  .component-breakdown { align-items: flex-end; }

  /* Inputs sit on the right of each line. */
  .schedule-cell-weeks,
  .schedule-cell-dose { justify-content: flex-end; }
  .schedule-cell-weeks input { width: 52px; }
  .schedule-cell-dose input { width: 64px; }
  .schedule-cell-freq { flex: 1; max-width: 60%; }
  .schedule-cell-freq select { width: 100%; }

  /* The actions cell has no label; just right-align the delete button. */
  .schedule-table__action-col { justify-content: flex-end; }
  .schedule-table__action-col::before { content: none; }

  /* Space saver for single compounds: show the three derived values
     (Volume / Units / Total mg) as a 3-column group with a small label above
     each value, sharing one divider band. Mirrors the desktop column headers,
     so no per-value unit suffix is needed. Blends keep stacked rows because
     their third value is a multi-line per-component breakdown. The frequency
     row's bottom border and the action row's top border frame the band. */
  .schedule-table:not(.is-blend) td.schedule-cell-derived {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0;
    width: 33.33%;
    padding: 9px 0 4px;
    border-bottom: none;
    text-align: left;
    vertical-align: top;
    font-size: 0.86rem;
    color: var(--text-muted);
  }
  /* Small label sits above its value (uses the cell's data-label via the
     general td::before rule); just tighten it for the compact group. */
  .schedule-table:not(.is-blend) td.schedule-cell-derived::before {
    font-size: 0.6rem;
    margin-bottom: 3px;
  }
  .schedule-table:not(.is-blend) td[data-derived="units"]::after { content: none; }
  .schedule-table:not(.is-blend) .schedule-table__action-col {
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }
}

/* ============================================================
   Blend support (GLOW / KLOW / Wolverine)
   ============================================================ */

/* A subtle marker on blend tiles in the selector grid. */
.compound-tile--blend .compound-tile__class {
  color: var(--accent);
  opacity: 0.85;
}

/* ---------- Blend vial setup (editable components) ---------- */
.blend-setup__label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.blend-setup__hint {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.8rem;
}

.blend-components {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.blend-component {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.blend-component__name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.blend-component__input-wrap {
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  transition: border-color 0.12s ease;
}

.blend-component__input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.blend-component__input {
  flex: 1;
  min-width: 0;
  padding: 8px 0 8px 10px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 500;
  -moz-appearance: textfield;
}

.blend-component__input::-webkit-outer-spin-button,
.blend-component__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.blend-component__unit {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  border-left: 1px solid var(--border);
  margin: 4px 0;
}

.vial-row--blend {
  grid-template-columns: 1fr auto;
}

@media (max-width: 600px) {
  .vial-row--blend { grid-template-columns: 1fr; }
}

/* ---------- Dose-mode toggle (units / mL) ---------- */
.dose-mode-toggle {
  display: inline-flex;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.dose-mode-toggle button {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.dose-mode-toggle button + button {
  border-left: 1px solid var(--border);
}

.dose-mode-toggle button:hover { color: var(--accent); }

.dose-mode-toggle button.selected {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Custom frequency ("every N days") ---------- */
.custom-days {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  white-space: nowrap;
}

.custom-days__input {
  width: 46px;
  text-align: right;
}

/* ---------- Per-component breakdown in schedule cell ---------- */
.component-breakdown {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-end;
}

.component-breakdown__item {
  white-space: nowrap;
  font-size: 0.78rem;
}

.component-breakdown__name { color: var(--text-faint); }
.component-breakdown__mg { color: var(--text-muted); font-weight: 600; }

/* ---------- Per-component totals strip (blends) ---------- */
.blend-totals {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.blend-totals__label {
  display: block;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.blend-totals__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.blend-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-radius: 8px;
}

.blend-total__name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.blend-total__value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

/* ============================================================
   Stacking: slot tabs, ester selector, offset control
   ============================================================ */

/* ---------- Slot tabs ---------- */
.slot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.slot-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.slot-tab:hover { border-color: var(--accent); color: var(--text); }

.slot-tab.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.slot-tab__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--border-strong);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
}

.slot-tab.selected .slot-tab__key { background: var(--accent); color: var(--accent-text); }

.slot-tab--add { border-style: dashed; }
.slot-tab--add:hover { background: var(--accent-soft); }
.slot-tab--remove { border-color: var(--border); color: var(--text-faint); }
.slot-tab--remove:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ---------- Ester selector (testosterone) ---------- */
.ester-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ester-select__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ester-select__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.ester-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.ester-btn:hover { border-color: var(--accent); color: var(--text); }

.ester-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.ester-btn__short {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--border-strong);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 600;
}

.ester-btn.selected .ester-btn__short { background: var(--accent); color: var(--accent-text); }

.ester-btn__name { font-size: 0.88rem; font-weight: 500; }

/* ---------- Offset control (under the chart header) ---------- */
.pk-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.pk-controls__text { color: var(--text-muted); }
.pk-controls__b { color: var(--accent); }

.pk-controls__input {
  width: 52px;
  padding: 5px 8px;
  text-align: right;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  -moz-appearance: textfield;
}
.pk-controls__input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.pk-controls__input::-webkit-outer-spin-button,
.pk-controls__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
