/* Shared active-session ribbon (Studio + Analysis). Tokens only — no new
   colour, radius, or font. Active accent follows the app's existing
   "is-active" treatment: --pulse-tint wash + rgba(63,127,221,0.35) hairline. */

/* Host collapses to nothing when empty/hidden, so a page with no active
   session renders exactly as before the ribbon existed. */
.fk-ribbon-host { display: block; }
.fk-ribbon-host[hidden] { display: none !important; }

/* Studio docks the ribbon in normal flow above the capture grid. */
.fk-ribbon-host:not(.fk-ribbon-host--overlay) .fk-ribbon {
  margin: var(--s-2) 0 var(--s-3);
}

/* Analysis docks it as a top-centre overlay. It sits BELOW the top chrome row
   (the top-left layer rail and top-right stats/protocol cluster) so it never
   collides with them; both side rails are edge-anchored, leaving the centre
   band clear. */
.fk-ribbon-host--overlay {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top, 0px) + 39px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: max-content;
  max-width: min(560px, calc(100vw - 120px));
  pointer-events: none;
}
.fk-ribbon-host--overlay .fk-ribbon { pointer-events: auto; width: auto; }
@media (max-width: 720px) {
  .fk-ribbon-host--overlay {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}

.fk-ribbon {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border: 1px solid rgba(63, 127, 221, 0.35);
  border-radius: var(--r-md);
  background: var(--pulse-tint);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--fg-1);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.fk-ribbon__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(63, 127, 221, 0.35);
  background: rgba(0, 0, 0, 0.12);
  color: var(--fk-ribbon-hue, var(--pulse-300));
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.fk-ribbon__who {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 36%;
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fk-ribbon__sep { flex: none; color: var(--fg-3); }
.fk-ribbon__proto {
  flex: 1 1 0;
  min-width: 0;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fk-ribbon__role {
  flex: none;
  padding: 2px var(--s-2);
  border-radius: var(--r-pill);
  border: 1px solid rgba(63, 127, 221, 0.35);
  color: var(--pulse-300);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.fk-ribbon__role[data-role="retest"] {
  color: var(--fg-2);
  border-color: var(--line-strong);
}

.fk-ribbon__date {
  flex: none;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  white-space: nowrap;
}

.fk-ribbon__spacer { flex: 1 1 0; min-width: 0; }

.fk-ribbon__exit {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  flex: 0 0 auto;
  padding: 3px var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.fk-ribbon__exit:hover { color: var(--fg-1); border-color: var(--line-strong); }
.fk-ribbon__exit-x { font-size: 12px; line-height: 1; }

/* Tight phones: drop secondary chips so the ✕ stays inside the badge. */
@media (max-width: 420px) {
  .fk-ribbon__date { display: none; }
  .fk-ribbon__role { display: none; }
  .fk-ribbon__who { max-width: 42%; }
  .fk-ribbon {
    padding-right: 8px;
    gap: 5px;
  }
}

/* Floating confirmation after Leave session (✕) — dark studio snackbar. */
.fk-ribbon-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(10px);
  z-index: 55;
  max-width: min(320px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: var(--r-md, 10px);
  background: rgba(16, 20, 28, 0.94);
  border: 1px solid rgba(150, 170, 200, 0.22);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--fg-1, #e8eef6);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.fk-ribbon-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (max-width: 720px) {
  .fk-ribbon-toast {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .fk-ribbon-toast { transition: none; }
}
