/* --- A client's file (modules/clients/views/client.php), built like the Calendar: a white box with the client's name
   on the anthracite band, the grey bar (Back and the tabs on the left, Book on the right) and the grey footer, all from
   pages/calendar.css. Inside: the journey or the list of reports, and the tab's page. The box is the screen's height
   (never shorter than --client-min-h; a shorter screen scrolls the page) and its parts scroll inside it. From 992px the
   journey or the list is a sidebar on the left; below that it is a row above the page that scrolls sideways. --- */

.admin__page:has(> .client) {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--admin-top-h));
  height: calc(100dvh - var(--admin-top-h)); /* 100vh first for browsers without dvh */
  min-height: var(--client-min-h);
}

.client {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
}

/* The band: the name cut short with "…" when long; email and phone on the right from 576px. */
.client__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client__contact {
  display: none;
  gap: var(--sp-4);
}

/* Back as a link at the right end of the band, on pages whose bar would hold nothing else. */
.client__back {
  flex: none;
  font-size: var(--fs-small);
  color: inherit;
}

.client__name:has(~ .client__back) {
  margin-right: auto; /* the address and Back sit together at the right */
}

.client__contact + .client__back {
  margin-left: var(--sp-3); /* with the gap, 24px from the address */
}

/* The client's file is the page's main box (components/box.css): its 16px corners, not the order page's 8px. */
.client.box {
  border-radius: var(--radius-4);
}

/* The toolbar: 16px sides, as every box's bar (components/box.css), so the client's name lines up with "Clients" and the
   pages with Back; the client's name on the left, cut short with "…" when long; the pages on the right (one drop-down
   below 768px, its menu opening under it from the right); 12px above and below its 32px buttons, as the Clients list's
   toolbar (57px with its line). */
.client.box > .calendar__bar {
  padding: var(--sp-3) var(--sp-4);
}

.client__who {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--c-text);
}

.client__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sp-2);
}

.client__tools .client__menu {
  right: 0;
  left: auto;
}

.client__tabs {
  display: none;
}

.client__tab {
  margin-left: calc(-1 * var(--border-1)); /* neighbours share one line */
  border-radius: 0;
}

.client__tab:first-child {
  margin-left: 0;
  border-radius: var(--radius-1) 0 0 var(--radius-1);
}

.client__tab:last-child {
  border-radius: 0 var(--radius-1) var(--radius-1) 0;
}

.client__tab--off {
  color: var(--c-text-muted);
  cursor: default;
}

.client__tab-drop {
  position: relative;
}

.client__tab-drop > summary {
  gap: var(--sp-2);
}

.client__tab-drop > summary i {
  font-size: var(--fs-xxs);
}

/* The tabs' drop-down menu: a white panel under its button. */
.client__menu {
  position: absolute;
  top: calc(100% + var(--sp-1));
  left: 0;
  z-index: 2;
  display: grid;
  min-width: 100%;
  padding: var(--sp-2);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
  box-shadow: var(--shadow-1);
}

.client__menu-item {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-small);
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius-1);
}

.client__menu-item[aria-current="page"] {
  font-weight: 600;
  color: var(--c-accent-text);
  background-color: var(--c-chip);
}

.client__menu-item--off {
  color: var(--c-text-muted);
}

/* The tab's page: below 992px one column, the journey or the list on top and the page under it, scrolling. */
.client__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.client__main {
  flex: 1;
  min-height: 0;
  padding: var(--sp-4);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.client__h {
  margin-bottom: var(--sp-3);
  font-family: var(--font-heading);
  font-size: var(--fs-lead);
  font-weight: 400;
  line-height: var(--lh-heading);
  color: var(--c-heading);
}

.client__cols {
  display: grid;
  align-items: start;
  gap: var(--sp-4);
}

/* A section's heading: small capitals in a light grey box with a line all round; its rows under it. */
.client__band {
  margin-bottom: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  font-family: inherit;
  font-size: var(--fs-xxs);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-anthracite);
  background-color: var(--c-surface);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.client__row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--sp-3);
  padding: var(--sp-3);
  font-size: var(--fs-small);
  border-bottom: var(--border-1) solid var(--c-line);
}

.client__row dt {
  color: var(--c-text-muted);
}

.client__row dd {
  overflow-wrap: anywhere; /* a long email address wraps instead of running out of the box */
}

/* The journey or the list: off-white; below 992px a row above the page with a line under it. */
.client__side {
  flex: none;
  padding: var(--sp-4);
  background-color: var(--c-off-white);
  border-bottom: var(--border-1) solid var(--c-line);
}

/* The journey: its heading with the client's tag beside it, then a thin line with a dot for each step (the booking still
   to come has a blue ring). Below 992px the steps run left to right, newest first, and the row scrolls sideways. */
.client__journey {
  order: -1; /* after Details in the page, but shown first */
}

.client__journey-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.client__journey-head .client__h {
  margin-bottom: 0;
}

.client__steps {
  position: relative;
  isolation: isolate; /* the lines sit behind the dots */
  display: grid;
  grid-auto-columns: var(--client-step-w);
  grid-auto-flow: column;
  gap: var(--sp-4);
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}

.client__step {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: var(--sp-1);
  font-size: var(--fs-small);
  scroll-snap-align: start;
}

.client__step::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--sp-5));
  left: 0;
  width: var(--sp-2);
  height: var(--sp-2);
  background-color: var(--c-line);
  border-radius: var(--radius-pill);
}

.client__step::after { /* the line to the next step, so it ends at the last one */
  content: "";
  position: absolute;
  top: calc(-1 * var(--sp-5) + var(--sp-1));
  left: 0;
  right: calc(-1 * var(--sp-4));
  z-index: -1;
  height: var(--border-1);
  background-color: var(--c-line);
}

.client__step:last-child::after {
  display: none;
}

.client__step--coming::before {
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-menu-button);
}

.client__when {
  font-size: var(--fs-xxs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.client__step--coming .client__when {
  color: var(--c-accent-text);
}

.client__step strong {
  font-weight: 600;
}

.client__note,
.client__none {
  font-size: var(--fs-small);
  color: var(--c-text-muted);
}

/* Overview: the page's content with three boxes (light grey bars): Timeline, Contact and Care, stacked, scrolling inside
   the file. The lines between their rows stop at the boxes' padding. From 992px Timeline is on the left and its steps run down. */
.client__overview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.client__overview .dashboard__tile {
  overflow: clip; /* the bar follows the box's round corners */
}

.client__overview :is(dl, .client__rows) {
  margin: calc(-1 * var(--sp-2)) 0 calc(-1 * var(--sp-4));
}

.client__overview .client__row {
  padding-inline: 0; /* the words and the lines between rows start where the bar's title starts */
}

.client__overview .client__row:last-child,
.client__rows .client__qa:last-child {
  border-bottom: 0;
}

/* Reports: the list in its box (no sidebar padding of its own), and the open report's parts, each under its heading in
   the same small capitals as the list's groups. */
.client__path .client__list {
  min-width: 0; /* the row of reports scrolls sideways inside the box instead of widening it */
}

.client__path .client__picker {
  margin-top: calc(-1 * var(--sp-2));
}

.client__path .client__group {
  padding-inline: 0;
}

.client__path .client__group:first-of-type {
  padding-top: 0;
}

.client__path .client__group + .client__set .client__none {
  padding-inline: 0;
}

.client__rows .client__qa {
  padding-inline: 0;
}

.client__part {
  padding: var(--sp-5) 0 var(--sp-2);
  font-family: inherit;
  font-size: var(--fs-xxs);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-anthracite);
  border-bottom: var(--border-1) solid var(--c-line);
}

.client__part:first-child {
  padding-top: var(--sp-4);
}

.client__path .client__steps {
  padding-bottom: 0;
}

/* Consultations: Booking's heading with the consultation's status chip on its right; its rows, then Change time and
   Cancel; then the summary, folded under a heading like the parts', with its line above it (and under it while open). */
.client__part--tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.client__part--tag h3 {
  font: inherit;
}

.client__part--tag .dashboard__tag { /* not the heading's capitals */
  letter-spacing: normal;
  text-transform: none;
}

.client__overview .client__rows dl {
  margin: 0;
}

.client__rows .client__actions {
  padding: var(--sp-2) 0 var(--sp-4);
}

.client__fold--part > .client__fold-head {
  margin-bottom: 0;
  border-top: var(--border-1) solid var(--c-line);
}

.client__fold--part:not([open]) > .client__fold-head { /* shut, it ends the box: room under it, as above it */
  padding-bottom: var(--sp-4);
  border-bottom: 0;
}

.client__fold--part[open] { /* open, it ends the box: room under its buttons, as at the box's other edges */
  padding-bottom: var(--sp-4);
}

/* A summary sent for review: its text in place of the editor, then when it was sent. */
.client__summary {
  padding-top: var(--sp-3);
}

.client__summary-sent {
  margin-top: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.client__overview .client__pad { /* in a box: level with the rows */
  padding: var(--sp-3) 0;
}

/* Reports: from 992px the list in groups (Questionnaires, Blood tests, Lab tests) under their names. Below that, tabs
   across the full width pick the group (radio buttons, so no JavaScript), and its reports sit in one row that scrolls
   sideways. The open report has a pale blue fill. */
.client__group,
.client__set {
  display: none;
}

.client__group-box--questionnaires:checked ~ .client__set--questionnaires,
.client__group-box--blood:checked ~ .client__set--blood,
.client__group-box--lab:checked ~ .client__set--lab {
  display: block;
}

.client__picker {
  display: grid;
  grid-template-columns: repeat(3, auto); /* the full width, its spare room shared equally, so long names still fit */
  margin-bottom: var(--sp-3);
  border-bottom: var(--border-1) solid var(--c-line);
}

.client__pick {
  margin-bottom: calc(-1 * var(--border-1)); /* the chosen tab's line sits on the line under them */
  padding-block: var(--sp-2);
  font-size: var(--fs-small);
  text-align: center;
  white-space: nowrap;
  color: var(--c-text-muted);
  border-bottom: calc(2 * var(--border-1)) solid transparent;
  cursor: pointer;
}

.client__group-box--questionnaires:checked ~ .client__picker .client__pick--questionnaires,
.client__group-box--blood:checked ~ .client__picker .client__pick--blood,
.client__group-box--lab:checked ~ .client__picker .client__pick--lab {
  font-weight: 600;
  color: var(--c-text);
  border-bottom-color: var(--c-anthracite);
}

.client__group-box--questionnaires:focus-visible ~ .client__picker .client__pick--questionnaires,
.client__group-box--blood:focus-visible ~ .client__picker .client__pick--blood,
.client__group-box--lab:focus-visible ~ .client__picker .client__pick--lab {
  outline: var(--border-1) solid var(--c-action);
  outline-offset: calc(-1 * var(--border-1));
}

.client__reports {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.client__reports li {
  flex: none;
}

.client__group {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  font-family: inherit;
  font-size: var(--fs-xxs);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-anthracite);
}

.client__group:first-of-type {
  padding-top: var(--sp-2);
}

.client__group + .client__set .client__none {
  padding-inline: var(--sp-3);
}

.client__reports form {
  display: block;
}

.client__report {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  font-size: var(--fs-small);
  text-align: start;
  white-space: nowrap;
  color: var(--c-text);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
  cursor: pointer;
}

.client__report > span {
  display: grid;
}

.client__report strong {
  font-weight: 600;
}

.client__report span span {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.client__report i {
  font-size: var(--fs-body);
  color: var(--c-text-muted);
}

.client__report[aria-current] {
  background-color: var(--c-chip);
  border-color: var(--c-chip);
}

.client__report[aria-current] strong {
  color: var(--c-accent-text);
}

.client__report[aria-current] i {
  color: var(--c-menu-button);
}

/* Consultations: the list as on Reports, upcoming dates in blue and cancelled ones crossed out. Below 992px both groups
   share one row that scrolls sideways. */
.client__report--coming strong {
  color: var(--c-accent-text);
}

.client__report--off strong {
  color: var(--c-text-muted);
  text-decoration: line-through;
}

.client__sets {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.client__sets .client__reports {
  overflow-x: visible;
}

.dashboard__tag.client__tag--planned { /* beats .dashboard__tag, which loads after this file */
  color: var(--c-accent-text);
  background-color: var(--c-chip);
}

.dashboard__tag.client__tag--completed {
  color: var(--c-success-text);
  background-color: var(--c-success-bg);
}

.dashboard__tag.client__tag--cancelled {
  color: var(--c-error);
  background-color: var(--c-error-bg);
}

/* The summary (and Orders' folds): folded shut until their heading is clicked; the chevron turns when open. */
.client__fold-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: 0;
  list-style: none;
  cursor: pointer;
}

.client__fold-head::-webkit-details-marker { /* Safari: hide its own triangle */
  display: none;
}

.client__fold[open] > .client__fold-head {
  margin-bottom: var(--sp-1);
}

.client__fold-title {
  font: inherit;
}

.client__fold-icon {
  margin-left: auto;
  transition: transform var(--duration-base);
}

.client__fold[open] .client__fold-icon {
  transform: rotate(180deg);
}

button.client__menu-item {
  font-family: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.client__menu form {
  display: grid;
}

.client__actions {
  display: flex;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
}

.client__action { /* Change time and Cancel: shown, but off until the cancellation policy is decided */
  padding: 0;
  font: inherit;
  color: var(--c-action);
  text-decoration: underline;
  background: none;
  border: 0;
}

.client__action--danger {
  color: var(--c-error);
}

.client__action:disabled {
  cursor: default;
}

.client__pad {
  padding: var(--sp-3);
}

/* The summary and a new note: the editor (TinyMCE) in place of the text box, its status and buttons under it. */
.client__editor {
  margin-top: var(--sp-2);
}

.client__editor .field:has(.tox-tinymce) .field__label {
  display: none; /* the band above names it; the editor's frame carries the name for screen readers */
}

.client__editor .tox-tinymce {
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.client__editor .field:has([aria-invalid="true"]) .tox-tinymce {
  border-color: var(--c-error);
}

.client__editor-foot {
  display: flex;
  margin-top: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.client__editor-buttons {
  display: flex;
  gap: var(--sp-2);
  margin-left: auto;
}

.client__sent {
  color: var(--c-success-text);
}

/* Orders: New order (the anthracite glass button) full width at the top of the list. */
.client__new {
  width: 100%;
  margin-bottom: var(--sp-3);
}

.dashboard__tag.client__tag--review {
  color: var(--c-warning-text);
  background-color: var(--c-warning-bg);
}

/* Adding a product: the product, then Quantity and the grey + (as tall as the fields), on one row where there is room. */
.client__add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--field-h);
  align-items: start; /* an error under a field never stretches the + */
  gap: var(--sp-2);
  padding-top: var(--sp-3);
}

.client__add-product {
  grid-column: 1 / -1;
}

.client__plus {
  display: grid;
  place-items: center;
  height: var(--field-h);
  padding: 0;
  font-size: var(--fs-lead);
  color: var(--c-text);
  background-color: var(--c-surface);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
  cursor: pointer;
}

/* An order's products, under Prescription and Non-prescription headings: name, size and group (or the shop's line) and
   the dose; how many on the right (− and + while it can be changed). Phones: one under the other. */
.client__lines {
  display: grid;
  border-bottom: var(--border-1) solid var(--c-line);
}

.client__line {
  display: grid;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  font-size: var(--fs-small);
  border-top: var(--border-1) solid var(--c-line);
}

.client__line:first-child {
  border-top: 0;
}

.client__line-name {
  display: grid;
  gap: var(--sp-1);
}

.client__line-name strong {
  font-weight: 600;
}

.client__line-sub {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

/* Change dose: a fold under the product's name (a <details>, so no JavaScript): a light grey row with the dose, Change
   dose and an arrow; open, the product's default dose and the form two by two under it, then Save dose. From 576px the
   name and how many share the first row and the fold takes the second; phones: name, dose, how many. */
.client__dose-fold {
  grid-column: 1 / -1;
}

.client__dose-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  list-style: none;
  cursor: pointer;
  background-color: var(--c-off-white);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.client__dose-head::-webkit-details-marker { /* Safari: hide its own triangle */
  display: none;
}

.client__dose-head > .bi-capsule {
  color: var(--c-text-muted);
}

.client__dose-change {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.client__dose-icon {
  font-size: var(--fs-xs);
  transition: transform var(--duration-fast) var(--ease);
}

[open] > .client__dose-head {
  border-radius: var(--radius-1) var(--radius-1) 0 0;
}

[open] > .client__dose-head .client__dose-icon {
  transform: rotate(180deg);
}

.client__dose-body {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-3);
  font-size: var(--fs-body);
  border: var(--border-1) solid var(--c-line);
  border-top: 0;
  border-radius: 0 0 var(--radius-1) var(--radius-1);
}

.client__dose-default {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  border-radius: var(--radius-1);
}

.client__dose-default i {
  margin-right: var(--sp-1);
}

.client__dose-default .client__action {
  margin-left: auto;
  cursor: pointer;
}

.client__dose-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--sp-2);
}

.client__dose-wide,
.client__dose-buttons {
  grid-column: 1 / -1;
}

.client__dose-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.client__kind-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding-inline: var(--sp-2);
  font-size: var(--fs-xxs);
  font-weight: 600;
  line-height: var(--sp-5);
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  border-radius: var(--radius-pill);
}

.client__kind-tag--rx {
  color: var(--c-warning-text);
  background-color: var(--c-warning-bg);
}

.client__line-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.client__qty {
  display: flex;
  align-items: center;
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.client__qty button,
.client__remove {
  display: grid;
  place-items: center;
  width: var(--sp-8);
  height: var(--sp-8);
  padding: 0;
  color: var(--c-text-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.client__qty button:disabled {
  opacity: 0.5;
  cursor: default;
}

.client__qty output {
  min-width: var(--sp-6);
  font-weight: 600;
  text-align: center;
}

/* An order's summary: each product's name over its size and group, how many and the dose beside it; Edit order and
   Delete, then (a draft) Send for review under a line. */
.client__row-name {
  display: block;
  font-weight: 600;
  color: var(--c-text);
}

.client__row dt .client__line-sub {
  display: block;
}

.client__row dd .client__kind-tag {
  margin-left: var(--sp-1);
}

.client__rows > .client__order-foot {
  margin-top: 0;
  padding: var(--sp-3) 0 var(--sp-4);
  border-top: var(--border-1) solid var(--c-line);
}

/* Edit order: the pop-up as wide as a 720px column, no taller than the screen (its middle scrolls), the product picker
   and the lines with their buttons inside, each with its dose fold. */
.dialog.client__dialog {
  max-width: var(--container-md);
}

.client__dialog .dialog__form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2 * var(--sp-4));
  max-height: calc(100dvh - 2 * var(--sp-4)); /* 100vh first for browsers without dvh */
}

.client__dialog-body {
  padding-top: var(--sp-4);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.client__dialog-body .client__add {
  padding-top: 0;
}

.client__dialog-body .client__lines {
  border-bottom: 0;
}

.client__dialog-body .client__line {
  padding-inline: 0;
}

.client__dialog-foot > :last-child { /* Done on the right */
  margin-left: auto;
}

/* Show older notes: centred above the notes shown. */
.client__older {
  display: flex;
  justify-content: center;
  padding-top: var(--sp-3);
  font-size: var(--fs-xs);
}

/* Private notes: a conversation, oldest first; each note with who wrote it, their role and when. */
.client__notes {
  display: grid;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
}

.client__note {
  display: flex;
  align-items: start;
  gap: var(--sp-3);
}

.client__note .clients__avatar {
  display: none;
  flex: none;
}

.client__note-box { /* a white bubble, its corner by the avatar less round, as in a chat */
  flex: 1;
  min-width: 0;
  padding: var(--sp-2) var(--sp-3);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1) var(--radius-2) var(--radius-2);
}

.client__note-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--sp-2);
  margin-bottom: var(--sp-1);
  font-size: var(--fs-xs);
}

.client__note-top strong {
  font-size: var(--fs-small);
  font-weight: 600;
}

.client__note-role {
  color: var(--c-accent-text);
}

.client__note-when {
  margin-left: auto;
  color: var(--c-text-muted);
}

.client__note-text {
  display: grid;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.client__note-text :is(ul, ol) {
  padding-left: var(--sp-5);
}

.client__note-text ul {
  list-style: disc;
}

.client__note-text ol {
  list-style: decimal;
}

.client__note-text :is(h2, h3) {
  font-family: var(--font-heading);
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--c-heading);
}

.client__note-text a {
  color: var(--c-action);
}

.client__qa {
  padding: var(--sp-3);
  font-size: var(--fs-small);
  border-bottom: var(--border-1) solid var(--c-line);
}

.client__q {
  margin-bottom: var(--sp-1);
  color: var(--c-text-muted);
}

.client__a {
  white-space: pre-line; /* the patient's own line breaks */
}

.client__a :is(ul, ol) {
  padding-left: var(--sp-5);
  white-space: normal;
}

.client__a ul {
  list-style: disc;
}

.client__a ol {
  list-style: decimal;
}

.client__a--none {
  font-style: italic;
  color: var(--c-text-muted);
}

.client .calendar__foot i {
  margin-right: var(--sp-1);
}

@media (hover: hover) {
  .client__report:not([aria-current]):hover,
  .client__menu-item:not(.client__menu-item--off):not([aria-current]):hover {
    background-color: var(--c-surface);
  }
}

@media (min-width: 576px) {
  .client__contact {
    display: flex;
  }

  .client__note .clients__avatar {
    display: grid;
  }
  .client__add {
    grid-template-columns: minmax(0, 1fr) var(--client-qty-w) var(--field-h);
  }

  .client__add-product {
    grid-column: auto;
  }

  .client__line {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .client__line-tools { /* beside the name, above the dose */
    grid-column: 2;
    grid-row: 1;
  }
}

@media (min-width: 768px) {
  .client__tabs {
    display: flex;
  }

  .client__tab-drop {
    display: none;
  }

  .client__cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* From 992px: the journey or the list as a sidebar on the left, the same width on both tabs, scrolling inside the box. */
@media (min-width: 1200px) {
  .admin__page:has(> .client) {
    height: 100vh;
    height: 100dvh; /* no top bar beside the sidebar */
  }
}

@media (min-width: 992px) {
  .client__body {
    flex-direction: row;
  }

  .client__overview { /* up to three boxes stacked on the right (Overview: Contact, Care, private notes), then the rest */
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    grid-template-rows: auto auto auto 1fr;
  }

  .client__path { /* the left box: the full height, beside them all */
    grid-row: 1 / -1;
  }

  /* Reports: both boxes at the screen's height; a long report scrolls inside its box, under its bar. */
  .client__reading {
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .client__reading .client__path {
    grid-row: auto;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .client__path .client__list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .client__reading .client__read { /* beats .dashboard__tile's grid, which loads after this file */
    display: flex;
    flex-direction: column;
    align-self: start; /* a short report ends where it ends */
    max-height: 100%;
  }

  .client__read .client__rows {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .client__path .client__steps {
    grid-auto-columns: auto;
    grid-auto-flow: row;
    padding: 0 0 0 var(--sp-6);
    overflow: visible;
    scroll-snap-type: none;
  }

  .client__main {
    padding: var(--sp-6);
  }

  .client__side {
    width: var(--client-side-w);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: var(--border-1) solid var(--c-line);
    border-bottom: 0;
  }

  .client__journey {
    display: flex;
    flex-direction: column;
    padding: var(--sp-6) var(--sp-5);
  }

  .client__journey .client__steps {
    flex: 1;
    grid-auto-columns: auto;
    grid-auto-flow: row;
    align-content: start; /* a short journey keeps its spacing instead of spreading down the sidebar */
    min-height: 0;
    padding: 0 0 0 var(--sp-6);
    overflow-x: visible;
    overflow-y: auto;
    scroll-snap-type: none;
  }

  .client__step::before {
    top: var(--sp-1);
    left: calc(-1 * var(--sp-6) + var(--border-1));
  }

  .client__step::after { /* the line down to the next step */
    top: var(--sp-1);
    bottom: calc(-1 * var(--sp-4) - var(--sp-1));
    left: calc(-1 * var(--sp-6) + var(--sp-1));
    right: auto;
    width: var(--border-1);
    height: auto;
  }

  .client__picker {
    display: none;
  }

  .client__group,
  .client__list .client__set {
    display: block;
  }

  .client__reports {
    display: block;
    overflow-x: visible;
  }

  .client__sets {
    display: block;
    overflow-x: visible;
  }

  .client__report {
    width: 100%;
    white-space: normal;
    background-color: transparent;
    border-color: transparent;
  }

  .client__report[aria-current] {
    background-color: var(--c-chip);
    border-color: var(--c-chip);
  }
}
