/* 🚨 CARD 267 (B25) — THE LATE-APPOINTMENT TOAST LANDS ON TOP OF THE LOWEST CARD.
   📏 Measured by box intersection, not by eye: the *"Immediate action required"* toast renders at
   (1045, 876) at 1440×900 and covers the Staff Messages card and its body.
   ⭐ It is a SLOT COLLISION, not a spacing bug on one screen — sonner pins it bottom-right of the
   VIEWPORT, this board is `height: calc(100vh - 132px)` with `overflow: hidden`, and the right column
   therefore always reaches the bottom edge the toast occupies. It recurs on any receptionist screen with
   a full right column, so nudging one card's margin fixes nothing.
   ⇒ The board RESERVES the band instead. Because the layout does not scroll, padding-bottom genuinely
   shrinks the content rather than pushing it out of sight — the card's own second option, and the only
   one that works when there is nowhere to scroll to.
   ⚠️ `--ahr-late-toast-reserve` is set by the page from the number of late toasts it is actually
   showing, and is `0px` when there are none — so a board with no late appointments is unchanged. */
.akashic-receptionist-overview {
  height: calc(100vh - 132px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--ahr-late-toast-reserve, 0px);
}

/* The height one late toast occupies, INCLUDING the gap sonner puts between stacked toasts.
   📐 Derived from the toast's own box: 13px padding × 2 + a 32px icon row + a wrapped second line at
   12px/1.45, plus sonner's ~14px stack gap. ⚠️ It is deliberately a little generous — a small unused
   band is a far cheaper error than an overlap, which is the defect being fixed.
   🔗 If the toast's padding or type sizes change, this changes with them. The pairing is pinned by
   `receptionistLateToastSlot.test.ts` so the two cannot drift apart silently. */
:root {
  --ahr-late-toast-height: 88px;
}

.akashic-receptionist-overview .ahr-receptionist-overview__title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.akashic-receptionist-overview .ahr-receptionist-overview__subtitle {
  margin: 3px 0 0;
  opacity: 0.7;
}

.akashic-receptionist-overview .ahr-receptionist-overview__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.akashic-receptionist-overview .ahr-receptionist-overview__grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.62fr 1fr;
  gap: 12px;
  overflow: hidden;
}

/* ONE row: this column has one child. It was 1fr 0.5fr from when it had two, and the leftover
   track was reserving about a third of the height for nothing - which starved the queues column of the
   budget it measures, so the only populated queue was capped to a single visible row.
   Do not restore a second track for a child that might arrive later. */
.akashic-receptionist-overview .ahr-receptionist-overview__main-column {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.akashic-receptionist-overview .ahr-receptionist-overview__secondary-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  overflow: hidden;
}

.akashic-receptionist-overview .ahr-receptionist-overview__message-column {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  overflow: hidden;
}

.akashic-receptionist-overview .ahr-receptionist-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* WordPress <Card> wraps header/body in an intermediate View (styles.Content)
   that only sets height: 100% — no flex. Without this, the card body can't
   flex-fill the card, so it grows to its content height and the card's
   overflow: hidden clips the bottom rows and the scrollbar's bottom arrow.
   Reconnect the height chain by making that wrapper a flex column. */
.akashic-receptionist-overview .ahr-receptionist-card > div:first-child {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Card 132 — retargeted from `.components-card__header` / `__body` when the Card family moved to
   ui/wp-card. These two rules are the reason the Card sweep was not a pure import swap: they set
   deliberate 10px/12px padding that overrides the card's own size padding, and they would simply have
   STOPPED APPLYING the moment the WordPress markup went, with nothing to point at — the same shape as
   the `.components-button` rules that turned out to be the real work in AudioControls. */
/* ⚠️ THE ID PREFIX IS REQUIRED, and its absence would have been silent. wp-card's own padding rules
   in index.css are ID-scoped — `#akashic-health-records-patient-portal-root .wp-card--medium >
   .wp-card__header` scores (1,2,0) — and an ID beats ANY number of classes, so the previous
   class-only selector here (0,3,0) would have lost and this card would have quietly taken the
   standard 16px/24px padding instead of its compact 10px/12px. It worked under WordPress only
   because WP's emotion padding was class-level too. With the ID this scores (1,4,0) and wins. */
#akashic-health-records-patient-portal-root .akashic-receptionist-overview .ahr-receptionist-card .wp-card__header {
  flex: 0 0 auto;
  padding: 10px 12px;
}

#akashic-health-records-patient-portal-root .akashic-receptionist-overview .ahr-receptionist-card .wp-card__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 0;
}

.akashic-receptionist-overview .ahr-receptionist-card__header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 10px;
}

.akashic-receptionist-overview .ahr-receptionist-card__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.akashic-receptionist-overview .ahr-receptionist-scroll-area {
  /* Flex to fill the card body (instead of height: 100%, which resolved
     taller than the body and pushed the scrollbar's bottom past the card's
     overflow: hidden edge, clipping the last rows). */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* Reserve space for the scrollbar so it sits beside the rows instead of
     overlapping the right-edge status/action icons. Applies to every card. */
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.akashic-receptionist-overview .ahr-receptionist-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
}

.akashic-receptionist-overview .ahr-receptionist-row {
  border: 1px solid var(--line);
  border-radius: var(--ak-card-radius);
  padding: 7px 9px;
  margin-bottom: 6px;
  background: var(--surface);
}

.akashic-receptionist-overview .ahr-receptionist-row--clickable {
  cursor: pointer;
}

.akashic-receptionist-overview .ahr-receptionist-row--empty {
  color: var(--ink-muted);
}

.akashic-receptionist-overview .ahr-receptionist-row--unread {
  background: var(--paper);
  border-left: 4px solid var(--primary);
}

.akashic-receptionist-overview .ahr-receptionist-row--muted {
  opacity: 0.82;
}

.akashic-receptionist-overview .ahr-receptionist-msg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}

.akashic-receptionist-overview .ahr-receptionist-msg-btn:hover {
  background: var(--blue-soft);
}

.akashic-receptionist-overview .ahr-receptionist-appointment-row {
  border-left-width: 5px;
  border-left-style: solid;
}

.akashic-receptionist-overview .ahr-receptionist-readiness-row {
  border-left-width: 4px;
  border-left-style: solid;
}

.akashic-receptionist-overview .ahr-state-ready {
  border-left-color: var(--success);
  background: var(--paper);
}

.akashic-receptionist-overview .ahr-state-attention {
  border-left-color: var(--amber-line);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-state-blocked {
  border-left-color: var(--danger);
  background: var(--paper);
}

.akashic-receptionist-overview .ahr-state-late {
  border-left-color: var(--amber-line);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-state-no-show {
  border-left-color: var(--line);
  background: var(--paper);
}

.akashic-receptionist-overview .ahr-late-urgency-recent {
  border-left-color: var(--amber-line);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-late-urgency-elevated {
  border-left-color: var(--warning);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-late-urgency-stale {
  border-left-color: var(--line);
  background: var(--paper);
}

.akashic-receptionist-overview .ahr-late-urgency-recent .ahr-receptionist-status-pill--late {
  color: var(--warning);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-late-urgency-elevated .ahr-receptionist-status-pill--late {
  color: var(--warning);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-late-urgency-stale .ahr-receptionist-status-pill--late {
  color: var(--ink);
  background: var(--sunken);
}

.akashic-receptionist-overview .ahr-receptionist-appointment-row__grid {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
}

.akashic-receptionist-overview .ahr-receptionist-row__split {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.akashic-receptionist-overview .ahr-receptionist-row__time {
  font-size: 14px;
}

.akashic-receptionist-overview .ahr-receptionist-row__name {
  font-size: 13px;
}

.akashic-receptionist-overview .ahr-receptionist-row__primary {
  font-weight: 600;
  line-height: 1.2;
}

.akashic-receptionist-overview .ahr-receptionist-row__content {
  min-width: 0;
}

.akashic-receptionist-overview .ahr-receptionist-text-muted {
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.25;
}

.akashic-receptionist-overview .ahr-receptionist-text-tiny {
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.2;
}

.akashic-receptionist-overview .ahr-receptionist-status-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 7px;
  white-space: nowrap;
  border: 1px solid currentColor;
}

.akashic-receptionist-overview .ahr-receptionist-status-pill--ready {
  color: var(--success);
  background: var(--green-soft);
}

.akashic-receptionist-overview .ahr-receptionist-status-pill--attention {
  color: var(--warning);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-receptionist-status-pill--blocked {
  color: var(--danger);
  background: var(--red-soft);
}

.akashic-receptionist-overview .ahr-receptionist-status-pill--late {
  color: var(--warning);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-receptionist-status-pill--no-show {
  color: var(--ink);
  background: var(--sunken);
}

@media (max-width: 960px) {
  .akashic-receptionist-overview {
    height: auto;
    overflow: visible;
  }

  .akashic-receptionist-overview .ahr-receptionist-overview__grid,
  .akashic-receptionist-overview .ahr-receptionist-overview__main-column,
  .akashic-receptionist-overview .ahr-receptionist-overview__secondary-grid,
  .akashic-receptionist-overview .ahr-receptionist-overview__message-column {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .akashic-receptionist-overview .ahr-receptionist-card {
    min-height: 260px;
  }
}

/* Receptionist book appointment modal */
.ahr-receptionist-book-appointment form,
.ahr-receptionist-book-appointment .ahr-custom-task-assignment-form {
    height: auto;
    min-height: 0;
}
 .ahr-receptionist-selected-patient {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.375rem;
    background: hsl(var(--muted) / 0.3);
    padding: 0.75rem;
}
/* Says why the patient is already chosen: the visit the clinician has open. */
.ahr-booking-seed-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 8px;
    border: 1px solid var(--green-line, var(--line));
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--ink-strong);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#akashic-health-records-patient-portal-root .ahr-booking-someone-else {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-booking-someone-else__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

#akashic-health-records-patient-portal-root .ahr-booking-someone-else__link:hover {
    text-decoration: underline;
}


/* Receptionist appointment status indicators */
.akashic-receptionist-overview .ahr-receptionist-row--clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.akashic-receptionist-overview .ahr-receptionist-appointment-row__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.akashic-receptionist-overview .ahr-receptionist-appointment-indicators {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.akashic-receptionist-overview .ahr-receptionist-appointment-indicator {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.akashic-receptionist-overview .ahr-receptionist-appointment-indicator--complete {
  color: var(--success);
  background: var(--green-soft);
}

.akashic-receptionist-overview .ahr-receptionist-appointment-indicator--incomplete {
  color: var(--warning);
  background: var(--amber-soft);
}

.akashic-receptionist-overview .ahr-receptionist-appointment-indicator--unknown,
.akashic-receptionist-overview .ahr-receptionist-appointment-indicator--loading {
  color: var(--ink-muted);
  background: var(--sunken);
}

@keyframes ahr-receptionist-spin {
  to {
    transform: rotate(360deg);
  }
}

.ahr-receptionist-spin {
  animation: ahr-receptionist-spin 0.9s linear infinite;
}

/* Receptionist appointment details modal */
.ahr-receptionist-appointment-dialog {
  width: min(800px, calc(100vw - 32px));
  max-width: min(800px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
}

#akashic-health-records-patient-portal-root
  [data-slot="dialog-content"].ahr-receptionist-appointment-dialog {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ahr-receptionist-modal-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.ahr-receptionist-modal-status--complete {
  color: var(--success);
  background: var(--green-soft);
}

.ahr-receptionist-modal-status--incomplete {
  color: var(--warning);
  background: var(--amber-soft);
}

.ahr-receptionist-modal-status--unable {
  color: var(--danger);
  background: var(--red-soft);
}

.ahr-receptionist-modal-status--cancelled {
  color: var(--muted-foreground);
  background: var(--muted);
}

.ahr-receptionist-appointment-loading,
.ahr-receptionist-appointment-inline-error,
.ahr-receptionist-appointment-empty-state,
.ahr-receptionist-readiness-summary {
  border-radius: 6px;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.ahr-receptionist-appointment-loading,
.ahr-receptionist-appointment-empty-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.3);
}

.ahr-receptionist-appointment-inline-error {
  color: var(--danger);
  background: var(--red-soft);
}

.ahr-receptionist-appointment-task-list {
  display: grid;
  gap: 9px;
}

.ahr-receptionist-appointment-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--ak-card-radius);
  background: hsl(var(--muted) / 0.18);
}

.ahr-receptionist-appointment-task__icon {
  display: flex;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.55);
}

.ahr-receptionist-appointment-task__content {
  min-width: 0;
  flex: 1 1 auto;
}

.ahr-receptionist-appointment-task__top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ahr-receptionist-appointment-task__top-row > div {
  min-width: 0;
}

.ahr-receptionist-appointment-task__type {
  display: block;
  margin-bottom: 2px;
  color: hsl(var(--muted-foreground));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-transform: uppercase;
}

.ahr-receptionist-appointment-task h5 {
  margin: 0;
  overflow-wrap: anywhere;
  color: hsl(var(--foreground));
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.ahr-receptionist-appointment-task__due {
  margin-top: 5px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  line-height: 1.35;
}

.ahr-receptionist-appointment-task__unable-reason {
  margin-top: 9px;
  padding: 9px 10px;
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  color: var(--danger);
  background: var(--red-soft);
}

.ahr-receptionist-appointment-task__unable-reason strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
}

.ahr-receptionist-appointment-task__unable-reason p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* Patient appointment timeline inside appointment details */
.ahr-receptionist-appointment-history-tabs {
  gap: 12px;
}

/* The line tabs are the shared ones (TabsList variant="line"); only their place is local. */
.ahr-receptionist-appointment-history-tabs__list {
  width: 100%;
  justify-content: flex-start;
  gap: 18px;
}

.ahr-receptionist-appointment-history-tabs__trigger {
  flex: 0 0 auto;
}

.ahr-receptionist-appointment-history-tabs__trigger > span {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.75);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.ahr-receptionist-appointment-history-tabs__trigger[data-state="active"] > span {
  color: hsl(var(--foreground));
}

.ahr-receptionist-appointment-history-tabs__content {
  margin-top: 0;
}

.ahr-receptionist-appointment-history-list {
  display: grid;
  gap: 8px;
}

.ahr-receptionist-appointment-history-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 11px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--ak-card-radius);
  background: hsl(var(--muted) / 0.18);
}

.ahr-receptionist-appointment-history-row__date,
.ahr-receptionist-appointment-history-row__details {
  min-width: 0;
}

.ahr-receptionist-appointment-history-row__date strong,
.ahr-receptionist-appointment-history-row__details strong {
  display: block;
  overflow: hidden;
  color: hsl(var(--foreground));
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ahr-receptionist-appointment-history-row__date span,
.ahr-receptionist-appointment-history-row__details span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ahr-receptionist-appointment-history-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.ahr-receptionist-appointment-history-status--on-time {
  color: var(--success);
  background: var(--green-soft);
}

.ahr-receptionist-appointment-history-status--scheduled {
  color: var(--primary);
  background: var(--blue-soft);
}

.ahr-receptionist-appointment-history-status--late {
  color: var(--warning);
  background: var(--amber-soft);
}

.ahr-receptionist-appointment-history-status--cancelled {
  color: var(--ink-muted);
  background: var(--sunken);
}

.ahr-receptionist-appointment-history-status--missed {
  color: var(--danger);
  background: var(--red-soft);
}

.ahr-receptionist-appointment-history-status--pending {
  color: var(--primary);
  background: var(--blue-soft);
}

.ahr-receptionist-appointment-history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding: 8px 2px 0;
  color: hsl(var(--muted-foreground));
  font-size: 11px;
  line-height: 1.35;
}

.ahr-receptionist-appointment-history-pagination span:last-child {
  text-align: right;
}

@media (max-width: 640px) {
  .akashic-receptionist-overview .ahr-receptionist-appointment-row__grid {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .akashic-receptionist-overview .ahr-receptionist-appointment-row__meta {
    grid-column: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .ahr-receptionist-appointment-dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .ahr-receptionist-appointment-section__heading-row,
  .ahr-receptionist-appointment-task__top-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .ahr-receptionist-appointment-history-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .ahr-receptionist-appointment-history-status {
    justify-self: flex-start;
  }

  .ahr-receptionist-appointment-history-pagination {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .ahr-receptionist-appointment-history-pagination span:last-child {
    text-align: left;
  }
}

/* Receptionist appointment editor and patient quick view */

.ahr-receptionist-book-appointment__initializing {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
}

.ahr-receptionist-patient-quick-view-dialog {
  width: min(920px, calc(100vw - 32px));
  max-width: min(920px, calc(100vw - 32px));
  max-height: min(900px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
}

#akashic-health-records-patient-portal-root
  [data-slot="dialog-content"].ahr-receptionist-patient-quick-view-dialog {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ahr-receptionist-patient-quick-view-dialog__header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 56px 16px 16px;
  border-bottom: 1px solid hsl(var(--border));
  text-align: left;
}

.ahr-receptionist-patient-quick-view-dialog__back,
.ahr-receptionist-patient-quick-view-dialog__full-profile {
  gap: 6px;
  white-space: nowrap;
}

.ahr-receptionist-patient-quick-view-dialog__heading {
  min-width: 0;
}

.ahr-receptionist-patient-quick-view-dialog__heading [data-slot="dialog-title"] {
  margin: 0 0 4px;
}

.ahr-receptionist-patient-quick-view-dialog__heading [data-slot="dialog-description"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ahr-receptionist-patient-quick-view-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 22px;
}

.ahr-receptionist-patient-quick-view-dialog__state,
.ahr-receptionist-patient-quick-view-dialog__error {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 20px;
  font-size: 14px;
}

.ahr-receptionist-patient-quick-view-dialog__state {
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.3);
}

.ahr-receptionist-patient-quick-view-dialog__error {
  color: var(--danger);
  background: var(--red-soft);
}

@media (max-width: 640px) {
  .ahr-receptionist-patient-quick-view-dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .ahr-receptionist-patient-quick-view-dialog__header {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 14px 48px 14px 12px;
  }

  .ahr-receptionist-patient-quick-view-dialog__full-profile {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: center;
  }

  .ahr-receptionist-patient-quick-view-dialog__body {
    padding: 14px;
  }
}

/* Receptionist appointment status controls and late alerts */
.ahr-receptionist-appointment-status-field {
  min-width: 0;
  scroll-margin-block: 90px;
}

.ahr-receptionist-appointment-status-field--attention {
  margin: -8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--amber-soft);
  box-shadow: 0 0 0 2px var(--warning);
  animation: ahr-receptionist-status-attention 0.9s ease-in-out 3;
}

@keyframes ahr-receptionist-status-attention {
  0%,
  100% {
    box-shadow: 0 0 0 2px var(--warning);
  }

  50% {
    box-shadow: 0 0 0 5px rgb(227 160 8 / 28%);
  }
}

/* Card 292 — the front desk board's capped, self-scrolling zones.
   The platform default scrollbar is a wide dark bar and it OUT-SHOUTED THE PATIENTS. A scrollbar on this
   board is an affordance, not information: findable when you look for it, invisible when you are not.
   Thin, hairline-coloured, transparent track.
   Everything else about these zones is expressed in Tailwind at the call site — the cap, the gap, and the
   flex-none children that make them SCROLL rather than compress. Only the scrollbar has no utility, which
   is why this is the one rule that lives here. */
.ahr-fd-zone {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.ahr-fd-zone::-webkit-scrollbar {
  width: 6px;
}

.ahr-fd-zone::-webkit-scrollbar-track {
  background: transparent;
}

.ahr-fd-zone::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 20px;
}

.ahr-fd-zone:hover {
  scrollbar-color: var(--faint) transparent;
}

.ahr-fd-zone:hover::-webkit-scrollbar-thumb {
  background: var(--faint);
}

/* The rail's section headings. The pressable label is a button, and the root's button rule reset the
   uppercase it inherited, so both the row and its button carry the heading type explicitly. */
#akashic-health-records-patient-portal-root .ahr-fd-rail-heading,
#akashic-health-records-patient-portal-root .ahr-fd-rail-heading > button:first-child {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-strong);
}

/* The On today role filter is a small lens on the heading line, not a form field. */
#akashic-health-records-patient-portal-root select.ahr-fd-role-filter {
  margin-left: auto;
  width: auto;
  max-width: 104px;
  min-height: 0;
  height: auto;
  padding: 1px 16px 1px 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background-color: transparent;
  background-position: right 3px center;
  background-size: 10px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink-muted);
}

/* The details overlay is a compact modal over the board, as drawn. Scoped to the root so the shared
   dialog rule, which is id-scoped, cannot widen it to the full screen. */
#akashic-health-records-patient-portal-root [data-slot="dialog-content"].ahr-receptionist-appointment-dialog {
  width: min(620px, calc(100vw - 36px));
  max-width: min(620px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 44px color-mix(in srgb, var(--ink-strong) 32%, transparent);
  overflow: hidden;
}

/* The front desk board, from the receptionist deck's overview frames. */
#akashic-health-records-patient-portal-root .ahr-fd-section + .ahr-fd-section {
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px solid var(--line-soft);
}

#akashic-health-records-patient-portal-root .ahr-fd-section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 4px;
}

/* Each queue keeps its heading colour on the shared section title (queue-total ruling). */

#akashic-health-records-patient-portal-root .ahr-fd-section-heading--attention { color: var(--danger); }
#akashic-health-records-patient-portal-root .ahr-fd-section-heading--scheduled { color: var(--primary); }
#akashic-health-records-patient-portal-root .ahr-fd-section-heading--checked-in { color: var(--sage-deep); }
#akashic-health-records-patient-portal-root .ahr-fd-section-heading--roomed { color: var(--ink-strong); }

#akashic-health-records-patient-portal-root .ahr-fd-section-count {
  font-size: 14px;
  font-weight: var(--ak-body-weight, 300);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

/* The Full day door is the shared section-head door (.ak-section-head__door). */

#akashic-health-records-patient-portal-root .ahr-fd-section-behind {
  margin-left: auto;
  font-size: 11px;
  color: var(--warning);
}

#akashic-health-records-patient-portal-root .ahr-fd-section-empty {
  margin: 0;
  padding: 2px 4px 4px;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--ink-muted);
}

/* Each queue row is the shared .ak-row (padding, hairline and cell type); only its deck columns are local. */
#akashic-health-records-patient-portal-root .ahr-fd-row {
  display: grid;
  grid-template-columns: 76px 156px minmax(0, 1fr) 104px 40px;
  white-space: nowrap;
  cursor: pointer;
}

#akashic-health-records-patient-portal-root .ahr-fd-row:hover { background: var(--sunken); }
#akashic-health-records-patient-portal-root .ahr-fd-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* A visit in progress is the quietest row: information, not a job. */
#akashic-health-records-patient-portal-root .ahr-fd-row--in-encounter { opacity: 0.82; }
#akashic-health-records-patient-portal-root .ahr-fd-row--flagged { border: 1px solid var(--danger); }
#akashic-health-records-patient-portal-root .ahr-fd-row--flagged + .ahr-fd-row,
#akashic-health-records-patient-portal-root .ahr-fd-row + .ahr-fd-row--flagged { border-top-color: var(--danger); }

#akashic-health-records-patient-portal-root .ahr-fd-row__name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#akashic-health-records-patient-portal-root .ahr-fd-row__mark .ahr-inbox-avatar {
  width: 22px;
  height: 22px;
  font-size: 9px;
  letter-spacing: 0.02em;
}

/* The deck's no-consent row: a danger frame and a danger detail line. */
#akashic-health-records-patient-portal-root .ahr-fd-row--flagged .ahr-fd-row__detail { color: var(--danger); }

#akashic-health-records-patient-portal-root .ahr-fd-row__state,
#akashic-health-records-patient-portal-root .ahr-fd-row__age {
  margin-left: 0;
  text-align: right;
}

#akashic-health-records-patient-portal-root .ahr-fd-row--late .ahr-fd-row__age { color: var(--danger); }

/* A phone stacks the row: time, name and state on one line, detail and elapsed under it, each row a
   white strip, two visible per queue before the queue scrolls. */
@media (max-width: 640px) {
  #akashic-health-records-patient-portal-root .ahr-fd-zone { --ahr-fd-row-h: 66px; }
  #akashic-health-records-patient-portal-root .ahr-fd-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "time name state" "detail detail age";
    align-content: center;
    column-gap: 8px;
    row-gap: 2px;
    min-height: var(--ahr-fd-row-h);
    padding: 7px 10px;
    background: var(--surface);
  }
  #akashic-health-records-patient-portal-root .ahr-fd-row__time { grid-area: time; font-size: 12.5px; }
  #akashic-health-records-patient-portal-root .ahr-fd-row__name { grid-area: name; font-size: 13px; }
  #akashic-health-records-patient-portal-root .ahr-fd-row__mark { display: none; }
  #akashic-health-records-patient-portal-root .ahr-fd-row__detail { grid-area: detail; }
  #akashic-health-records-patient-portal-root .ahr-fd-row__state { grid-area: state; font-size: 11.5px; }
  #akashic-health-records-patient-portal-root .ahr-fd-row__age { grid-area: age; }
}

/* The late-arrival toast is the shared .ak-toast--error (surface, danger edge, title, body, actions). */
#akashic-health-records-patient-portal-root .ahr-late-toast {
  box-sizing: border-box;
  font-family: inherit;
}

#akashic-health-records-patient-portal-root .ahr-late-toast__title,
#akashic-health-records-patient-portal-root .ahr-late-toast__line {
  display: block;
  margin: 0;
}

#akashic-health-records-patient-portal-root .ahr-late-toast__actions {
  flex-wrap: wrap;
}

/* The rail: primary glyphs, muted counts, and the roster as one line per person. */
#akashic-health-records-patient-portal-root .ahr-fd-rail-glyph { color: var(--primary); }

#akashic-health-records-patient-portal-root .ahr-fd-rail-count {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink-muted);
}

/* The rail's compact rows, the deck's .mrow and roster line: 5px 4px under a soft rule. No shared compact
   row exists (.ak-row is 6px 10px at 36px), so this is the one local rule for both (F22). */
#akashic-health-records-patient-portal-root .ahr-fd-roster-row,
#akashic-health-records-patient-portal-root .ahr-fd-mrow {
  padding: 5px 4px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}

#akashic-health-records-patient-portal-root .ahr-fd-roster-row:first-child,
#akashic-health-records-patient-portal-root .ahr-fd-mrow:first-child { border-top: 0; }
#akashic-health-records-patient-portal-root .ahr-fd-roster-row:hover,
#akashic-health-records-patient-portal-root .ahr-fd-mrow:hover { background: var(--sunken); }

#akashic-health-records-patient-portal-root .ahr-fd-mrow__line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

#akashic-health-records-patient-portal-root .ahr-fd-mrow__who,
#akashic-health-records-patient-portal-root .ahr-fd-mrow__snip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#akashic-health-records-patient-portal-root .ahr-fd-mrow__who {
  font-size: 12px;
  font-weight: var(--ak-label-weight);
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-fd-mrow--unread .ahr-fd-mrow__who {
  font-weight: var(--ak-heading-weight);
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-fd-mrow__age {
  flex: none;
  margin-left: auto;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-fd-mrow--unread .ahr-fd-mrow__age { font-weight: var(--ak-heading-weight); }

#akashic-health-records-patient-portal-root .ahr-fd-mrow__snip {
  font-size: 11.5px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-fd-mrow--unread .ahr-fd-mrow__snip { color: var(--ink); }

#akashic-health-records-patient-portal-root .ahr-fd-roster-row__line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

#akashic-health-records-patient-portal-root .ahr-fd-roster-row__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-fd-roster-row__hours {
  flex: none;
  margin-left: auto;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-late-toast__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

/* The visit details overlay, from the deck's Appointment Details frames. */
#akashic-health-records-patient-portal-root .ahr-receptionist-appointment-dialog [data-slot="dialog-close"] {
  top: 18px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}

#akashic-health-records-patient-portal-root .ahr-receptionist-appointment-dialog [data-slot="dialog-close"] svg { width: 18px; height: 18px; }

#akashic-health-records-patient-portal-root .ahr-rx__head {
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 18px 60px 18px 22px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

#akashic-health-records-patient-portal-root .ahr-rx__head [data-slot="dialog-title"] { margin: 0; }

#akashic-health-records-patient-portal-root .ahr-rx__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

#akashic-health-records-patient-portal-root .ahr-rx__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 16px;
}

#akashic-health-records-patient-portal-root .ahr-rx__facts > div { min-width: 0; overflow-wrap: anywhere; }
#akashic-health-records-patient-portal-root .ahr-rx__facts dt { display: block; font-size: 12px; color: var(--ink-muted); }
#akashic-health-records-patient-portal-root .ahr-rx__facts dd { display: block; margin: 0; font-size: 14px; color: var(--ink); }
#akashic-health-records-patient-portal-root .ahr-rx__facts dd.text-muted-foreground { color: var(--ink-muted); }

#akashic-health-records-patient-portal-root .ahr-rx__field { display: block; margin: 0 0 14px; }

/* The label and the status field are the shared ones (.ak-label and the foundation select). */
#akashic-health-records-patient-portal-root .ahr-rx__label {
  display: block;
  margin-bottom: 5px;
}

#akashic-health-records-patient-portal-root .ahr-rx__select {
  width: 100%;
}

#akashic-health-records-patient-portal-root .ahr-rx__note {
  margin: 13px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-rx__updating { margin: 14px 0 0; font-size: 14px; color: var(--ink); }
#akashic-health-records-patient-portal-root .ahr-rx__plain { margin: 14px 0; font-size: 14px; color: var(--ink); }

#akashic-health-records-patient-portal-root .ahr-rx__heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: var(--ak-body-weight, 300);
  line-height: 1.5;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-rx__count { margin-left: auto; font-size: 12px; color: var(--ink-muted); }

/* A refused or unconfirmed change: the shared error notice with its triangle. */
#akashic-health-records-patient-portal-root .ahr-rx__alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
}

#akashic-health-records-patient-portal-root .ahr-rx__alert-icon { flex: none; margin-top: 1px; }
#akashic-health-records-patient-portal-root .ahr-rx__alert-title { margin: 0; color: var(--danger); }
#akashic-health-records-patient-portal-root .ahr-rx__alert-text { margin: 3px 0 10px; }

#akashic-health-records-patient-portal-root .ahr-rx__field .ahr-rx__alert { margin: 10px 0 0; }

/* The three agreements read as answer rows: the document name small and muted, its state under it. */
#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-status-row"] {
  display: block;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-status-row"] > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 0;
}

#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-status-row"] > div > svg { display: none; }

#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-instrument-name"] {
  flex-basis: 100%;
  font-size: 12px;
  font-weight: 300;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-status-row"] > div > span:nth-child(3) {
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
}

#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-answered-at"],
#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-agreed-version"] {
  font-size: 12px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-rx__section [data-testid="org-authorization-checkin-panel"] { margin: 8px 0; }

#akashic-health-records-patient-portal-root .ahr-rx__answer { padding: 10px 0; border-bottom: 1px solid var(--line); }
#akashic-health-records-patient-portal-root .ahr-rx__answer > span { display: block; font-size: 12px; color: var(--ink-muted); }

#akashic-health-records-patient-portal-root .ahr-rx__more { margin-top: 12px; }

#akashic-health-records-patient-portal-root .ahr-rx__more > summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}

#akashic-health-records-patient-portal-root .ahr-rx__footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

#akashic-health-records-patient-portal-root .ahr-rx__footer .ahr-rx__note { margin: 0; }
#akashic-health-records-patient-portal-root .ahr-rx__spacer { flex: 1; }
#akashic-health-records-patient-portal-root .ahr-rx__footer .btn svg { width: 14px; height: 14px; flex: none; }

/* A phone opens the details as a sheet from under the header. */
@media (max-width: 640px) {
  #akashic-health-records-patient-portal-root [data-slot="dialog-content"].ahr-receptionist-appointment-dialog {
    top: 52px;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: none;
    border-radius: 14px 14px 0 0;
    transform: none;
    translate: none;
  }
  #akashic-health-records-patient-portal-root .ahr-rx__head,
  #akashic-health-records-patient-portal-root .ahr-rx__footer { padding: 14px 16px; }
  #akashic-health-records-patient-portal-root .ahr-rx__footer { flex-wrap: wrap; }
  #akashic-health-records-patient-portal-root .ahr-rx__footer .ahr-rx__spacer { display: none; }
  #akashic-health-records-patient-portal-root .ahr-rx__footer .btn { flex: 1 1 auto; justify-content: center; }
  #akashic-health-records-patient-portal-root .ahr-rx__head { padding-right: 56px; }
  #akashic-health-records-patient-portal-root .ahr-rx__body { padding: 16px; }
  #akashic-health-records-patient-portal-root .ahr-rx__facts { grid-template-columns: 1fr; }
  #akashic-health-records-patient-portal-root .ahr-receptionist-appointment-dialog [data-slot="dialog-close"] { top: 12px; right: 10px; }
}

#akashic-health-records-patient-portal-root .ahr-rx__head [data-slot="dialog-title"] { flex: 1; padding: 0; text-align: left; }
