/* Master Context Strip v0 — #5034. BROWSER half.

   ⚠ TWIN of ~/spotsheet-helper/ui/master-context-strip.css. Byte-identical apart from
   this header and the two desktop-only blocks in the middle of the file — the
   #3977 impact confirm and the #3975 deleted-marker resolve cover — which live
   on the rig because only the rig writes markers. Change one, change the other
   in the same pass: "same field order, labels, iconography, clock typography
   and state colors across all modes" is the founder rule the strip exists to
   satisfy.

   #5695 reconciled the pair after a 220-line drift. What keeps them in step
   now is packaging/qa/verify-mcs-twin.sh (helper repo), not this comment.

   Uses tokens.css ONLY — no local palette. */
.mcs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 3px 8px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  font-family: var(--ui);
  user-select: none;
}

/* ── 1 · PROJECT — dominant identity ──────────────────────────────────── */
.mcs-identity { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.mcs-project {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 320px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: left;
  cursor: default;
}
.mcs-project.is-switch { cursor: pointer; }
.mcs-project.is-switch:hover { color: var(--ss-accent); }
.mcs-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcs-chev { color: var(--fg-mute); font-size: 9px; flex: none; }

/* ── 2 · VERSION and 3 · SESSION — the subordinate line ───────────────── */
/* Both live BELOW the project on one quiet line. This is the structural part
   of the hierarchy: session can never be mistaken for a fourth equal control
   because it is not on the same row as the project at all. */
.mcs-sub { display: flex; align-items: center; gap: 6px; min-width: 0; }

.mcs-version {
  flex: none;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-mute);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
}

.mcs-session {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-mute);
  font: inherit;
  font-size: 10.5px;
  line-height: 1.2;
  cursor: default;
}
.mcs-session.is-switch { cursor: pointer; }
.mcs-session.is-switch:hover { color: var(--fg); }
.mcs-session-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mcs-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; background: var(--fg-faint); }
/* `idle` is NORMAL protected context (the #5026 default fallback), not an
   error — it must never read as a failure. */
.mcs-session.tone-idle .mcs-dot { background: var(--fg-faint); }
.mcs-session.tone-ok   .mcs-dot { background: var(--tc-green); }
.mcs-session.tone-warn .mcs-dot { background: var(--cue-amber); }
.mcs-session.tone-bad  .mcs-dot { background: var(--st-danger); }
.mcs-session.tone-bad  { color: var(--st-danger); }

.mcs-spacer { flex: 1 1 auto; min-width: 8px; }

/* ── 4 · TIMECODE — the persistent functional anchor ──────────────────── */
.mcs-clock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-1);
  background: var(--bg-deep);
}
.mcs-tc {
  font-family: var(--mono);
  /* Tabular figures: digits must not shift width while rolling, or the clock
     visibly jitters at 4 Hz and reads as unstable. */
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tc-green);
}
.mcs-clock.is-rolling .mcs-tc { color: var(--ss-accent); }
/* Stale = we have no fresh reading. Dimming is the honest signal; freezing a
   stale number at full strength would present a lie as live truth. */
.mcs-clock.is-stale .mcs-tc { color: var(--fg-mute); }
/* #5431 — the source label. Deliberately small and quiet: it must name the
   state without competing with the timecode it qualifies, and it must never be
   mistaken for the transport word (PLAY/STOP) that sits in the same row. */
.mcs-src {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  /* --fg-faint (what .mcs-transport uses) is unreadable at 8.5px here, and an
     honesty label nobody can read is not honesty. Same tone as the dimmed
     digits it qualifies; the 8.5px size keeps it subordinate. */
  color: var(--fg-mute);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 0 3px;
  flex: none;
}
/* NOT hidden on narrow screens. .mcs-transport is (it is a nicety); this label
   is the only thing telling you the number follows nothing, so dropping it is
   exactly the state #5431 was filed about. */
.mcs-transport {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  min-width: 26px;
}

/* ── authority — SUPPORTS the clock, never competes with identity ─────── */
.mcs-auth {
  flex: none;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--fg-mute);
  padding: 2px 4px;
}
.mcs-auth.is-leader { color: var(--tc-green); }

/* ── remote-control grants (#5029 w5) ─────────────────────────────────── */
.mcs-remote {
  flex: none;
  padding: 2px 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-1);
  background: var(--bg-sub);
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.mcs-remote.has-grant { color: var(--tc-green); border-color: var(--line); }
/* An unanswered ask is the one thing in this strip allowed to pull the eye:
   somebody is standing at a locked door waiting for this human. */
.mcs-remote.has-pending {
  color: var(--cue-amber);
  border-color: var(--cue-amber);
  background: transparent;
}

/* ── this surface's OWN grant standing (#5034 w7b) ────────────────────────
   NOT the roster above. `.mcs-remote` is the rig answering "who may drive
   me"; this is a browser or a phone answering "may I drive it". A
   non-executing surface cannot read the grant table — it lives at the rig —
   so this reports only what its own intents have proved. Deliberately quieter
   than `.mcs-remote`: nobody is waiting on THIS reader to act. */
.mcs-grant {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--fg-mute);
  font-size: 10.5px;
  line-height: 1.2;
}
.mcs-grant-label { white-space: nowrap; }
/* `idle` covers both "no rig" and "not asked yet". Neither is a failure and
   neither may read as one — same rule as the session pill's default state. */
.mcs-grant.tone-idle .mcs-dot { background: var(--fg-faint); }
.mcs-grant.tone-ok   .mcs-dot { background: var(--tc-green); }
.mcs-grant.tone-warn .mcs-dot { background: var(--cue-amber); }
.mcs-grant.tone-warn { color: var(--cue-amber); }

.mcs-err {
  flex: none;
  color: var(--st-danger);
  font-weight: 800;
  font-size: 12px;
  padding: 0 4px;
  cursor: help;
}

/* ── narrow / compact ─────────────────────────────────────────────────── */
/* Founder rule for small widths: PROJECT + TIMECODE stay immediately visible;
   VERSION + SESSION may compact but may never be omitted or contradicted. The
   v1 app is a 360px companion column (DH #576/#580), so this is the normal
   case here, not an edge case. */
@media (max-width: 420px) {
  .mcs { gap: 6px; padding: 3px 6px; }
  .mcs-project { max-width: 150px; font-size: 12px; }
  .mcs-version { max-width: 64px; }
  .mcs-tc { font-size: 12.5px; }
  .mcs-transport { display: none; }
}
.mcs-compact { min-height: 30px; }
.mcs-compact .mcs-project { font-size: 12px; }
.mcs-compact .mcs-tc { font-size: 13px; }


/* ═══ DH #612 v2 (#5332) · THE RESTING PILL ══════════════════════════════════
   Ported verbatim from the design's uwc-v2.css. The pill is the browser and
   desktop twin's identity cluster: project dominant, version and session as
   mono identifiers, session alone toned (tone-idle = plain grey rest, #5026).
   The narrow and reduced-motion rules for the pill live here with it. */
/* ── 1 · THE RESTING PILL ────────────────────────────────────────────────────
   The old strip was dropped into the 44px top bar with its panel background
   stripped (`.ss-topbar-mcs .mcs { background:transparent; padding:0 }`) and
   nothing put back, so the "pill" was naked text with a 9px --fg-faint chevron.
   It had no boundary, no hit area you could see, and no hover. This gives it a
   body without raising its voice: it must still sit UNDER the timecode in the
   visual hierarchy (#5301 — the master readout is the only live clock).

   Field order is unchanged from #5034 — PROJECT · VERSION · SESSION · TIMECODE
   — so the desktop twin keeps the contract. What changes is that the two
   subordinate fields stop competing with each other. */
.wcp {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  min-width: 0;
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  background: rgba(255,255,255,.030);
  font-family: var(--ui);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.wcp:hover        { border-color: var(--line); background: rgba(255,255,255,.055); }
.wcp:focus-visible{ outline: 2px solid var(--ss-accent); outline-offset: 2px; }
/* Open is a STATE, not a hover. The pill stays lit while its window is down so
   the eye can always find what the window belongs to. */
.wcp.is-open      { border-color: var(--ss-accent-line); background: var(--ss-accent-bg); }

.wcp-stack   { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wcp-project {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 650; letter-spacing: -.01em; line-height: 1.15;
  color: var(--fg-strong);
}
.wcp:hover .wcp-project { color: #fff; }
.wcp-sub { display: flex; align-items: center; gap: 7px; min-width: 0; line-height: 1.2; }

/* VERSION — an identifier, so mono. This is the whole differentiation. */
.wcp-version {
  flex: none; max-width: 128px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .01em;
  color: var(--fg-mute);
}
.wcp-sep { flex: none; color: var(--fg-dim); font-size: 10px; }

/* SESSION — tertiary, and the only field allowed a state colour, because it is
   the only one that can be wrong about the outside world. */
.wcp-session { display: flex; align-items: center; gap: 5px; min-width: 0; }
.wcp-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; background: var(--fg-faint); }
.wcp-session-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; color: var(--fg-dim);
}
.wcp.tone-ok   .wcp-dot { background: var(--tc-green); }
.wcp.tone-warn .wcp-dot { background: var(--cue-amber); }
.wcp.tone-bad  .wcp-dot { background: var(--st-danger); }
.wcp.tone-bad  .wcp-session-name { color: var(--st-danger); }

.wcp-chev {
  flex: none; margin-left: 1px; color: var(--fg-dim); font-size: 9px;
  transition: transform var(--t-fast), color var(--t-fast);
}
.wcp:hover .wcp-chev   { color: var(--fg-mute); }
.wcp.is-open .wcp-chev { transform: rotate(180deg); color: var(--ss-accent); }

.wcp.tone-idle .wcp-dot { background: var(--fg-faint); }  /* explicit rest, matches .mcs tone-idle */
@media (max-width: 520px) {
  .wcp { max-width: 200px; }
  .wcp-version { max-width: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  .wcp, .wcp-chev { transition: none; }
}

/* ── #5690 · THE PT BINARY LIGHT (founder ruling, History 6707) ───────────────
   No words: the badge is the light. OFF = dim chrome; ON = lit. Identical on
   the browser strip and the desktop twin. */
.mcs-auth.mcs-ptlight { opacity: .4; letter-spacing: .08em; }
.mcs-auth.mcs-ptlight.on { opacity: 1; color: var(--tc-green, var(--ss-accent)); border-color: currentColor; }
