/* ---------- published timeframes (progress bars) ---------- */
.tf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.8rem;
  color: var(--text-2);
}
.tf-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tf-key {
  display: inline-block;
  width: 16px;
  height: 8px;
  border-radius: 3px;
}
.tf-key-onset {
  background: color-mix(in srgb, var(--series-1) 45%, transparent);
}
.tf-key-max {
  background: color-mix(in srgb, var(--series-2) 70%, transparent);
}
.tf-key-you {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--text);
}
.tf-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 14px;
}
.tf-row {
  display: grid;
  gap: 5px;
}
.tf-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
}
.tf-bar {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.tf-bar > span {
  position: absolute;
  top: 0;
  bottom: 0;
}
.tf-progress {
  left: 0;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.tf-onset {
  background: color-mix(in srgb, var(--series-1) 45%, transparent);
  border-radius: 6px;
}
.tf-max {
  background: color-mix(in srgb, var(--series-2) 70%, transparent);
  border-radius: 6px;
}
.tf-open {
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--series-2) 70%, transparent), transparent);
}
.tf-you {
  z-index: 1;
  width: 3px;
  margin-left: -1.5px;
  background: var(--text);
  border-radius: 2px;
}
.tf-status {
  color: var(--text-2);
}
.tf-nobar .tf-status {
  color: var(--muted);
}
/* Year scale above the bars: sticks under the top bar while the list scrolls past. */
.tf-axis {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 2;
  margin: 12px -16px 0;
  padding: 8px 16px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tf-axis-title {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.tf-axis-scale {
  position: relative;
  height: 24px;
}
.tf-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 8px;
  background: var(--border-strong, var(--muted));
}
.tf-tick-minor {
  height: 4px;
  opacity: 0.6;
}
.tf-tick-label {
  position: absolute;
  bottom: 10px;
  left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.tf-tick-first .tf-tick-label {
  transform: none;
}
.tf-tick-last {
  margin-left: -1px;
}
.tf-tick-last .tf-tick-label {
  transform: translateX(-100%);
}
.tf-tick-you {
  position: absolute;
  bottom: -4px;
  width: 0;
  height: 0;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--text);
}
/* Year dividers drawn over the bar so every row lines up with the scale. */
.tf-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to right, transparent 0 calc(100% / var(--years) - 2px), var(--surface) calc(100% / var(--years) - 2px) calc(100% / var(--years)));
}
.tf-you-past {
  left: auto !important;
  right: 0;
  width: 0;
  margin: 0;
  background: none;
  border: 6px solid transparent;
  border-right: 0;
  border-left: 7px solid var(--text);
  top: 0;
  bottom: 0;
}

.compare-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 10px 0 0;
}
.lab-delta {
  margin-top: 1px;
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
/* The card a same-day link pointed at, picked out for a moment. */
.card-flash {
  animation: card-flash 1.6s ease-out;
}
@keyframes card-flash {
  from,
  40% {
    box-shadow: 0 0 0 3px var(--accent);
  }
}
.card-derived {
  background: color-mix(in srgb, var(--surface) 70%, var(--surface-2));
}
.badge-auto {
  background: var(--info-soft);
  color: var(--info);
}
.schedule-btn {
  margin-top: 6px;
}

.target-list {
  display: grid;
  gap: 8px;
}
.target-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px auto 80px auto;
  align-items: center;
  gap: 6px;
}
.target-name {
  font-weight: 550;
  font-size: 0.9rem;
}
@media (max-width: 520px) {
  .target-row {
    grid-template-columns: 1fr auto 1fr auto;
  }
  .target-name {
    grid-column: 1 / -1;
  }
}

/* Tables that become stacked cards on phones (cells carry data-label). */
@media (max-width: 560px) {
  .table-stack thead {
    display: none;
  }
  .table-stack,
  .table-stack tbody,
  .table-stack tr {
    display: block;
    width: 100%;
  }
  .table-stack tr {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .table-stack th[scope='row'] {
    grid-column: 1 / -1;
    width: auto;
    padding: 0;
    border: 0;
    color: var(--text);
  }
  .table-stack td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 0;
    border: 0;
    white-space: normal;
  }
  .table-stack td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    color: var(--muted);
  }
}

.grid-2.tight-gap {
  gap: 8px;
}


/* "How to read these charts" disclosure on the Charts page. */
.chart-help {
  margin: 4px 0 16px;
}
.chart-help ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Shown at the top of every page while the in-memory sample person is open. */
.sample-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 16px;
  padding: 10px 12px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.9rem;
}
.sample-banner > svg {
  flex: none;
  color: var(--accent);
}
.sample-banner > span {
  flex: 1;
  min-width: 12ch;
}

/* Feature switches (onboarding and Settings). */
.feature-list {
  display: grid;
  gap: 6px;
}
.feature-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.feature-row:hover {
  background: var(--surface-2);
}
.feature-row:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.feature-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feature-text {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 1px;
}
.feature-text span {
  font-size: 0.82rem;
  color: var(--muted);
}
.feature-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
}

