
/* ============ SKINS (CSS variable themes) ============ */
:root, [data-skin="ocean"] {
  --bg: #f2f7f9; --panel: #ffffff; --panel-2: #e9f2f5; --ink: #16323c;
  --ink-soft: #4f6b76; --brand: #1a7f8e; --brand-2: #0e5a66; --accent: #e8a33d;
  --line: #d5e4e9; --ok: #2e8b57; --warn: #c9762b; --danger: #c0392b;
  --room-bg: linear-gradient(160deg, #10333d 0%, #1a5560 100%);
  --card-shadow: 0 2px 10px rgba(22,50,60,.08); --radius: 14px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
[data-skin="warm"] {
  --bg: #faf5ef; --panel: #fffdf9; --panel-2: #f5ebdd; --ink: #3d2f24;
  --ink-soft: #7a6a58; --brand: #b0652f; --brand-2: #8a4c1f; --accent: #5d8a66;
  --line: #e8dccb; --ok: #4a7c59; --warn: #b07d2f; --danger: #b03a2e;
  --room-bg: linear-gradient(160deg, #4a3423 0%, #7a5533 100%);
  --card-shadow: 0 2px 10px rgba(61,47,36,.09);
}
[data-skin="forest"] {
  --bg: #f1f6f0; --panel: #ffffff; --panel-2: #e5efe3; --ink: #23372a;
  --ink-soft: #5a7261; --brand: #3a7d44; --brand-2: #275c30; --accent: #c98a2b;
  --line: #d3e3d2; --ok: #2e7d32; --warn: #b8862f; --danger: #b3392b;
  --room-bg: linear-gradient(160deg, #1d3a24 0%, #35603f 100%);
  --card-shadow: 0 2px 10px rgba(35,55,42,.08);
}
[data-skin="lavender"] {
  --bg: #f6f3fa; --panel: #ffffff; --panel-2: #ece5f5; --ink: #322a44;
  --ink-soft: #6d6383; --brand: #6d5aa8; --brand-2: #4f3f85; --accent: #c9803d;
  --line: #e0d7ee; --ok: #3f8a58; --warn: #b8792f; --danger: #b53a3a;
  --room-bg: linear-gradient(160deg, #2c2347 0%, #4d3e78 100%);
  --card-shadow: 0 2px 10px rgba(50,42,68,.09);
}
[data-skin="slate"] {
  --bg: #14181d; --panel: #1e242b; --panel-2: #262e37; --ink: #e6edf3;
  --ink-soft: #9fb0bf; --brand: #4da3b8; --brand-2: #6fc3d8; --accent: #d9a441;
  --line: #313b46; --ok: #4caf7d; --warn: #d09a3e; --danger: #d05548;
  --room-bg: linear-gradient(160deg, #0c1014 0%, #1a2229 100%);
  --card-shadow: 0 2px 12px rgba(0,0,0,.35);
}
[data-skin="classic"] {
  --bg: #f4f4f2; --panel: #ffffff; --panel-2: #ebebe6; --ink: #26292e;
  --ink-soft: #5d636b; --brand: #35597a; --brand-2: #24405a; --accent: #a8763e;
  --line: #dcdcd4; --ok: #38793f; --warn: #a8763e; --danger: #a83232;
  --room-bg: linear-gradient(160deg, #1e2a36 0%, #35597a 100%);
  --card-shadow: 0 2px 10px rgba(38,41,46,.08);
}
[data-skin="blush"] {   /* pink background · blue + yellow */
  --bg: #fdf0f6; --panel: #ffffff; --panel-2: #f9dbe9; --ink: #3a2a33;
  --ink-soft: #7b6472; --brand: #3f6fb3; --brand-2: #2d548c; --accent: #e0a92c;
  --line: #f0d3e0; --ok: #2e8b57; --warn: #c9762b; --danger: #c0392b;
  --room-bg: linear-gradient(160deg, #274a7a 0%, #7a5570 100%);
  --card-shadow: 0 2px 10px rgba(58,42,51,.09);
}
[data-skin="rose"] {   /* pink background · green + brown */
  --bg: #fdf0f6; --panel: #ffffff; --panel-2: #f9dbe9; --ink: #3a2a33;
  --ink-soft: #7b6472; --brand: #5d8a66; --brand-2: #476b4f; --accent: #b0652f;
  --line: #f0d3e0; --ok: #2e8b57; --warn: #b07d2f; --danger: #b03a2e;
  --room-bg: linear-gradient(160deg, #4a3423 0%, #7a5570 100%);
  --card-shadow: 0 2px 10px rgba(58,42,51,.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font, 'Segoe UI', system-ui, sans-serif);
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }

/* ============ LAYOUT ============ */
#app { display: flex; height: 100vh; overflow: hidden; }
#sidebar {
  width: 232px; min-width: 232px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 6px 10px 16px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--brand);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 17px;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-name small { display: block; font-weight: 500; font-size: 10.5px; color: var(--ink-soft); letter-spacing: .04em; }
.navbtn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: none;
  background: transparent; color: var(--ink-soft); border-radius: 9px; font-size: 13.5px; font-weight: 600;
  text-align: left; transition: background .15s;
}
.navbtn:hover { background: var(--panel-2); color: var(--ink); }
.navbtn.active { background: var(--brand); color: #fff; }
.navbtn .ic { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-section { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding: 14px 12px 5px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 10px 8px 4px; font-size: 11px; color: var(--ink-soft); border-top: 1px solid var(--line); }
.badge-secure { display:inline-flex; align-items:center; gap:5px; background: var(--panel-2); border:1px solid var(--line); border-radius: 20px; padding: 4px 10px; font-size: 10.5px; font-weight:600; color: var(--ink-soft); margin-bottom: 6px;}

#main { flex: 1; overflow-y: auto; position: relative; }
.view { display: none; padding: 26px 30px 60px; max-width: 1180px; margin: 0 auto; }
.view.active { display: block; }
.view-title { font-size: 22px; font-weight: 750; margin-bottom: 4px; }
.view-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 22px; }

/* ============ SHARED COMPONENTS ============ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius, 14px); box-shadow: var(--card-shadow); padding: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 650; font-size: 13.5px;
  transition: filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 650; }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill.neutral { background: var(--panel-2); color: var(--ink-soft); }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
h3.section { font-size: 15px; font-weight: 750; margin: 0 0 12px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel-2); border: 1px solid var(--line); padding: 4px 11px; border-radius: 18px; font-size: 12px; font-weight: 600; margin: 0 5px 6px 0; }
.chip button { border: none; background: none; color: var(--ink-soft); font-size: 13px; padding: 0 0 0 2px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); z-index: 300;
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  opacity: 0; transition: all .3s; pointer-events: none; max-width: 480px; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.plain th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.plain td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }

/* ============ DASHBOARD ============ */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--card-shadow); }
.stat .num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--ink-soft); font-weight: 650; margin-top: 3px; }
.appt { display: flex; align-items: center; gap: 13px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.appt:last-child { border-bottom: none; }
.appt .time { font-weight: 800; font-size: 13px; width: 74px; color: var(--brand); flex-shrink: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: 14px; color: var(--brand); flex-shrink: 0; border: 1px solid var(--line); overflow: hidden;}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.compliance-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.compliance-item:last-child { border-bottom: none; }

/* ============ SESSION ROOM ============ */
#view-session.active { display: flex; flex-direction: column; padding: 0; max-width: none; height: 100vh; }
.room-top {
  display: flex; align-items: center; gap: 14px; padding: 10px 72px 10px 18px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;   /* right padding clears the fixed notification bell */
}
.room-top .who { font-weight: 750; font-size: 14.5px; }
.room-top .timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); font-size: 13.5px; }
.loc-banner {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650;
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-soft);
}
.loc-banner.verified { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.loc-banner.missing { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.room-body { flex: 1; display: flex; min-height: 0; background: var(--room-bg); }
.stage { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; padding: 18px; min-width: 0; }
.video-wrap { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#clientTile {
  width: min(100%, 1040px); aspect-ratio: 16/9; max-height: 100%; border-radius: 16px; overflow: hidden;
  background: #0b1518; display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}
/* ---- client's own in-call controls ---- */
#cControls { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 7px; align-items: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(8px); padding: 8px 9px; border-radius: 16px; z-index: 6; flex-wrap: nowrap; width: max-content; max-width: none; }
.cc-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 54px; padding: 7px 9px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1.1; white-space: nowrap; flex: 0 0 auto; }
.cc-btn .i { font-size: 17px; }
.cc-btn:hover { background: rgba(255,255,255,.2); }
/* drag handle for the control bar */
.cc-grip { flex: 0 0 auto; align-self: stretch; display: flex; align-items: center; padding: 0 4px 0 2px; color: rgba(255,255,255,.5);
  cursor: grab; user-select: none; touch-action: none; font-size: 15px; letter-spacing: -1px; }
.cc-grip:active { cursor: grabbing; }
.cc-btn.on { background: var(--brand); border-color: var(--brand); }
.cc-btn.off { background: rgba(200,60,60,.85); border-color: rgba(200,60,60,.9); }
#cSelfTile { position: absolute; right: 28px; bottom: 28px; cursor: grab; touch-action: none; }
#cSelfTile.dragging { cursor: grabbing; }
/* side-by-side layout: therapist and self share the stage equally */
/* GRID view: everyone equal — remote, every guest tile, and yourself.
   !important where inline styles on the stage/videos would otherwise win. */
/* client/guest grid: identical paradigm — JS-sized 16:9 rounded tiles centered on the backdrop */
#clientCall.cc-grid .cc-stage { display: flex !important; flex-wrap: wrap; align-content: center; justify-content: center; gap: 12px; padding-bottom: 140px !important; }
#clientCall.cc-grid #cMainTile, #clientCall.cc-grid .guest-strip .ptile, #clientCall.cc-grid #cSelfTile {
  position: relative !important; inset: auto !important; flex: 0 0 auto;
  aspect-ratio: 16/9 !important; height: auto !important; max-width: 100%; max-height: 100%; min-height: 0;
  border-radius: 16px !important; overflow: hidden; background: #dfe7ea !important; box-shadow: 0 6px 24px rgba(22,50,60,.14);
}
#clientCall.cc-grid .guest-strip { display: contents !important; }
#clientCall.cc-grid #cMainTile video, #clientCall.cc-grid .ptile video, #clientCall.cc-grid #cSelfVideo { object-fit: contain !important; }
/* free-dragged remote tiles (focus view): absolute within the stage, above the strip.
   The explicit width matters — outside the strip, the tile would otherwise balloon
   to the raw video's intrinsic size and cover the whole screen. */
.ptile.free { position: absolute; z-index: 45; cursor: grab; }
.ptile.free.dragging, #cSelfTile.dragging { cursor: grabbing; }
@media (max-width: 640px){ .cc-btn{ min-width: 50px; padding: 6px 7px; } .cc-btn .t{ font-size: 10px; } }
/* placeholder ("no one here yet" / "connection lost"): a centered column that SCALES with
   its tile — circle stays a circle, text clamps, the button never clips off the bottom */
.client-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: #cfe3e8; padding: 10px 16px; overflow: hidden; box-sizing: border-box; }
.client-placeholder > * { max-width: 100%; flex: 0 0 auto; }
.client-placeholder #wrStatusLine { line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#admitBtn { white-space: normal; max-width: 100%; height: auto; margin-top: 4px !important; }
.client-placeholder .big-avatar {
  height: 30%; max-height: 100px; min-height: 34px; aspect-ratio: 1 / 1; width: auto; border-radius: 50%; margin: 0; box-sizing: border-box;
  background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center;
  font-size: clamp(15px, 4.5vh, 34px); font-weight: 700; color: #fff; border: 2px solid rgba(255,255,255,.25);
}
.tile-label {
  position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.55); color: #fff;
  padding: 4px 12px; border-radius: 8px; font-size: 12px; font-weight: 650; backdrop-filter: blur(4px);
}
#selfTile {
  position: absolute; right: 30px; bottom: 30px; width: 220px; aspect-ratio: 4/3; border-radius: 13px;
  overflow: hidden; background: #000; box-shadow: 0 6px 24px rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.25); z-index: 5;
}
#selfVideo, #selfCanvas { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
#selfCanvas { display: none; position: absolute; inset: 0; }
#selfOff { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #9db6bd; font-size: 12.5px; font-weight: 650; background: #101c20; text-align: center; padding: 10px; }
#screenTile { display: none; position: absolute; inset: 18px; border-radius: 14px; overflow: hidden; background: #000; z-index: 4; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
#screenVideo { width: 100%; height: 100%; object-fit: contain; }
.room-side {
  width: 340px; min-width: 340px; background: var(--panel); border-left: 1px solid var(--line);
  display: none; flex-direction: column; min-height: 0;
}
.room-side.open { display: flex; }
.room-side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.room-side-tabs button {
  flex: 1; padding: 11px 4px; border: none; background: none; font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.room-side-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.room-side-tabs .side-close { flex: 0 0 38px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.room-side-tabs .side-close:hover { color: var(--danger); }
.side-pane { flex: 1; display: none; flex-direction: column; min-height: 0; }
.side-pane.active { display: flex; }
#chatLog { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 13px; font-size: 13.5px; }
.msg .who { font-size: 10.5px; font-weight: 700; opacity: .7; margin-bottom: 2px; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; background: none; color: var(--ink-soft); font-size: 11.5px; font-style: italic; padding: 2px; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.controls {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px;
  background: var(--panel); border-top: 1px solid var(--line); flex-wrap: wrap;
}
.ctl {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 66px; padding: 8px 10px;
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; font-size: 10.5px; font-weight: 700; color: var(--ink-soft);
}
.ctl .ic { font-size: 18px; }
.ctl.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ctl.off { background: rgba(200,60,60,.92); border-color: rgba(200,60,60,.95); color: #fff; }   /* muted / camera off — matches the client controls */
.ctl.alert { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctl:hover { filter: brightness(.95); }

/* session notes pane */
#paneNotes { padding: 0; }
#paneNotes .inner { padding: 14px; overflow-y: auto; flex: 1; }
#sessionNoteArea { width: 100%; min-height: 220px; border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-size: 13px; }

/* safety pane */
#paneSafety .inner { padding: 14px; overflow-y: auto; flex: 1; }
.hospital { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hospital:last-child { border-bottom: none; }
.emergency-cta { background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: 11px; padding: 13px; margin-bottom: 13px; }

/* ============ ASSESSMENTS ============ */
.q-row { padding: 11px 0; border-bottom: 1px solid var(--line); }
.q-row:last-child { border-bottom: none; }
.q-text { font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.q-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.q-opts button {
  padding: 5px 11px; border: 1px solid var(--line); background: var(--panel); border-radius: 18px; font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.q-opts button.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.score-box { text-align: center; padding: 18px; border-radius: 12px; background: var(--panel-2); margin-top: 14px; }
.score-box .val { font-size: 34px; font-weight: 800; }

/* ============ DIRECTORY ============ */
.therapist-card { display: flex; gap: 16px; }
.tc-photo { width: 86px; height: 86px; border-radius: 14px; object-fit: cover; background: var(--panel-2); flex-shrink: 0; border: 1px solid var(--line); }
.verify-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 0; }

/* ============ CONSENT DOC ============ */
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 34px; font-size: 14px; line-height: 1.65; }
.doc h2 { font-size: 18px; margin-bottom: 4px; }
.doc h4 { font-size: 13.5px; margin: 16px 0 5px; }
.doc .letterhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 16px; }
.sig-line { border-bottom: 1.5px solid var(--ink); min-width: 220px; display: inline-block; font-family: 'Brush Script MT', cursive; font-size: 20px; padding: 0 8px; min-height: 26px; }

/* skins grid */
.skin-card { border: 2px solid var(--line); border-radius: 13px; padding: 0; overflow: hidden; cursor: pointer; background: var(--panel); text-align: left; }
.skin-card.sel { border-color: var(--brand); }
.skin-preview { height: 74px; display: flex; }
.skin-preview span { flex: 1; }
.skin-card .nm { padding: 9px 12px; font-size: 13px; font-weight: 700; }

/* waiting room */
.breath { width: 120px; height: 120px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 22%, transparent);
  border: 2px solid var(--brand); animation: breathe 8s ease-in-out infinite; display: flex; align-items: center;
  justify-content: center; font-size: 11.5px; font-weight: 700; color: var(--brand); text-align: center; margin: 0 auto; }
@keyframes breathe { 0%,100% { transform: scale(.72); } 45%,55% { transform: scale(1.12); } }
#wrVideo { width: 100%; aspect-ratio: 4/3; border-radius: 12px; background: #0b1518; object-fit: cover; transform: scaleX(-1); display: block; }
.wr-step { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.wr-step:last-child { border-bottom: none; }
.wr-num { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); flex-shrink: 0; }
.wr-step.done .wr-num { background: var(--ok); border-color: var(--ok); color: #fff; }

/* welcome modal */
#welcome {
  position: fixed; inset: 0; background: rgba(10,25,30,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
}
#welcome .box { background: var(--panel); border-radius: 18px; max-width: 560px; padding: 34px 36px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.wl-point { display: flex; gap: 11px; margin: 11px 0; font-size: 13.5px; align-items: flex-start; }
.wl-point .ic { color: var(--ok); font-weight: 800; flex-shrink: 0; }

/* ============ REAL APP ADDITIONS ============ */
body.client-mode #sidebar { display: none !important; }
body.client-mode .view.active { max-width: 860px; }

/* ============ 4-4-8 BREATHING (16s cycle: in 4 · hold 4 · out 8) ============ */
.breath { animation: breathe448 16s ease-in-out infinite; }
@keyframes breathe448 {
  0%   { transform: scale(.72); }
  25%  { transform: scale(1.14); }  /* 4s inhale */
  50%  { transform: scale(1.14); }  /* 4s hold  */
  100% { transform: scale(.72); }   /* 8s exhale */
}

/* ============ MOBILE PASS (client-facing views) ============ */
@media (max-width: 640px) {
  body.client-mode .view.active { padding: 18px 14px 48px; }
  body.client-mode .grid2 { grid-template-columns: 1fr !important; gap: 14px; }
  body.client-mode .card { padding: 18px; }
  .breath { width: 104px; height: 104px; }
  /* in-call layout on phones */
  #clientCall:not(.cc-grid) #cSelfTile { width: 104px !important; right: 12px !important; bottom: 84px !important; }
  #clientCall #cChatPane { position: absolute; inset: auto 0 0 0; width: 100% !important; min-width: 0 !important; height: 46%; border-left: none; border-top: 1px solid var(--line); z-index: 5; }
  #clientCall #cMainTile { border-radius: 10px; }
  #clientAssess { inset: 10px !important; padding: 16px !important; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ LIGHT SESSION ROOM (white backdrop, per GP) ============ */
.room-body { background: #eef2f4 !important; }
.stage { padding: 16px; }
#clientTile { background: #dfe7ea; box-shadow: 0 6px 24px rgba(22,50,60,.14); }
.client-placeholder { color: #4f6b76; }
.client-placeholder .big-avatar { background: #c6d4d9; color: #4f6b76; border-color: #b3c5cc; }
#selfTile { cursor: grab; box-shadow: 0 6px 20px rgba(22,50,60,.22); border-color: #fff; }
#selfTile:active { cursor: grabbing; }
/* GRID: everyone equal — the client, every guest, and you. The auto-fit grid adapts
   to headcount: 2 people = side-by-side, 3–4 = a proper grid. */
.video-wrap { position: relative; }
/* Grid = video-shaped 16:9 tiles, sized by JS (gridReflow) so everyone fits, centered on the
   page background. No bands, no slices — just rounded screens. Same paradigm as the client side. */
.stage.grid .video-wrap { display: flex !important; flex-wrap: wrap; align-content: center; justify-content: center; gap: 14px; height: calc(100% - 58px); }
.stage.grid #clientTile, .stage.grid #selfTile, .stage.grid .guest-strip .ptile {
  position: relative !important; inset: auto !important; flex: 0 0 auto;
  aspect-ratio: 16/9 !important; height: auto !important; max-width: 100%; max-height: 100%; min-height: 0;
  border-radius: 16px !important; overflow: hidden; background: #dfe7ea; cursor: default; box-shadow: 0 6px 24px rgba(22,50,60,.14);
}
.stage.grid .guest-strip { display: contents !important; }
/* letterbox INSIDE the video-shaped tile: bars (if any) match the light backdrop */
.stage.grid #clientVideo, .stage.grid #selfTile video, .stage.grid #selfTile canvas, .stage.grid .ptile video { object-fit: contain !important; }
/* client call: light theme */
#clientCall { background: #eef2f4 !important; }
#clientCall > div:first-child { background: #ffffff !important; color: var(--ink) !important; border-bottom: 1px solid var(--line); }
#clientCall > div:first-child .pill { background: color-mix(in srgb, var(--ok) 12%, #fff) !important; color: var(--ok) !important; }
#cMainTile { background: #dfe7ea !important; }
#cConnecting { color: #4f6b76 !important; }
#cConnecting > div:first-child { border-color: #c6d4d9 !important; border-top-color: var(--brand) !important; }
/* client call on phones: video fills the screen */
@media (max-width: 640px) {
  #clientCall > div:first-child { padding: 8px 10px !important; gap: 8px !important; }
  #clientCall > div:first-child b { font-size: 13px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #clientCall .btn.small { padding: 7px 10px; font-size: 12px; }
  #clientCall:not(.cc-grid) #cMainTile { width: 100% !important; height: calc(100% - 8px) !important; max-height: none !important; aspect-ratio: auto !important; border-radius: 12px !important; }
}

/* no sideways scroll, ever, on client-facing screens */
body.client-mode, #clientCall { overflow-x: hidden; max-width: 100vw; }
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  #clientCall > div:first-child { flex-wrap: wrap; }
  body.client-mode .card, body.client-mode .qcard { max-width: 100%; }
  body.client-mode input, body.client-mode textarea { max-width: 100%; }
}

/* iOS: inputs under 16px trigger auto-zoom that leaves the page horizontally scrollable */
@media (max-width: 640px) {
  body.client-mode input, body.client-mode textarea, body.client-mode select,
  #clientCall input, #clientCall textarea { font-size: 16px !important; }
}

/* ================= CLIENTS & SCHEDULE ================= */
/* the scheduling workspace gets the full window width */
#view-clients { max-width: none; }
.clients-grid { grid-template-columns: minmax(320px, 420px) 1fr; align-items: start; }
@media (max-width: 1000px) { .clients-grid { grid-template-columns: 1fr; } }

/* segmented switch — two visible positions, always reversible, no disappearing links */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel-2); }
.seg-btn { border: none; background: transparent; padding: 7px 13px; font-size: 12.5px; font-weight: 650;
  color: var(--ink-soft); cursor: pointer; font-family: inherit; transition: all .15s; }
.seg-btn.on { background: var(--brand); color: #fff; }
.seg-btn:not(.on):hover { color: var(--ink); }

/* floating "message from your therapist" pop — fixed to the viewport, slides in from the top */
.wr-msg-pop { position: fixed; top: 16px; left: 50%; z-index: 220; width: min(440px, calc(100% - 24px));
  background: color-mix(in srgb, var(--brand) 12%, var(--panel)); border: 1.5px solid var(--brand);
  border-radius: 14px; padding: 13px 34px 13px 16px; box-shadow: 0 16px 44px rgba(22,50,60,.30);
  transform: translateX(-50%) translateY(-170%); opacity: 0;
  transition: transform .40s cubic-bezier(.2,.9,.3,1.15), opacity .30s; }
.wr-msg-pop.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.wr-msg-pop.pulse { animation: wrMsgPulse 1.1s ease 1; }
@keyframes wrMsgPulse { 0%,100% { box-shadow: 0 16px 44px rgba(22,50,60,.30); }
  45% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 32%, transparent), 0 16px 44px rgba(22,50,60,.30); } }
.wr-msg-x { position: absolute; top: 5px; right: 9px; background: none; border: none; font-size: 21px;
  line-height: 1; color: var(--brand); cursor: pointer; opacity: .65; font-family: inherit; }
.wr-msg-x:hover { opacity: 1; }

/* week calendar */
.cal { display: grid; grid-template-columns: 52px repeat(7, minmax(96px, 1fr)); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; min-width: 740px; background: var(--line); gap: 1px; }
.cal-corner, .cal-day, .cal-hour, .cal-cell { background: var(--panel); }
.cal-day { padding: 7px 4px; text-align: center; font-size: 11.5px; font-weight: 650; color: var(--ink-soft); }
.cal-day b { display: block; font-size: 15px; color: var(--ink); }
.cal-day.today { background: var(--brand); color: #fff; }
.cal-day.today b { color: #fff; }
/* days outside the therapist's weekly availability — grayed but still clickable */
.cal-day.off:not(.today) { background: var(--panel-2); }
.cal-day.off:not(.today) b { color: var(--ink-soft); }
.cal-cell.off:not(.today) { background: color-mix(in srgb, var(--ink-soft) 7%, var(--panel)); }
.cal-cell.off:not(.today):hover { background: color-mix(in srgb, var(--brand) 9%, var(--panel)); }
.cal-hour { padding: 5px 6px 0 0; text-align: right; font-size: 10.5px; color: var(--ink-soft); font-weight: 600; }
.cal-cell { min-height: 34px; cursor: pointer; padding: 2px; display: flex; flex-direction: column; gap: 2px; }
.cal-cell:hover { background: color-mix(in srgb, var(--brand) 8%, var(--panel)); }
.cal-cell.today { background: color-mix(in srgb, var(--brand) 11%, var(--panel)); }
.cal-cell.today:hover { background: color-mix(in srgb, var(--brand) 20%, var(--panel)); }
.cal-chip { background: var(--brand); color: #fff; border-radius: 6px; padding: 3px 6px; font-size: 10.5px;
  font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-chip:hover { background: var(--brand-2, #0e5a66); }
.cal-chip[draggable="true"] { cursor: grab; }
.cal-chip[draggable="true"]:active { cursor: grabbing; }
.cal-cell.cal-drop { background: color-mix(in srgb, var(--brand) 22%, var(--panel)); outline: 2px dashed var(--brand); outline-offset: -2px; }

/* calendar early/late expander rows */
.cal-x { grid-column: 1 / -1; background: var(--panel-2); text-align: center; padding: 6px; font-size: 11.5px;
  font-weight: 650; color: var(--ink-soft); cursor: pointer; user-select: none; }
.cal-x:hover { color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--panel-2)); }

/* real clients never see the therapist-side waiting-room tools */
body.client-mode #wrTherapistUI { display: none !important; }

/* compact patient list: search, scroll, name-opens-details, actions menu */
.client-scroll { max-height: 62vh; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.client-name { border: none; background: none; padding: 4px 2px; font-family: inherit; font-size: 14px;
  color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; border-radius: 7px; }
.client-name:hover { color: var(--brand); }
.client-name .chev { font-size: 10px; color: var(--ink-soft); }
.action-menu { position: fixed; z-index: 230; background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; box-shadow: 0 12px 40px rgba(22,50,60,.22); min-width: 230px; padding: 5px; }
.action-menu button { display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 9px 12px; font-family: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; border-radius: 7px; }
.action-menu button:hover { background: var(--panel-2); color: var(--brand); }

/* one clean line per patient — nothing wraps, long names truncate */
.client-row { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; min-width: 0; }
.client-row .client-name { flex: 1; min-width: 0; justify-content: flex-start; text-align: left; }
.client-row .client-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn-kebab { padding: 6px 10px; font-size: 15px; line-height: 1; font-weight: 800; }

/* ended sessions on the calendar: quiet, not clickable */
.cal-chip.done { background: var(--panel-2); color: var(--ink-soft); cursor: default; }
.cal-chip.done:hover { background: var(--panel-2); }

/* ---- specialties picker (searchable multi-select) — My Listing ---- */
.specpicker{ position:relative; }
#pf-specs:not(:empty){ margin-bottom:8px; }
.specadd{ padding:9px 14px; border:1px dashed var(--line); border-radius:9px; background:var(--panel); color:var(--brand); font-weight:600; font-size:13.5px; cursor:pointer; font-family:inherit; }
.specadd:hover{ border-color:var(--brand); }
.specmenu{ position:absolute; left:0; right:0; top:100%; margin-top:6px; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 14px 44px rgba(0,0,0,.18); z-index:60; padding:10px; }
.specmenu input{ width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px; font-size:14px; font-family:inherit; background:var(--panel); color:var(--ink); margin-bottom:6px; }
.speclist{ max-height:300px; overflow-y:auto; }
.specgroup{ font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); margin:10px 6px 3px; }
.specopt{ display:flex; align-items:center; gap:9px; padding:7px 9px; border-radius:7px; cursor:pointer; font-size:14px; color:var(--ink); }
.specopt:hover{ background:var(--bg); }
.specopt .box{ width:16px; height:16px; border:1.6px solid var(--line); border-radius:4px; display:flex; align-items:center; justify-content:center; font-size:11px; color:#fff; flex:0 0 auto; }
.specopt.on .box{ background:var(--brand); border-color:var(--brand); }
.specempty{ padding:14px; color:var(--ink-soft); font-size:13.5px; text-align:center; }
.specdone{ display:block; width:100%; margin-top:8px; padding:9px; border:none; border-radius:8px; background:var(--brand); color:#fff; font-weight:700; font-size:13.5px; cursor:pointer; font-family:inherit; }

/* ============ THERAPIST APP — MOBILE NAV DRAWER ============ */
/* Desktop is unchanged: these elements are hidden until the phone breakpoint. */
#mobileBar { display: none; }
#navBackdrop { display: none; }
@media (max-width: 760px) {
  /* slim top bar with a hamburger (therapist app only; never in client mode) */
  #mobileBar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 150;
    background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 14px;
  }
  body.client-mode #mobileBar { display: none !important; }
  #navHamb {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 38px; padding: 0 9px; cursor: pointer;
    background: none; border: 1px solid var(--line); border-radius: 9px;
  }
  #navHamb span { display: block; height: 2.5px; width: 100%; background: var(--ink); border-radius: 2px; }
  .mb-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ink); }
  .mb-logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff;
             display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }

  /* the sidebar slides in from the left instead of stealing width from the content */
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 262px; min-width: 0; z-index: 200;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 44px rgba(0,0,0,.28);
  }
  #app.nav-open #sidebar { transform: translateX(0); }
  #app.nav-open #navBackdrop { display: block; position: fixed; inset: 0; background: rgba(10,25,30,.45); z-index: 190; }

  /* content now has the whole screen */
  .view { padding: 18px 15px 56px; }

  /* nothing may scroll the page sideways (kills the left/right wiggle) */
  #main { overflow-x: hidden; }
  .view, .view .card { max-width: 100%; }
  /* collapse ANY two/three-column layout to a single column on phones —
     including ones set with inline styles, which the class rules don't catch */
  .view [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* wide tables (e.g. Admin) scroll inside their own box, not the page */
  .view table.plain { display: block; width: 100%; overflow-x: auto; }
}

/* ============ CLIENT CHECK-IN / WAITING ROOM — MOBILE HARDENING ============ */
/* Guarantees the two-column check-in becomes one column on phones and that the
   street + ZIP row can shrink to fit, so nothing runs off the right edge. */
@media (max-width: 760px) {
  #wrClientUI .grid2 { grid-template-columns: 1fr !important; gap: 14px; }
  #wrStreet, #wrZip { min-width: 0; }
}

/* ============ HARD OVERFLOW CLAMP (phones) ============ */
/* Nothing in the signed-in app may push past either edge of the screen. */
@media (max-width: 760px) {
  html, body, #app, #main { max-width: 100vw; overflow-x: hidden; }
  #main > * , .view > * { max-width: 100%; }
}

/* iOS Safari can auto-inflate text and blow out the layout width — pin it. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ============ iOS FLEX-SHRINK FIX (the real cause of the left/right spill) ============ */
/* A flex child defaults to min-width:auto, so its content can force the whole
   column wider than the phone (iOS honours this even with overflow-x:hidden).
   Allow the content column and its flex rows to shrink so text wraps to fit.
   The video Session Room is excluded — it needs its fixed-size panels. */
#main { min-width: 0; }
@media (max-width: 760px) {
  .view:not(#view-session) [style*="display:flex"],
  .view:not(#view-session) [style*="display: flex"],
  .view:not(#view-session) [style*="display:flex"] > *,
  .view:not(#view-session) [style*="display: flex"] > * { min-width: 0; }
}

/* ============ SAFARI iOS RESIDUAL-WIDTH FIX ============ */
/* iOS Safari's 100vw can be a few px wider than the visible viewport, and it
   respects overflow-x:clip more reliably than overflow-x:hidden. Use % + clip.
   Also cap the floating toast so it can never poke past a narrow screen. */
.toast { max-width: calc(100vw - 24px); }
@media (max-width: 760px) {
  html, body, #app, #main { max-width: 100%; overflow-x: clip; }
  body.client-mode, #clientCall { max-width: 100%; }
}

/* ============ iOS SAFARI OFF-CANVAS DRAWER FIX ============ */
/* iOS Safari counts an off-screen position:fixed element as scrollable area
   (WebKit bug: overflow:hidden on <body> is ignored). The closed drawer sat at
   left:-262px and let Safari scroll sideways to it. Hiding it while closed
   removes it from the scroll area; the slide animation still plays because the
   visibility change is delayed until the slide-out finishes. */
@media (max-width: 760px) {
  #sidebar { visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  #app.nav-open #sidebar { visibility: visible; transition: transform .25s ease, visibility 0s linear 0s; }
}

/* ============ iOS SAFARI SCROLL-LOCK (documented) ============ */
/* Safari ignores overflow:hidden on <body> (WebKit bug 153852) but DOES respect
   it on a position:fixed wrapper. Pin the app shell to the viewport so there is
   no horizontal scroll no matter what. Mobile only; desktop untouched. */
@media (max-width: 760px) {
  #app { position: fixed; inset: 0; height: auto; overflow: hidden; }
}

/* ================= MESSAGES + NOTIFICATION BELL (P2) ================= */
/* unread badge on the sidebar "Messages" item */
.nav-badge { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px;
  padding:0 5px; margin-left:auto; background:var(--danger); color:#fff; border-radius:10px; font-size:11px; font-weight:800; }
.navbtn { position:relative; }

/* fixed notification bell — sits above content, below modals */
#bellWrap { position:fixed; top:14px; right:18px; z-index:120; }
#bellBtn { position:relative; width:44px; height:44px; border-radius:50%; border:1px solid var(--line);
  background:var(--panel); box-shadow:0 3px 12px rgba(22,50,60,.14); font-size:19px; cursor:pointer; line-height:1; }
#bellBtn:hover { background:var(--panel-2); }
.bell-count { position:absolute; top:-4px; right:-4px; min-width:19px; height:19px; padding:0 5px;
  background:var(--danger); color:#fff; border-radius:10px; font-size:11px; font-weight:800;
  display:flex; align-items:center; justify-content:center; border:2px solid var(--panel); }
.bell-panel { position:absolute; top:52px; right:0; width:330px; max-width:86vw; max-height:70vh; overflow-y:auto;
  background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:0 18px 50px rgba(22,50,60,.22); }
.bell-head { padding:13px 16px; font-weight:800; font-size:13.5px; border-bottom:1px solid var(--line); color:var(--ink); }
.bell-item { padding:12px 16px; border-bottom:1px solid var(--line); cursor:pointer; }
.bell-item:last-child { border-bottom:none; }
.bell-item:hover { background:var(--panel-2); }
.bell-item .bi-top { display:flex; align-items:center; gap:8px; }
.bell-item .bi-name { font-weight:750; font-size:13.5px; color:var(--ink); }
.bell-item .bi-dot { width:8px; height:8px; border-radius:50%; background:var(--brand); flex:0 0 auto; }
.bell-item .bi-prev { font-size:12.5px; color:var(--ink-soft); margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bell-empty { padding:26px 16px; text-align:center; color:var(--ink-soft); font-size:13px; }

/* two-pane inbox */
.msg-layout { display:grid; grid-template-columns:320px 1fr; gap:16px; align-items:start; }
.thread-list { background:var(--panel); border:1px solid var(--line); border-radius:14px; overflow:hidden; max-height:70vh; overflow-y:auto; }
.thread-item { padding:14px 16px; border-bottom:1px solid var(--line); cursor:pointer; display:flex; gap:10px; }
.thread-item:last-child { border-bottom:none; }
.thread-item:hover { background:var(--panel-2); }
.thread-item.active { background:color-mix(in srgb, var(--brand) 9%, var(--panel)); }
.thread-item .ti-dot { width:9px; height:9px; border-radius:50%; background:var(--brand); margin-top:5px; flex:0 0 auto; visibility:hidden; }
.thread-item.unread .ti-dot { visibility:visible; }
.thread-item .ti-name { font-weight:750; font-size:14px; color:var(--ink); }
.thread-item.unread .ti-name { font-weight:800; }
.thread-item .ti-prev { font-size:12.5px; color:var(--ink-soft); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:230px; }
.thread-item .ti-time { font-size:11px; color:var(--ink-soft); margin-top:3px; }
.thread-empty-list { padding:26px 16px; text-align:center; color:var(--ink-soft); font-size:13px; }

.thread-pane { background:var(--panel); border:1px solid var(--line); border-radius:14px; min-height:420px; display:flex; flex-direction:column; }
.thread-empty { margin:auto; color:var(--ink-soft); font-size:14px; padding:40px; text-align:center; }
.tp-head { padding:15px 18px; border-bottom:1px solid var(--line); }
.tp-head .tp-name { font-weight:800; font-size:16px; color:var(--ink); }
.tp-head .tp-email { font-size:12.5px; color:var(--ink-soft); margin-top:2px; }
.tp-body { flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:10px; max-height:52vh; }
.msg-bubble { max-width:78%; padding:10px 14px; border-radius:14px; font-size:14px; line-height:1.5; white-space:pre-wrap; word-wrap:break-word; }
.msg-bubble.them { align-self:flex-start; background:var(--panel-2); color:var(--ink); border-bottom-left-radius:4px; }
.msg-bubble.me { align-self:flex-end; background:var(--brand); color:#fff; border-bottom-right-radius:4px; }
.msg-time { font-size:10.5px; color:var(--ink-soft); margin-top:2px; }
.msg-bubble.me + .msg-time { text-align:right; }
.tp-reply { border-top:1px solid var(--line); padding:12px; display:flex; gap:10px; align-items:flex-end; }
.tp-reply textarea { flex:1; border:1px solid var(--line); border-radius:10px; padding:10px 12px; font-size:14px;
  font-family:inherit; resize:vertical; min-height:44px; max-height:160px; color:var(--ink); background:var(--panel); }
@media (max-width: 760px) {
  .msg-layout { grid-template-columns:1fr; }
  .thread-list { max-height:none; }
  #bellWrap { top:12px; right:12px; }
}

body.client-mode #bellWrap { display:none; }

/* ================= AVAILABILITY EDITOR (P4) ================= */
.av-settings{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px}
.av-week{display:flex;flex-direction:column}
.av-day{display:grid;grid-template-columns:170px 1fr;gap:14px;align-items:start;padding:14px 0;border-bottom:1px solid var(--line)}
.av-day:last-child{border-bottom:none}
.av-day.is-off{opacity:.72}
.av-toggle{display:flex;align-items:center;gap:9px;font-size:15px;cursor:pointer;padding-top:6px}
.av-toggle input{width:auto}
.av-ranges{display:flex;flex-direction:column;gap:9px;align-items:flex-start}
.av-range{display:flex;align-items:center;gap:9px}
.av-range input[type=time]{padding:8px 10px;border:1px solid var(--line);border-radius:9px;font-size:14px;font-family:inherit;color:var(--ink);background:var(--panel)}
.av-x{border:none;background:none;color:var(--ink-soft);cursor:pointer;font-size:14px;padding:4px 6px;border-radius:6px}
.av-x:hover{background:var(--panel-2);color:var(--danger)}
.av-add{border:1.5px dashed var(--line);background:none;color:var(--brand);font-weight:650;font-size:13px;cursor:pointer;padding:7px 13px;border-radius:9px;font-family:inherit}
.av-add:hover{border-color:var(--brand)}
@media(max-width:640px){.av-day{grid-template-columns:1fr;gap:8px}}

/* ================= BOOKING REQUESTS CARD (P4) ================= */
.req-card{margin-bottom:16px;border:1.5px solid color-mix(in srgb,var(--accent) 45%,var(--line))}
.req-count{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;padding:0 7px;background:var(--accent);color:#fff;border-radius:11px;font-size:12.5px;font-weight:800;margin-left:6px}
.req-sub{font-size:13px;color:var(--ink-soft);margin-bottom:12px}
.req-row{display:flex;align-items:center;gap:14px;padding:12px 0;border-top:1px solid var(--line);flex-wrap:wrap}
.req-info{flex:1;min-width:200px}
.req-info b{font-size:14.5px}
.req-when{font-weight:700;color:var(--brand);margin-left:6px}
.req-email{font-size:12.5px;color:var(--ink-soft);margin-top:2px}
.req-acts{display:flex;gap:8px;flex:0 0 auto}
.btn.small{padding:8px 15px;font-size:13px}

/* ================= SCREEN-SHARE FIT ================= */
/* a video carrying a SHARED SCREEN must show the whole screen — letterbox it, never crop.
   (!important so it beats the inline object-fit:cover that face tiles use) */
video.screen-src{object-fit:contain !important;background:#0e1518 !important}

/* "camera is off" veil — shown over a peer's tile when they turn their camera off,
   so a black rectangle never reads as a broken connection. Their name label stays visible. */
.cam-off-veil{position:absolute;inset:0;background:#1c272b;color:#dfe7ea;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:22px;z-index:2}
.cam-off-veil span{font-size:12.5px;font-weight:700}
.ptile-name{z-index:3}

/* ================= CLIENT/GUEST BRANDING ================= */
/* small, quiet MyTherapyMatch mark on every client- and guest-facing surface */
.mtm-brand{display:flex;align-items:center;gap:8px;user-select:none}
.mtm-brand-m{width:26px;height:26px;border-radius:8px;background:#1a7f8e;color:#fff;font-weight:800;font-size:13px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.mtm-brand-t{font-weight:750;font-size:13.5px;letter-spacing:.01em;white-space:nowrap}
@media(max-width:640px){ #clientCall .mtm-brand-t{display:none} }  /* in-call top bar: keep just the M on phones */

/* ===== Recoup (collections) — scoped to #view-recoup so it inherits the active office theme ===== */
#view-recoup .rp-kpis{ display:grid; grid-template-columns:repeat(auto-fit,minmax(158px,1fr)); gap:12px; margin:6px 0 4px; }
#view-recoup .rp-kpi{ background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:14px 15px; }
#view-recoup .rp-kpi .v{ font-size:24px; font-weight:800; letter-spacing:-.5px; color:var(--ink); }
#view-recoup .rp-kpi .l{ font-size:12px; color:var(--ink-soft); margin-top:3px; line-height:1.35; }
#view-recoup .rp-kpi.hero{ border-color:var(--ok); }
#view-recoup .rp-kpi.hero .v{ color:var(--ok); }
#view-recoup .rp-grid{ display:grid; grid-template-columns:1.15fr 1fr; gap:16px; margin-top:16px; }
@media(max-width:900px){ #view-recoup .rp-grid{ grid-template-columns:1fr; } }
#view-recoup .rp-card{ padding:0; overflow:hidden; }
#view-recoup .rp-h{ font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-soft); margin:0; padding:13px 16px; border-bottom:1px solid var(--line); }
#view-recoup .rp-table{ width:100%; border-collapse:collapse; font-size:13px; }
#view-recoup .rp-table th,#view-recoup .rp-table td{ text-align:left; padding:9px 12px; border-bottom:1px solid var(--line); }
#view-recoup .rp-table th{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); }
#view-recoup tr.rp-claim{ cursor:pointer; }
#view-recoup tr.rp-claim:hover{ background:var(--panel-2); }
#view-recoup tr.rp-claim.sel{ background:var(--panel-2); box-shadow:inset 3px 0 0 var(--brand); }
#view-recoup .rp-mono{ font-variant-numeric:tabular-nums; }
#view-recoup .rp-pill{ display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:700; border:1px solid var(--line); }
#view-recoup .rp-pill.s-paid{ color:var(--ok); } #view-recoup .rp-pill.s-recovered{ color:var(--brand); }
#view-recoup .rp-pill.s-denied,#view-recoup .rp-pill.s-appealing{ color:var(--danger); }
#view-recoup .rp-pill.s-underpaid{ color:var(--warn); }
#view-recoup .rp-pill.s-written_off,#view-recoup .rp-pill.s-closed,#view-recoup .rp-pill.s-patient_billed,#view-recoup .rp-pill.s-submitted,#view-recoup .rp-pill.s-draft{ color:var(--ink-soft); }
#view-recoup .rp-empty{ padding:26px; color:var(--ink-soft); font-size:13.5px; }
#view-recoup .rp-detail-h{ font-size:14px; font-weight:800; color:var(--ink); margin:0; padding:13px 16px; border-bottom:1px solid var(--line); }
#view-recoup .rp-note{ font-size:12px; color:var(--ink-soft); padding:10px 16px; background:var(--panel-2); }
#view-recoup .rp-lbl{ font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-soft); margin:14px 16px 0; font-weight:700; }
#view-recoup .rp-tl{ list-style:none; margin:0; padding:12px 16px; max-height:290px; overflow:auto; }
#view-recoup .rp-tl li{ font-size:12.5px; padding:5px 0 5px 14px; border-left:2px solid var(--line); margin-left:4px; }
#view-recoup .rp-tl li b{ color:var(--brand); }
#view-recoup .rp-tl li.k-recovered{ border-color:var(--ok); }
#view-recoup .rp-tl li.k-denied,#view-recoup .rp-tl li.k-appeal_upheld{ border-color:var(--danger); }
#view-recoup .rp-tl li.k-appeal_filed,#view-recoup .rp-tl li.k-underpayment_appeal{ border-color:var(--warn); }
#view-recoup .rp-letter{ margin:12px 16px 16px; background:var(--panel-2); border:1px solid var(--line); border-radius:10px; padding:14px; font-family:ui-monospace,Menlo,monospace; font-size:11.5px; white-space:pre-wrap; line-height:1.5; max-height:340px; overflow:auto; color:var(--ink); }

/* Recoup — recovery-by-play breakdown strip + new event-kind colors */
#view-recoup .rp-mix{ display:flex; flex-wrap:wrap; gap:10px 18px; align-items:center; margin:4px 2px 0; padding:10px 12px; background:var(--panel-2); border:1px solid var(--line); border-radius:12px; font-size:12.5px; }
#view-recoup .rp-mix-lbl{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); font-weight:700; }
#view-recoup .rp-mix-item{ color:var(--ink); } #view-recoup .rp-mix-item b{ color:var(--ink-soft); font-weight:600; }
#view-recoup .rp-tl li.k-reauth_approved{ border-color:var(--ok); }
#view-recoup .rp-tl li.k-reauth_requested,#view-recoup .rp-tl li.k-downcoded,#view-recoup .rp-tl li.k-clawback,#view-recoup .rp-tl li.k-clawback_dispute{ border-color:var(--warn); }
#view-recoup .rp-tl li.k-reauth_denied,#view-recoup .rp-tl li.k-clawback_lost{ border-color:var(--danger); }
#view-recoup .rp-tl li.k-corrected_resubmit{ border-color:var(--warn); }
#view-recoup .rp-tl li.k-duplicate_confirmed{ border-color:var(--ink-soft); }

/* Denyless — Live/Demo tabs + demo watermark */
#view-recoup .dl-tabs{ display:flex; gap:8px; margin:2px 0 14px; }
#view-recoup .dl-tab{ padding:7px 20px; border-radius:20px; border:1px solid var(--line); background:var(--panel); cursor:pointer; font-weight:700; font-size:13px; color:var(--ink-soft); font-family:inherit; }
#view-recoup .dl-tab:hover{ border-color:var(--brand); color:var(--brand); }
#view-recoup .dl-tab.active{ background:var(--brand); color:#fff; border-color:var(--brand); }
#view-recoup .dl-tab.demo.active{ background:var(--accent); border-color:var(--accent); }
#view-recoup .dl-demo{ position:relative; }
#view-recoup .dl-watermark{ position:absolute; inset:0; pointer-events:none; z-index:6; display:flex; flex-direction:column; align-items:center; justify-content:space-around; overflow:hidden; }
#view-recoup .dl-watermark span{ font-size:110px; font-weight:900; letter-spacing:.25em; color:var(--ink); opacity:.05; transform:rotate(-22deg); white-space:nowrap; user-select:none; }

/* Denyless "Your practice details" — make the collapsed card obviously expandable */
#view-recoup #dlIdentityCard summary{ list-style:none; }
#view-recoup #dlIdentityCard summary::-webkit-details-marker{ display:none; }
#view-recoup #dlIdentityCard summary::after{ content:'▾ view / edit'; font-size:12px; font-weight:700; color:var(--brand); white-space:nowrap; }
#view-recoup #dlIdentityCard[open] summary::after{ content:'▴ close'; }
#view-recoup #dlIdentityCard summary:hover{ background:var(--panel-2); }

/* Denyless billing sub-tabs (underline style, distinct from the big Live/Demo pills) */
#view-recoup .dl-subtabs{ display:flex; gap:2px; border-bottom:1px solid var(--line); margin:0 0 14px; }
#view-recoup .dl-subtab{ position:relative; padding:8px 14px; background:none; border:none; border-bottom:2px solid transparent; margin-bottom:-1px; cursor:pointer; font-weight:700; font-size:13px; color:var(--ink-soft); font-family:inherit; }
#view-recoup .dl-subtab:hover{ color:var(--brand); }
#view-recoup .dl-subtab.active{ color:var(--brand); border-bottom-color:var(--brand); }
#view-recoup .dl-subtab.attn::after{ content:''; position:absolute; top:6px; right:4px; width:7px; height:7px; border-radius:50%; background:var(--warn); }

/* busy spinner on async action buttons */
.btn.busy{ pointer-events:none; opacity:.75; }
.btn.busy::after{ content:''; display:inline-block; width:11px; height:11px; margin-left:7px; border:2px solid currentColor; border-top-color:transparent; border-radius:50%; animation:dlspin .7s linear infinite; vertical-align:-1px; }
@keyframes dlspin{ to{ transform:rotate(360deg); } }
#view-recoup .rp-pill.s-appeal_sent{ color:var(--warn); }
