/* ============================================================
   TRANSPARENT SPACE THERAPY — approved design system (Revision 2)
   ============================================================ */
:root {
  --tst-yellow: #F0B429;
  --tst-yellow-dark: #D89A1A;
  --tst-yellow-tint: #FDF3DC;
  --tst-offwhite: #FBF9F5;
  --tst-white: #FFFFFF;
  --tst-gray-100: #F3F1EC;
  --tst-gray-200: #E8E5DD;
  --tst-gray-300: #D9D5CB;
  --tst-gray-500: #9C9689;
  --tst-charcoal: #2A2823;
  --tst-charcoal-soft: #4A4740;
  --tst-green: #2F9E5C;
  --tst-green-tint: #E7F6ED;
  --tst-amber: #D9822B;
  --tst-amber-tint: #FCEFDE;
  --tst-red: #D64545;
  --tst-red-tint: #FBEAEA;
  --tst-gray-status: #8A8578;
  --tst-gray-status-tint: #F0EEE8;
  --shadow-sm: 0 1px 2px rgba(42,40,35,0.06), 0 1px 1px rgba(42,40,35,0.04);
  --shadow-md: 0 4px 12px rgba(42,40,35,0.08), 0 2px 4px rgba(42,40,35,0.04);
  --sidebar-w: 232px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--tst-offwhite);
  color: var(--tst-charcoal);
  line-height: 1.5;
  font-size: 14px;
}
h1, h2, h3, h4, .heading { font-family: 'Manrope', sans-serif; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
a { color: inherit; }
button { font-family: inherit; }

/* ---------- App shell ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--tst-charcoal); color: #EDE9DF;
  padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.logo-placeholder {
  width: 34px; height: 34px; border-radius: 8px; border: 1.5px dashed var(--tst-yellow);
  display: flex; align-items: center; justify-content: center; font-size: 8.5px; color: var(--tst-yellow);
  text-align: center; line-height: 1.1; flex-shrink: 0; font-weight: 700;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--tst-white); flex-shrink: 0;
  object-fit: contain; padding: 3px; box-shadow: 0 0 0 1px rgba(240,180,41,0.35);
}
.logo-mark-lg {
  width: 72px; height: 72px; border-radius: 16px; background: var(--tst-white); flex-shrink: 0;
  object-fit: contain; padding: 6px; box-shadow: 0 0 0 1px rgba(240,180,41,0.35);
}
.sidebar-logo .logo-text { font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 14.5px; color: white; }
.sidebar-logo .logo-sub { font-size: 10px; color: #A39C8A; margin-top: 1px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; font-size: 13.2px;
  color: #C9C3B3; text-decoration: none; font-weight: 500; cursor: pointer; transition: background .12s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: var(--tst-yellow); color: var(--tst-charcoal); font-weight: 700; }
.sidebar-nav a.active:hover { background: var(--tst-yellow); }
.sidebar-nav .nav-icon { width: 16px; text-align: center; opacity: .85; font-size: 13px; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.role-switcher { font-size: 11px; color: #A39C8A; padding: 8px; }
.role-pill { display: inline-flex; gap: 4px; background: rgba(255,255,255,0.06); border-radius: 8px; padding: 3px; margin-top: 6px; }
.role-pill button {
  border: none; background: transparent; color: #C9C3B3; font-size: 11px; font-weight: 600; padding: 5px 10px;
  border-radius: 6px; cursor: pointer;
}
.role-pill button.active { background: var(--tst-yellow); color: var(--tst-charcoal); }

.main { flex: 1; min-width: 0; padding: 26px 34px 60px; max-width: 1360px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 21px; }
.welcome-tag { font-size: 12px; color: var(--tst-gray-500); margin-top: 3px; font-weight: 400; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px; border-radius: 8px; padding: 9px 16px;
  cursor: pointer; border: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn-primary { background: var(--tst-yellow); color: var(--tst-charcoal); }
.btn-primary:hover { background: var(--tst-yellow-dark); }
.btn-secondary { background: var(--tst-white); color: var(--tst-charcoal); border: 1px solid var(--tst-gray-300); }
.btn-secondary:hover { background: var(--tst-gray-100); }
.btn-ghost { background: transparent; color: var(--tst-charcoal-soft); }
.btn-ghost:hover { color: var(--tst-charcoal); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-danger { background: var(--tst-red-tint); color: var(--tst-red); }
.link-btn { background: none; border: none; color: var(--tst-yellow-dark); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card { background: var(--tst-white); border: 1px solid var(--tst-gray-200); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 12.5px; color: var(--tst-gray-500); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 26px; color: var(--tst-charcoal); }
.kpi-sub { font-size: 12px; color: var(--tst-gray-500); margin-top: 4px; }
.progress-track { height: 7px; background: var(--tst-gray-100); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; background: var(--tst-yellow); border-radius: 999px; transition: width .3s; }

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1050px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }

.section-heading { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 12px; }
.section-heading h2 { font-size: 15.5px; }
.section-block { margin-bottom: 8px; }

.mini-list-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--tst-gray-100); font-size: 12.5px; }
.mini-list-row:last-child { border-bottom: none; }
.mini-list-row .lbl { color: var(--tst-charcoal-soft); }
.mini-list-row .val { font-weight: 700; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge-green { background: var(--tst-green-tint); color: var(--tst-green); }
.badge-amber { background: var(--tst-amber-tint); color: var(--tst-amber); }
.badge-red { background: var(--tst-red-tint); color: var(--tst-red); }
.badge-gray { background: var(--tst-gray-status-tint); color: var(--tst-gray-status); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--tst-white); border: 1px solid var(--tst-gray-200); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
table.tst-table { width: 100%; border-collapse: collapse; }
table.tst-table th {
  text-align: left; font-size: 10.8px; text-transform: uppercase; letter-spacing: .04em; color: var(--tst-gray-500);
  font-weight: 700; padding: 11px 14px; background: var(--tst-gray-100); border-bottom: 1px solid var(--tst-gray-200);
  white-space: nowrap;
}
table.tst-table td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--tst-gray-100); color: var(--tst-charcoal); vertical-align: middle; }
table.tst-table tr:last-child td { border-bottom: none; }
table.tst-table tbody tr { cursor: default; }
table.tst-table tbody tr:hover { background: var(--tst-yellow-tint); }
.field-pair .owner { font-weight: 600; display: block; }
.field-pair .therapist { font-size: 11px; color: var(--tst-gray-500); }
.cell-muted { color: var(--tst-gray-500); }

/* ---------- Filters / toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-select, .filter-input {
  font-family: inherit; font-size: 12.5px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--tst-gray-300);
  background: var(--tst-white); color: var(--tst-charcoal); cursor: pointer;
}
.filter-input { cursor: text; min-width: 200px; }
.filter-input:focus, .filter-select:focus { outline: 2px solid var(--tst-yellow); outline-offset: -1px; }
.tab-row { display: flex; gap: 6px; border-bottom: 1px solid var(--tst-gray-200); margin-bottom: 18px; }
.tab-row button {
  background: none; border: none; padding: 10px 4px; margin-right: 18px; font-size: 13px; font-weight: 600;
  color: var(--tst-gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-row button.active { color: var(--tst-charcoal); border-bottom-color: var(--tst-yellow); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid; margin-bottom: 9px; font-size: 12.8px; }
.alert-icon { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.alert-urgent { background: var(--tst-red-tint); border-color: #F3D3D3; }
.alert-urgent .alert-icon { background: var(--tst-red); color: white; }
.alert-attention { background: var(--tst-amber-tint); border-color: #F4DCB8; }
.alert-attention .alert-icon { background: var(--tst-amber); color: white; }
.alert-info { background: var(--tst-yellow-tint); border-color: #F0DFA8; }
.alert-info .alert-icon { background: var(--tst-yellow-dark); color: white; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-sub { color: var(--tst-charcoal-soft); font-size: 11.5px; }
.alert-cat { font-size: 10px; color: var(--tst-gray-500); text-transform: uppercase; letter-spacing: .03em; margin-top: 3px; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 46px 20px; color: var(--tst-gray-500); }
.empty-state .icon { font-size: 30px; margin-bottom: 10px; }
.empty-state .title { font-family: 'Manrope'; font-weight: 700; color: var(--tst-charcoal); margin-bottom: 4px; font-size: 14.5px; }
.empty-state .sub { font-size: 12.5px; max-width: 320px; margin: 0 auto; }

/* ---------- Capacity / clinician rows ---------- */
.clinician-row { display: grid; grid-template-columns: 130px 1fr 60px 110px 130px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--tst-gray-100); font-size: 12.5px; }
.clinician-row:last-child { border-bottom: none; }
.clinician-row.head { font-size: 10.5px; color: var(--tst-gray-500); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--tst-gray-200); padding-bottom: 9px; }
.clinician-name-cell { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--tst-charcoal); color: var(--tst-yellow); font-family: 'Manrope'; font-weight: 700; font-size: 10.5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.clinician-name { font-weight: 700; font-size: 12.8px; cursor: pointer; }
.clinician-name:hover { text-decoration: underline; }
.clinician-bar-track { height: 6px; background: var(--tst-gray-100); border-radius: 999px; overflow: hidden; }
.clinician-bar-fill { height: 100%; border-radius: 999px; }
.clinician-util { font-weight: 700; text-align: right; }
.clinician-metric { color: var(--tst-charcoal-soft); font-size: 11.8px; }
.total-row { background: var(--tst-yellow-tint); border-radius: 8px; padding: 11px 12px; margin-top: 6px; display: grid; grid-template-columns: 130px 1fr 60px 110px 130px; gap: 12px; align-items: center; font-size: 12.5px; }

/* ---------- Funnel ---------- */
.funnel { display: flex; align-items: flex-end; gap: 6px; height: 100px; margin: 6px 0 4px; }
.funnel-bar { flex: 1; background: var(--tst-yellow); border-radius: 6px 6px 0 0; position: relative; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; min-height: 22px; }
.funnel-bar .fnum { font-family: 'Manrope'; font-weight: 800; font-size: 13px; color: var(--tst-charcoal); }
.funnel-labels { display: flex; gap: 6px; }
.funnel-labels span { flex: 1; text-align: center; font-size: 9.5px; color: var(--tst-gray-500); font-weight: 600; }

/* ---------- Weekly schedule grid ---------- */
.week-grid-wrap { overflow-x: auto; }
.week-grid { display: grid; border: 1px solid var(--tst-gray-200); border-radius: 12px; overflow: hidden; min-width: 720px; }
.week-grid .grid-header, .week-grid .grid-row { display: contents; }
.week-grid .cell { padding: 8px 6px; font-size: 11px; text-align: center; border-bottom: 1px solid var(--tst-gray-100); border-right: 1px solid var(--tst-gray-100); }
.week-grid .cell.head { background: var(--tst-gray-100); font-weight: 700; color: var(--tst-gray-500); text-transform: uppercase; font-size: 9.5px; letter-spacing: .03em; }
.week-grid .cell.clinician-label { background: var(--tst-gray-100); font-weight: 700; text-align: left; padding-left: 12px; color: var(--tst-charcoal); }
.slot-available { background: var(--tst-green-tint); color: var(--tst-green); font-weight: 700; }
.slot-booked { background: var(--tst-gray-100); color: var(--tst-gray-500); }
.slot-unavailable { background: repeating-linear-gradient(45deg, #F3F1EC, #F3F1EC 4px, #EAE7E0 4px, #EAE7E0 8px); color: var(--tst-gray-300); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(42,40,35,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--tst-white); border-radius: 16px; width: 100%; max-width: 460px; padding: 26px; box-shadow: var(--shadow-md); max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .modal-sub { font-size: 12.5px; color: var(--tst-gray-500); margin-bottom: 18px; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--tst-charcoal-soft); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; font-family: inherit; font-size: 13px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--tst-gray-300); background: var(--tst-offwhite);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: 2px solid var(--tst-yellow); outline-offset: -1px; background: white; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Checklist ---------- */
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--tst-gray-100); font-size: 13px; }
.checklist-item:last-child { border-bottom: none; }
.check-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--tst-gray-300); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; }
.check-box.done { background: var(--tst-green); border-color: var(--tst-green); color: white; }
.checklist-item.done span.label { color: var(--tst-gray-500); text-decoration: line-through; }

/* ---------- Misc ---------- */
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-nav button { border: 1px solid var(--tst-gray-300); background: var(--tst-white); border-radius: 999px; padding: 6px 13px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--tst-charcoal-soft); }
.pill-nav button.active { background: var(--tst-charcoal); border-color: var(--tst-charcoal); color: var(--tst-yellow); }
.text-muted { color: var(--tst-gray-500); }
.mt-24 { margin-top: 24px; }
.source-tag { font-size: 9.5px; color: var(--tst-gray-500); background: var(--tst-gray-100); padding: 2px 7px; border-radius: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.divider { height: 1px; background: var(--tst-gray-200); margin: 18px 0; }
.reserved-slogan-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--tst-charcoal);
  color: white; flex-direction: column; text-align: center; padding: 24px;
}
.reserved-slogan-login .slogan { font-family: 'Manrope'; font-weight: 700; font-size: 22px; color: var(--tst-yellow); margin: 18px 0 6px; }

/* ============================================================
   HOSTED CONVERSION — iPad / tablet responsive adjustments only.
   No visual identity, color, spacing philosophy, or component
   redesign here — purely fitting the SAME layout onto narrower
   viewports per section 11 of the hosting-conversion spec. See
   docs/RESPONSIVE_REVIEW.md for what was checked and why each rule
   below exists.
   ============================================================ */

/* Tables (Team, Compliance, Financials, Referral Analytics, Tasks,
   Inquiries, Staff Onboarding) previously used `overflow: hidden` on
   the wrapping card, which CLIPPED extra columns on narrow viewports
   instead of letting you scroll to them — the "horizontal-layout
   disaster" the spec called out. Fixed to scroll horizontally instead,
   keeping every column reachable without shrinking text or breaking
   the existing table styling. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.tst-table { min-width: 640px; }

@media (max-width: 900px) {
  /* Sidebar: same structure/branding, narrower so the main content
     area isn't squeezed to near-nothing on a 768px-wide iPad portrait
     view (the sidebar was previously a fixed 232px on every viewport). */
  :root { --sidebar-w: 176px; }
  .sidebar { padding: 16px 10px; }
  .sidebar-logo .logo-text { font-size: 13px; }
  .sidebar-nav a { padding: 8px 8px; font-size: 12.5px; }

  /* Main content: reclaim padding on narrower screens so cards/tables
     have more usable width, same content and card styling otherwise. */
  .main { padding: 16px 14px 40px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* Team/Capacity clinician rows used a fixed 5-column grid
     (130px 1fr 60px 110px 130px = 430px of fixed columns before the
     flexible name column) that no longer fit next to the sidebar on
     an iPad-width viewport. Scaled down proportionally rather than
     restructured — same columns, same order, same information. */
  .clinician-row, .total-row { grid-template-columns: 88px 1fr 44px 78px 92px; gap: 8px; font-size: 11.5px; }

  /* Modal dialogs: a little less side padding so form fields/buttons
     have room to breathe at narrower widths; same modal, same fields. */
  .modal { padding: 18px; }
  .modal-backdrop { padding: 10px; }
}

@media (max-width: 620px) {
  /* Below iPad-portrait width (phones, or a split-screen iPad app),
     the sidebar drops out of the sticky side column and sits above
     the content instead of squeezing it — still the same nav, same
     footer, same toggle, just stacked instead of side-by-side. */
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { width: 100%; }
}
.reserved-slogan-login .brand-name { font-size: 13px; color: #C9C3B3; letter-spacing: .04em; text-transform: uppercase; }
