/* HIAZ APP — Online Psychology Consultation
   Design tokens mirror the existing Finance module for visual consistency.
   Mobile-first, no emoji icons, soft borders and rounded cards. */
:root{
  --psy-teal:#14b8a6;
  --psy-teal-dark:#0f8f82;
  --psy-teal-light:#e8f7f5;
  --psy-teal-border:#cce9e6;
  --psy-text:#183238;
  --psy-muted:#718287;
  --psy-line:#e6eded;
  --psy-bg:#ffffff;
  --psy-surface:#fbfcfc;
  --psy-danger:#bd4d4d;
  --psy-danger-light:#fff0f0;
  --psy-warning:#b7791f;
  --psy-warning-light:#fdf6e3;
  --psy-radius:16px;
  --psy-radius-sm:10px;
  --psy-shadow:0 20px 60px rgba(24,50,56,.18);
  --psy-gap:16px;
}

*,*::before,*::after{box-sizing:border-box}

html{-webkit-text-size-adjust:100%}

body{
  margin:0;
  background:var(--psy-bg);
  color:var(--psy-text);
  font-family:"Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  font-size:15px;
  line-height:1.6;
}

h1,h2,h3,h4{margin:0 0 8px;line-height:1.3;color:var(--psy-text)}
h1{font-size:22px}
h2{font-size:19px}
h3{font-size:16px}
p{margin:0 0 12px}

a{color:var(--psy-teal-dark);text-decoration:none}
a:hover{text-decoration:underline}

/* ---------- Layout ---------- */
.psy-page{max-width:1080px;margin:0 auto;padding:20px 16px 48px}
.psy-header{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-bottom:20px}
.psy-header .psy-title{flex:1 1 auto;min-width:0}
.psy-subtitle{font-size:13px;color:var(--psy-muted);margin:0}

.psy-grid{display:grid;grid-template-columns:1fr;gap:var(--psy-gap)}
.psy-grid-2{display:grid;grid-template-columns:1fr;gap:var(--psy-gap)}
.psy-grid-3{display:grid;grid-template-columns:1fr;gap:var(--psy-gap)}

/* ---------- Cards ---------- */
.psy-card{
  background:var(--psy-bg);
  border:1px solid var(--psy-line);
  border-radius:var(--psy-radius);
  padding:18px;
  overflow-wrap:anywhere;
}
.psy-card--soft{background:var(--psy-surface)}
.psy-card__head{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:12px}
.psy-card__head h2,.psy-card__head h3{margin:0;flex:1 1 auto;min-width:0}

/* ---------- Buttons ---------- */
.psy-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  font:inherit;font-weight:650;line-height:1;
  min-height:44px;padding:11px 18px;
  border-radius:var(--psy-radius-sm);
  border:1px solid transparent;
  cursor:pointer;
  text-decoration:none;
}
.psy-btn:hover{text-decoration:none}
.psy-btn--primary{background:var(--psy-teal);color:#fff}
.psy-btn--primary:hover{background:var(--psy-teal-dark)}
.psy-btn--ghost{background:#fff;border-color:var(--psy-line);color:#526568}
.psy-btn--ghost:hover{background:var(--psy-surface)}
.psy-btn--soft{background:var(--psy-teal-light);border-color:var(--psy-teal-border);color:var(--psy-teal-dark)}
.psy-btn--soft:hover{background:#d8efec}
.psy-btn--danger{background:#fff;border-color:var(--psy-line);color:var(--psy-danger)}
.psy-btn--danger:hover{background:var(--psy-danger-light)}
.psy-btn:disabled{opacity:.6;cursor:not-allowed}
.psy-btn--block{width:100%}

/* ---------- Forms ---------- */
.psy-field{display:block;margin-bottom:14px}
.psy-field > span{display:block;font-size:11px;color:var(--psy-muted);margin-bottom:6px}
.psy-field input,.psy-field select,.psy-field textarea{
  box-sizing:border-box;font:inherit;width:100%;min-width:0;
  border:1px solid var(--psy-line);border-radius:9px;
  padding:10px;color:inherit;background:#fff;
}
.psy-field textarea{min-height:85px;resize:vertical}
.psy-field input:focus-visible,.psy-field select:focus-visible,.psy-field textarea:focus-visible,
.psy-btn:focus-visible,a:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}
.psy-hint{display:block;margin-top:6px;font-size:11px;color:var(--psy-muted)}
.psy-error{font-size:12px;color:var(--psy-danger);margin:6px 0 0}

/* Quick-prompt chips for the "reason for visit" answer. A chip appends its phrase to
   the textarea, so the text stays the single source of truth — and the analysis tags
   are derived from exactly what the patient can see. */
.psy-prompts{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 8px}
.psy-prompt{
  font:inherit;font-size:12px;line-height:1;
  padding:8px 12px;border-radius:999px;cursor:pointer;
  color:var(--psy-teal-dark);background:var(--psy-teal-light);
  border:1px solid var(--psy-teal-border);
}
.psy-prompt:hover{background:var(--psy-teal);border-color:var(--psy-teal);color:#fff}
.psy-prompt:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}
/* Small muted note under the primary action (e.g. "confirmed after payment"). */
.psy-pay-note{margin:10px 0 0;font-size:12px;color:var(--psy-muted);text-align:center}

/* The fee is decided by the server from the patient's history, so the form says so
   instead of offering a price to choose. Styled as information, not a warning. */
.psy-fee-note{
  margin:0 0 16px;
  padding:12px 14px;
  border:1px solid var(--psy-teal-border);
  border-radius:12px;
  background:var(--psy-teal-light);
  color:var(--psy-text);
  font-size:13px;
  line-height:1.5;
}

/* ---------- Badges ---------- */
.psy-badge{
  display:inline-flex;align-items:center;
  font-size:11px;font-weight:650;line-height:1;
  padding:5px 10px;border-radius:999px;
  border:1px solid var(--psy-line);background:var(--psy-surface);color:var(--psy-muted);
}
.psy-badge--available{background:var(--psy-teal-light);border-color:var(--psy-teal-border);color:var(--psy-teal-dark)}
.psy-badge--unavailable{background:var(--psy-danger-light);border-color:#f3d6d6;color:var(--psy-danger)}
.psy-badge--pending{background:var(--psy-warning-light);border-color:#f0e2bd;color:var(--psy-warning)}
/* Consultation type badges ("New Client" / "Repeat / Follow-up"). */
.psy-badge--new{background:#ecfdf5;border-color:#d1fae5;color:#065f46}
.psy-badge--followup{background:#f3f4f6;border-color:#e5e7eb;color:#4b5563}

/* ---------- Avatar ---------- */
.psy-avatar{
  display:inline-flex;align-items:center;justify-content:center;
  width:48px;height:48px;flex:0 0 auto;
  border-radius:50%;
  background:var(--psy-teal-light);color:var(--psy-teal-dark);
  font-weight:700;font-size:15px;letter-spacing:.5px;
}

/* The published roster ships a headshot per psychologist, so the circle becomes
   a clipped photo (kept round by the wrapper's border-radius). A profile added
   through the admin form has no photo and keeps the initials fallback above. */
.psy-avatar--photo{
  padding:0;overflow:hidden;
  background:var(--psy-bg);
  border:1px solid var(--psy-line);
}
.psy-avatar--photo img{
  display:block;width:100%;height:100%;
  object-fit:cover;border-radius:50%;
}

/* ---------- Psychologist list ---------- */
.psy-cp-list{display:grid;grid-template-columns:1fr;gap:var(--psy-gap);list-style:none;margin:0;padding:0}
.psy-cp{display:flex;gap:14px;align-items:flex-start}
.psy-cp__body{flex:1 1 auto;min-width:0}
.psy-cp__name{font-size:15px;font-weight:650;margin:0 0 2px}
.psy-cp__role{font-size:12px;color:var(--psy-muted);margin:0 0 8px}
.psy-cp__meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.psy-cp__next{font-size:12px;color:var(--psy-muted)}

/* ---------- Public top bar ---------- */
/* The customer pages centre the brand. Every .psy-logo is absolutely centred
   (out of flow), so the Back link — when there is one — no longer carries a
   width reserve and the logo stays optically centred on all pages. */
.psy-topbar{
  display:flex;align-items:center;justify-content:center;
  position:relative;min-height:60px;
  padding:16px;border-bottom:1px solid var(--psy-line);background:var(--psy-bg);
}
.psy-logo{
  position:absolute;left:50%;transform:translateX(-50%);
  font-size:20px;font-weight:800;letter-spacing:-.6px;color:var(--psy-text);
  white-space:nowrap;
}
.psy-logo span{color:var(--psy-teal)}
.psy-topbar__spacer{display:none}
.psy-back{
  display:inline-flex;align-items:center;gap:6px;
  min-width:0;min-height:44px;padding:0 8px;margin-right:auto;
  font-size:13px;font-weight:650;color:var(--psy-muted);text-decoration:none;
}
.psy-back:hover{color:var(--psy-teal-dark);text-decoration:none}


/* ---------- Hero ---------- */
.psy-hero{padding:28px 0 20px;text-align:center}
.psy-hero h1{font-size:26px;letter-spacing:-.5px;margin:0 0 6px}
.psy-hero p{margin:0;color:var(--psy-muted);font-size:14px}

/* ---------- Search ---------- */
.psy-search{position:relative;margin:0 0 20px}
.psy-search input{
  box-sizing:border-box;font:inherit;width:100%;min-width:0;
  border:1px solid var(--psy-line);border-radius:var(--psy-radius-sm);
  padding:12px 14px;color:inherit;background:#fff;
}
.psy-search input:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}

/* ---------- Clickable CP card ---------- */
.psy-cp-card{
  display:flex;gap:14px;align-items:flex-start;
  background:var(--psy-bg);border:1px solid var(--psy-line);
  border-radius:var(--psy-radius);padding:16px;
  color:inherit;text-decoration:none;
  transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease;
}
.psy-cp-card:hover{
  text-decoration:none;
  transform:translateY(-2px);
  border-color:var(--psy-teal-border);
  box-shadow:0 10px 26px rgba(20,184,166,.16);
}
.psy-cp-card--disabled{
  opacity:.6;cursor:not-allowed;
  background:var(--psy-surface);
}
.psy-cp-card--disabled:hover{transform:none;box-shadow:none;border-color:var(--psy-line)}
.psy-cp-card .psy-cp__body{display:flex;flex-direction:column;align-items:flex-start}
.psy-cp-card .psy-cp__name{display:block;margin:0 0 6px;overflow-wrap:anywhere}
.psy-cp-card .psy-cp__role{display:block;margin:0}
.psy-cp-card__status{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:12px}
.psy-status-dot{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12px;font-weight:650;color:var(--psy-teal-dark);
}
.psy-status-dot::before{
  content:"";width:8px;height:8px;border-radius:50%;
  background:var(--psy-teal);flex:0 0 auto;
}
.psy-status-off{
  display:inline-flex;align-items:center;gap:6px;
  font-size:11px;font-weight:650;line-height:1;
  padding:5px 10px;border-radius:999px;
  background:var(--psy-danger-light);border:1px solid #f3d6d6;color:var(--psy-danger);
}
.psy-status-off::before{content:"\2298";font-size:12px;line-height:1}

/* ---------- Slots ---------- */
.psy-slots{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;list-style:none;margin:0;padding:0}
.psy-slot{
  display:flex;align-items:center;justify-content:center;
  min-height:44px;padding:8px;
  border:1px solid var(--psy-line);border-radius:var(--psy-radius-sm);
  background:#fff;color:var(--psy-text);font-size:13px;font-weight:600;
  cursor:pointer;
}
.psy-slot:hover{border-color:var(--psy-teal-border);background:var(--psy-teal-light)}
.psy-slot[aria-pressed="true"]{background:var(--psy-teal);border-color:var(--psy-teal);color:#fff}
.psy-slot:disabled{opacity:.45;cursor:not-allowed;background:var(--psy-surface);text-decoration:line-through}

/* ---------- Time slot grid (Page 3) ---------- */
.psy-slot-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;list-style:none;margin:0;padding:0;
}
.psy-slot-grid .psy-slot{
  width:100%;min-height:48px;padding:10px 8px;
  border:1px solid var(--psy-teal-border);
  background:#fff;color:var(--psy-teal-dark);
  font-size:13px;font-weight:650;
  transition:background .15s ease,color .15s ease,border-color .15s ease,box-shadow .15s ease;
}
.psy-slot-grid .psy-slot:hover{
  background:var(--psy-teal-light);border-color:var(--psy-teal-border);color:var(--psy-teal-dark);
}
/* Selected slot: solid teal fill + white text. Higher specificity than
   .psy-slot-grid .psy-slot:hover so hover cannot override the selected state. */
.psy-slot-grid .psy-slot.psy-slot--selected,
.psy-slot-grid .psy-slot.psy-slot--selected:hover,
.psy-slot-grid .psy-slot[aria-pressed="true"],
.psy-slot-grid .psy-slot[aria-pressed="true"]:hover{
  background:var(--psy-teal);border-color:var(--psy-teal);color:#fff;
  box-shadow:0 6px 16px rgba(20,184,166,.28);
  cursor:pointer;
}
.psy-slot-grid .psy-slot.psy-slot--unavailable,
.psy-slot-grid .psy-slot.psy-slot--unavailable:hover,
.psy-slot-grid .psy-slot:disabled,
.psy-slot-grid .psy-slot:disabled:hover{
  background:#f3f4f6;border-color:var(--psy-line);color:#9aa5a7;
  cursor:not-allowed;text-decoration:none;box-shadow:none;
}
.psy-slot-grid .psy-slot:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}


/* ---------- Booking: narrow page + CP summary ---------- */
.psy-page--narrow{max-width:560px}
.psy-cp-summary{display:flex;gap:14px;align-items:flex-start;margin-bottom:20px}
.psy-cp-summary .psy-cp__name{margin:0 0 2px}
.psy-cp-summary .psy-cp__role{margin:0 0 8px}

/* ---------- Error card ---------- */
.psy-error-card{
  background:var(--psy-danger-light);border:1px solid #f3d6d6;
  border-radius:var(--psy-radius);padding:20px;text-align:center;
}
.psy-error-card h2{color:var(--psy-danger);font-size:17px}
.psy-error-card .psy-btn{margin-top:8px}

/* ---------- Calendar ---------- */
/* width:100% + max-width:100% + overflow:hidden is what stops a narrow phone
   from ever scrolling sideways inside the card. min-width:0 lets the card
   shrink inside the booking grid column instead of being held open by its
   own content (grid/flex items default to min-width:auto). */
.psy-calendar{width:100%;max-width:100%;min-width:0;padding:16px;overflow:hidden}
.psy-calendar__head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px}
/* nowrap keeps "September 2026" on one line: with a wrap allowed the label
   broke into "Septembe r 2026" once the flex row became narrower than the
   text. min-width:0 lets the flex item shrink so the month name never pushes
   the nav buttons out of the card. */
.psy-calendar__month{
  font-size:16px;font-weight:700;margin:0;text-align:center;
  flex:1 1 auto;min-width:0;white-space:nowrap;
}
.psy-calendar__nav{
  display:inline-flex;align-items:center;justify-content:center;
  width:40px;height:40px;flex:0 0 auto;
  font:inherit;font-size:16px;line-height:1;
  border:1px solid var(--psy-line);border-radius:var(--psy-radius-sm);
  background:#fff;color:var(--psy-text);cursor:pointer;
}
.psy-calendar__nav:hover{border-color:var(--psy-teal-border);background:var(--psy-teal-light);color:var(--psy-teal-dark)}
.psy-calendar__nav:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}

/* The weekday row and the day grid share repeat(7,minmax(0,1fr)) so their
   columns line up exactly; minmax(0,...) is what allows each column to shrink
   below its content width on a narrow phone. */
.psy-calendar__dow{
  display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;
  margin-bottom:6px;
}
.psy-calendar__dow span{
  min-width:0;text-align:center;font-size:11px;font-weight:650;
  text-transform:uppercase;letter-spacing:.03em;color:var(--psy-muted);
  /* nowrap stops "MON" from breaking into "MO N" in a ~35px column. */
  white-space:nowrap;overflow:hidden;
}
/* How the "Mon ... Sun" labels are shortened and then fits the 7 equal columns:
   wide screens keep "MON", <=480px switches to one letter (M T W T F S S). */
.psy-calendar__dow--short{display:none}

.psy-calendar__grid{
  display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;
  width:100%;max-width:100%;min-width:0;
}
.psy-calendar__blank{min-width:0;height:48px}
/* Date cell shows only the day number. Fixed height keeps every row identical
   (no jumping when a month has no available dates) and gives a 48px tap target,
   comfortably above the 44px mobile minimum. min-width:0 lets the cell shrink
   with its 1fr column instead of forcing the row wider than the card, and
   nowrap keeps a two-digit number like "14" on one line. */
.psy-calendar__day{
  display:flex;align-items:center;justify-content:center;
  width:100%;min-width:0;height:48px;padding:4px;
  font:inherit;font-size:13px;font-weight:600;
  border:1px solid transparent;border-radius:var(--psy-radius-sm);
  background:transparent;color:var(--psy-text);cursor:pointer;
  white-space:nowrap;
}
.psy-calendar__daynum{line-height:1;white-space:nowrap}
.psy-calendar__day--today{border-color:var(--psy-teal-border)}
.psy-calendar__day--available{background:var(--psy-teal-light);color:var(--psy-teal-dark)}
.psy-calendar__day--available:hover{background:var(--psy-teal);color:#fff}
.psy-calendar__day--selected,
.psy-calendar__day--selected:hover{
  background:var(--psy-teal-dark);border-color:var(--psy-teal-dark);color:#fff;
}
.psy-calendar__day--off{color:#c3ccce;cursor:not-allowed}
.psy-calendar__day:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}

.psy-calendar__legend{
  display:flex;flex-wrap:wrap;gap:16px;align-items:center;
  margin-top:16px;padding-top:14px;border-top:1px solid var(--psy-line);
  font-size:12px;color:var(--psy-muted);
}
.psy-legend__item{display:inline-flex;align-items:center;gap:6px}
.psy-legend__dot{width:10px;height:10px;border-radius:50%;flex:0 0 auto}
.psy-legend__dot--available{background:var(--psy-teal)}
.psy-legend__dot--off{border:1px solid #c3ccce;background:transparent}

/* ---------- Footer actions ---------- */
.psy-footer-actions{margin-top:20px}

/* ---------- Payment page (Task 1B-1) ---------- */
.psy-page--payment{max-width:600px}

/* Booking summary: label/value rows, compact, above the "Complete Payment"
   heading so the patient can see what they are paying for. */
.psy-summary-card{margin-bottom:22px;padding:14px 16px}
.psy-summary-card .psy-confirm-ref__value{font-size:16px;letter-spacing:.4px}
.psy-summary-card .psy-confirm-row{margin-bottom:6px}
.psy-summary-card .psy-confirm-row:last-child{margin-bottom:0}
.psy-summary-card__total{
  margin-top:10px;padding-top:10px;border-top:1px solid var(--psy-line);
}
.psy-summary-card__total dt,.psy-summary-card__total dd{font-size:14px}
.psy-summary-card__total dd{font-weight:800;color:var(--psy-teal-dark)}

/* Payment method sections (QR / bank transfer / receipt upload) */
.psy-pay-section + .psy-pay-section{margin-top:var(--psy-gap)}
.psy-pay-section__head{margin-bottom:12px}
.psy-pay-section__head h2{font-size:16px;margin:0}
.psy-pay-section__note{margin:10px 0 0;font-size:12px;color:var(--psy-muted);text-align:center}

/* The DuitNow QR, bank-transfer and receipt-upload styles were removed with the manual
   payment flow. Payment is a single "Pay with FPX" action on a hosted page. */

/* Footer actions (stacked on mobile, side by side from 480px) */
.psy-pay-actions{display:flex;flex-direction:column;gap:10px;margin-top:22px}
@media(min-width:480px){
  .psy-pay-actions{flex-direction:row}
  .psy-pay-actions .psy-btn{flex:1 1 0}
}

/* ---------- Toasts (customer booking flow) ---------- */
/* Same look as the admin toasts, but the customer pages only load
   psychology.css, so the rules live here too. Bottom-centred so they never
   cover the sticky-looking footer buttons on a phone. */
.psy-toasts{
  position:fixed;left:50%;bottom:24px;transform:translateX(-50%);
  z-index:2000;display:flex;flex-direction:column;align-items:center;gap:8px;
  width:min(360px,calc(100vw - 32px));pointer-events:none;
}
.psy-toasts:empty{display:none}
.psy-toast{
  display:flex;align-items:center;gap:10px;
  width:100%;padding:12px 16px;
  background:var(--psy-bg);color:var(--psy-text);
  border:1px solid var(--psy-line);border-left:4px solid var(--psy-muted);
  border-radius:10px;box-shadow:0 8px 24px rgba(24,50,56,.18);
  font-size:13.5px;line-height:1.45;
  pointer-events:auto;opacity:0;
  transition:opacity .2s ease,transform .2s ease;
}
.psy-toast--in{opacity:1}
.psy-toast--success{background:#ecfdf5;color:#065f46;border-color:#d1fae5;border-left-color:var(--psy-teal)}
.psy-toast--error{background:#fef2f2;color:#991b1b;border-color:#fee2e2;border-left-color:#ef4444}
.psy-toast--loading{border-left-color:var(--psy-muted)}
.psy-toast__icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:18px;height:18px}
.psy-toast__icon svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2}
.psy-toast--success .psy-toast__icon{color:var(--psy-teal-dark)}
.psy-toast__msg{flex:1 1 auto;min-width:0}
.psy-toast__spinner{
  width:14px;height:14px;
  border:2px solid rgba(0,0,0,.15);border-top-color:var(--psy-muted);
  border-radius:50%;animation:psySpin .7s linear infinite;
}
@keyframes psySpin{from{transform:rotate(0)}to{transform:rotate(360deg)}}

/* ---------- Booking Confirmation (Page 4) ---------- */
.psy-page--confirm{max-width:600px}

/* Success hero */
.psy-success{text-align:center;padding:12px 0 24px}
.psy-success__icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:72px;height:72px;margin-bottom:14px;
  border-radius:50%;
  background:var(--psy-teal-light);border:1px solid var(--psy-teal-border);
  color:var(--psy-teal);
}
.psy-success__icon svg{width:38px;height:38px;display:block}
.psy-success h1{font-size:24px;letter-spacing:-.4px;margin:0 0 6px}
.psy-success p{margin:0;color:var(--psy-muted);font-size:14px}

/* Detail card sections */
.psy-confirm-card{padding:0}
.psy-confirm-section{padding:16px 18px}
.psy-confirm-section + .psy-confirm-section{border-top:1px solid var(--psy-line)}
.psy-confirm-section__label{
  font-size:11px;font-weight:650;text-transform:uppercase;
  letter-spacing:.04em;color:var(--psy-muted);margin:0 0 8px;
}
.psy-confirm-ref{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.psy-confirm-ref__value{
  font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;
  font-size:20px;font-weight:700;letter-spacing:.5px;color:var(--psy-text);
  overflow-wrap:anywhere;
}
.psy-copy-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:36px;height:36px;flex:0 0 auto;
  border:1px solid var(--psy-line);border-radius:var(--psy-radius-sm);
  background:#fff;color:var(--psy-muted);cursor:pointer;
}
.psy-copy-btn:hover{border-color:var(--psy-teal-border);background:var(--psy-teal-light);color:var(--psy-teal-dark)}
.psy-copy-btn:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}
.psy-copy-btn svg{width:18px;height:18px;display:block}
.psy-copy-btn--done{border-color:var(--psy-teal-border);background:var(--psy-teal-light);color:var(--psy-teal-dark)}

.psy-confirm-cp{display:flex;gap:12px;align-items:center}
.psy-confirm-cp .psy-avatar{width:44px;height:44px;font-size:14px}
.psy-confirm-cp .psy-cp__name{margin:0 0 2px;font-size:15px}
.psy-confirm-cp .psy-cp__role{margin:0;font-size:12px}

.psy-confirm-rows{margin:0}
.psy-confirm-row{display:flex;justify-content:space-between;gap:16px;margin:0 0 8px}
.psy-confirm-row:last-child{margin-bottom:0}
.psy-confirm-row dt{font-size:12px;color:var(--psy-muted);font-weight:600;flex:0 0 auto}
.psy-confirm-row dd{margin:0;font-size:13px;font-weight:650;color:var(--psy-text);text-align:right;overflow-wrap:anywhere}

/* Info notice */
.psy-notice{
  display:flex;gap:10px;align-items:flex-start;
  margin-top:16px;padding:14px 16px;
  background:var(--psy-teal-light);border:1px solid var(--psy-teal-border);
  border-radius:var(--psy-radius);font-size:13px;color:var(--psy-text);
}
.psy-notice svg{width:18px;height:18px;flex:0 0 auto;margin-top:2px;color:var(--psy-teal-dark)}
.psy-notice p{margin:0}
.psy-notice__title{font-weight:700;margin:0 0 2px}
.psy-notice--info{font-size:13.5px;line-height:1.55}
.psy-notice--info p + p{margin-top:6px}

/* Footer buttons */
.psy-confirm-actions{display:flex;flex-direction:column;gap:10px;margin-top:20px}
@media(min-width:480px){
  .psy-confirm-actions{flex-direction:row}
  .psy-confirm-actions .psy-btn{flex:1 1 0}
}

/* The read-only payment-receipt card was removed with the manual flow. */


/* ---------- Patient Details form (Page 4) ---------- */
.psy-page--details{max-width:600px}

/* Compact booking summary card */
.psy-booking-summary{
  background:var(--psy-teal-light);
  border-color:var(--psy-teal-border);
  padding:14px 16px;
  margin-bottom:20px;
}
.psy-booking-summary__cp{display:flex;gap:12px;align-items:center}
.psy-booking-summary__cp .psy-avatar{width:42px;height:42px;font-size:14px}
.psy-booking-summary__cp .psy-cp__name{margin:0 0 2px;font-size:14px}
.psy-booking-summary__cp .psy-cp__role{margin:0;font-size:12px}
.psy-booking-summary__meta{
  display:flex;flex-wrap:wrap;gap:6px 24px;
  margin:12px 0 0;padding-top:12px;
  border-top:1px solid var(--psy-teal-border);
}
.psy-booking-summary__row{display:flex;align-items:baseline;gap:8px;margin:0}
.psy-booking-summary__row dt{font-size:11px;font-weight:650;text-transform:uppercase;letter-spacing:.04em;color:var(--psy-muted)}
.psy-booking-summary__row dd{margin:0;font-size:13px;font-weight:650;color:var(--psy-text)}

/* Form fields */
.psy-field label,.psy-field legend{
  display:block;font-size:13px;font-weight:650;color:var(--psy-text);margin-bottom:6px;
}
.psy-fieldset{border:0;padding:0;margin:0 0 14px}
.psy-fieldset legend{padding:0}
.psy-req{color:var(--psy-danger);font-weight:700}
.psy-optional{font-weight:500;color:var(--psy-muted);font-size:12px}
.psy-field input[aria-invalid="true"],
.psy-field textarea[aria-invalid="true"]{border-color:var(--psy-danger);background:var(--psy-danger-light)}

/* Radio + checkbox groups */
/* Stacked option lists. */
.psy-radio-group{display:flex;flex-direction:column;gap:12px}
/* Gender keeps its two options side by side on one row. */
.psy-radio-group--inline{flex-direction:row;flex-wrap:wrap;gap:10px 24px}
.psy-radio,.psy-checkbox{
  display:flex;align-items:center;gap:10px;
  font-size:13px;font-weight:500;color:var(--psy-text);cursor:pointer;
}
/* Radio labels get their own vertical rhythm so a wrapped option stays comfortable. */
.psy-radio{padding:8px 0}
.psy-radio-group--inline .psy-radio{padding:4px 0}
.psy-radio span{line-height:1.5;min-width:0}
.psy-checkbox{align-items:flex-start}
/* Option labels live inside a .psy-field wrapper, whose `.psy-field label`
   rule sets display:block. That selector is more specific (0,1,1) than
   `.psy-radio` (0,1,0), so it silently won and killed the flex layout — and
   with it the gap between the circle and the text. This rule restores the flex
   row with the specificity needed to beat `.psy-field label`. */
.psy-field label.psy-radio{display:flex;align-items:center;gap:12px;width:auto;max-width:100%}
.psy-field label.psy-checkbox{display:flex;align-items:flex-start;gap:12px}
.psy-radio-group label{display:flex;align-items:center;gap:12px}
/* Fallback for any radio/checkbox label that forgets the .psy-radio class. */
label:has(> input[type="radio"]){display:flex;align-items:center;gap:12px}
label:has(> input[type="checkbox"]){display:flex;align-items:flex-start;gap:12px}
.psy-radio input,.psy-checkbox input{
  width:18px;height:18px;flex:0 0 auto;margin:0;
  accent-color:var(--psy-teal);cursor:pointer;
}
/* The label gap is the only spacing, so no extra margin on the control. */
.psy-radio input{margin:0}
.psy-checkbox input{margin:2px 0 0}
.psy-consent{
  margin:18px 0 16px;
  padding:0;
  border:0;
}
.psy-consent__legend{padding:0;margin:0 0 4px;font-size:14px;font-weight:700;color:var(--psy-text)}
.psy-consent__intro{margin:0 0 12px;font-size:12.5px;line-height:1.5;color:var(--psy-muted)}
.psy-consent__item{
  display:flex;flex-wrap:wrap;gap:8px 12px;align-items:flex-start;
  padding:12px 14px;margin-bottom:10px;
  background:#fff;border:1px solid var(--psy-line);border-radius:var(--psy-radius-sm);
}
.psy-consent .psy-checkbox{flex:1 1 260px;min-width:0;line-height:1.5;font-size:13.5px}
.psy-consent a{font-weight:650}

/* "Read Document": a small chip beside the checkbox, never a full-width button that
   competes with the consent itself. */
.psy-consent__read{
  flex:0 0 auto;margin-left:auto;
  padding:7px 12px;font:inherit;font-size:12.5px;font-weight:650;
  color:var(--psy-teal-dark);background:var(--psy-teal-light);
  border:1px solid var(--psy-teal-border);border-radius:999px;cursor:pointer;
}
.psy-consent__read:hover{background:var(--psy-teal);border-color:var(--psy-teal);color:#fff}
.psy-consent__read:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}

/* ---------- Document reader (consent modal) ---------- */
.psy-doc-modal{
  position:fixed;inset:0;z-index:1200;
  display:flex;align-items:center;justify-content:center;
  padding:16px;
}
.psy-doc-modal[hidden]{display:none}
.psy-doc-modal__backdrop{position:absolute;inset:0;background:rgba(15,23,42,.55)}
.psy-doc-modal__card{
  position:relative;z-index:1;
  width:100%;max-width:560px;max-height:82vh;
  display:flex;flex-direction:column;
  background:#fff;border-radius:14px;
  box-shadow:0 24px 60px rgba(15,23,42,.28);
  padding:20px;
}
.psy-doc-modal__title{margin:0 0 12px;font-size:17px;color:var(--psy-text)}
/* While a document is open the page behind it must not move. Only the modal body scrolls;
   overscroll-behavior keeps the inner scroll from chaining to the page at either end, which
   `overflow:hidden` alone does not do on iOS. */
body.psy-no-scroll{overflow:hidden}
.psy-doc-modal__body{
  flex:1 1 auto;overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-y;
  font-size:15px;line-height:1.6;color:var(--psy-text);
  background:var(--psy-surface);border:1px solid var(--psy-line);border-radius:10px;
  padding:16px 18px;
}
.psy-doc-modal__body p{margin:0 0 16px}
.psy-doc-modal__body p:last-child{margin-bottom:0}
.psy-doc-modal__body h4{
  margin:20px 0 8px;
  font-size:15px;font-weight:700;color:var(--psy-text);
}
.psy-doc-modal__body h4:first-child{margin-top:0}
.psy-doc-modal__body ul,
.psy-doc-modal__body ol{
  list-style-type:disc;
  margin:0 0 16px;
  padding-left:20px;
}
.psy-doc-modal__body ol{list-style-type:decimal}
.psy-doc-modal__body li{margin:0 0 8px;padding-left:2px}
.psy-doc-modal__body li:last-child{margin-bottom:0}
.psy-doc-modal__body ul ul{list-style-type:circle;margin:8px 0 0;padding-left:18px}
.psy-doc-modal__body strong{font-weight:700}
.psy-doc-modal__foot{display:flex;justify-content:flex-end;margin-top:16px}
@media(max-width:480px){
  .psy-doc-modal{padding:10px}
  .psy-doc-modal__card{padding:16px;max-height:88vh}
  .psy-consent__read{margin-left:0}
}


/* ---------- Booking: merged calendar + slots ---------- */
.psy-page--booking{max-width:1080px;padding-bottom:120px}
/* The calendar sits inside its own column on wide screens, but on a phone it is
   the single widest thing on the page: the booking page and the 24px grid gap
   can both be released at phone widths so the 7 columns get the most room. */
.psy-page--booking .psy-booking-grid{gap:20px}
.psy-page--booking .psy-booking-col--calendar{min-width:0}
.psy-booking-grid{display:grid;grid-template-columns:1fr;gap:24px}
.psy-booking-col{min-width:0}
.psy-booking-col .psy-header{margin-bottom:14px}
.psy-booking-col .psy-header h1{font-size:19px}
.psy-slot-placeholder{
  margin:0;padding:24px;text-align:center;
  color:var(--psy-muted);font-style:italic;font-size:13px;
}

/* ---------- Sticky summary bar ---------- */
.psy-summary-bar{
  position:fixed;left:0;right:0;bottom:0;z-index:20;
  background:var(--psy-bg);
  border-top:1px solid var(--psy-line);
  box-shadow:0 -8px 24px rgba(24,50,56,.10);
}
.psy-summary-bar__inner{
  max-width:1080px;margin:0 auto;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 16px;
}
.psy-summary-bar__info{display:flex;flex-wrap:wrap;gap:6px 18px;min-width:0}
.psy-summary-bar__item{font-size:13px;font-weight:650;color:var(--psy-text);white-space:nowrap}
.psy-summary-bar__label{color:var(--psy-muted);font-weight:600}
.psy-summary-bar .psy-btn{flex:0 0 auto}


/* ---------- Tables ---------- */
.psy-table{width:100%;border-collapse:collapse;font-size:13px}

.psy-table th,.psy-table td{padding:10px;text-align:left;border-bottom:1px solid var(--psy-line);vertical-align:top}
.psy-table th{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--psy-muted);font-weight:650}
.psy-table tbody tr:last-child td{border-bottom:0}

/* ---------- Empty state ---------- */
.psy-empty{padding:24px;text-align:center;color:var(--psy-muted);font-size:13px;border:1px dashed var(--psy-line);border-radius:var(--psy-radius)}

/* ---------- Utilities ---------- */
/* A compact button, shared by the pages that render action rows in a card. */
.psy-btn--sm{padding:8px 14px;font-size:13px;border-radius:8px;min-height:38px}
.psy-muted{color:var(--psy-muted)}
.psy-nowrap{white-space:nowrap}
.psy-mt{margin-top:var(--psy-gap)}
.psy-mb{margin-bottom:var(--psy-gap)}
.psy-hidden{display:none !important}

/* ---------- Responsive (mobile-first) ---------- */
@media(min-width:600px){
  .psy-page{padding:28px 24px 64px}
  .psy-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
  .psy-cp-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .psy-slots{grid-template-columns:repeat(3,minmax(0,1fr))}
  .psy-slot-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(min-width:768px){
  /* Merged booking: calendar (60%) + slots (40%) side by side */
  .psy-booking-grid{grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:28px;align-items:start}
  .psy-summary-bar{position:sticky;bottom:0}
}
@media(min-width:900px){
  h1{font-size:26px}
  .psy-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
  .psy-cp-list{grid-template-columns:repeat(3,minmax(0,1fr))}
  .psy-slots{grid-template-columns:repeat(4,minmax(0,1fr))}
  .psy-slot-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}



/* Stacked labeled table rows at narrow widths */
@media(max-width:700px){
  .psy-table thead{display:none}
  .psy-table tr{display:block;border:1px solid var(--psy-line);border-radius:var(--psy-radius-sm);margin-bottom:10px;padding:6px 10px}
  .psy-table td{display:flex;justify-content:space-between;gap:12px;border-bottom:0;padding:6px 0}
  .psy-table td::before{content:attr(data-label);font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--psy-muted);font-weight:650}
}


/* ---------- Narrow phones: calendar + summary bar ---------- */
/* 7 equal columns is the whole problem on a phone: at a 245px viewport the
   calendar card left roughly 35px per day, which was not enough for a "MON"
   label or for a 48px-tall cell (the cell was much taller than the column was
   wide, so the grid read as broken). Everything below re-fits the same markup
   to that width; the HTML is untouched apart from the short weekday row.
   Verified against 245px (small phone), 320px (iPhone SE), 375px (standard)
   and 414px (large phone) using the width model documented in
   docs/psychology-mobile-calendar.md. */
@media(max-width:480px){
  /* Buying horizontal room for the 7 calendar columns. `.psy-page--booking` is
     one class more specific than the shared `.psy-page`, and the media block
     comes last in the file, so this beats the generic 20px/16px padding. */
  .psy-page,.psy-page--booking{padding-left:10px;padding-right:10px}
  .psy-page--booking .psy-booking-grid{gap:16px}
  .psy-topbar{padding:12px}
  /* The bar centres the logo with absolute positioning, so neither the logo
     nor the Back link needs a width reserve any more (the 64px spacer + 64px
     Back min-width were what pushed the page content to ~245px). The logo is
     kept in flow on phones so it can never overlap the Back link. */
  .psy-logo{position:static;transform:none;font-size:17px;letter-spacing:-.3px}

  .psy-calendar{padding:10px}
  .psy-calendar__head{gap:6px;margin-bottom:10px}
  .psy-calendar__month{font-size:16px;white-space:nowrap;text-align:center}
  /* 32x32 arrows instead of 40x40: still comfortably tappable and they leave
     the month title the room it needs to stay on one line. */
  .psy-calendar__nav{width:32px;height:32px;font-size:14px}
  .psy-calendar__dow,
  .psy-calendar__grid{gap:3px}
  .psy-calendar__dow span{font-size:10px;letter-spacing:0}
  /* One-letter weekday row (M T W T F S S) on phones: "MON" cannot fit a ~35px
     column at 245px without breaking into "MO N". */
  .psy-calendar__dow--full{display:none}
  .psy-calendar__dow--short{display:grid}
  .psy-calendar__day{
    /* aspect-ratio square instead of a fixed height: the cell follows the
       column width (~39px at 375px) so a narrow phone never gets tall thin
       boxes, and min-height keeps a 36px touch target even at 245px. */
    height:auto;aspect-ratio:1/1;min-height:36px;
    padding:4px 2px;font-size:13px;border-radius:8px;
  }
  .psy-calendar__blank{height:auto;aspect-ratio:1/1;min-height:36px}
  .psy-calendar__legend{gap:12px;margin-top:12px;padding-top:12px}

  /* Sticky summary bar: the "1 Sep 2026 / 09:00-10:00" pair was nowrap, which
     also pushed the page wider than the phone. */
  .psy-summary-bar__inner{padding:10px 12px;gap:8px}
  .psy-summary-bar__info{gap:4px 12px}
  .psy-summary-bar__item{white-space:normal}
}

/* Very small phones (~245px) need the last few pixels of padding back so every
   day column keeps at least ~28px for a two-digit number. */
@media(max-width:400px){
  .psy-page,.psy-page--booking{padding-left:8px;padding-right:8px}
  .psy-calendar{padding:8px}
  .psy-calendar__dow,
  .psy-calendar__grid{gap:2px}
}

/* ---------- CP portal (the psychologist's own workspace) ---------- */

/* The shared top bar centres an absolutely positioned logo; this page has a signed-in
   identity on the right, so the logo sits in flow instead. Its padding matches the page
   column, so the logo and the cards share one left edge instead of looking shifted. */
.psy-cp-topbar{
  justify-content:space-between;
  padding-inline:max(16px, calc((100% - 820px) / 2 + 16px));
}
.psy-cp-topbar .psy-logo{position:static;transform:none}
.psy-topbar__right{display:flex;align-items:center;gap:10px;margin-left:auto}

/* A session list reads best a little narrower than the full page, centred. */
.psy-portal-page{max-width:820px;margin-inline:auto;width:100%}
.psy-cp-title{margin:0 0 4px;font-size:22px;letter-spacing:-.3px}

.psy-cp-tabs{display:flex;gap:4px;margin:18px 0 16px;border-bottom:1px solid var(--psy-line)}
.psy-cp-tab{
  appearance:none;border:0;background:none;cursor:pointer;
  padding:10px 12px;font:inherit;font-size:13.5px;font-weight:650;color:var(--psy-muted);
  border-bottom:2px solid transparent;margin-bottom:-1px;
}
.psy-cp-tab:hover{color:var(--psy-text)}
.psy-cp-tab[aria-selected="true"]{color:var(--psy-teal-dark);border-bottom-color:var(--psy-teal)}
.psy-cp-tab:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}
.psy-cp-tab__count{
  display:inline-block;min-width:20px;margin-left:4px;padding:1px 6px;
  font-size:11.5px;font-weight:700;color:var(--psy-teal-dark);
  background:var(--psy-teal-light);border-radius:999px;text-align:center;
  font-variant-numeric:tabular-nums;
}

/* The session list. Note the names: .psy-cp-card / .psy-cp-list already belong to the
   admin roster of psychologists, so reusing them here made these cards inherit that
   tile's hover transform, padding and badge rules. These are theirs alone. */
.psy-session-list{display:grid;gap:12px;margin-top:2px}
.psy-session-card{
  display:flex;flex-direction:column;gap:16px;
  padding:18px;background:#fff;
  border:1px solid var(--psy-line);border-radius:var(--psy-radius);
  box-shadow:0 1px 2px rgba(15,23,42,.05);
}

/* Header: initials, name, and where the session stands. */
.psy-session-card__top{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.psy-session-card__who{display:flex;align-items:center;gap:12px;min-width:0}
.psy-session-card__avatar{
  flex:0 0 auto;
  display:inline-flex;align-items:center;justify-content:center;
  width:42px;height:42px;border-radius:50%;
  font-size:13.5px;font-weight:700;letter-spacing:.02em;
  color:var(--psy-teal-dark);
  background:var(--psy-teal-light);
  border:1px solid var(--psy-teal-border);
}
.psy-session-card__name{
  margin:0;font-size:18px;font-weight:700;line-height:1.3;letter-spacing:-.2px;
  color:var(--psy-text);overflow-wrap:anywhere;
}
.psy-session-card__status{flex:0 0 auto}

/* The four facts sit on one even row on a desktop card. */
.psy-session-card__facts{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px 20px;margin:0;
}
.psy-session-card__fact{min-width:0}
.psy-session-card__fact dt{
  margin:0 0 6px;
  font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  color:var(--psy-muted);
}
.psy-session-card__fact dd{
  margin:0;font-size:14.5px;font-weight:650;line-height:1.4;
  color:var(--psy-text);overflow-wrap:anywhere;
}

/* The actions sit below a hairline, so the card reads as header / facts / actions. */
.psy-session-card__actions{
  display:flex;flex-wrap:wrap;gap:8px;
  margin-top:auto;padding-top:14px;
  border-top:1px solid var(--psy-line);
}
.psy-session-card__actions .psy-btn{text-decoration:none}

/* Desktop: a little more air, four facts across, buttons on the right. */
@media(min-width:640px){
  .psy-session-card{padding:20px 22px;gap:18px}
  .psy-session-card__facts{grid-template-columns:repeat(4,minmax(0,1fr))}
  .psy-session-card__actions{justify-content:flex-end}
}
/* A completed session has a fifth fact (when it finished): give it a fifth column rather
   than orphaning it onto a second row. */
@media(min-width:720px){
  .psy-session-card--completed .psy-session-card__facts{
    grid-template-columns:repeat(5,minmax(0,1fr));
  }
}
/* Mobile: two columns and full-width targets. */
@media(max-width:639px){
  .psy-session-card{padding:16px;gap:14px}
  .psy-session-card__facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px}
  .psy-session-card__actions{flex-direction:column}
  .psy-session-card__actions .psy-btn{width:100%}
}

/* Clinical notes worksheet: full-screen, because four SOAP sections need room on a phone.
   The header's status dot is the autosave indicator (unsaved / saving / saved / error). */
.psy-soap{
  position:fixed;inset:0;z-index:1400;display:flex;flex-direction:column;
  background:var(--psy-surface);
}
.psy-soap[hidden]{display:none}
.psy-soap__bar{
  display:flex;align-items:center;gap:12px;padding:10px 16px;
  background:#fff;border-bottom:1px solid var(--psy-line);
}
.psy-soap__who{flex:1;min-width:0}
.psy-soap__title{margin:0;font-size:16px;line-height:1.3}
.psy-soap__meta{
  margin:2px 0 0;font-size:12px;color:var(--psy-muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.psy-soap__status{
  display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;
  font-size:11.5px;color:var(--psy-muted);white-space:nowrap;
}
.psy-soap__dot{width:8px;height:8px;border-radius:50%;background:#cbd5e1;flex:0 0 auto}
.psy-soap__status[data-state="saving"] .psy-soap__dot{background:#d97706}
.psy-soap__status[data-state="saved"] .psy-soap__dot{background:#059669}
.psy-soap__status[data-state="error"] .psy-soap__dot{background:#dc2626}
.psy-soap__tabs{
  display:flex;gap:6px;padding:8px 16px;background:#fff;
  border-bottom:1px solid var(--psy-line);overflow-x:auto;
}
.psy-soap__tab{
  font:inherit;font-size:12.5px;font-weight:650;color:var(--psy-muted);
  background:none;border:1px solid transparent;border-radius:999px;
  padding:8px 14px;cursor:pointer;white-space:nowrap;
}
.psy-soap__tab[aria-selected="true"]{
  background:var(--psy-teal-light);border-color:var(--psy-teal-border);color:var(--psy-teal-dark);
}
.psy-soap__tab:focus-visible{outline:2px solid var(--psy-teal);outline-offset:2px}
.psy-soap__body{
  flex:1;overflow-y:auto;padding:16px;width:100%;max-width:980px;margin:0 auto;
  box-sizing:border-box;
}
.psy-soap__grid{display:grid;gap:14px}
.psy-soap__field{display:block;font-size:13px;font-weight:650}
.psy-soap__field > span{display:block;letter-spacing:.03em}
.psy-soap__field small{
  display:block;margin-top:4px;font-size:12px;line-height:1.45;
  font-weight:400;font-style:italic;color:#6b7280;
}
.psy-soap__field textarea{
  display:block;width:100%;box-sizing:border-box;margin-top:8px;padding:12px;
  font:inherit;font-size:14px;line-height:1.55;color:var(--psy-text);
  background:#fff;border:1px solid var(--psy-line);border-radius:10px;resize:vertical;
}
.psy-soap__field textarea:focus{outline:2px solid var(--psy-teal);outline-offset:1px;border-color:var(--psy-teal)}
.psy-soap__empty{
  padding:28px 20px;background:#fff;border:1px dashed var(--psy-line);
  border-radius:12px;text-align:center;
}
.psy-soap__empty h3{margin:0 0 6px;font-size:15px}
.psy-soap__empty p{margin:0}
.psy-soap__foot{background:#fff;border-top:1px solid var(--psy-line);padding:10px 16px}
.psy-soap__foot .psy-error{margin:0 0 8px}
.psy-soap__footrow{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  max-width:980px;margin:0 auto;
}
.psy-soap__hint{font-size:11.5px;color:var(--psy-muted)}
@media(min-width:760px){
  .psy-soap__grid{grid-template-columns:1fr 1fr}
  .psy-soap__field textarea{min-height:220px}
}
@media(max-width:520px){
  .psy-soap__hint{display:none}
  .psy-soap__footrow{justify-content:flex-end}
  .psy-soap__footrow .psy-btn{flex:1 1 auto}
}

/* Intake forms: one accordion of large textareas, so a long form never becomes one wall
   of scroll. <details>/<summary> keeps it keyboard-accessible with no JavaScript. */
.psy-intake{max-width:760px;margin:0 auto}
.psy-intake__head{
  display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;
  gap:10px 12px;margin-bottom:12px;
}
.psy-intake__heading{flex:1 1 100%;min-width:0}
.psy-intake__heading h3{margin:0;font-size:15px}
.psy-intake__heading p{margin:2px 0 0;font-size:12px}
.psy-intake__actions{
  display:flex;align-items:center;justify-content:flex-end;gap:10px;
  flex:1 1 100%;min-width:0;
}
@media(min-width:760px){
  .psy-intake__heading{flex:1 1 auto}
  .psy-intake__actions{flex:0 0 auto;justify-content:flex-end}
}
.psy-intake__sections{display:grid;gap:10px}
.psy-intake__section{
  background:#fff;border:1px solid var(--psy-line);border-radius:12px;overflow:hidden;
}
.psy-intake__section[open]{box-shadow:0 8px 22px rgba(15,23,42,.06)}
.psy-intake__summary{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:14px 16px;font-size:13.5px;font-weight:650;color:var(--psy-text);
  cursor:pointer;list-style:none;
}
.psy-intake__summary::-webkit-details-marker{display:none}
.psy-intake__summary::after{
  content:"+";flex:0 0 auto;font-size:16px;font-weight:600;color:var(--psy-teal-dark);
}
.psy-intake__section[open] .psy-intake__summary::after{content:"\2013"}
.psy-intake__section[open] > .psy-intake__summary{
  background:#f0fdfa;border-bottom:1px solid #e5e7eb;
}
.psy-intake__summary:focus-visible{outline:2px solid var(--psy-teal);outline-offset:-2px}
.psy-intake__body{display:block;padding:0 16px 16px}
.psy-intake__group{
  display:block;padding:14px 0;border-top:1px solid var(--psy-line);
}
.psy-intake__group:first-child{border-top:0;padding-top:0}
.psy-intake__group:last-child{padding-bottom:0}
.psy-intake__guide{min-width:0}
.psy-intake__guide h4{margin:0;font-size:12.5px;font-weight:700;color:var(--psy-text)}
.psy-intake__guide ul{margin:6px 0 0;padding-left:16px}
.psy-intake__guide li{
  margin:0 0 3px;font-size:11.5px;line-height:1.4;font-style:italic;color:#6b7280;
}
.psy-intake__answer{min-width:0;margin-top:8px}
.psy-intake__answer textarea{
  display:block;width:100%;box-sizing:border-box;padding:10px 12px;
  font:inherit;font-size:13.5px;line-height:1.55;color:var(--psy-text);
  background:#fff;border:1px solid var(--psy-line);border-radius:9px;resize:vertical;
  min-height:100px;
}
.psy-intake__answer textarea:focus{
  outline:2px solid var(--psy-teal);outline-offset:1px;border-color:var(--psy-teal);
}
.psy-intake__answer textarea:disabled{background:var(--psy-surface);color:var(--psy-muted)}
@media(min-width:760px){
  .psy-intake__sections{gap:12px}
}

/* Patient timeline: every past SOAP note, newest first, each one an accordion row. */
.psy-history__timeline{
  margin-top:22px;padding-top:18px;border-top:1px solid var(--psy-line);
}
.psy-history__head h3{margin:0;font-size:15px}
.psy-history__head p{margin:2px 0 12px;font-size:12px}
.psy-history__list{display:grid;gap:10px}
.psy-history__session{
  background:#fff;border:1px solid var(--psy-line);border-radius:12px;overflow:hidden;
}
.psy-history__session[open]{box-shadow:0 8px 22px rgba(15,23,42,.06)}
.psy-history__session-summary{
  display:flex;align-items:baseline;flex-wrap:wrap;justify-content:space-between;
  gap:2px 12px;padding:12px 16px;font-size:13px;font-weight:650;
  color:var(--psy-text);cursor:pointer;list-style:none;
}
.psy-history__session-summary::-webkit-details-marker{display:none}
.psy-history__session-summary::after{
  content:"+";margin-left:auto;font-size:15px;font-weight:600;color:var(--psy-teal-dark);
}
.psy-history__session[open] .psy-history__session-summary::after{content:"\2013"}
.psy-history__session-summary:focus-visible{outline:2px solid var(--psy-teal);outline-offset:-2px}
.psy-history__session-title{min-width:0}
.psy-history__session-meta{font-size:11.5px;font-weight:400;color:var(--psy-muted)}
.psy-history__session-body{
  display:grid;gap:12px;padding:12px 16px 16px;border-top:1px solid var(--psy-line);
}
.psy-history__field h4{
  margin:0 0 4px;font-size:11px;font-weight:700;letter-spacing:.07em;
  text-transform:uppercase;color:var(--psy-muted);
}
.psy-history__field p{
  margin:0;font-size:13.5px;line-height:1.6;white-space:pre-wrap;color:var(--psy-text);
}
.psy-history__by{margin:0;font-size:11.5px;color:var(--psy-muted)}

/* Consultation Room: video left, SOAP right on desktop; video on top on a phone. */
.psy-room{
  position:fixed;inset:0;z-index:1500;display:flex;flex-direction:column;
  background:#0b1f22;color:#e6f4f1;
}
.psy-room[hidden]{display:none}
.psy-room__grid{
  flex:1;min-height:0;display:grid;grid-template-columns:1fr;
  grid-template-rows:minmax(260px,45vh) minmax(0,1fr);
}
.psy-room__video{
  display:flex;flex-direction:column;min-height:0;min-width:0;background:#0b1f22;
}
.psy-room__bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:10px 16px;background:#0f2a2d;border-bottom:1px solid rgba(255,255,255,.08);
  min-width:0;
}
.psy-room__who{flex:1 1 0;min-width:0;overflow:hidden}
.psy-room__who h2{margin:0;font-size:14px;color:#fff}
.psy-room__who p{
  margin:2px 0 0;font-size:11.5px;color:#9fc4bf;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.psy-room__live{
  display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;
  font-size:11px;color:#9fc4bf;
}
.psy-room__live::before{
  content:"";width:7px;height:7px;border-radius:50%;background:#f59e0b;
}
.psy-room__live[data-state="live"]::before{background:#10b981}
.psy-room__live[data-state="error"]::before{background:#ef4444}
.psy-room__stage{position:relative;flex:1;min-height:0;background:#000}
.psy-room__stage iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.psy-room__loading{
  position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;
  margin:0;padding:20px;text-align:center;font-size:13px;color:#9fc4bf;
  background:#0b1f22;pointer-events:none;
}
.psy-room__loading[hidden]{display:none}
.psy-room__loading[data-state="error"]{
  background:#2a1215;color:#fecaca;font-weight:600;
}
.psy-room__loading[data-state="slow"]{background:#2a2412;color:#fde68a}
.psy-room__close{
  flex:0 0 auto;font:inherit;font-size:11.5px;font-weight:600;color:#9fc4bf;
  background:transparent;border:1px solid rgba(255,255,255,.18);
  border-radius:999px;padding:6px 10px;cursor:pointer;
}
.psy-room__close:hover{color:#fff;border-color:rgba(255,255,255,.35)}
.psy-room__close:focus-visible{outline:2px solid #5eead4;outline-offset:2px}
.psy-room__notes{
  display:flex;flex-direction:column;min-height:0;min-width:0;background:var(--psy-surface);
  color:var(--psy-text);border-left:1px solid var(--psy-line);
}
.psy-room__tabs{flex:0 0 auto}
.psy-room__panel{
  flex:1;min-height:0;min-width:0;overflow-y:auto;padding:12px 14px;box-sizing:border-box;
}
.psy-room__panel.psy-hidden{display:none}
.psy-room__soap-head{display:flex;justify-content:flex-end;margin-bottom:8px}
.psy-room__panel .psy-soap__grid{grid-template-columns:1fr;gap:12px}
.psy-room__panel .psy-soap__field textarea{min-height:110px}
.psy-room__panel .psy-intake{max-width:none;margin:0;min-width:0}
@media(min-width:900px){
  .psy-room__grid{grid-template-columns:7fr 3fr;grid-template-rows:1fr}
  .psy-room__panel .psy-soap__field textarea{min-height:132px}
}

/* End consultation confirmation */
.psy-room__dialog{
  position:fixed;inset:0;z-index:1600;display:flex;align-items:center;justify-content:center;
  padding:16px;background:rgba(3,15,17,.66);
}
.psy-room__dialog[hidden]{display:none}
.psy-room__dialog-card{
  width:100%;max-width:430px;background:#fff;color:var(--psy-text);
  border-radius:14px;padding:20px;box-shadow:0 24px 60px rgba(0,0,0,.35);
}
.psy-room__dialog-card h3{margin:0 0 8px;font-size:16px}
.psy-room__dialog-card p{margin:0 0 14px;font-size:13.5px;line-height:1.55}
.psy-room__dialog-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.psy-room__dialog-actions .psy-btn{flex:1 1 auto}
@media(min-width:480px){
  .psy-room__dialog-actions .psy-btn{flex:0 0 auto}
}

/* Session-note modal */
.psy-cp-modal{
  position:fixed;inset:0;z-index:1300;
  display:flex;align-items:center;justify-content:center;padding:16px;
}
.psy-cp-modal[hidden]{display:none}
.psy-cp-modal__backdrop{position:absolute;inset:0;background:rgba(15,23,42,.55)}
.psy-cp-modal__card{
  position:relative;z-index:1;width:100%;max-width:560px;
  background:#fff;border-radius:14px;box-shadow:0 24px 60px rgba(15,23,42,.28);
  padding:20px;
}
.psy-cp-modal__title{margin:0 0 4px;font-size:17px}
.psy-cp-notes-field{display:block;margin:14px 0 6px;font-size:13px;font-weight:650}
.psy-cp-notes-field__hint{font-weight:400;color:var(--psy-muted)}
.psy-cp-notes-field textarea{
  display:block;width:100%;box-sizing:border-box;margin-top:8px;padding:12px;
  font:inherit;font-size:14px;line-height:1.55;color:var(--psy-text);
  background:#fff;border:1px solid var(--psy-line);border-radius:10px;resize:vertical;
}
.psy-cp-notes-field textarea:focus{outline:2px solid var(--psy-teal);outline-offset:1px;border-color:var(--psy-teal)}
.psy-cp-notes-count{
  margin:6px 0 0;text-align:right;font-size:11.5px;color:var(--psy-muted);
  font-variant-numeric:tabular-nums;
}
.psy-cp-modal__foot{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
@media(max-width:520px){
  .psy-cp-modal{padding:10px}
  .psy-cp-modal__card{padding:16px}
  .psy-cp-modal__foot .psy-btn{flex:1 1 auto}
}
