/* ===========================================================================
 * impersonation.css — the persistent "you are impersonating" banner.
 * ---------------------------------------------------------------------------
 * Replaces the interim inline styles that shipped with Story 4.2 (the partial's
 * own comment said "the real theme is Epic 5" — Epic 5 has since landed, so the
 * banner now uses the OKLCH tokens like everything else).
 *
 * BIMERGE-145: the banner was `position: fixed` with nothing reserving space for
 * it, so it sat ON TOP of the first ~45px of every page it appeared on — the
 * client sidebar's brand mark, the topbar, the admin nav. It had to stay fixed
 * (it must remain visible while scrolling a long dashboard), so instead the page
 * is pushed down by exactly the banner's height.
 *
 * The height is published as `--impersonation-h` and is **0px unless the banner
 * is actually on screen**. Every offset below is expressed against that variable,
 * so when nobody is impersonating every calc() resolves to its original value and
 * the layout is bit-for-bit unchanged. That is the whole safety property: the
 * offsets cannot mis-fire for normal users, because there is nothing to subtract.
 *
 * The banner sets `height: var(--impersonation-h)` rather than being sized by its
 * own content, so the reserved space and the rendered banner cannot drift apart.
 * =========================================================================== */

:root {
  /* Inert by default. Overridden only while impersonating (below). */
  --impersonation-h: 0px;
}

body.impersonating {
  --impersonation-h: 48px;
  /* Pushes ALL page content clear of the fixed banner. Safe with border-box (set
     by Tailwind Preflight, and by autodesk.css's own `*` reset): the body's own
     min-height:100vh already accounts for its padding, so this adds no scrollbar.
     Children that set their own 100vh are corrected where they are defined. */
  padding-top: var(--impersonation-h);
}

.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999; /* above the client sidebar (sticky) and the React SPA */
  height: var(--impersonation-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: var(--destructive);
  color: var(--destructive-foreground);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
}

.impersonation-banner strong { font-weight: 700; }

/* Truncate rather than wrap: the banner's height is fixed, so a long tenant name
   must not push text out of the bar. */
.impersonation-banner .impersonation-msg {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Neutralise the wrapping button_to <form> so no layout's form styling boxes it. */
.impersonation-banner form { margin: 0; padding: 0; background: none; border: 0; display: inline; }

.impersonation-banner .impersonation-stop {
  flex: none;
  background: var(--destructive-foreground);
  color: var(--destructive);
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
}
.impersonation-banner .impersonation-stop:hover { opacity: .9; }
