/* --- The dashboard (modules/dashboard/views/dashboard.php): a greeting, then white tiles on the hexagons. Phones: two
   numbers a row, every other tile full width; from 768px four numbers a row and the lists two a row. --- */
/* The dashboard fills the screen's height (under the phone top bar), so Clients, the last tile, stretches down to the
   bottom; with more clients than fit, the page grows instead. Phones: five rows above Clients (the greeting, two rows
   of numbers, Coming up, Consultations held); from 768px three. */
.admin__page:has(> .dashboard) {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--admin-top-h));
  min-height: calc(100dvh - var(--admin-top-h)); /* 100vh first for browsers without dvh */
}

.dashboard {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, auto) 1fr;
  gap: var(--sp-5);
  /* Coming up's three rows (a day box with its padding, and the lines between them): the least height of Coming up and
     Consultations held, empty or not. */
  --dashboard-rows-h: calc(3 * (var(--sp-10) + 2 * var(--sp-2)) + 2 * var(--border-1));
}

.dashboard__hello {
  grid-column: 1 / -1;
  min-width: 0;
  margin-bottom: var(--sp-2);
}

/* One line, never wrapped: below 768px site.js (data-fit) grows it to fill the width, up to its desktop size; a name
   too long even at its CSS size is cut off with "…". */
.dashboard__hello h1 {
  overflow: hidden;
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  white-space: nowrap;
  text-overflow: ellipsis;
  --fit-max: var(--fs-hello-max);
}

.dashboard__hello p {
  margin-top: var(--sp-1);
  font-size: var(--fs-small);
  color: var(--c-text-muted);
}

.dashboard__tile {
  display: grid;
  align-content: start;
  gap: var(--sp-2);
  min-width: 0;
  padding: var(--sp-4);
  font-size: var(--fs-small);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
}

.dashboard__tile--half,
.dashboard__tile--wide {
  grid-column: 1 / -1;
  overflow: clip; /* the head's band follows the tile's round corners */
}

.dashboard__tile--half {
  grid-template-rows: auto minmax(var(--dashboard-rows-h), 1fr);
}

/* A number: what it counts (with its icon on the right), the number, and a short note. */
.dashboard__label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  color: var(--c-text-muted);
}

.dashboard__label i {
  margin-left: auto;
}

.dashboard__label,
.dashboard__note {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dashboard__number {
  font-family: var(--font-heading);
  font-size: var(--fs-h3);
  font-weight: 400;
  line-height: 1;
  color: var(--c-heading);
}

.dashboard__note {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

/* A list tile's head: an anthracite band across the top of the tile, its title in white small capitals, with a link or a
   note on the right. */
.dashboard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: var(--sp-8); /* the same height with or without a link on the right */
  margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  line-height: var(--lh-heading);
  color: var(--c-page);
  background-color: var(--c-anthracite);
}

.dashboard__head h2 {
  font-family: inherit;
  font-size: var(--fs-xxs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: inherit;
}

.dashboard__head > :last-child:not(h2) {
  flex: none; /* the note stays on one line; on the narrowest phones the title wraps instead */
  font-size: var(--fs-xxs);
  color: inherit;
}

.dashboard__head > a:last-child {
  font-size: var(--fs-xs); /* a link people tap stays a step bigger */
}

.dashboard__none {
  color: var(--c-text-muted);
}

/* Coming up: the day in a small box, then who and what, cut short with "…". */
.dashboard__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-2);
}

.dashboard__row + .dashboard__row {
  border-top: var(--border-1) solid var(--c-line);
}

.dashboard__date {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--sp-10);
  height: var(--sp-10);
  font-size: var(--fs-xs);
  line-height: var(--lh-heading);
  color: var(--c-text-muted);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.dashboard__date strong {
  font-size: var(--fs-body);
  color: var(--c-text);
}

.dashboard__what {
  display: grid;
  min-width: 0;
}

.dashboard__what > * {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dashboard__what strong {
  font-weight: 600;
}

.dashboard__what span {
  color: var(--c-text-muted);
}

/* Consultations held: a bar a month, this month darker. The bars fill the tile's height down to its bottom (beside
   Coming up, as tall as it). Each bar's height is a tenth of the column per step (--1 to --10, set by PHP: no style=""
   under the site's security headers); an empty month still shows a sliver. */
.dashboard__bars {
  display: flex;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
}

.dashboard__bar {
  display: grid;
  flex: 1;
  grid-template-rows: repeat(10, 1fr) auto;
}

.dashboard__bar-fill {
  grid-row: 10; /* --0: a sliver at the bottom */
  align-self: end;
  min-height: var(--sp-1);
  background-color: var(--c-bar);
  border-radius: var(--radius-1) var(--radius-1) 0 0;
}

.dashboard__bar-fill--1 { grid-row: span 1 / -2; }
.dashboard__bar-fill--2 { grid-row: span 2 / -2; }
.dashboard__bar-fill--3 { grid-row: span 3 / -2; }
.dashboard__bar-fill--4 { grid-row: span 4 / -2; }
.dashboard__bar-fill--5 { grid-row: span 5 / -2; }
.dashboard__bar-fill--6 { grid-row: span 6 / -2; }
.dashboard__bar-fill--7 { grid-row: span 7 / -2; }
.dashboard__bar-fill--8 { grid-row: span 8 / -2; }
.dashboard__bar-fill--9 { grid-row: span 9 / -2; }
.dashboard__bar-fill--10 { grid-row: span 10 / -2; }

.dashboard__bar-fill:not(.dashboard__bar-fill--0) {
  align-self: stretch; /* the steps fill their rows */
}

.dashboard__bar:last-child .dashboard__bar-fill {
  background-color: var(--c-menu-button);
}

.dashboard__bar-month {
  grid-row: -2 / -1; /* always the last row, under the bar */
  padding-top: var(--sp-1);
  font-size: var(--fs-xs);
  text-align: center;
  color: var(--c-text-muted);
}

/* Clients: a small table; the email only from 576px. */
.dashboard__table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard__table th {
  padding-block: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 400;
  text-align: left;
  color: var(--c-text-muted);
}

.dashboard__table td {
  padding-block: var(--sp-2);
  border-top: var(--border-1) solid var(--c-line);
  white-space: nowrap;
}

.dashboard__table td:first-child {
  white-space: normal; /* a long name wraps, so the table never runs out of its tile */
}

.dashboard__table :is(th, td) + :is(th, td) {
  padding-left: var(--sp-3);
}

.dashboard__table .dashboard__end {
  text-align: right;
}

.dashboard__wide {
  display: none;
}

/* Clients: Newest (sign-up) or A–Z, two choices on the band's right. The chosen one is a white pill; both lists are in
   the page and only the chosen one shows. Each choice is 24px high for a finger (its label, reaching over the band's
   padding so the band keeps its height), with a 16px pill inside. */
.dashboard__sort {
  display: flex;
  flex: none;
  gap: var(--sp-1);
  margin: calc(-1 * var(--sp-1)) 0;
  padding: 0;
  border: 0;
}

.dashboard__sort label {
  padding-block: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}

.dashboard__sort span {
  display: block;
  padding-inline: var(--sp-2);
  line-height: var(--sp-4);
  border-radius: var(--radius-pill);
}

.dashboard__sort :checked + span {
  color: var(--c-anthracite);
  background-color: var(--c-page);
}

.dashboard__sort :focus-visible + span {
  outline: var(--border-1) solid var(--c-page); /* the site's soft blue ring would not show on the dark band */
  outline-offset: var(--border-1);
}

.dashboard__by-name,
.dashboard__tile:has([value="name"]:checked) .dashboard__by-new {
  display: none;
}

.dashboard__tile:has([value="name"]:checked) .dashboard__by-name {
  display: table-row-group;
}

/* A client's status: grey Booked, yellow To contact. */
.dashboard__tag {
  display: inline-block;
  padding-inline: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: var(--sp-5);
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  border-radius: var(--radius-pill);
}

.dashboard__tag--contact {
  color: var(--c-warning-text);
  background-color: var(--c-warning-bg);
}

@media (min-width: 576px) {
  .dashboard__wide {
    display: table-cell;
  }
}

@media (min-width: 768px) {
  .dashboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto) 1fr;
  }

  .dashboard__tile--half {
    grid-column: span 2;
  }
}

@media (min-width: 992px) {
  .admin__page:has(> .dashboard) {
    min-height: 100vh;
    min-height: 100dvh; /* no top bar beside the sidebar */
  }
}


/* --- The partner Overview (modules/dashboard/views/partner.php): the greeting with the date (plain words) in two
   columns, stacked on phones; the tiles in frosted white glass; then Affiliates and Trends, side by side from 1200px reaching
   the bottom of the screen, each with the small dark bar (32px) and a small toolbar under it. --- */
.overview { display: flex; flex-direction: column; gap: var(--sp-5); }
.overview__title { flex-direction: column; align-items: flex-start; gap: var(--sp-2); margin-bottom: 0; }
.overview__title .title-row__note { padding: 0; font-size: var(--fs-small); letter-spacing: normal; text-transform: none; color: var(--c-text-muted); background: none; border: 0; } /* the date: plain words, not a pill */
@media (min-width: 576px) {
  .overview__title { flex-direction: row; align-items: center; }
}
.overview__tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
@media (min-width: 768px) {
  .overview__tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* The tiles: frosted white glass with a faint blue glow in the bottom right corner. */
.overview__tile {
  background: radial-gradient(circle at 100% 100%, var(--c-accent), transparent 45%), var(--c-glass-top); /* frosted white; a faint glow of the palest blue in the bottom right corner */
  border: 0;
  box-shadow: var(--shadow-glass); /* the glass buttons' bright top edge, faint grey ring and soft shadow */
  -webkit-backdrop-filter: var(--blur-bar); /* Safari before 18 */
  backdrop-filter: var(--blur-bar);
}
.overview__tile .dashboard__label i { color: var(--c-menu-button); }

.overview__boxes { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); } /* minmax: the Trends strip never widens the page */
.overview__box { display: flex; flex-direction: column; min-width: 0; }
.overview__bar { height: var(--sp-8); padding-inline: var(--sp-4); } /* the small dark bar (the old Dashboard's) */
.overview__bar .box__title { font-size: var(--fs-xxs); }
/* The small toolbar under a bar: a short line on the left, its square buttons on the right; on phones the buttons go
   under the line when they do not fit beside it. */
.overview__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); }
.overview__toolbar[hidden] { display: none; }
.overview__tools { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.overview__square { width: var(--button-h-sm); padding: 0; } /* Trends' arrows */
.overview__add { gap: var(--sp-1); padding-inline: var(--sp-2); } /* a plus, then the affiliate icon */
/* Newest first or A–Z: the tick box (hidden) shows one list and the words that go with it. */
.overview__when-az,
.overview__box:has(.overview__az:checked) .overview__when-new { display: none; }
.overview__box:has(.overview__az:checked) .overview__when-az { display: revert; }
.overview__az:focus-visible + label { box-shadow: var(--focus-ring); }
.overview__toolbar-text { font-size: var(--fs-xs); color: var(--c-text-muted); }

.overview__scroll { flex: 1; padding-bottom: var(--sp-4); }
/* A row's line runs to the box's edges and its hover fills it all; no line under the last row. */
.overview__row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto var(--sp-4); align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-small); border-bottom: var(--border-1) solid var(--c-line); }
.overview__list .overview__row:last-child { border-bottom: 0; }
.overview__row > .open { display: contents; } /* its button covers the whole row (.clients__open), outside the grid */
.overview__row--total { font-weight: 600; }
.overview__name { display: grid; min-width: 0; }
.overview__name > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.overview__name > span { font-size: var(--fs-xs); font-weight: 400; color: var(--c-text-muted); }
.overview__num { text-align: right; white-space: nowrap; }
.overview__go { color: var(--c-text-muted); }
@media (hover: hover) {
  .overview__row:has(.clients__open:hover) { background-color: var(--c-surface); }
}

.overview__panels {
  position: relative; /* holds its hidden screen-reader words (visually-hidden), which would otherwise widen the page */
  display: grid;
  flex: 1;
  grid-auto-columns: 100%;
  grid-auto-flow: column;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  column-gap: 0; /* set, so the arrows (site.js data-slider) can measure a step */
  scroll-behavior: smooth; /* the next chart slides in (an instant change with prefers-reduced-motion, below) */
  scroll-snap-type: x mandatory;
  scrollbar-width: none; /* swiped, or moved with the arrows on the bar */
}
/* Latest in the Affiliates list's sizes (14px names, 12px under them). */
.overview__panel .dashboard__rows { font-size: var(--fs-small); }
.overview__panel .dashboard__what span { font-size: var(--fs-xs); }
.overview__panel .dashboard__date strong { font-size: var(--fs-small); }
.overview__panel { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: var(--sp-4); scroll-snap-align: start; }
.overview__panel-title { display: flex; align-items: center; gap: var(--sp-2); font-family: inherit; font-size: var(--fs-small); font-weight: 600; color: var(--c-heading); }
.overview__panel-title span { margin-left: auto; font-size: var(--fs-xs); font-weight: 400; color: var(--c-text-muted); }
.overview__bars { flex: 1; min-height: var(--dashboard-rows-h); }
.overview__bars .dashboard__bar { grid-template-rows: auto repeat(10, 1fr) auto; } /* its value on top */
.overview__value { grid-row: 1; padding-bottom: var(--sp-1); font-size: var(--fs-xxs); text-align: center; white-space: nowrap; color: var(--c-text-muted); }

@media (min-width: 1200px) {
  .overview__boxes { flex: 1 1 0; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: calc(var(--dashboard-rows-h) + var(--sp-24)); }
  .overview__box { min-height: 0; }
  .overview__scroll { min-height: 0; overflow-y: auto; } /* a long list scrolls inside its box */
}
@media (prefers-reduced-motion: reduce) {
  .overview__panels { scroll-behavior: auto; }
}
