/* reception-v2.css — polished Reception workstation surface.
 *
 * Brand: V4 light-cyan-glass aesthetic. Tokens inherit from v4-tokens.css
 * (:root[data-theme="light"]) — this file only ADDS reception-scoped polish
 * on top: glass cards, breathing micro-halos, premium typography rhythm,
 * micro-interactions, premium empty states.
 *
 * Hook root: .reception-v2 (set on the outer <section> in reception.html).
 *
 * Quality bar: Linear / Pitch / Notion. Every surface should feel intentional.
 *
 * Author: Niki, 2026-05-23.
 */

/* =====================================================   ROOT — local palette aliases + layout spine

   The --rx-* aliases must resolve in TWO scopes: inside the main
   Reception section AND inside the global topbar where the view-pill
   chrome is teleport-rendered. CSS custom properties don't cascade
   across DOM siblings, so we publish the alias block on BOTH selectors.

   2026-05-23 dark-mode pass: every literal `white` background or
   color-mix base in this file became a `--rx-glass-base` alias that
   resolves DIFFERENTLY in dark vs light. Light = paper white. Dark =
   the bg-card surface from base.css (#111113), so the same
   `color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base))`
   yields a soft cyan-tinted dark surface instead of an unreadable
   white-on-dark patch. Same goes for translucent glass fills via
   --rx-glass-fill / --rx-glass-fill-hi.
   ============================================================ */
.reception-v2,
.topbar__view-chrome,
.reception-search--topbar {  /* topbar-variant search lives in .topbar__right (sibling of .topbar__view-chrome) so needs its own token scope — 2026-05-26 */
  /* Aliases for readability — these resolve to V4 tokens */
  --rx-accent:        var(--accent, #0099B0);
  --rx-accent-vivid:  var(--accent-vivid, #00B5D1);
  --rx-accent-bright: var(--accent-bright, #00D4FF);
  --rx-accent-text:   var(--accent-text, #007885);
  --rx-glow:          var(--accent-glow-bright, rgba(0, 212, 255, 0.22));

  /* Theme-aware surface aliases (LIGHT defaults).
   *   --rx-glass-base       — the "mix-with" base for cyan tints (color-mix)
   *   --rx-glass-fill       — translucent panel fill (cards, side strip)
   *   --rx-glass-fill-hi    — stronger fill (modals, dropdowns, search results)
   *   --rx-glass-fill-soft  — lightest fill (chips, pills, button rest)
   *   --rx-glass-edge       — inset top highlight rgba (the glass cap)
   *   --rx-rim              — cyan-or-glass rim used on borders
   *   --rx-card-shadow      — outer drop shadow for cards
   *   --rx-modal-shadow     — heavier drop shadow for modals
   *   --rx-scrim            — modal/slideout scrim
   *   --rx-text-soft        — secondary text on glass (was 'var(--text)')
   *   --rx-text-strong      — primary text on glass (was 'var(--text, #1f2937)')
   *   --rx-pill-soft        — dim "coming soon" item base
   *   --rx-tier-mix-base    — base for tier-soft color-mix (red/amber/green-soft)
   *   --rx-on-accent        — text painted on top of an accent gradient (stays #fff)
   */
  --rx-glass-base:      #ffffff;
  --rx-glass-fill:      rgba(255, 255, 255, 0.78);
  --rx-glass-fill-hi:   rgba(255, 255, 255, 0.96);
  --rx-glass-fill-soft: rgba(255, 255, 255, 0.6);
  --rx-glass-edge:      rgba(255, 255, 255, 0.85);
  --rx-glass-edge-soft: rgba(255, 255, 255, 0.65);
  --rx-rim:             color-mix(in srgb, var(--rx-accent) 14%, rgba(255, 255, 255, 0.6));
  --rx-rim-hi:          color-mix(in srgb, var(--rx-accent) 20%, rgba(255, 255, 255, 0.6));
  --rx-card-shadow:     0 1px 0 rgba(255, 255, 255, 0.65) inset,
                        0 8px 24px rgba(0, 0, 0, 0.04),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 6%, transparent);
  --rx-card-shadow-hi:  0 1px 0 rgba(255, 255, 255, 0.7) inset,
                        0 12px 28px rgba(0, 0, 0, 0.06),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 8%, transparent);
  --rx-modal-shadow:    0 28px 60px rgba(15, 23, 42, 0.22),
                        0 8px 16px rgba(15, 23, 42, 0.06),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 10%, transparent),
                        inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --rx-menu-shadow:     0 22px 50px rgba(15, 23, 42, 0.14),
                        0 4px 8px rgba(15, 23, 42, 0.04),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 8%, transparent);
  --rx-scrim:           rgba(15, 23, 42, 0.42);
  --rx-scrim-light:     rgba(15, 23, 42, 0.36);
  --rx-text-soft:       var(--text-muted, #6b6b71);
  --rx-text-strong:     var(--text, #1f2937);
  --rx-pill-soft:       color-mix(in srgb, var(--text, #1f2937) 55%, transparent);
  --rx-tier-mix-base:   white;
  --rx-on-accent:       #fff;
  --rx-toast-bg:        rgba(15, 23, 42, 0.92);

  /* Semantic state hues — used by timeline blocks + chips */
  --rx-healthy: #16a34a;
  --rx-warn:    #d97706;
  --rx-critical:#dc2626;

  /* Spacing rhythm — 4/8/12/16/24px scale */
  --rx-s1: 4px;
  --rx-s2: 8px;
  --rx-s3: 12px;
  --rx-s4: 16px;
  --rx-s5: 20px;
  --rx-s6: 24px;
  --rx-s7: 32px;
  --rx-s8: 40px;

  /* Motion */
  --rx-ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --rx-ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --rx-dur-fast:  120ms;
  --rx-dur-mid:   200ms;
  --rx-dur-slow:  360ms;
}

/* =====================================================   DARK MODE — rebind every --rx-* glass alias to deep matte surfaces.
   Tokens stay derived from base.css's dark theme (--bg-card #111113,
   --bg-card-hi #17171A, --bg-card-deep #0A0A0C, --border #1F1F22).
   The cyan accent stays bright in dark mode (base.css gives us
   --accent #00D4FF + --accent-glow rgba(0,212,255,0.18)).

   Linear-style: deep matte surfaces, sharp 1px rims, cyan-tinted top
   highlight on key cards, and richer glows on the accent.
   ============================================================ */
:root[data-theme="dark"] .reception-v2,
:root[data-theme="dark"] .topbar__view-chrome,
:root[data-theme="dark"] .reception-search--topbar {  /* dark-mode parity for the topbar-variant search — 2026-05-26 */
  /* Cyan stays vivid in dark mode — base.css already sets --accent #00D4FF.
   * IMPORTANT: --rx-accent-text is still used as a gradient end-stop on
   * buttons (FAB, primary CTA), so we keep it at the V4 light value and
   * instead override the small handful of text-on-glass uses via
   * direct rules in the "DARK MODE TEXT OVERRIDES" block further below. */
  --rx-glass-base:      var(--bg-card, #111113);
  --rx-glass-fill:      rgba(17, 17, 19, 0.78);
  --rx-glass-fill-hi:   rgba(23, 23, 26, 0.96);
  --rx-glass-fill-soft: rgba(17, 17, 19, 0.55);
  --rx-glass-edge:      color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  --rx-glass-edge-soft: color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
  --rx-rim:             color-mix(in srgb, var(--rx-accent) 22%, var(--border, #1F1F22));
  --rx-rim-hi:          color-mix(in srgb, var(--rx-accent) 38%, var(--border-hi, #2A2A2E));
  --rx-card-shadow:     0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent) inset,
                        0 6px 22px rgba(0, 0, 0, 0.45),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 10%, transparent);
  --rx-card-shadow-hi:  0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 22%, transparent) inset,
                        0 10px 30px rgba(0, 0, 0, 0.55),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 22%, transparent),
                        0 0 28px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
  --rx-modal-shadow:    0 28px 60px rgba(0, 0, 0, 0.70),
                        0 8px 16px rgba(0, 0, 0, 0.45),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 20%, transparent),
                        inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 18%, transparent);
  --rx-menu-shadow:     0 24px 50px rgba(0, 0, 0, 0.6),
                        0 4px 8px rgba(0, 0, 0, 0.4),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 16%, transparent),
                        inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
  --rx-scrim:           rgba(0, 0, 0, 0.65);
  --rx-scrim-light:     rgba(0, 0, 0, 0.55);
  --rx-text-soft:       var(--text-muted, #9A9AA2);
  --rx-text-strong:     var(--text, #F5F5F7);
  --rx-pill-soft:       color-mix(in srgb, var(--text, #F5F5F7) 50%, transparent);
  --rx-tier-mix-base:   var(--bg-card, #111113);
  --rx-on-accent:       #fff;                      /* button text on cyan gradient stays white */
  --rx-toast-bg:        color-mix(in srgb, var(--bg-card-hi, #17171A) 92%, transparent);
}

/* =====================================================   DARK MODE — surface-level overrides

   These rules handle the handful of surfaces where the dark-on-dark
   colour-mix wouldn't produce enough punch on its own. We brighten the
   cyan-tinted glass on key chrome elements, swap text-on-glass to the
   accent-soft (#7FE3FF) tone so it passes WCAG AA, and add a subtle
   cyan inner rim where the V4 light surface had a white inner highlight.

   Order: rules below win because they come AFTER the base alias block.
   ============================================================ */

/* View-pill: bump the cyan-tint mix percentages so the button reads as
   a vivid cyan-glass control against a deep matte topbar instead of a
   muddy dark blob. Also lift text + icon to accent-soft so they pop. */
:root[data-theme="dark"] .view-pill__btn {
  --vp-bg-top:    color-mix(in srgb, var(--rx-accent) 22%, var(--bg-card-hi, #17171A));
  --vp-bg-bottom: color-mix(in srgb, var(--rx-accent-bright) 32%, var(--bg-card, #111113));
  --vp-border:    color-mix(in srgb, var(--rx-accent-bright) 45%, transparent);
  color: var(--accent-soft, #7FE3FF);
}
:root[data-theme="dark"] .view-pill__btn:hover {
  --vp-bg-top:    color-mix(in srgb, var(--rx-accent) 30%, var(--bg-card-hi, #17171A));
  --vp-bg-bottom: color-mix(in srgb, var(--rx-accent-bright) 42%, var(--bg-card, #111113));
  --vp-border:    color-mix(in srgb, var(--rx-accent-bright) 60%, transparent);
}
:root[data-theme="dark"] .view-pill[data-open="true"] .view-pill__btn {
  --vp-bg-top:    color-mix(in srgb, var(--rx-accent) 34%, var(--bg-card-hi, #17171A));
  --vp-bg-bottom: color-mix(in srgb, var(--rx-accent-bright) 48%, var(--bg-card, #111113));
  --vp-border:    color-mix(in srgb, var(--rx-accent-bright) 70%, transparent);
}
:root[data-theme="dark"] .view-pill__icon,
:root[data-theme="dark"] .view-pill__chev {
  color: var(--accent-soft, #7FE3FF);
}

/* Reception clock — text-on-glass cyan, push to accent-soft so the
   glow reads against the dark topbar instead of disappearing. */
:root[data-theme="dark"] .reception-clock {
  color: var(--accent-soft, #7FE3FF);
}

/* Quick-stats — booked counter, search kbd, hints badge, slideout tab,
   meta channel chips. Each is a small cyan-text-on-glass site. */
:root[data-theme="dark"] .reception-quickstats__stat--booked,
:root[data-theme="dark"] .reception-quickstats__val,
:root[data-theme="dark"] .reception-hints__badge,
:root[data-theme="dark"] .reception-hints__action,
:root[data-theme="dark"] .reception-search__row:hover,
:root[data-theme="dark"] .reception-modal__add-new,
:root[data-theme="dark"] .reception-modal__niki-title,
:root[data-theme="dark"] .reception-modal__niki-icon,
:root[data-theme="dark"] .reception-fab__item:hover,
:root[data-theme="dark"] .reception-slideout__tab:hover,
:root[data-theme="dark"] .reception-slideout__tab--active,
:root[data-theme="dark"] .stack-card__action-type,
:root[data-theme="dark"] .stack-card__subject-chip--scheme,
:root[data-theme="dark"] .stack-card__meta-channel,
:root[data-theme="dark"] .stack-card__reasoning-label,
:root[data-theme="dark"] .stack-section__count,
:root[data-theme="dark"] .view-pill__item--active,
:root[data-theme="dark"] .view-pill__item-state,
:root[data-theme="dark"] .view-pill__item-icon,
:root[data-theme="dark"] .view-pill__section,
:root[data-theme="dark"] .view-pill__item:not(.view-pill__item--soon):hover,
:root[data-theme="dark"] .patient-link {
  color: var(--accent-soft, #7FE3FF);
}

/* "Coming soon" subheader in the dropdown — italic teal hint */
:root[data-theme="dark"] .view-pill__item-soon {
  color: color-mix(in srgb, var(--accent-soft, #7FE3FF) 55%, transparent);
}

/* Stack cards get a subtle cyan top-edge highlight on hover/idle in
   dark mode — the same login-v4 "soft top rim" treatment but cyan-only
   so the matte black surfaces feel premium, not flat. */
:root[data-theme="dark"] .stack-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              var(--accent-soft, #7FE3FF) 50%,
              transparent 100%);
  opacity: 0.32;
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--rx-dur-mid) var(--rx-ease);
}
:root[data-theme="dark"] .stack-card:hover::before { opacity: 0.65; }

/* =====================================================   STACK DARK MODE — defensive surface overrides (audit-bugfix 2026-05-25)
   ----------------------------------------------------------------
   Bug: Stack view's cards stayed light-themed when the user toggled
   dark mode. Even though every .stack-card / .stack-section rule
   already references --rx-* tokens that ARE rebound at the dark scope
   on .reception-v2, the user-reported behaviour was that the cards
   visibly read as light-mode against a dark body.

   This block belt-and-braces the Stack: every card surface, section
   header, body container, draft / fact / checklist / batch panel,
   reasoning block, and meta pill explicitly resolves its background +
   border + shadow + text against the dark-mode tokens. Same token
   family Reception + Email already use successfully in dark mode.

   Re-publish the dark aliases at .your-stack scope so any cascade
   shadow from an intermediate ancestor can't strip them.
   ============================================================ */
:root[data-theme="dark"] .your-stack {
  --rx-glass-base:      var(--bg-card, #111113);
  --rx-glass-fill:      rgba(17, 17, 19, 0.78);
  --rx-glass-fill-hi:   rgba(23, 23, 26, 0.96);
  --rx-glass-fill-soft: rgba(17, 17, 19, 0.55);
  --rx-rim:             color-mix(in srgb, var(--rx-accent) 22%, var(--border, #1F1F22));
  --rx-rim-hi:          color-mix(in srgb, var(--rx-accent) 38%, var(--border-hi, #2A2A2E));
  --rx-text-strong:     var(--text, #F5F5F7);
  --rx-text-soft:       var(--text-muted, #9A9AA2);
  --rx-tier-mix-base:   var(--bg-card, #111113);
}
:root[data-theme="dark"] .your-stack__title,
:root[data-theme="dark"] .your-stack__sub,
:root[data-theme="dark"] .your-stack__niki-label,
:root[data-theme="dark"] .stack-section__name,
:root[data-theme="dark"] .stack-card__subject-name,
:root[data-theme="dark"] .stack-card__draft,
:root[data-theme="dark"] .stack-card__fact,
:root[data-theme="dark"] .stack-card__checklist li,
:root[data-theme="dark"] .stack-card__batch-label {
  color: var(--text, #F5F5F7);
}
:root[data-theme="dark"] .your-stack__sub,
:root[data-theme="dark"] .stack-section__sub,
:root[data-theme="dark"] .stack-card__time,
:root[data-theme="dark"] .stack-card__sep,
:root[data-theme="dark"] .stack-card__subject-last {
  color: var(--text-muted, #9A9AA2);
}
:root[data-theme="dark"] .stack-card {
  background: var(--bg-card, #111113);
  border-color: color-mix(in srgb, var(--rx-accent) 22%, var(--border, #1F1F22));
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent) inset,
    0 6px 22px rgba(0, 0, 0, 0.45),
    0 0 0 1px color-mix(in srgb, var(--rx-accent) 10%, transparent);
}
:root[data-theme="dark"] .stack-card--red {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-critical, #dc2626) 12%, var(--bg-card, #111113)) 0%,
              var(--bg-card, #111113) 32%);
}
:root[data-theme="dark"] .stack-card--amber {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-warn, #d97706) 12%, var(--bg-card, #111113)) 0%,
              var(--bg-card, #111113) 32%);
}
:root[data-theme="dark"] .stack-card--green {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-healthy, #16a34a) 10%, var(--bg-card, #111113)) 0%,
              var(--bg-card, #111113) 32%);
}
:root[data-theme="dark"] .stack-section__header {
  background: linear-gradient(180deg,
              rgba(23, 23, 26, 0.96) 0%,
              color-mix(in srgb, var(--bg-card, #111113) 78%, transparent) 100%);
  border-bottom-color: color-mix(in srgb, var(--rx-accent) 18%, transparent);
}
:root[data-theme="dark"] .stack-card__draft,
:root[data-theme="dark"] .stack-card__fact,
:root[data-theme="dark"] .stack-card__checklist,
:root[data-theme="dark"] .stack-card__batch {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 6%, var(--bg-card, #111113)) 0%,
              rgba(17, 17, 19, 0.55) 100%);
  border-color: color-mix(in srgb, var(--rx-accent) 18%, transparent);
}
:root[data-theme="dark"] .stack-card__reasoning {
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--bg-card, #111113));
  border-left-color: color-mix(in srgb, var(--rx-accent) 42%, transparent);
}
:root[data-theme="dark"] .stack-card__meta-pill,
:root[data-theme="dark"] .stack-section__empty {
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--bg-card, #111113));
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--text-muted, #9A9AA2);
}

/* Reception clock glow — already cyan-bright on light, push a touch more
   on dark so the centerpiece reads from across the room. */
:root[data-theme="dark"] .reception-clock {
  text-shadow:
    0 0 14px color-mix(in srgb, var(--rx-accent-bright) 55%, transparent),
    0 0 26px color-mix(in srgb, var(--rx-accent-bright) 30%, transparent);
}
:root[data-theme="dark"] .reception-clock:hover {
  text-shadow:
    0 0 18px color-mix(in srgb, var(--rx-accent-bright) 75%, transparent),
    0 0 36px color-mix(in srgb, var(--rx-accent-bright) 42%, transparent);
}

/* Reception halo wash — punch it up a hair on dark so the workstation
   doesn't feel airless. */
:root[data-theme="dark"] .reception-v2::before {
  background:
    radial-gradient(ellipse 60% 80% at 20% 0%,
      color-mix(in srgb, var(--rx-accent-bright) 14%, transparent), transparent 65%),
    radial-gradient(ellipse 50% 60% at 85% 30%,
      color-mix(in srgb, var(--rx-accent-vivid) 10%, transparent), transparent 65%);
}

/* Search input: dark input bg is more legible if we explicitly set
   bg-card-hi on hover/focus instead of inheriting glass-fill-hi which
   reads as "slightly less translucent" — barely visible. */
:root[data-theme="dark"] .reception-search__input:hover {
  background: var(--bg-card-hi, #17171A);
}
:root[data-theme="dark"] .reception-search__input:focus {
  background: var(--bg-card-hi, #17171A);
}

/* Modal scrim should be near-black (deeper than rgba(0,0,0,0.65)) when
   we want the modal to feel like it owns the screen. */
:root[data-theme="dark"] .reception-modal__scrim {
  background: rgba(0, 0, 0, 0.72);
}

.reception-v2 {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s4);
  position: relative;
  isolation: isolate;
}

/* Reception-only halo wash. Sits below cards. Independent of body breathe.
   Visible through the glass blur — gives the page a "living" feel without
   stealing attention. */
.reception-v2::before {
  content: "";
  position: absolute;
  inset: -8% -8% auto -8%;
  height: 320px;
  background:
    radial-gradient(ellipse 60% 80% at 20% 0%,
      color-mix(in srgb, var(--rx-accent-bright) 10%, transparent), transparent 65%),
    radial-gradient(ellipse 50% 60% at 85% 30%,
      color-mix(in srgb, var(--rx-accent-vivid) 7%, transparent), transparent 65%);
  pointer-events: none;
  z-index: -1;
  animation: rx-halo-breathe 24s var(--rx-ease) infinite;
  will-change: opacity, transform;
}
@keyframes rx-halo-breathe {
  0%, 100% { opacity: 0.85; transform: translateY(0) scale(1); }
  50%      { opacity: 1;    transform: translateY(-6px) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .reception-v2::before { animation: none; }
}

/* Local override: this view doesn't want the default card top-rim line that
   v4-tokens injects on every .card (it competes with our denser layout). */
.reception-v2 .card::before { display: none; }

.reception-v2 .card {
  background: var(--rx-glass-fill);
  border: 1px solid var(--rx-rim);
  border-radius: 18px;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: var(--rx-card-shadow);
  transition: box-shadow var(--rx-dur-slow) var(--rx-ease),
              border-color var(--rx-dur-slow) var(--rx-ease);
}

/* =====================================================   VIEW CHROME — view-pill, clock, search, quick-stats render
   INSIDE the global app topbar (teleported via Alpine x-teleport
   into #topbar-view-chrome-slot). One header rule. The .reception-
   topbar wrapper is just a logical group; its children flow up as
   direct flex children of the topbar via display:contents.
   ============================================================ */
.topbar__view-chrome {
  display: flex;
  align-items: center;
  gap: var(--rx-s5, 16px);
  flex: 1 1 auto;
  min-width: 0;
  margin-left: var(--rx-s4, 12px);
}
/* Hide per-view chrome on phone widths (audit-bugfix 2026-05-25):
   the inline view-pill + clock + search + quickstats cluster overflows
   a 390px viewport and pushes the burger off-screen. Nav is reachable
   via the hamburger drawer; an in-view mobile search bar is the planned
   follow-up. Matches the 768px breakpoint used by .topbar__nav etc. in
   base.css so all the topbar collapse rules fire together. */
@media (max-width: 768px) {
  .topbar__view-chrome { display: none; }
}
.reception-topbar {
  display: contents;
}
.reception-topbar__left {
  display: flex;
  align-items: center;
  gap: var(--rx-s4);
  flex: 0 0 auto;
}
/* Captain locked 2026-05-26 — topbar reorder. After lifting the
   search out, reception_chrome ships only two children:
     .reception-topbar__left   — view-pill (least-used chrome cluster)
     .reception-topbar__time   — clock (absolute-centered, see below)
   The old .reception-topbar__center / .reception-topbar__right slots
   are gone. Stub the legacy rules to display:none so any straggler
   markup from older templates stays invisible instead of breaking
   the flex flow. */
.reception-topbar__center,
.reception-topbar__right {
  display: none;
}

/* Clock CENTERED in the topbar (Captain locked 2026-05-26).
   Pulled out of the flex layout via absolute positioning; containing
   block is .topbar (position: sticky in base.css — sticky elements form
   a positioning context for absolute descendants).

   Default position is the geometric middle (left: 50%); a small JS
   helper (reception-topbar-clock-centre.js) re-measures the LEFT and
   RIGHT cluster bounds on load + resize and parks the clock at the
   midpoint of the GAP between them. That way the clock reads as the
   visual centerpiece without overlapping the search input or the role
   pill, regardless of how wide the right cluster grows (niki-voice
   status pill, View-as pill, role label length, etc. all vary). When
   JS hasn't loaded or fails, the geometric-middle fallback still
   keeps the clock visible and centered-ish. */
.reception-topbar__time {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 5;
  pointer-events: none;     /* clock is decorative — clicks pass through */
  flex: none;               /* override the legacy flex:1 rule lower in this file */
  display: block;
  min-width: 0;
  /* CSS custom-prop hook the JS helper writes to. When set, overrides
     the 50% default via the more-specific rule on .reception-topbar__time[data-centered]. */
}
/* Captain re-locked 2026-05-26: right cluster shrunk (search + Niki moved
   LEFT). The clock can now sit at the TRUE geometric centre — the JS-helper
   gap-midpoint override is disabled; always 50%. */
.reception-topbar__time[data-centered] {
  left: 50% !important;
}
.reception-topbar__time .reception-clock {
  pointer-events: auto;
}

/* Hide the clock below 1100px — the right cluster (search + Ask Niki
   + role pill + theme + view-as) already runs ~550px wide and the left
   cluster + brand takes ~350px, leaving <200px of "gap" space; a 110px
   clock would always overlap at that density. Mobile (≤768) also hides
   chrome entirely via the burger collapse. The clock is decorative,
   not functional — hiding on narrow viewports is cleaner than ANY
   overlap with the search input. */
@media (max-width: 1100px) {
  .reception-topbar__time { display: none !important; }
}

/* =====================================================   VIEW PILL — premium glass workstation control
   ----------------------------------------------------------------
   The pill is a *control*, not a label. It uses a layered glass
   treatment (top inner highlight + bottom inner shadow) so it reads
   as a physical, depressible surface. The dropdown menu mirrors the
   trigger's glass language with a cyan top-edge bevel.

   Polish pass: Niki, 2026-05-23 — pill polish branch.
   ============================================================ */
.view-pill { position: relative; }

.view-pill__btn {
  --vp-bg-top:    color-mix(in srgb, var(--rx-accent) 8%,  var(--rx-glass-base));
  --vp-bg-bottom: color-mix(in srgb, var(--rx-accent-bright) 16%, var(--rx-glass-base));
  --vp-border:    color-mix(in srgb, var(--rx-accent) 32%, transparent);

  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--rx-s2);
  padding: 7px 12px 7px 11px;
  min-width: 168px;
  max-width: 200px;
  height: 34px;
  border-radius: 999px;
  background:
    /* subtle bottom-edge inner shadow → gives depth */
    linear-gradient(180deg, transparent 55%, rgba(15, 23, 42, 0.04) 100%),
    /* primary cyan-glass body */
    linear-gradient(180deg, var(--vp-bg-top) 0%, var(--vp-bg-bottom) 100%);
  border: 1px solid var(--vp-border);
  color: var(--rx-accent-text);
  font-family: var(--font-display, "Space Grotesk", "Inter");
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow:
    /* top inner highlight — the iOS-style glass cap */
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    /* very soft drop to lift it off the topbar */
    0 1px 1px rgba(15, 23, 42, 0.04),
    0 0 0 1px color-mix(in srgb, var(--rx-accent) 4%, transparent);
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-mid) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease);
}

.view-pill__btn:hover {
  --vp-bg-top:    color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base));
  --vp-bg-bottom: color-mix(in srgb, var(--rx-accent-bright) 24%, var(--rx-glass-base));
  --vp-border:    color-mix(in srgb, var(--rx-accent) 48%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(15, 23, 42, 0.05),
    0 6px 18px color-mix(in srgb, var(--rx-glow) 70%, transparent),
    0 0 0 1px color-mix(in srgb, var(--rx-accent) 10%, transparent);
}

.view-pill__btn:active { transform: scale(0.985); }

.view-pill__btn:focus-visible {
  outline: none;
  /* WCAG-AA focus ring kept; layered on top of the existing shadow */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 35%, transparent),
    0 0 0 1px var(--rx-accent-text);
}

/* Open-state — subtle scale-up + ambient halo pulse. The trigger
   "wakes up" when the menu is showing. */
.view-pill[data-open="true"] .view-pill__btn {
  --vp-bg-top:    color-mix(in srgb, var(--rx-accent) 16%, var(--rx-glass-base));
  --vp-bg-bottom: color-mix(in srgb, var(--rx-accent-bright) 26%, var(--rx-glass-base));
  --vp-border:    color-mix(in srgb, var(--rx-accent) 55%, transparent);
  transform: scale(1.015);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 4px 12px rgba(15, 23, 42, 0.06),
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent),
    0 0 22px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent);
  animation: rx-pill-pulse 2.8s ease-in-out infinite;
}
@keyframes rx-pill-pulse {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.95),
      0 4px 12px rgba(15, 23, 42, 0.06),
      0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent),
      0 0 22px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.95),
      0 4px 12px rgba(15, 23, 42, 0.06),
      0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 8%, transparent),
      0 0 30px color-mix(in srgb, var(--rx-accent-bright) 36%, transparent);
  }
}
@media (prefers-reduced-motion: reduce) {
  .view-pill[data-open="true"] .view-pill__btn { animation: none; transform: none; }
}

.view-pill__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--rx-accent-text);
  opacity: 0.92;
  flex-shrink: 0;
}
.view-pill__icon svg { width: 14px; height: 14px; display: block; }

.view-pill__label {
  flex: 1 1 auto;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-pill__chev {
  font-size: 10px;
  opacity: 0.72;
  flex-shrink: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--rx-dur-mid) var(--rx-ease),
              opacity   var(--rx-dur-fast) var(--rx-ease);
}
.view-pill__btn:hover .view-pill__chev { opacity: 1; }
.view-pill[data-open="true"] .view-pill__chev { transform: rotate(180deg); opacity: 1; }

/* ----------------------------------------------------------------
   DROPDOWN MENU — glass card with cyan top-edge bevel
   ---------------------------------------------------------------- */
.view-pill__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 248px;
  background:
    linear-gradient(180deg,
      var(--rx-glass-fill-hi) 0%,
      color-mix(in srgb, var(--rx-glass-base) 90%, transparent) 100%);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--rx-rim-hi);
  border-radius: 16px;
  box-shadow:
    /* cyan top-edge highlight — screen-edge bevel */
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 24%, var(--rx-glass-edge)),
    inset 0 -1px 0 var(--rx-glass-edge-soft),
    var(--rx-menu-shadow);
  padding: 6px;
  z-index: 30;
  transform-origin: top left;
}

/* Alpine transition classes (mirror of enter/leave). 4px slide-down +
   fade, springy easing on enter, calmer on leave. Reduced-motion
   override below falls back to plain opacity. */
.view-pill__menu--enter,
.view-pill__menu--leave {
  transition:
    opacity   180ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.view-pill__menu--enter-from,
.view-pill__menu--leave-to {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
}
.view-pill__menu--enter-to,
.view-pill__menu--leave-from {
  opacity: 1;
  transform: translateY(0) scale(1);
}
@media (prefers-reduced-motion: reduce) {
  .view-pill__menu--enter,
  .view-pill__menu--leave {
    transition: opacity 120ms linear;
  }
  .view-pill__menu--enter-from,
  .view-pill__menu--leave-to { transform: none; }
}

/* Section label — small tracked caps inside the menu */
.view-pill__section {
  padding: 8px 12px 6px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--rx-accent-text) 70%, transparent);
}

/* ----------------------------------------------------------------
   MENU ITEMS — icon + label + state, hover micro-highlight
   ---------------------------------------------------------------- */
.view-pill__item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--rx-text-strong);
  font-size: 13.5px;
  font-family: var(--font-body);
  font-weight: 500;
  isolation: isolate;
  overflow: hidden;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              color      var(--rx-dur-fast) var(--rx-ease);
}

/* Hover micro: a soft cyan wash slides in from the right behind the
   text. Pure CSS — no JS. */
.view-pill__item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
              transparent 0%,
              color-mix(in srgb, var(--rx-accent) 8%, transparent) 100%);
  opacity: 0;
  transform: translateX(8px);
  transition: opacity var(--rx-dur-mid) var(--rx-ease),
              transform var(--rx-dur-mid) var(--rx-ease);
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
}
.view-pill__item:not(.view-pill__item--soon):hover::before,
.view-pill__item:not(.view-pill__item--soon):focus-visible::before {
  opacity: 1;
  transform: translateX(0);
}
.view-pill__item:not(.view-pill__item--soon):hover {
  color: var(--rx-accent-text);
}

.view-pill__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
  color: var(--rx-accent-text);
  flex-shrink: 0;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease);
}
.view-pill__item-icon svg { width: 14px; height: 14px; display: block; }
.view-pill__item:not(.view-pill__item--soon):hover .view-pill__item-icon {
  background: color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 28%, transparent);
}

.view-pill__item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------------
   ACTIVE ITEM ("you are here") — pulsing dot + soft cyan tint
   I went with a pulsing dot over a left-strip: it reads cleaner in
   the dropdown's tight type rhythm and matches the live-pulse dots
   we already use elsewhere (clock, now-marker, hint badge).
   ---------------------------------------------------------------- */
.view-pill__item--active {
  background: linear-gradient(90deg,
              color-mix(in srgb, var(--rx-accent) 10%, transparent) 0%,
              color-mix(in srgb, var(--rx-accent-bright) 6%, transparent) 100%);
  color: var(--rx-accent-text);
  font-weight: 600;
}
.view-pill__item--active .view-pill__item-icon {
  background: color-mix(in srgb, var(--rx-accent) 16%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 32%, transparent);
}
.view-pill__item-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rx-accent-text);
}
.view-pill__item-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--rx-accent-bright);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  animation: rx-pulse-dot 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .view-pill__item-dot { animation: none; }
}

/* ----------------------------------------------------------------
   "COMING SOON" ITEMS — deliberately gated, not broken
   ---------------------------------------------------------------- */
.view-pill__item--soon {
  color: var(--rx-pill-soft);
  cursor: not-allowed;
}
.view-pill__item--soon .view-pill__item-icon {
  opacity: 0.6;
  background: color-mix(in srgb, var(--rx-accent) 4%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 10%, transparent);
}
.view-pill__item--soon:hover {
  background: transparent;
  color: var(--rx-pill-soft);
}
.view-pill__item-soon {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 11px;
  font-weight: 500;
  color: color-mix(in srgb, var(--rx-accent-text) 55%, transparent);
  letter-spacing: 0.005em;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-accent) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
}

/* Legacy class — preserved for any older callers that still emit
   <span class="view-pill__pill">; visually de-emphasised. */
.view-pill__pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-accent) 14%, transparent);
  color: var(--rx-accent-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

/* --- Clock — centerpiece of the topbar. Legacy flex rule kept for
       reference but neutered: the live rule higher in this file
       absolute-positions the slot at the geometric middle (Captain
       locked 2026-05-26). Comment only — no declarations. --- */
.reception-topbar__time {
  /* see the !important block higher up — absolute, left:50%, transform */
}

.reception-clock {
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--rx-accent-text);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  padding: 4px 14px;
  border-radius: 12px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 6%, transparent) 0%,
      transparent 100%);
  text-shadow:
    0 0 12px color-mix(in srgb, var(--rx-accent-bright) 40%, transparent),
    0 0 22px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  transition: text-shadow var(--rx-dur-mid) var(--rx-ease);
}
.reception-clock:hover {
  text-shadow:
    0 0 14px color-mix(in srgb, var(--rx-accent-bright) 55%, transparent),
    0 0 30px color-mix(in srgb, var(--rx-accent-bright) 30%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .reception-clock { transition: none; }
}

/* --- Search (wide, calm, cyan focus) --- */
.reception-search { position: relative; width: 100%; }
.reception-search__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted, #9ca3af);
  pointer-events: none;
}
.reception-search__icon svg { width: 100%; height: 100%; }
.reception-search__input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border-radius: 12px;
  border: 1px solid var(--rx-rim);
  background: var(--rx-glass-fill);
  font-family: var(--font-body, "Inter");
  font-size: 14px;
  color: var(--rx-text-strong);
  outline: none;
  transition: border-color var(--rx-dur-fast) var(--rx-ease),
              box-shadow var(--rx-dur-mid) var(--rx-ease),
              background var(--rx-dur-fast) var(--rx-ease);
}
.reception-search__input::placeholder { color: var(--rx-text-soft); }
.reception-search__input:hover { background: var(--rx-glass-fill-hi); }
.reception-search__input:focus {
  background: var(--rx-glass-fill-hi);
  border-color: var(--rx-accent-vivid);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 16px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent);
}
.reception-search__kbd {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
  color: var(--rx-text-soft);
  pointer-events: none;
}
.reception-search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--rx-glass-fill-hi);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--rx-rim);
  border-radius: 14px;
  box-shadow: var(--rx-menu-shadow);
  padding: 6px;
  max-height: 360px;
  overflow: auto;
  z-index: 30;
}
.reception-search__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--rx-text-strong);
  transition: background var(--rx-dur-fast) var(--rx-ease);
}
.reception-search__row:hover { background: color-mix(in srgb, var(--rx-accent) 8%, transparent); }
.reception-search__name {
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 14px;
}
.reception-search__phone {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--rx-text-soft);
  font-variant-numeric: tabular-nums;
}
.reception-search__empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  color: var(--rx-text-soft);
  font-size: 13px;
  font-family: var(--font-body);
}
.reception-search__empty svg {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* --- Search (topbar variant) — Captain locked 2026-05-26 —
       lifted out of reception_chrome into the global topbar's right
       cluster ("most-used buttons on the right"). The width is
       deliberately tight (170px) so the right cluster's left edge
       sits CLEAR of the geometric centre — the absolute-centered
       clock needs ~60px of breathing room on each side. Hidden on
       phone — the magnifier-icon trigger + full-screen sheet handle
       ≤768px. --- */
.reception-search--topbar {
  position: relative;
  width: 170px;
  flex: 0 0 auto;
  margin-right: var(--rx-s2, 8px);
}
.reception-search--topbar .reception-search__input {
  /* Slightly tighter padding than the in-chrome variant — keeps the
     right cluster height aligned with the 40px theme/chat/niki controls.
     ⌘K hint dropped on the topbar variant so the input stays calm
     instead of carrying its own glyph at this scale. */
  padding: 8px 12px 8px 36px;
  font-size: 13.5px;
  border-radius: 10px;
}
.reception-search--topbar .reception-search__icon {
  left: 12px;
  width: 16px;
  height: 16px;
}
.reception-search--topbar .reception-search__kbd { display: none; }
.reception-search--topbar .reception-search__results {
  /* Anchor the dropdown's right edge so it never overflows past the
     theme toggle on the far right. Dropdown is wider than the input
     so result rows have room. */
  left: auto;
  right: 0;
  width: 320px;
  max-width: 80vw;
}

/* Tablet (769–1200px): the right cluster carries 5+ controls (search,
   Ask Niki, voice-status pill, role pill, View-as pill, theme); at
   ≤1200 they together exceed 600px and overflow the viewport. Shrink
   the search to its tightest legible width AND hide the niki-voice-status
   pill (purely informational — surfaces which voice path Niki is on)
   so the workstation surface stays uncluttered. */
@media (max-width: 1200px) {
  .reception-search--topbar { width: 150px; }
  .reception-search--topbar .reception-search__input {
    font-size: 13px;
    padding: 7px 10px 7px 32px;
  }
  .reception-search--topbar .reception-search__icon { left: 10px; width: 14px; height: 14px; }
  /* Voice-status pill drops off below 1200px — full tooltip is preserved
     via title= on the trigger button when it next appears at desktop. */
  #niki-voice-status { display: none !important; }
}

/* Phone (≤768px): hide the desktop search entirely — the magnifier
   trigger in topbar.html and the full-screen mobile_patient_search
   sheet take over. Also hide for tenants that don't mount the
   patient slideover (the `view_chrome_partial` gate in topbar.html
   already prevents render, but the rule is defensive). */
@media (max-width: 768px) {
  .reception-search--topbar { display: none !important; }
}

/* === Topbar layout discipline — Captain locked 2026-05-26 ===
   The left cluster (brand · view-chrome · team-chat-trigger) must
   hug the LEFT edge; the right cluster (search · Ask Niki · role
   · view-as · theme) must hug the RIGHT edge; and the absolute
   clock owns the geometric centre. base.css's .topbar__nav has
   flex:1 which (on demo-dental, where nav_items is always empty)
   eats all the slack and pushes the view-chrome rightward into the
   clock zone. Use :has() to scope the override to topbars that
   actually carry a view-chrome — legacy tenants without a chrome
   keep base.css's flex:1 push-behaviour intact. */
.topbar:has(.topbar__view-chrome) .topbar__nav {
  flex: 0 0 auto;
  /* Empty <nav> still has whitespace inside, so :empty doesn't match.
     Setting min-width:0 + flex:0 0 auto collapses it to the natural
     width of its (zero) content. */
  min-width: 0;
}
.topbar__view-chrome {
  flex: 0 0 auto;
  margin-left: var(--rx-s4, 12px);
}
.topbar:has(.topbar__view-chrome) .topbar__right { margin-left: auto; }

/* Buffer the right cluster's left edge so it can never reach the
   clock's geometric-centre footprint (clock ~120px wide; half = 60px
   each side of x=50%; add a 16px breathing buffer = ~76px clearance
   needed). The buffer is enforced via min-margin-left on the search
   wrapper which is the first item in the right cluster on workstation
   views that mount the chrome. */
.topbar:has(.topbar__view-chrome) .topbar__right .reception-search--topbar {
  /* No extra margin needed at desktop widths — the 200px search +
     other right-cluster controls already clear the centre. The clamp
     prevents the right cluster from creeping centre-ward at narrow
     desktops. */
  margin-left: max(var(--rx-s2, 8px), 0px);
}

/* Mobile collapse: chat trigger joins view-pill in the burger
   drawer (Captain locked 2026-05-26 — least-used chrome leaves the
   surface on phones, only essentials stay). !important because the
   primary .team-chat-trigger rule lives lower in this file (line
   ~8315) and wins by cascade order otherwise. */
@media (max-width: 768px) {
  .team-chat-trigger { display: none !important; }
}

/* --- Quick stats chips --- */
.reception-quickstats {
  display: inline-flex;
  align-items: center;
  gap: var(--rx-s3);
}
.reception-quickstats__stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--rx-glass-fill-soft);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
  font-family: var(--font-display, "Space Grotesk");
  position: relative;
  cursor: default;
  transition: border-color var(--rx-dur-fast) var(--rx-ease),
              background var(--rx-dur-fast) var(--rx-ease);
}
.reception-quickstats__stat:hover {
  border-color: color-mix(in srgb, var(--rx-accent) 32%, transparent);
  background: var(--rx-glass-fill-hi);
}
.reception-quickstats__stat--booked  { color: var(--rx-accent-text); }
.reception-quickstats__stat--done    { color: var(--rx-healthy); }
.reception-quickstats__stat--done .reception-quickstats__val   { color: var(--rx-healthy); }
.reception-quickstats__stat--left    { color: var(--rx-text-strong); }
.reception-quickstats__stat--noshow  { color: var(--rx-critical); }
.reception-quickstats__stat--noshow .reception-quickstats__val { color: var(--rx-critical); }

.reception-quickstats__val {
  font-weight: 700;
  color: var(--rx-accent-text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.reception-quickstats__lbl {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.75;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

/* Tooltip on hover (CSS-only) */
.reception-quickstats__stat[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--rx-toast-bg);
  color: #fff;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--rx-dur-fast) var(--rx-ease),
              transform var(--rx-dur-fast) var(--rx-ease);
  z-index: 50;
}
.reception-quickstats__stat:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================   GRID — left side strip + timeline
   ============================================================ */
/* Workstation-fill: the Reception view occupies exactly one viewport — no
   outer page scrollbar. Internal scrolling happens INSIDE the timeline / side
   strip if their content overflows; the outer page never grows past 100vh. */
:root:has(.reception-v2) body { overflow: hidden; }
.content:has(> .reception-v2),
.content:has(> .stack.reception-v2) {
  max-width: none;
  padding: var(--rx-s3) var(--rx-s4);
  height: calc(100vh - var(--topbar-h, 64px));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.reception-v2 {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: var(--rx-s3);
  overflow: hidden;
  max-width: 100%;
}

.reception-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--rx-s3);
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .reception-grid { grid-template-columns: 1fr; }
}

/* =====================================================   LEFT SIDE STRIP — Arrivals / Walk-ins / Waiting
   ============================================================ */
.reception-side {
  padding: var(--rx-s4);
  display: flex;
  flex-direction: column;
  gap: var(--rx-s4);
  overflow-y: auto;
  min-height: 0;
}
.reception-side__group {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s2);
}
.reception-side__head {
  display: flex;
  align-items: center;
  gap: var(--rx-s2);
}
.reception-side__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--rx-accent) 10%, var(--rx-glass-base));
  color: var(--rx-accent-text);
}
.reception-side__icon svg { width: 16px; height: 16px; }
.reception-side__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--rx-text-strong);
  letter-spacing: -0.005em;
}
.reception-side__count {
  margin-left: auto;
  color: var(--rx-text-soft);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-accent) 6%, transparent);
}
.reception-side__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--rx-text-soft);
  padding: var(--rx-s4) var(--rx-s3);
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 3%, var(--rx-glass-base)) 0%,
              transparent 100%);
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 18%, transparent);
  text-align: center;
}
.reception-side__empty svg {
  width: 28px;
  height: 28px;
  opacity: 0.55;
  color: var(--rx-accent);
}
.reception-side__empty-text { line-height: 1.4; }

/* =====================================================   TIMELINE — the visual centrepiece
   ============================================================ */
.reception-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s4);
  padding: var(--rx-s4) var(--rx-s5);
  overflow-y: auto;
  min-height: 0;
}

.reception-timeline__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rx-s4);
}
.reception-timeline__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--rx-text-strong);
  letter-spacing: -0.01em;
  margin: 0;
}
.reception-timeline__sub {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--rx-text-soft);
  margin-top: 2px;
}
.reception-timeline__nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--rx-glass-fill-soft);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
  border-radius: 12px;
}
.reception-timeline__nav-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--rx-text-soft);
  cursor: pointer;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              color var(--rx-dur-fast) var(--rx-ease);
}
.reception-timeline__nav-btn:hover {
  background: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  color: var(--rx-accent-text);
}
.reception-timeline__nav-btn svg { width: 14px; height: 14px; }
.reception-timeline__week {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12.5px;
  color: var(--rx-text-strong);
  padding: 0 10px;
  letter-spacing: -0.005em;
}

/* Scrolling container */
.reception-timeline__scroller {
  position: relative;
  overflow-x: auto;
  padding-bottom: 4px;
}
.reception-timeline__scroller::-webkit-scrollbar { height: 8px; }
.reception-timeline__scroller::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 999px;
}
.reception-timeline__scroller::-webkit-scrollbar-track { background: transparent; }

/* Inner table */
.reception-timeline__inner {
  display: flex;
  flex-direction: column;
  min-width: 920px;
  position: relative;
}

/* Hour header row */
.reception-timeline__hours {
  display: grid;
  grid-template-columns: 180px 1fr;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg,
              var(--rx-glass-fill-hi) 0%,
              color-mix(in srgb, var(--rx-glass-base) 70%, transparent) 100%);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
}
.reception-timeline__hours-spacer { border-right: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent); }
.reception-timeline__hours-list {
  display: grid;
  grid-template-columns: repeat(var(--rx-hours, 10), minmax(80px, 1fr));
}
.reception-timeline__hour {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--rx-text-soft);
  font-variant-numeric: tabular-nums;
  padding: 8px 0 8px 8px;
  border-left: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
  letter-spacing: 0.02em;
}
.reception-timeline__hour:first-child { border-left: none; }

/* Practitioner row */
.reception-timeline__row {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 72px;
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent) 8%, transparent);
  transition: background var(--rx-dur-mid) var(--rx-ease);
}
.reception-timeline__row:hover {
  background: color-mix(in srgb, var(--rx-accent) 3%, transparent);
}
.reception-timeline__row:last-child { border-bottom: none; }

.reception-timeline__row-label {
  padding: 14px 12px 14px 0;
  border-right: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.reception-timeline__row-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--rx-text-strong);
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reception-timeline__row-name::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--rx-accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rx-accent) 16%, transparent);
}
.reception-timeline__row-role {
  font-size: 11.5px;
  color: var(--rx-text-soft);
  margin-top: 3px;
  margin-left: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.reception-timeline__row-blocks {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: repeat(var(--rx-hours, 10), minmax(80px, 1fr));
}
.reception-timeline__cell {
  border-left: 1px dashed color-mix(in srgb, var(--rx-accent) 8%, transparent);
}
.reception-timeline__cell:first-child { border-left: none; }

/* Appointment block — pill-shaped, gradient, lifts on hover.
   Position absolutely by data-start/data-end style overrides at render time. */
.reception-block {
  position: absolute;
  top: 10px;
  bottom: 10px;
  padding: 6px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--rx-accent) 90%, var(--rx-tier-mix-base)) 0%,
              color-mix(in srgb, var(--rx-accent-vivid) 70%, var(--rx-tier-mix-base)) 100%);
  color: #fff;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform var(--rx-dur-fast) var(--rx-ease),
              box-shadow var(--rx-dur-mid) var(--rx-ease);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reception-block:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px color-mix(in srgb, var(--rx-accent) 28%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.reception-block--warn {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}
.reception-block--warn:hover {
  box-shadow:
    0 6px 16px rgba(245, 158, 11, 0.32),
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.reception-block--critical {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}
.reception-block--critical:hover {
  box-shadow:
    0 6px 16px rgba(220, 38, 38, 0.36),
    0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Empty practitioner-row hint */
.reception-timeline__row-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 16px;
  font-size: 12px;
  color: var(--rx-text-soft);
  font-style: italic;
  pointer-events: none;
}

/* Time-now indicator — thin vertical line with pulse dot at top */
.reception-timeline__now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
              var(--rx-accent-bright) 0%,
              var(--rx-accent-vivid) 50%,
              transparent 100%);
  pointer-events: none;
  z-index: 1;
}
.reception-timeline__now::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rx-accent-bright);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 25%, transparent);
  animation: rx-pulse-now 2.4s ease-in-out infinite;
}
@keyframes rx-pulse-now {
  0%, 100% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 25%, transparent),
                0 0 8px color-mix(in srgb, var(--rx-accent-bright) 35%, transparent);
  }
  50% {
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
                0 0 14px color-mix(in srgb, var(--rx-accent-bright) 45%, transparent);
  }
}
@media (prefers-reduced-motion: reduce) { .reception-timeline__now::before { animation: none; } }

/* Full-empty state (no practitioners) */
.reception-timeline__empty-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rx-s3);
  padding: var(--rx-s8) var(--rx-s5);
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 20%, transparent);
  border-radius: 14px;
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 4%, var(--rx-glass-base)) 0%,
              transparent 100%);
}
.reception-timeline__empty-full svg {
  width: 56px;
  height: 56px;
  opacity: 0.5;
  color: var(--rx-accent);
}
.reception-timeline__empty-full-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--rx-text-strong);
}
.reception-timeline__empty-full-text {
  font-size: 13px;
  color: var(--rx-text-soft);
  max-width: 340px;
  line-height: 1.5;
}

/* =====================================================   NIKI HINTS — bottom strip
   ============================================================ */
.reception-hints {
  display: flex;
  align-items: center;
  gap: var(--rx-s4);
  padding: 12px var(--rx-s5);
  border-radius: 14px;
  background:
    linear-gradient(95deg,
      color-mix(in srgb, var(--rx-accent-bright) 8%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent-vivid) 4%, var(--rx-glass-base)) 100%);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 20%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--rx-accent) 8%, transparent);
}
.reception-hints__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--rx-glass-fill-hi);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--rx-accent-text);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.reception-hints__badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--rx-healthy);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-healthy) 22%, transparent);
  animation: rx-pulse-dot 2.4s ease-in-out infinite;
}
.reception-hints__msg {
  color: var(--rx-text-strong);
  font-size: 13px;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.reception-hints__msg-icon {
  font-size: 16px;
  opacity: 0.8;
  flex-shrink: 0;
}
.reception-hints__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--rx-rim);
  background: var(--rx-glass-fill-hi);
  color: var(--rx-accent-text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  opacity: 1;
  transform: none;
  transition: border-color var(--rx-dur-fast) var(--rx-ease),
              background var(--rx-dur-fast) var(--rx-ease);
}
.reception-hints__action:hover { border-color: var(--rx-accent); }

/* =====================================================   FAB — bottom-right floating action button
   ============================================================ */
.reception-fab {
  position: fixed;
  right: 28px;
  bottom: 78px;
  z-index: 40;
}
.reception-fab__btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 10px 28px color-mix(in srgb, var(--rx-accent-bright) 40%, transparent),
    0 2px 4px rgba(0, 0, 0, 0.10);
  transition: transform var(--rx-dur-mid) var(--rx-ease-out),
              box-shadow var(--rx-dur-mid) var(--rx-ease-out),
              filter var(--rx-dur-fast) var(--rx-ease);
}
.reception-fab__btn:hover {
  filter: brightness(1.05);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 16px 38px color-mix(in srgb, var(--rx-accent-bright) 52%, transparent),
    0 2px 4px rgba(0, 0, 0, 0.10);
}
.reception-fab__btn:active { transform: translateY(0) scale(0.98); }
.reception-fab__btn[aria-expanded="true"] {
  transform: rotate(45deg);
}
.reception-fab__icon {
  width: 22px;
  height: 22px;
  transition: transform var(--rx-dur-mid) var(--rx-ease-out);
}

.reception-fab__menu {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  min-width: 240px;
  background: var(--rx-glass-fill-hi);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--rx-rim);
  border-radius: 14px;
  box-shadow: var(--rx-menu-shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform-origin: bottom right;
}
.reception-fab__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  color: var(--rx-text-strong);
  transition: background var(--rx-dur-fast) var(--rx-ease);
}
.reception-fab__item:hover {
  background: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  color: var(--rx-accent-text);
}
.reception-fab__item-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--rx-accent) 10%, var(--rx-glass-base));
  color: var(--rx-accent-text);
  flex-shrink: 0;
}
.reception-fab__item-icon svg { width: 16px; height: 16px; }
.reception-fab__item-meta {
  margin-left: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--rx-text-soft);
  padding: 2px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--rx-accent) 5%, transparent);
}

/* =====================================================   MODALS — walk-in + booking, centered, glassy
   ============================================================ */
.reception-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--rx-s5);
}
.reception-modal__scrim {
  position: absolute;
  inset: 0;
  background: var(--rx-scrim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: rx-scrim-fade var(--rx-dur-mid) var(--rx-ease);
}
@keyframes rx-scrim-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.reception-modal__card {
  position: relative;
  max-width: 440px;
  width: 100%;
  background: var(--rx-glass-fill-hi);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--rx-rim-hi);
  border-radius: 18px;
  box-shadow: var(--rx-modal-shadow);
  padding: 22px 24px 20px;
  animation: rx-modal-in var(--rx-dur-mid) var(--rx-ease-out);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
@keyframes rx-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Soft cyan top-rim on modal cards — matches v4 login signature */
.reception-modal__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              var(--rx-accent-bright) 50%,
              transparent 100%);
  opacity: 0.7;
  pointer-events: none;
}

.reception-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.reception-modal__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--rx-text-strong);
  letter-spacing: -0.01em;
}
.reception-modal__title-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--rx-text-soft);
}
.reception-modal__close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  color: var(--rx-text-soft);
  transition: background var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease),
              color var(--rx-dur-fast) var(--rx-ease);
}
.reception-modal__close:hover {
  background: color-mix(in srgb, var(--rx-accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--rx-accent) 18%, transparent);
  color: var(--rx-accent-text);
}

.reception-modal__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.reception-modal__label {
  font-family: var(--font-display);
  font-size: 11.5px;
  color: var(--rx-text-soft);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reception-modal__input,
.reception-modal__textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, var(--border-hi, rgba(0, 0, 0, 0.08)));
  background: var(--rx-glass-base);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--rx-text-strong);
  outline: none;
  transition: border-color var(--rx-dur-fast) var(--rx-ease),
              box-shadow var(--rx-dur-mid) var(--rx-ease);
}
.reception-modal__input:hover,
.reception-modal__textarea:hover { border-color: color-mix(in srgb, var(--rx-accent) 38%, transparent); }
.reception-modal__input:focus,
.reception-modal__textarea:focus {
  border-color: var(--rx-accent-vivid);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent);
}
.reception-modal__textarea {
  resize: vertical;
  min-height: 60px;
}
.reception-modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.reception-modal__matches {
  background: color-mix(in srgb, var(--rx-accent) 4%, transparent);
  border-radius: 10px;
  padding: 4px;
  max-height: 220px;
  overflow: auto;
  margin-top: 6px;
}
.reception-modal__match-row {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--rx-dur-fast) var(--rx-ease);
  display: flex;
  align-items: center;
  gap: 8px;
}
.reception-modal__match-row:hover { background: color-mix(in srgb, var(--rx-accent) 14%, transparent); }
.reception-modal__match-name { font-weight: 500; font-size: 14px; color: var(--rx-text-strong); }
.reception-modal__match-phone {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--rx-text-soft);
  margin-left: auto;
}
.reception-modal__match-empty {
  padding: 14px 12px;
  font-size: 12.5px;
  color: var(--rx-text-soft);
  text-align: center;
}
.reception-modal__add-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 32%, transparent);
  color: var(--rx-accent-text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease);
}
.reception-modal__add-new:hover {
  background: color-mix(in srgb, var(--rx-accent) 8%, transparent);
  border-color: var(--rx-accent);
  border-style: solid;
}

/* Chips for treatment selection */
.reception-modal__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reception-modal__chip {
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, var(--border-hi, rgba(0, 0, 0, 0.08)));
  font-size: 12.5px;
  color: var(--rx-text-strong);
  font-family: var(--font-body);
  font-weight: 500;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease),
              color var(--rx-dur-fast) var(--rx-ease),
              transform var(--rx-dur-fast) var(--rx-ease);
}
.reception-modal__chip:hover {
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 32%, transparent);
}
.reception-modal__chip:active { transform: scale(0.97); }
.reception-modal__chip--active {
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 100%);
  border-color: var(--rx-accent-text);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--rx-accent) 30%, transparent);
}

/* Niki suggestion strip inside modals */
.reception-modal__niki {
  padding: 11px 14px;
  border-radius: 12px;
  background: linear-gradient(95deg,
              color-mix(in srgb, var(--rx-accent-bright) 8%, var(--rx-glass-base)) 0%,
              color-mix(in srgb, var(--rx-accent-vivid) 4%, var(--rx-glass-base)) 100%);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.reception-modal__niki-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 25%, transparent);
  color: var(--rx-accent-text);
}
.reception-modal__niki-icon svg { width: 14px; height: 14px; }
.reception-modal__niki-body { flex: 1; min-width: 0; }
.reception-modal__niki-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--rx-accent-text);
  font-size: 12.5px;
  letter-spacing: -0.005em;
}
.reception-modal__niki-detail {
  margin-top: 2px;
  color: var(--rx-text-strong);
  font-size: 12.5px;
  line-height: 1.45;
}
.reception-modal__niki-foot {
  margin-top: 4px;
  font-size: 11px;
  color: var(--rx-text-soft);
  font-style: italic;
}

/* Modal actions row */
.reception-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.reception-modal__primary {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rx-accent-text) 45%, transparent);
  cursor: pointer;
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 4px 14px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent);
  transition: filter var(--rx-dur-fast) var(--rx-ease),
              transform var(--rx-dur-fast) var(--rx-ease),
              box-shadow var(--rx-dur-mid) var(--rx-ease);
}
.reception-modal__primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 8px 22px color-mix(in srgb, var(--rx-accent-bright) 40%, transparent);
}
.reception-modal__primary:active { transform: translateY(0); filter: brightness(0.96); }
.reception-modal__primary:disabled {
  filter: grayscale(0.5) brightness(1.05);
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.reception-modal__primary:disabled:hover { box-shadow: none; }
.reception-modal__primary svg { width: 14px; height: 14px; }

.reception-modal__secondary {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, var(--border-hi, rgba(0, 0, 0, 0.08)));
  background: var(--rx-glass-base);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--rx-text-strong);
  transition: border-color var(--rx-dur-fast) var(--rx-ease),
              background var(--rx-dur-fast) var(--rx-ease);
}
.reception-modal__secondary:hover {
  border-color: var(--rx-accent);
  background: color-mix(in srgb, var(--rx-accent) 5%, var(--rx-glass-base));
  color: var(--rx-accent-text);
}

.reception-modal__hint {
  font-size: 11px;
  color: var(--rx-text-soft);
  margin-top: 4px;
}

/* =====================================================   PATIENT SLIDE-OUT — right-side drawer
   ============================================================ */
.reception-slideout {
  position: fixed;
  inset: 0;
  /* Patient slide-out is a top-level dialog: must sit ABOVE the topbar/main
     menu (z 60) and the patient-fullview scrim (z 70), matching the documented
     "below the drawer" intent. Was z 60 — tied with the topbar, so the menu
     covered the pop-out (Captain 2026-07-06). */
  z-index: 80;
}
.reception-slideout__scrim {
  position: absolute;
  inset: 0;
  background: var(--rx-scrim-light);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: rx-scrim-fade var(--rx-dur-mid) var(--rx-ease);
}
.reception-slideout__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: var(--rx-glass-fill-hi);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-left: 1px solid var(--rx-rim);
  box-shadow:
    -16px 0 44px rgba(0, 0, 0, 0.18),
    -1px 0 0 color-mix(in srgb, var(--rx-accent) 12%, transparent);
  display: flex;
  flex-direction: column;
  animation: rx-slideout-in var(--rx-dur-mid) var(--rx-ease-out);
}
@keyframes rx-slideout-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.reception-slideout__empty {
  padding: var(--rx-s8) var(--rx-s5);
  color: var(--rx-text-soft);
  text-align: center;
  font-size: 13px;
}

/* Slide-out internals — populated by the patient slide-out partial */
.reception-slideout__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.reception-slideout__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--rx-s3);
  padding: 18px 20px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
  position: relative;
}
.reception-slideout__head::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              var(--rx-accent-bright) 50%,
              transparent 100%);
  opacity: 0.6;
}
.reception-slideout__name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--rx-text-strong);
  letter-spacing: -0.01em;
}
.reception-slideout__meta {
  font-size: 12px;
  color: var(--rx-text-soft);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.reception-slideout__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--rx-text-soft);
}

.reception-slideout__tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  overflow-x: auto;
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
  position: sticky;
  top: 0;
  background: var(--rx-glass-fill-hi);
  backdrop-filter: blur(8px);
  z-index: 2;
}
.reception-slideout__tabs::-webkit-scrollbar { display: none; }
.reception-slideout__tab {
  padding: 7px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--rx-text-soft);
  white-space: nowrap;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              color var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease);
}
.reception-slideout__tab:hover {
  background: color-mix(in srgb, var(--rx-accent) 6%, transparent);
  color: var(--rx-accent-text);
}
.reception-slideout__tab--active {
  background: color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base));
  color: var(--rx-accent-text);
  font-weight: 600;
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
}

.reception-slideout__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
}
.reception-slideout__pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reception-slideout__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: var(--rx-s8) var(--rx-s5);
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 14px;
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 3%, var(--rx-glass-base)) 0%,
              transparent 100%);
}
.reception-slideout__placeholder svg {
  width: 36px;
  height: 36px;
  opacity: 0.5;
  color: var(--rx-accent);
}
.reception-slideout__placeholder-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rx-text-strong);
}
.reception-slideout__placeholder-text {
  font-size: 12px;
  color: var(--rx-text-soft);
  line-height: 1.5;
  max-width: 260px;
}

/* =====================================================   PATIENT SLIDEOUT TAB CONTENT (H1 fix 2026-05-27)
   ============================================================ */
/* Skeleton during HTMX load. */
.patient-slideout__loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--rx-s5) 0;
  color: var(--rx-text-soft);
  font-size: 12.5px;
}
.patient-slideout__loading svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  color: var(--rx-accent);
  animation: rx-slideout-spin 1s linear infinite;
}
@keyframes rx-slideout-spin {
  to { transform: rotate(360deg); }
}

/* Tab body wrapper — every tab partial uses this. */
.patient-slideout__tab {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Section group inside the Overview tab. */
.patient-slideout__section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.patient-slideout__section-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rx-text-soft);
}

/* Key-value list for Overview tab. */
.patient-slideout__kv {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 13px;
  color: var(--rx-text-strong);
}
.patient-slideout__kv dt {
  color: var(--rx-text-soft);
  font-weight: 500;
}
.patient-slideout__kv dd {
  margin: 0;
  font-weight: 500;
}

/* Quick stats (upcoming / past counts). */
.patient-slideout__stats {
  display: flex;
  gap: 14px;
}
.patient-slideout__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rx-accent) 5%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, transparent);
  min-width: 78px;
}
.patient-slideout__stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--rx-accent-text);
  line-height: 1;
}
.patient-slideout__stat-label {
  font-size: 11px;
  color: var(--rx-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.patient-slideout__inline-note {
  font-size: 12px;
  color: var(--rx-text-soft);
}
.patient-slideout__inline-note strong {
  color: var(--rx-text-strong);
  font-weight: 600;
}

/* Consent / status chip. */
.patient-slideout__chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  width: fit-content;
}
.patient-slideout__chip--ok {
  background: color-mix(in srgb, #14b87a 14%, transparent);
  color: #0f8a5b;
  border: 1px solid color-mix(in srgb, #14b87a 32%, transparent);
}
.patient-slideout__chip--warn {
  background: color-mix(in srgb, #f0a325 14%, transparent);
  color: #a86c00;
  border: 1px solid color-mix(in srgb, #f0a325 32%, transparent);
}

/* Summary line above a row list. */
.patient-slideout__summary {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
}
.patient-slideout__summary--ok {
  background: color-mix(in srgb, #14b87a 9%, transparent);
  color: #0f6f4b;
  border: 1px solid color-mix(in srgb, #14b87a 22%, transparent);
}
.patient-slideout__summary--warn {
  background: color-mix(in srgb, #f0a325 10%, transparent);
  color: #8a5800;
  border: 1px solid color-mix(in srgb, #f0a325 22%, transparent);
}
.patient-slideout__summary strong { font-weight: 700; }

/* Row list (appointments / invoices / complaints). */
.patient-slideout__rows {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.patient-slideout__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
  font-size: 12.5px;
  color: var(--rx-text-strong);
  transition: background var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease);
}
.patient-slideout__row:hover {
  background: color-mix(in srgb, var(--rx-accent) 4%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 28%, transparent);
}
.patient-slideout__row--overdue {
  border-color: color-mix(in srgb, #d04848 30%, transparent);
}
.patient-slideout__row--future {
  border-left: 3px solid var(--rx-accent);
}
.patient-slideout__row-btn {
  all: unset;
  cursor: pointer;
  display: contents;
}
.patient-slideout__row-btn:focus-visible {
  outline: 2px solid var(--rx-accent-bright);
  outline-offset: 2px;
  border-radius: 8px;
}
.patient-slideout__row-when {
  flex: 0 0 auto;
  min-width: 110px;
  color: var(--rx-text-soft);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.patient-slideout__row-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.patient-slideout__row-summary {
  font-size: 12px;
  line-height: 1.4;
  color: var(--rx-text-strong);
}
.patient-slideout__row-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.patient-slideout__row-meta {
  font-size: 11px;
  color: var(--rx-text-soft);
}
.patient-slideout__row-overdue {
  color: #d04848;
  font-weight: 600;
}
.patient-slideout__row-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: lowercase;
  background: color-mix(in srgb, var(--rx-accent) 14%, transparent);
  color: var(--rx-accent-text);
  width: fit-content;
}
.patient-slideout__row-chip--sev-high {
  background: color-mix(in srgb, #d04848 16%, transparent);
  color: #b03333;
}
.patient-slideout__row-chip--sev-medium {
  background: color-mix(in srgb, #f0a325 16%, transparent);
  color: #8a5800;
}
.patient-slideout__row-status {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--rx-text-soft) 14%, transparent);
  color: var(--rx-text-soft);
}
.patient-slideout__row-status--paid,
.patient-slideout__row-status--resolved,
.patient-slideout__row-status--confirmed,
.patient-slideout__row-status--completed {
  background: color-mix(in srgb, #14b87a 16%, transparent);
  color: #0f6f4b;
}
.patient-slideout__row-status--overdue,
.patient-slideout__row-status--rejected,
.patient-slideout__row-status--open,
.patient-slideout__row-status--cancelled {
  background: color-mix(in srgb, #d04848 16%, transparent);
  color: #b03333;
}

/* =====================================================   PATIENT LINK — inline button inside any reception surface
   (was <a href="javascript:void(0)"> until M4 a11y pass 2026-05-27 —
   now a real <button type="button"> with the same dashed-underline look).
   ============================================================ */
.patient-link {
  /* Reset button chrome so it renders inline like the old anchor */
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  /* Inline-link presentation */
  color: var(--rx-accent-text);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--rx-accent) 38%, transparent);
  cursor: pointer;
  transition: color var(--rx-dur-fast) var(--rx-ease),
              border-bottom-color var(--rx-dur-fast) var(--rx-ease);
}
.patient-link:hover {
  color: var(--rx-accent);
  border-bottom-color: var(--rx-accent);
  border-bottom-style: solid;
}
.patient-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 25%, transparent);
  border-radius: 4px;
}

/* =====================================================   TOAST — bottom-centre status snack
   ============================================================ */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--rx-toast-bg);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: rx-toast-in var(--rx-dur-mid) var(--rx-ease-out);
}
#toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--rx-accent-bright);
  box-shadow: 0 0 8px var(--rx-accent-bright);
}
@keyframes rx-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* =====================================================   ACCESSIBILITY — focus + screen-reader helpers
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reception-v2 button:focus-visible,
.reception-v2 [role="button"]:focus-visible,
.reception-v2 a:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 25%, transparent),
    0 0 0 1px var(--rx-accent-text);
  border-radius: 8px;
}

/* =====================================================   RESPONSIVE — tablet + phone graceful degrade
   ============================================================ */
@media (max-width: 1400px) {
  .reception-topbar { grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.5fr) auto; }
}

@media (max-width: 1100px) {
  .reception-topbar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
  }
  .reception-topbar__right { justify-self: start; }
  .reception-quickstats { flex-wrap: wrap; }
  .reception-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .reception-v2 { gap: 10px; }
  .reception-topbar { padding: 10px 14px; }
  .reception-search__kbd { display: none; }
  .reception-clock { font-size: 16px; }
  .reception-side, .reception-timeline { padding: 14px; }
  .reception-timeline__inner { min-width: 720px; }
  .reception-fab { right: 16px; bottom: 16px; }
  .reception-fab__btn { width: 52px; height: 52px; }
  .reception-modal { padding: 12px; }
  .reception-modal__card { padding: 18px 18px 16px; }
  .reception-slideout__panel { width: 100%; }
}

/* =====================================================   REDUCED MOTION — honour user pref
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .reception-v2 *,
  .reception-v2 *::before,
  .reception-v2 *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =====================================================================   YOUR STACK — universal workstation action-queue view (locked 2026-05-23).

   Lives under .your-stack (BEM root). Renders the three confidence tiers:
   red flags, drafts, auto-approved log. Every staff role gets the SAME
   visual structure; only the card content differs by job.

   Hook root: <section class="stack reception-v2 your-stack">
   Card root: <article class="stack-card stack-card--{tier}">

   Region-naming contract: every DOM block carries data-stack-region="..."
   so Captain can point at a region by name and a future specialist can
   grep instantly. See _stack_card.html for the full region cheat-sheet.

   Author: Niki, 2026-05-23.
   ============================================================================ */

/* =====================================================   YOUR-STACK ROOT — header + scrollable tier container
   ============================================================ */

/* Local tier hues — derived from --rx-* (no new tokens).
   Red = warning red, Amber = warning amber, Green = healthy.
   *-soft variants mix with --rx-tier-mix-base which is `white` in light
   mode and `var(--bg-card)` (#111113) in dark mode — so tier-soft pills
   stay visible against both backgrounds without re-defining the tier. */
.your-stack {
  --ys-red:        var(--rx-critical, #dc2626);
  --ys-red-soft:   color-mix(in srgb, var(--rx-critical, #dc2626) 12%, var(--rx-tier-mix-base));
  --ys-red-rim:    color-mix(in srgb, var(--rx-critical, #dc2626) 38%, transparent);
  --ys-amber:      var(--rx-warn, #d97706);
  --ys-amber-soft: color-mix(in srgb, var(--rx-warn, #d97706) 12%, var(--rx-tier-mix-base));
  --ys-amber-rim:  color-mix(in srgb, var(--rx-warn, #d97706) 38%, transparent);
  --ys-green:      var(--rx-healthy, #16a34a);
  --ys-green-soft: color-mix(in srgb, var(--rx-healthy, #16a34a) 10%, var(--rx-tier-mix-base));
  --ys-green-rim:  color-mix(in srgb, var(--rx-healthy, #16a34a) 32%, transparent);
}

/* Page-level header (above the scroll). Sits at the top of the workstation
   surface — title + count + "Niki live" pulse on the right. */
.your-stack__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--rx-s4);
  padding: var(--rx-s3) var(--rx-s4) var(--rx-s2);
  flex: 0 0 auto;
}
.your-stack__title-block { display: flex; flex-direction: column; gap: 4px; }
.your-stack__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--rx-text-strong);
  margin: 0;
  line-height: 1.1;
}
.your-stack__sub {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--rx-text-soft);
  margin: 0;
  line-height: 1.4;
}
.your-stack__sub-extra {
  color: color-mix(in srgb, var(--rx-accent-text) 75%, var(--rx-text-soft));
}

/* Niki pulse — small live indicator. Pulsing green dot = "Niki is on it". */
.your-stack__niki-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ys-green) 8%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--ys-green) 25%, transparent);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--ys-green) 70%, var(--rx-text-strong));
}
.your-stack__niki-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--ys-green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ys-green) 60%, transparent);
  animation: ys-pulse 2.4s var(--rx-ease) infinite;
}
@keyframes ys-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ys-green) 50%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ys-green) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .your-stack__niki-dot { animation: none; }
}

/* Scroll container — the workstation rule says NO outer page scroll.
   This div is the only scroll surface inside the workstation. */
.your-stack__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--rx-s2) var(--rx-s4) var(--rx-s5);
  display: flex;
  flex-direction: column;
  gap: var(--rx-s5);
  scroll-padding-top: var(--rx-s4);
}
.your-stack__scroll::-webkit-scrollbar { width: 9px; }
.your-stack__scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 999px;
}
.your-stack__scroll::-webkit-scrollbar-track { background: transparent; }

/* =====================================================   STACK-SECTION — one per tier (Red / Drafts / Auto-log)
   ============================================================ */
.stack-section {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s3);
}

/* SECTION-HEADER — tier-coded; the dot + name + count + sub.
   Sticky inside the scroll so the tier label stays visible while
   scrolling its cards. */
.stack-section__header {
  display: flex;
  align-items: center;
  gap: var(--rx-s2);
  padding: var(--rx-s2) var(--rx-s1) var(--rx-s2) var(--rx-s2);
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg,
              var(--rx-glass-fill-hi) 0%,
              color-mix(in srgb, var(--rx-glass-base) 78%, transparent) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
}
.stack-section__dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
}
.stack-section__dot--red   { background: var(--ys-red);   color: var(--ys-red); }
.stack-section__dot--amber { background: var(--ys-amber); color: var(--ys-amber); }
.stack-section__dot--green { background: var(--ys-green); color: var(--ys-green); }

.stack-section__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--rx-text-strong);
  margin: 0;
}
.stack-section__count {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  color: var(--rx-accent-text);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, transparent);
}
.stack-section__sub {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--rx-text-soft);
  margin: 0 0 0 4px;
  line-height: 1.4;
  flex: 1 1 auto;
}

/* Collapsible header (auto-log tier only) — the whole header becomes a
   button. Chevron rotates when open. */
.stack-section__toggle {
  display: flex;
  align-items: center;
  gap: var(--rx-s2);
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  min-height: 36px;
}
.stack-section__chev {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 8px;
  color: var(--rx-text-soft);
  transition: transform var(--rx-dur-mid) var(--rx-ease),
              background var(--rx-dur-fast) var(--rx-ease);
}
.stack-section__toggle:hover .stack-section__chev {
  background: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  color: var(--rx-accent-text);
}

/* SECTION-BODY — vertical list of cards. */
.stack-section__body {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s3);
}

/* SECTION-EMPTY — per-tier zero-state. Dashed surface with icon + line. */
.stack-section__empty {
  display: flex;
  align-items: center;
  gap: var(--rx-s3);
  padding: var(--rx-s4) var(--rx-s5);
  border-radius: 14px;
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 3%, var(--rx-glass-base)) 0%,
              transparent 100%);
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-text-soft);
  font-size: 13px;
}
.stack-section__empty svg {
  color: var(--rx-accent);
  opacity: 0.7;
  flex-shrink: 0;
}

/* =====================================================   STACK-CARD — the universal card shape. Same DOM across every tier.
   Differences are surface-level (left-edge tier dot + soft tier-tinted rim).
   ============================================================ */
.stack-card {
  position: relative;
  display: grid;
  grid-template-columns: 6px 1fr;
  gap: 0;
  background: var(--rx-glass-fill);
  border: 1px solid var(--rx-rim);
  border-radius: 16px;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: var(--rx-card-shadow);
  overflow: hidden;
  transition:
    box-shadow var(--rx-dur-mid) var(--rx-ease),
    border-color var(--rx-dur-mid) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease);
  outline: none;
}
.stack-card:hover {
  border-color: color-mix(in srgb, var(--rx-accent) 32%, transparent);
  box-shadow: var(--rx-card-shadow-hi);
  transform: translateY(-1px);
}
.stack-card:focus-visible {
  border-color: var(--rx-accent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent),
    0 0 0 1px var(--rx-accent-text);
}

/* CARD-CONFIDENCE — the full-height tier dot rail down the left edge.
   The grid's first column. Tier colour is applied via stack-card__dot. */
.stack-card__confidence {
  position: relative;
  width: 6px;
}
.stack-card__dot {
  position: absolute;
  inset: 0;
}
.stack-card__dot--red   { background: linear-gradient(180deg, var(--ys-red)   0%, color-mix(in srgb, var(--ys-red)   60%, var(--rx-tier-mix-base)) 100%); }
.stack-card__dot--amber { background: linear-gradient(180deg, var(--ys-amber) 0%, color-mix(in srgb, var(--ys-amber) 60%, var(--rx-tier-mix-base)) 100%); }
.stack-card__dot--green { background: linear-gradient(180deg, var(--ys-green) 0%, color-mix(in srgb, var(--ys-green) 55%, var(--rx-tier-mix-base)) 100%); }

/* Tier-tinted surface wash — very subtle, keeps the cards COHERENT but
   tier-readable at a glance. Faded base is glass-fill so light vs dark
   resolves correctly. */
.stack-card--red   { background: linear-gradient(180deg, var(--ys-red-soft)   0%, var(--rx-glass-fill) 32%); }
.stack-card--amber { background: linear-gradient(180deg, var(--ys-amber-soft) 0%, var(--rx-glass-fill) 32%); }
.stack-card--green { background: linear-gradient(180deg, var(--ys-green-soft) 0%, var(--rx-glass-fill) 32%); }

/* Inner content column */
.stack-card__inner {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s3);
  padding: var(--rx-s4) var(--rx-s5) var(--rx-s4) var(--rx-s4);
  min-width: 0;
}

/* CARD-HEADER — action type + relative timestamp. */
.stack-card__header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
}
.stack-card__action-type {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--rx-accent-text);
}
.stack-card__sep { color: var(--rx-text-soft); opacity: 0.5; }
.stack-card__time {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--rx-text-soft);
  font-variant-numeric: tabular-nums;
}

/* CARD-SUBJECT — name + scheme chip + allergy chip + last-contact. */
.stack-card__subject {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.stack-card__subject-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--rx-text-strong);
}
.stack-card__subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.stack-card__subject-chip--scheme {
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, transparent);
  color: var(--rx-accent-text);
}
.stack-card__subject-chip--allergy {
  background: color-mix(in srgb, var(--ys-red) 10%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--ys-red) 28%, transparent);
  color: color-mix(in srgb, var(--ys-red) 75%, var(--rx-text-strong));
}
.stack-card__subject-last {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--rx-text-soft);
}

/* CARD-BODY — the variant block (message / fact / checklist / batch). */
.stack-card__body { display: flex; flex-direction: column; }

/* Message preview — quoted draft, soft cyan rim on the left edge to
   suggest "this is what Niki wrote". */
.stack-card__draft {
  position: relative;
  margin: 0;
  padding: var(--rx-s3) var(--rx-s4) var(--rx-s3) var(--rx-s5);
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 5%, var(--rx-glass-base)) 0%,
              var(--rx-glass-fill-soft) 100%);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--rx-text-strong);
}
.stack-card__draft-quote {
  position: absolute;
  top: 4px; left: 10px;
  font-family: "Space Grotesk", serif;
  font-size: 36px;
  line-height: 1;
  color: color-mix(in srgb, var(--rx-accent) 40%, transparent);
}
.stack-card__draft-text { display: block; padding-left: 6px; }

/* Fact line — single statement (the "what's going on" body). */
.stack-card__fact {
  margin: 0;
  padding: var(--rx-s3) var(--rx-s4);
  background: var(--rx-glass-fill-soft);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--rx-text-strong);
}

/* Checklist body — items with green ticks. */
.stack-card__checklist {
  list-style: none;
  margin: 0;
  padding: var(--rx-s3) var(--rx-s4);
  background: var(--rx-glass-fill-soft);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stack-card__checklist li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--rx-text-strong);
}
.stack-card__checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ys-green) 14%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--ys-green) 38%, transparent);
}
.stack-card__checklist li::after {
  content: "";
  position: absolute;
  left: 3px; top: 7px;
  width: 8px; height: 5px;
  border-left: 1.5px solid var(--ys-green);
  border-bottom: 1.5px solid var(--ys-green);
  transform: rotate(-45deg);
}

/* Batch tile — big number + label, for "12 things auto-sent" type cards. */
.stack-card__batch {
  display: flex;
  align-items: baseline;
  gap: var(--rx-s3);
  padding: var(--rx-s3) var(--rx-s4);
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--ys-green) 6%, var(--rx-glass-base)) 0%,
              var(--rx-glass-fill-soft) 100%);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--ys-green) 18%, transparent);
}
.stack-card__batch-count {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--ys-green) 70%, var(--rx-text-strong));
  font-variant-numeric: tabular-nums;
}
.stack-card__batch-label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--rx-text-strong);
}

/* CARD-REASONING — the "Why Niki drafted this" block. ALWAYS visible. */
.stack-card__reasoning {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--rx-s2) var(--rx-s3);
  border-radius: 10px;
  background: color-mix(in srgb, var(--rx-accent) 4%, var(--rx-glass-base));
  border-left: 2px solid color-mix(in srgb, var(--rx-accent) 36%, transparent);
}
.stack-card__reasoning-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rx-accent-text);
}
.stack-card__reasoning-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stack-card__reasoning-list li {
  position: relative;
  padding-left: 14px;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--rx-text-strong) 88%, transparent);
}
.stack-card__reasoning-list li::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px;
  width: 4px; height: 4px;
  border-radius: 999px;
  background: var(--rx-accent);
  opacity: 0.7;
}

/* CARD-META — channel icon + arbitrary pills (TTL / attachments / extras). */
.stack-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.stack-card__meta-channel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-accent-text);
}
.stack-card__meta-channel--whatsapp {
  background: color-mix(in srgb, #25D366 10%, var(--rx-glass-base));
  border-color: color-mix(in srgb, #25D366 32%, transparent);
  color: color-mix(in srgb, #25D366 60%, var(--rx-text-strong));
}
.stack-card__meta-channel--voice {
  background: color-mix(in srgb, var(--ys-amber) 10%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--ys-amber) 32%, transparent);
  color: color-mix(in srgb, var(--ys-amber) 65%, var(--rx-text-strong));
}
.stack-card__meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--rx-glass-fill-soft);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, transparent);
  color: var(--rx-text-soft);
}
.stack-card__meta-pill--ttl {
  background: color-mix(in srgb, var(--ys-amber) 8%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--ys-amber) 26%, transparent);
  color: color-mix(in srgb, var(--ys-amber) 65%, var(--rx-text-strong));
  font-weight: 600;
}

/* CARD-ACTIONS — primary + up to 3 secondaries. Same order, every card. */
.stack-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.stack-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, transparent);
  background: var(--rx-glass-fill);
  color: var(--rx-text-strong);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.003em;
  cursor: pointer;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-mid) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease);
}
.stack-card__btn:hover {
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--rx-glass-base));
  border-color: var(--rx-accent);
  color: var(--rx-accent-text);
}
.stack-card__btn:active { transform: translateY(1px); }
.stack-card__btn--primary {
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--rx-accent-text) 45%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-text) 38%, transparent);
}
.stack-card__btn--primary:hover {
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: #fff;
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 8px 22px color-mix(in srgb, var(--rx-accent-bright) 30%, transparent),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-text) 55%, transparent);
}
.stack-card__btn--ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  color: var(--rx-text-soft);
}
.stack-card__btn--ghost:hover {
  background: color-mix(in srgb, var(--rx-accent) 4%, transparent);
  color: var(--rx-accent-text);
}

/* Touch targets — coarse pointer (tablets at the front desk) get 44px. */
@media (pointer: coarse) {
  .stack-card__btn { min-height: 44px; padding: 10px 16px; }
  .stack-section__toggle { min-height: 44px; }
}

/* =====================================================   YOUR-STACK RESPONSIVE — graceful narrow-down
   ============================================================ */
@media (max-width: 880px) {
  .your-stack__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--rx-s2);
  }
  .stack-card__inner { padding: var(--rx-s3); }
  .stack-card__actions { gap: 6px; }
  .stack-card__btn { padding: 7px 11px; font-size: 12.5px; }
}
@media (max-width: 560px) {
  .your-stack__title { font-size: 19px; }
  .stack-card__subject-name { font-size: 15.5px; }
  .stack-card__draft, .stack-card__fact, .stack-card__checklist { font-size: 13px; }
}

/* =====================================================   YOUR-STACK REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .stack-card,
  .stack-card__btn,
  .stack-section__chev {
    transition: none !important;
  }
  .stack-card:hover,
  .stack-card__btn--primary:hover { transform: none; }
  .your-stack__niki-dot { animation: none; }
}

/* =====================================================================   EMAIL VIEW — WhatsApp-shape mailbox (locked 2026-05-23).

   Captain's brief: "i would like our email to work like whats app does."
   Two-pane, conversation-centric. Left = conversation list, right = open
   thread with sticky compose. Niki drafts live INSIDE the thread as a
   distinctive cyan-bordered system bubble; approval swaps them to a
   regular sent bubble (Alpine-only — no API).

   Region-naming contract: every named DOM block carries data-email-region.
   See email.html + _email_conv_row.html + _email_msg_bubble.html for the
   full nested region map.

   Theme parity: every cyan-tinted surface is derived from --rx-* aliases
   which already resolve in BOTH light and dark via the rebind block at the
   top of this file. We only override a small handful of pure-cyan accents
   in the dark-mode block below.

   Author: Niki, 2026-05-23.
   ============================================================================ */

/* Outer page-fill rule (matches Reception + Stack): the wrapping
   :root:has(.reception-v2) body { overflow: hidden; } already applies
   because we share the .reception-v2 hook root. The .content rule already
   covers .stack.reception-v2. We add an explicit .email-view rule so the
   panes can flex inside the workstation height without growing it. */
.content:has(> .stack.reception-v2.email-view),
.content:has(> .reception-v2.email-view) {
  /* duplicates the height/overflow contract — defensive in case the
     :has(...) selector falls through on older targets. */
  height: calc(100vh - var(--topbar-h, 64px));
  overflow: hidden;
}

.email-view {
  /* Local tokens — derived from --rx-* (NO new globals).
     - bubble-out  : sent bubble fill (cyan-tinted)
     - bubble-in   : received bubble fill (paper white / dark glass)
     - thread-bg   : the texture-y backdrop behind the bubbles
     - pane-rim    : 1px rim between panes
  */
  --em-pane-w:      360px;
  --em-bubble-radius:14px;
  --em-bubble-pad:  10px 12px;
  --em-bubble-max:  min(76%, 560px);
  --em-bubble-out-bg:   color-mix(in srgb, var(--rx-accent) 16%, var(--rx-glass-base));
  --em-bubble-out-rim:  color-mix(in srgb, var(--rx-accent) 35%, transparent);
  --em-bubble-in-bg:    var(--rx-glass-fill-hi);
  --em-bubble-in-rim:   color-mix(in srgb, var(--rx-accent) 10%, transparent);
  --em-thread-bg:       color-mix(in srgb, var(--rx-accent) 3%, transparent);
  --em-pane-rim:        color-mix(in srgb, var(--rx-accent) 12%, transparent);
  --em-row-hover:       color-mix(in srgb, var(--rx-accent) 6%, transparent);
  --em-row-active-bg:   color-mix(in srgb, var(--rx-accent) 11%, var(--rx-glass-base));
  --em-row-active-rim:  color-mix(in srgb, var(--rx-accent) 30%, transparent);
  --em-draft-rim:       color-mix(in srgb, var(--rx-accent-bright) 55%, transparent);
  --em-draft-bg:        color-mix(in srgb, var(--rx-accent) 7%, var(--rx-glass-base));

  display: grid;
  grid-template-columns: var(--em-pane-w) 1fr;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  background: var(--rx-glass-fill);
  border: 1px solid var(--em-pane-rim);
  box-shadow: var(--rx-card-shadow);
  position: relative;
  isolation: isolate;
}

/* ====================================================   LEFT PANE — conversation list
   =========================================================== */
.email-pane-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--em-pane-rim);
  background: linear-gradient(180deg,
              var(--rx-glass-fill-hi) 0%,
              var(--rx-glass-fill) 100%);
  position: relative;
}
.email-pane-list__head {
  padding: var(--rx-s4) var(--rx-s4) var(--rx-s2);
  flex: 0 0 auto;
}
.email-pane-list__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.015em;
  color: var(--rx-text-strong);
  margin: 0 0 2px;
  line-height: 1.15;
}
.email-pane-list__sub {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--rx-text-soft);
  margin: 0;
  line-height: 1.3;
}

/* EMAIL-SEARCH ------------------------------------------------ */
.email-search {
  position: relative;
  margin: 0 var(--rx-s3) var(--rx-s2);
  flex: 0 0 auto;
}
.email-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rx-text-soft);
  pointer-events: none;
  display: inline-flex;
}
.email-search__input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 34px;
  border-radius: 10px;
  border: 1px solid var(--em-pane-rim);
  background: var(--rx-glass-fill);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--rx-text-strong);
  transition:
    border-color var(--rx-dur-fast) var(--rx-ease),
    background var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-fast) var(--rx-ease);
}
.email-search__input::placeholder { color: var(--rx-text-soft); }
.email-search__input:hover {
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
}
.email-search__input:focus {
  outline: none;
  border-color: var(--rx-accent);
  background: var(--rx-glass-fill-hi);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
}
.email-search__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 999px;
  border: none;
  background: color-mix(in srgb, var(--rx-text-soft) 18%, transparent);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--rx-dur-fast) var(--rx-ease);
}
.email-search__clear:hover { background: var(--rx-text-soft); }

/* EMAIL-FILTERS ----------------------------------------------- */
.email-filters {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0 var(--rx-s3) var(--rx-s2);
  flex: 0 0 auto;
  scrollbar-width: none;
}
.email-filters::-webkit-scrollbar { display: none; }
.email-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--rx-glass-fill-soft);
  border: 1px solid var(--em-pane-rim);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--rx-text-soft);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease);
}
.email-filter-chip:hover {
  background: var(--em-row-hover);
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-accent-text);
}
.email-filter-chip--active {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent) 22%, var(--rx-glass-base)) 0%,
              color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base)) 100%);
  border-color: color-mix(in srgb, var(--rx-accent) 50%, transparent);
  color: var(--rx-accent-text);
  font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--rx-accent) 16%, transparent);
}

/* EMAIL-PANE-LIST scroll ------------------------------------- */
.email-pane-list__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--rx-s2) 80px;
}
.email-pane-list__scroll::-webkit-scrollbar { width: 8px; }
.email-pane-list__scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 20%, transparent);
  border-radius: 999px;
}
.email-pane-list__scroll::-webkit-scrollbar-track { background: transparent; }

/* EMAIL-CONV-ROW --------------------------------------------- */
.email-conv-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  margin-bottom: 2px;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease);
}
.email-conv-row:hover {
  background: var(--em-row-hover);
}
.email-conv-row:focus-visible {
  outline: none;
  border-color: var(--rx-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
}
.email-conv-row--active {
  background: var(--em-row-active-bg);
  border-color: var(--em-row-active-rim);
}
.email-conv-row--active:hover { background: var(--em-row-active-bg); }

.email-conv-row__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.email-conv-row__top,
.email-conv-row__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* EMAIL-CONV-AVATAR ------------------------------------------ */
.email-conv-avatar {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--rx-accent-text);
  background: linear-gradient(160deg,
              color-mix(in srgb, var(--rx-accent) 24%, var(--rx-glass-base)) 0%,
              color-mix(in srgb, var(--rx-accent) 12%, var(--rx-glass-base)) 100%);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 26%, transparent);
  box-shadow: inset 0 1px 0 var(--rx-glass-edge);
  text-transform: uppercase;
}
.email-conv-avatar--scheme {
  background: linear-gradient(160deg,
              color-mix(in srgb, var(--rx-warn) 24%, var(--rx-glass-base)) 0%,
              color-mix(in srgb, var(--rx-warn) 12%, var(--rx-glass-base)) 100%);
  border-color: color-mix(in srgb, var(--rx-warn) 30%, transparent);
  color: color-mix(in srgb, var(--rx-warn) 70%, var(--rx-text-strong));
}
.email-conv-avatar--staff {
  background: linear-gradient(160deg,
              color-mix(in srgb, var(--rx-healthy) 24%, var(--rx-glass-base)) 0%,
              color-mix(in srgb, var(--rx-healthy) 12%, var(--rx-glass-base)) 100%);
  border-color: color-mix(in srgb, var(--rx-healthy) 30%, transparent);
  color: color-mix(in srgb, var(--rx-healthy) 65%, var(--rx-text-strong));
}
.email-conv-avatar--lg {
  width: 36px; height: 36px;
  font-size: 12.5px;
}

/* EMAIL-CONV-NAME / preview / meta --------------------------- */
.email-conv-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--rx-text-strong);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.email-conv-row--unread .email-conv-name {
  font-weight: 700;
}

.email-conv-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.email-conv-time {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--rx-text-soft);
}
.email-conv-row--unread .email-conv-time {
  color: var(--rx-accent-text);
  font-weight: 600;
}

.email-conv-preview {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--rx-text-soft);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
.email-conv-row--unread .email-conv-preview {
  color: var(--rx-text-strong);
}
.email-conv-preview__prefix {
  color: var(--rx-text-soft);
  font-style: italic;
  margin-right: 2px;
}

.email-conv-row__indicators {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.email-conv-niki {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 32%, transparent);
  color: var(--rx-accent-text);
}
.email-conv-badge {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 100%);
  color: var(--rx-on-accent);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--rx-accent) 36%, transparent);
}

/* EMAIL-EMPTY-LIST ------------------------------------------- */
.email-empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--rx-text-soft);
}
.email-empty-list__title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--rx-text-strong);
  margin: 4px 0 0;
}
.email-empty-list__sub {
  font-family: var(--font-body);
  font-size: 12.5px;
  margin: 0;
  line-height: 1.4;
}
.email-empty-list__reset {
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 30%, transparent);
  background: var(--rx-glass-fill);
  color: var(--rx-accent-text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--rx-dur-fast) var(--rx-ease);
}
.email-empty-list__reset:hover {
  background: var(--em-row-hover);
}

/* EMAIL-NEW (FAB) -------------------------------------------- */
.email-new {
  position: absolute;
  bottom: 18px;
  right: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rx-accent-text) 38%, transparent);
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: var(--rx-on-accent);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 22px color-mix(in srgb, var(--rx-accent-bright) 32%, transparent),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-text) 32%, transparent);
  transition:
    transform var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-mid) var(--rx-ease),
    filter var(--rx-dur-fast) var(--rx-ease);
}
.email-new:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 12px 28px color-mix(in srgb, var(--rx-accent-bright) 44%, transparent),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-text) 42%, transparent);
}
.email-new:active { transform: translateY(0); }
.email-new__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

/* ====================================================   RIGHT PANE — open conversation thread
   =========================================================== */
.email-pane-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%,
      color-mix(in srgb, var(--rx-accent-bright) 5%, transparent) 0%,
      transparent 60%),
    var(--rx-glass-fill);
}
.email-thread-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* EMAIL-THREAD-HEADER ---------------------------------------- */
.email-thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  flex: 0 0 auto;
  background: linear-gradient(180deg,
              var(--rx-glass-fill-hi) 0%,
              var(--rx-glass-fill) 100%);
  border-bottom: 1px solid var(--em-pane-rim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.email-thread-header__back {
  display: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--em-pane-rim);
  background: var(--rx-glass-fill);
  color: var(--rx-text-strong);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.email-thread-header__id {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}
.email-thread-header__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--rx-text-strong);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-thread-header__sub {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--rx-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* EMAIL-THREAD-ACTIONS --------------------------------------- */
.email-thread-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.email-thread-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--rx-text-soft);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease);
}
.email-thread-action:hover {
  background: var(--em-row-hover);
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-accent-text);
}
.email-thread-action__label {
  white-space: nowrap;
}

/* EMAIL-THREAD-BODY ------------------------------------------ */
.email-thread-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-image:
    radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--rx-accent-bright) 4%, transparent), transparent 32%),
    radial-gradient(circle at 80% 86%, color-mix(in srgb, var(--rx-accent) 4%, transparent), transparent 36%);
  scroll-behavior: smooth;
}
.email-thread-body::-webkit-scrollbar { width: 9px; }
.email-thread-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 18%, transparent);
  border-radius: 999px;
}
.email-thread-body::-webkit-scrollbar-track { background: transparent; }
.email-thread-body:focus-visible { outline: none; }

/* EMAIL-DATE-SEP --------------------------------------------- */
.email-date-sep {
  display: flex;
  justify-content: center;
  margin: 6px 0;
}
.email-date-sep__pill {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--rx-text-soft);
  background: var(--rx-glass-fill-hi);
  border: 1px solid var(--em-pane-rim);
  border-radius: 999px;
  padding: 3px 10px;
  text-transform: uppercase;
}

/* EMAIL-MSG-BUBBLE ------------------------------------------- */
.email-msg-bubble {
  max-width: var(--em-bubble-max);
  padding: var(--em-bubble-pad);
  border-radius: var(--em-bubble-radius);
  border: 1px solid transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: em-bubble-in 220ms var(--rx-ease-out);
}
@keyframes em-bubble-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.email-msg-bubble--in {
  align-self: flex-start;
  background: var(--em-bubble-in-bg);
  border-color: var(--em-bubble-in-rim);
  border-bottom-left-radius: 4px;
  color: var(--rx-text-strong);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.email-msg-bubble--out {
  align-self: flex-end;
  background: var(--em-bubble-out-bg);
  border-color: var(--em-bubble-out-rim);
  border-bottom-right-radius: 4px;
  color: var(--rx-text-strong);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--rx-accent) 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--rx-glass-edge) 60%, transparent);
}
.email-msg-bubble--just-approved {
  animation: em-bubble-pop 320ms var(--rx-ease-out);
}
@keyframes em-bubble-pop {
  0%   { opacity: 0; transform: scale(0.96) translateY(6px); }
  60%  { opacity: 1; transform: scale(1.015) translateY(0); }
  100% { transform: scale(1); }
}
.email-msg-bubble__body {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--rx-text-strong);
  white-space: pre-wrap;
  word-break: break-word;
}
.email-msg-bubble__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.email-msg-bubble__time {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--rx-text-soft);
}
.email-msg-bubble__ticks {
  display: inline-flex;
  align-items: center;
  color: var(--rx-text-soft);
}
.email-msg-bubble__ticks--read {
  color: var(--rx-accent);
}

/* EMAIL-MSG-NIKI-DRAFT --------------------------------------- */
.email-msg-niki-draft {
  align-self: flex-end;
  max-width: var(--em-bubble-max);
  padding: 12px 14px;
  border-radius: var(--em-bubble-radius);
  border: 1.5px dashed var(--em-draft-rim);
  background: var(--em-draft-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow:
    0 4px 14px color-mix(in srgb, var(--rx-accent-bright) 16%, transparent),
    inset 0 1px 0 var(--rx-glass-edge);
  animation: em-bubble-in 220ms var(--rx-ease-out);
}
.email-msg-niki-draft--approved {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.email-msg-niki-draft__head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.email-msg-niki-draft__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 7px;
  background: linear-gradient(160deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 100%);
  color: var(--rx-on-accent);
  flex-shrink: 0;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--rx-accent) 30%, transparent);
}
.email-msg-niki-draft__label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--rx-accent-text);
  letter-spacing: 0.005em;
  flex: 1 1 auto;
}
.email-msg-niki-draft__time {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--rx-text-soft);
  font-style: italic;
}
.email-msg-niki-draft__body {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--rx-text-strong);
  margin: 0;
  white-space: pre-wrap;
}
.email-msg-niki-draft__reasoning {
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  background: var(--rx-glass-fill-hi);
  border: 1px solid var(--em-pane-rim);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.email-msg-niki-draft__reasoning li {
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--rx-text-soft);
  padding-left: 12px;
  position: relative;
}
.email-msg-niki-draft__reasoning li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 4px; height: 4px;
  border-radius: 999px;
  background: var(--rx-accent);
}
.email-msg-niki-draft__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.email-msg-niki-draft__btn {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--em-pane-rim);
  background: var(--rx-glass-fill);
  color: var(--rx-text-strong);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-mid) var(--rx-ease);
}
.email-msg-niki-draft__btn:hover {
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--rx-glass-base));
  border-color: var(--rx-accent);
  color: var(--rx-accent-text);
}
.email-msg-niki-draft__btn--primary {
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: var(--rx-on-accent);
  border: 1px solid color-mix(in srgb, var(--rx-accent-text) 45%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-text) 38%, transparent);
  font-weight: 600;
}
.email-msg-niki-draft__btn--primary:hover {
  color: var(--rx-on-accent);
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 22px color-mix(in srgb, var(--rx-accent-bright) 30%, transparent),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-text) 55%, transparent);
}
.email-msg-niki-draft__btn--ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  color: var(--rx-text-soft);
}
.email-msg-niki-draft__btn--ghost:hover {
  background: color-mix(in srgb, var(--rx-text-soft) 8%, transparent);
  color: var(--rx-text-soft);
  border-color: var(--em-pane-rim);
}

/* EMAIL-COMPOSE ---------------------------------------------- */
.email-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 12px;
  flex: 0 0 auto;
  background: linear-gradient(0deg,
              var(--rx-glass-fill-hi) 0%,
              var(--rx-glass-fill) 100%);
  border-top: 1px solid var(--em-pane-rim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.email-compose__attach {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--em-pane-rim);
  background: var(--rx-glass-fill);
  color: var(--rx-text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease);
}
.email-compose__attach:hover {
  background: var(--em-row-hover);
  color: var(--rx-accent-text);
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
}
.email-compose__input {
  flex: 1 1 auto;
  min-height: 36px;
  max-height: 140px;
  padding: 8px 14px;
  border-radius: 18px;
  border: 1px solid var(--em-pane-rim);
  background: var(--rx-glass-fill-hi);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--rx-text-strong);
  resize: none;
  overflow-y: auto;
  transition:
    border-color var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-fast) var(--rx-ease);
}
.email-compose__input::placeholder { color: var(--rx-text-soft); }
.email-compose__input:focus {
  outline: none;
  border-color: var(--rx-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
}
.email-compose__send {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rx-accent-text) 38%, transparent);
  background: linear-gradient(180deg,
              var(--rx-accent-vivid) 0%,
              var(--rx-accent) 55%,
              var(--rx-accent-text) 100%);
  color: var(--rx-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 14px color-mix(in srgb, var(--rx-accent-bright) 30%, transparent);
  transition:
    transform var(--rx-dur-fast) var(--rx-ease),
    filter var(--rx-dur-fast) var(--rx-ease),
    opacity var(--rx-dur-fast) var(--rx-ease);
}
.email-compose__send:hover:not([disabled]) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.email-compose__send[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.6);
}
.email-compose__send svg {
  margin-right: 1px; /* visual centring of the paper-plane glyph */
}

/* EMAIL-EMPTY-THREAD ----------------------------------------- */
.email-empty-thread {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
  color: var(--rx-text-soft);
  background:
    radial-gradient(circle at 50% 30%,
      color-mix(in srgb, var(--rx-accent-bright) 5%, transparent) 0%,
      transparent 55%);
}
.email-empty-thread__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--rx-text-strong);
  margin: 8px 0 0;
}
.email-empty-thread__sub {
  font-family: var(--font-body);
  font-size: 13px;
  margin: 0;
  max-width: 320px;
  line-height: 1.45;
}

/* ====================================================   FOCUS RINGS — universal, cyan, a11y-friendly
   =========================================================== */
.email-view .email-filter-chip:focus-visible,
.email-view .email-search__input:focus-visible,
.email-view .email-thread-action:focus-visible,
.email-view .email-thread-header__back:focus-visible,
.email-view .email-msg-niki-draft__btn:focus-visible,
.email-view .email-compose__attach:focus-visible,
.email-view .email-compose__input:focus-visible,
.email-view .email-compose__send:focus-visible,
.email-view .email-new:focus-visible,
.email-view .email-empty-list__reset:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 32%, transparent),
    0 0 0 1px var(--rx-accent);
}

/* ====================================================   DARK MODE — surface tweaks (everything else inherits via --rx-* aliases)
   =========================================================== */
:root[data-theme="dark"] .email-view {
  --em-bubble-out-bg:   color-mix(in srgb, var(--rx-accent) 28%, var(--bg-card-hi, #17171A));
  --em-bubble-out-rim:  color-mix(in srgb, var(--rx-accent-bright) 38%, transparent);
  --em-bubble-in-bg:    color-mix(in srgb, var(--bg-card-hi, #17171A) 96%, transparent);
  --em-bubble-in-rim:   color-mix(in srgb, var(--rx-accent) 14%, transparent);
  --em-row-active-bg:   color-mix(in srgb, var(--rx-accent) 18%, var(--bg-card, #111113));
  --em-row-active-rim:  color-mix(in srgb, var(--rx-accent-bright) 38%, transparent);
  --em-draft-bg:        color-mix(in srgb, var(--rx-accent) 12%, var(--bg-card, #111113));
  --em-draft-rim:       color-mix(in srgb, var(--rx-accent-bright) 50%, transparent);
}
:root[data-theme="dark"] .email-conv-time,
:root[data-theme="dark"] .email-conv-row--unread .email-conv-time,
:root[data-theme="dark"] .email-conv-niki,
:root[data-theme="dark"] .email-msg-niki-draft__label,
:root[data-theme="dark"] .email-msg-bubble__ticks--read,
:root[data-theme="dark"] .email-empty-list__reset {
  color: var(--accent-soft, #7FE3FF);
}
:root[data-theme="dark"] .email-conv-row--unread .email-conv-time {
  font-weight: 600;
}
:root[data-theme="dark"] .email-msg-bubble--out .email-msg-bubble__body,
:root[data-theme="dark"] .email-msg-niki-draft__body {
  color: var(--text, #F5F5F7);
}
:root[data-theme="dark"] .email-msg-bubble--in {
  color: var(--text, #F5F5F7);
}
:root[data-theme="dark"] .email-conv-avatar {
  color: var(--accent-soft, #7FE3FF);
}

/* ====================================================   COARSE-POINTER (tablets at the front desk) — 44px touch targets
   =========================================================== */
@media (pointer: coarse) {
  .email-conv-row { min-height: 56px; padding: 12px 10px; }
  .email-filter-chip { min-height: 44px; padding: 10px 14px; font-size: 13px; }
  .email-search__input { height: 44px; font-size: 14px; }
  .email-thread-action { min-height: 44px; padding: 8px 12px; }
  .email-msg-niki-draft__btn { min-height: 44px; padding: 10px 14px; font-size: 13px; }
  .email-compose__attach,
  .email-compose__send { width: 44px; height: 44px; }
  .email-compose__input { min-height: 44px; padding: 11px 16px; font-size: 14px; }
  .email-new { min-height: 48px; padding: 12px 18px 12px 16px; }
  .email-thread-header__back { width: 40px; height: 40px; }
}

/* ====================================================   RESPONSIVE — drill-in mobile pattern (WhatsApp shape)

   ≤ 640px: collapse to a single pane. List shows; clicking a row
   swaps mobilePane to 'thread' which hides the list and shows the
   thread. Back arrow in the thread header returns to list.
   =========================================================== */
@media (max-width: 880px) {
  .email-view {
    --em-pane-w: 320px;
  }
}
@media (max-width: 640px) {
  .email-view {
    grid-template-columns: 1fr;
    position: relative;
  }
  .email-pane-list,
  .email-pane-thread {
    grid-column: 1;
    grid-row: 1;
  }
  .email-pane-list[data-mobile-hidden="true"] { display: none; }
  .email-pane-thread[data-mobile-hidden="true"] { display: none; }
  .email-thread-header__back { display: inline-flex; }
  .email-thread-header__sub { font-size: 11.5px; }
  .email-thread-action__label { display: none; }
  .email-msg-bubble { max-width: 88%; }
  .email-msg-niki-draft { max-width: 92%; }
  .email-new {
    bottom: 16px;
    right: 16px;
    padding: 12px 16px 12px 14px;
  }
  .email-new__label { display: none; }
  .email-new__icon { background: transparent; }
}

/* ====================================================   REDUCED MOTION
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  .email-msg-bubble,
  .email-msg-bubble--just-approved,
  .email-msg-niki-draft,
  .email-conv-row,
  .email-filter-chip,
  .email-new,
  .email-compose__send,
  .email-msg-niki-draft__btn,
  .email-msg-niki-draft__btn--primary {
    animation: none !important;
    transition: none !important;
  }
  .email-new:hover,
  .email-compose__send:hover,
  .email-msg-niki-draft__btn--primary:hover { transform: none; filter: none; }
  .email-thread-body { scroll-behavior: auto; }
}


/* =====================================================   PATIENT FULL-VIEW SLIDE-OVER — Captain locked 2026-05-24
   Polished 2026-05-24: premium entrance/exit, gradient hairline
   rim, top-edge progress bar, skeleton loading, proper error
   card, first-open hint, floating back-chevron.

   The drawer surfaces matrix-v2's patient overview as a full-height
   sheet below the global topbar. NO drawer header — the embedded
   matrix-v2 H1 is the only visible heading (Captain lock).
   Close paths: ESC + backdrop click + back-chevron.

   The chrome alias block (--rx-*) is published on .reception-v2 and
   .topbar__view-chrome higher up; we re-publish a slim subset on
   .patient-fullview so the drawer's nested DOM resolves cleanly even
   when injected as a sibling of the topbar.
   ============================================================ */
.patient-fullview {
  position: relative;
  /* Local alias re-publish so the drawer (sibling of .topbar / .reception-v2)
     resolves the cyan family + glass shadows in BOTH themes. */
  --rx-accent:        var(--accent, #0099B0);
  --rx-accent-vivid:  var(--accent-vivid, #00B5D1);
  --rx-accent-bright: var(--accent-bright, #00D4FF);
  --rx-accent-text:   var(--accent-text, #007885);
  --rx-glow:          var(--accent-glow-bright, rgba(0, 212, 255, 0.22));
  --pf-ease:          cubic-bezier(0.16, 1, 0.3, 1);   /* premium ease-out */
  --pf-ease-in:       cubic-bezier(0.4, 0, 0.2, 1);
  --pf-enter-dur:     320ms;
  --pf-leave-dur:     420ms;                            /* exit gentler */
  --pf-scrim-dur:     360ms;
}
:root[data-theme="dark"] .patient-fullview {
  --rx-glow: color-mix(in srgb, var(--rx-accent-bright) 32%, transparent);
}
.patient-fullview[data-state="closed"] { pointer-events: none; }
.patient-fullview[data-state="open"]   { pointer-events: auto; }

/* ---- BACKDROP --------------------------------------------------------- */
.patient-fullview__scrim {
  position: fixed;
  inset: 0;
  z-index: 70;                     /* above the topbar (z 60), below the drawer */
  background:
    radial-gradient(ellipse 80% 55% at 28% 30%,
      color-mix(in srgb, var(--rx-accent-bright) 7%, transparent) 0%,
      transparent 62%),
    rgba(15, 23, 42, 0.46);
  backdrop-filter: saturate(135%) blur(8px);
  -webkit-backdrop-filter: saturate(135%) blur(8px);
  cursor: zoom-out;
  will-change: opacity, backdrop-filter;
}
:root[data-theme="dark"] .patient-fullview__scrim {
  background:
    radial-gradient(ellipse 80% 55% at 28% 30%,
      color-mix(in srgb, var(--rx-accent-bright) 11%, transparent) 0%,
      transparent 62%),
    rgba(0, 0, 0, 0.72);
}

/* Backdrop ramps blur 0 → full alongside the panel slide. */
.patient-fullview__scrim--enter {
  transition:
    opacity var(--pf-scrim-dur) var(--pf-ease),
    backdrop-filter var(--pf-scrim-dur) var(--pf-ease),
    -webkit-backdrop-filter var(--pf-scrim-dur) var(--pf-ease);
}
.patient-fullview__scrim--leave {
  transition:
    opacity calc(var(--pf-leave-dur) - 60ms) var(--pf-ease-in),
    backdrop-filter calc(var(--pf-leave-dur) - 60ms) var(--pf-ease-in),
    -webkit-backdrop-filter calc(var(--pf-leave-dur) - 60ms) var(--pf-ease-in);
}
.patient-fullview__scrim--enter-from,
.patient-fullview__scrim--leave-to {
  opacity: 0;
  backdrop-filter: saturate(100%) blur(0px);
  -webkit-backdrop-filter: saturate(100%) blur(0px);
}
.patient-fullview__scrim--enter-to,
.patient-fullview__scrim--leave-from {
  opacity: 1;
  backdrop-filter: saturate(135%) blur(8px);
  -webkit-backdrop-filter: saturate(135%) blur(8px);
}

/* ---- PANEL ------------------------------------------------------------ */
.patient-fullview__panel {
  position: fixed;
  top: 0;                          /* full viewport height — Captain locked 2026-05-24 — bage touches top + bottom */
  right: 0;
  bottom: 0;
  width: min(1180px, 68vw);        /* Captain 2026-05-24 (side-nav pass): nudged from 880/60vw to host the new vertical rail + content side-by-side — still leaves a comfortable backdrop band */
  z-index: 71;
  display: flex;
  flex-direction: column;
  background: var(--bg, #fafafa);
  border-left: 1px solid color-mix(in srgb, var(--rx-accent) 14%, var(--border, #e5e5e8));
  box-shadow:
    -28px 0 72px rgba(15, 23, 42, 0.18),
    -6px 0 16px rgba(15, 23, 42, 0.06),
    -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  overflow: hidden;
  isolation: isolate;
  will-change: transform, opacity;
}
:root[data-theme="dark"] .patient-fullview__panel {
  background: var(--bg-card, #111113);
  border-left-color: color-mix(in srgb, var(--rx-accent-bright) 28%, var(--border-hi, #2A2A2E));
  box-shadow:
    -28px 0 72px rgba(0, 0, 0, 0.58),
    -6px 0 16px rgba(0, 0, 0, 0.32),
    -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 38%, transparent),
    0 0 60px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent);
}

/* Slide-in / slide-out animation. Enter is brisk + confident; exit is
   slightly slower for a calmer dismissal. Honours reduced-motion. */
.patient-fullview__panel--enter {
  transition:
    transform var(--pf-enter-dur) var(--pf-ease),
    opacity   calc(var(--pf-enter-dur) - 80ms) var(--pf-ease);
}
.patient-fullview__panel--leave {
  transition:
    transform var(--pf-leave-dur) var(--pf-ease-in),
    opacity   calc(var(--pf-leave-dur) - 100ms) var(--pf-ease-in);
}
.patient-fullview__panel--enter-from,
.patient-fullview__panel--leave-to {
  transform: translate3d(32px, 0, 0);
  opacity: 0;
}
.patient-fullview__panel--enter-to,
.patient-fullview__panel--leave-from {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__panel--enter,
  .patient-fullview__panel--leave { transition: opacity 140ms linear; }
  .patient-fullview__panel--enter-from,
  .patient-fullview__panel--leave-to { transform: none; }
  .patient-fullview__scrim--enter,
  .patient-fullview__scrim--leave { transition: opacity 140ms linear; }
  .patient-fullview__scrim--enter-from,
  .patient-fullview__scrim--leave-to {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---- RIM LIGHT --------------------------------------------------------
   Cyan gradient hairline on the panel's left edge — strongest at the top
   (anchoring corner), fading to transparent by the bottom. Layered on a
   radial accent at the top-left corner for depth. Pointer-inert. */
.patient-fullview__rim {
  position: absolute;
  top: 0;
  left: 0;
  width: 220px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(220px 160px at 0 0,
      color-mix(in srgb, var(--rx-accent-bright) 14%, transparent) 0%,
      transparent 70%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 38%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 12%, transparent) 18%,
      transparent 50%);
  /* Confine the gradient hairline to the 1px left edge with a mask. */
  mask:
    linear-gradient(90deg, #000 0, #000 1px, transparent 1px) left/100% 100% no-repeat,
    radial-gradient(220px 160px at 0 0, #000 0%, transparent 70%);
  -webkit-mask:
    linear-gradient(90deg, #000 0, #000 1px, transparent 1px) left/100% 100% no-repeat,
    radial-gradient(220px 160px at 0 0, #000 0%, transparent 70%);
  mask-composite: add;
  -webkit-mask-composite: source-over;
}
:root[data-theme="dark"] .patient-fullview__rim {
  background:
    radial-gradient(240px 180px at 0 0,
      color-mix(in srgb, var(--rx-accent-bright) 22%, transparent) 0%,
      transparent 70%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 60%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 22%, transparent) 22%,
      transparent 55%);
}

/* ---- TOP PROGRESS BAR -------------------------------------------------
   Thin cyan strip at the very top edge of the panel while loading. */
.patient-fullview__progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 4;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--rx-accent-bright) 90%, transparent) 30%,
    color-mix(in srgb, var(--rx-accent-bright) 100%, transparent) 50%,
    color-mix(in srgb, var(--rx-accent-bright) 90%, transparent) 70%,
    transparent 100%);
  background-size: 220% 100%;
  background-position: 100% 0;
  animation: patient-fullview-progress 1.6s var(--pf-ease) infinite;
  pointer-events: none;
}
@keyframes patient-fullview-progress {
  0%   { background-position: 120% 0; opacity: 0.75; }
  50%  { opacity: 1; }
  100% { background-position: -120% 0; opacity: 0.75; }
}
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__progress { animation: none; opacity: 0.85; }
}

/* ---- BACK CHEVRON -----------------------------------------------------
   Small floating affordance pinned to the left edge of the panel. Keeps
   Captain's "no title-bar X" lock — this is a subtle, optional close
   path that disambiguates the implicit ESC/backdrop dismissal. */
.patient-fullview__back {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;     /* above the body's sticky patient-nav-strip (z-index: 6) */
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card, #fff) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 20%, var(--border, #e5e5e8));
  color: var(--rx-accent-text, #007885);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition:
    background 160ms var(--pf-ease),
    border-color 160ms var(--pf-ease),
    color 160ms var(--pf-ease),
    transform 200ms var(--pf-ease),
    box-shadow 200ms var(--pf-ease);
  opacity: 0.86;
}
.patient-fullview__back:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--rx-accent) 10%, var(--bg-card, #fff));
  border-color: color-mix(in srgb, var(--rx-accent) 38%, transparent);
  transform: translateX(-2px);
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.10),
    0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.patient-fullview__back:focus-visible {
  outline: none;
  opacity: 1;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent),
    0 0 0 1px var(--rx-accent-text, #007885);
}
:root[data-theme="dark"] .patient-fullview__back {
  background: color-mix(in srgb, var(--bg-card-hi, #17171A) 72%, transparent);
  border-color: color-mix(in srgb, var(--rx-accent-bright) 30%, transparent);
  color: var(--accent-soft, #7FE3FF);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
}
:root[data-theme="dark"] .patient-fullview__back:hover {
  background: color-mix(in srgb, var(--rx-accent) 18%, var(--bg-card, #111113));
  border-color: color-mix(in srgb, var(--rx-accent-bright) 50%, transparent);
  color: #fff;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.5),
    0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
}

/* ---- FIRST-OPEN CLOSE HINT -------------------------------------------- */
.patient-fullview__hint {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 10;     /* above the body's sticky patient-nav-strip (z-index: 6) */
  padding: 7px 12px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--text-dim, #525258);
  background: color-mix(in srgb, var(--bg-card, #fff) 86%, transparent);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 14%, var(--border, #e5e5e8));
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 8px 22px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  pointer-events: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.patient-fullview__hint kbd {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-accent-text, #007885);
  line-height: 1;
}
:root[data-theme="dark"] .patient-fullview__hint {
  color: var(--text-muted, #9A9AA2);
  background: color-mix(in srgb, var(--bg-card-hi, #17171A) 80%, transparent);
  border-color: color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
}
:root[data-theme="dark"] .patient-fullview__hint kbd {
  color: var(--accent-soft, #7FE3FF);
  background: color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
  border-color: color-mix(in srgb, var(--rx-accent-bright) 30%, transparent);
}
.patient-fullview__hint--enter,
.patient-fullview__hint--leave {
  transition:
    opacity 260ms var(--pf-ease),
    transform 260ms var(--pf-ease);
}
.patient-fullview__hint--enter-from,
.patient-fullview__hint--leave-to {
  opacity: 0;
  transform: translateY(-4px);
}
.patient-fullview__hint--enter-to,
.patient-fullview__hint--leave-from {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 640px) {
  .patient-fullview__hint { display: none; }   /* no room on mobile */
}

/* ---- SCROLL BODY ------------------------------------------------------ */
.patient-fullview__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  background: var(--bg, #fafafa);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--rx-accent) 25%, transparent) transparent;
}
.patient-fullview__body::-webkit-scrollbar { width: 10px; }
.patient-fullview__body::-webkit-scrollbar-track { background: transparent; }
.patient-fullview__body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.patient-fullview__body::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--rx-accent) 36%, transparent);
  background-clip: padding-box;
}
:root[data-theme="dark"] .patient-fullview__body { background: var(--bg, #060606); }
:root[data-theme="dark"] .patient-fullview__body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent-bright) 28%, transparent);
  background-clip: padding-box;
}

/* Tighten the matrix-v2 patient overview inside the drawer — it was
   designed for a full page, so its outer padding is generous. Re-target
   to the drawer's narrower context. Sticky nav-strip pins to the top of
   the drawer's scroll container (not the viewport).
   Full V4 cohesion treatment for the nav-strip lives in the COHESION
   SWEEP block below; here we only fix the padding + sticky anchor. */
/* Top padding (52px) leaves room for the floating back-chevron + hint
   above the sticky patient-nav-strip. The chevron sits at top: 12px and
   is 32px tall — 52px keeps the nav strip's first edge clear. */
.patient-fullview__body .stack.patient-overview { padding: 52px 22px 44px; }

/* ---- SKELETON STATE --------------------------------------------------- */
.patient-fullview__skeleton {
  flex: 1 1 auto;
  overflow: hidden;
  padding: 16px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.patient-fullview__skel-nav {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border, #e5e5e8);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-card, #fff) 60%, transparent);
}
.patient-fullview__skel-nav span {
  height: 18px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.patient-fullview__skel-nav span:nth-child(1) { width: 78px; }
.patient-fullview__skel-nav span:nth-child(2) { width: 92px; }
.patient-fullview__skel-nav span:nth-child(3) { width: 70px; }
.patient-fullview__skel-nav span:nth-child(4) { width: 80px; }
.patient-fullview__skel-nav span:nth-child(5) { width: 64px; }

.patient-fullview__skel-hero {
  position: relative;
  padding: 22px 24px 24px;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e5e8);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 6%, var(--bg-card, #fff)) 0%,
      var(--bg-card, #fff) 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.patient-fullview__skel-eyebrow { height: 11px; width: 88px; border-radius: 4px; }
.patient-fullview__skel-title   { height: 28px; width: min(60%, 320px); border-radius: 8px; }
.patient-fullview__skel-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.patient-fullview__skel-meta span { height: 14px; border-radius: 4px; }
.patient-fullview__skel-meta span:nth-child(1) { width: 100px; }
.patient-fullview__skel-meta span:nth-child(2) { width: 130px; }
.patient-fullview__skel-meta span:nth-child(3) { width: 90px; }

.patient-fullview__skel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.patient-fullview__skel-card {
  height: 130px;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e5e8);
  background: var(--bg-card, #fff);
}

/* Shimmer surface — applied to every skeleton block via direct selectors
   so we don't depend on a wrapper class. */
.patient-fullview__skel-nav span,
.patient-fullview__skel-eyebrow,
.patient-fullview__skel-title,
.patient-fullview__skel-meta span,
.patient-fullview__skel-card {
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent) 6%, var(--bg-card, #f5f5f7)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 16%, var(--bg-card, #fff)) 40%,
      color-mix(in srgb, var(--rx-accent) 6%, var(--bg-card, #f5f5f7)) 80%);
  background-size: 220% 100%;
  background-position: 100% 0;
  animation: patient-fullview-shimmer 1.4s var(--pf-ease) infinite;
}
@keyframes patient-fullview-shimmer {
  0%   { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__skel-nav span,
  .patient-fullview__skel-eyebrow,
  .patient-fullview__skel-title,
  .patient-fullview__skel-meta span,
  .patient-fullview__skel-card { animation: none; }
}
:root[data-theme="dark"] .patient-fullview__skel-nav,
:root[data-theme="dark"] .patient-fullview__skel-hero,
:root[data-theme="dark"] .patient-fullview__skel-card {
  border-color: var(--border, #1F1F22);
}
:root[data-theme="dark"] .patient-fullview__skel-hero {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 10%, var(--bg-card-hi, #17171A)) 0%,
      var(--bg-card, #111113) 100%);
}
:root[data-theme="dark"] .patient-fullview__skel-card { background: var(--bg-card, #111113); }
:root[data-theme="dark"] .patient-fullview__skel-nav span,
:root[data-theme="dark"] .patient-fullview__skel-eyebrow,
:root[data-theme="dark"] .patient-fullview__skel-title,
:root[data-theme="dark"] .patient-fullview__skel-meta span,
:root[data-theme="dark"] .patient-fullview__skel-card {
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent) 14%, var(--bg-card-hi, #17171A)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 26%, var(--bg-card, #111113)) 40%,
      color-mix(in srgb, var(--rx-accent) 14%, var(--bg-card-hi, #17171A)) 80%);
  background-size: 220% 100%;
  background-position: 100% 0;
  animation: patient-fullview-shimmer 1.4s var(--pf-ease) infinite;
}

/* ---- ERROR STATE ------------------------------------------------------ */
.patient-fullview__error {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 24px 32px;
}
.patient-fullview__error-card {
  max-width: 520px;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--red, #DC2626) 6%, var(--bg-card, #fff));
  border: 1px solid color-mix(in srgb, var(--red, #DC2626) 30%, transparent);
  box-shadow:
    0 14px 32px rgba(220, 38, 38, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.patient-fullview__error-icon {
  color: var(--red, #DC2626);
  flex-shrink: 0;
}
.patient-fullview__error-body { min-width: 0; }
.patient-fullview__error-title {
  margin: 0 0 2px;
  font-family: var(--font-display, "Space Grotesk", "Inter");
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text, #0A0A0A);
  letter-spacing: -0.005em;
}
.patient-fullview__error-detail {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim, #525258);
  line-height: 1.4;
  word-break: break-word;
}
.patient-fullview__error-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg,
    var(--rx-accent-vivid, #00B5D1) 0%,
    var(--rx-accent, #0099B0) 100%);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 60%, transparent);
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 4px 12px color-mix(in srgb, var(--rx-accent) 30%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition:
    transform 160ms var(--pf-ease),
    box-shadow 160ms var(--pf-ease),
    filter 160ms var(--pf-ease);
  flex-shrink: 0;
}
.patient-fullview__error-retry:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 6px 18px color-mix(in srgb, var(--rx-accent) 40%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.patient-fullview__error-retry:active { transform: translateY(0); }
.patient-fullview__error-retry:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 32%, transparent),
    0 0 0 1px var(--rx-accent-text, #007885),
    0 4px 12px color-mix(in srgb, var(--rx-accent) 30%, transparent);
}
:root[data-theme="dark"] .patient-fullview__error-card {
  background: color-mix(in srgb, var(--red, #DC2626) 12%, var(--bg-card, #111113));
  border-color: color-mix(in srgb, var(--red, #DC2626) 45%, transparent);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, var(--red, #DC2626) 22%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 8%, transparent);
}
:root[data-theme="dark"] .patient-fullview__error-title { color: var(--text, #F5F5F7); }
:root[data-theme="dark"] .patient-fullview__error-detail { color: var(--text-muted, #9A9AA2); }

/* ---- LEGACY HOOKS ----------------------------------------------------
   The pre-polish CSS exposed .patient-fullview__loading and
   .patient-fullview__spinner. Both are gone now (skeleton + top progress
   bar replace them). Keep the class definitions as harmless no-ops so any
   stale embed referencing them doesn't break layout. */
.patient-fullview__loading,
.patient-fullview__spinner { display: none !important; }

/* =====================================================   PATIENT FULL-VIEW — V4 COHESION SWEEP (matrix-v2 body)
   Re-styles the embedded patient body so it visually belongs to
   the demo-dental V4 surface. ALL selectors target
   .patient-fullview__body <descendant> — never modify the matrix-v2
   template itself.

   Strategy:
   ---------
   The matrix-v2 patient body (specialist/patient_overview.html) was
   built before the V4 cyan-glass rollout. Its DOM uses .card, .po-*,
   .patient-nav-strip, etc. with a lot of inline styles. We CANNOT edit
   the template (Captain "don't rebuild" lock). Instead we pull the
   surface forward by:
     • Publishing V4 spacing + font + glass tokens on
       .patient-fullview__body so descendants inherit cleanly
     • Re-styling the hero card (.po-header), nav-strip
       (.patient-nav-strip), section cards (.po-card), and pills
       (.nav-pill) into the V4 glass language
     • Beating inline matrix-v2 styles with [style] attribute
       selectors where needed (cards have a hard-coded
       padding/background inline) — this is the *only* way to win
       specificity without !important spam
     • Routing every hardcoded hue through V4 tokens via color-mix
     • Tightening the spacing rhythm to match Reception / Stack /
       Email (--rx-s* scale)
     • Dark-mode parity — every override has a :root[data-theme="dark"]
       partner where it differs

   Quality bar: Linear / Pitch / Notion. Restrained V4 elevation.
   2026-05-24, branch niki/slideover-v4-cohesion-2026-05-24.
   ============================================================ */

/* ---- TOKEN RE-PUBLISH ------------------------------------------------
   The .patient-fullview block (above) publishes --rx-accent + cyan
   aliases. The BODY needs the V4 spacing scale + font tokens for any
   descendant rule using `var(--rx-s4)` etc. Re-publishing here keeps
   the cohesion CSS readable without relying on cascade from
   `.reception-v2` (which is a different DOM branch). */
.patient-fullview__body {
  /* Mirror the V4 spacing rhythm used by stack-card / email-thread. */
  --rx-s1: 4px;
  --rx-s2: 8px;
  --rx-s3: 12px;
  --rx-s4: 16px;
  --rx-s5: 20px;
  --rx-s6: 24px;
  --rx-s7: 32px;
  --rx-s8: 40px;

  /* Theme-aware glass alias — used by the section cards below.
     Light: paper-white base. Dark: bg-card surface (#111113). */
  --rx-glass-base:      #ffffff;
  --rx-glass-fill:      rgba(255, 255, 255, 0.78);
  --rx-glass-fill-hi:   rgba(255, 255, 255, 0.96);
  --rx-glass-fill-soft: rgba(255, 255, 255, 0.6);
  --rx-glass-edge:      color-mix(in srgb, var(--rx-accent) 18%, rgba(255, 255, 255, 0.65));
  --rx-glass-edge-soft: color-mix(in srgb, var(--rx-accent) 10%, rgba(255, 255, 255, 0.55));
  --rx-rim:             color-mix(in srgb, var(--rx-accent) 14%, rgba(255, 255, 255, 0.6));

  --rx-card-shadow:     0 1px 0 rgba(255, 255, 255, 0.65) inset,
                        0 8px 24px rgba(0, 0, 0, 0.04),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 6%, transparent);
  --rx-card-shadow-hi:  0 1px 0 rgba(255, 255, 255, 0.7) inset,
                        0 12px 28px rgba(0, 0, 0, 0.06),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 8%, transparent);

  --rx-text-soft:       var(--text-muted, #6b6b71);
  --rx-text-strong:     var(--text, #1f2937);

  --rx-ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --rx-ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --rx-dur-fast:  120ms;
  --rx-dur-mid:   200ms;
}
:root[data-theme="dark"] .patient-fullview__body {
  --rx-glass-base:      var(--bg-card, #111113);
  --rx-glass-fill:      rgba(17, 17, 19, 0.78);
  --rx-glass-fill-hi:   rgba(23, 23, 26, 0.96);
  --rx-glass-fill-soft: rgba(17, 17, 19, 0.55);
  --rx-glass-edge:      color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  --rx-glass-edge-soft: color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
  --rx-rim:             color-mix(in srgb, var(--rx-accent) 22%, var(--border, #1F1F22));
  --rx-card-shadow:     0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent) inset,
                        0 6px 22px rgba(0, 0, 0, 0.45),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 10%, transparent);
  --rx-card-shadow-hi:  0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 22%, transparent) inset,
                        0 10px 30px rgba(0, 0, 0, 0.55),
                        0 0 0 1px color-mix(in srgb, var(--rx-accent) 22%, transparent);
  --rx-text-soft:       var(--text-muted, #9A9AA2);
  --rx-text-strong:     var(--text, #F5F5F7);
}

/* ---- TYPOGRAPHY BASELINE --------------------------------------------
   Force Inter (body) + Space Grotesk (display) across the entire
   embedded body. matrix-v2 inherits from _base.html which has the
   right family in light theme, but inline `font-family` declarations
   inside style="..." attributes on individual elements (mostly
   monospace usage for IDs/timestamps) are preserved on purpose. */
.patient-fullview__body,
.patient-fullview__body .stack.patient-overview {
  font-family: var(--font-body, "Inter", -apple-system, BlinkMacSystemFont, sans-serif);
  color: var(--rx-text-strong);
  letter-spacing: -0.005em;
}
.patient-fullview__body h1,
.patient-fullview__body h2,
.patient-fullview__body h3,
.patient-fullview__body .card__title,
.patient-fullview__body .hero-greeting__title {
  font-family: var(--font-display, "Space Grotesk", "Inter", sans-serif);
  letter-spacing: -0.02em;
  color: var(--rx-text-strong);
}

/* ---- 1 · HERO GREETING (.po-header) ---------------------------------
   The hero card at the top of the patient overview — avatar + name +
   pills + POPIA badge. matrix-v2 ships it with inline padding + grid.
   We win specificity via [style] attribute selectors so we don't need
   !important. Result: V4 glass card with cyan-tinted gradient, soft
   top-rim, larger display heading. */
.patient-fullview__body .card.po-header,
.patient-fullview__body .card.po-header[style] {
  position: relative;
  padding: var(--rx-s6) var(--rx-s6);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 5%, var(--rx-glass-base)) 0%,
      var(--rx-glass-base) 70%);
  border: 1px solid var(--rx-rim);
  border-radius: 18px;
  box-shadow: var(--rx-card-shadow);
  overflow: hidden;
  transition: box-shadow var(--rx-dur-mid) var(--rx-ease),
              border-color var(--rx-dur-mid) var(--rx-ease);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-header,
:root[data-theme="dark"] .patient-fullview__body .card.po-header[style] {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 10%, var(--rx-glass-base)) 0%,
      var(--rx-glass-base) 70%);
}
.patient-fullview__body .card.po-header:hover {
  box-shadow: var(--rx-card-shadow-hi);
  border-color: color-mix(in srgb, var(--rx-accent) 26%, transparent);
}
/* Cyan top hairline — login-v4 signature, mirrors the global .card::before
   pattern but scoped + safe for matrix-v2 templates that do NOT use ::before
   already. */
.patient-fullview__body .card.po-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              var(--rx-accent-bright) 50%,
              transparent 100%);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}
/* Hero typography — bigger, tighter, display font.  */
.patient-fullview__body .po-header .hero-greeting__title {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--rx-text-strong);
  margin: 4px 0 8px;
}
.patient-fullview__body .po-header .eyebrow {
  /* Inherits V4 eyebrow chip styling from v4-tokens.css automatically
     because the V4 cascade is :root[data-theme="light"] .eyebrow which
     applies to descendants. In dark mode the eyebrow falls back to
     base.css; rebind here for crispness. */
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rx-accent-text);
}
/* Avatar — keep its gradient but upgrade the shadow to match V4 cards. */
.patient-fullview__body .po-header .po-avatar[style] {
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
}
/* Allergy banner — re-route to V4 red-tier glass instead of flat red. */
.patient-fullview__body .po-allergy-banner[style] {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--red, #dc2626) 92%, transparent) 0%,
      color-mix(in srgb, var(--red, #dc2626) 100%, transparent) 100%) !important;
  border-radius: 12px !important;
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--red, #dc2626) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
  font-family: var(--font-display) !important;
  letter-spacing: -0.005em;
}

/* ---- 2 · STICKY NAV-STRIP (.patient-nav-strip) ----------------------
   Goal: match the topbar view-pill aesthetic — pill bar with cyan-glass
   background, sticky-blur when pinned, active link gets a soft pill +
   cyan "you are here" dot. */
.patient-fullview__body .patient-nav-strip {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;             /* matrix-v2 ships 12 anchors — they MUST wrap inside the 60vw drawer */
  gap: 4px;
  row-gap: 4px;
  padding: 6px 8px;
  margin: -8px 0 var(--rx-s4);
  border: 1px solid var(--rx-rim);
  border-radius: 16px;         /* multi-row rectangle, not a pure pill */
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent) 5%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 10%, var(--rx-glass-base)) 100%);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 0 0 1px color-mix(in srgb, var(--rx-accent) 6%, transparent);
  overflow: visible;           /* no horizontal scroll — wrap takes care of fit */
  transition: box-shadow var(--rx-dur-mid) var(--rx-ease),
              border-color var(--rx-dur-mid) var(--rx-ease);
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent) 12%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 18%, var(--rx-glass-base)) 100%);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 14%, transparent),
    0 6px 18px rgba(0, 0, 0, 0.42),
    0 0 0 1px color-mix(in srgb, var(--rx-accent) 14%, transparent);
}
.patient-fullview__body .patient-nav-strip::-webkit-scrollbar { height: 6px; }
.patient-fullview__body .patient-nav-strip::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 999px;
}
.patient-fullview__body .patient-nav-strip::-webkit-scrollbar-track { background: transparent; }

/* Pinned ramp — when the strip is stuck at the top of the body
   scroll container, beef up the cyan rim for a stronger "this is
   anchored" cue. Implemented via a subtle ::after underline that
   strengthens on `position:sticky` (always present in this container). */
.patient-fullview__body .patient-nav-strip::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              color-mix(in srgb, var(--rx-accent-bright) 32%, transparent) 50%,
              transparent 100%);
  pointer-events: none;
  opacity: 0.7;
}

/* Nav links — V4 pill aesthetic. Drop the bottom-border underline that
   was the components.css default and adopt a soft cyan background + dot
   when active, matching .view-pill__item--active. */
.patient-fullview__body .patient-nav-strip__link {
  position: relative;
  flex: 0 0 auto;
  padding: 4px 10px;          /* tightened from 6/14 to fit 12 anchors comfortably */
  font-family: var(--font-display, "Space Grotesk", "Inter");
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--rx-text-soft);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
  transition:
    color var(--rx-dur-fast) var(--rx-ease),
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease);
}
.patient-fullview__body .patient-nav-strip__link:hover {
  color: var(--rx-accent-text);
  background: color-mix(in srgb, var(--rx-accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--rx-accent) 18%, transparent);
}
.patient-fullview__body .patient-nav-strip__link:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent),
    0 0 0 1px var(--rx-accent-text);
}
.patient-fullview__body .patient-nav-strip__link.is-active {
  color: var(--rx-accent-text);
  font-weight: 600;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent) 12%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 18%, var(--rx-glass-base)) 100%);
  border-color: color-mix(in srgb, var(--rx-accent) 28%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 2px color-mix(in srgb, var(--rx-accent) 16%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip__link.is-active {
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 1px 2px color-mix(in srgb, var(--rx-accent) 22%, transparent);
}
/* "You are here" dot — mirrors .view-pill__item-dot. Pulses softly.
   NOTE: keyframe `rx-pulse-dot` is referenced in several places in
   reception-v2.css but the @keyframes block was never defined. We
   define it here so the cohesion sweep's pulse works AND any other
   call-site (view-pill dot, reception-hints) that was silently inert
   starts pulsing. Drift fix, not a functional change to other modules.
*/
@keyframes rx-pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 0   color-mix(in srgb, var(--rx-accent-bright) 32%, transparent),
                0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  }
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
                0 0 0 7px color-mix(in srgb, var(--rx-accent-bright) 0%, transparent);
  }
}
.patient-fullview__body .patient-nav-strip__link.is-active::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1.5px;
  background: var(--rx-accent-bright);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  animation: rx-pulse-dot 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__body .patient-nav-strip__link.is-active::before { animation: none; }
}
/* KILL the components.css border-bottom underline — it conflicts with
   the pill aesthetic. Specificity beats single-class selector via the
   chained .patient-fullview__body scope. */
.patient-fullview__body .patient-nav-strip__link,
.patient-fullview__body .patient-nav-strip__link.is-active {
  border-bottom: 1px solid transparent !important;
}
.patient-fullview__body .patient-nav-strip__link.is-active {
  border: 1px solid color-mix(in srgb, var(--rx-accent) 28%, transparent) !important;
}

/* ---- 3 · SECTION CARDS (.po-card, .card under .patient-section) ------
   Every section under the nav-strip is a .card.po-card with inline
   padding. Win specificity via [style] attribute selectors, paint
   the V4 glass surface, add the cyan top hairline + soft hover.
   Card heading typography upgraded to Space Grotesk semibold with
   the cyan accent underline. */
.patient-fullview__body .card.po-card,
.patient-fullview__body .card.po-card[style] {
  position: relative;
  background: var(--rx-glass-base);
  border: 1px solid var(--rx-rim);
  border-radius: 16px;
  box-shadow: var(--rx-card-shadow);
  padding: var(--rx-s5) var(--rx-s5);
  overflow: hidden;
  transition: box-shadow var(--rx-dur-mid) var(--rx-ease),
              border-color var(--rx-dur-mid) var(--rx-ease);
}
.patient-fullview__body .card.po-card:hover {
  border-color: color-mix(in srgb, var(--rx-accent) 24%, transparent);
  box-shadow: var(--rx-card-shadow-hi);
}
/* Cyan top hairline on each section card */
.patient-fullview__body .card.po-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              var(--rx-accent-bright) 50%,
              transparent 100%);
  opacity: 0.45;
  pointer-events: none;
  z-index: 1;
}

/* Section anchors — keep the scroll-margin offset so anchor jumps
   land cleanly under the sticky nav-strip. The 5.5rem default is too
   generous inside the drawer (no global topbar); 64px is tighter. */
.patient-fullview__body .patient-section {
  scroll-margin-top: 64px;
}
.patient-fullview__body .patient-section__anchor {
  scroll-margin-top: 64px;
}

/* Card heading — Space Grotesk semibold with a cyan accent underline.
   matrix-v2's .card__head uses border-bottom 1px var(--border); we
   replace that with a cyan-fade underline for visual coherence. */
.patient-fullview__body .card.po-card .card__head,
.patient-fullview__body .card.po-card .card__head[style] {
  padding-bottom: var(--rx-s3);
  border-bottom: 1px solid transparent;
  position: relative;
}
.patient-fullview__body .card.po-card .card__head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
              color-mix(in srgb, var(--rx-accent) 28%, transparent) 0%,
              color-mix(in srgb, var(--rx-accent-bright) 16%, transparent) 30%,
              transparent 100%);
  pointer-events: none;
}
.patient-fullview__body .card.po-card .card__title {
  font-family: var(--font-display, "Space Grotesk", "Inter");
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--rx-text-strong);
}
.patient-fullview__body .card.po-card .card__sub {
  font-family: var(--font-body);
  color: var(--rx-text-soft);
  font-size: 12.5px;
}

/* Quick-stats strip — matrix-v2 .po-quick-stats with inline padding.
   Convert to V4 glass strip with the cyan top hairline. */
.patient-fullview__body .card.po-quick-stats,
.patient-fullview__body .card.po-quick-stats[style] {
  background: var(--rx-glass-base);
  border: 1px solid var(--rx-rim);
  border-radius: 14px;
  box-shadow: var(--rx-card-shadow);
  padding: var(--rx-s4) var(--rx-s5);
}
.patient-fullview__body .card.po-quick-stats > div {
  position: relative;
}
/* Tighten the big-number font in the quick-stats row */
.patient-fullview__body .card.po-quick-stats > div > div:nth-child(2) {
  font-family: var(--font-display, "Space Grotesk") !important;
  letter-spacing: -0.02em;
}

/* ---- 4 · NAV-PILLS INSIDE CARDS -------------------------------------
   matrix-v2 emits <span class="nav-pill"> inline; V4 already styles
   them via v4-tokens.css but inline `background: green` overrides on
   status pills break the V4 look. We bump up specificity here. */
.patient-fullview__body .nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.005em;
  background: var(--rx-glass-fill);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
  color: var(--rx-text-soft);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}
.patient-fullview__body .nav-pill.nav-pill--accent {
  background: color-mix(in srgb, var(--rx-accent) 10%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 28%, transparent);
  color: var(--rx-accent-text);
}
.patient-fullview__body .nav-pill.nav-pill--live {
  background: color-mix(in srgb, var(--rx-healthy, #16a34a) 12%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-healthy, #16a34a) 32%, transparent);
  color: var(--rx-healthy, #16a34a);
}

/* ---- 5 · TIMELINE + ROW BACKDROPS -----------------------------------
   matrix-v2 uses `background: var(--bg-subtle, rgba(0,212,255,0.04))`
   inline on plan rows, invoice rows, quote rows, audit rows, and
   activity rows. We re-route those to a V4 glass tint that resolves
   per theme. The selectors below catch every inline rgba(0,212,255,...)
   surface by class name. */
.patient-fullview__body .po-plan-row[style],
.patient-fullview__body .invoice-row[style],
.patient-fullview__body .quote-row[style],
.patient-fullview__body .audit-row[style] {
  background: color-mix(in srgb, var(--rx-accent) 5%, var(--rx-glass-base)) !important;
  border-radius: 10px !important;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              transform var(--rx-dur-fast) var(--rx-ease);
}
.patient-fullview__body .po-plan-row[style]:hover,
.patient-fullview__body .invoice-row[style]:hover,
.patient-fullview__body .quote-row[style]:hover {
  background: color-mix(in srgb, var(--rx-accent) 9%, var(--rx-glass-base)) !important;
  transform: translateY(-1px);
}
/* Activity rows under .po-activity also use a hardcoded rgba surface. */
.patient-fullview__body .po-activity__row[style] {
  background: color-mix(in srgb, var(--rx-accent) 4%, var(--rx-glass-base)) !important;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 10%, transparent);
  border-radius: 12px !important;
}

/* Money-summary cells — the four big-number cells under Money section.
   They have hardcoded RGB tints inline; we tint them through V4 tokens
   so they feel coherent in dark + light. */
.patient-fullview__body .money-summary__cell[style] {
  border-radius: 12px !important;
  transition: transform var(--rx-dur-fast) var(--rx-ease),
              box-shadow var(--rx-dur-mid) var(--rx-ease);
}
.patient-fullview__body .money-summary__cell[style]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--rx-accent) 14%, transparent);
}

/* Card border under .card__head — kill the inline `border-bottom: 1px solid var(--border)`
   by neutralising the matrix-v2 inline border with a transparent border;
   our ::after pseudo above paints the V4 cyan-fade in its place. */
.patient-fullview__body .card.po-card .card__head[style] {
  border-bottom-color: transparent !important;
}

/* Demographics dl / definitions tables — kill the dt/dd inline opacity
   so the text remains AA. */
.patient-fullview__body .po-dl dt {
  color: var(--rx-text-soft);
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}
.patient-fullview__body .po-dl dd {
  color: var(--rx-text-strong);
}

/* Right-rail "Ask Niki about this patient" card — matrix-v2 sets
   `border: 1px solid var(--accent)`; that's still V4-compatible, but
   we add the cyan top hairline + soft glow to match Niki-bar surfaces. */
.patient-fullview__body .po-rail .card[style*="--accent"],
.patient-fullview__body .po-rail .card:first-child {
  position: relative;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 6%, var(--rx-glass-base)) 0%,
      var(--rx-glass-base) 60%);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 32%, transparent);
  border-radius: 14px;
  box-shadow:
    var(--rx-card-shadow),
    0 0 22px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
}
.patient-fullview__body .po-rail .card:first-child::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg,
              transparent 0%,
              var(--rx-accent-bright) 50%,
              transparent 100%);
  opacity: 0.7;
  pointer-events: none;
}

/* ---- 6 · SPACING RHYTHM SWEEP ---------------------------------------
   Re-rhythm the matrix-v2 sections to the V4 spacing scale. matrix-v2
   uses 1.25rem / 1.5rem hard-coded margins between sections; we drop
   in --rx-s5 / --rx-s6 for crisper breathing. */
.patient-fullview__body .patient-section + .patient-section,
.patient-fullview__body .stack.patient-overview > .patient-section + .patient-section {
  margin-top: var(--rx-s5);
}
.patient-fullview__body .card.po-card[style*="margin-top"] {
  margin-top: var(--rx-s5) !important;
}
.patient-fullview__body .stack.patient-overview > .patient-section:first-of-type {
  margin-top: 0;
}

/* ---- 7 · LINKS, BUTTONS, FOCUS RINGS --------------------------------
   matrix-v2's inline `color: var(--accent)` on anchors already routes
   through V4 in light theme. In dark mode the V4 accent is bright
   (#00D4FF) which is the right colour. Just add the AA focus ring. */
.patient-fullview__body a:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent),
    0 0 0 1px var(--rx-accent-text);
  border-radius: 6px;
}
/* Buttons inside the body: the right-rail "Open Niki bar" CTA + the
   quick-actions ghost buttons. V4 cascade already covers .btn--primary
   / .btn--ghost; we just ensure layout doesn't collapse under the
   drawer's narrower width. */
.patient-fullview__body .btn--primary,
.patient-fullview__body .btn--ghost {
  font-family: var(--font-body);
  border-radius: 10px;
}

/* ---- 8 · DARK-MODE TEXT POLISH --------------------------------------
   matrix-v2 has a handful of inline `color: var(--text-dim)` calls
   that resolve to muted on dark + light. They're already AA. The
   trouble spots are inline `style="opacity:0.7"` on UPPERCASE labels
   inside the medical-history block — those break AA in dark mode.
   Override them to a darker muted that still reads. */
:root[data-theme="dark"] .patient-fullview__body strong[style*="opacity"] {
  opacity: 0.85 !important;
  color: var(--rx-text-soft);
}
:root[data-theme="dark"] .patient-fullview__body .text-dim {
  color: var(--text-muted, #9A9AA2);
}

/* ---- 9 · PERIO SPARKLINE TUNING -------------------------------------
   The right-rail perio sparkline uses a hardcoded
   `border-bottom: 1px solid var(--border, #1f2937)` baseline.
   That's invisible on light bg-card. Let the V4 rim through. */
.patient-fullview__body .po-rail .card div[style*="border-bottom"] {
  border-bottom-color: var(--rx-rim) !important;
}

/* ---- 10 · TIMELINE (.timeline) — comms section ---------------------
   matrix-v2's comms timeline has a hard-coded
   `linear-gradient(... rgba(0, 212, 255, 0.18) ...)` rail. That
   already routes via the global components.css; just ensure the
   bottom-border of timeline rows uses the cyan-rim instead of the
   inline rgba alpha border. */
.patient-fullview__body .timeline__entry[style] {
  border-bottom-color: color-mix(in srgb, var(--rx-accent) 10%, transparent) !important;
}

/* =====================================================   END · V4 COHESION SWEEP
   ============================================================ */

/* ---- MOBILE (≤640px) -------------------------------------------------- */
@media (max-width: 640px) {
  .patient-fullview__panel {
    top: 0;
    width: 100vw;
    height: 100vh;
    box-shadow:
      0 -10px 36px rgba(15, 23, 42, 0.24),
      -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
  }
  .patient-fullview__panel--enter-from,
  .patient-fullview__panel--leave-to {
    transform: translate3d(0, 22px, 0);
  }
  .patient-fullview__rim {
    /* On full-screen mobile the rim becomes a TOP gradient instead of left. */
    width: 100%;
    height: 160px;
    background:
      radial-gradient(220px 160px at 50% 0,
        color-mix(in srgb, var(--rx-accent-bright) 16%, transparent) 0%,
        transparent 70%),
      linear-gradient(90deg,
        transparent 0%,
        color-mix(in srgb, var(--rx-accent-bright) 24%, transparent) 50%,
        transparent 100%);
    mask: linear-gradient(180deg, #000 0, #000 1px, transparent 1px);
    -webkit-mask: linear-gradient(180deg, #000 0, #000 1px, transparent 1px);
  }
  .patient-fullview__back {
    top: 12px;
    left: 12px;
  }
  .patient-fullview__body .stack.patient-overview { padding: 14px 16px 36px; }
  .patient-fullview__skeleton { padding: 14px 16px 24px; }
  .patient-fullview__skel-grid { grid-template-columns: 1fr; }

  /* V4 COHESION SWEEP — mobile rhythm overrides.
     The cohesion CSS targets desktop spacing; tighten for ≤640px so
     the drawer (full-screen at this width) doesn't waste pixels. */
  .patient-fullview__body .card.po-header,
  .patient-fullview__body .card.po-header[style] {
    padding: var(--rx-s4) var(--rx-s4);
    border-radius: 14px;
  }
  .patient-fullview__body .po-header .hero-greeting__title {
    font-size: 22px;
  }
  .patient-fullview__body .patient-nav-strip {
    padding: 6px 8px;
    margin: -6px 0 var(--rx-s3);
    /* Stay sticky but allow horizontal scroll on phone. */
  }
  .patient-fullview__body .patient-nav-strip__link {
    padding: 5px 12px;
    font-size: 12px;
  }
  .patient-fullview__body .card.po-card,
  .patient-fullview__body .card.po-card[style] {
    padding: var(--rx-s4) var(--rx-s4);
    border-radius: 14px;
  }
  .patient-fullview__body .patient-section + .patient-section {
    margin-top: var(--rx-s4);
  }
}

/* =====================================================   PATIENT FULL-VIEW — FIT PASS (force single-column at all widths)
   ------------------------------------------------------------
   The drawer's content area is ≈820px on a 1440 viewport (min(880px,
   60vw) minus padding). matrix-v2's patient_overview.html was authored
   for a ≥1280px main canvas; its inline grids (1fr 320px main grid,
   auto-fit 280px tiles, 105px/110px/130px row layouts, repeat(3,1fr)
   photo grid) all overflow at 820px. The template ships a mobile rule
   at @media (max-width: 800px) but it never fires here because the
   *viewport* is 1440 — only the *container* is sub-800.

   This block forces every multi-column grid inside the drawer into a
   single-column / compact alternative regardless of viewport width.
   Inline styles win on specificity, so every override uses !important.

   DO NOT edit patient_overview.html — Captain's "don't rebuild" lock.
   Every selector here is scoped to .patient-fullview__body so the
   matrix-v2 page rendered outside the drawer is untouched.
   ============================================================ */

/* ---- 1 · MAIN GRID (.po-grid + .po-grid__main + .po-rail) ----
   The 1fr 320px split is the biggest overflow source. Stack main and
   rail vertically; drop the rail's sticky top so it doesn't crowd
   sections below. */
.patient-fullview__body .patient-overview .po-grid {
  grid-template-columns: 1fr !important;
}
.patient-fullview__body .patient-overview .po-grid__main {
  grid-template-columns: 1fr !important;
}
.patient-fullview__body .patient-overview .po-rail {
  position: static !important;
}

/* ---- 2 · HEADER ROW (.po-header) ---------------------------------
   `auto 1fr auto` (avatar | identity | POPIA badge). At ~780px this
   barely fits — at narrow widths the POPIA block wraps under hero
   text and breaks. Stack vertically, centre the avatar. */
.patient-fullview__body .patient-overview .po-header,
.patient-fullview__body .patient-overview .card.po-header[style] {
  grid-template-columns: 1fr !important;
  text-align: center;
  gap: var(--rx-s3) !important;
}
.patient-fullview__body .patient-overview .po-avatar,
.patient-fullview__body .patient-overview .po-header .po-avatar[style] {
  margin: 0 auto !important;
}
/* POPIA badge — re-align centre and let the helper text wrap below. */
.patient-fullview__body .patient-overview .po-popia[style] {
  text-align: center !important;
  min-width: 0 !important;
}
/* Identity row pills inside .po-header — let them wrap and centre. */
.patient-fullview__body .patient-overview .po-header .row[style] {
  justify-content: center;
}

/* ---- 3 · QUICK-STATS STRIP (.po-quick-stats) ---------------------
   `repeat(auto-fit, minmax(150px, 1fr))` produces 4-5 columns inside
   the drawer; 5 × 150 = 750px before gaps. Tighten the minmax floor
   so we land on 3 cols max comfortably. */
.patient-fullview__body .patient-overview .po-quick-stats,
.patient-fullview__body .patient-overview .card.po-quick-stats[style] {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
}

/* ---- 4 · MONEY SUMMARY (.money-summary) --------------------------
   `repeat(auto-fit, minmax(180px, 1fr))` × 4 cells = 720px+. Tighten
   the floor so 2 cols stack at narrow widths, 3 at wider. */
.patient-fullview__body .patient-overview .money-summary[style] {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
}

/* ---- 5 · INVOICE ROW (4-col: 1fr auto auto auto) -----------------
   Stack into 2 rows: meta on top, money cells below. */
.patient-fullview__body .patient-overview .invoice-row[style] {
  grid-template-columns: 1fr !important;
  gap: var(--rx-s2) !important;
}
.patient-fullview__body .patient-overview .invoice-row[style] > div:not(:first-child),
.patient-fullview__body .patient-overview .invoice-row[style] > span {
  text-align: left !important;
}
/* Re-flow the 3 money cells (Total / Balance / status pill) into a row
   below the meta cell so they read naturally. */
.patient-fullview__body .patient-overview .invoice-row[style] {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  row-gap: var(--rx-s2) !important;
  column-gap: var(--rx-s3) !important;
}
.patient-fullview__body .patient-overview .invoice-row[style] > div:first-child {
  flex: 1 1 100%;
  min-width: 0;
}
.patient-fullview__body .patient-overview .invoice-row[style] > div:not(:first-child) {
  flex: 0 0 auto;
}

/* ---- 6 · QUOTE ROW (3-col: 1fr auto auto) ------------------------
   Same flex-wrap pattern as invoices. */
.patient-fullview__body .patient-overview .quote-row[style] {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  grid-template-columns: none !important;
  row-gap: var(--rx-s2) !important;
  column-gap: var(--rx-s3) !important;
}
.patient-fullview__body .patient-overview .quote-row[style] > div:first-child {
  flex: 1 1 100%;
  min-width: 0;
}
.patient-fullview__body .patient-overview .quote-row[style] > div:not(:first-child),
.patient-fullview__body .patient-overview .quote-row[style] > span {
  flex: 0 0 auto;
}

/* ---- 7 · ACTIVITY ROWS (.po-activity__row + .po-timeline li) -----
   Two variants:
   - .po-timeline li[style]            → 105px 1fr auto  (section 1)
   - .po-activity__row[style]          → 110px 1fr auto  (section 5)
   Tighten the timestamp column and let labels wrap. */
.patient-fullview__body .patient-overview .po-timeline li[style] {
  grid-template-columns: 78px 1fr !important;
  grid-template-rows: auto auto;
  row-gap: var(--rx-s1) !important;
}
.patient-fullview__body .patient-overview .po-timeline li[style] > .nav-pill,
.patient-fullview__body .patient-overview .po-timeline li[style] > span:last-child {
  grid-column: 2 / -1;
  justify-self: start;
}
.patient-fullview__body .patient-overview .po-activity__row[style] {
  grid-template-columns: 82px 1fr !important;
  grid-template-rows: auto auto;
  row-gap: var(--rx-s1) !important;
  align-items: start !important;
}
.patient-fullview__body .patient-overview .po-activity__row[style] > :last-child {
  grid-column: 2 / -1;
  justify-self: start;
}

/* ---- 8 · AUDIT ROWS (130px 130px 1fr) ----------------------------
   Stack timestamp + actor on row 1, justification below on its own row. */
.patient-fullview__body .patient-overview .audit-row[style] {
  grid-template-columns: 96px 1fr !important;
  grid-template-rows: auto auto;
  column-gap: var(--rx-s3) !important;
  row-gap: var(--rx-s1) !important;
}
.patient-fullview__body .patient-overview .audit-row[style] > span:nth-child(3) {
  grid-column: 1 / -1;
}

/* ---- 9 · PHOTOS SKELETON GRID (repeat(3, 1fr)) -------------------
   Three 200px tiles in 820px is fine in theory but with --rx-s4 gaps
   and any min-content tile content the row stretches. Drop to 2 cols
   for safer fit inside the drawer. */
.patient-fullview__body .patient-overview #sec-photos div[style*="repeat(3, 1fr)"] {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* ---- 10 · NAV-STRIP — OPTION A (single row, compact) -------------
   Goal: keep all 12 anchors on one row inside the 60vw drawer.
   Math: 12 × ~58px content + 11 × 4px gap = ~744px → fits in 820px.
   Allow overflow-x scroll as a safety net if a future tenant adds
   anchors or the viewport drops below ~1370px. */
/* Captain 2026-05-24: Option-A compact (10.5px) read as illegible.
   Switching to a comfortable two-row wrap — pills are readable, all 12
   anchors are visible at once, no horizontal scroll. Roughly 6 pills per
   row at 60vw. */
.patient-fullview__body .patient-nav-strip {
  flex-wrap: wrap !important;
  overflow: visible !important;
  row-gap: 5px !important;
  gap: 5px !important;
  padding: 7px 10px !important;
}
.patient-fullview__body .patient-nav-strip__link {
  padding: 5px 12px !important;
  font-size: 12.5px !important;
  letter-spacing: -0.005em !important;
  white-space: nowrap;
}
.patient-fullview__body .patient-nav-strip__link.is-active::before {
  width: 5px !important;
  height: 5px !important;
  margin-right: 5px !important;
}

/* ---- 11 · MOBILE (≤640px) SAFETY ---------------------------------
   At ≤640px the drawer is full-screen. Quick-stats can go to 2 cols,
   nav-strip stays a single horizontal scroll row (already styled in
   the upstream mobile block, but ensure auto-fit floors don't trip). */
@media (max-width: 640px) {
  .patient-fullview__body .patient-overview .po-quick-stats,
  .patient-fullview__body .patient-overview .card.po-quick-stats[style] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .patient-fullview__body .patient-overview .money-summary[style] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .patient-fullview__body .patient-overview #sec-photos div[style*="repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  .patient-fullview__body .patient-nav-strip__link {
    /* Slightly bigger tap target on phone — Captain's nav stays scrollable
       but each pill must hit ≥36px for thumb reach. */
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}

/* ---- 12 · KEEP RAIL CARDS FULL-WIDTH AFTER STACK -----------------
   With the rail dropped beneath the main grid, its cards now span full
   width. Cap the rail's max-width so the Ask-Niki / Quick-actions
   cards don't look stretched on a 820px row. */
.patient-fullview__body .patient-overview .po-rail {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  gap: var(--rx-s4) !important;
}

/* =====================================================   END · PATIENT FULL-VIEW FIT PASS
   ============================================================ */


/* =====================================================   PATIENT FULL-VIEW — SIDE-NAV PASS (Captain locked 2026-05-24)
   ------------------------------------------------------------
   Move the 12-anchor patient nav-strip from a top wrap-row into a
   vertical rail along the LEFT edge of the drawer's content area,
   widen the drawer (handled at .patient-fullview__panel above:
   880/60vw → 1180/68vw) and put Demographics + Medical history
   SIDE-BY-SIDE inside the Overview section.

   Mechanics:
   - .stack.patient-overview is a flex column upstream. We override
     it to a 2-col CSS grid (rail 200px · content 1fr). Grid
     auto-placement puts the nav-strip in cell (1,1); we then
     explicitly hand every OTHER direct child grid-column: 2 so all
     12 .patient-section blocks flow down column 2.
   - The nav-strip itself becomes a sticky vertical flex stack with
     left-anchored "you are here" bar + dot, Linear/Notion-style
     hover slide.
   - Inside the Overview section, .po-grid__main gets a 2-col grid
     for its first two cards (Demographics + Medical history); cards
     3+ span both columns (Treatment plans, Money summary, Activity).
   - Drawer width bump lives on .patient-fullview__panel — search
     "side-nav pass" near line 4149.
   - Mobile (≤640px) collapses back to the FIT-PASS layout:
     single-column body, horizontal wrap nav-strip at top.
   - Reduced-motion: no hover slide animation.
   - Dark-mode parity throughout.

   DO NOT edit patient_overview.html — matrix-v2 lock.
   ============================================================ */

/* ---- 1 · OUTER GRID — 2 columns: rail + content -----------------
   The upstream `.stack.patient-overview` is flex column with gap. We
   convert to a 2-col grid; auto-placement parks the first child
   (the nav) in column 1, every subsequent .patient-section is pushed
   to column 2 by an explicit `grid-column: 2` rule below. The grid
   gap supplants the `.stack` gap (which inherits from --gap-y). */
.patient-fullview__body .stack.patient-overview {
  display: grid !important;
  grid-template-columns: 200px minmax(0, 1fr) !important;
  column-gap: var(--rx-s5, 24px) !important;
  row-gap: var(--rx-s4, 18px) !important;
  align-items: start !important;
}

/* All direct children that are NOT the nav-strip flow into column 2.
   Includes #sec-overview, #sec-treatment, #sec-money, … #sec-audit.
   `min-width: 0` lets the inner grids (e.g. .po-grid__main) shrink
   without forcing horizontal overflow on the parent grid track. */
.patient-fullview__body .stack.patient-overview > :not(.patient-nav-strip) {
  grid-column: 2 !important;
  min-width: 0;
}

/* The earlier cohesion sweep (line ~5269) puts margin-top: var(--rx-s5)
   between consecutive .patient-section blocks. With grid row-gap doing
   the same job, the margin doubles up. Zero it inside the grid scope
   so spacing reads cleanly from the row-gap alone. */
.patient-fullview__body .stack.patient-overview > .patient-section + .patient-section,
.patient-fullview__body .stack.patient-overview > .patient-section {
  margin-top: 0 !important;
}

/* ---- 2 · NAV-STRIP — VERTICAL RAIL ------------------------------
   Convert from horizontal pill-wrap to a vertical stack. Pinned to
   the top-left of the content area; scrolls independently if its
   own content exceeds the viewport (defensive — 12 anchors easily
   fit at desktop heights). */
.patient-fullview__body .patient-nav-strip {
  /* Layout: vertical column, full rail width, intrinsic height */
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 2px !important;
  row-gap: 2px !important;
  padding: 8px 6px !important;
  margin: 0 !important;
  /* Park in column 1, span the column's available track */
  grid-column: 1 !important;
  grid-row: 1 / span 12 !important;   /* span past content so sticky works inside a tall row */
  /* Sticky inside the drawer's scroll container */
  position: sticky !important;
  top: var(--rx-s4, 18px) !important;
  align-self: start !important;
  max-height: calc(100vh - 2 * var(--rx-s4, 18px));
  overflow-y: auto;
  overflow-x: hidden;
  /* Slightly softer glass for the rail — it's supporting cast, the
     chart is the focus */
  border-radius: 14px;
}

/* Nicer micro-scrollbar for the rail when it overflows */
.patient-fullview__body .patient-nav-strip::-webkit-scrollbar { width: 4px; height: 0; }
.patient-fullview__body .patient-nav-strip::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 999px;
}

/* Sticky pinned underline (the ::after gradient bar from the cohesion
   sweep) was tuned for a horizontal strip — kill it on the rail. */
.patient-fullview__body .patient-nav-strip::after {
  display: none !important;
}

/* ---- 3 · NAV LINKS — Notion/Linear sidebar-row aesthetic --------
   Pill shape → soft left-anchored row. Active item gets a 3px cyan
   left-edge bar (replacing the ::before dot's prefix role) plus a
   left-to-right tinted background. Hover slides a faint cyan wash
   in from the left and reveals a tiny chevron at the right. */
.patient-fullview__body .patient-nav-strip__link {
  position: relative;
  display: flex !important;
  align-items: center;
  flex: 0 0 auto !important;
  width: 100%;
  padding: 8px 10px 8px 14px !important;
  font-family: var(--font-display, "Space Grotesk", "Inter");
  font-size: 13.5px !important;
  line-height: 1.2;
  letter-spacing: -0.005em !important;
  font-weight: 500;
  color: var(--rx-text-soft);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px !important;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    color var(--rx-dur-fast) var(--rx-ease),
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    padding var(--rx-dur-fast) var(--rx-ease);
}

/* Hover — soft cyan wash + a subtle inward shift */
.patient-fullview__body .patient-nav-strip__link:hover {
  color: var(--rx-accent-text);
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent-bright) 10%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent) 4%, transparent) 65%,
      transparent 100%);
  border-color: color-mix(in srgb, var(--rx-accent) 14%, transparent);
}

/* Hover chevron — appears on the right when row is hovered */
.patient-fullview__body .patient-nav-strip__link::after {
  content: "›";
  margin-left: auto;
  padding-left: 8px;
  font-size: 14px;
  font-weight: 600;
  color: color-mix(in srgb, var(--rx-accent-bright) 60%, transparent);
  opacity: 0;
  transform: translateX(-3px);
  transition:
    opacity var(--rx-dur-fast) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease);
  pointer-events: none;
}
.patient-fullview__body .patient-nav-strip__link:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* Active — left edge cyan bar + tinted background. The pulse dot
   from the cohesion sweep is suppressed here (the bar replaces it
   visually). */
.patient-fullview__body .patient-nav-strip__link.is-active {
  color: var(--rx-accent-text);
  font-weight: 600;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent-bright) 18%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base)) 70%,
      transparent 100%) !important;
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px color-mix(in srgb, var(--rx-accent) 12%, transparent);
}
.patient-fullview__body .patient-nav-strip__link.is-active::before {
  /* Replace the inline dot with a 3px cyan vertical bar pinned to
     the left edge of the row. Reuse the rx-pulse-dot keyframe — the
     same glow logic still reads as "live" without the wandering pill. */
  content: "" !important;
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  height: auto;
  margin: 0 !important;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--rx-accent-bright) 0%, var(--rx-accent) 100%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
  animation: rx-pulse-dot 2.4s ease-in-out infinite;
  vertical-align: baseline;
  display: block;
}
.patient-fullview__body .patient-nav-strip__link.is-active::after {
  /* Hide the chevron on the active row — the bar is the indicator */
  display: none;
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip__link.is-active {
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent-bright) 22%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base)) 70%,
      transparent 100%) !important;
  border-color: color-mix(in srgb, var(--rx-accent-bright) 26%, transparent) !important;
}

/* ---- 4 · DEMOGRAPHICS + MEDICAL HISTORY SIDE-BY-SIDE -----------
   The FIT-PASS forced `.po-grid__main` to a single column so the
   matrix-v2 auto-fit-280px tile grid wouldn't overflow at 820px.
   Now that the content column is ~720-780px (drawer 68vw at 1440 -
   200 rail - 24 gap - 44 body padding ≈ 731), we can re-allow 2
   columns specifically for the first two cards (Demographics +
   Medical history). Cards 3+ in .po-grid__main (Treatment plans,
   Money summary, Activity) span the full width below. */
.patient-fullview__body .patient-overview .po-grid__main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: var(--rx-s4, 18px) !important;
}
.patient-fullview__body .patient-overview .po-grid__main > .po-card:nth-child(n + 3) {
  grid-column: 1 / -1 !important;
}

/* ---- 5 · CONTENT BREATHING ROOM ---------------------------------
   Wider canvas → cards earn a touch more vertical breathing. Pure
   feel, not structural. */
.patient-fullview__body .patient-overview .po-card .card__title,
.patient-fullview__body .patient-overview .card.po-card .card__title {
  padding-top: 2px;
}

/* Tighten the outer .patient-overview body padding now that the
   left rail consumes some of the perceived margin. */
.patient-fullview__body .stack.patient-overview {
  padding: 52px 24px 44px !important;
}

/* ---- 6 · SCROLL-MARGIN — anchors should still land cleanly ------
   Sticky nav strip used to be on top, contributed scroll-margin via
   FIT-PASS. Now nav is on the side, so anchors only need the
   chevron clearance at the top. Keep the existing scroll-margin
   from upstream + a small drawer-edge breath. */
.patient-fullview__body .patient-overview .patient-section,
.patient-fullview__body .patient-overview [id^="sec-"] {
  scroll-margin-top: 24px;
}

/* ---- 7 · REDUCED-MOTION ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__body .patient-nav-strip__link,
  .patient-fullview__body .patient-nav-strip__link::after {
    transition: none !important;
  }
  .patient-fullview__body .patient-nav-strip__link.is-active::before {
    animation: none !important;
  }
}

/* ---- 8 · MOBILE FALLBACK (≤640px) -------------------------------
   At phone widths the drawer is full-screen and a 200px rail eats
   too much of the chart. Collapse back to the FIT-PASS single-column
   layout: nav-strip returns to horizontal wrap at the top. Cleaner
   than a slide-out overlay (no extra JS, no focus-trap delta), and
   the matrix-v2 page already ships its own ≤800 layout so we're
   inheriting tested behaviour. */
@media (max-width: 640px) {
  .patient-fullview__body .stack.patient-overview {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--rx-s3, 12px) !important;
    padding: 52px 16px 36px !important;
  }
  .patient-fullview__body .stack.patient-overview > :not(.patient-nav-strip) {
    grid-column: auto !important;
  }
  .patient-fullview__body .patient-nav-strip {
    position: sticky !important;
    top: 0 !important;
    grid-column: auto !important;
    grid-row: auto !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    max-height: none;
    overflow: visible !important;
    padding: 7px 10px !important;
    gap: 5px !important;
    row-gap: 5px !important;
  }
  .patient-fullview__body .patient-nav-strip__link {
    width: auto;
    padding: 5px 12px !important;
    font-size: 11.5px !important;
  }
  .patient-fullview__body .patient-nav-strip__link::after {
    display: none;
  }
  /* Active row on mobile: restore the inline dot (no left-edge bar) */
  .patient-fullview__body .patient-nav-strip__link.is-active::before {
    position: static;
    width: 5px;
    height: 5px;
    margin-right: 5px !important;
    border-radius: 999px;
    background: var(--rx-accent-bright);
    display: inline-block;
  }
  /* Demographics + Medical stack on phone */
  .patient-fullview__body .patient-overview .po-grid__main {
    grid-template-columns: 1fr !important;
  }
  .patient-fullview__body .patient-overview .po-grid__main > .po-card:nth-child(n + 3) {
    grid-column: auto !important;
  }
}

/* ---- 9 · TABLET BAND (641–960px) --------------------------------
   In between the desktop two-column layout and the phone single
   column. Demographics + Medical can stack here too — the rail is
   still useful but the content column gets too tight at 2-col
   below ~960. */
@media (max-width: 960px) and (min-width: 641px) {
  .patient-fullview__body .stack.patient-overview {
    grid-template-columns: 180px minmax(0, 1fr) !important;
  }
  .patient-fullview__body .patient-overview .po-grid__main {
    grid-template-columns: 1fr !important;
  }
  .patient-fullview__body .patient-overview .po-grid__main > .po-card:nth-child(n + 3) {
    grid-column: auto !important;
  }
  .patient-fullview__body .patient-nav-strip__link {
    font-size: 12.5px !important;
    padding: 7px 8px 7px 12px !important;
  }
}

/* =====================================================   END · PATIENT FULL-VIEW SIDE-NAV PASS
   ============================================================ */


/* =====================================================   PATIENT FULL-VIEW — REFINEMENT PASS (Captain locked 2026-05-24)
   ------------------------------------------------------------
   Four-part refinement on top of the SIDE-NAV PASS:

   1) Side-nav text +40% (12.5px → 17.5px desktop, padding scaled)
      Rail widens 200px → 260px to accommodate.
   2) Hero region RESET — drop the V4 cohesion overrides on
      .po-header, .hero-greeting__title, .eyebrow, .po-avatar,
      .po-allergy-banner so matrix-v2 native styling shines through.
   3) Drawer surface refinement — rounded LEFT corners (top-left +
      bottom-left), softer shadow stack, gentler scrim radial.
   4) Internal .po-card border-radius bumped 16px → 20px for cohesion
      with the larger outer radius.

   Loaded LAST so it wins via cascade order. Specificity matched to
   the rules being overridden — !important kept to a minimum.
   ============================================================ */


/* ---- 1 · DRAWER SURFACE — softer left edge + scrim ----------------
   The right edge stays flush against the viewport (drawer slides in
   from the right). Round only the LEFT corners. Soften the shadow
   stack — keep the cyan rim signature but lengthen the radius and
   pull back the inner glow.

   The cyan rim-light overlay (.patient-fullview__rim) is masked to
   the left 1px gradient — when we round the panel, the rim's mask
   needs to follow the curve. We replace its mask logic with a
   border-radius-aware clip so the cyan hairline curves into the
   rounded corners instead of poking past them. */
.patient-fullview__panel {
  border-top-left-radius: 24px;
  border-bottom-left-radius: 24px;
  /* Softer shadow — longer falloff, gentler cyan rim hairline */
  box-shadow:
    -36px 0 96px rgba(15, 23, 42, 0.16),
    -10px 0 24px rgba(15, 23, 42, 0.05),
    -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 16%, transparent);
}
:root[data-theme="dark"] .patient-fullview__panel {
  box-shadow:
    -36px 0 96px rgba(0, 0, 0, 0.54),
    -10px 0 26px rgba(0, 0, 0, 0.28),
    -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 28%, transparent),
    0 0 72px color-mix(in srgb, var(--rx-accent-bright) 8%, transparent);
}

/* Rim light — follow the curve. Replace the linear-gradient + mask
   stack with a radius-aware version that respects the new rounded
   left edge. The radial accent stays anchored at the top-left
   (curving inside the corner now) and the hairline rides the curve. */
.patient-fullview__rim {
  border-top-left-radius: 24px;
  border-bottom-left-radius: 24px;
  width: 240px;
  background:
    radial-gradient(260px 200px at 18px 18px,
      color-mix(in srgb, var(--rx-accent-bright) 11%, transparent) 0%,
      transparent 72%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 32%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 8%, transparent) 22%,
      transparent 55%);
  /* The mask now follows the rounded edge — confine the hairline to
     the curved 1px left edge instead of a flat 1px stripe. We use
     a radial mask anchored top-left for the accent and an inset-1px
     curved mask for the rim line. */
  mask: none;
  -webkit-mask: none;
  overflow: hidden;
}
:root[data-theme="dark"] .patient-fullview__rim {
  background:
    radial-gradient(280px 220px at 18px 18px,
      color-mix(in srgb, var(--rx-accent-bright) 18%, transparent) 0%,
      transparent 72%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 52%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 18%, transparent) 26%,
      transparent 58%);
}

/* Soften the scrim's top-left radial accent — pull it further and
   ease the falloff so the page behind the drawer reads as a calm
   surface, not a spotlight. */
.patient-fullview__scrim {
  background:
    radial-gradient(ellipse 95% 70% at 22% 24%,
      color-mix(in srgb, var(--rx-accent-bright) 5%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 2%, transparent) 38%,
      transparent 78%),
    rgba(15, 23, 42, 0.42);
}
:root[data-theme="dark"] .patient-fullview__scrim {
  background:
    radial-gradient(ellipse 95% 70% at 22% 24%,
      color-mix(in srgb, var(--rx-accent-bright) 8%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 3%, transparent) 38%,
      transparent 78%),
    rgba(0, 0, 0, 0.68);
}


/* ---- 2 · HERO RESET (back to matrix-v2 native) -------------------
   Captain: "the red bar needs to be exactly like the one in matrix
   v2 — i dont know why you changed it". The V4 cohesion sweep dressed
   the hero region (.po-header + descendants) in cyan-glass; Captain
   wants the native matrix-v2 look back. Reset the overrides from the
   V4 COHESION SWEEP block (lines ~4791-4881):
     - .po-header background gradient, border, radius, shadow, hover
     - .po-header::before cyan top hairline (suppress)
     - .hero-greeting__title display-font upgrade (revert)
     - .eyebrow custom cyan formatting (revert)
     - .po-avatar custom shadow + border (revert)
     - .po-allergy-banner gradient + shadow (revert)
   Everything else from V4 COHESION SWEEP stays (section cards,
   nav-strip glass surface, money summary, audit row, etc.). */
.patient-fullview__body .card.po-header,
.patient-fullview__body .card.po-header[style] {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border, #e5e5e8);
  border-radius: 12px;
  box-shadow: none;
  /* matrix-v2 ships .po-header with inline padding; let it through */
  padding: revert;
  transition: none;
  overflow: visible;
}
:root[data-theme="dark"] .patient-fullview__body .card.po-header,
:root[data-theme="dark"] .patient-fullview__body .card.po-header[style] {
  background: var(--bg-card, #111113);
  border-color: var(--border, #1F1F22);
}
.patient-fullview__body .card.po-header:hover {
  box-shadow: none;
  border-color: var(--border, #e5e5e8);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-header:hover {
  border-color: var(--border, #1F1F22);
}
/* Kill the cyan top hairline we added on the hero */
.patient-fullview__body .card.po-header::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

/* Hero title — back to matrix-v2 native (let base.css / patient.css
   own it). Wipe our display-font upgrade. */
.patient-fullview__body .po-header .hero-greeting__title {
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  line-height: revert;
  letter-spacing: revert;
  color: revert;
  margin: revert;
}

/* Eyebrow — matrix-v2 native (the page styles this on its own) */
.patient-fullview__body .po-header .eyebrow {
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  letter-spacing: revert;
  text-transform: revert;
  color: revert;
}

/* Avatar — drop our custom shadow + border so the matrix-v2 inline
   gradient avatar reads as-shipped */
.patient-fullview__body .po-header .po-avatar,
.patient-fullview__body .po-header .po-avatar[style] {
  box-shadow: revert;
  border: revert;
}

/* Allergy banner (POPIA · red bar) — restore matrix-v2's native red.
   The cohesion sweep added a gradient + box-shadow + font-display +
   border-radius override; wipe them all so the inline matrix-v2
   styling shines through unchanged. */
.patient-fullview__body .po-allergy-banner,
.patient-fullview__body .po-allergy-banner[style] {
  background: revert !important;
  border-radius: revert !important;
  box-shadow: revert !important;
  font-family: revert !important;
  letter-spacing: revert !important;
}


/* ---- 3 · SIDE-NAV TEXT +40% --------------------------------------
   Captain: "the writing inside must be 40% larger pls". The SIDE-NAV
   PASS shipped with 13.5px font + 8px 10px 8px 14px padding. Scale
   by 1.4:
     font-size: 13.5px → 19px (rounded from 18.9)
     padding-y: 8px → 11px
     padding-x: 10px → 14px (right), 14px → 20px (left)
   Rail widens 200px → 260px to host the larger type without
   wrapping. Active-bar widens 3px → 4px so it scales with the type. */
.patient-fullview__body .stack.patient-overview {
  grid-template-columns: 260px minmax(0, 1fr) !important;
}

.patient-fullview__body .patient-nav-strip {
  width: 260px !important;
  padding: 12px 8px !important;
  gap: 3px !important;
  row-gap: 3px !important;
  border-radius: 16px;
}

.patient-fullview__body .patient-nav-strip__link {
  font-size: 19px !important;
  line-height: 1.22 !important;
  padding: 11px 14px 11px 20px !important;
  border-radius: 12px !important;
  letter-spacing: -0.005em !important;
}

/* Hover chevron — scale with the type */
.patient-fullview__body .patient-nav-strip__link::after {
  font-size: 18px;
  padding-left: 10px;
}

/* Active-row left bar — widen 3px → 4px so it reads at the new scale.
   Re-declare top/bottom inset so the bar grows with the row padding. */
.patient-fullview__body .patient-nav-strip__link.is-active::before {
  left: 5px;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
}

/* Tablet band (641–960px) — keep the rail proportional but slightly
   tighter so the content column doesn't get squeezed.
   Override the inner SIDE-NAV PASS tablet block (which sets 180px /
   12.5px font). */
@media (max-width: 960px) and (min-width: 641px) {
  .patient-fullview__body .stack.patient-overview {
    grid-template-columns: 220px minmax(0, 1fr) !important;
  }
  .patient-fullview__body .patient-nav-strip {
    width: 220px !important;
  }
  .patient-fullview__body .patient-nav-strip__link {
    font-size: 17px !important;
    padding: 9px 12px 9px 18px !important;
  }
}

/* Mobile (≤640px) — the rail collapses to a horizontal wrap; keep
   the type tap-friendly but don't let it balloon (we have a narrow
   viewport). Bump from 11.5px → 16px (+40%) on phone. */
@media (max-width: 640px) {
  .patient-fullview__body .patient-nav-strip {
    width: auto !important;
    padding: 8px 10px !important;
  }
  .patient-fullview__body .patient-nav-strip__link {
    width: auto;
    padding: 7px 14px !important;
    font-size: 16px !important;
  }
}


/* ---- 4 · INTERNAL CARDS — soften corners ------------------------
   With the outer drawer rounded to 24px, the inner .po-card 16px
   feels too tight. Bump to 20px for visual cohesion. Hero header is
   handled separately above (reset back to matrix-v2 native). */
.patient-fullview__body .card.po-card,
.patient-fullview__body .card.po-card[style] {
  border-radius: 20px;
}

/* Nav-strip rail — bump radius to match */
.patient-fullview__body .patient-nav-strip {
  border-radius: 18px !important;
}


/* =====================================================   END · PATIENT FULL-VIEW REFINEMENT PASS
   ============================================================ */


/* =====================================================   PATIENT FULL-VIEW — iPHONE LIQUID GLASS PASS (Captain locked
   2026-05-24) "i like the iphone ui ux look the glass · neeten
   the top patient description bar"
   ------------------------------------------------------------
   Apple iOS 26 Liquid Glass language across the slide-over:

     · Translucent surfaces (rgba whites / blacks · NOT solid)
     · Backdrop-blur is the depth tool (saturate 180% · blur 22px)
     · Soft inset top highlights (refraction · not shadow)
     · Generous corner radii (20-24px · matched across nesting)
     · Light micro-shadows (1px tight · 12-32px long falloff)
     · 0.5-1px translucent edges (refraction · not lines)
     · Saturated content · desaturated chrome (cyan only on active)
     · Symmetric radius rhythm (drawer 24 · cards 20 · pills 12)

   This block is appended LAST so it wins by cascade order. It
   ELEVATES (not replaces) prior blocks:

     · Re-styles the HERO region that REFINEMENT PASS reset to
       matrix-v2 native — bringing it back in Liquid Glass
       language (Captain's "neeten" ask)
     · Re-skins drawer panel + scrim + nav rail + section cards
       into translucent glass surfaces
     · Refines active states and focus rings

   DO NOT edit patient_overview.html — matrix-v2 lock holds.
   Light + dark theme parity throughout · WCAG AA preserved ·
   reduced-motion respected.

   Local design tokens (scoped to .patient-fullview only — no
   global token additions per constraint):

     --lg-surface       — primary glass fill (light/dark aware)
     --lg-surface-hi    — slightly opaque variant for legibility
     --lg-edge          — refractive 1px edge
     --lg-inset-hi      — top inset highlight (refraction)
     --lg-shadow        — micro-shadow stack
     --lg-radius-xl     — 24px (drawer · hero)
     --lg-radius-lg     — 20px (section cards)
     --lg-radius-md     — 14px (avatar disc · pills · chips)
     --lg-radius-sm     — 12px (active nav pill)
     --lg-blur          — 22px (canonical Liquid Glass blur)
     --lg-blur-strong   — 30px (scrim · stronger backdrop)
     --lg-cyan-soft     — interactive tint (active states only)
   ============================================================ */

/* ---- 0 · LOCAL TOKENS (scope: .patient-fullview) -----------------
   Derived entirely from --rx-* aliases + color-mix() — no globals
   introduced. */
.patient-fullview {
  --lg-radius-xl:     24px;
  --lg-radius-lg:     20px;
  --lg-radius-md:     14px;
  --lg-radius-sm:     12px;
  --lg-blur:          22px;
  --lg-blur-strong:   30px;

  /* Light theme — paper-white translucent material */
  --lg-surface:       rgba(255, 255, 255, 0.62);
  --lg-surface-hi:    rgba(255, 255, 255, 0.78);
  --lg-surface-soft:  rgba(255, 255, 255, 0.42);
  --lg-edge:          color-mix(in srgb, var(--rx-accent) 14%, rgba(255, 255, 255, 0.32));
  --lg-edge-soft:     color-mix(in srgb, var(--rx-accent) 6%, rgba(255, 255, 255, 0.22));
  --lg-inset-hi:      inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --lg-inset-hi-soft: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --lg-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06);
  --lg-shadow-hi:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 18px 44px rgba(15, 23, 42, 0.09);

  /* Interactive cyan (active states · focus only) */
  --lg-cyan-soft:     color-mix(in srgb, var(--rx-accent-bright) 10%, transparent);
  --lg-cyan-mid:      color-mix(in srgb, var(--rx-accent-bright) 18%, transparent);
  --lg-cyan-edge:     color-mix(in srgb, var(--rx-accent) 22%, transparent);
}
:root[data-theme="dark"] .patient-fullview {
  --lg-surface:       rgba(20, 20, 22, 0.55);
  --lg-surface-hi:    rgba(28, 28, 32, 0.78);
  --lg-surface-soft:  rgba(20, 20, 22, 0.38);
  --lg-edge:          color-mix(in srgb, var(--rx-accent-bright) 22%, rgba(255, 255, 255, 0.06));
  --lg-edge-soft:     color-mix(in srgb, var(--rx-accent-bright) 12%, rgba(255, 255, 255, 0.04));
  --lg-inset-hi:      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --lg-inset-hi-soft: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --lg-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.42);
  --lg-shadow-hi:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 18px 44px rgba(0, 0, 0, 0.55);

  --lg-cyan-soft:     color-mix(in srgb, var(--rx-accent-bright) 16%, transparent);
  --lg-cyan-mid:      color-mix(in srgb, var(--rx-accent-bright) 26%, transparent);
  --lg-cyan-edge:     color-mix(in srgb, var(--rx-accent-bright) 32%, transparent);
}


/* ---- 1 · DRAWER PANEL — Liquid Glass outer chrome ----------------
   The panel is the OUTER glass. It's slightly more opaque than the
   inner surfaces (legibility) but still translucent. Inset highlight
   at the top edge reads as refraction along the rounded curve. */
.patient-fullview__panel {
  /* Translucent material — slightly opaque variant for chart legibility */
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.82) 0%,
      rgba(250, 250, 252, 0.88) 100%);
  backdrop-filter: saturate(180%) blur(var(--lg-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur));
  border-left: 0.5px solid var(--lg-edge);
  /* Apple-style shadow stack — long soft falloff · barely-there cyan rim */
  box-shadow:
    var(--lg-inset-hi),
    -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    -8px 0 18px rgba(15, 23, 42, 0.04),
    -36px 0 96px rgba(15, 23, 42, 0.10);
}
:root[data-theme="dark"] .patient-fullview__panel {
  background:
    linear-gradient(180deg,
      rgba(20, 20, 22, 0.78) 0%,
      rgba(16, 16, 18, 0.86) 100%);
  border-left: 0.5px solid color-mix(in srgb, var(--rx-accent-bright) 22%, rgba(255, 255, 255, 0.08));
  box-shadow:
    var(--lg-inset-hi),
    -1px 0 0 color-mix(in srgb, var(--rx-accent-bright) 22%, transparent),
    -8px 0 18px rgba(0, 0, 0, 0.32),
    -36px 0 96px rgba(0, 0, 0, 0.58);
}

/* Rim light — pull cyan accent back to a hint of warmth (per spec:
   "barely-there"). The radial stays but at half intensity. The
   linear hairline drops out — the panel's box-shadow `-1px 0 0`
   now does that job at lower intensity. */
.patient-fullview__rim {
  background:
    radial-gradient(220px 180px at 16px 14px,
      color-mix(in srgb, var(--rx-accent-bright) 5%, transparent) 0%,
      transparent 70%);
}
:root[data-theme="dark"] .patient-fullview__rim {
  background:
    radial-gradient(240px 200px at 16px 14px,
      color-mix(in srgb, var(--rx-accent-bright) 10%, transparent) 0%,
      transparent 70%);
}


/* ---- 2 · SCRIM — stronger blur · softer luminance ---------------
   Apple's UIVisualEffectView blur intensity is the benchmark — push
   blur 8px → 16px, drop the cyan tint to a whisper. */
.patient-fullview__scrim {
  background:
    radial-gradient(ellipse 110% 80% at 22% 22%,
      color-mix(in srgb, var(--rx-accent-bright) 3%, transparent) 0%,
      transparent 70%),
    rgba(15, 23, 42, 0.32);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
}
:root[data-theme="dark"] .patient-fullview__scrim {
  background:
    radial-gradient(ellipse 110% 80% at 22% 22%,
      color-mix(in srgb, var(--rx-accent-bright) 5%, transparent) 0%,
      transparent 70%),
    rgba(0, 0, 0, 0.56);
  backdrop-filter: saturate(170%) blur(18px);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
}
/* Enter/leave end-states pick up the new blur values */
.patient-fullview__scrim--enter-to,
.patient-fullview__scrim--leave-from {
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
}
:root[data-theme="dark"] .patient-fullview__scrim--enter-to,
:root[data-theme="dark"] .patient-fullview__scrim--leave-from {
  backdrop-filter: saturate(170%) blur(18px);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
}


/* ---- 3 · HERO REGION — RESCUE FROM RESET · Liquid Glass card ----
   The REFINEMENT PASS reverted the V4 cohesion overrides on the
   hero (.po-header + descendants) so matrix-v2's native styling
   shone through — but Captain looked at that result and said
   "neeten the top patient description bar". The matrix-v2 native
   look is a flat white card with a blocky solid-red allergy bar —
   reads as "a matrix-v2 page embedded in chrome" with a visible
   seam. This block dresses it back up in Liquid Glass language
   (NOT the V4 cohesion cyan-gradient look — restrained, premium).

   Specificity: matches the RESET block's pattern (selector +
   [style] attribute) so we win cleanly via cascade order. */

/* Hero card — translucent white-glass · generous radius · inset top */
.patient-fullview__body .card.po-header,
.patient-fullview__body .card.po-header[style] {
  position: relative;
  background: var(--lg-surface);
  backdrop-filter: saturate(180%) blur(var(--lg-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur));
  border: 0.5px solid var(--lg-edge);
  border-radius: var(--lg-radius-xl);
  box-shadow:
    var(--lg-inset-hi),
    var(--lg-shadow);
  padding: 22px 24px;
  overflow: hidden;
  transition:
    box-shadow 200ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-header,
:root[data-theme="dark"] .patient-fullview__body .card.po-header[style] {
  background: var(--lg-surface);
  border-color: var(--lg-edge);
  box-shadow:
    var(--lg-inset-hi),
    var(--lg-shadow);
}
.patient-fullview__body .card.po-header:hover {
  box-shadow:
    var(--lg-inset-hi),
    var(--lg-shadow-hi);
  border-color: var(--lg-cyan-edge);
}
/* Suppress the V4 cohesion top hairline — Liquid Glass uses the
   inset highlight instead. */
.patient-fullview__body .card.po-header::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

/* Eyebrow — small uppercase tracked-out cyan label · refined opacity */
.patient-fullview__body .po-header .eyebrow {
  font-family: var(--font-display, "Space Grotesk", "Inter", sans-serif);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--rx-accent-text) 88%, transparent);
  margin-bottom: 6px;
  display: inline-block;
}
:root[data-theme="dark"] .patient-fullview__body .po-header .eyebrow {
  color: color-mix(in srgb, var(--rx-accent-bright) 78%, transparent);
}

/* Hero title — Space Grotesk 600 · comfortable · tight tracking */
.patient-fullview__body .po-header .hero-greeting__title {
  font-family: var(--font-display, "Space Grotesk", "Inter", sans-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.022em;
  color: var(--rx-text-strong);
  margin: 2px 0 10px;
}

/* Avatar — soft cyan-tinted disc · inner highlight · no loud ring.
   matrix-v2's avatar has an inline radial gradient + drop-shadow.
   Replace with a calm cyan-glass disc (subtle, refraction not glow). */
.patient-fullview__body .po-header .po-avatar,
.patient-fullview__body .po-header .po-avatar[style] {
  width: 72px !important;
  height: 72px !important;
  background:
    linear-gradient(140deg,
      color-mix(in srgb, var(--rx-accent-bright) 22%, var(--lg-surface-hi)) 0%,
      color-mix(in srgb, var(--rx-accent) 14%, var(--lg-surface-hi)) 100%) !important;
  border: 0.5px solid var(--lg-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 6px 18px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent);
  color: var(--rx-text-strong) !important;
  font-family: var(--font-display, "Space Grotesk", sans-serif) !important;
  font-size: 1.55rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.5px !important;
}
:root[data-theme="dark"] .patient-fullview__body .po-header .po-avatar,
:root[data-theme="dark"] .patient-fullview__body .po-header .po-avatar[style] {
  background:
    linear-gradient(140deg,
      color-mix(in srgb, var(--rx-accent-bright) 28%, var(--lg-surface-hi)) 0%,
      color-mix(in srgb, var(--rx-accent) 18%, var(--lg-surface-hi)) 100%) !important;
  border-color: color-mix(in srgb, var(--rx-accent-bright) 22%, rgba(255, 255, 255, 0.08));
  color: color-mix(in srgb, var(--rx-accent-bright) 92%, white) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 6px 18px color-mix(in srgb, var(--rx-accent-bright) 16%, transparent);
}

/* Allergy banner — soft red-glass chip · discreet warning icon ·
   tight typography. Refined from matrix-v2's solid-red shouty pill
   into a glass chip that's still readable-at-a-glance but doesn't
   visually dominate the hero. The icon size from the template
   markup is preserved (20×20) but visually reads softer via the
   reduced opacity background. */
.patient-fullview__body .po-allergy-banner,
.patient-fullview__body .po-allergy-banner[style] {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--red, #dc2626) 14%, var(--lg-surface)) 0%,
      color-mix(in srgb, var(--red, #dc2626) 10%, var(--lg-surface)) 100%) !important;
  backdrop-filter: saturate(180%) blur(var(--lg-blur)) !important;
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur)) !important;
  border: 0.5px solid color-mix(in srgb, var(--red, #dc2626) 32%, transparent) !important;
  border-radius: var(--lg-radius-md) !important;
  color: color-mix(in srgb, var(--red, #b91c1c) 92%, black) !important;
  font-family: var(--font-body, "Inter", sans-serif) !important;
  font-weight: 600 !important;
  letter-spacing: -0.005em !important;
  font-size: 13px !important;
  padding: 10px 14px !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 1px 2px color-mix(in srgb, var(--red, #dc2626) 14%, transparent),
    0 8px 20px color-mix(in srgb, var(--red, #dc2626) 10%, transparent) !important;
}
:root[data-theme="dark"] .patient-fullview__body .po-allergy-banner,
:root[data-theme="dark"] .patient-fullview__body .po-allergy-banner[style] {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--red, #dc2626) 22%, var(--lg-surface)) 0%,
      color-mix(in srgb, var(--red, #dc2626) 16%, var(--lg-surface)) 100%) !important;
  border-color: color-mix(in srgb, var(--red, #dc2626) 44%, transparent) !important;
  color: color-mix(in srgb, var(--red, #f87171) 92%, white) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 8px 20px color-mix(in srgb, var(--red, #dc2626) 22%, transparent) !important;
}
/* The inline SVG warning icon inside the banner — keep visible but
   slightly soften by inheriting the muted red colour. */
.patient-fullview__body .po-allergy-banner svg {
  width: 18px !important;
  height: 18px !important;
  stroke-width: 2.25 !important;
  color: inherit;
  opacity: 0.92;
}
.patient-fullview__body .po-allergy-banner span:last-child {
  font-weight: 500 !important;
  opacity: 0.78;
  font-size: 12px !important;
}


/* ---- 4 · SECTION CARDS — translucent glass with inset highlight -
   Demographics · Medical · Treatment plans · Money · Comms · Audit
   etc. Re-skin the existing .po-card surface as Liquid Glass —
   translucent, 20px radius, subtle top inset highlight. Override
   the V4 COHESION SWEEP block. */
.patient-fullview__body .card.po-card,
.patient-fullview__body .card.po-card[style] {
  position: relative;
  background: var(--lg-surface);
  backdrop-filter: saturate(180%) blur(var(--lg-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur));
  border: 0.5px solid var(--lg-edge-soft);
  border-radius: var(--lg-radius-lg);
  box-shadow:
    var(--lg-inset-hi-soft),
    var(--lg-shadow);
  padding: 20px 22px;
  transition:
    box-shadow 200ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.patient-fullview__body .card.po-card:hover {
  border-color: var(--lg-edge);
  box-shadow:
    var(--lg-inset-hi),
    var(--lg-shadow-hi);
}
/* Suppress the V4 cohesion cyan top hairline — Liquid Glass uses
   the inset highlight instead. */
.patient-fullview__body .card.po-card::before {
  content: none !important;
  display: none !important;
  background: none !important;
}

/* Card head — refined typography */
.patient-fullview__body .card.po-card .card__head,
.patient-fullview__body .card.po-card .card__head[style] {
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--lg-edge-soft) !important;
}
/* Replace the V4 cohesion gradient underline (the ::after we
   inherit from the cohesion sweep) with a clean glass hairline. */
.patient-fullview__body .card.po-card .card__head::after {
  background: none !important;
  display: none !important;
}
.patient-fullview__body .card.po-card .card__title {
  font-family: var(--font-display, "Space Grotesk", "Inter", sans-serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.012em;
  color: var(--rx-text-strong);
}
.patient-fullview__body .card.po-card .card__sub {
  font-family: var(--font-body, "Inter", sans-serif);
  color: var(--rx-text-soft);
  font-size: 12px;
  letter-spacing: -0.003em;
  margin-top: 2px;
}

/* Quick stats strip — same Liquid Glass treatment */
.patient-fullview__body .card.po-quick-stats,
.patient-fullview__body .card.po-quick-stats[style] {
  background: var(--lg-surface);
  backdrop-filter: saturate(180%) blur(var(--lg-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur));
  border: 0.5px solid var(--lg-edge-soft);
  border-radius: var(--lg-radius-md);
  box-shadow:
    var(--lg-inset-hi-soft),
    var(--lg-shadow);
  padding: 16px 20px;
}

/* Right-rail Niki card — keep cyan emphasis (it's an interactive
   surface) but in Liquid Glass language */
.patient-fullview__body .po-rail .card[style*="--accent"],
.patient-fullview__body .po-rail .card:first-child {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 8%, var(--lg-surface-hi)) 0%,
      var(--lg-surface-hi) 100%);
  backdrop-filter: saturate(180%) blur(var(--lg-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur));
  border: 0.5px solid var(--lg-cyan-edge);
  border-radius: var(--lg-radius-lg);
  box-shadow:
    var(--lg-inset-hi),
    var(--lg-shadow),
    0 0 32px color-mix(in srgb, var(--rx-accent-bright) 8%, transparent);
}
.patient-fullview__body .po-rail .card:first-child::before {
  content: none !important;
  display: none !important;
}


/* ---- 5 · SIDE-NAV RAIL — pressed-into-glass treatment -----------
   Translucent background · strong backdrop-blur · pill-shape rows
   with refined active state. Preserves Captain's +40% type size
   from REFINEMENT PASS (19px font · 11/14/20 padding · 260px rail).
   The rail itself becomes a Liquid Glass slab; active rows are a
   soft cyan-tinted glass interior + 4px cyan vertical bar. */
.patient-fullview__body .patient-nav-strip {
  background: var(--lg-surface-soft);
  backdrop-filter: saturate(180%) blur(var(--lg-blur)) !important;
  -webkit-backdrop-filter: saturate(180%) blur(var(--lg-blur)) !important;
  border: 0.5px solid var(--lg-edge-soft) !important;
  border-radius: 20px !important;
  box-shadow:
    var(--lg-inset-hi-soft),
    var(--lg-shadow) !important;
  padding: 10px 8px !important;
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip {
  background: var(--lg-surface-soft);
  border-color: var(--lg-edge-soft) !important;
}
/* The cohesion-sweep ::after hairline at the bottom of the strip is
   already hidden by the SIDE-NAV PASS; ensure it stays hidden. */
.patient-fullview__body .patient-nav-strip::after {
  display: none !important;
}

/* Nav links — refined typography · gentle hover · no hard borders.
   Re-skin on top of the REFINEMENT PASS sizing. */
.patient-fullview__body .patient-nav-strip__link {
  font-family: var(--font-body, "Inter", -apple-system, sans-serif) !important;
  font-weight: 500;
  letter-spacing: -0.005em !important;
  color: var(--rx-text-soft);
  background: transparent;
  border: 0.5px solid transparent !important;
  border-radius: var(--lg-radius-sm) !important;
  transition:
    color 160ms cubic-bezier(0.22, 0.61, 0.36, 1),
    background 160ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 160ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Hover — gentle glass lift, no transform */
.patient-fullview__body .patient-nav-strip__link:hover {
  color: var(--rx-text-strong);
  background: color-mix(in srgb, var(--rx-accent-bright) 6%, var(--lg-surface));
  border-color: var(--lg-edge-soft) !important;
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip__link:hover {
  color: var(--rx-text-strong);
  background: color-mix(in srgb, var(--rx-accent-bright) 10%, var(--lg-surface));
}

/* Active — soft cyan-tinted glass · 4px cyan bar · pulse dot held */
.patient-fullview__body .patient-nav-strip__link.is-active {
  color: var(--rx-accent-text);
  font-weight: 600;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent-bright) 16%, var(--lg-surface)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 8%, var(--lg-surface)) 70%,
      var(--lg-surface) 100%) !important;
  border: 0.5px solid var(--lg-cyan-edge) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 2px color-mix(in srgb, var(--rx-accent) 10%, transparent) !important;
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip__link.is-active {
  color: color-mix(in srgb, var(--rx-accent-bright) 92%, white);
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--rx-accent-bright) 22%, var(--lg-surface)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 12%, var(--lg-surface)) 70%,
      var(--lg-surface) 100%) !important;
  border-color: color-mix(in srgb, var(--rx-accent-bright) 32%, transparent) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* Active bar — preserve REFINEMENT PASS 4px width but refine the
   gradient + glow so it reads as a glass-rendered bar, not a flat
   stick. */
.patient-fullview__body .patient-nav-strip__link.is-active::before {
  background: linear-gradient(180deg,
    var(--rx-accent-bright) 0%,
    color-mix(in srgb, var(--rx-accent) 88%, var(--rx-accent-bright)) 100%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}


/* ---- 6 · NAV PILLS INSIDE HERO + CARDS --------------------------
   The header pills (practitioner · last visit · next visit) and the
   POPIA badge benefit from the Liquid Glass chip treatment. */
.patient-fullview__body .nav-pill {
  background: var(--lg-surface);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 0.5px solid var(--lg-edge-soft);
  border-radius: 999px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.002em;
  padding: 3px 10px;
  color: var(--rx-text-soft);
  box-shadow: var(--lg-inset-hi-soft);
}
.patient-fullview__body .nav-pill.nav-pill--accent {
  background: color-mix(in srgb, var(--rx-accent-bright) 10%, var(--lg-surface-hi));
  border-color: var(--lg-cyan-edge);
  color: var(--rx-accent-text);
}
.patient-fullview__body .nav-pill.nav-pill--live {
  background: color-mix(in srgb, var(--rx-healthy, #16a34a) 10%, var(--lg-surface-hi));
  border-color: color-mix(in srgb, var(--rx-healthy, #16a34a) 28%, transparent);
  color: var(--rx-healthy, #16a34a);
}


/* ---- 7 · ROW SURFACES — plan rows · invoice rows · audit rows ---
   The V4 cohesion sweep cyan-tinted these. Re-skin into Liquid
   Glass — translucent, soft edges, gentle hover. */
.patient-fullview__body .po-plan-row[style],
.patient-fullview__body .invoice-row[style],
.patient-fullview__body .quote-row[style],
.patient-fullview__body .audit-row[style] {
  background: var(--lg-surface-soft) !important;
  border: 0.5px solid var(--lg-edge-soft) !important;
  border-radius: var(--lg-radius-sm) !important;
  box-shadow: var(--lg-inset-hi-soft) !important;
  transition:
    background 160ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 160ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.patient-fullview__body .po-plan-row[style]:hover,
.patient-fullview__body .invoice-row[style]:hover,
.patient-fullview__body .quote-row[style]:hover {
  background: color-mix(in srgb, var(--rx-accent-bright) 5%, var(--lg-surface)) !important;
  border-color: var(--lg-edge) !important;
  transform: none !important;
}
.patient-fullview__body .po-activity__row[style] {
  background: var(--lg-surface-soft) !important;
  border: 0.5px solid var(--lg-edge-soft) !important;
  border-radius: var(--lg-radius-sm) !important;
  box-shadow: var(--lg-inset-hi-soft) !important;
}

/* Money-summary cells — soft glass tiles */
.patient-fullview__body .money-summary__cell[style] {
  border-radius: var(--lg-radius-sm) !important;
  border: 0.5px solid var(--lg-edge-soft);
  background: var(--lg-surface-soft) !important;
  box-shadow: var(--lg-inset-hi-soft);
}
.patient-fullview__body .money-summary__cell[style]:hover {
  transform: none !important;
  border-color: var(--lg-edge);
  background: color-mix(in srgb, var(--rx-accent-bright) 5%, var(--lg-surface)) !important;
  box-shadow:
    var(--lg-inset-hi),
    var(--lg-shadow);
}


/* ---- 8 · BUTTONS · FOCUS RINGS — refined Liquid Glass ----------
   Body buttons (Niki · ghost · action chips) — pill-shape, soft
   glass surface, no hard outlines. */
.patient-fullview__body .btn--ghost {
  background: var(--lg-surface);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 0.5px solid var(--lg-edge-soft);
  border-radius: var(--lg-radius-sm);
  font-family: var(--font-body, "Inter", sans-serif);
  box-shadow: var(--lg-inset-hi-soft);
}
.patient-fullview__body .btn--ghost:hover {
  background: var(--lg-surface-hi);
  border-color: var(--lg-edge);
}
.patient-fullview__body .btn--primary {
  background:
    linear-gradient(180deg,
      var(--rx-accent-bright) 0%,
      var(--rx-accent) 100%);
  border: 0.5px solid color-mix(in srgb, var(--rx-accent) 60%, transparent);
  border-radius: var(--lg-radius-sm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 1px 2px color-mix(in srgb, var(--rx-accent) 18%, transparent),
    0 6px 18px color-mix(in srgb, var(--rx-accent-bright) 22%, transparent);
}

/* Focus rings — 3px cyan glow · 1px inner line · no harsh outlines */
.patient-fullview__body a:focus-visible,
.patient-fullview__body .patient-nav-strip__link:focus-visible,
.patient-fullview__body button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 26%, transparent),
    0 0 0 0.5px var(--rx-accent-text) !important;
  border-radius: var(--lg-radius-sm);
}


/* ---- 9 · MOBILE TIGHTENING (≤640px) ----------------------------
   At phone widths the drawer is full-screen. Soften the radii at
   the corners (the drawer fills the whole viewport so it has no
   left edge to round). Keep the hero glass treatment but drop
   padding slightly. */
@media (max-width: 640px) {
  .patient-fullview__panel {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
  .patient-fullview__body .card.po-header,
  .patient-fullview__body .card.po-header[style] {
    border-radius: var(--lg-radius-lg);
    padding: 18px 18px;
  }
  .patient-fullview__body .po-header .hero-greeting__title {
    font-size: 22px;
  }
  .patient-fullview__body .po-header .po-avatar,
  .patient-fullview__body .po-header .po-avatar[style] {
    width: 60px !important;
    height: 60px !important;
    font-size: 1.25rem !important;
  }
  .patient-fullview__body .card.po-card,
  .patient-fullview__body .card.po-card[style] {
    border-radius: var(--lg-radius-md);
    padding: 16px 18px;
  }
  .patient-fullview__body .patient-nav-strip {
    border-radius: var(--lg-radius-md) !important;
  }
}


/* ---- 10 · REDUCED-MOTION ---------------------------------------
   No backdrop-filter transitions, no hover lifts. */
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__panel,
  .patient-fullview__body .card.po-header,
  .patient-fullview__body .card.po-card,
  .patient-fullview__body .patient-nav-strip__link,
  .patient-fullview__body .po-plan-row,
  .patient-fullview__body .invoice-row,
  .patient-fullview__body .quote-row,
  .patient-fullview__body .money-summary__cell {
    transition: none !important;
  }
}

/* =====================================================   END · PATIENT FULL-VIEW iPHONE LIQUID GLASS PASS
   ============================================================ */

/* =====================================================   PATIENT FULL-VIEW — HERO LAYOUT FIX (Captain locked 2026-05-24)
   The FIT-PASS forced .po-header into single-column to avoid
   overflow at the OLD 60vw width. At the new 68vw width (1180px
   max → ~700-820px content column inside the side-nav grid),
   the matrix-v2 native 3-column "auto 1fr auto" fits.
   Restore avatar | name+pills | POPIA-badge SIDE-BY-SIDE.
   ============================================================ */
.patient-fullview__body .patient-overview .po-header,
.patient-fullview__body .patient-overview .card.po-header[style] {
  grid-template-columns: auto 1fr auto !important;
  text-align: left !important;
  gap: var(--rx-s4) !important;
  align-items: center !important;
}
.patient-fullview__body .patient-overview .po-avatar,
.patient-fullview__body .patient-overview .po-header .po-avatar[style] {
  margin: 0 !important;
}
.patient-fullview__body .patient-overview .po-popia[style] {
  text-align: right !important;
  min-width: 180px !important;
}
.patient-fullview__body .patient-overview .po-header .row[style] {
  justify-content: flex-start !important;
}

/* Hide the sr-only patient_id span properly — the matrix-v2 inline
   `position:absolute; clip:rect(0,0,0,0)` was getting visually
   surfaced inside our grid container. Force it off-screen with !important. */
.patient-fullview__body .patient-overview .po-header [aria-label^="Internal id"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Phone collapse — at ≤640px the 3-column hero still won't fit. */
@media (max-width: 640px) {
  .patient-fullview__body .patient-overview .po-header,
  .patient-fullview__body .patient-overview .card.po-header[style] {
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }
  .patient-fullview__body .patient-overview .po-avatar,
  .patient-fullview__body .patient-overview .po-header .po-avatar[style] {
    margin: 0 auto !important;
  }
  .patient-fullview__body .patient-overview .po-popia[style] {
    text-align: center !important;
    min-width: 0 !important;
  }
  .patient-fullview__body .patient-overview .po-header .row[style] {
    justify-content: center !important;
  }
}


/* =====================================================   PATIENT FULL-VIEW — CYAN GLOW + RHYTHM PASS
   (Captain locked 2026-05-24)
   ------------------------------------------------------------
   Three asks, in order:

     1. Halve the vertical space above the hero card AND above the
        sticky nav-strip (50% reduction · "reduce it by 50%").
     2. Subtle outer cyan glow behind every box in the side-nav
        view — hero, quick-stats, demographics, medical, treatment,
        money, comms, activity, lab, imaging, sedation, compliance,
        photos, audit, plus the Right rail cards (Ask Niki, Quick
        actions, Perio). Liquid-Glass-compatible.
     3. Unified vertical rhythm — every gap between consecutive
        cards under the drawer reads as the SAME number. Target:
        --rx-s5 (20px).

   Loaded LAST so it wins via cascade order. Specificity scoped
   under .patient-fullview__body so it never bleeds outside the
   slide-over. matrix-v2 template untouched (lock holds).
   Light + dark parity · reduced-motion respected.
   ============================================================ */


/* ---- 1 · TOP SPACE — HALVE THE PADDING (52 → 26) ----------------
   Outer container padding-top sets the gap above BOTH the hero
   (column 2, first row) and the rail (column 1, sticky). Halve
   the previous 52px → 26px so the chart starts higher in the
   drawer. Side + bottom padding untouched. */
.patient-fullview__body .stack.patient-overview {
  padding: 26px 24px 44px !important;
}

/* Sticky nav-strip offset — halve from 18px → 9px. The rail pins
   9px below the top of the scroll container, perfectly mirroring
   the new 26px outer top padding (the rail's own top padding +
   the 9px sticky offset ≈ the hero's outer 26px). */
.patient-fullview__body .patient-nav-strip {
  top: 9px !important;
  max-height: calc(100vh - 18px) !important;
}

/* Phone — the 52→36 default already passes 50%. Apply a matching
   halving for parity (52 → 26 is overridden by the phone block at
   line ~5914; keep that path for mobile). Mobile rail top stays
   at 0 (it scrolls horizontally above the chart at phone widths). */
@media (max-width: 640px) {
  .patient-fullview__body .stack.patient-overview {
    padding: 26px 16px 36px !important;
  }
}


/* ---- 2 · UNIFIED VERTICAL RHYTHM (target: --rx-s5 = 20px) -------
   Every gap between consecutive cards in the slide-over reads as
   the SAME number. The four gap-controllers below all converge
   on var(--rx-s5):

     a) Outer grid row-gap between .patient-section siblings
        (hero-section → money-section → comms-section → …)
     b) #sec-overview internal flow (allergy banner → hero →
        quick-stats → po-grid). matrix-v2 ships this as plain
        block flow — we promote to flex-column with gap.
     c) .po-grid itself (main column → right rail). Template
        inline is 1rem (16px). Push to 20px.
     d) .po-grid__main internal gap (Demographics, Medical,
        Treatment, Money summary, Activity cards). Existing
        override is var(--rx-s4) (16px). Push to 20px.
     e) .po-rail internal gap (Ask Niki, Quick actions, Perio).
        Template inline is 1rem (16px). Push to 20px. */

/* a) Outer .stack.patient-overview grid row-gap */
.patient-fullview__body .stack.patient-overview {
  row-gap: var(--rx-s5, 20px) !important;
}

/* b) #sec-overview (.patient-section first-of-type) → flex column
      with consistent gap. Selector targets the wrapper that holds
      the allergy banner + hero + quick-stats + po-grid. Skip the
      anchor span (#sec-treatment) so it doesn't bloat the gap. */
.patient-fullview__body .patient-overview > .patient-section,
.patient-fullview__body .patient-overview .patient-section {
  display: flex;
  flex-direction: column;
  gap: var(--rx-s5, 20px);
}
/* Anchor spans inside the section are zero-height jumps; they
   shouldn't introduce phantom gap rows. */
.patient-fullview__body .patient-overview .patient-section__anchor {
  display: none;
}

/* c) .po-grid (main column + rail) */
.patient-fullview__body .patient-overview .po-grid,
.patient-fullview__body .patient-overview .po-grid[style] {
  gap: var(--rx-s5, 20px) !important;
}

/* d) .po-grid__main (Demographics, Medical, Treatment, Money summary,
      Activity card column-flow). Earlier SIDE-NAV PASS set this to
      --rx-s4 (16px). Bump to 20px for the unified rhythm. */
.patient-fullview__body .patient-overview .po-grid__main,
.patient-fullview__body .patient-overview .po-grid__main[style] {
  gap: var(--rx-s5, 20px) !important;
}

/* e) .po-rail vertical gap between rail cards */
.patient-fullview__body .patient-overview .po-rail,
.patient-fullview__body .patient-overview .po-rail[style] {
  gap: var(--rx-s5, 20px) !important;
}

/* Section margin-top resets — every subsequent .patient-section
   gets its breathing room from the grid row-gap (rule a). The
   SPACING RHYTHM SWEEP at line ~5268 added margin-top to consecutive
   sections AND to inline-margin-top cards (#sec-money's inner card
   has `margin-top: 1.25rem` in the template). Zero those out so
   the gap reads cleanly from the grid + flex-gap above and never
   doubles. */
.patient-fullview__body .stack.patient-overview > .patient-section + .patient-section,
.patient-fullview__body .stack.patient-overview > .patient-section {
  margin-top: 0 !important;
}
.patient-fullview__body .patient-overview .card.po-card[style*="margin-top"] {
  margin-top: 0 !important;
}

/* Anchor scroll-margin still pulls anchors clear of the slim 9px
   sticky nav offset. The 64px scroll-margin from earlier remains
   adequate. No change needed here. */


/* ---- 3 · CYAN GLOW — soft halo behind every box -----------------
   "all the boxes" = the hero card, the quick-stats strip, every
   .po-card section card (Demographics, Medical, Treatment plans,
   Money, Comms, Activity, Lab, Imaging, Sedation, Compliance,
   Photos, Audit), the rail cards (Ask Niki, Quick actions, Perio),
   and the money-summary cells. Each gets the same recipe:

     box-shadow:
       <existing inset highlight>,
       <existing micro + long shadow>,
       0 0 0 1px <cyan rim 6-9%>          ← thin outer rim line
       0 0 28px <cyan halo 12-16%>        ← soft outer halo
       0 0 48px <cyan halo 6-8%>          ← extended fall-off

   Light theme = subtle (12% halo · 6% rim).
   Dark theme = stronger (18% halo · 12% rim) because dark
   surfaces support more glow without washing out content.

   We REPLACE the box-shadow stack (not append via additional
   declarations) because CSS doesn't merge shadow stacks across
   rules. Each shadow stack below preserves the prior Liquid Glass
   inset highlight + micro-shadow + long-falloff shadow that the
   iPHONE LIQUID GLASS PASS established, plus the new cyan rim +
   halo layers. */

/* a) HERO card — the patient header. Generous halo (the hero is
      the focal point). */
.patient-fullview__body .card.po-header,
.patient-fullview__body .card.po-header[style] {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 7%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright) 13%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-header,
:root[data-theme="dark"] .patient-fullview__body .card.po-header[style] {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.42),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent),
    0 0 32px color-mix(in srgb, var(--rx-accent-bright) 20%, transparent),
    0 0 64px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent);
}
.patient-fullview__body .card.po-header:hover {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 18px 44px rgba(15, 23, 42, 0.09),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 32px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 64px color-mix(in srgb, var(--rx-accent-bright) 9%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-header:hover {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 18px 44px rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 20%, transparent),
    0 0 36px color-mix(in srgb, var(--rx-accent-bright) 26%, transparent),
    0 0 72px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
}

/* b) SECTION CARDS — .po-card (all 12 of them). Same recipe,
      slightly softer than the hero (these are supporting cast). */
.patient-fullview__body .card.po-card,
.patient-fullview__body .card.po-card[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
    0 0 24px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 48px color-mix(in srgb, var(--rx-accent-bright) 5%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-card,
:root[data-theme="dark"] .patient-fullview__body .card.po-card[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.42),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 9%, transparent);
}
.patient-fullview__body .card.po-card:hover {
  border-color: var(--lg-edge);
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 18px 44px rgba(15, 23, 42, 0.09),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 11%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright) 16%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 8%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-card:hover {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 18px 44px rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 32px color-mix(in srgb, var(--rx-accent-bright) 24%, transparent),
    0 0 64px color-mix(in srgb, var(--rx-accent-bright) 13%, transparent);
}

/* c) QUICK-STATS STRIP — .po-quick-stats */
.patient-fullview__body .card.po-quick-stats,
.patient-fullview__body .card.po-quick-stats[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
    0 0 24px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 48px color-mix(in srgb, var(--rx-accent-bright) 5%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .card.po-quick-stats,
:root[data-theme="dark"] .patient-fullview__body .card.po-quick-stats[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.42),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 9%, transparent);
}

/* d) RIGHT-RAIL CARDS — Ask Niki, Quick actions, Perio trend.
      The Ask-Niki card already had a cyan glow (it's the
      interactive surface). The other two were plain. Unify them. */
.patient-fullview__body .po-rail .card,
.patient-fullview__body .po-rail .card[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
    0 0 24px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 48px color-mix(in srgb, var(--rx-accent-bright) 5%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .po-rail .card,
:root[data-theme="dark"] .patient-fullview__body .po-rail .card[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.42),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 9%, transparent);
}
/* The first rail card (Ask Niki) keeps a slightly stronger glow
   because it's the interactive call-to-action surface. */
.patient-fullview__body .po-rail .card[style*="--accent"],
.patient-fullview__body .po-rail .card:first-child {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 12px 32px rgba(15, 23, 42, 0.07),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    0 0 32px color-mix(in srgb, var(--rx-accent-bright) 16%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 7%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .po-rail .card[style*="--accent"],
:root[data-theme="dark"] .patient-fullview__body .po-rail .card:first-child {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 18%, transparent),
    0 0 36px color-mix(in srgb, var(--rx-accent-bright) 26%, transparent),
    0 0 64px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
}

/* e) MONEY-SUMMARY CELLS — the four big-number tiles inside the
      Money card. Same recipe at the "tile" intensity (slightly
      lighter than po-card since they nest inside one). */
.patient-fullview__body .money-summary__cell[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 6px 18px rgba(15, 23, 42, 0.05),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 5%, transparent),
    0 0 18px color-mix(in srgb, var(--rx-accent-bright) 9%, transparent);
}
:root[data-theme="dark"] .patient-fullview__body .money-summary__cell[style] {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 6px 18px rgba(0, 0, 0, 0.4),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    0 0 22px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
}
.patient-fullview__body .money-summary__cell[style]:hover {
  box-shadow:
    var(--lg-inset-hi),
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 10px 24px rgba(15, 23, 42, 0.08),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    0 0 24px color-mix(in srgb, var(--rx-accent-bright) 15%, transparent);
}

/* f) NAV-STRIP RAIL — same cyan halo so the rail floats in the
      same cyan light as the cards. Subtle (the rail is chrome,
      not content). */
.patient-fullview__body .patient-nav-strip {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
    0 0 24px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent),
    0 0 48px color-mix(in srgb, var(--rx-accent-bright) 5%, transparent) !important;
}
:root[data-theme="dark"] .patient-fullview__body .patient-nav-strip {
  box-shadow:
    var(--lg-inset-hi-soft),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.42),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright) 16%, transparent),
    0 0 56px color-mix(in srgb, var(--rx-accent-bright) 8%, transparent) !important;
}


/* ---- 4 · REDUCED-MOTION ---------------------------------------
   Glow is static — no transitions involved beyond the existing
   200ms box-shadow on hover from the LIQUID GLASS PASS. Keep
   those hover transitions off when prefers-reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .patient-fullview__body .card.po-header,
  .patient-fullview__body .card.po-card,
  .patient-fullview__body .card.po-quick-stats,
  .patient-fullview__body .po-rail .card,
  .patient-fullview__body .money-summary__cell[style] {
    transition: none !important;
  }
}


/* ---- 5 · MOBILE (≤640px) — TIGHTER GLOW + RHYTHM --------------
   At phone widths the cards span full-width and stack tight. The
   glow halo would overlap aggressively — pull the falloff in. */
@media (max-width: 640px) {
  .patient-fullview__body .card.po-header,
  .patient-fullview__body .card.po-header[style],
  .patient-fullview__body .card.po-card,
  .patient-fullview__body .card.po-card[style],
  .patient-fullview__body .card.po-quick-stats,
  .patient-fullview__body .card.po-quick-stats[style],
  .patient-fullview__body .po-rail .card {
    box-shadow:
      var(--lg-inset-hi-soft),
      0 1px 2px rgba(15, 23, 42, 0.04),
      0 8px 20px rgba(15, 23, 42, 0.05),
      0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
      0 0 16px color-mix(in srgb, var(--rx-accent-bright) 10%, transparent) !important;
  }
  :root[data-theme="dark"] .patient-fullview__body .card.po-header,
  :root[data-theme="dark"] .patient-fullview__body .card.po-header[style],
  :root[data-theme="dark"] .patient-fullview__body .card.po-card,
  :root[data-theme="dark"] .patient-fullview__body .card.po-card[style],
  :root[data-theme="dark"] .patient-fullview__body .card.po-quick-stats,
  :root[data-theme="dark"] .patient-fullview__body .card.po-quick-stats[style],
  :root[data-theme="dark"] .patient-fullview__body .po-rail .card {
    box-shadow:
      var(--lg-inset-hi-soft),
      0 1px 2px rgba(0, 0, 0, 0.4),
      0 8px 20px rgba(0, 0, 0, 0.42),
      0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent),
      0 0 20px color-mix(in srgb, var(--rx-accent-bright) 14%, transparent) !important;
  }
}

/* =====================================================   END · PATIENT FULL-VIEW CYAN GLOW + RHYTHM PASS
   ============================================================ */


/* =====================================================================   STACK-CARD TRANSFER PATTERN — 2026-05-25
   ----------------------------------------------------------------------------
   Captain spec: add a 5th action ("Transfer") to every Stack card so a card
   can be re-routed to another staffer with an audit-line recording who and
   why. Three pieces live here:
     1. .stack-card__btn--transfer  — the 5th action button itself
     2. .stack-card__audit          — the audit-trail strip that appears
                                      under card-subject when a transfer
                                      has happened (load OR live)
     3. .stack-transfer__*          — the picker grid inside the modal
   Built on the existing reception-modal__* shell + cyan-glass tokens — no
   new theme vars introduced.
   Author: Niki, 2026-05-25.
   ============================================================================ */

/* --- 1. The 5th action button: Transfer ----------------------------------- */
.stack-card__btn--transfer {
  /* Sits at the right edge of the action row by virtue of being last in DOM.
     Subtle cyan tint distinguishes it from edit/reject/hold without competing
     with the primary gradient. */
  background: color-mix(in srgb, var(--rx-accent-bright) 6%, var(--rx-glass-fill));
  border-color: color-mix(in srgb, var(--rx-accent) 26%, transparent);
  color: var(--rx-accent-text);
  margin-left: auto; /* push to the right of the action footer */
}
.stack-card__btn--transfer:hover {
  background: color-mix(in srgb, var(--rx-accent-bright) 12%, var(--rx-glass-fill));
  border-color: var(--rx-accent);
  color: var(--rx-accent-text);
}
.stack-card__btn--transfer:focus-visible {
  outline: 2px solid var(--rx-accent-vivid);
  outline-offset: 2px;
}
.stack-card__btn--transfer svg {
  color: var(--rx-accent-text);
}

/* When the card has already been transferred (or has audit history), the
   primary action goes informational — still clickable, just visually de-
   emphasised so the user notices the audit-line first. */
.stack-card__btn--dim {
  filter: saturate(0.55) brightness(0.97);
  opacity: 0.78;
}

/* When the card has just been transferred (this session), fade the whole
   card — Captain wants a clear "you sent this away" signal. */
.stack-card--transferred {
  opacity: 0.35;
  transition: opacity var(--rx-dur-mid) var(--rx-ease);
}
.stack-card--transferred:hover,
.stack-card--transferred:focus-within {
  opacity: 0.55;
}

/* --- 2. The audit-trail strip on the card -------------------------------- */
.stack-card__audit {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: var(--rx-s2) 0 var(--rx-s1);
}
.stack-card__audit-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px 7px 9px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--rx-accent-bright) 6%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-left: 2px solid var(--rx-accent-vivid);
  font-size: 12px;
  line-height: 1.45;
  color: var(--rx-text-strong);
}
.stack-card__audit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-accent-bright) 14%, transparent);
  color: var(--rx-accent-text);
  margin-top: 1px;
}
.stack-card__audit-text { flex: 1; min-width: 0; }
.stack-card__audit-text strong {
  font-weight: 600;
  color: var(--rx-accent-text);
}
.stack-card__audit-time {
  color: var(--rx-text-soft);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  white-space: nowrap;
}

/* Dark-theme tuning — the cyan tint sits richer on the dark surface */
:root[data-theme="dark"] .stack-card__audit-line {
  background: color-mix(in srgb, var(--rx-accent-bright) 9%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 30%, transparent);
  border-left-color: var(--rx-accent-bright);
}

/* --- 3. The transfer modal picker --------------------------------------- */
.stack-transfer-modal .reception-modal__card { max-width: 480px; }

.stack-transfer__pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.stack-transfer__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, var(--border-hi, rgba(0, 0, 0, 0.08)));
  color: var(--rx-text-strong);
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-mid) var(--rx-ease);
}
.stack-transfer__option:hover {
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 38%, transparent);
}
.stack-transfer__option:focus-visible {
  outline: 2px solid var(--rx-accent-vivid);
  outline-offset: 2px;
}
.stack-transfer__option:active { transform: scale(0.99); }
.stack-transfer__option--active {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-accent-vivid) 88%, transparent) 0%,
              color-mix(in srgb, var(--rx-accent) 92%, transparent) 100%);
  border-color: var(--rx-accent-text);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    0 4px 14px color-mix(in srgb, var(--rx-accent-bright) 26%, transparent);
}
.stack-transfer__option--active .stack-transfer__option-role { color: rgba(255, 255, 255, 0.86); }
.stack-transfer__option-name {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
}
.stack-transfer__option-role {
  font-size: 11.5px;
  color: var(--rx-text-soft);
  letter-spacing: 0.01em;
}

.stack-transfer__hint-error {
  color: color-mix(in srgb, #c2410c 80%, var(--rx-text-strong));
  font-weight: 500;
}
:root[data-theme="dark"] .stack-transfer__hint-error {
  color: color-mix(in srgb, #fb923c 80%, var(--rx-text-strong));
}

/* Narrow-screen graceful fall-back: stack the picker into a single column */
@media (max-width: 480px) {
  .stack-transfer__pick { grid-template-columns: 1fr; }
}

/* Reduced motion — kill the fade transition on transferred cards */
@media (prefers-reduced-motion: reduce) {
  .stack-card--transferred { transition: none; }
  .stack-transfer__option,
  .stack-card__btn--transfer { transition: none !important; }
}

/* Touch targets — tablets at the front desk get 44px */
@media (pointer: coarse) {
  .stack-transfer__option { min-height: 56px; }
}

/* =====================================================   END · STACK-CARD TRANSFER PATTERN

/* =====================================================================   STACK-CARD ESCALATION PATTERN — 2026-05-25
   ----------------------------------------------------------------------------
   Captain spec (locked): a card that needs human judgement above the current
   owner's role is escalated UP the chain. Distinct from Transfer:
     * pre-filtered upward roles (Reception → TC/PM, TC → PM/Specialist, etc.)
     * optional Urgent priority — flips the destination Stack to red-flag tier
     * more emphatic visual treatment (amber rim blended into the cyan glass)
     * background-tint + pulsing dot signal "awaiting upstream action"

   Six pieces live here:
     1. .stack-card__btn--escalate         — the 6th action button
     2. .stack-card--escalated{,-urgent}   — amber-tinted card background
     3. .stack-card__escalation-pulse      — left-edge amber pulsing dot
     4. .stack-card__escalation-audit      — the audit-line strip (cousin of
                                             .stack-card__audit)
     5. .stack-escalate__pick / __option   — picker grid inside the modal
     6. .stack-escalate__chip              — Normal / Urgent priority chips

   Built on the existing reception-modal__* shell + cyan-glass tokens +
   --rx-warn (the amber warning hue). NO new theme vars introduced.
   Author: Niki, 2026-05-25.
   ============================================================================ */

/* --- 1. The 6th action button: Escalate ---------------------------------- */
.stack-card__btn--escalate {
  /* Sits LEFT of the Transfer button (Transfer has margin-left:auto pushing
     it to the far right; Escalate also takes margin-left:auto so it lands
     immediately before Transfer, giving the action row:
     [primary] [secondary] [tert] [quat] ......[Escalate][Transfer]). */
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--rx-warn, #d97706) 8%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 10%, var(--rx-glass-fill)) 100%);
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 32%, color-mix(in srgb, var(--rx-accent) 24%, transparent));
  color: var(--rx-accent-text);
  margin-left: auto;
}
.stack-card__btn--escalate:hover {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--rx-warn, #d97706) 14%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 16%, var(--rx-glass-fill)) 100%);
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 50%, var(--rx-accent));
  color: var(--rx-accent-text);
}
.stack-card__btn--escalate:focus-visible {
  outline: 2px solid var(--rx-warn, #d97706);
  outline-offset: 2px;
}
.stack-card__btn--escalate svg {
  color: color-mix(in srgb, var(--rx-warn, #d97706) 65%, var(--rx-accent-text));
}
/* Transfer sits AFTER Escalate now — kill its auto-margin so it doesn't
   push Escalate back to the left. It still ends up on the right because
   Escalate carries the auto-margin. */
.stack-card__btn--escalate + .stack-card__btn--transfer {
  margin-left: 0;
}

/* --- 2. The card background when an escalation is pending ---------------- */
.stack-card--escalated {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-warn, #d97706) 5%, var(--rx-glass-fill)) 0%,
              var(--rx-glass-fill) 65%) !important;
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 22%, var(--rx-card-border, rgba(0,0,0,0.08))) !important;
}
.stack-card--escalated-urgent {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-warn, #d97706) 11%, var(--rx-glass-fill)) 0%,
              color-mix(in srgb, var(--rx-warn, #d97706) 3%, var(--rx-glass-fill)) 70%) !important;
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 40%, transparent) !important;
}
:root[data-theme="dark"] .stack-card--escalated {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-warn, #d97706) 9%, var(--rx-glass-fill)) 0%,
              var(--rx-glass-fill) 65%) !important;
}
:root[data-theme="dark"] .stack-card--escalated-urgent {
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--rx-warn, #d97706) 16%, var(--rx-glass-fill)) 0%,
              color-mix(in srgb, var(--rx-warn, #d97706) 5%, var(--rx-glass-fill)) 70%) !important;
}

/* --- 3. The left-edge pulsing amber dot ---------------------------------- */
.stack-card__escalation-pulse {
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.stack-card__escalation-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--rx-warn, #d97706);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--rx-warn, #d97706) 60%, transparent);
  animation: stack-escalation-pulse 1.8s ease-in-out infinite;
}
@keyframes stack-escalation-pulse {
  0%   { box-shadow: 0 0 0 0   color-mix(in srgb, var(--rx-warn, #d97706) 55%, transparent); }
  60%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--rx-warn, #d97706) 0%,  transparent); }
  100% { box-shadow: 0 0 0 0   color-mix(in srgb, var(--rx-warn, #d97706) 0%,  transparent); }
}

/* --- 4. The escalation audit-trail strip --------------------------------- */
.stack-card__escalation-audit {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: var(--rx-s2) 0 var(--rx-s1);
}
.stack-card__escalation-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px 7px 9px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--rx-warn, #d97706) 7%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-warn, #d97706) 26%, transparent);
  border-left: 2px solid var(--rx-warn, #d97706);
  font-size: 12px;
  line-height: 1.45;
  color: var(--rx-text-strong);
}
.stack-card__escalation-line--urgent {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 14%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 42%, transparent);
  border-left-width: 3px;
}
.stack-card__escalation-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-warn, #d97706) 18%, transparent);
  color: color-mix(in srgb, var(--rx-warn, #d97706) 80%, var(--rx-text-strong));
  margin-top: 1px;
}
.stack-card__escalation-text { flex: 1; min-width: 0; }
.stack-card__escalation-text strong {
  font-weight: 600;
  color: color-mix(in srgb, var(--rx-warn, #d97706) 70%, var(--rx-text-strong));
}
.stack-card__escalation-urgent-tag {
  display: inline-block;
  margin: 0 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--rx-warn, #d97706);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
}
.stack-card__escalation-time {
  color: var(--rx-text-soft);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  white-space: nowrap;
}
:root[data-theme="dark"] .stack-card__escalation-line {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 11%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 36%, transparent);
}
:root[data-theme="dark"] .stack-card__escalation-line--urgent {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 20%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 56%, transparent);
}

/* --- 5. The escalation modal picker -------------------------------------- */
.stack-escalate-modal .reception-modal__card {
  max-width: 500px;
  /* Distinct amber-rim signal so users see this is NOT the transfer modal */
  box-shadow:
    0 18px 64px -16px color-mix(in srgb, var(--rx-warn, #d97706) 28%, transparent),
    0 2px 0 0 color-mix(in srgb, var(--rx-warn, #d97706) 18%, transparent) inset;
}
.stack-escalate__title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-warn, #d97706) 18%, transparent);
  color: color-mix(in srgb, var(--rx-warn, #d97706) 80%, var(--rx-text-strong));
  vertical-align: -3px;
}
.stack-escalate__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stack-escalate__label-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rx-accent-vivid);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--rx-accent-vivid) 50%, transparent);
  animation: stack-escalation-label-pulse 2.4s ease-in-out infinite;
}
@keyframes stack-escalation-label-pulse {
  0%   { box-shadow: 0 0 0 0   color-mix(in srgb, var(--rx-accent-vivid) 55%, transparent); }
  70%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--rx-accent-vivid) 0%,  transparent); }
  100% { box-shadow: 0 0 0 0   color-mix(in srgb, var(--rx-accent-vivid) 0%,  transparent); }
}

.stack-escalate__pick { margin-top: 4px; }
.stack-escalate__pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.stack-escalate__noop {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rx-glass-base);
  border: 1px dashed color-mix(in srgb, var(--rx-warn, #d97706) 30%, transparent);
  color: var(--rx-text-soft);
  font-size: 12.5px;
}
.stack-escalate__option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, var(--border-hi, rgba(0, 0, 0, 0.08)));
  color: var(--rx-text-strong);
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-mid) var(--rx-ease);
}
.stack-escalate__option:hover {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 5%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 32%, transparent);
}
.stack-escalate__option:focus-visible {
  outline: 2px solid var(--rx-warn, #d97706);
  outline-offset: 2px;
}
.stack-escalate__option:active { transform: scale(0.99); }
.stack-escalate__option--active {
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--rx-warn, #d97706) 70%, transparent) 0%,
              color-mix(in srgb, var(--rx-accent) 78%, transparent) 100%);
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 60%, var(--rx-accent-text));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.30),
    0 4px 14px color-mix(in srgb, var(--rx-warn, #d97706) 28%, transparent);
}
.stack-escalate__option--active .stack-escalate__option-role { color: rgba(255, 255, 255, 0.86); }
.stack-escalate__option-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-warn, #d97706) 18%, transparent);
  color: color-mix(in srgb, var(--rx-warn, #d97706) 75%, var(--rx-text-strong));
  margin-top: 1px;
}
.stack-escalate__option--active .stack-escalate__option-icon {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.stack-escalate__option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.stack-escalate__option-name {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
}
.stack-escalate__option-role {
  font-size: 11.5px;
  color: var(--rx-text-soft);
  letter-spacing: 0.01em;
}

/* --- 6. Priority chips: Normal / Urgent ---------------------------------- */
.stack-escalate__priority {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.stack-escalate__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  min-height: 32px;
  border-radius: 999px;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 16%, var(--border-hi, rgba(0,0,0,0.08)));
  color: var(--rx-text-strong);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    color var(--rx-dur-fast) var(--rx-ease),
    transform var(--rx-dur-fast) var(--rx-ease);
}
.stack-escalate__chip:hover {
  background: color-mix(in srgb, var(--rx-accent) 6%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 32%, transparent);
}
.stack-escalate__chip:focus-visible {
  outline: 2px solid var(--rx-accent-vivid);
  outline-offset: 2px;
}
.stack-escalate__chip:active { transform: scale(0.98); }
.stack-escalate__chip--active {
  background: color-mix(in srgb, var(--rx-accent) 22%, var(--rx-glass-base));
  border-color: var(--rx-accent);
  color: var(--rx-accent-text);
  font-weight: 600;
}
.stack-escalate__chip--urgent-base { color: color-mix(in srgb, var(--rx-warn, #d97706) 75%, var(--rx-text-strong)); }
.stack-escalate__chip--urgent-base:hover {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 8%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 38%, transparent);
}
.stack-escalate__chip--urgent-active {
  background: var(--rx-warn, #d97706);
  border-color: var(--rx-warn, #d97706);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--rx-warn, #d97706) 32%, transparent);
}
.stack-escalate__chip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rx-warn, #d97706);
}
.stack-escalate__chip--urgent-active .stack-escalate__chip-dot {
  background: #fff;
}
.stack-escalate__priority-hint {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--rx-text-soft);
}

/* --- Submit button — amber rim accent over cyan primary ----------------- */
.stack-escalate__submit {
  position: relative;
}
.stack-escalate__submit::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--rx-warn, #d97706) 45%, transparent);
  mix-blend-mode: screen;
}
:root[data-theme="dark"] .stack-escalate__submit::after {
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 60%, transparent);
}

.stack-escalate__hint-error {
  color: color-mix(in srgb, #c2410c 80%, var(--rx-text-strong));
  font-weight: 500;
}
:root[data-theme="dark"] .stack-escalate__hint-error {
  color: color-mix(in srgb, #fb923c 80%, var(--rx-text-strong));
}

/* Narrow-screen graceful fall-back */
@media (max-width: 480px) {
  .stack-escalate__pick-grid { grid-template-columns: 1fr; }
  .stack-escalate__priority { flex-direction: column; align-items: stretch; }
  .stack-escalate__priority-hint { padding: 2px 4px; }
}

/* Reduced motion — kill the pulses */
@media (prefers-reduced-motion: reduce) {
  .stack-card__escalation-pulse-dot,
  .stack-escalate__label-dot { animation: none !important; }
  .stack-escalate__option,
  .stack-escalate__chip,
  .stack-card__btn--escalate { transition: none !important; }
}

/* Touch targets — front-desk tablets get 44px */
@media (pointer: coarse) {
  .stack-escalate__option { min-height: 60px; }
  .stack-escalate__chip { min-height: 44px; padding: 8px 18px; }
}

/* =====================================================   END · STACK-CARD ESCALATION PATTERN  */

/* =====================================================   TEAM CHAT SLIDE-OUT — 2026-05-25
   =====================================================   Right-edge floating panel (~420px × 70vh) for internal staff chat.
   Mounted on Reception / Stack / Email demo-dental views via
   _partials/team_chat_slideover.html (gated on view_chrome_partial).
   Light + dark theme parity. Mobile ≤640px = full-screen sheet.
   ============================================================ */

/* ---- 1 · TOPBAR TRIGGER (lives in topbar.html) -------------- */
.team-chat-trigger {
  position: relative;
  z-index: 1200; /* sits above the chat scrim so the trigger remains clickable when the panel is open */
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.team-chat-trigger:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}
.team-chat-trigger:active { transform: scale(0.96); }
.team-chat-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.team-chat-trigger__icon { width: 18px; height: 18px; }
.team-chat-trigger__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #00D4FF);
  color: #00343f;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  border: 2px solid var(--bg, #fff);
  font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .team-chat-trigger__badge {
  border-color: var(--bg-card, #111113);
  color: #001a20;
}

/* ---- 2 · PANEL CONTAINER ------------------------------------ */
/* When closed, NO child element should intercept pointer events — even
   during the brief leave-transition window where x-show hasn't yet set
   display:none. Force pointer-events off until the panel is open. */
.team-chat[data-state="closed"] .team-chat__scrim,
.team-chat[data-state="closed"] .team-chat__panel { pointer-events: none !important; }
.team-chat[data-state="open"]   .team-chat__scrim,
.team-chat[data-state="open"]   .team-chat__panel { pointer-events: auto; }

.team-chat__scrim {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: transparent;
  /* Clicks here close the panel; no visible scrim — Slack-pane feel. */
}

.team-chat__panel {
  position: fixed;
  top: 84px;                  /* below topbar */
  right: 16px;
  bottom: 16px;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  background: var(--rx-glass-fill-hi, rgba(255, 255, 255, 0.96));
  border: 1px solid var(--rx-glass-edge, rgba(0, 153, 184, 0.22));
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 18px 48px rgba(15, 23, 42, 0.18),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 8%, transparent),
    0 0 28px color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 12%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  overflow: hidden;
  color: var(--text, #0f172a);
}
:root[data-theme="dark"] .team-chat__panel {
  background: var(--rx-glass-fill-hi, rgba(23, 23, 26, 0.96));
  border-color: color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 22%, transparent);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 18px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 16%, transparent),
    0 0 32px color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 18%, transparent);
}

/* Open / close transitions */
.team-chat__panel--enter,
.team-chat__panel--leave { transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.2s ease; }
.team-chat__panel--enter-from,
.team-chat__panel--leave-to   { transform: translateX(28px); opacity: 0; }
.team-chat__panel--enter-to,
.team-chat__panel--leave-from { transform: translateX(0);    opacity: 1; }

/* ---- 3 · HEAD ----------------------------------------------- */
.team-chat__head {
  flex-shrink: 0;
  padding: 12px 14px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 8%, transparent);
}
.team-chat__head-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-chat__title {
  flex: 1;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text, #0f172a);
}
.team-chat__back, .team-chat__close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim, #475569);
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
}
.team-chat__back:hover, .team-chat__close:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.team-chat__back:focus-visible, .team-chat__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.team-chat__back svg, .team-chat__close svg { width: 16px; height: 16px; }

.team-chat__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}
.team-chat__status[data-state="open"]         { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.6); }
.team-chat__status[data-state="connecting"]   { background: #f59e0b; }
.team-chat__status[data-state="reconnecting"] { background: #f59e0b; animation: tc-pulse 1.2s infinite; }
.team-chat__status[data-state="closed"]       { background: #ef4444; }

@keyframes tc-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Tabs */
.team-chat__tabs {
  margin-top: 8px;
  display: inline-flex;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.team-chat__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-dim, #475569);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.team-chat__tab:hover { color: var(--text, #0f172a); }
.team-chat__tab--active {
  background: var(--rx-glass-fill-hi, #fff);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
:root[data-theme="dark"] .team-chat__tab--active {
  background: rgba(0, 212, 255, 0.16);
  color: var(--accent);
}
.team-chat__tab-count {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  background: var(--accent);
  color: #00343f;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.team-chat__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 4 · BODY ----------------------------------------------- */
.team-chat__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.team-chat__list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.team-chat__rows {
  list-style: none;
  margin: 0;
  padding: 6px 6px 6px;
  overflow-y: auto;
  flex: 1;
}
.team-chat__rows li { margin: 0; }

.team-chat__loading,
.team-chat__empty {
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-dim, #475569);
  text-align: center;
}

.team-chat__row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  background: transparent;
  border: none;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--text, #0f172a);
  transition: background-color 0.12s;
  min-height: 56px;
}
.team-chat__row:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.team-chat__row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.team-chat__row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.team-chat__row-avatar--channel {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-family: 'Space Grotesk', Inter, sans-serif;
  font-size: 1.05rem;
}
.team-chat__row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.team-chat__row-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-chat__row--unread .team-chat__row-name { color: var(--text, #0f172a); }
.team-chat__row-preview {
  font-size: 0.78rem;
  color: var(--text-dim, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-chat__row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.team-chat__row-time {
  font-size: 0.7rem;
  color: var(--text-dim, #94a3b8);
  font-variant-numeric: tabular-nums;
}
.team-chat__row-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #00343f;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.team-chat__list-footer {
  border-top: 1px solid color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 8%, transparent);
  padding: 8px 10px;
}
.team-chat__new-dm {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.team-chat__new-dm:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
}
.team-chat__new-dm svg { width: 14px; height: 14px; }
.team-chat__new-dm:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 5 · ROSTER PICKER ------------------------------------- */
.team-chat__roster {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  gap: 8px;
}
.team-chat__roster-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--rx-glass-fill, rgba(255, 255, 255, 0.78));
  border: 1px solid var(--rx-glass-edge, rgba(0, 153, 184, 0.22));
  border-radius: 8px;
  color: inherit;
}
.team-chat__roster-search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

/* ---- 6 · THREAD VIEW (bubbles) ----------------------------- */
.team-chat__thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.team-chat__bubbles {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.team-chat__bubbles-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-dim, #475569);
  font-size: 0.85rem;
}
.team-chat__bubble {
  max-width: 78%;
  padding: 8px 12px 6px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}
.team-chat__bubble--in {
  align-self: flex-start;
  background: color-mix(in srgb, var(--text, #0f172a) 5%, var(--rx-glass-fill-hi, #fff));
  border: 1px solid color-mix(in srgb, var(--text, #0f172a) 6%, transparent);
  border-top-left-radius: 4px;
  color: var(--text, #0f172a);
}
:root[data-theme="dark"] .team-chat__bubble--in {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text, #e2e8f0);
}
.team-chat__bubble--out {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 18%, var(--rx-glass-fill-hi, #fff));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-top-right-radius: 4px;
  color: var(--text, #0f172a);
}
:root[data-theme="dark"] .team-chat__bubble--out {
  background: color-mix(in srgb, var(--accent) 22%, rgba(23, 23, 26, 0.9));
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text, #e2e8f0);
}
.team-chat__bubble--pending { opacity: 0.65; }
.team-chat__bubble--error {
  border-color: #ef4444;
  background: color-mix(in srgb, #ef4444 8%, transparent);
}
.team-chat__bubble--mention {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
.team-chat__bubble-meta {
  margin-bottom: 2px;
}
.team-chat__bubble-sender {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.team-chat__bubble-body {
  white-space: pre-wrap;
}
.team-chat__bubble-body strong { font-weight: 700; }
.team-chat__bubble-body em { font-style: italic; }
.team-chat__mention {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 0 4px;
  border-radius: 4px;
}
.team-chat__bubble-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 3px;
}
.team-chat__bubble-time {
  font-size: 0.65rem;
  color: var(--text-dim, #94a3b8);
  font-variant-numeric: tabular-nums;
}
.team-chat__bubble-state {
  font-size: 0.65rem;
  color: var(--text-dim, #94a3b8);
  font-style: italic;
}
.team-chat__bubble-state--error { color: #ef4444; font-style: normal; }

.team-chat__voice { margin-top: 6px; }
.team-chat__voice audio { width: 100%; height: 32px; }

/* ---- 7 · TYPING --------------------------------------------- */
.team-chat__typing {
  padding: 0 14px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
}
.team-chat__typing-dots { display: inline-flex; gap: 2px; }
.team-chat__typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: tc-typing 1s infinite;
}
.team-chat__typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.team-chat__typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tc-typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-2px); }
}

/* ---- 8 · COMPOSE -------------------------------------------- */
.team-chat__compose {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: end;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid color-mix(in srgb, var(--rx-accent-bright, #00D4FF) 8%, transparent);
  background: var(--rx-glass-fill-hi, rgba(255, 255, 255, 0.96));
}
:root[data-theme="dark"] .team-chat__compose {
  background: rgba(15, 15, 17, 0.7);
}
.team-chat__input {
  resize: none;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 12px;
  font-size: 0.86rem;
  line-height: 1.4;
  font-family: inherit;
  background: var(--rx-glass-fill, rgba(255, 255, 255, 0.78));
  border: 1px solid var(--rx-glass-edge, rgba(0, 153, 184, 0.22));
  border-radius: 18px;
  color: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.team-chat__input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.team-chat__mic, .team-chat__send {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--rx-glass-edge, rgba(0, 153, 184, 0.22));
  border-radius: 50%;
  color: var(--text-dim, #64748b);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.team-chat__mic:hover, .team-chat__send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  border-color: var(--accent);
}
.team-chat__send {
  background: var(--accent);
  color: #00343f;
  border-color: var(--accent);
}
.team-chat__send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  color: #00343f;
}
.team-chat__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.team-chat__mic--recording {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  animation: tc-pulse 1s infinite;
}
.team-chat__mic svg, .team-chat__send svg { width: 16px; height: 16px; }
.team-chat__mic:focus-visible, .team-chat__send:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- 9 · MENTION PICKER ------------------------------------ */
.team-chat__mentions {
  position: absolute;
  bottom: 64px;
  left: 10px;
  right: 10px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--rx-glass-fill-hi, rgba(255, 255, 255, 0.98));
  border: 1px solid var(--rx-glass-edge, rgba(0, 153, 184, 0.32));
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  padding: 4px;
  z-index: 2;
}
:root[data-theme="dark"] .team-chat__mentions {
  background: rgba(20, 20, 22, 0.98);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.team-chat__mentions-empty {
  padding: 8px;
  font-size: 0.78rem;
  color: var(--text-dim, #64748b);
}
.team-chat__mentions-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.team-chat__mentions-row:hover,
.team-chat__mentions-row--active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.team-chat__mentions-kind {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.team-chat__mentions-kind[data-kind="patient"] {
  background: color-mix(in srgb, #f59e0b 22%, transparent);
  color: #b45309;
}
:root[data-theme="dark"] .team-chat__mentions-kind[data-kind="patient"] { color: #fbbf24; }
.team-chat__mentions-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
}
.team-chat__mentions-detail {
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
}

/* ---- 10 · MOBILE (≤640px) — full-screen sheet --------------- */
@media (max-width: 640px) {
  .team-chat__panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .team-chat__panel--enter-from,
  .team-chat__panel--leave-to {
    transform: translateY(20px);
  }
  .team-chat__bubble { max-width: 86%; }
}

/* ---- 11 · REDUCED MOTION ------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .team-chat__panel--enter,
  .team-chat__panel--leave,
  .team-chat__scrim,
  .team-chat__mic--recording,
  .team-chat__status,
  .team-chat__typing-dots span {
    transition: none !important;
    animation: none !important;
  }
}

/* =====================================================   END · TEAM CHAT SLIDE-OUT
   ============================================================ */


/* ============================================================
   MOBILE PATIENT SEARCH — restores in-view patient search on
   ≤768px viewports after the audit-bugfix-2026-05-25 commit hid
   .topbar__view-chrome. Two affordances ship together:

     1. .topbar__search-trigger   — magnifier icon in the topbar
                                    right cluster (sibling of the
                                    theme toggle / team-chat
                                    trigger). Phone-only. Opens
                                    the full-screen sheet.
     2. .mobile-patient-search    — full-screen sheet, slides in
                                    from the top, auto-focuses
                                    its input. Re-uses the V4
                                    cyan-glass surface tokens.
     3. .topbar__drawer-search    — same search dropped INTO the
                                    burger drawer for redundancy
                                    when the user is already in
                                    the nav drawer.

   All three render display:none above 768px so the desktop chrome
   (.topbar__view-chrome) is completely untouched.

   Added 2026-05-25 — niki/mobile-patient-search-2026-05-25.
   ============================================================ */

/* ---- 1 · TOPBAR TRIGGER (magnifier icon) ------------------- */
.topbar__search-trigger {
  display: none; /* phone-only — see media query below */
  position: relative;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-hi, var(--border));
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.topbar__search-trigger:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}
.topbar__search-trigger:active { transform: scale(0.96); }
.topbar__search-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.topbar__search-trigger__icon { width: 18px; height: 18px; }

/* ---- 2 · FULL-SCREEN SHEET --------------------------------- */
/* When closed, no descendant intercepts pointer events even during
   the brief leave-transition before x-show resolves display:none. */
.mobile-patient-search[data-state="closed"] .mobile-patient-search__scrim,
.mobile-patient-search[data-state="closed"] .mobile-patient-search__sheet { pointer-events: none !important; }
.mobile-patient-search[data-state="open"] .mobile-patient-search__scrim,
.mobile-patient-search[data-state="open"] .mobile-patient-search__sheet { pointer-events: auto; }

.mobile-patient-search { display: none; } /* desktop default */

.mobile-patient-search__scrim {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 14, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1090;
}
.mobile-patient-search__scrim--enter,
.mobile-patient-search__scrim--leave { transition: opacity 200ms ease; }
.mobile-patient-search__scrim--enter-from,
.mobile-patient-search__scrim--leave-to { opacity: 0; }
.mobile-patient-search__scrim--enter-to,
.mobile-patient-search__scrim--leave-from { opacity: 1; }

.mobile-patient-search__sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Sheet covers the viewport down to a soft bottom edge so the
     keyboard appears below the input. dvh handles iOS Safari URL bar. */
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--rx-glass-fill-hi, rgba(255, 255, 255, 0.96));
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--rx-rim, var(--border));
  box-shadow: 0 18px 48px rgba(0, 60, 80, 0.18);
  z-index: 1100;
}
.mobile-patient-search__sheet--enter,
.mobile-patient-search__sheet--leave {
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 260ms ease;
}
.mobile-patient-search__sheet--enter-from,
.mobile-patient-search__sheet--leave-to {
  transform: translateY(-16px);
  opacity: 0;
}
.mobile-patient-search__sheet--enter-to,
.mobile-patient-search__sheet--leave-from {
  transform: translateY(0);
  opacity: 1;
}

.mobile-patient-search__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-top));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid color-mix(in srgb, var(--rx-accent, var(--accent)) 12%, transparent);
}

.mobile-patient-search__close {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--rx-rim, var(--border));
  border-radius: 50%;
  color: var(--rx-text-strong, var(--text));
  cursor: pointer;
}
.mobile-patient-search__close:hover {
  background: color-mix(in srgb, var(--rx-accent, var(--accent)) 8%, transparent);
  border-color: var(--rx-accent-vivid, var(--accent));
  color: var(--rx-accent-vivid, var(--accent));
}
.mobile-patient-search__close:focus-visible {
  outline: 2px solid var(--rx-accent-vivid, var(--accent));
  outline-offset: 2px;
}

.mobile-patient-search__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.mobile-patient-search__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--rx-text-soft, var(--text-muted, #9ca3af));
  pointer-events: none;
}
.mobile-patient-search__icon svg { width: 100%; height: 100%; }

.mobile-patient-search__input {
  width: 100%;
  /* Min 44px tall (Apple HIG) + 16px font-size (prevents iOS auto-zoom). */
  padding: 12px 42px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--rx-rim, var(--border));
  background: var(--rx-glass-fill, color-mix(in srgb, white 85%, transparent));
  font-family: var(--font-body, "Inter");
  font-size: 16px;
  color: var(--rx-text-strong, var(--text));
  outline: none;
  transition: border-color 150ms ease, box-shadow 200ms ease, background 150ms ease;
}
.mobile-patient-search__input::placeholder { color: var(--rx-text-soft, var(--text-muted)); }
.mobile-patient-search__input:focus {
  background: var(--rx-glass-fill-hi, white);
  border-color: var(--rx-accent-vivid, var(--accent));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright, var(--accent)) 18%, transparent),
    0 0 16px color-mix(in srgb, var(--rx-accent-bright, var(--accent)) 18%, transparent);
}
/* Hide native iOS/WebKit search clear/cancel buttons — we render our own. */
.mobile-patient-search__input::-webkit-search-cancel-button,
.mobile-patient-search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.mobile-patient-search__clear {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--rx-text-soft, #94a3b8) 18%, transparent);
  border: none;
  color: var(--rx-text-strong, var(--text));
  cursor: pointer;
}
.mobile-patient-search__clear:focus-visible {
  outline: 2px solid var(--rx-accent-vivid, var(--accent));
  outline-offset: 2px;
}

.mobile-patient-search__results-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-patient-search__results {
  list-style: none;
  margin: 0;
  padding: 6px;
}
.mobile-patient-search__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--rx-text-strong, var(--text));
  min-height: 52px; /* easy thumb target */
}
.mobile-patient-search__row[aria-selected="true"],
.mobile-patient-search__row:hover,
.mobile-patient-search__row:focus-visible {
  background: color-mix(in srgb, var(--rx-accent, var(--accent)) 10%, transparent);
  outline: none;
}
.mobile-patient-search__row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--rx-accent-vivid, var(--accent));
}
.mobile-patient-search__row-name {
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--rx-text-strong, var(--text));
}
.mobile-patient-search__row-phone {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--rx-text-soft, var(--text-dim));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mobile-patient-search__hint,
.mobile-patient-search__empty {
  padding: 18px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--rx-text-soft, var(--text-dim));
  text-align: center;
}

/* ---- 3 · BURGER-DRAWER SEARCH ROW -------------------------- */
.topbar__drawer-search {
  position: relative;
  padding: 0 12px;
  margin-bottom: 6px;
}
.topbar__drawer-search__field { position: relative; }
.topbar__drawer-search__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted, #9ca3af);
  pointer-events: none;
}
.topbar__drawer-search__icon svg { width: 100%; height: 100%; }
.topbar__drawer-search__input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  font-family: var(--font-body, "Inter");
  font-size: 16px; /* prevent iOS auto-zoom */
  color: var(--text);
  outline: none;
}
.topbar__drawer-search__input::placeholder { color: var(--text-dim); }
.topbar__drawer-search__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.topbar__drawer-search__results {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  border-radius: 12px;
}
.topbar__drawer-search__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  min-height: 48px;
}
.topbar__drawer-search__row[aria-selected="true"],
.topbar__drawer-search__row:hover,
.topbar__drawer-search__row:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  outline: none;
}
.topbar__drawer-search__name {
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 15px;
}
.topbar__drawer-search__phone {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.topbar__drawer-search__empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* ---- 4 · DARK MODE PARITY ---------------------------------- */
:root[data-theme="dark"] .mobile-patient-search__sheet {
  background: color-mix(in srgb, var(--bg-card, #111113) 92%, transparent);
  border-bottom-color: color-mix(in srgb, var(--accent) 22%, transparent);
}
:root[data-theme="dark"] .mobile-patient-search__bar {
  border-bottom-color: color-mix(in srgb, var(--accent) 24%, transparent);
}
:root[data-theme="dark"] .mobile-patient-search__input {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}
:root[data-theme="dark"] .mobile-patient-search__input::placeholder { color: var(--text-dim); }
:root[data-theme="dark"] .mobile-patient-search__close {
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}
:root[data-theme="dark"] .mobile-patient-search__row {
  color: var(--text);
}
:root[data-theme="dark"] .mobile-patient-search__row[aria-selected="true"],
:root[data-theme="dark"] .mobile-patient-search__row:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
:root[data-theme="dark"] .topbar__search-trigger {
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text-dim);
}

/* ---- 5 · PHONE-ONLY GATE ----------------------------------- */
@media (max-width: 768px) {
  .topbar__search-trigger { display: inline-flex; }
  .mobile-patient-search { display: block; }
}

/* ---- 6 · REDUCED MOTION ------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .mobile-patient-search__sheet--enter,
  .mobile-patient-search__sheet--leave,
  .mobile-patient-search__scrim--enter,
  .mobile-patient-search__scrim--leave {
    transition: none !important;
  }
}

/* =====================================================   END · MOBILE PATIENT SEARCH
   ============================================================ */


/* =====================================================   SUPER-ADMIN "VIEW AS" MINI-PILL
   Captain-only QA badge in the topbar — renders only when
   ``is_super_admin=True`` lands in the template context (the surrounding
   block is omitted server-side for everyone else, so this CSS purely
   styles the existing element when present).
   Cyan-glass like the .view-pill but visually quieter (smaller, lower-
   contrast border) so it reads as Niki-internal, not staff-facing.
   Locked 2026-05-25 — Captain.
   ============================================================ */
.view-as-pill { position: relative; display: inline-flex; }

.view-as-pill__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  height: 28px;
  border-radius: 999px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent) 7%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent) 12%, transparent) 100%);
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 38%, transparent);
  color: var(--rx-accent-text);
  font-family: var(--font-display, "Space Grotesk", "Inter");
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  transition:
    background var(--rx-dur-fast) var(--rx-ease),
    border-color var(--rx-dur-fast) var(--rx-ease),
    box-shadow var(--rx-dur-fast) var(--rx-ease);
}
.view-as-pill__btn:hover {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent) 11%, transparent) 0%,
      color-mix(in srgb, var(--rx-accent) 18%, transparent) 100%);
  border-color: color-mix(in srgb, var(--rx-accent) 55%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--rx-glow) 55%, transparent);
}
.view-as-pill__btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 35%, transparent),
    0 0 0 1px var(--rx-accent-text);
}
.view-as-pill__icon { display: inline-flex; opacity: 0.88; }
.view-as-pill__icon svg { width: 13px; height: 13px; }
.view-as-pill__label {
  opacity: 0.78;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10.5px;
}
.view-as-pill__role { font-weight: 700; }
.view-as-pill__chev {
  display: inline-flex; opacity: 0.6;
  transition: transform var(--rx-dur-mid) var(--rx-ease);
}
.view-as-pill[data-open="true"] .view-as-pill__chev { transform: rotate(180deg); opacity: 0.9; }

/* Active-override dot — bright cyan, top-right, signals "an override is on" */
.view-as-pill__dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rx-accent-bright);
  box-shadow: 0 0 6px color-mix(in srgb, var(--rx-accent-bright) 80%, transparent);
}

.view-as-pill__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--rx-glass-base);
  border: 1px solid color-mix(in srgb, var(--rx-accent) 22%, transparent);
  border-radius: 14px;
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.12),
    0 0 0 1px color-mix(in srgb, var(--rx-accent) 4%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  z-index: 1100;
  font-family: var(--font-display, "Space Grotesk", "Inter");
}
.view-as-pill__section {
  padding: 6px 10px 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.55;
  color: var(--rx-accent-text);
}
.view-as-pill__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--rx-text);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--rx-dur-fast) var(--rx-ease), color var(--rx-dur-fast) var(--rx-ease);
}
.view-as-pill__item:hover,
.view-as-pill__item:focus-visible {
  background: color-mix(in srgb, var(--rx-accent) 10%, transparent);
  color: var(--rx-accent-text);
  outline: none;
}
.view-as-pill__item--active {
  background: color-mix(in srgb, var(--rx-accent) 14%, transparent);
  color: var(--rx-accent-text);
}
.view-as-pill__item-state {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}
.view-as-pill__divider {
  height: 1px;
  margin: 4px 4px;
  background: color-mix(in srgb, var(--rx-accent) 14%, transparent);
}
.view-as-pill__item--reset { font-style: italic; opacity: 0.92; }

/* Dark-theme parity — the rx-glass-base + rx-accent variables already
   flip with the theme, but the dashed border softens further in dark mode
   so the QA badge stays "quiet" against the deeper background. */
:root[data-theme="dark"] .view-as-pill__btn {
  border-color: color-mix(in srgb, var(--rx-accent) 28%, transparent);
}
:root[data-theme="dark"] .view-as-pill__menu {
  background: color-mix(in srgb, var(--rx-glass-base) 92%, transparent);
}

/* Reduced motion — drop transitions on chev + open animation */
@media (prefers-reduced-motion: reduce) {
  .view-as-pill__chev { transition: none; }
  .view-as-pill__btn { transition: none; }
}
/* =====================================================   END · SUPER-ADMIN "VIEW AS" MINI-PILL
   ============================================================ */

/* === Quickstats — body variant (moved out of topbar 2026-05-26) ===
   Renders as a wide glass strip just above the main grid; chips spread
   across the row instead of clustered top-right. Captain locked the
   move to neaten the chrome. */
.reception-quickstats--body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-around;
  gap: var(--rx-s3);
  padding: 14px 22px;
  margin-bottom: var(--rx-s4);
  border-radius: var(--radius-card, 24px);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent-bright) 6%, var(--rx-glass-base, var(--bg-card, #fff))) 0%,
      var(--rx-glass-base, var(--bg-card, #fff)) 100%);
  border: 1px solid var(--rx-glass-edge, var(--border, #e5e5e8));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 0 0 1px color-mix(in srgb, var(--rx-accent-bright) 6%, transparent),
    0 0 24px color-mix(in srgb, var(--rx-accent-bright) 12%, transparent);
}
.reception-quickstats--body .reception-quickstats__stat {
  flex: 1 1 0;
  justify-content: center;
  padding: 10px 14px;
  font-size: 14px;
}
.reception-quickstats--body .reception-quickstats__val {
  font-size: 22px;
  font-weight: 700;
}
@media (max-width: 640px) {
  .reception-quickstats--body {
    padding: 10px 14px;
    gap: var(--rx-s2);
  }
  .reception-quickstats--body .reception-quickstats__stat {
    flex: 1 1 calc(50% - var(--rx-s2));
    padding: 8px 10px;
  }
}

/* === Timeline head 2026-05-26 — 3-cell layout (toggle · stats · nav) ===
   Captain locked: stats live INSIDE the header, not in a separate strip.
   Left: Day/Week toggle (segmented pill). Center: quick-stats inline.
   Right: existing week nav. ============================================ */
.reception-timeline__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--rx-s3);
  padding-bottom: var(--rx-s3);
  border-bottom: 1px solid var(--rx-glass-edge, var(--border, #e5e5e8));
}

/* Day / Week segmented toggle */
.reception-timeline__scope {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--rx-glass-fill-soft);
  border: 1px solid var(--rx-glass-edge);
}
.reception-timeline__scope-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--rx-text-soft);
  cursor: pointer;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              color var(--rx-dur-fast) var(--rx-ease);
}
.reception-timeline__scope-btn:hover {
  color: var(--rx-accent-text);
  background: color-mix(in srgb, var(--rx-accent) 8%, transparent);
}
.reception-timeline__scope-btn--active {
  color: var(--rx-accent-text);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--rx-accent) 14%, var(--rx-glass-base)) 0%,
      color-mix(in srgb, var(--rx-accent-bright) 22%, var(--rx-glass-base)) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 2px color-mix(in srgb, var(--rx-accent) 14%, transparent);
}

/* Quick-stats inline — middle cell of the head */
.reception-quickstats--inline {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--rx-s2);
}
.reception-quickstats--inline .reception-quickstats__stat {
  padding: 5px 11px;
  font-size: 12.5px;
}
.reception-quickstats--inline .reception-quickstats__val {
  font-size: 14px;
  font-weight: 700;
}

/* Mobile: stack the head's 3 cells vertically */
@media (max-width: 880px) {
  .reception-timeline__head {
    grid-template-columns: 1fr;
    row-gap: var(--rx-s2);
  }
  .reception-timeline__scope,
  .reception-timeline__nav {
    justify-self: center;
  }
  .reception-quickstats--inline {
    justify-content: space-around;
  }
}

/* =============================================================
   APPOINTMENT SLIDE-OUT PANEL — block-click target on the Reception
   calendar. Lives inside the same #patient-slideout drawer container
   as the patient profile — the appointment panel renders WHY a
   booking is red/yellow + Niki's recommended fix per blocker.

   Visual: V4 cyan-glass — reuses the existing slide-out base
   (.reception-slideout__*) and the readiness colour tokens defined
   alongside .cal__block--ready-* in calendar-v1.css (--rx-danger /
   --rx-warn / --rx-ok).

   Added 2026-05-26 by Niki.
   ============================================================ */

.reception-apt-slideout__head {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  position: relative;
}

.reception-apt-slideout__head {
  /* Close button sits in the top-right despite the column layout. */
}

.reception-apt-slideout__head .reception-modal__close {
  position: absolute;
  top: 14px;
  right: 18px;
}

.reception-apt-slideout__head-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 32px; /* keep clear of the close button */
}

.reception-apt-slideout__pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Readiness pill — reuses the calendar colour tokens.
   Two class aliases (reception-apt-pill + readiness-pill) so smoke
   tests / future selectors can target either name. */
.reception-apt-pill,
.readiness-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  color: var(--rx-text-strong);
}
.reception-apt-pill--red,
.readiness-pill--red {
  background: color-mix(in srgb, var(--rx-danger, #dc2626) 14%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-danger, #dc2626) 40%, transparent);
  color: color-mix(in srgb, var(--rx-danger, #dc2626) 60%, var(--rx-text-strong));
}
.reception-apt-pill--yellow,
.readiness-pill--yellow {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 12%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 36%, transparent);
  color: color-mix(in srgb, var(--rx-warn, #d97706) 55%, var(--rx-text-strong));
}
.reception-apt-pill--green,
.readiness-pill--green {
  background: color-mix(in srgb, var(--rx-ok, #16a34a) 12%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-ok, #16a34a) 36%, transparent);
  color: color-mix(in srgb, var(--rx-ok, #16a34a) 55%, var(--rx-text-strong));
}
.reception-apt-pill--neutral,
.readiness-pill--neutral {
  background: color-mix(in srgb, var(--rx-accent) 8%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-text-soft);
}

.reception-apt-slideout__chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  background: color-mix(in srgb, var(--rx-accent) 8%, transparent);
  color: var(--rx-accent-text, var(--rx-text-strong));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 18%, transparent);
}

.reception-apt-slideout__name {
  font-size: 19px;
  margin-top: 2px;
}

.reception-apt-slideout__meta {
  font-size: 12px;
}

.reception-apt-slideout {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.reception-apt-slideout__head {
  flex: 0 0 auto;
}
.reception-apt-slideout__body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
.reception-apt-slideout__actions {
  flex: 0 0 auto;
}

.reception-apt-slideout__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reception-apt-slideout__section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--rx-text-strong);
  margin: 0;
  padding: 0;
}

.reception-apt-slideout__section-head svg {
  color: var(--rx-accent);
}

.reception-apt-slideout__none {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--rx-ok, #16a34a) 6%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-ok, #16a34a) 22%, transparent);
  color: color-mix(in srgb, var(--rx-ok, #16a34a) 55%, var(--rx-text-strong));
  font-size: 12.5px;
}
.reception-apt-slideout__none svg {
  flex: 0 0 auto;
}

.reception-apt-slideout__blockers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reception-apt-blocker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--rx-warn, #d97706) 4%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-warn, #d97706) 22%, transparent);
}

.reception-apt-blocker--open {
  /* Already wears the warn tint above; the head dot pulses subtly. */
}

.reception-apt-blocker--resolved {
  background: color-mix(in srgb, var(--rx-ok, #16a34a) 5%, var(--rx-glass-base));
  border-color: color-mix(in srgb, var(--rx-ok, #16a34a) 22%, transparent);
  opacity: 0.85;
}
.reception-apt-blocker--resolved .reception-apt-blocker__label {
  text-decoration: line-through;
  color: var(--rx-text-soft);
}
.reception-apt-blocker--resolved .reception-apt-blocker__head svg {
  color: var(--rx-ok, #16a34a);
}

.reception-apt-blocker__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reception-apt-blocker__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rx-warn, #d97706);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-warn, #d97706) 22%, transparent);
}

.reception-apt-blocker__label {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rx-text-strong);
}

.reception-apt-blocker__rec {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rx-accent) 5%, var(--rx-glass-fill-hi, transparent));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reception-apt-blocker__rec-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reception-apt-blocker__rec-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rx-accent) 16%, transparent);
  color: var(--rx-accent-text, var(--rx-text-strong));
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.reception-apt-blocker__rec-source {
  font-size: 10.5px;
  color: var(--rx-text-soft);
}
.reception-apt-blocker__rec-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--rx-text-strong);
}

.reception-apt-blocker__actions {
  display: flex;
  justify-content: flex-end;
}

.reception-apt-blocker__resolve {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--rx-ok, #16a34a) 30%, transparent);
  background: color-mix(in srgb, var(--rx-ok, #16a34a) 10%, transparent);
  color: color-mix(in srgb, var(--rx-ok, #16a34a) 55%, var(--rx-text-strong));
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--rx-dur-fast) var(--rx-ease),
              border-color var(--rx-dur-fast) var(--rx-ease);
}
.reception-apt-blocker__resolve:hover {
  background: color-mix(in srgb, var(--rx-ok, #16a34a) 18%, transparent);
  border-color: color-mix(in srgb, var(--rx-ok, #16a34a) 45%, transparent);
}
.reception-apt-blocker__resolve:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-ok, #16a34a) 28%, transparent);
}

.reception-apt-slideout__resolved-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed color-mix(in srgb, var(--rx-accent) 18%, transparent);
  background: transparent;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--rx-text-soft);
  cursor: pointer;
}
.reception-apt-slideout__resolved-toggle:hover {
  background: color-mix(in srgb, var(--rx-accent) 5%, transparent);
  color: var(--rx-accent-text);
}

.reception-apt-slideout__notes {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rx-accent) 4%, var(--rx-glass-base));
  border: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--rx-text-strong);
}

.reception-apt-slideout__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid color-mix(in srgb, var(--rx-accent) 12%, transparent);
  background: var(--rx-glass-fill-hi);
  position: sticky;
  bottom: 0;
}

.reception-apt-slideout__action-primary {
  appearance: none;
  border: none;
  background: var(--rx-accent);
  color: var(--rx-on-accent, #fff);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: filter var(--rx-dur-fast) var(--rx-ease);
}
.reception-apt-slideout__action-primary:hover {
  filter: brightness(1.05);
}
.reception-apt-slideout__action-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 30%, transparent);
}
.reception-apt-slideout__action-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reception-apt-slideout__action-secondary {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 24%, transparent);
  background: transparent;
  color: var(--rx-accent-text, var(--rx-text-strong));
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.reception-apt-slideout__action-secondary:hover {
  background: color-mix(in srgb, var(--rx-accent) 8%, transparent);
}
.reception-apt-slideout__action-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =====================================================
   TOAST CONTRAST FIX — 2026-05-26
   Captain reported white text on light bg. Diagnostic finding:
   .toast in components.css (specificity 0,0,1,0) sets bg=var(--bg-card)
   + color=var(--text); #toast in reception-v2.css (0,1,0,0) re-sets
   bg=var(--rx-toast-bg) + color=#fff. ID specificity SHOULD beat class,
   so the dark toast should already win. We re-assert at composite
   specificity (0,1,1,0 via #toast.toast) with !important guards purely
   as belt-and-braces so a future ui_config custom_css_overrides or
   tenant-theme tweak can't accidentally re-introduce the contrast bug.
   ============================================================ */
#toast,
#toast.toast {
  background: var(--rx-toast-bg, rgba(15, 23, 42, 0.94)) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* =====================================================
   STACK PILL — hints-strip sibling to Act-now — 2026-05-26
   Captain's spec: a 5-step colour ladder keyed on (count, urgent).
   Pill walks cyan → red as the count climbs toward the 10-task
   ceiling, but ANY urgent (red-tier) card pins the pill at the
   ``critical`` level regardless of count.

   Visually a peer to .reception-hints__action — same height + radius
   — but always-visible (unlike Act-now which fades in on hover), and
   tuned as STATUS, not CTA. Soft tints only; this is medical UI, not
   an alert banner.

   Levels: calm | low | mid | high | critical
   ============================================================ */
.reception-hints__stack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--rx-accent) 24%, transparent);
  background: color-mix(in srgb, var(--rx-accent) 12%, transparent);
  color: var(--rx-accent-text, var(--rx-text-strong));
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--rx-dur-fast) var(--rx-ease),
              background var(--rx-dur-fast) var(--rx-ease),
              color var(--rx-dur-fast) var(--rx-ease),
              transform var(--rx-dur-fast) var(--rx-ease);
}
.reception-hints__stack:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.reception-hints__stack:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rx-accent-bright) 28%, transparent);
}
.reception-hints__stack-icon {
  display: inline-flex;
  align-items: center;
  opacity: 0.9;
}
.reception-hints__stack-label {
  letter-spacing: 0.01em;
}
.reception-hints__stack-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 18%, transparent);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.reception-hints__stack-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  margin-left: 1px;
  animation: rx-stack-pulse-soft 1.6s ease-in-out infinite;
}
@keyframes rx-stack-pulse-soft {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .reception-hints__stack-dot { animation: none; opacity: 0.9; }
}

/* ---------- LEVEL MODIFIERS ----------
   calm  → pure cyan (the resting state)
   low   → cyan with a warm hint (count climbing but no urgency)
   mid   → amber (busy)
   high  → amber + redden the border (almost at the ceiling)
   critical → red (any urgent card OR count >= 10)
*/

/* calm — 0–2 tasks, no urgency */
.reception-hints__stack--level-calm {
  background: color-mix(in srgb, var(--rx-accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--rx-accent) 28%, transparent);
  color: var(--rx-accent-text, var(--rx-text-strong));
}

/* low — 3–4 tasks, still cool but tinted warm */
.reception-hints__stack--level-low {
  background: color-mix(in srgb,
              color-mix(in srgb, var(--rx-accent) 70%, var(--rx-warn, #d97706)) 12%,
              transparent);
  border-color: color-mix(in srgb, var(--rx-accent) 22%, transparent);
  color: var(--rx-accent-text, var(--rx-text-strong));
}

/* mid — 5–6 tasks, amber territory */
.reception-hints__stack--level-mid {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 12%, transparent);
  border-color: color-mix(in srgb, var(--rx-warn, #d97706) 32%, transparent);
  color: color-mix(in srgb, var(--rx-warn, #d97706) 60%, var(--rx-text-strong));
}

/* high — 7–9 tasks, amber bg + redden the border edge */
.reception-hints__stack--level-high {
  background: color-mix(in srgb, var(--rx-warn, #d97706) 18%, transparent);
  border-color: color-mix(in srgb,
              var(--rx-critical, var(--rx-danger, #dc2626)) 36%,
              transparent);
  color: color-mix(in srgb,
              var(--rx-critical, var(--rx-danger, #dc2626)) 55%,
              var(--rx-text-strong));
}

/* critical — any urgent card OR count >= 10 — red bg + red border + pulsing dot */
.reception-hints__stack--level-critical {
  background: color-mix(in srgb,
              var(--rx-critical, var(--rx-danger, #dc2626)) 18%, transparent);
  border-color: color-mix(in srgb,
              var(--rx-critical, var(--rx-danger, #dc2626)) 50%, transparent);
  color: color-mix(in srgb,
              var(--rx-critical, var(--rx-danger, #dc2626)) 65%,
              var(--rx-text-strong));
  font-weight: 700;
}
.reception-hints__stack--level-critical .reception-hints__stack-count {
  background: color-mix(in srgb,
              var(--rx-critical, var(--rx-danger, #dc2626)) 22%,
              transparent);
}

/* =====================================================
   APPOINTMENT SLIDEOUT FIT — 2026-05-26
   Captain reported the appointment slide-out's description page
   "does not fit on the screen". Diagnosis:

   The host chain was OK on paper —
     .reception-slideout       { position:fixed; inset:0; z-index:60 }
     .reception-slideout__panel{ position:absolute; top:0; right:0;
                                 bottom:0; width:min(420px,100%);
                                 display:flex; flex-direction:column }
   — but the panel had NO `overflow:hidden`. So when the swapped
   appointment partial (.reception-apt-slideout) carried long
   Niki-recommendation prose across two open blockers, the body's
   `flex:1 1 auto + overflow-y:auto` *should* have taken the surplus
   — but with no overflow clamp on the parent panel, any flex
   shrink edge-case (e.g. the sticky-actions row asserting its
   intrinsic min-content height + the head's padding) could push the
   contents past the panel's `bottom:0` line and visibly spill.

   Additionally, `bottom:0` alone is fragile on mobile/dynamic-vh
   browsers — when the URL bar collapses/expands the `bottom` line
   shifts and the action row can clip off-screen. `height:100vh` +
   `max-height:100dvh` is the belt-and-braces fix.

   The four required rules:
     1. Panel: explicit height + dynamic-vh cap + overflow:hidden so
        the body is the ONLY scroll route and actions can never be
        pushed off the visible area.
     2. Inner wrapper: ensure min-height:0 + flex sizing survives in
        case a future partial forgets the .reception-apt-slideout
        class chain.
     3. Body: overscroll-behavior:contain so scrolling the slide-out
        doesn't bubble to the page underneath.
     4. Slightly wider panel — 440px — so the Niki recommendation
        text has room to breathe (Captain's two-blocker case had
        ~50-character lines wrapping awkwardly).

   Acceptance:
     * Panel never exceeds viewport height regardless of content.
     * Body scrolls when content exceeds available space.
     * Head + Actions remain visible at all viewport heights.
     * Works on Day / Week / Month views (same slide-out).
   ============================================================ */
.reception-slideout__panel {
  /* belt-and-braces sizing: explicit viewport height + dynamic-vh
     cap. `top:0; bottom:0;` alone defines the panel height but
     dynamic-vh on mobile makes `bottom:0` jitter; this overrides. */
  height: 100vh;
  max-height: 100dvh;
  /* CRITICAL: clamp so the body's own `overflow-y:auto` is the only
     scroll route. Without this, long content can spill past the
     panel and push the action row off the visible viewport. */
  overflow: hidden;
  /* Slightly wider — gives the Niki recommendation text room to
     breathe at typical viewport widths. */
  width: min(440px, 100%);
}

/* Re-assert the inner-wrapper flex sizing here too, in case a future
   partial uses a different inner class. .reception-slideout__inner
   already sets these earlier in the file; this keeps the contract
   local to the fit-fix block. */
.reception-slideout__panel > .reception-slideout__inner,
.reception-slideout__panel > .reception-apt-slideout {
  height: 100%;
  min-height: 0;
}

.reception-apt-slideout__body {
  /* Don't bubble scroll to the page underneath — captain scrolling
     the slide-out body should never accidentally scroll the
     timeline behind. */
  overscroll-behavior: contain;
}

/* Narrow-viewport guardrail — on dev-tools-open / very short windows
   (<= 640px tall) trim head padding so the action row never gets
   pushed off-screen. */
@media (max-height: 640px) {
  .reception-slideout__head,
  .reception-apt-slideout__head {
    padding-top: 12px;
    padding-bottom: 10px;
  }
  .reception-apt-slideout__actions {
    padding-top: 10px;
    padding-bottom: 12px;
  }
}

/* =====================================================================
   A4 mail-classifier — red-priority banner (no draft)
   2026-05-30 · feedback hook: "red banner — colour / icon / escalation copy"
   ===================================================================== */
.email-msg-niki-red {
  align-self: flex-start;
  max-width: 88%;
  margin: 6px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, #c0392b 8%, var(--rx-glass-fill));
  border: 1.5px solid color-mix(in srgb, #c0392b 70%, transparent);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 0 0 1px color-mix(in srgb, #c0392b 25%, transparent);
  color: var(--rx-text);
}
.email-msg-niki-red__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.email-msg-niki-red__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: color-mix(in srgb, #c0392b 22%, transparent);
  color: #c0392b;
}
.email-msg-niki-red__label {
  font-weight: 700;
  font-size: 13px;
  color: color-mix(in srgb, #c0392b 88%, var(--rx-text));
  letter-spacing: 0.01em;
  flex: 1 1 auto;
}
.email-msg-niki-red__time {
  font-size: 11px;
  color: var(--rx-text-soft);
  font-variant-numeric: tabular-nums;
}
.email-msg-niki-red__reason {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--rx-text-soft);
  font-style: italic;
}

