/* patient-r2.css — the patient shell on the round-2 component standard (UI polish, 2026-11-11 night,
   zone P-shell). wiki/ui-standards.md §8 holds the shared classes (.ui-tabs, .ui-btn, .ui-card,
   UiDialog); this sheet only fits the patient shell's own markup onto them:

     - header buttons: icon + word, 44 px at every width (P-09);
     - stage tabs: the shared underlined page tabs (.ui-tabs / .ui-tab) with the step number;
     - card buttons (.acp-cta) take the .ui-btn look they now carry in markup;
     - the windows that keep their own markup (Settings, Reschedule, Invite to session) wear the
       UiDialog frame and fade in AND out (P-33); the People menu fades both ways.

   Loaded by templates/patient_shell.html after patient-polish.css, so equal-specificity rules here
   win. Font sizes come from the type scale only (var(--fs-N)). */

/* -- P-09: header buttons say what they are, 44 px tall at every width ------------------------ */
.ps-header {
  padding-right: 16px;
}

.ps-header .ps-header-actions {
  gap: 4px;
}

.ps-header .ps-icon-btn.ps-hdr-btn {
  position: relative;
  width: auto;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  gap: 8px;
  border-radius: 999px;
  color: var(--ps-text-soft);
  font-size: var(--fs-14, 14px);
  font-weight: 600;
  white-space: nowrap;
}

.ps-header .ps-icon-btn.ps-hdr-btn > i {
  font-size: var(--fs-16, 16px);
}

.ps-header .ps-icon-btn.ps-hdr-btn::after {
  content: none;
}

.ps-header .ps-icon-btn.ps-hdr-btn:focus-visible {
  outline: 2px solid var(--ps-accent);
  outline-offset: 2px;
}

/* On a phone the word sits under the icon (three words do not fit beside the brand). */
@media (max-width: 760px) {
  .ps-header {
    height: 60px;
    padding: 8px 8px 8px 16px;
  }

  .ps-header .ps-header-brand-name {
    font-size: var(--fs-14, 14px);
  }

  .ps-header .ps-icon-btn.ps-hdr-btn {
    flex-direction: column;
    gap: 2px;
    min-width: 56px;
    height: 48px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: var(--fs-12, 12px);
  }

  /* One name for the button: "Feedback & Questions" on two lines under the icon, never the
     cut "Feedback" (cohesion review). */
  .ps-header .ps-hdr-btn[data-ps-feedback] {
    min-width: 72px;
    height: 52px;
    gap: 1px;
  }

  .ps-header .ps-hdr-btn[data-ps-feedback] .ps-hdr-word--long {
    display: block;
    max-width: 72px;
    font-size: var(--fs-12, 12px);
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

}

/* -- Stage tabs: the shared page tabs (.ui-tabs / .ui-tab), one per step, full width ---------- */
.ui-tabs.ps-stage-tabs {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 0 18px;
  padding: 0;
  border-bottom: 1px solid var(--ps-border);
  background: transparent;
  /* Leaves a gap above the rail when a tap scrolls it to the top on a phone. */
  scroll-margin-top: 10px;
}

.ui-tabs.ps-stage-tabs > .ui-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 56px;
  margin-bottom: -1px;
  padding: 6px 4px 8px;
  gap: 2px;
}

.ps-stage-tab-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.ps-stage-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The step number: a small circle; filled forest on the step to do now (P-08). */
.ps-stage-tab-index {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--color-panel);
  color: var(--ps-text-soft);
  font-size: var(--fs-12, 12px);
  font-weight: 700;
}

.ps-stage-tab--done .ps-stage-tab-index {
  background: color-mix(in srgb, var(--color-done) 12%, transparent);
  color: var(--ps-green);
}

.ps-stage-tab--current .ps-stage-tab-index {
  background: var(--ps-accent);
  color: var(--color-on-main);
}

.ui-tabs.ps-stage-tabs > .ui-tab .ui-tab__note {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The state word is status the patient needs ("Later", "After evidence"): the readable
   soft text, not the 0.48 dim token (2.6:1 on cream; Codex run 3). Done/Next keep their colour. */
.ps-stage-tab .ui-tab__note { color: var(--ps-text-soft); }
.ps-stage-tab--done .ui-tab__note { color: var(--ps-green); }
.ps-stage-tab--current .ui-tab__note { color: var(--ps-accent-text); }

/* The chosen tab: the forest underline (the shared rule) and an ink name, as in the Evergreen
   picture (the rust accent is for links and the "Next" word); the number keeps its state. */
.ui-tabs.ps-stage-tabs > .ui-tab[aria-selected="true"] .ps-stage-tab-label {
  color: var(--color-text);
}

/* Support is not a step: a hairline before it, a glyph instead of a number. */
.ui-tabs.ps-stage-tabs > .ps-stage-tab--support::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  border-left: 1px solid var(--ps-border);
}

.ui-tabs.ps-stage-tabs > .ps-stage-tab--support {
  position: relative;
}

.ps-stage-tab--support .ps-stage-tab-index {
  background: var(--ps-accent-dim);
  color: var(--ps-accent);
}

@media (max-width: 760px) {
  /* Four tabs (Support) share 390 px: 13 px names and a smaller number keep "Evidence" whole. */
  .ui-tabs.ps-stage-tabs > .ui-tab {
    padding-inline: 2px;
    font-size: var(--fs-13, 13px);
  }

  .ps-stage-tab-line {
    gap: 4px;
  }

  .ps-stage-tab-index {
    width: 18px;
    height: 18px;
  }
}

/* Five tabs (Payment still due, plus Support) on a phone: the number sits above the name, so
   "Payment" and "Session" are never cut off. Four tabs keep the number beside the name. */
@media (max-width: 480px) {
  .ui-tabs.ps-stage-tabs:has(> .ui-tab:nth-child(5)) .ps-stage-tab-line {
    flex-direction: column;
    gap: 2px;
  }
}

/* -- Card buttons: .acp-cta now also carries .ui-btn (main / secondary); the shared look wins --- */
.acp-cta.ui-btn {
  min-height: var(--ui-btn-h, 44px);
  padding: 0 var(--ui-btn-pad, 18px);
  border-radius: 999px;
  font-size: var(--ui-btn-fs, 15px);
  font-weight: var(--fw-semibold, 600);
  box-shadow: none;
}

.acp-cta.ui-btn--main {
  min-height: var(--ui-btn-main-h, 48px);
  border-color: var(--ps-accent);
  background: var(--ps-accent);
  color: var(--color-on-main);
}

.acp-cta.ui-btn--main:hover:not(:disabled) {
  border-color: var(--color-text);
  background: var(--color-text);
}

.acp-cta.ui-btn--secondary {
  border-color: var(--ui-line, var(--color-line));
  background: var(--ps-surface, var(--color-card));
  color: var(--ps-text);
}

.acp-cta.ui-btn--secondary:hover:not(:disabled) {
  background: var(--ps-surface-soft);
}

/* Quiet text actions in a card (Reschedule, Cancel session) are 44 px tap targets at every
   width; Cancel session reads as danger text, not a bright red link. */
.ps-stage-body .acp-inline-link {
  min-height: 44px;
}

.ps-stage-body .acp-inline-link--danger {
  color: var(--ps-red, #b42318);
}

/* -- Windows that keep their own markup wear the UiDialog frame (radius, backdrop, × 44 px) ---- */
.ps-modal .ps-modal-head h2,
.ps-modal .ps-modal-title {
  font-size: var(--ui-title-fs, 17px);
  font-weight: 600;
  line-height: 1.25;
}

.ps-modal .ps-dlg-x,
.ps-modal .ps-modal-head .ps-icon-btn {
  width: var(--ui-x-size, 44px);
  height: var(--ui-x-size, 44px);
  border: 0;
  border-radius: 999px;
  color: var(--ps-text-soft);
  font-size: var(--fs-24, 24px);
  line-height: 1;
}

.ps-modal .ps-dlg-x:hover,
.ps-modal .ps-modal-head .ps-icon-btn:hover {
  background: var(--ps-surface-soft);
  color: var(--ps-text);
}

/* Settings: the UiDialog card look (white, radius 18, one shadow, the 0.32 backdrop, no blur),
   a 44 px ×, the window title size; the card is no wider than a large window. */
.atlas-settings-overlay .atlas-settings-backdrop {
  background: rgba(21, 37, 30, 0.32);
  backdrop-filter: none;
}

.atlas-settings-overlay .atlas-settings-card {
  width: min(44rem, calc(100vw - 32px));
  margin: 20px auto;
  border: 1px solid var(--ps-border);
  border-radius: var(--ui-dialog-radius, 18px);
  background: var(--ps-surface, var(--color-card));
  box-shadow: 0 28px 90px rgba(21, 37, 30, 0.22);
}

.atlas-settings-overlay .atlas-settings-title {
  font-size: var(--ui-title-fs, 17px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

/* N3 (pfix2): the title block and × sit where UiDialog puts them: top left / top right, the same
   padding as .ui-dialog-head, so Settings no longer reads as a different window. */
.atlas-settings-overlay .atlas-settings-header {
  align-items: flex-start;
  padding: 20px 20px 14px;
}

.atlas-settings-overlay .atlas-settings-header .atlas-settings-close {
  margin: -4px -6px 0 0;
}

.atlas-settings-overlay .atlas-settings-close {
  width: var(--ui-x-size, 44px);
  height: var(--ui-x-size, 44px);
  border: 0;
  border-radius: 999px;
  font-size: var(--fs-24, 24px);
  line-height: 1;
}

.atlas-settings-overlay .atlas-settings-footer .ui-btn {
  border-radius: 999px;
}

@media (max-width: 760px) {
  .atlas-settings-overlay .atlas-settings-card {
    width: calc(100vw - 32px);
    margin: 16px auto;
    border-radius: var(--ui-dialog-radius, 18px);
  }
}

/* -- P-33: close motion for Settings and the People menu (open motion: patient-polish.css) ----- */
@media (prefers-reduced-motion: no-preference) {
  .atlas-settings-overlay.is-closing .atlas-settings-backdrop {
    animation: ps-dlg-fade-out 150ms ease forwards;
  }

  .atlas-settings-overlay.is-closing .atlas-settings-card {
    animation: ps-dlg-sink 200ms ease forwards;
  }

  .atlas-settings-overlay.is-closing {
    pointer-events: none;
  }

  .ps-evals-menu:not([hidden]) {
    animation: ps-dlg-rise 150ms ease backwards;
  }

  .ps-evals-menu.is-closing {
    animation: ps-dlg-sink 150ms ease forwards;
    pointer-events: none;
  }
}

/* -- People helping out: Edit / Remind / Remove are secondary buttons on one line ------------- */
.ps-informant-person .ui-btn,
.ps-informant-rows > .ps-informant-add.ui-btn {
  font-size: var(--fs-14, 14px);
}

.ps-informant-person .ui-btn {
  padding: 0 14px;
}

/* The roster's own rules (patient-shell.css .ps-informant-nudge: a filled accent pill;
   patient-polish.css) load after the shared classes, so the standard looks are restated here. */
.ps-informant-rows .ui-btn {
  min-height: var(--ui-btn-h, 44px);
  border-radius: 999px;
  font-weight: var(--fw-semibold, 600);
  gap: 6px;
}

.ps-informant-rows .ui-btn.ui-btn--secondary {
  border: 1px solid var(--ui-line, var(--color-line));
  background: var(--ps-surface, var(--color-card));
  color: var(--ps-text);
}

.ps-informant-rows .ui-btn.ui-btn--secondary:hover:not(:disabled) {
  border-color: var(--ui-line, var(--color-line));
  background: var(--ps-surface-soft);
  color: var(--ps-text);
}

.ps-informant-rows .ui-btn.ui-btn--main {
  min-height: var(--ui-btn-main-h, 48px);
  padding: 0 var(--ui-btn-pad, 18px);
  border: 1px solid var(--ps-accent);
  background: var(--ps-accent);
  color: var(--color-on-main);
}

.ps-informant-rows .ui-btn.ui-btn--main:hover:not(:disabled) {
  background: var(--color-text);
  border-color: var(--color-text);
}

.ps-informant-nudge.ui-btn:disabled {
  opacity: 1;
  color: var(--ps-text-dim);
}

@media (max-width: 760px) {
  /* The words alone on a phone, so Edit, Remind and Remove share one line. */
  .ps-informant-person .ui-btn > i {
    display: none;
  }

  .ps-informant-person .ui-btn {
    padding: 0 12px;
  }
}

/* -- Report tab: the two "what next" lines under Download (P2-36) --------------------------- */
.ps-report-next {
  margin: 16px 0 0;
  padding: 0 0 0 18px;
  color: var(--ps-text-soft);
  font-size: var(--fs-14, 14px);
  line-height: 1.5;
}

.ps-report-next li + li {
  margin-top: 6px;
}

/* Apricot list markers: decoration only (--color-decor, never text), as in the Evergreen picture. */
.ps-report-next li::marker {
  color: var(--color-decor);
}

/* The brand link is a 44 px tap target too. */
.ps-header .ps-header-brand {
  min-height: 44px;
}

/* -- 44 px tap targets at every width (not only under 760 px) ------------------------------- */
.ps-stage-body .fbq-prompt-cta,
.ps-stage-body .fbq-prompt-dismiss,
.ps-stage-body .sp-cta-daily {
  min-height: 44px;
}

.ps-stage-body .fbq-prompt-cta {
  font-size: var(--fs-15, 15px);
}

/* -- "A couple of details first" and "Add a person": the window buttons at the standard sizes -- */
.ps-modal .ps-btn.ui-btn {
  min-height: var(--ui-btn-h, 44px);
  padding: 0 var(--ui-btn-pad, 18px);
  border-radius: 999px;
  font-size: var(--ui-btn-fs, 15px);
  font-weight: var(--fw-semibold, 600);
}

.ps-modal .ps-btn.ui-btn--main {
  min-height: var(--ui-btn-main-h, 48px);
}

/* -- Layout QA round 2: every patient control is a 44 px tap target, every field the patient input
   height. One block for the shell's own markup (the older sheets drew 36-40 px): ------------------ */

/* "Add a person" and other shell windows: inputs and selects at the patient input height (48 px). */
.ps-modal-field input,
.ps-modal-field select {
  min-height: var(--input-h, 48px);
}

/* A checkbox or radio is tapped through its whole row (the label): each row is at least 44 px
   tall ("People helping out" topics, "Invite to session" choices). */
.ps-modal-check,
.acp-invite-option {
  min-height: 44px;
}

/* The People menu's rows (a person, "Add person") at every width; the phone rule already did 44. */
.ps-eval-tabs--menu .ps-tab,
.ps-eval-tabs--menu .ps-tab-more {
  min-height: 44px;
}

/* Settings: "Sign out" at the standard button height, and the × keeps its 44 px square on a phone
   (the header's flex row squeezed it to 43 px). */
.atlas-settings-overlay .atlas-settings-footer .ui-btn {
  min-height: var(--ui-btn-h, 44px);
}

.atlas-settings-overlay .atlas-settings-close {
  flex: none;
}

/* Voice buttons in the shell's text boxes (Feedback & Questions): 44 px, not the clinician's 34. */
.st-mic--icon {
  width: 44px;
  height: 44px;
}

/* ---- Codex visual review, run 3 (vfixp, 2026-11-12) ---------------------------------------
   People helping out rows: the person's name leads in the main text colour; the relationship
   and the invitation / progress line use the readable soft text (they were the 0.48 dim
   token, ~2.6:1 on white, while the buttons beside them dominated). */
.ps-informant-person--flat .ps-informant-name {
  color: var(--ps-text);
  font-size: var(--fs-14, 14px);
  font-weight: 600;
}

.ps-informant-person--flat .ps-informant-role-sub,
.ps-informant-person--flat .ps-informant-progress {
  color: var(--ps-text-soft);
  font-size: var(--fs-13, 13px);
  font-weight: 400;
}

/* Invite to session: each choice is the radio, then the name with its relationship under it,
   so the relationships start on one line instead of after names of different lengths. */
.acp-invite-modal .acp-invite-option {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
}

.acp-invite-modal .acp-invite-option > input[type="radio"] {
  grid-row: 1 / span 2;
}

.acp-invite-modal .acp-invite-option-role {
  grid-column: 2;
}

/* The Session tab's note ("Nov 16, 12:00 PM EST") may take a second, balanced line on a phone
   instead of losing the time zone to "…" (Codex run 3). */
@media (max-width: 600px) {
  .ui-tabs.ps-stage-tabs > .ui-tab .ui-tab__note {
    white-space: normal;
    text-wrap: balance;
  }
}

/* Session, waiting only on the people helping out: a plain block inside the card (no amber box,
   no lock), the hourglass in the soft text colour; the person's state reads in soft text. */
.acp-evidence-notice--waiting {
  padding: 0;
  border: none;
  background: transparent;
}

.acp-evidence-notice--waiting .acp-evidence-notice-icon {
  color: var(--ps-text-soft);
}

.acp-waiting-progress {
  color: var(--ps-text-soft);
}

/* A finished state ("Evidence submitted", "Session complete") shows its check in the success
   green the Done tabs use, not the accent (Codex run 3: coral check beside green Done). */
.acp-waiting-icon:has(> .fa-circle-check) {
  background: var(--ps-green-bg);
  color: var(--ps-green);
}

/* Settings on a phone: the overlay is a grid with 22 px padding, and shell-settings.css's id
   rule gave the card 100vw - 28px, wider than the space left, so it hung 22 px from the left
   and 6 px from the right. The card now fills the overlay's space (16 px each side on a phone),
   centred. Group titles in the readable soft text, and the "You" chip in sentence case like
   every label (Codex run 3). */
#ps-settings-overlay .atlas-settings-card {
  width: min(44rem, 100%);
  justify-self: center;
}

@media (max-width: 760px) {
  #ps-settings-overlay.atlas-settings-overlay {
    padding: 16px;
  }
}

#ps-settings-overlay .shset-group-label {
  color: var(--ps-text-soft);
}

#ps-settings-overlay .shset-you-chip {
  letter-spacing: 0;
  text-transform: none;
}
