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

   ⚠ TWIN of ~/spotsheet-helper/ui/master-context-strip.css. Byte-identical
   apart from this header and the desktop-only #3977 impact-confirm block,
   which lives 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.

   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(--teal); }
.mcs-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcs-chev { color: var(--fg-faint); 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-dim);
  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: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tc-green);
}
.mcs-clock.is-rolling .mcs-tc { color: var(--teal); }
/* 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-faint); }
.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-faint);
  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-dim);
  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; }
