/* The admin client page and the full lists behind its "See all" links.
   Design: the operator's "Client profile (admin version)", option 10a.
   White cards on the app's own background, one narrow column, green only
   for what can be clicked. The admin DSP page (dsp_page.css) wears the same
   tokens, width and cards, so the two read as one product. */
.client-page,
.dsp-page {
  --profile-green: #2e7d52;
  --profile-green-dark: #226b46;
  --profile-green-soft: #ecf5ef;
  --profile-green-softer: #dceee3;
  --profile-raised: #f7f4ef;
  --profile-sunken: #e8e2d8;
  --profile-border: #e6e0d6;
  --profile-hairline: #efeae1;
  --profile-border-strong: #d8d1c4;
  --profile-ink: #15302e;
  --profile-ink-700: #33474a;
  --profile-ink-500: #5c6b6a;
  --profile-ink-400: #8a938f;
  --profile-success: #16804c;
  --profile-success-soft: #dcf1e5;
  --profile-warning: #d99a2b;
  --profile-warning-soft: #fbefd3;
  --profile-warning-ink: #8a5a12;
  --profile-danger: #e03a3a;
  --profile-danger-soft: #fbe2e1;
  --profile-danger-ink: #9b1c1c;

  display: flex;
  flex-direction: column;
  gap: 20px;
  color: var(--profile-ink);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;

  /* Clear the 64px top bar that stays put while the page scrolls. */
  & [id] { scroll-margin-top: calc(64px + 16px); }
}

/* Back link, header and jump links. */
.client-page__back {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: var(--profile-green);

  &:hover { color: var(--profile-green-dark); }
}
.client-page__back-icon { width: 18px; height: 18px; }

.client-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
.client-header__who {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 12rem;
}
.client-header__name {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.client-header__age { color: var(--profile-ink-500); }
.client-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-more {
  z-index: 20;
  min-width: 15rem;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--profile-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgb(21 48 46 / 0.12);
  list-style: none;
}
.client-more__item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--profile-ink-700);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;

  &:hover { background: var(--profile-raised); }
}
.client-more__item--danger { color: var(--profile-danger-ink); }

.client-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  /* A little room under the name, and close to the first card. */
  margin-bottom: -4px;

  & a {
    padding: 4px 0;
    color: var(--profile-ink-500);
    font-size: 15px;
    font-weight: 500;
    transition: color 150ms ease;

    &:hover { color: var(--profile-green); }
  }
}

/* Initials until there is a photo. */
.client-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid var(--profile-green);
  border-radius: 50%;
  background: #c9dccf;
  color: var(--profile-ink);
  font-weight: 700;
}
.client-avatar--large { width: 64px; height: 64px; font-size: 22px; }
.client-avatar--medium { width: 72px; height: 72px; font-size: 26px; }
.client-avatar--small { width: 44px; height: 44px; font-size: 15px; }
.client-avatar__photo { width: 100%; height: 100%; object-fit: cover; }

/* Buttons and links. */
.profile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--profile-border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--profile-ink-700);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;

  &:hover { background: var(--profile-raised); }
}
.profile-button--primary {
  border-color: var(--profile-green);
  background: var(--profile-green);
  color: #fff;

  &:hover { border-color: var(--profile-green-dark); background: var(--profile-green-dark); }
}
.profile-button--danger {
  border-color: var(--profile-danger-ink);
  background: var(--profile-danger-ink);
  color: #fff;

  &:hover { background: #7f1616; }
}
.profile-button--wide { width: 100%; }

.profile-link,
.profile-more {
  color: var(--profile-green);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;

  &:hover { color: var(--profile-green-dark); }
}
.profile-more {
  align-self: flex-start;
  padding-top: 12px;
}

/* The underlined actions at the end of a row. */
.profile-action {
  color: var(--profile-green);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  cursor: pointer;

  &:hover { color: var(--profile-green-dark); }
}
.profile-action--muted { color: var(--profile-ink-500); }
.profile-action--danger { color: var(--profile-danger-ink); }

.profile-quiet { color: var(--profile-ink-500); }
.profile-empty { color: var(--profile-ink-500); }

.profile-dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--profile-ink-400);
}
.profile-dot--small { width: 8px; height: 8px; }
.profile-dot--green { background: var(--profile-green); }
.profile-dot--red { background: var(--profile-danger); }
.profile-dot--amber { background: var(--profile-warning); }
.profile-dot--grey { background: #b8b2a7; }

/* Cards. */
.profile-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--profile-border);
  border-radius: 16px;
  background: #fff;

  @media (max-width: 640px) { padding: 20px 16px; }
}
.profile-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
}
.profile-card__title {
  color: var(--profile-ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}
.profile-card__title--spaced { padding-bottom: 12px; }
.profile-card__subtitle {
  margin-top: 4px;
  color: var(--profile-ink-500);
  font-size: 15px;
}
.profile-card__count { color: var(--profile-ink-500); font-size: 15px; }
/* A count in small grey beside the title, centred on it: "Sophia's people 15 people". */
.profile-card__title--with-count {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;

  & .profile-card__count { font-weight: 400; line-height: 1; }
}
/* The add-coverage pop-up lets its person pickers drop below the box. */
.coverage-dialog .modal-box { overflow: visible; }
.profile-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 12px;
}

/* Rows in a card. The first row after a title has no line above it. */
.profile-list { display: flex; flex-direction: column; }
.profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--profile-hairline);
}
.profile-list > .profile-row:first-child,
.profile-list > turbo-frame:first-child { border-top: 0; }
.profile-list--continued > :first-child { border-top: 1px solid var(--profile-hairline); }
.profile-row__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.profile-row__kicker { color: var(--profile-ink-500); font-size: 14px; }
.profile-row__name {
  color: #1f3a38;
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.profile-row__detail {
  color: var(--profile-ink-500);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.profile-row__detail--warning { color: var(--profile-warning-ink); }
.profile-row__small { color: var(--profile-ink-500); font-size: 14px; }
.profile-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
}
.profile-row__form { display: inline; }

/* Needs your attention. */
.client-attention {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;

  & > .client-attention { padding-top: 0; }
}
.client-attention__row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  line-height: 1.5;

  & .profile-dot { transform: translateY(-1px); }
}
.client-attention__title {
  color: var(--profile-green);
  font-weight: 600;

  &:hover { color: var(--profile-green-dark); }
}
.client-attention__text {
  margin-left: 8px;
  color: var(--profile-ink-700);
}

/* Scheduled shifts: the month, and the chosen day beside it. */
.shift-calendar {
  display: grid;
  /* 360px for the day, less when the app's menu leaves the page narrow. */
  grid-template-columns: minmax(0, 1fr) min(360px, 42%);
  gap: 24px;

  @media (max-width: 900px) { grid-template-columns: minmax(0, 1fr); }
}
.shift-calendar__month { display: flex; flex-direction: column; gap: 14px; }
.shift-calendar__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  & .profile-card__title { white-space: nowrap; }
}
.shift-calendar__nav { display: flex; align-items: center; gap: 6px; }
.shift-calendar__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--profile-ink-700);
  font-size: 22px;
  transition: background 150ms ease;

  &:hover { background: var(--profile-raised); }
}
.shift-calendar__title {
  min-width: 120px;
  color: var(--profile-ink-700);
  font-weight: 600;
  text-align: center;
}
.shift-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.shift-calendar__weekday {
  padding: 4px 0;
  color: var(--profile-ink-500);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.shift-calendar__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 56px;
  border-radius: 10px;
  color: var(--profile-ink);
  transition: background 150ms ease;

  &:is(a):hover { background: var(--profile-raised); }
}
.shift-calendar__day--outside { opacity: 0.35; }
.shift-calendar__day--selected,
.shift-calendar__day--selected:is(a):hover { background: var(--profile-green-soft); }
.shift-calendar__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.shift-calendar__day--today .shift-calendar__number {
  background: var(--profile-green);
  color: #fff;
  font-weight: 700;
}
.shift-calendar__dots {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 9px;

  & .profile-dot { width: 7px; height: 7px; }
}
.shift-calendar__more {
  color: var(--profile-ink-500);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.shift-calendar__day-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 24px;
  border-left: 1px solid var(--profile-border);

  @media (max-width: 900px) {
    padding: 20px 0 0;
    border-top: 1px solid var(--profile-border);
    border-left: 0;
  }
}
.shift-calendar__day-title {
  display: flex;
  align-items: center;
  height: 36px;
  font-size: 18px;
  font-weight: 700;
}
.shift-calendar__shifts {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}
.shift-calendar__shift {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -8px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 150ms ease;

  &:hover { background: var(--profile-raised); }
}
.shift-calendar__time {
  min-width: 150px;
  color: var(--profile-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.shift-calendar__dsp { color: var(--profile-ink-500); font-size: 15px; }
.shift-calendar__rest {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0 0 20px;
  font-size: 15px;

  & > span { color: var(--profile-ink-500); }
  & .profile-link { font-size: 15px; }
}

/* The care plan card has its own stylesheet, care_plan.css. */

/* The client's information. */
.client-info__title { padding-bottom: 16px; }
.client-info__ids {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--profile-hairline);
  border-radius: 12px;
  background: var(--profile-raised);
}
.client-info__id {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px 20px;

  & + & { border-left: 1px solid var(--profile-border); }
}
.client-info__id-label { color: var(--profile-ink-500); font-size: 14px; }
.client-info__id-value {
  overflow: hidden;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}
.client-info__group {
  padding: 18px 0 4px;
  color: var(--profile-ink-500);
  font-size: 15px;
  font-weight: 700;
}
.client-info__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--profile-hairline);
}
.client-info__label { color: var(--profile-ink-500); }
.client-info__value {
  color: var(--profile-ink);
  font-size: 17px;
  overflow-wrap: anywhere;
  text-align: right;

  & b { font-weight: 600; }
}
.client-info__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.client-info__chip {
  padding: 3px 12px;
  border: 1px solid var(--profile-border);
  border-radius: 999px;
  background: var(--profile-raised);
  color: var(--profile-ink-700);
  font-size: 15px;
  font-weight: 600;
}
.client-info__emails {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

/* Locations and documents: a round or rounded icon at the start of a row. */
.location-row__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--profile-green-soft);
  color: var(--profile-green);
}
.location-row__glyph { width: 20px; height: 20px; }
/* An open edit form takes the whole row. */
.location-row:has(> form) { display: block; }
.document-row__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--profile-raised);
  color: var(--profile-ink-700);
}

.document-upload {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--profile-raised);
}
.document-upload__type {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--profile-ink-500);
  font-size: 15px;
}
.document-upload__drop {
  padding: 24px;
  border: 2px dashed var(--profile-border-strong);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  cursor: pointer;

  &:hover { border-color: var(--profile-green); }
}
.document-upload__progress {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--profile-sunken);
}
.document-upload__bar {
  width: 0;
  height: 100%;
  background: var(--profile-green);
  transition: width 200ms ease;
}

/* About. */
.about-me { gap: 18px; }
.about-me__header { display: flex; align-items: center; gap: 20px; }
.about-me__columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;

  @media (max-width: 640px) { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
.about-me__column { display: flex; flex-direction: column; min-width: 0; }
.about-me__heading {
  padding-bottom: 4px;
  color: var(--profile-ink-500);
  font-size: 15px;
  font-weight: 700;
}
.about-me__item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; }
.about-me__label { color: var(--profile-ink-500); font-size: 15px; }
.about-me__text {
  color: var(--profile-ink);
  line-height: 1.5;
  white-space: pre-line;
  text-wrap: pretty;
}

/* Notes. */
.note-row { align-items: baseline; }
.note-row__text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--profile-ink);
  font-size: 17px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* MAR. */
.mar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: baseline;
}
.mar-row__when { display: flex; flex-direction: column; gap: 2px; }
.mar-row__what { color: var(--profile-ink); font-size: 17px; }
.mar-row__comment { color: var(--profile-ink-700); line-height: 1.5; }
.mar-row__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--profile-ink-700);
  font-size: 15px;
  white-space: nowrap;
}

/* Past shifts. */
.past-shifts { overflow-x: auto; }
.past-shifts__table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;

  & th {
    padding: 0 12px 6px 0;
    color: var(--profile-ink-500);
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    vertical-align: bottom;
  }
  & td {
    padding: 10px 12px 10px 0;
    color: var(--profile-ink);
    white-space: nowrap;
  }
  /* The status may wrap, so the row fits beside the app's menu. */
  & td:nth-child(7) { white-space: normal; }
  & td:last-child { padding-right: 0; }
}
.past-shifts__stars { color: var(--profile-warning); letter-spacing: 1px; }
.past-shifts__stars--empty { color: var(--profile-border-strong); }
.past-shifts__status { display: inline-flex; align-items: center; gap: 8px; }
.past-shifts__view { text-align: right; }
.past-shifts__edited {
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--profile-warning-soft);
  color: var(--profile-warning-ink);
  font-size: 13px;
  font-weight: 600;
}

/* Activity history. */
.activity-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;

  @media (max-width: 640px) { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
.activity-row__when {
  color: var(--profile-ink-500);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.activity-row__what { color: var(--profile-ink); }

/* The quiet green link at the right of a card's title: "Edit →". */
.profile-card-action {
  padding: 0;
  border: 0;
  background: none;
  color: #5b8a6c;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;

  &:hover { color: var(--profile-green-dark); text-decoration: underline; }
}
.profile-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}
/* Pills: grey by default. */
.profile-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--profile-sunken);
  color: var(--profile-ink-700);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.profile-pill--green { background: var(--profile-success-soft); color: #11603a; }
.profile-pill--red { background: var(--profile-danger-soft); color: var(--profile-danger-ink); }
.profile-pill--blue { background: #e0ecfb; color: #1f5fa8; }
.profile-pill--amber { background: var(--profile-warning-soft); color: var(--profile-warning-ink); }

/* A person's role, under their name, with any pills after it. */
.person-row__role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--profile-ink-700);
  font-size: 15px;
}

/* A case manager's past coverage: "Past coverage" opens the list under
   their row, indented to their name, and closes it again. */
.past-coverage > summary {
  list-style: none;
  cursor: pointer;

  &::-webkit-details-marker { display: none; }
  &::after { content: "▾"; display: inline-block; margin-left: 4px; text-decoration: none; }
}
.past-coverage[open] > summary::after { content: "▴"; }
.past-coverage__list {
  display: none;
  flex-direction: column;
  margin: 0 0 12px 60px;
  padding: 0;
  list-style: none;
}
.person-row:has(.past-coverage[open]) + .past-coverage__list { display: flex; }
.past-coverage__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--profile-hairline);
  color: var(--profile-ink-700);

  &:last-child { border-bottom: 0; }
}
.past-coverage__name { color: var(--profile-ink); font-weight: 500; }
.past-coverage__now { color: var(--profile-success); font-weight: 600; }

/* Notes and history: the date in a grey column, then what happened. */
.profile-history { display: flex; flex-direction: column; }
.profile-history__line {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  grid-template-areas: "when what who";
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--profile-hairline);
}
.profile-history > .profile-history__line:first-child { border-top: 0; }
.profile-history__when { grid-area: when; color: var(--profile-ink-500); font-size: 15px; font-variant-numeric: tabular-nums; }
.profile-history__what {
  grid-area: what;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  color: var(--profile-ink);
  overflow-wrap: anywhere;
}
.profile-history__who { grid-area: who; color: var(--profile-ink-500); font-size: 14px; white-space: nowrap; }
.profile-history__open {
  color: var(--profile-green);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;

  &:hover { color: var(--profile-green-dark); }
}
.profile-history__more { align-self: flex-start; padding-top: 12px; }
.profile-history__finders {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-top: 12px;
}

/* The phone: Notes and history reads date · who, then what happened. */
@media (max-width: 640px) {
  .profile-card-action { font-size: 14px; }
  .profile-history__line {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "when who" "what what";
    gap: 2px 8px;
  }
  .profile-history__who { font-size: 12px; }
  .profile-history__who::before { content: "· "; }
  .profile-history__when { font-size: 12px; }
  .profile-history__what { font-size: 14px; }
}

/* The full lists behind "See all". */
.client-list__title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.client-list__search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.client-list__search-input {
  flex: 1;
  min-width: 14rem;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--profile-border-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;

  &:focus { outline: 2px solid var(--profile-green); outline-offset: 1px; }
}
/* The pager sits inside the list's card at the bottom, as on the
   dashboard's Schedule, and only when there is more than one page. */
.client-list__pages { margin-top: 12px; }
.client-list__pages > div { padding-inline: 0; background: none; }

/* Some words are shorter on a phone ("Add" for "Add a location"). */
.client-page .phone-only,
.dsp-page .phone-only { display: none; }

/* The phone. Design: the operator's phone frames for the same page. Smaller
   type, and rows that stack instead of squeezing into columns. */
@media (max-width: 640px) {
  .client-page,
  .dsp-page {
    gap: 16px;
    font-size: 15px;

    & .desktop-only { display: none; }
    & .phone-only { display: inline; }
  }

  .profile-card__title { font-size: 19px; }
  .profile-card__subtitle { margin-top: 2px; font-size: 13px; }
  .profile-button { min-height: 34px; padding: 0 14px; font-size: 14px; }
  .profile-card__header { flex-wrap: nowrap; padding-bottom: 8px; }
  .profile-link, .profile-more { font-size: 15px; }
  .profile-action { font-size: 14px; }
  .profile-row { gap: 12px; padding: 12px 0; }
  .profile-row__name { font-size: 15px; }
  .profile-row__detail { font-size: 13px; overflow-wrap: break-word; }
  .profile-row__kicker, .profile-row__small { font-size: 12px; }
  .person-row__role { font-size: 14px; }
  .past-coverage__list { margin-left: 52px; font-size: 14px; }
  .client-avatar--small { width: 40px; height: 40px; font-size: 14px; }

  /* Scheduled shifts. */
  .shift-calendar__day { height: 44px; }
  .shift-calendar__number { width: 28px; height: 28px; font-size: 14px; }
  .shift-calendar__day-title { height: auto; font-size: 16px; }
  .shift-calendar__time { min-width: 0; font-size: 14px; }
  .shift-calendar__dsp { font-size: 14px; }

  /* The client's information. */
  .client-info__id { padding: 10px 14px; }
  .client-info__id-label { font-size: 12px; }
  .client-info__id-value { font-size: 16px; }
  .client-info__group { padding-top: 14px; font-size: 13px; }
  .client-info__row { padding: 10px 0; }
  .client-info__label { font-size: 14px; }
  .client-info__value { font-size: 15px; }
  .client-info__phone { color: var(--profile-green); }
  .client-info__chip { font-size: 13px; }

  /* People: their ways to reach them stack at the right, so the name and
     details keep the width. */
  .person-row { align-items: flex-start; }
  .person-row .profile-row__actions { flex-direction: column; align-items: flex-end; gap: 6px; }

  /* Locations: Directions, Edit and Remove go under the address. */
  .location-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;

    & .profile-row__actions { grid-column: 2; justify-content: flex-start; padding-top: 4px; }
  }
  .location-row__icon { width: 40px; height: 40px; }

  /* About. */
  .about-me { gap: 10px; }
  .about-me__item { padding: 6px 0; }
  .about-me__heading, .about-me__label { font-size: 13px; }

  /* Notes. */
  .note-row__text { font-size: 15px; }

  /* Documents: a tap anywhere on the row opens the file. */
  .document-row { position: relative; }
  .document-row .profile-row__actions { display: none; }
  .document-row__icon { width: 40px; height: 40px; }
  .document-row__open {
    display: flex;
    color: var(--profile-ink-500);

    &::after { position: absolute; inset: 0; content: ""; }
  }
  .document-row__chevron { width: 18px; height: 18px; }

  /* MAR: the medicine and its status on one line, then when and who. */
  .mar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
  }
  .mar-row__when { display: none; }
  .mar-row .profile-row__body { grid-row: 1; grid-column: 1; }
  .mar-row__status { grid-row: 1; grid-column: 2; font-size: 13px; }
  .mar-row__what { font-size: 15px; font-weight: 600; }
  .mar-row__comment { font-size: 14px; }
  .mar-row__session { padding-top: 2px; font-size: 13px; }

  /* Past shifts: each shift is a few short lines instead of a table row. */
  .past-shifts { overflow: visible; }
  .past-shifts__table {
    display: block;

    & thead { display: none; }
    & tbody { display: flex; flex-direction: column; }
    /* Three lines: the day and its status; the time and the DSP; the care,
       the miles and the rating. The two zero-height breaks end the lines. */
    & tr {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      row-gap: 4px;
      padding: 12px 0;
      border-top: 1px solid var(--profile-hairline);
    }
    & tr::before, & tr::after { flex-basis: 100%; height: 0; content: ""; }
    & tr::before { order: 3; }
    & tr::after { order: 6; }
    & tr:first-child { border-top: 0; }
    & td { padding: 0; font-size: 14px; }
    & td:nth-child(1) { order: 1; flex: 1; font-size: 15px; font-weight: 700; }
    & td:nth-child(7) { order: 2; font-size: 13px; white-space: nowrap; }
    & td:nth-child(3) { order: 4; }
    & td:nth-child(2) { order: 5; }
    & td:nth-child(2)::before { content: "\00a0·\00a0"; }
    & td:nth-child(8) { order: 5; margin-left: auto; }
    & td:nth-child(4) { order: 7; color: var(--profile-ink-500); font-size: 13px; }
    & td:nth-child(5) { order: 7; color: var(--profile-ink-500); font-size: 13px; }
    & td:nth-child(5)::before { content: "\00a0·\00a0"; }
    & td:nth-child(6) { order: 8; margin-left: auto; }
  }

  /* Activity history: the time above what happened, a line between. */
  .activity-row {
    padding: 10px 0;
    border-top: 1px solid var(--profile-hairline);

    &:first-child { border-top: 0; }
  }
  .activity-row__when { font-size: 12px; }
  .activity-row__what { font-size: 14px; }
}
