/* Clinic app (js/features/clinic/*): the appointments calendar, the appointment and patient pages. */
.clinic-toolbar { flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.clinic-nav { display: flex; gap: var(--space-1); align-items: center; flex-wrap: wrap; }
.clinic-summary { margin: 0 0 var(--space-2); }
.clinic-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* the grid: a time column, then one column per therapist (day) or per day (week). It scrolls sideways on phones. */
.clinic-cal-wrap { overflow-x: auto; padding: 0; }
.clinic-cal { --row: calc(var(--control-height-md) * 0.9); display: grid;
  grid-template-columns: calc(var(--space-5) * 2.5) repeat(var(--cols), minmax(calc(var(--space-5) * 7), 1fr)); min-width: min-content; }
.clinic-times, .clinic-col { display: flex; flex-direction: column; }
.clinic-col { border-inline-start: 1px solid var(--color-border); min-width: 0; }
.clinic-colhead { position: sticky; top: 0; z-index: 1; height: var(--control-height-md); display: flex; align-items: center; justify-content: center;
  padding: 0 var(--space-2); background: var(--color-surface-2); border-bottom: 1px solid var(--color-border); font-weight: var(--weight-semibold);
  font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-times { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--color-surface); }
.clinic-time { height: var(--row); font-size: var(--text-xs); color: var(--color-text-muted); padding-inline: var(--space-1);
  border-bottom: 1px dashed var(--color-border); font-variant-numeric: tabular-nums; }
.clinic-colbody { position: relative; display: grid; grid-template-rows: repeat(var(--rows), var(--row)); }
.clinic-slot { all: unset; box-sizing: border-box; display: block; height: var(--row); border-bottom: 1px dashed var(--color-border); cursor: pointer; }
button.clinic-slot:hover { background: var(--color-hover-wash); }
button.clinic-slot:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.clinic-slot.off { background: var(--color-surface-inset); }

/* an appointment sits over the slots it takes */
.clinic-appt { all: unset; box-sizing: border-box; position: absolute; inset-inline: var(--space-1);
  top: calc(var(--top) * var(--row) + 1px); height: calc(var(--span) * var(--row) - 2px);
  display: flex; flex-direction: column; gap: 0; overflow: hidden; cursor: pointer; padding: calc(var(--space-1) * 0.75) var(--space-2);
  border-radius: var(--radius-md); background: var(--color-primary-subtle); color: var(--color-text);
  border-inline-start: 4px solid var(--tone, var(--color-primary)); font-size: var(--text-xs); line-height: 1.2; box-shadow: var(--shadow-raised); }
/* a short appointment (up to 1.5 slots) shows the time and the patient only */
.clinic-appt.short { padding-block: calc(var(--space-1) / 2); }
.clinic-appt.short .clinic-appt-svc { display: none; }
.clinic-appt:focus-visible { box-shadow: var(--focus-ring); }
.clinic-appt-time { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.clinic-appt-name { font-weight: var(--weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-appt-svc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-appt.st-arrived { background: var(--color-warning-subtle); }
.clinic-appt.st-done { background: var(--color-success-subtle); }
.clinic-appt.st-no_show { background: var(--color-danger-subtle); text-decoration: line-through; }
.clinic-warn, .clinic-warn-text { color: var(--color-danger-strong); font-weight: var(--weight-bold); }
.clinic-warn-text { font-weight: var(--weight-medium); }

/* the appointment dialog and the patient file */
.clinic-kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-2); padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; }
.clinic-kv:last-child { border-bottom: none; }
.clinic-file { margin-bottom: var(--space-4); }
.clinic-days { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.clinic-dot { display: inline-block; width: var(--space-3); height: var(--space-3); border-radius: var(--radius-pill); margin-inline-end: var(--space-2); vertical-align: middle; }
@media (max-width: 640px) {
  .clinic-kv { grid-template-columns: 1fr; gap: 0; }
}
