/* =========================================================================
   TLC — Workload-Based Therapy Scheduling System
   Shared design system (prototype). Brand derived from the TLC lotus logo:
   purple lotus, gray cradling hands, calm / caring / clinical-but-warm.
   ========================================================================= */

:root {
  /* Brand */
  --plum-900: #3d2750;
  --plum-700: #5b3a6e;
  --plum-600: #6e4c87;
  --plum-500: #7a52a0;
  --plum-300: #b79fd0;
  --lilac-100: #e9def2;
  --lilac-50:  #f3edf9;

  /* Neutrals (the hands) */
  --ink:       #2b2533;
  --slate-700: #4a4458;
  --slate-500: #6f697e;
  --slate-400: #938da3;
  --ink-soft:  #6f697e;
  --line:      #e4dfec;
  --line-strong:#cfc7da;
  --bg:        #faf8fc;
  --surface:   #ffffff;

  /* Emily's event language. Muted surfaces + readable foregrounds keep a
     busy clinic calendar calm; color is always paired with a text label. */
  --event-evaluation-bg:#e3e5e8; --event-evaluation-fg:#374151; --event-evaluation-line:#5a6b7d;
  --event-iep-bg:#f4dec9;        --event-iep-fg:#713b15;        --event-iep-line:#e07b1f;
  --event-therapy-bg:#d5ecea;    --event-therapy-fg:#175b5d;    --event-therapy-line:#16a39c;
  --event-consult-bg:#315474;    --event-consult-fg:#ffffff;    --event-consult-line:#1d6fb8;
  --event-supervision-bg:#dce7d8;--event-supervision-fg:#36513b;--event-supervision-line:#5ca904;
  --event-team-bg:#e8dff0;       --event-team-fg:#563a68;       --event-team-line:#4f46e5;
  --event-free-bg:#ffffff;       --event-free-fg:#4a4458;       --event-free-line:#9a95a5;
  --event-group-bg:#2e5d46;      --event-group-fg:#ffffff;      --event-group-line:#107c52;
  --event-camp-bg:#4d7650;       --event-camp-fg:#ffffff;       --event-camp-line:#2f9e44;
  --event-volunteer-bg:#f7e9ae;  --event-volunteer-fg:#5d4a09;  --event-volunteer-line:#f5b301;
  --event-admin-bg:#6e4c87;      --event-admin-fg:#ffffff;      --event-admin-line:#8b2fb8;
  --event-care-in-bg:#f0dde4;    --event-care-in-fg:#6c384b;    --event-care-in-line:#d6336c;
  --event-care-out-bg:#dceaf4;   --event-care-out-fg:#2d526b;   --event-care-out-line:#0d7fa3;
  --event-lunch-bg:#efddda;      --event-lunch-fg:#77382f;      --event-lunch-line:#c2410c;

  /* Functional status — the heart of the workload model */
  --ok:        #2e9e6b;
  --ok-bg:     #e4f5ec;
  --warn:      #d99016;
  --warn-bg:   #fbf0db;
  --over:      #d94a4a;
  --over-bg:   #fbe6e6;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(43,37,51,.05), 0 6px 20px rgba(91,58,110,.07);
  --shadow-lg: 0 12px 40px rgba(61,39,80,.16);
  --sidebar-w: 246px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand .name, .stat .num {
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

:focus-visible {
  outline: 3px solid var(--plum-300);
  outline-offset: 2px;
}

a { color: var(--plum-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 700; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .6rem; color: var(--slate-700); }
small { color: var(--slate-500); }

/* ----------------------------------------------------------- App shell --- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--plum-900), var(--plum-700));
  color: #f4eefb;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Nav can outgrow short screens (Phase 5 added Waitlist/My Day) — without
     this the bottom links ("Switch person") are unreachable. */
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 12px;
}
.sidebar .brand img {
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff; padding: 2px; object-fit: cover;
}
.sidebar .brand .name { font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; color: #fff; }
.sidebar .brand .sub  { font-size: .72rem; color: var(--plum-300); margin-top: 1px; }

.nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--plum-300); margin: 16px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: #e7ddf3; font-weight: 600; font-size: .92rem;
  cursor: pointer; transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.09); text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; opacity: .92; }

.sidebar .spacer { flex: 1; }
.sidebar .role-switch {
  font-size: .8rem; color: var(--plum-300);
  border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px;
}
.sidebar .role-switch a { color: #fff; font-weight: 600; }

/* ------------------------------------------------------------- Content --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumbs { color: var(--slate-500); font-size: .82rem; }
.topbar .crumbs b { color: var(--ink); }
.topbar .role-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--lilac-100); color: var(--plum-700);
  padding: 6px 13px; border-radius: 999px; font-weight: 700; font-size: .82rem;
}
.topbar .role-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--plum-500); }

/* Density pass (7/26, client note 1): the background showing between the page
   edge and the cards — and between the cards themselves — was eating the
   screen. Gutters and inter-card gaps come down about a third; hierarchy is
   kept by the card borders/shadows, not by empty space. */
.content { padding: 16px 18px 32px; max-width: 1400px; width: 100%; }
.page-head { margin-bottom: 12px; }
.page-head .eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .7rem;
  font-weight: 700; color: var(--plum-500); margin-bottom: 6px;
}
.page-head p { max-width: 70ch; }

/* -------------------------------------------------------------- Layout --- */
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.split { display: grid; grid-template-columns: 1fr 340px; gap: 12px; align-items: start; }
@media (max-width: 980px) {
  .cols-2, .cols-3, .split { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------- Cards --- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 16px;
}
.card.tight { padding: 12px; }
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.card .card-head h2, .card .card-head h3 { margin: 0; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .num { font-size: 1.8rem; font-weight: 800; color: var(--plum-700); line-height: 1; }
.stat .lbl { font-size: .8rem; color: var(--slate-500); }

/* ----------------------------------------------------------- Capacity --- */
.cap {
  height: 12px; border-radius: 999px; background: var(--line);
  overflow: hidden; position: relative;
}
.cap > span { display: block; height: 100%; border-radius: 999px; transition: width .3s ease; }
.cap.lg { height: 16px; }
.is-ok   > span { background: var(--ok); }
.is-warn > span { background: var(--warn); }
.is-over > span { background: var(--over); }

.cap-meta { display: flex; justify-content: space-between; font-size: .8rem; margin-top: 6px; }
.cap-meta .hrs { font-weight: 700; color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.ok   { background: var(--ok-bg);   color: #1d7a4f; }
.pill.ok   .dot { background: var(--ok); }
.pill.warn { background: var(--warn-bg); color: #9a6406; }
.pill.warn .dot { background: var(--warn); }
.pill.over { background: var(--over-bg); color: #b62f2f; }
.pill.over .dot { background: var(--over); }
.pill.tier { background: var(--lilac-100); color: var(--plum-700); }
/* Scaling class of a workload activity (v7): every session vs once a week. */
.pill.scale    { background: var(--lilac-50); color: var(--slate-500); font-size: .6rem; padding: 2px 8px; }
.pill.scale.wk { background: var(--line);     color: var(--slate-700); }

/* --------------------------------------------------------------- Table --- */
.therapist-row {
  display: grid; grid-template-columns: 1.4fr 1.2fr 1.6fr auto;
  align-items: center; gap: 16px;
  padding: 15px 4px; border-bottom: 1px solid var(--line);
}
.therapist-row:last-child { border-bottom: 0; }
.therapist-row .who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--lilac-100); color: var(--plum-700);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem;
  flex: 0 0 38px;
}
.therapist-row .who .nm { font-weight: 700; }
.therapist-row .who .rl { font-size: .78rem; color: var(--slate-500); }

table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--slate-500); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: .9rem; }
table.data tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------- Forms --- */
label.field { display: block; margin-bottom: 16px; }
label.field .lab { display: block; font-weight: 700; font-size: .82rem; margin-bottom: 6px; color: var(--slate-700); }
select, input[type="text"], input[type="number"] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); font: inherit; color: var(--ink);
}
select:focus, input:focus { outline: 2px solid var(--plum-300); border-color: var(--plum-500); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg .opt {
  flex: 1; min-width: 70px; text-align: center; cursor: pointer;
  padding: 12px 8px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-weight: 700; background: var(--surface); transition: all .15s;
}
.seg .opt small { display: block; font-weight: 600; color: var(--slate-500); font-size: .72rem; margin-top: 2px; }
.seg .opt:hover { border-color: var(--plum-300); }
.seg .opt.sel { border-color: var(--plum-500); background: var(--lilac-50); color: var(--plum-700); box-shadow: 0 0 0 3px var(--lilac-100); }
.seg .opt.sel small { color: var(--plum-600); }

/* Weekday cadence toggles (WP1) — a multi-select sibling of .seg. Same border /
   lilac "selected" language, sized down to a day chip so a whole clinic week
   fits on one line beside a label. Deliberately NOT .seg: that class is
   stamped as a radiogroup (one choice), these are checkboxes (many). */
.wd-toggle { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wd-toggle .wd-day {
  min-width: 46px; text-align: center; cursor: pointer;
  padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 999px;
  font-weight: 700; font-size: .78rem; background: var(--surface);
  color: var(--ink); transition: all .15s; user-select: none;
}
.wd-toggle .wd-day:hover { border-color: var(--plum-300); }
.wd-toggle .wd-day:focus-visible { outline: 2px solid var(--plum-300); outline-offset: 1px; }
.wd-toggle .wd-day.sel {
  border-color: var(--plum-500); background: var(--lilac-50);
  color: var(--plum-700); box-shadow: 0 0 0 3px var(--lilac-100);
}
.wd-toggle.disabled { opacity: .45; pointer-events: none; }
.wd-note { color: var(--slate-500); font-size: .74rem; }

/* ---- WP2: meetings & team scheduling on the client file ------------------
   A meeting row is now two lines: the head (type / cadence / days / time) and
   a quieter sub-row for location + guests, so the row stays scannable as it
   grows fields. The guest list is chips (add via the trailing select, drop via
   the ×) because a meeting can invite several people. */
.collab-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.collab-row .cm-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.collab-row .cm-head .wd-toggle .wd-day { min-width: 34px; padding: 4px 7px; font-size: .7rem; }
.cm-sub {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--line);
  border-radius: var(--radius-sm); background: var(--bg);
}
.cm-sub label { display: flex; flex-direction: column; gap: 3px; }
.cm-sub input[type="text"], .cm-sub input[type="time"], .cm-sub input[type="number"], .cm-sub select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .8rem;
}
.cm-sub .cm-loc { min-width: 190px; }
.cm-att-wrap { display: flex; flex-direction: column; gap: 3px; }
.cm-attendees { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.att-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.att-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 6px 3px 9px; border: 1px solid var(--plum-300); border-radius: 999px;
  background: var(--lilac-50); color: var(--plum-700); font-size: .72rem; font-weight: 700;
}
.att-chip.all { border-style: dashed; }
.att-chip .cm-att-del {
  border: 0; background: none; cursor: pointer; color: inherit;
  font-size: .85rem; line-height: 1; padding: 0 2px; opacity: .6;
}
.att-chip .cm-att-del:hover { opacity: 1; }
.cm-att-add { max-width: 190px; }

/* Team member's own schedule on a case (WP2c) + the Protections reveal (WP2d)
   share this indented, dashed "extra detail" treatment. */
.pc-tsched, .pc-reveal {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 7px; margin-left: 24px; padding: 8px 10px;
  border-left: 3px solid var(--plum-300); border-radius: var(--radius-sm);
  background: var(--bg);
}
.pc-reveal { display: block; margin-left: 0; border: 1px solid var(--line); border-left-width: 3px; margin-top: 8px; }
.pc-tsched input, .pc-tsched select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .8rem;
}
.pc-tsched .wd-toggle .wd-day { min-width: 34px; padding: 4px 7px; font-size: .7rem; }

/* Mini month calendar (WP2b) — compact, read-only; days with meetings lit. */
.mini-cal {
  margin-top: 14px; padding: 10px 12px; max-width: 300px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.mini-cal-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.mini-cal-t { font-weight: 800; font-size: .82rem; color: var(--plum-700); }
.mini-cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: .66rem; text-align: center; }
.mini-cal-g b { color: var(--slate-500); font-weight: 700; }
.mini-cal-g span { padding: 3px 0; border-radius: 5px; }
.mini-cal-g span.out { opacity: .3; }
.mini-cal-g span.has { background: var(--lilac-100); color: var(--plum-700); font-weight: 800; cursor: help; }
.mini-cal-g span.today { outline: 1.5px solid var(--plum-500); }
.mini-key {
  display: inline-block; width: 9px; height: 9px; margin-right: 5px;
  border-radius: 3px; background: var(--lilac-100); vertical-align: -1px;
}

.check-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: var(--surface);
}
.check-row.on { border-color: var(--plum-300); background: var(--lilac-50); }
.check-row .meta { display: flex; align-items: center; gap: 10px; }
.check-row .mins { font-variant-numeric: tabular-nums; color: var(--slate-500); font-weight: 700; font-size: .82rem; }

/* Toggle */
.toggle { position: relative; width: 42px; height: 24px; flex: 0 0 42px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; }
.toggle .track::after { content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; background:#fff; border-radius:50%; transition:.2s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + .track { background: var(--plum-500); }
.toggle input:checked + .track::after { transform: translateX(18px); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 11px 18px; border-radius: var(--radius-sm); font: inherit; font-weight: 700;
  border: 1px solid transparent; transition: all .15s; min-height: 42px;
}
.btn.primary { background: var(--plum-600); color: #fff; }
.btn.primary:hover { background: var(--plum-700); text-decoration: none; }
.btn.primary:disabled { background: var(--slate-400); cursor: not-allowed; opacity: .7; }
.btn.ghost:disabled { cursor: not-allowed; opacity: .5; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--plum-700); }
.btn.ghost:hover { border-color: var(--plum-300); text-decoration: none; }
.btn.danger-ghost { background: var(--surface); border-color: var(--over); color: var(--over); }
.btn.sm { padding: 7px 13px; font-size: .84rem; min-height: 38px; }

/* ---------------------------------------------------------- Calculator --- */
.calc-total {
  display: flex; align-items: baseline; gap: 10px;
  padding: 16px; border-radius: var(--radius-sm);
  background: var(--lilac-50); border: 1px solid var(--lilac-100); margin-bottom: 14px;
}
.calc-total .big { font-size: 2.1rem; font-weight: 800; color: var(--plum-700); line-height: 1; }
.calc-total .of  { color: var(--slate-500); font-size: .85rem; }

.split-bar { display: flex; height: 34px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.split-bar .direct   { background: var(--plum-500); }
.split-bar .indirect { background: var(--plum-300); }
.split-bar > div { display: grid; place-items: center; color: #fff; font-size: .76rem; font-weight: 700; }
.split-legend { display: flex; gap: 18px; margin-top: 9px; font-size: .8rem; color: var(--slate-600); }
.split-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* ---------------------------------------------------------- Alert pane --- */
.alert {
  display: flex; gap: 11px; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); margin-bottom: 10px; background: var(--surface);
}
.alert .ico { font-size: 1.05rem; line-height: 1.3; }
.alert .a-body { font-size: .85rem; }
.alert .a-body .t { font-weight: 700; color: var(--ink); }
.alert .a-body .m { color: var(--slate-500); font-size: .8rem; }
.alert.over { border-left: 4px solid var(--over); }
.alert.warn { border-left: 4px solid var(--warn); }
.alert.info { border-left: 4px solid var(--plum-500); }

/* Guardrail banner */
.banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 15px 17px; border-radius: var(--radius-sm); margin-bottom: 16px;
  border: 1px solid; font-size: .9rem;
}
.banner .ico { font-size: 1.3rem; line-height: 1; }
.banner.over { background: var(--over-bg); border-color: #efb4b4; color: #8f2727; }
.banner.ok   { background: var(--ok-bg);  border-color: #b6e3ca; color: #1d6e49; }
.banner b { font-weight: 800; }
.banner .hint { display: block; margin-top: 3px; opacity: .85; font-size: .82rem; }

/* ------------------------------------------------------------ Calendar --- */
.cal { display: grid; grid-template-columns: 56px repeat(5, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .ch { background: var(--lilac-50); font-weight: 700; font-size: .8rem; text-align: center; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--plum-700); }
.cal .time { font-size: .7rem; color: var(--slate-400); text-align: right; padding: 6px 8px 0 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 46px; padding: 3px; position: relative; }
.cal .ev {
  border-radius: 7px; padding: 5px 7px; font-size: .73rem; font-weight: 700; margin-bottom: 3px;
  background: var(--plum-500); color: #fff; line-height: 1.25;
}
.cal .ev small { display: block; font-weight: 600; opacity: .85; }
.cal .ev.buf { background: var(--lilac-100); color: var(--plum-700); border: 1px dashed var(--plum-300); }
.cal .ev.mtg { background: var(--slate-500); }

.legend-dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* ---- Collapsible section card (7/26 client notes 3 + 5) -----------------
   A <details class="card collapse"> whose <summary> is the card head. Long
   reference sections (My caseload, Event types & colors) ship collapsed so the
   calendar / the rest of the page can use the width — one click reopens them,
   nothing is removed. */
details.collapse { padding: 0; }
details.collapse > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; font-weight: 700; color: var(--ink); border-radius: var(--radius);
}
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary:hover { background: var(--lilac-50); }
details.collapse > summary::after {
  content: "▾"; margin-left: auto; color: var(--plum-600); font-size: .9rem;
  transition: transform .15s;
}
details.collapse[open] > summary::after { transform: rotate(180deg); }
details.collapse > summary h2, details.collapse > summary h3 { margin: 0; }
details.collapse > summary .sum-note { font-weight: 600; font-size: .78rem; color: var(--slate-500); }
details.collapse .collapse-body { padding: 0 16px 14px; }
details.collapse[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
details.collapse[open] .collapse-body { padding-top: 12px; }

/* --------------------------------------------------------------- Misc ---- */
.muted { color: var(--slate-500); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.note {
  font-size: .84rem; color: var(--slate-500); background: var(--lilac-50);
  border: 1px dashed var(--lilac-100); border-radius: var(--radius-sm);
  padding: 10px 12px; display: flex; gap: 8px;
}
.note .ico { color: var(--plum-500); }

/* "We need your answer" callout — an open question the clinic settles during
   review, ideally by leaving a note with the "+" button right next to it. */
.note.ask {
  background: var(--warn-bg); border: 1px dashed #e8cf9a; color: #6d5312;
  font-size: .8rem; line-height: 1.5;
}
.note.ask .ico { color: #9a6406; }
.note.ask b { color: #4a3a08; }

/* Landing */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--lilac-100), var(--bg)); }
.landing .box { text-align: center; max-width: 940px; width: 100%; }
.landing .logo-lg { width: 108px; height: 108px; border-radius: 50%; background:#fff; padding:5px; box-shadow: var(--shadow-lg); }
.landing h1 { font-size: 2.1rem; margin: 20px 0 8px; }
.landing .tagline { color: var(--slate-500); font-size: 1.05rem; margin-bottom: 36px; }
.role-cards { display:grid; grid-template-columns:minmax(0,560px); justify-content:center; gap:10px; }
.role-card {
  width:100%; background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:14px 16px; text-align:left; box-shadow:var(--shadow); transition:transform .15s, box-shadow .15s;
  display:flex; align-items:center; gap:14px; color:inherit; font:inherit; cursor:pointer;
}
.role-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-lg); }
.role-card:focus-visible { outline:3px solid var(--plum-300); outline-offset:2px; }
.role-card .rc-ico { width:44px; height:44px; flex:0 0 44px; border-radius:12px; background:var(--lilac-100); color:var(--plum-700); display:grid; place-items:center; font-size:1.35rem; }
.role-card .role-card-main { flex:1; min-width:0; }
.role-card h3 { font-size:1rem; margin:0 0 2px; }
.role-card p { font-size:.78rem; margin:0; color:var(--slate-500); }
.role-card .go { margin-left:auto; color:var(--plum-600); font-weight:700; font-size:.8rem; white-space:nowrap; }

/* Hosted sign-in card (Phase 4 WP2). Reuses the .role-cards grid slot so the
   landing page keeps the same width and centring in both modes. */
.signin-box { grid-template-columns:minmax(0,380px); }
.signin-form {
  width:100%; background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:22px 22px 20px; text-align:left; box-shadow:var(--shadow);
}
.signin-form .field { display:block; margin-bottom:12px; }
.signin-form input { width:100%; box-sizing:border-box; }
.signin-form .btn { width:100%; justify-content:center; }
.signin-form .signin-msg:empty { min-height:0; }

.auth-blocked { max-width:560px; margin:80px auto; padding:28px; text-align:center; }
.auth-blocked-icon { font-size:2.4rem; }
.auth-blocked h2 { margin:10px 0 6px; }
.auth-blocked p { color:var(--slate-500); font-size:.92rem; line-height:1.5; }
.auth-blocked .btn { display:inline-block; margin-right:10px; padding:9px 16px; background:var(--plum-600); color:#fff; border-radius:9px; text-decoration:none; }
.auth-chip { margin-left:auto; display:inline-flex; align-items:center; gap:8px; font-size:.78rem; color:var(--slate-500); }
.auth-chip b,.auth-chip a { color:var(--plum-700); }.foot-note { margin-top: 34px; font-size: .8rem; color: var(--slate-400); }

/* ---- Tier-3 team-training counter (TT-3) -------------------------------- */
.tt-track { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.tt-dots { display: inline-flex; gap: 3px; }
.tt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); border: 1px solid #d8d0e4; }
.tt-dot.on { background: var(--plum-500); border-color: var(--plum-500); }

/* Optional reflection journal (therapist team-training) */
.reflect-item { position: relative; padding: 10px 30px 10px 12px; background: var(--lilac-50); border: 1px solid var(--line); border-left: 3px solid var(--plum-300); border-radius: var(--radius-sm); }
.reflect-del { position: absolute; top: 6px; right: 8px; border: none; background: none; color: var(--slate-500); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.reflect-del:hover { background: rgba(0,0,0,.06); color: var(--plum-700); }

/* Compact record tables (client management sub-sections) */
.mini-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.mini-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table td:first-child { white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; }
.auth-row { padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }

/* ---- Inline save confirmation (client note 1) ---------------------------
   Everything autosaves, but with no acknowledgement people re-type values to
   be sure they "took". A small chip pops next to the control that was just
   edited and fades out. Fixed-positioned so it never shifts any layout. */
.saved-chip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--plum-700, #5b3a7e); color: #fff;
  font-size: .68rem; font-weight: 800; letter-spacing: .01em;
  padding: 3px 8px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(40,20,60,.22);
  animation: savedChip 1.6s ease forwards;
}
@keyframes savedChip {
  0%   { opacity: 0; transform: translateY(4px); }
  12%  { opacity: 1; transform: translateY(0); }
  75%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-4px); }
}
/* ---- Booking toast (client notes 12+13, 7/26) ---------------------------
   "Confirmation toast when saving a session add" — and the same after adding a
   coloured event. Bottom-centre, out of the way of the grid, auto-dismissing;
   it names what landed and where, so the eye knows what to look for while the
   new tile is still pulsing. */
.tlc-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  z-index: 120; pointer-events: none; opacity: 0;
  max-width: min(520px, calc(100vw - 32px));
  background: var(--plum-700, #5b3a7e); color: #fff;
  font-size: .84rem; font-weight: 700; line-height: 1.35;
  padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 10px 28px rgba(40,20,60,.30);
  transition: opacity .18s ease, transform .18s ease;
}
.tlc-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Modal page freeze (client notes 10+11, 7/26) -----------------------
   While any .modal-overlay is up the page behind must not scroll and must not
   be reachable. The wheel belongs to whatever sits under the mouse: inside the
   dialog it scrolls the dialog and stops at its ends (overscroll-behavior),
   outside it does nothing (see modalPageFreeze() in app.js). */
body.modal-open { overflow: hidden; }
.modal-overlay { overscroll-behavior: contain; }
.modal-overlay .modal-box {
  max-height: calc(100vh - 44px); overflow-y: auto; overscroll-behavior: contain;
}

/* A value the rules fix and the admin may not change (e.g. the 60-min contact
   hour). Reads as deliberate, not as a broken input. */
.locked-val { display: inline-flex; align-items: center; gap: 5px; }
.locked-val .lk { opacity: .6; font-size: .78rem; cursor: help; }

/* Read-only mirror rows (client file allocations summary) */
.ro-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ro-row:last-child { border-bottom: none; }
.ro-row .ro-facts { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--slate-500); }
.ro-row .ro-facts b { color: var(--ink, #2b2540); }

/* Consult blocks on time-grid */
.tg-ev.consult { background: #e4f5ec; border-color: #8fd4b0; color: #1f6b45; }
.tg-ev.consult b { color: #1f6b45; }

/* ---- Mobile shell (sidebar collapse) ------------------------------------ */
.nav-toggle {
  display: none;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  width: 40px; height: 40px; font-size: 1.15rem; cursor: pointer; margin-right: 10px;
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    transform: translateX(-105%);
    transition: transform .2s ease;
    width: min(280px, 86vw);
    flex: none;
    height: 100vh;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(40,28,55,.4); z-index: 35;
  }
  .sidebar-backdrop.show { display: block; }
  .topbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .content { padding: 12px 12px 28px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr !important; }
  .split { display: block !important; }
  .page-head h1 { font-size: 1.25rem; }
  .tg-week { min-width: 640px; }
  .content:has(.tg) { overflow-x: auto; }
}
