/* The patient quick view: the receptionist deck's .rx-dialog chrome over its .qvdlg profile. */
#akashic-health-records-patient-portal-root [data-slot="dialog-content"].ahr-qv {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 610px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: hidden;
}

/* Profile is the deck's narrower Quick View (524 x 736); the list sections take its 610px one. */
#akashic-health-records-patient-portal-root [data-slot="dialog-content"].ahr-qv[data-section="profile"] {
  width: 524px;
}

#akashic-health-records-patient-portal-root .ahr-qv > [data-slot="dialog-close"] {
  top: 20px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}

#akashic-health-records-patient-portal-root .ahr-qv > [data-slot="dialog-close"] svg {
  width: 20px;
  height: 20px;
}

#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__head {
  flex: none;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px 56px 14px 16px;
  text-align: left;
}

#akashic-health-records-patient-portal-root .ahr-qv__head .ahr-inbox-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  font-size: 14px;
}

#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#akashic-health-records-patient-portal-root .ahr-qv .btn.ahr-qv__message {
  flex: none;
}

/* Why Message is not offered: the chart band's note, under the patient's name. */
#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__note {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 36px 22px;
  font-size: 14px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__state--failed {
  color: var(--danger);
}

#akashic-health-records-patient-portal-root .ahr-qv__tabs {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 0;
}

/* The seven tabs sit on one line; below 640px the section select replaces them. */
#akashic-health-records-patient-portal-root .ahr-qv__strip {
  flex: none;
  margin: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

#akashic-health-records-patient-portal-root .ahr-qv__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 16px;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile {
  display: grid;
  gap: 14px;
}

/* The three agreements stack as one block, as the deck's .rx-agreements: no gap between rows. */
#akashic-health-records-patient-portal-root .ahr-qv__agreements {
  display: grid;
}

/* The three agreements, each one sunken row: its name and state, and the capture beside them. */
#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-row"],
#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-unreadable"] {
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sunken);
}

#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-row"] > div > svg {
  display: none;
}

/* Name and state read as one phrase and wrap onto a second line rather than truncating. */
#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-row"] > div {
  flex-wrap: wrap;
  column-gap: 4px;
  row-gap: 0;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-instrument-name"] {
  overflow: visible;
  white-space: normal;
  font-size: 13.5px;
  font-weight: 300;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-row"] > div > span:nth-child(3) {
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 300;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-row"] > div > span:nth-child(3)::before {
  content: "· ";
}

#akashic-health-records-patient-portal-root .ahr-qv__profile [data-testid="org-authorization-status-row"] > .btn {
  flex: none;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card {
  gap: 14px;
}

/* Show field history sits on the left as a quiet outlined button. */
#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card > div:first-child {
  justify-content: flex-start;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card__group {
  gap: 8px;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card__grid {
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card__grid .flex-col {
  gap: 0;
  padding: 0;
}

#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card__grid .flex-col > span:first-child {
  font-size: 12.5px;
  font-weight: 300;
  line-height: 19.4px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .ahr-qv__profile .ahr-patient-profile-card__grid .flex-col > div {
  font-size: 13.5px;
  line-height: 20.9px;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .ahr-qv__foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

#akashic-health-records-patient-portal-root .ahr-qv__foot .btn svg {
  width: 14px;
  height: 14px;
}

/* The board's compact quick view, the deck's .rx-dialog: notes over the profile, no sections. */
#akashic-health-records-patient-portal-root [data-slot="dialog-content"].ahr-qv.ahr-qv--desk {
  width: 620px;
}

#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__heading {
  flex: 1;
  min-width: 0;
  text-align: left;
}

/* The board's compact view keeps its own head: wider padding and a rule under it, as its deck frame draws. */
#akashic-health-records-patient-portal-root .ahr-qv--desk .ahr-qv__head {
  gap: 16px;
  padding: 18px 64px 18px 22px;
  border-bottom: 1px solid var(--line);
}

#akashic-health-records-patient-portal-root .ahr-qv--desk > [data-slot="dialog-close"] {
  top: 24px;
  right: 18px;
}

#akashic-health-records-patient-portal-root .ahr-qv--desk .ahr-qv__title {
  padding: 0;
  line-height: 1.55;
}

#akashic-health-records-patient-portal-root .ahr-qv .ahr-qv__who {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

#akashic-health-records-patient-portal-root .ahr-qv--desk .ahr-qv__body {
  padding: 18px 22px;
  font-size: 14px;
  line-height: 1.5;
}

#akashic-health-records-patient-portal-root .ahr-qv--desk .ahr-qv__notes {
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

/* The notes heading is the shared h3.ak-section-title; only the space under it is set here. */
#akashic-health-records-patient-portal-root .ahr-qv--desk .ahr-qv__section-title {
  margin: 0 0 8px;
}

/* A phone opens it as a sheet from under the header. */
@media (max-width: 640px) {
  #akashic-health-records-patient-portal-root [data-slot="dialog-content"].ahr-qv {
    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-qv .ahr-qv__head {
    gap: 12px;
    padding: 14px 56px 14px 16px;
  }

  #akashic-health-records-patient-portal-root .ahr-qv > [data-slot="dialog-close"] {
    top: 20px;
    right: 12px;
  }

  #akashic-health-records-patient-portal-root .ahr-qv__strip { margin: 0 16px; overflow: visible; }
  #akashic-health-records-patient-portal-root .ahr-qv__strip select { width: 100%; }

  #akashic-health-records-patient-portal-root .ahr-qv__body { padding: 14px 16px 16px; }
  #akashic-health-records-patient-portal-root .ahr-qv--desk .ahr-qv__body { padding: 16px; }
  #akashic-health-records-patient-portal-root .ahr-qv__foot { padding: 14px 16px; }
}

/* Tabs that would clip become the section select at any width. The tab list stays laid out, invisible, so
   its natural width can still be measured; it is out of the accessibility tree while hidden. */
#akashic-health-records-patient-portal-root .ahr-qv__strip[data-sections="select"] > .ak-tabs {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}
#akashic-health-records-patient-portal-root .ahr-qv__strip[data-sections="select"] > .ak-tabs-mobile {
  display: block;
}
#akashic-health-records-patient-portal-root .ahr-qv__strip {
  position: relative;
}
