/* ============================================================================
   ATLAS REDESIGN — Shifts & coverage screen styles  (reference #14)
   Branch: atlas-redesign-2026-06-29 · tokens only (--r-*), both themes.
   Self-contained under .rd-shifts (the .rd-card / .rd-eyebrow / .rd-empty
   primitives are scoped elsewhere, so they're redeclared here).
   ========================================================================== */

.rd-shifts { max-width: var(--r-page-max); margin: 0 auto; }

/* ---- shared primitives (scoped) ----------------------------------------- */
.rd-shifts .rd-eyebrow {
  font-family: var(--r-font-mono); font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em; text-transform: uppercase; color: var(--r-clay);
  margin: 0 0 5px;
}
.rd-shifts .rd-card {
  background: var(--r-surface); border: 1px solid var(--r-border);
  border-radius: 16px; box-shadow: var(--r-shadow-card); padding: 20px 22px;
}
.rd-shifts .rd-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.rd-shifts .rd-card__title {
  margin: 0; font-family: var(--r-font-display); font-size: 18px; font-weight: 600;
  letter-spacing: -.01em; color: var(--r-ink); display: flex; align-items: center; gap: 7px;
}
.rd-shifts .rd-card__meta {
  margin-left: auto; font-size: 12px; color: var(--r-muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.rd-shifts .rd-empty { font-size: 13px; color: var(--r-muted); padding: 6px 0; }

/* ---- header ------------------------------------------------------------- */
.rd-shifts__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.rd-shifts__h1 {
  margin: 0; font-family: var(--r-font-display); font-size: 27px; font-weight: 600;
  letter-spacing: -.01em; color: var(--r-ink);
}
.rd-shifts__head-r { display: inline-flex; align-items: center; gap: 10px; }

/* live "Now" clock chip */
.rd-shifts__now-chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 12.5px; color: var(--r-mint-ink); background: var(--r-mint-surface);
  border-radius: var(--r-radius-pill); padding: 4px 12px; font-weight: 600;
}
.rd-shifts__now-chip b { font-weight: 700; }
.rd-shifts__now-chip--lg { height: 34px; padding: 0 14px; }
.rd-shifts__now-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--r-good);
  box-shadow: 0 0 0 3px var(--r-mint-surface); animation: rd-shifts-pulse 2.4s var(--r-ease) infinite;
}
@keyframes rd-shifts-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .rd-shifts__now-dot { animation: none; } }

.rd-shifts__edit {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: var(--r-radius-control); border: 1px solid var(--r-border);
  background: var(--r-surface); color: var(--r-body); font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: box-shadow var(--r-dur), border-color var(--r-dur), transform var(--r-dur);
}
.rd-shifts__edit i { font-size: 15px; color: var(--r-muted); }
.rd-shifts__edit:hover { box-shadow: var(--r-shadow-hover); border-color: var(--r-hairline-2); transform: translateY(-1px); }
.rd-shifts__edit:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- KPI strip ---------------------------------------------------------- */
.rd-shifts__kpis { margin-bottom: 20px; }

/* ---- state color tokens (shared by lanes) ------------------------------- */
.rd-shifts [data-state="live"]     { --st: var(--r-good); --st-bg: var(--r-mint-surface); }
.rd-shifts [data-state="building"] { --st: var(--r-amber); --st-bg: var(--r-chip-risk-surface); }
.rd-shifts [data-state="planned"]  { --st: var(--r-faint); --st-bg: var(--r-seg-track); }
.rd-shifts [data-state="off"]      { --st: var(--r-faint); --st-bg: var(--r-seg-track); }

/* ---- coverage timeline -------------------------------------------------- */
.rd-shifts__timeline { margin-bottom: 20px; }
.rd-shifts__now-chip .rd-shifts__now-line {
  width: 14px; height: 2px; border-radius: 2px; background: var(--r-alert); display: inline-block;
}
.rd-shifts__oncall-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--r-muted);
}
.rd-shifts__oncall-chip i { font-size: 14px; color: var(--r-faint); }

/* lane geometry — shared left column width so the tracks all align */
.rd-shifts__ruler-row,
.rd-shifts__lane { display: grid; grid-template-columns: 176px 1fr; align-items: center; }

.rd-shifts__ruler-row { margin-bottom: 8px; }
.rd-shifts__ruler-pad {
  font-family: var(--r-font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--r-faint);
}
.rd-shifts__ruler { position: relative; height: 16px; }
.rd-shifts__tick {
  position: absolute; top: 0; transform: translateX(-50%);
  font-family: var(--r-font-mono); font-size: 12px; color: var(--r-faint); white-space: nowrap;
}
.rd-shifts__tick.is-now { color: var(--r-alert); font-weight: 700; }
.rd-shifts__nowline {
  position: absolute; top: 16px; width: 2px; height: 6px; background: var(--r-alert);
  transform: translateX(-50%); border-radius: 2px;
}

.rd-shifts__lanes { display: flex; flex-direction: column; }
.rd-shifts__lane {
  width: 100%; text-align: left; font: inherit; cursor: pointer; background: transparent;
  border: 0; border-top: 1px solid var(--r-hairline); padding: 11px 0; color: var(--r-body);
  transition: background var(--r-dur);
}
.rd-shifts__lane:first-child { border-top: 0; }
.rd-shifts__lane:hover { background: var(--r-canvas-raised); }
.rd-shifts__lane:focus-visible { outline: var(--r-focus); outline-offset: -2px; }

.rd-shifts__lane-id { display: inline-flex; align-items: center; gap: 10px; min-width: 0; padding-right: 12px; }
.rd-shifts__lane-ic {
  flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--r-mint-surface); color: var(--r-mint-ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.rd-shifts__lane-ic--you {
  background: var(--r-primary); color: var(--r-primary-ink); font-family: var(--r-font-mono);
  font-size: 11px; font-weight: 600;
}
.rd-shifts__lane-txt { display: flex; flex-direction: column; min-width: 0; }
.rd-shifts__lane-name { font-size: 13.5px; font-weight: 600; color: var(--r-ink); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-shifts__lane-status { font-size: 12px; color: var(--r-faint); }

/* the gantt track */
.rd-shifts__track {
  position: relative; height: 30px; border-radius: 9px; background: var(--r-well);
  overflow: hidden;
}
.rd-shifts__bar {
  position: absolute; top: 0; height: 100%; display: inline-flex; align-items: center;
  padding: 0 12px; border-radius: 9px;
}
.rd-shifts__bar-label {
  font-family: var(--r-font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap;
}
/* live agent = full-width on-demand availability bar (its status color) */
.rd-shifts__bar.is-on {
  left: 0; right: 0; background: var(--r-good); color: var(--r-primary-ink);
  justify-content: center;
}
.rd-shifts__bar.is-starting {
  left: 0; right: 0; background: var(--r-chip-risk-surface); color: var(--r-chip-risk-ink);
  border: 1px dashed var(--r-amber); justify-content: center;
}
/* on-call · you — dashed overnight lanes (structural, not scheduled data) */
.rd-shifts__lane--oncall { border-top: 1px dashed var(--r-hairline-2); }
.rd-shifts__lane--oncall .rd-shifts__track { background: transparent; border: 1px dashed var(--r-hairline-2); }
.rd-shifts__bar.is-oncall {
  background: transparent; border: 1px dashed var(--r-border); color: var(--r-faint);
}
.rd-shifts__bar--am { left: 0; width: 25%; border-radius: 9px 0 0 9px; }
.rd-shifts__bar--pm { right: 0; width: 25%; border-radius: 0 9px 9px 0; }

/* the real "now" vertical marker on every track */
.rd-shifts__now {
  position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--r-alert);
  transform: translateX(-50%); z-index: 2; pointer-events: none;
}
.rd-shifts__now::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--r-alert);
}

.rd-shifts__note {
  display: flex; align-items: flex-start; gap: 7px; margin: 14px 0 0;
  font-size: 12px; color: var(--r-muted); line-height: 1.45;
}
.rd-shifts__note i { color: var(--r-faint); font-size: 14px; margin-top: 1px; flex: none; }
.rd-shifts__note--tight { margin-top: 12px; }

/* ---- band: heatmap + handoff -------------------------------------------- */
.rd-shifts__band { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }

/* coverage-by-hour heatmap (honest neutral, no fabricated gradient) */
.rd-shifts__hours {
  display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px;
}
.rd-shifts__hour {
  position: relative; height: 40px; border-radius: 6px; background: var(--r-seg-track);
  border: 1px solid var(--r-hairline);
}
.rd-shifts__hour.is-now { border-color: var(--r-alert); box-shadow: inset 0 0 0 1px var(--r-alert); }
.rd-shifts__hour-lbl {
  position: absolute; left: 0; top: calc(100% + 4px);
  font-family: var(--r-font-mono); font-size: 12px; color: var(--r-faint); white-space: nowrap;
}
.rd-shifts__heat-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 24px; flex-wrap: wrap;
}
.rd-shifts__insight {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  font-size: 12px; color: var(--r-muted);
}
.rd-shifts__insight i { color: var(--r-faint); font-size: 14px; }
.rd-shifts__ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--r-radius-control); border: 1px solid var(--r-border);
  background: var(--r-surface); color: var(--r-body); font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: box-shadow var(--r-dur), border-color var(--r-dur), transform var(--r-dur);
}
.rd-shifts__ghost i { font-size: 14px; color: var(--r-muted); }
.rd-shifts__ghost:hover { box-shadow: var(--r-shadow-hover); border-color: var(--r-hairline-2); transform: translateY(-1px); }
.rd-shifts__ghost:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* handoff & on-call panel */
.rd-shifts__ho-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-shifts__ho-row:first-of-type { border-top: 0; padding-top: 2px; }
.rd-shifts__ho-ic {
  flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--r-canvas-raised);
  color: var(--r-primary); border: 1px solid var(--r-hairline);
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.rd-shifts__ho-body { flex: 1; min-width: 0; }
.rd-shifts__ho-name { font-size: 13.5px; font-weight: 600; color: var(--r-ink); }
.rd-shifts__ho-sub { font-size: 12px; color: var(--r-muted); margin-top: 1px; }
.rd-shifts__ho-who {
  flex: none; font-family: var(--r-font-mono); font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: var(--r-muted); background: var(--r-seg-track); border-radius: var(--r-radius-pill); padding: 3px 10px;
}
.rd-shifts__ho-who.is-you { color: var(--r-mint-ink); background: var(--r-mint-surface); }

/* ---- lightweight CSS tooltip (heatmap + automation hour cells) -----------
   Same technique as reports.css: a data-tip attribute + a ::after bubble.
   No library, no new tab-stop behavior beyond the existing tabindex on the
   cell itself. --r-ink/--r-canvas are inverse-contrasting in both themes. */
.rd-shifts [data-tip] { position: relative; }
.rd-shifts [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: var(--r-ink);
  color: var(--r-canvas);
  font-family: var(--r-font-mono);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--r-dur) var(--r-ease), transform var(--r-dur) var(--r-ease);
  z-index: 5;
}
.rd-shifts [data-tip]:hover::after,
.rd-shifts [data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.rd-shifts__hour:focus-visible,
.rd-shifts__heatcell:focus-visible,
.rd-shifts__blk:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- peak coverage marker (real data — the busiest scheduled hour) ------- */
.rd-shifts__hour.is-peak { box-shadow: inset 0 0 0 1px var(--r-primary); }
.rd-shifts__peak-dot {
  position: absolute; top: 3px; right: 3px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--r-primary);
}
.rd-shifts__heatcell[data-peak="1"] { box-shadow: inset 0 0 0 1px var(--r-ink); }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 1080px) {
  .rd-shifts__band { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .rd-shifts__head { flex-direction: column; align-items: stretch; }
  .rd-shifts__head-r { justify-content: space-between; }
  .rd-shifts__ruler-row,
  .rd-shifts__lane { grid-template-columns: 128px 1fr; }
  .rd-shifts__hours { gap: 3px; }
}
@media (max-width: 400px) {
  .rd-shifts__ruler-row,
  .rd-shifts__lane { grid-template-columns: 96px 1fr; }
  .rd-shifts__hours { gap: 2px; }
  .rd-shifts [data-tip]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rd-shifts [data-tip]::after { transition: none; }
}


/* ── 2026-07-03 real coverage feed additions ───────────────────────────────── */
.rd-shifts__group {
  margin: 14px 0 6px;
  font: 700 11px/1 var(--r-font-mono, ui-monospace, monospace);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--r-muted);
}
.rd-shifts__lane--strip .rd-shifts__track--heat {
  display: flex;
  gap: 2px;
  align-items: stretch;
}
.rd-shifts__heatcell {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px;
  background: var(--r-primary);
}
.rd-shifts__blk {
  position: absolute;
  top: 22%;
  height: 56%;
  border-radius: 4px;
  background: color-mix(in srgb, var(--r-primary) 55%, transparent);
}
.rd-shifts__bar.is-cal {
  position: absolute;
  top: 18%;
  height: 64%;
  border-radius: 6px;
  background: color-mix(in srgb, var(--r-primary) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--r-primary) 45%, transparent);
  overflow: hidden;
}
.rd-shifts__bar.is-cal .rd-shifts__bar-label {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--r-body);
}
.rd-shifts__bar.is-cal.is-allday {
  left: 0;
  width: 100%;
  background: color-mix(in srgb, var(--r-primary) 12%, transparent);
}
.rd-shifts__hb {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font: 600 10px/1 var(--r-font-mono, ui-monospace, monospace);
  color: var(--r-muted);
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: 999px;
  padding: 3px 8px;
}
.rd-shifts__members {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 0;
}
.rd-shifts__member {
  font: 600 12px/1 var(--r-font-body, inherit);
  color: var(--r-body);
  border: 1px solid var(--r-border);
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--r-surface);
}
.rd-shifts__cap {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--r-muted);
}
