/* ----- Schedules: form grid + table -------------------------------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--t-space-4);
}

/* New/edit schedule form, every row shares one 3-column grid so the
   fields line up across rows (Row 1 was thirds, Rows 2/3 were halves, so
   the edges didn't match). The active-window control spans the two right
   columns; the enabled toggle bottom-aligns with the priority input. */
.schedule-form .field-grid { grid-template-columns: repeat(3, 1fr); }
.schedule-form .sf-window { grid-column: span 2; }
.schedule-form .sf-meta { align-items: end; }

@media (max-width: 720px) {
  .schedule-form .field-grid { grid-template-columns: 1fr; }
  .schedule-form .sf-window { grid-column: auto; }
}

/* Conditions + fallback block. Lives outside the 3-column form grid so
   the picker has the full form width to render its rows. The disclosure
   summary stays compact; the open body stacks the two fields vertically
   so the picker can breathe and the fallback select sits beneath it. */
.schedule-form .sf-conditions {
  margin: 0;
}
.schedule-form .sf-conditions > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  padding: var(--t-space-2) 0;
  color: var(--t-fg, #1B1A16);
}
.schedule-form .sf-conditions-body {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-4);
  margin-top: var(--t-space-2);
}

/* "optional" tag beside a field label. */
.field-opt {
  font-size: var(--t-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t-muted);
  margin-left: var(--t-space-2);
}

/* Active window: two time inputs read as one "start to end" control. */
.sf-window-pair {
  display: flex;
  align-items: center;
  gap: var(--t-space-2);
}
.sf-window-pair input[type="time"] {
  flex: 1 1 0;
  min-width: 0;
}
.sf-window-dash {
  flex: 0 0 auto;
  color: var(--t-muted);
  font-size: var(--t-size-sm);
}

.dow-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--t-space-2);
  margin-top: 2px;
}

.dow-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--t-space-1);
  padding: var(--t-space-1) var(--t-space-3);
  border-radius: var(--t-radius-pill);
  border: 1px solid var(--t-border-strong);
  background: var(--t-surface);
  cursor: pointer;
  font-size: var(--t-size-sm);
  font-weight: 500;
  user-select: none;
  transition: background var(--t-trans-fast), color var(--t-trans-fast),
              border-color var(--t-trans-fast), transform var(--t-trans-fast);
}
.dow-chip:hover {
  border-color: var(--t-accent);
  color: var(--t-accent);
  transform: translateY(-1px);
}
.dow-chip:has(input:checked) {
  background: var(--t-accent);
  color: var(--t-accent-fg);
  border-color: var(--t-accent);
  box-shadow: var(--t-shadow-sm),
              inset 0 1px 0 rgba(255,255,255,.28);
}
.dow-chip input {
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-size-md);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: var(--t-space-3);
  border-bottom: 1px solid var(--t-border);
  /* Middle-align so every cell in a row lines up on one baseline -
     rows mix single-line (page, state) and two-line (cadence window)
     content, and top-align made them look ragged. */
  vertical-align: middle;
}

/* Keep the secondary line tight under its primary in two-line cells. */
.data-table .col-page,
.data-table .col-last,
.data-table .col-state { white-space: nowrap; }

.data-table th {
  font-size: var(--t-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t-muted);
  background: var(--t-surface-soft);
}

.data-table tr.is-disabled td { opacity: 0.55; }
.data-table tr.is-stale td { background: color-mix(in oklab, var(--t-danger) 8%, transparent); }
.data-table .muted-row { color: var(--t-muted); font-size: var(--t-size-xs); margin-top: 2px; }
.data-table .actions-col {
  white-space: nowrap;
  width: 1%;
}
.data-table .actions-col form.inline { display: inline-block; margin: 0 2px 0 0; }
.data-table .actions-col .ghost-link {
  display: inline-block;
  padding: var(--t-space-2) var(--t-space-3);
  font-size: inherit;
  color: var(--t-fg-soft);
  text-decoration: none;
  border-radius: var(--t-radius-sm);
}
.data-table .actions-col .ghost-link:hover { color: var(--t-accent); }

button.ghost.danger { color: var(--t-danger); }
button.ghost.danger:hover { color: var(--t-danger); text-decoration: underline; }

/* Schedules table, progressively drop columns as the viewport
   narrows so the table fits without horizontal scroll. The Name +
   Cadence + Actions columns are the essentials; everything else
   gets hidden first. */
@media (max-width: 900px) {
  .schedules-table .col-last,
  .schedules-table .col-state { display: none; }
}
@media (max-width: 700px) {
  .schedules-table .col-page,
  .schedules-table .col-days { display: none; }
  /* Collapse the action button labels to icons only. */
  .schedules-table .actions-col button > span,
  .schedules-table .actions-col a > span { display: none; }
  .schedules-table .actions-col button,
  .schedules-table .actions-col .ghost-link {
    padding: var(--t-space-2);
    min-width: 32px;
  }
}
@media (max-width: 500px) {
  /* Tighten further on phones: smaller font, tighter cells. */
  .data-table { font-size: var(--t-size-sm); }
  .data-table th,
  .data-table td { padding: var(--t-space-2); }
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: var(--t-space-2);
  padding: var(--t-space-2) var(--t-space-4);
  color: var(--t-fg-soft);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--t-radius-sm);
}
.ghost-link:hover { color: var(--t-accent); background: var(--t-surface-soft); }
.ghost-link .ph { font-size: 14px; }

.muted { color: var(--t-muted); }

/* Pill: small status / tag chip used in the schedules + rotations
   index tables. The base sets the shape + neutral background; the
   ``is-*`` modifiers swap in tone colours via color-mix so they stay
   readable against every theme without hand-tuned hex per variant. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--t-space-1);
  padding: 2px var(--t-space-2);
  border-radius: var(--t-radius-pill);
  background: color-mix(in oklab, var(--t-fg, #1B1A16) 7%, transparent);
  color: var(--t-fg-soft, var(--t-muted));
  font-size: var(--t-size-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.pill .ph { font-size: 12px; }
.pill.is-ok {
  background: color-mix(in oklab, var(--t-ok) 18%, transparent);
  color: color-mix(in oklab, var(--t-ok) 70%, var(--t-fg, #1B1A16));
}
.pill.is-warn {
  background: color-mix(in oklab, var(--t-warn) 18%, transparent);
  color: color-mix(in oklab, var(--t-warn) 70%, var(--t-fg, #1B1A16));
}
.pill.is-danger {
  background: color-mix(in oklab, var(--t-danger) 18%, transparent);
  color: color-mix(in oklab, var(--t-danger) 70%, var(--t-fg, #1B1A16));
}
.pill.is-accent {
  background: color-mix(in oklab, var(--t-accent) 18%, transparent);
  color: color-mix(in oklab, var(--t-accent) 75%, var(--t-fg, #1B1A16));
}
/* Held / waiting state: a warm dusty rose so it reads "paused", not
   alarming. Sits next to is-warn without competing for attention. */
.pill.is-held {
  background: color-mix(in oklab, #A66161 18%, transparent);
  color: color-mix(in oklab, #A66161 75%, var(--t-fg, #1B1A16));
}

/* ----- Schedules timeline ------------------------------------------ */

.timeline {
  display: grid;
  gap: var(--t-space-2);
  padding-top: var(--t-space-6);
  position: relative;
}

/* "Now" line, vertical accent stripe spanning every row's track.
   Positioned via --now-pct (set inline on .timeline). The line lives
   in a strip that mirrors the track lane: the 180px label column is
   skipped by offsetting `left` past the gutter + gap, and width then
   spans the remaining row area. */
.timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(180px + var(--t-space-3));
  width: calc(100% - 180px - var(--t-space-3));
  pointer-events: none;
  z-index: 1;
}
.timeline-now::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--now-pct, 0%);
  width: 2px;
  margin-left: -1px;
  background: var(--t-accent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--t-accent) 25%, transparent);
}
.timeline-now-label {
  position: absolute;
  top: 0;
  left: var(--now-pct, 0%);
  transform: translateX(-50%);
  padding: 1px 6px;
  background: var(--t-accent);
  color: var(--t-bg, #fff);
  font: 700 10px/1.2 var(--t-font-mono, ui-monospace);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 2px;
  white-space: nowrap;
}
.timeline-axis {
  position: relative;
  height: 16px;
  margin-left: 180px;
  border-bottom: 1px dashed var(--t-border);
  margin-bottom: var(--t-space-1);
}
.timeline-tick {
  position: absolute;
  top: -18px;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
}
.timeline-tick::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 1px;
  height: 6px;
  background: var(--t-border);
}
.timeline-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: var(--t-space-3);
  min-height: 30px;
}
.timeline-row.is-disabled { opacity: 0.45; }
.timeline-label {
  display: inline-flex;
  align-items: center;
  gap: var(--t-space-2);
  font-size: var(--t-size-sm);
  color: var(--t-fg-soft);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: var(--t-space-1) var(--t-space-2);
  border-radius: var(--t-radius-sm);
}
.timeline-label:hover { background: var(--t-surface-sunk); color: var(--t-accent); }
.timeline-label .ph { font-size: 13px; opacity: 0.7; }
.timeline-track {
  position: relative;
  height: 22px;
  background: var(--t-surface-soft);
  border-radius: var(--t-radius-pill);
  overflow: hidden;
}
.timeline-fire {
  position: absolute;
  top: 3px;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--t-accent);
  transform: translateX(-50%);
}
.timeline-row.is-disabled .timeline-fire { background: var(--t-muted); }

@media (max-width: 720px) {
  .timeline-row { grid-template-columns: 120px 1fr; }
  .timeline-axis { margin-left: 132px; }
  .timeline-now {
    left: calc(120px + var(--t-space-3));
    width: calc(100% - 120px - var(--t-space-3));
  }
}


/* Smart-sync indicator dot on the schedule list (issue #10).
   Three states, surfaced as colour via the `--{state}` modifier:
     warming, schedule has smart_sync on but no bound device is
              trusted yet, scheduler falls back to interval cadence
     active,  at least one bound device is trusted; JIT firing is live
     blocked, smart_sync is on but the schedule has no device bindings,
              or none of the bindings will ever publish telemetry */
.smart-sync-dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  margin-right: 0.45em;
  vertical-align: middle;
  background: var(--t-muted);
}
.smart-sync-dot--active  { background: var(--t-ok, #4eb87d); }
.smart-sync-dot--warming { background: var(--t-warn, #d49a3a); }
.smart-sync-dot--blocked { background: var(--t-danger, #c34d3a); }

/* ----- Rotations ---------------------------------------------------- */

.rotations-list {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-4);
  margin-bottom: var(--t-space-4);
}

.rotation-card {
  padding: var(--t-space-4);
}

.rotation-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--t-space-3);
  margin-bottom: var(--t-space-2);
}

.rotation-title h2 {
  margin: 0;
  font-size: var(--t-size-lg);
}

.rotation-title .muted {
  font-size: var(--t-size-sm);
}

.rotation-meta {
  display: flex;
  gap: var(--t-space-4);
  flex-wrap: wrap;
  color: var(--t-muted);
  font-size: var(--t-size-sm);
  margin-bottom: var(--t-space-3);
}

.rotation-meta i { margin-right: 0.3em; }

.rotation-steps-preview {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--t-space-3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--t-space-1);
}

.rotation-steps-preview li {
  display: grid;
  grid-template-columns: 2em 1fr auto;
  gap: var(--t-space-3);
  align-items: baseline;
  padding: var(--t-space-1) var(--t-space-2);
  border-radius: var(--t-radius-sm);
}

.rotation-steps-preview li.is-current {
  background: color-mix(in srgb, var(--t-accent) 12%, transparent);
}

.rotation-steps-preview .rot-step-num {
  font-weight: 600;
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
}

.rotation-timeline {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: var(--t-border);
  overflow: hidden;
  margin-bottom: var(--t-space-3);
}

.rotation-band {
  position: absolute;
  top: 0;
  bottom: 0;
}

/* Monochromatic ladder built from the page accent. Each step is the
   same hue at a different intensity, so the bar reads as a single
   coherent strip rather than competing colours, and it tracks the
   active theme + dark mode automatically. Step 0 is strongest, step
   4 lightest, then it cycles. */
.rotation-band--step-0 { background: color-mix(in oklab, var(--t-accent) 90%, var(--t-surface)); }
.rotation-band--step-1 { background: color-mix(in oklab, var(--t-accent) 70%, var(--t-surface)); }
.rotation-band--step-2 { background: color-mix(in oklab, var(--t-accent) 50%, var(--t-surface)); }
.rotation-band--step-3 { background: color-mix(in oklab, var(--t-accent) 35%, var(--t-surface)); }
.rotation-band--step-4 { background: color-mix(in oklab, var(--t-accent) 20%, var(--t-surface)); }
/* "Held" bands appear when conditions gate every step at that moment.
   Renders as a faint diagonal stripe so the user sees "nothing will
   fire here" without a confusing solid colour. */
.rotation-band.is-held {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in oklab, var(--t-muted) 28%, var(--t-surface)),
    color-mix(in oklab, var(--t-muted) 28%, var(--t-surface)) 6px,
    color-mix(in oklab, var(--t-muted) 14%, var(--t-surface)) 6px,
    color-mix(in oklab, var(--t-muted) 14%, var(--t-surface)) 12px
  );
}
/* Subtle dot in the corner so the user sees this slot's step was
   walked-past due to a failing condition (the autonomous tick fires
   the next eligible step instead). */
.rotation-band.is-shifted {
  box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--t-warn) 70%, transparent);
}

.rotation-actions {
  display: flex;
  gap: var(--t-space-2);
  flex-wrap: wrap;
}

.rotation-actions form { margin: 0; }

/* New / edit form */

/* Four fields on one row at desktop width (Name + Starts + Ends +
   Priority). Name gets a bit more space because it's free-text; the
   three numeric / time inputs sit at 1fr each. align-items: end keeps
   inputs on a shared baseline even if a label wraps over two lines. */
.rotation-form .field-grid {
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  align-items: end;
}

@media (max-width: 960px) {
  .rotation-form .field-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
  .rotation-form .field-grid { grid-template-columns: 1fr; }
}

.rot-steps {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-2);
  margin-bottom: var(--t-space-2);
}

.rot-step {
  display: grid;
  grid-template-columns: 2em 1fr 8ch 3ch auto auto;
  gap: var(--t-space-2);
  align-items: center;
}

.rot-step .rot-step-num {
  font-weight: 600;
  color: var(--t-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rot-step-unit {
  color: var(--t-muted);
  font-size: var(--t-size-sm);
}

@media (max-width: 540px) {
  .rot-step { grid-template-columns: 1.5em 1fr 6ch 2ch auto auto; }
}

/* v0.48 step conditions: each step lives inside a .rot-step-wrap
   wrapper that holds the controls row and a sibling panel beneath
   it. The Conditions button on the right of the row is wired by JS
   to toggle ``[hidden]`` on the panel. This avoids the previous
   <details>+grid+display:contents combo that produced layout
   surprises inside the CSS grid.

   The button itself is a plain .ghost button so it shares the same
   look as every other ghost button in the rest of the editor. */
.rot-step-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-2);
}
.rot-step-cond-toggle[aria-expanded="true"] {
  background: color-mix(in oklab, var(--t-accent, #C24F2C) 14%, transparent);
  border-color: var(--t-accent, #C24F2C);
}
.rot-step-cond-panel {
  /* Full-width below the controls row. Sits inside the wrapper so it
     pushes the next step down naturally rather than overlapping. */
  width: 100%;
  margin-top: 0;
}
.rot-step-cond > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  /* Match the padding the form's ghost buttons + inputs use so the
     button shares the same vertical height as the X icon button and
     the dwell input next to it. */
  padding: var(--t-space-2) var(--t-space-3);
  border: 1px solid var(--t-border, color-mix(in oklab, var(--t-fg, #1B1A16) 18%, transparent));
  border-radius: var(--t-radius-sm, 6px);
  background: transparent;
  color: var(--t-fg, #1B1A16);
  font-size: var(--t-size-md, 0.95em);
  font-weight: 500;
  line-height: 1.2;
  user-select: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.rot-step-cond > summary::-webkit-details-marker { display: none; }
.rot-step-cond > summary:hover {
  background: color-mix(in oklab, var(--t-fg, #1B1A16) 5%, transparent);
}
.rot-step-cond[open] > summary {
  background: color-mix(in oklab, var(--t-accent, #C24F2C) 14%, transparent);
  border-color: var(--t-accent, #C24F2C);
  color: var(--t-fg, #1B1A16);
}

/* v0.48 condition picker (static/condition-picker.js). Uses the
   existing button.ghost + .dow-picker patterns so no new colours or
   borders are introduced - this block only handles layout + spacing. */
.condition-picker {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-2);
}
.condition-picker .cp-rows {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-2);
}
.condition-picker .cp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--t-space-2);
  padding: var(--t-space-2);
  border: 1px solid var(--t-border, color-mix(in oklab, var(--t-fg, #1B1A16) 14%, transparent));
  border-radius: var(--t-radius-sm, 6px);
  background: color-mix(in oklab, var(--t-fg, #1B1A16) 2%, transparent);
}
.condition-picker .cp-row-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--t-space-2);
  flex: 1 1 auto;
  min-width: 0;
}
.condition-picker .cp-row-body > input[type="text"],
.condition-picker .cp-row-body > input[type="number"] {
  flex: 1 1 12em;
  min-width: 8em;
}
.condition-picker .cp-row-body > .dow-picker {
  margin-left: 0;
}
.condition-picker .cp-label {
  color: var(--t-muted);
  font-size: var(--t-size-sm);
}
.condition-picker .cp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--t-space-3);
}
.condition-picker .cp-status {
  margin-left: auto;
  font-size: var(--t-size-sm);
  color: var(--t-muted);
}
.condition-picker .cp-status[data-tone="ok"]   { color: var(--t-success, #2E7D32); }
.condition-picker .cp-status[data-tone="warn"] { color: var(--t-warn,    #B36A0A); }
.condition-picker .cp-status[data-tone="fail"] { color: var(--t-danger,  #B0322A); }
.condition-picker .cp-row-test {
  margin-left: auto;
  font-size: var(--t-size-md);
  font-weight: 700;
}
.condition-picker .cp-row-test[data-tone="ok"]   { color: var(--t-success, #2E7D32); }
.condition-picker .cp-row-test[data-tone="fail"] { color: var(--t-danger,  #B0322A); }
.condition-picker .cp-error {
  color: var(--t-danger, #B0322A);
}
.condition-picker .cp-advanced > summary {
  cursor: pointer;
  font-size: var(--t-size-sm);
  color: var(--t-muted);
  user-select: none;
}
.condition-picker .cp-advanced > .cp-json-editor {
  margin-top: var(--t-space-2);
}

/* Syntax-highlighted JSON editor: a <pre> overlay shows coloured
   tokens, the textarea sits on top with transparent text so the
   caret + selection still work natively. They share the same
   typography so character positions line up exactly. */
.cp-json-editor {
  position: relative;
  border: 1px solid var(--t-border, color-mix(in oklab, var(--t-fg, #1B1A16) 18%, transparent));
  border-radius: var(--t-radius-sm, 6px);
  background: color-mix(in oklab, var(--t-fg, #1B1A16) 3%, transparent);
  overflow: hidden;
}
.cp-json-editor .cp-jh,
.cp-json-editor textarea {
  margin: 0;
  padding: var(--t-space-2);
  font-family: var(--ff-mono, ui-monospace, monospace);
  font-size: 0.85em;
  line-height: 1.45;
  tab-size: 2;
  white-space: pre;
  word-break: keep-all;
  overflow-wrap: normal;
  box-sizing: border-box;
}
.cp-json-editor .cp-jh {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: auto;
  color: var(--t-fg, #1B1A16);
}
.cp-json-editor textarea {
  position: relative;
  display: block;
  width: 100%;
  min-height: 10em;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--t-fg, #1B1A16);
  resize: vertical;
  outline: none;
}
.cp-json-editor textarea::selection {
  background: color-mix(in oklab, var(--t-accent, #C24F2C) 30%, transparent);
}
/* v0.63.0: the per-token classes (cp-jh-key / -str / -num / -kw)
   used to live here with their own palette. The condition picker
   now emits the shared ``dx-code-*`` token classes (single source
   of truth across the events page + condition editor); the rules
   live in settings.css alongside the other dx-code primitives. */

/* No-JS fallback: when the picker isn't initialized, the textarea
   inside the condition-picker is the only thing the user can edit,
   so it stays visible. Once the picker JS moves the textarea inside
   .cp-json-editor it's no longer a direct child of .condition-picker
   and this selector stops matching, the .cp-json-editor rules above
   take over. */
@media (max-width: 540px) {
  .rot-step-cond-label { display: none; }
}

/* Step preview cards: page name on one line, bound devices listed below. */
.rotation-steps-preview li {
  grid-template-columns: 2em 1fr;
  align-items: start;
  padding: var(--t-space-2);
}

.rot-step-body {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-1);
  min-width: 0;
}

.rot-step-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--t-space-3);
}

.rot-step-devices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--t-space-2);
  font-size: var(--t-size-sm);
}

.rot-step-devices li {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 2px 8px;
  background: var(--t-surface-sunken, color-mix(in srgb, var(--t-text) 6%, transparent));
  border-radius: var(--t-radius-pill, 999px);
  color: var(--t-muted);
}

.rot-step-devices li i {
  font-size: 1.1em;
}

.rot-step-devices--empty {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0;
  font-size: var(--t-size-sm);
}

/* ----- Rotation countdown bar (rotations.js) -----------------------
   Live progress bar above each active rotation's step list, ticking
   every second toward the next step transition. The fill is driven
   from JS by the wall-clock delta between data-step-started and
   data-next-transition. */
.rotation-countdown {
  margin: var(--t-space-3) 0 var(--t-space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rotation-countdown-track {
  height: 8px;
  background: var(--t-bg-soft, rgba(0, 0, 0, 0.06));
  border-radius: var(--t-radius-pill, 999px);
  overflow: hidden;
  position: relative;
}
.rotation-countdown-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    to right,
    var(--t-accent, #0d8c7e),
    var(--t-accent-hover, #0d8c7e)
  );
  border-radius: inherit;
  transition: width 0.95s linear;
}
.rotation-countdown-meta {
  display: flex;
  align-items: center;
  gap: var(--t-space-2);
  margin: 0;
  font-size: var(--t-size-sm);
  color: var(--t-fg);
}
.rotation-countdown-meta strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rotation-countdown-meta .pill {
  font-size: 0.75em;
  padding: 1px 8px;
}

/* ----- Per-step "play" button --------------------------------------
   Sits to the right of the dwell label on each step row. Compact icon
   button; "manual" flash gets surfaced via the countdown's chip. */
.rot-step-play {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}
.rot-step-play .btn--icon {
  padding: 2px 6px;
  color: var(--t-fg-soft, var(--text-muted));
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.rotation-steps-preview li:hover .rot-step-play .btn--icon,
.rot-step-play .btn--icon:focus-visible {
  opacity: 1;
  color: var(--t-accent, #0d8c7e);
}
.rotation-steps-preview li.is-current .rot-step-play .btn--icon {
  opacity: 0.8;
  color: var(--t-accent, #0d8c7e);
}
