/* Calibration Studio styles
 *
 * The /calibration pages (Benchmarks, Scenarios, Movement tuning, Scores)
 * and the Tune drawer rendered over a workout's intensity tile.
 *
 * Class selectors only (no element-prefixed selectors).
 */

.calibration-tab-panel {
  padding-top: 0.5rem;
}

/* ---- Benchmarks dashboard ---- */

.calibration-benchmarks {
  width: 100%;
}

.calibration-benchmarks-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.calibration-benchmarks-table th,
.calibration-benchmarks-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-soft, #f1f5f9);
}

.calibration-benchmarks-table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calibration-benchmark-note {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
  margin-top: 0.15rem;
}

.calibration-benchmark-quantity {
  font-weight: 600;
}

.calibration-benchmark-time-fixed {
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  margin-top: 0.1rem;
}

.calibration-benchmark-error-message {
  display: block;
  font-size: 0.8rem;
  color: var(--danger, #b91c1c);
  margin-top: 0.15rem;
}

/* ---- Status pills ---- */

.calibration-status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-raised, #f3f4f6);
  color: var(--text, #111827);
  white-space: nowrap;
}

.calibration-status-in-band {
  background: #dcfce7;
  color: #166534;
}

.calibration-status-slow,
.calibration-status-fast {
  background: #fef3c7;
  color: #92400e;
}

.calibration-status-no-range {
  background: #e5e7eb;
  color: #4b5563;
}

.calibration-status-error {
  background: #fee2e2;
  color: #991b1b;
}

/* ---- Benchmark row actions / edit form ---- */

.calibration-benchmark-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.calibration-benchmark-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 16rem;
}

/* ---- Movement tuning tab ---- */

.calibration-tuning {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Shared by every tab that opens with a line explaining what it shows. */
.calibration-tab-intro {
  color: var(--text-muted, #6b7280);
  max-width: 60ch;
  margin: 0;
}

/* The heading is the UI::Disclosure summary; this only holds it together. */
.calibration-tuning-group {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--calibration-surface, #ffffff);
  overflow: hidden;
}

.calibration-tuning-subgroups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calibration-tuning-subgroup {
  border-top: 1px solid var(--border-soft, #f1f5f9);
  padding-top: 0.5rem;
}

.calibration-tuning-subgroup:first-child {
  border-top: none;
  padding-top: 0;
}

.calibration-tuning-subgroup-heading {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.calibration-tuning-count {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--calibration-surface, #ffffff);
  color: var(--text-muted, #6b7280);
  border: 1px solid var(--border, #e5e7eb);
}

.calibration-tuning-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.5rem;
}

.calibration-tuning-row {
  margin: 0;
  padding: 0;
}

/* The whole card is the link that opens the movement's tuning detail. */
.calibration-tuning-card {
  display: block;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: var(--calibration-surface, #ffffff);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.1s ease, background 0.1s ease;
}

.calibration-tuning-card:hover {
  border-color: var(--accent, #2563eb);
  background: var(--surface-raised, #f9fafb);
}

.calibration-tuning-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.calibration-tuning-profile {
  display: block;
  padding: 0.25rem 0;
  border-top: 1px dashed var(--border-soft, #f1f5f9);
}

.calibration-tuning-profile:first-of-type {
  border-top: none;
  padding-top: 0;
}

.calibration-tuning-values {
  display: block;
  font-size: 0.8rem;
  color: var(--text, #111827);
  font-variant-numeric: tabular-nums;
}

.calibration-tuning-band {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  margin-top: 0.05rem;
}

/* ---- Scope badges ---- */

.calibration-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.calibration-badge-global {
  background: var(--surface-raised, #f3f4f6);
  color: var(--text-muted, #4b5563);
  border: 1px solid var(--border, #e5e7eb);
}

.calibration-badge-company {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* ---- Tune drawer ----
 * The drawer renders only inside the intensity tile (a colored surface whose
 * text already inherits white). The dark theme is scoped to
 * .calibration-drawer-body, which wraps only the calibration card, so it does
 * not override the fork-hint's warning-callout tokens. The tile has no
 * light/dark surface tokens, so these translucent overlays mirror the tile's
 * own panels in intensity.css. The standalone Element-page card has no
 * .calibration-drawer-body ancestor and keeps its light styling.
 */
.calibration-drawer {
  display: block;
}

/* Closed state: the empty host frame must add no box of its own. */
.calibration-drawer:empty {
  display: none;
}

.calibration-drawer-header {
  margin-top: 0.75rem;
}

/* Standard warning callout, built from the design system's alert tokens. */
.calibration-drawer-fork-hint {
  font-size: 0.85rem;
  color: var(--alert-warning-text);
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--alert-warning-bg);
  border-left: 3px solid var(--alert-warning-border);
  border-radius: 4px;
}

.calibration-drawer-body {
  --calibration-surface: transparent;
  --surface-raised: rgba(0, 0, 0, 0.15);
  --border: rgba(255, 255, 255, 0.2);
  --text-muted: rgba(255, 255, 255, 0.72);
  --alert-warning-text: #fde68a;
}

/* ---- Predictions page (was the Scores tab) ---- */

.calibration-scores {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.score-calibration-apply-form {
  display: inline-block;
}

.score-calibration-evidence {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
