/* بالِ — patient dashboard.
   Tokens live in /bali/theme.css, shared primitives in /bali/base.css.
   Dashboard deliberately sets headings in the warm serif; component
   rules opt back into var(--display) where the sans face reads better. */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.015em;
}
.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }
p { text-wrap: pretty; }

.btn .ico { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
}

/* ── Page shell ──────────────────────────────────────────────── */
body { background: var(--cream); overflow-x: hidden; }
.page {
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
aside.sidenav {
  background: var(--paper);
  border-inline-end: 1px solid var(--rule);
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
aside.sidenav > * { flex-shrink: 0; }
aside.sidenav::-webkit-scrollbar { width: 6px; }
aside.sidenav::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
aside.sidenav::-webkit-scrollbar-track { background: transparent; }
.sidenav .wordmark {
  margin: 2px 4px 18px;
  text-decoration: none;
  color: inherit;
  display: inline-flex;
}

.nav-section { margin-bottom: 26px; }
.nav-section h6 {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0 12px 10px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), padding-left var(--t-base) var(--ease-out);
  text-decoration: none;
  position: relative;
}
.nav-item:hover { background: var(--cream); }
.nav-item.active {
  background: var(--g10);
  color: var(--forest-deep);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--forest);
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
}
.nav-item .ico {
  width: 18px; height: 18px;
  color: currentColor;
  opacity: 0.85;
  flex-shrink: 0;
}
.nav-item .num,
.nav-item .badge {
  margin-inline-start: auto;
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  letter-spacing: 0.05em;
}
.nav-item .badge {
  background: var(--forest);
  color: var(--cream);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.nav-item.active .ico { opacity: 1; }

/* Therapist mini-card in sidebar */
.therapist-mini {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  margin: 0 -2px 8px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
  border: 1px solid var(--rule-soft);
  text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.therapist-mini:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.therapist-mini .info { min-width: 0; flex: 1; }
.therapist-mini .name {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-small);
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.therapist-mini .role {
  font-size: var(--t-micro);
  color: var(--muted);
  margin-top: 2px;
}

/* ── Sidenav messages widget (compact) ──────────────────────
   Lives in the sidenav directly below the account widget. Holds the
   same data-binds as the old dashboard panel (msg-teaser-count,
   msg-teaser-cta, msg-teaser-badge, msg-teaser-body) so
   renderMessagesTeaser() populates it unchanged. */
.sn-messages {
  margin-top: 22px;
  padding: 14px 14px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sn-messages-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-2);
}
.sn-messages-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin: 0;
}
.sn-messages-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--taupe);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Compact Open-inbox CTA — full width with terra accent. */
.sn-inbox-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--forest);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--forest-deep);
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-small);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.sn-inbox-btn:hover {
  background: var(--forest);
  color: var(--cream);
}
.sn-inbox-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.sn-inbox-label { flex: 1; }
.sn-inbox-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--forest);
  color: var(--cream);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  transition: background var(--t-fast), color var(--t-fast);
}
.sn-inbox-btn:hover .sn-inbox-badge {
  background: var(--cream);
  color: var(--forest-deep);
}

/* Preview body — recycles the existing .msg-teaser markup classes
   that renderMessagesTeaser injects. Constrains height so a long
   preview wraps tidily inside the narrow sidenav column. */
.sn-messages-body { font-size: var(--t-small); }
.sn-messages-body .msg-teaser {
  display: flex;
  gap: 10px;
  padding: var(--s-2);
  background: var(--cream-soft);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
  transition: background var(--t-fast);
}
.sn-messages-body .msg-teaser:hover { background: var(--cream-deep); }
.sn-messages-body .msg-teaser.unread {
  background: var(--g10);
  border: 1px solid var(--g16);
  padding: 7px;
}
.sn-messages-body .mt-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--t-micro);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.sn-messages-body .mt-main { flex: 1; min-width: 0; }
.sn-messages-body .mt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.sn-messages-body .mt-from {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sn-messages-body .mt-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--taupe);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.sn-messages-body .mt-preview {
  font-size: var(--t-micro);
  color: var(--taupe);
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sn-messages-body .mt-unread { display: none; }
.sn-messages-empty {
  font-size: 12px;
  color: var(--taupe);
  font-style: italic;
  padding: var(--s-1) 0;
}

/* Primary "Book new session" CTA — full-width terra button on the left
   rail, sits above the matching-criteria card. */
.sn-book {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 12px 14px;
  background: var(--forest);
  color: var(--cream);
  border: 1px solid var(--forest);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-small);
  text-decoration: none;
  transition: background var(--t-fast), transform var(--t-fast);
}
.sn-book:hover {
  background: var(--forest-deep);
  border-color: var(--forest-deep);
  transform: translateY(-1px);
}

/* Matching-criteria nav button — sits under the messages widget, same
   card rhythm. Icon tile + label/sub stack + trailing arrow. */
.sn-criteria {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.sn-criteria:hover {
  border-color: var(--forest);
  background: var(--cream-deep);
  transform: translateY(-1px);
}
.sn-criteria-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--cream-deep);
  color: var(--forest-deep);
}
.sn-criteria:hover .sn-criteria-icon {
  background: var(--paper);
}
.sn-criteria-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.sn-criteria-label {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-small);
  color: var(--ink);
}
.sn-criteria-sub {
  font-size: var(--t-micro);
  color: var(--taupe);
}
.sn-criteria-arrow {
  flex-shrink: 0;
  color: var(--taupe);
  transition: transform var(--t-fast), color var(--t-fast);
}
.sn-criteria:hover .sn-criteria-arrow {
  color: var(--forest-deep);
  transform: translateX(2px);
}

/* Sidenav account widget. Sits directly below the <span class="ar-name">بالِ</span> mark (top of
   the sidenav stack, above the messages teaser). Top rule + small
   margin separate it from the wordmark; no auto-margin push to bottom
   so it doesn't collide with the crisis FAB. */
.sidenav-account {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.account-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: var(--s-2);
  background: transparent;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: start;
  transition: background var(--t-fast);
}
.account-btn:hover { background: var(--cream); }
/* min-width: 0 lets the text column shrink inside the fixed-width
   sidenav; without it a long name or meta line overruns the flex item
   and clips on the inline-end edge (QA doc item 15 — reads as "cut
   from the right" in Arabic, where the sidenav sits on the right). */
.account-btn .me-text { min-width: 0; flex: 1; }
.account-btn .me-name {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  font-size: var(--t-small);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-btn .me-meta {
  font-size: var(--t-micro);
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-btn .ico-chev {
  margin-inline-start: auto;
  color: var(--muted);
  transition: transform var(--t-fast);
}

/* ── Main ────────────────────────────────────────────────────── */
main.content {
  padding: 36px 56px 64px;
  min-width: 0;
}

/* Greeting ----------------------------------------------------- */
.greet {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.greet-left { min-width: 0; flex: 1; }
.greet h1 {
  /* Serif hero greeting per the new design direction — Newsreader at
     a literary weight. The terra italic span inside still gets the
     serif italic from the inline tag. */
  font-family: var(--serif);
  font-size: 44px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.greet h1 .terra {
  color: var(--forest);
  font-style: italic;
  font-weight: 500;
}
.greet .sub {
  font-size: var(--t-body);
  color: var(--muted);
  margin-top: 10px;
  max-width: 56ch;
  line-height: 1.5;
}
/* Inline link in the greet sub-line — taps scroll the page to the
   notifications panel and trigger a brief highlight (.panel-flash). */
.greet-msg-link {
  color: var(--forest-deep);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--g16);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}
.greet-msg-link:hover {
  color: var(--forest);
  text-decoration-color: currentColor;
}
.panel-flash {
  animation: panel-flash 1.4s ease-out;
}
@keyframes panel-flash {
  0%   { box-shadow: 0 0 0 0 var(--forest), 0 0 0 0 var(--g16); }
  20%  { box-shadow: 0 0 0 3px var(--forest), 0 0 0 10px var(--g16); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
}
.greet .meta {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  text-align: end;
  letter-spacing: 0.05em;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.greet .meta .date {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  white-space: nowrap;
}
.streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--grow-tint);
  color: var(--olive-deep);
  border-radius: var(--r-pill);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.streak .ico { width: 12px; height: 12px; }

/* ── Hero: next session (vertical, in sidebar) ─────────────── */
.next-session.next-session--vertical {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 22px 20px 18px;
  border-radius: var(--r-xl);
  margin: 6px 0 14px;
  color: var(--cream);
  position: relative;
  flex-shrink: 0;
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 0 50%, rgba(1,93,103,0.05) 10px, transparent 11px),
    radial-gradient(circle at 100% 50%, rgba(1,93,103,0.05) 10px, transparent 11px),
    radial-gradient(circle at 50% 0, rgba(1,93,103,0.05) 10px, transparent 11px),
    radial-gradient(circle at 50% 100%, rgba(1,93,103,0.05) 10px, transparent 11px),
    radial-gradient(120% 70% at 100% 0%, rgba(1,93,103,0.22) 0%, transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(63,125,82,0.16) 0%, transparent 65%);
  background-size: 72px 72px, 72px 72px, 72px 72px, 72px 72px, auto, auto;
  background-position: 18px 0, 18px 0, 18px 0, 18px 0, 0 0, 0 0;
  box-shadow: var(--shadow-hero);
}
.next-session.next-session--vertical::after {
  content: none;
}

.next-session--vertical .ns-portrait {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--cream-deep);
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 3px rgba(247,245,239,0.10);
  flex-shrink: 0;
}
.next-session--vertical .ns-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.next-session--vertical .ns-lbl {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--g16);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.next-session--vertical .ns-lbl::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--forest);
  animation: pulse-dot 1.8s var(--ease-out) infinite;
}
.next-session--vertical .ns-name {
  font-family: var(--display);
  font-size: var(--t-lead);
  color: var(--cream);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast);
}
.next-session--vertical a.ns-name:hover { border-bottom-color: var(--g16); }
.next-session--vertical .ns-role {
  font-family: var(--sans);
  font-size: var(--t-micro);
  color: rgba(247,245,239,0.55);
  margin-top: 1px;
  margin-bottom: 6px;
}
.next-session--vertical .ns-view-profile {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--g16);
  text-decoration: none;
  margin-bottom: 10px;
  padding: 3px 0;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.next-session--vertical .ns-view-profile:hover {
  color: var(--cream);
  border-bottom-color: var(--g16);
}
.next-session--vertical .ns-body .pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(247,245,239,0.10);
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
}

.next-session--vertical .ns-when {
  padding-top: 12px;
  border-top: 1px solid rgba(247,245,239,0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.next-session--vertical .ns-when-day {
  font-family: var(--display);
  font-weight: 600;
  color: var(--cream);
  font-size: 14px;
  letter-spacing: -0.005em;
}
.next-session--vertical .ns-when-line {
  font-family: var(--sans);
  font-size: var(--t-micro);
  color: rgba(247,245,239,0.65);
  letter-spacing: 0.01em;
}

.next-session--vertical .ns-time-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
  padding-top: 12px;
  border-top: 1px solid rgba(247,245,239,0.12);
}
.next-session--vertical .ns-countdown-lbl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--g16);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  white-space: nowrap;
}
.next-session--vertical .ns-countdown {
  font-family: var(--display);
  font-size: 24px;
  color: var(--cream);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.next-session--vertical .ns-countdown .seg { display: flex; align-items: baseline; gap: 3px; }
.next-session--vertical .ns-countdown .seg .u {
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(247,245,239,0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 400;
}

.next-session--vertical .ns-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-2);
  padding-top: 14px;
  border-top: 1px solid rgba(247,245,239,0.12);
}
.next-session--vertical .ns-actions .btn {
  width: 100%;
  padding: 10px 18px;
  font-size: var(--t-small);
}
.next-session--vertical .ns-actions .btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}
.next-session--vertical .ns-actions .ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(247,245,239,0.22);
}
.next-session--vertical .ns-actions .ghost:hover { background: rgba(247,245,239,0.06); color: var(--cream); }
.next-session--vertical .ns-actions .btn.primary { background: var(--forest); color: var(--cream); }
.next-session--vertical .ns-actions .btn.primary:hover { background: var(--forest-deep); }
.next-session--vertical .join-hint {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(247,245,239,0.5);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  white-space: nowrap;
}
.next-session--vertical .join-hint .ico { width: 11px; height: 11px; opacity: 0.7; }

/* When relocated into the main column on narrow screens — render full-width horizontal */
#hero-mobile-slot .next-session--vertical {
  margin: 0 0 22px;
  padding: 22px;
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 18px;
  row-gap: 14px;
  align-items: start;
}
#hero-mobile-slot .next-session--vertical .ns-portrait { width: 64px; height: 64px; font-size: var(--t-h3); }
#hero-mobile-slot .next-session--vertical .ns-body { grid-column: 2; }
#hero-mobile-slot .next-session--vertical .ns-when,
#hero-mobile-slot .next-session--vertical .ns-time-block,
#hero-mobile-slot .next-session--vertical .ns-actions {
  grid-column: 1 / -1;
}
#hero-mobile-slot .next-session--vertical .ns-countdown { font-size: 26px; }

/* ── Hero: next session (legacy, fallback) ──────────────────── */
.next-session {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(1,93,103,0.20) 0%, transparent 55%),
    radial-gradient(80% 60% at 0% 100%, rgba(63,125,82,0.16) 0%, transparent 60%),
    var(--ink);
  color: var(--cream);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-hero);
  isolation: isolate;
}
.next-session::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 0 50%, rgba(1,93,103,0.06) 10px, transparent 11px),
    radial-gradient(circle at 100% 50%, rgba(1,93,103,0.06) 10px, transparent 11px),
    radial-gradient(circle at 50% 0, rgba(1,93,103,0.06) 10px, transparent 11px),
    radial-gradient(circle at 50% 100%, rgba(1,93,103,0.06) 10px, transparent 11px);
  background-size: 72px 72px;
  background-position: 24px 0;
  opacity: 0.7;
  z-index: -1;
  pointer-events: none;
}

.ns-portrait {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--cream-deep);
  overflow: hidden;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  color: var(--ink);
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 3px rgba(247,245,239,0.10);
}

.ns-body { min-width: 0; }
.ns-lbl {
  font-family: var(--mono);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--g16);
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.ns-lbl::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--forest);
  animation: pulse-dot 1.8s var(--ease-out) infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}
.ns-name {
  font-family: var(--display);
  font-size: var(--t-h2);
  color: var(--cream);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
  line-height: 1.1;
}
.ns-meta {
  font-size: var(--t-small);
  color: rgba(247,245,239,0.72);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.ns-meta .ns-line { white-space: nowrap; }
.ns-meta .pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 3px 8px;
  background: rgba(247,245,239,0.10);
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ns-time-block {
  text-align: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-1);
}
.ns-countdown-lbl {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--g16);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.ns-countdown {
  font-family: var(--display);
  font-size: 32px;
  color: var(--cream);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.ns-countdown .seg { display: flex; align-items: baseline; gap: var(--s-1); }
.ns-countdown .seg .u {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: rgba(247,245,239,0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 400;
}
.ns-countdown.live { color: var(--g16); }

.ns-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(247,245,239,0.12);
}
.ns-actions .btn { background: var(--forest); }
.ns-actions .btn:hover { background: var(--forest-deep); }
.ns-actions .ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(247,245,239,0.28);
}
.ns-actions .ghost:hover { background: rgba(247,245,239,0.08); color: var(--cream); }
.next-session .btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}
.join-hint {
  font-family: var(--mono);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(247,245,239,0.55);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.join-hint .ico { width: 12px; height: 12px; opacity: 0.7; }

/* ── Today band — anchor (next session) + check-in (mood) ────
   The hero row at the top of the main content. Two cards side by
   side at wider widths; stacks below 900px. */
.today-band {
  display: grid;
  /* Same column widths as the dash-grid below, so the left-edge of
     the sessions panel here lines up with the left-edge of every
     left card below, and same for the right column. */
  grid-template-columns: 1.5fr 1fr;
  gap: var(--s-5);
  margin-bottom: 24px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .today-band { grid-template-columns: 1fr; gap: 14px; }
}

/* Anchor card — restyles the legacy .next-session (kept on the class
   list so existing JS finds it) into a vertical stacked layout to
   match the new design direction. Navy depth with warm radial
   highlights, serif name. */
.anchor.next-session {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 28px;
  margin-bottom: 0;
  border-radius: 20px;
  /* the .next-session base rule already provides the navy + radial
     overlays + isolation + shadow; we override the grid layout */
  grid-template-columns: none;
}
.anchor .a-kick {
  font-family: var(--display);
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g16);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.anchor .a-kick-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 4px rgba(197,84,60,0.25);
  animation: anchor-breathe 1.9s ease-in-out infinite;
}
@keyframes anchor-breathe {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.85); }
}
/* Therapist name + role block. The portrait was removed — the name
   stands on its own at the top of the card now, so we bump the type
   size a notch and let the name + role read as one quiet identity
   header above the When and Action rows. */
.anchor .a-head {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(247,245,239,0.12);
}
.anchor .a-id { min-width: 0; }
.anchor .a-name {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: -0.01em;
  line-height: 1.2;
  border-bottom: 1px dotted transparent;
  transition: border-color var(--t-fast);
}
.anchor .a-name:hover { border-bottom-color: rgba(247,245,239,0.4); }
.anchor .a-role {
  font-size: var(--t-small);
  color: rgba(247,245,239,0.6);
  margin-top: 6px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.anchor .a-when {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-4);
}
.anchor .a-when-day {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--cream);
  line-height: 1.25;
}
.anchor .a-when-line {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: rgba(247,245,239,0.6);
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.anchor .a-count { text-align: end; flex-shrink: 0; }
.anchor .a-count .ns-countdown-lbl {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(247,245,239,0.5);
}
.anchor .a-cd {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--cream);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.anchor .a-cd.live { color: var(--g16); }
.anchor .a-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid rgba(247,245,239,0.12);
  margin-top: 0;
}
.anchor .a-join {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--forest);
  color: var(--cream);
  padding: 11px 22px;
  border-radius: var(--r-pill);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.anchor .a-join:hover {
  background: var(--forest-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.anchor .a-join .ico { transition: transform var(--t-fast); }
.anchor .a-join:hover .ico { transform: translateX(2px); }
.anchor .a-join[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}
.anchor .a-join-hint {
  font-family: var(--mono);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(247,245,239,0.6);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.anchor .a-pill {
  margin-inline-start: auto;
  background: rgba(247,245,239,0.08);
  color: rgba(247,245,239,0.7);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Check-in card — paper surface, serif title, the existing mood
   today-form inside (data-binds preserved). */
.checkin {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 26px 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.checkin .ci-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.checkin .ci-q {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
}
.checkin .today-pill {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--forest-deep);
  background: var(--g10);
  padding: 3px 9px;
  border-radius: var(--r-pill);
}
.checkin .ci-sub {
  font-size: var(--t-small);
  color: var(--taupe);
  line-height: 1.5;
  margin: 0;
}
/* The mood-picker grid + emoji styles already exist below; the
   .ci-faces class is a no-op visual marker for clarity. */
.checkin .ci-faces { margin-top: 4px; }
.checkin .mood-confirm,
.checkin .mood-after-pick { margin-top: 6px; }

/* ── Dash grid ──────────────────────────────────────────────── */
/* Two-column layout with ROW alignment. Each pair of panels (left +
   right) sits on the same grid row and stretches to the taller card,
   so the cards line up cleanly above each other. The welcome panel
   spans both columns when shown. */
.dash-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--s-5);
  align-items: stretch;
}
.dash-grid > .welcome-panel { grid-column: 1 / -1; }

/* ── First-time welcome panel ────────────────────────────────
   Surfaces only when the patient hasn't completed any sessions,
   logged any moods, or received any journals — i.e. they just
   signed up. Sits across both columns of the dash grid so it's
   the very first thing they see. Hidden by default; JS unhides. */
.welcome-panel {
  grid-column: 1 / -1;
  grid-row: 1;
  background: linear-gradient(135deg, var(--g10) 0%, var(--cream-deep) 100%);
  border: 1px solid var(--g16);
  border-inline-start: 4px solid var(--forest);
  border-radius: var(--r-lg);
  padding: 28px 32px;
  margin-bottom: 4px;
}
.welcome-panel[hidden] { display: none; }
.welcome-panel .wp-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: 14px;
}
.welcome-panel .wp-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-lead);
  flex-shrink: 0;
}
.welcome-panel .wp-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-h3);
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.welcome-panel .wp-lede {
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 var(--s-4);
}
.welcome-panel .wp-lede strong { color: var(--ink); }
.welcome-panel .wp-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.welcome-panel .wp-step {
  background: rgba(253,252,246,0.6);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.welcome-panel .wp-step-num {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--forest-deep);
  margin-bottom: 6px;
  display: block;
}
.welcome-panel .wp-step-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-body);
  color: var(--ink);
  margin-bottom: 4px;
}
.welcome-panel .wp-step-detail {
  font-size: var(--t-small);
  color: var(--ink-soft);
  line-height: 1.45;
}
.welcome-panel .wp-foot {
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.welcome-panel .wp-foot a {
  color: var(--forest-deep);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--g16);
}
.welcome-panel .wp-foot a:hover { border-bottom-color: var(--forest); }
@media (max-width: 880px) {
  .welcome-panel { padding: 22px 20px; }
  .welcome-panel .wp-steps { grid-template-columns: 1fr; gap: 10px; }
  .welcome-panel .wp-step { padding: 12px 14px; }
  .welcome-panel .wp-title { font-size: 19px; }
}

/* ── Panel ──────────────────────────────────────────────────── */
.panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: box-shadow var(--t-base);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.panel-head .title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.panel-head h3 { white-space: nowrap; }
.panel-head .title-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--forest);
  flex-shrink: 0;
}
.panel-head .title-dot.olive { background: var(--grow); }
.panel-head .title-dot.navy { background: var(--ink); }
.panel-head h3 {
  /* Card titles use the serif at a tighter weight so they read
     literary, not corporate. Inherits font-family: var(--serif) from
     the base h1..h6 rule. */
  font-size: 19px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.panel-head .count {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  background: var(--cream-deep);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  letter-spacing: 0.06em;
}
.panel-head .link {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--forest);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm);
  margin-inline-end: -8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.panel-head .link:hover { background: var(--g10); color: var(--forest-deep); }
.panel-head .link .ico { width: 11px; height: 11px; transition: transform var(--t-fast); }
.panel-head .link:hover .ico { transform: translateX(2px); }

/* ── Upcoming sessions list ─────────────────────────────────── */
.session-list { display: flex; flex-direction: column; }
.session-row {
  display: grid;
  /* 3 columns: date · info (name + meta) · action group (action + cancel
     inline). The format word now lives inside the meta line, so the
     standalone pill column is gone. */
  grid-template-columns: 56px 1fr auto;
  gap: var(--s-4);
  padding: 14px 8px;
  margin: 0 -8px;
  border-radius: var(--r-md);
  border-bottom: 1px solid var(--rule);
  align-items: center;
  transition: background var(--t-fast);
}
.session-row:last-child { border-bottom: 0; }
.session-row:hover { background: var(--cream); }
.session-row.needs-time {
  background: var(--g10);
  border-bottom-color: var(--g16);
}
.session-row.needs-time:hover { background: color-mix(in srgb, var(--g10) 80%, var(--cream)); }

.session-date {
  text-align: center;
  padding: 8px 0 6px;
  background: var(--cream-deep);
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-soft);
}
.session-row.is-next .session-date {
  background: var(--ink);
  border-color: var(--ink);
}
.session-row.is-next .session-date .month { color: var(--g16); }
.session-row.is-next .session-date .day { color: var(--cream); }
.session-row.needs-time .session-date {
  background: var(--g16);
  border-color: var(--g16);
}
.session-row.needs-time .session-date .month,
.session-row.needs-time .session-date .day { color: var(--forest-deep); }

.session-date .month {
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; color: var(--muted); letter-spacing: 0.14em;
  font-weight: 500;
}
.session-date .day {
  font-family: var(--display); font-size: var(--t-lead); color: var(--ink);
  font-weight: 700; line-height: 1; letter-spacing: -0.02em;
  margin-top: 2px;
}
.session-info { min-width: 0; }
.session-who {
  font-family: var(--display);
  font-size: var(--t-body);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.session-when {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-pill {
  padding: 4px 10px;
  background: var(--cream-deep);
  border-radius: var(--r-pill);
  font-size: var(--t-micro);
  color: var(--ink);
  font-family: var(--mono);
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.session-pill .ico { width: 11px; height: 11px; opacity: 0.65; }
.session-row.needs-time .session-pill {
  background: var(--g16);
  color: var(--forest-deep);
}
button.session-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--forest-deep);
  padding: 7px 12px;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}
button.session-action:hover {
  border-color: var(--g16);
  background: var(--g10);
}
button.session-action.primary {
  background: var(--forest);
  color: var(--cream);
  border-color: var(--forest);
}
button.session-action.primary:hover {
  background: var(--forest-deep);
  border-color: var(--forest-deep);
}
button.session-action .ico { width: 11px; height: 11px; transition: transform var(--t-fast); }
button.session-action:hover .ico { transform: translateX(2px); }

/* Action column — wraps the row's primary action (Edit / Pick time /
   status text / Live now) and the optional Cancel link INLINE, so the
   row reads left-to-right as one tight action group instead of a
   stacked block. */
.session-action-col {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: var(--s-3);
  flex-shrink: 0;
}

/* Cancel — quiet mono text link directly under the action. Reads as
   the secondary "if you must, here's the escape hatch" affordance.
   Terra-deep on hover signals the destructive intent. */
button.session-cancel {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--taupe);
  background: transparent;
  border: 0;
  padding: 2px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}
button.session-cancel:hover {
  /* clay, NOT --terra-deep: --terra now aliases to Forest, so hovering
     'Cancel' would light it up in the brand's YES colour */
  color: var(--clay);
  text-decoration-color: currentColor;
}
button.session-cancel:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
button.session-cancel:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Read-only status pills on session rows. The Join CTA is now in the
   sidenav only, so the row's action column shows the timing/state. */
/* Session-status chips — deliberately richer than base.css's
   .status-pill (live-pulse dot, per-state tooltips); they stay page-
   owned. Colors are fully tokenized as of the UX-3 pass. */
span.session-action.status {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}
span.session-action.status.live {
  background: var(--forest);
  color: var(--cream);
  position: relative;
  padding-inline-start: 22px;
}
span.session-action.status.live::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 0 0 4px rgba(247,245,239, 0.35);
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
/* Quiet read-only statuses — plain mono text so they don't compete
   with actionable buttons (Reschedule / Pick time) for click-intent.
   `.live` (urgent) and `.pending` (awaiting therapist approval) keep
   strong pills because the patient needs to clearly understand those
   states. */
span.session-action.status.soon,
span.session-action.status.locked {
  background: transparent;
  padding: var(--s-1) 0;
}
span.session-action.status.soon    { color: var(--forest-deep); }
span.session-action.status.locked  { color: var(--text-muted); }

/* Awaiting-therapist-approval pill — navy chip with a tiny pulsing
   dot so the patient knows the request is in flight. Used together
   with `.session-row.pending-approval` (row tint below). */
span.session-action.status.pending {
  background: var(--ink);
  color: var(--cream);
  padding: 6px 12px;
  padding-inline-start: 22px;
  position: relative;
}
span.session-action.status.pending::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cream);
  opacity: 0.85;
  animation: pending-pulse 1.6s ease-in-out infinite;
}
@keyframes pending-pulse {
  0%, 100% { opacity: 0.85; transform: translateY(-50%) scale(1); }
  50%      { opacity: 0.30; transform: translateY(-50%) scale(0.8); }
}

/* Row tint for an in-flight reschedule. Mirrors `.needs-time` but
   uses a navy-tinted wash to differentiate from the terra "you need
   to act" state — this one is "we're waiting on your therapist". */
.session-row.pending-approval {
  background: var(--g16, color-mix(in srgb, var(--ink) 8%, var(--paper)));
  border-bottom-color: color-mix(in srgb, var(--ink) 14%, transparent);
}
.session-row.pending-approval:hover {
  background: color-mix(in srgb, var(--ink) 12%, var(--paper));
}
.session-row.pending-approval .session-date {
  background: var(--ink);
  border-color: var(--ink);
}
.session-row.pending-approval .session-date .month { color: var(--g16); }
.session-row.pending-approval .session-date .day { color: var(--cream); }

/* ── Mood panel ─────────────────────────────────────────────── */
.mood {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
}

.mood-today { margin-bottom: 18px; }
.mood-today-q {
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.mood-today-q > span:first-child { min-width: 0; }
.mood-today-q .today-pill {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--forest-deep);
  background: var(--g10);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.mood-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.mood-emoji {
  border: 1.5px solid var(--rule);
  background: var(--cream);
  border-radius: var(--r-md);
  padding: 10px 4px 8px;
  font-size: var(--t-h3);
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease-spring),
    border-color var(--t-fast),
    background var(--t-fast);
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
}
.mood-emoji .lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.mood-emoji:hover {
  border-color: var(--g16);
  background: var(--g10);
  transform: translateY(-2px);
}
.mood-emoji:hover .lbl { opacity: 1; color: var(--forest-deep); }
.mood-emoji.selected {
  border-color: var(--forest);
  background: var(--g10);
  transform: translateY(-3px);
  box-shadow: 0 4px 14px -4px rgba(1,93,103,0.4);
}
.mood-emoji.selected .lbl { opacity: 1; color: var(--forest-deep); font-weight: 600; }

/* Confirmation pill — shown the moment a mood is logged (one-tap UX).
   Holds the "Tell us why?" affordance that expands the optional note. */
.mood-confirm {
  background: var(--grow-tint);
  border: 1px solid var(--grow-tint);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: 10px;
  animation: mood-form-in 220ms var(--ease-out);
}
.mood-confirm[hidden] { display: none; }
.mood-confirm-text {
  font-size: var(--t-small);
  color: var(--olive-deep);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}
.mood-confirm-text strong { font-weight: 600; }
.mood-confirm-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--grow);
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mood-confirm-time {
  margin-inline-start: 4px;
  color: var(--muted);
  font-size: 12px;
}
.mood-tell-why {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--forest-deep);
  background: var(--cream);
  border: 1px solid var(--g16);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
  white-space: nowrap;
}
.mood-tell-why:hover { background: var(--g10); border-color: var(--forest); }

.mood-note {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--cream);
  font-family: inherit;
  font-size: var(--t-small);
  color: var(--ink);
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border-color var(--t-fast), opacity var(--t-fast), background var(--t-fast);
}
.mood-note::placeholder { color: var(--text-faint); font-style: italic; }
.mood-note:disabled { opacity: 0.5; cursor: not-allowed; }
.mood-note:focus {
  outline: none;
  border-color: var(--forest);
  background: var(--paper);
}
/* Wrapper that holds the note input + save button. Hidden by default;
   JS sets `hidden = false` when the user picks an emoji. */
.mood-after-pick {
  margin-top: 12px;
  animation: mood-form-in 220ms var(--ease-out);
}
.mood-after-pick[hidden] { display: none; }
@keyframes mood-form-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.mood-after-pick .mood-note {
  margin-bottom: 12px;
}
.mood-save-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.btn.primary.sm {
  font-size: 12px;
  padding: 8px 18px;
  background: var(--forest);
  color: var(--cream);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background var(--t-fast), opacity var(--t-fast), transform var(--t-fast);
}
.btn.primary.sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--faint);
}
.btn.primary.sm:hover:not(:disabled) { background: var(--forest-deep); transform: translateY(-1px); }
.mood-saved {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--olive-deep);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: fade-up var(--t-base) var(--ease-out);
}
/* Higher-specificity rule so the global [hidden] attribute actually
   hides the saved badge — otherwise display:inline-flex above wins. */
.mood-saved[hidden] { display: none; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Day cards */
.mood-cards-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.mood-cards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mood-cards-lbl {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.mood-cards-nav { display: flex; gap: var(--s-1); }
.mood-nav-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--rule);
  background: var(--cream);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: all var(--t-fast);
}
.mood-nav-btn:hover:not(:disabled) {
  border-color: var(--g16);
  background: var(--g10);
  color: var(--forest-deep);
}
.mood-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.mood-nav-btn .ico { width: 12px; height: 12px; }

.mood-card-track {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s-1);
}
.mood-card {
  background: var(--cream-deep);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 8px 4px 6px;
  text-align: center;
  position: relative;
  transition: transform var(--t-fast), border-color var(--t-fast);
  cursor: default;
}
.mood-card:hover { transform: translateY(-2px); border-color: var(--rule); }
.mood-card.is-today {
  border-color: var(--forest);
  background: var(--g10);
  box-shadow: 0 0 0 1px var(--forest);
}
.mood-card.had-session::after {
  content: "";
  position: absolute;
  top: 5px; right: 6px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink);
}
.mood-card .mc-date {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}
.mood-card.is-today .mc-date { color: var(--forest-deep); font-weight: 600; }
.mood-card .mc-emoji {
  font-size: var(--t-lead);
  line-height: 1;
  margin-bottom: 2px;
}
.mood-card.is-empty .mc-emoji { opacity: 0.18; }

/* Globally-positioned tooltip — appended to <body> and re-positioned
   above the hovered day card via JS. Replaces the old inline .mc-tip. */
.mood-day-tooltip {
  position: absolute;
  z-index: 2000;
  min-width: 180px;
  max-width: 240px;
  padding: 10px 14px 12px;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  text-align: start;
  font-family: var(--sans);
}
.mood-day-tooltip[hidden] { display: none; }
.mood-day-tooltip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  margin-inline-start: -6px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.mood-day-tooltip .mdt-date {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--g16);
  margin-bottom: 6px;
}
.mood-day-tooltip .mdt-mood {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 4px;
}
.mood-day-tooltip .mdt-note {
  font-size: var(--t-small);
  line-height: 1.4;
  color: rgba(247,245,239,0.88);
}
.mood-day-tooltip .mdt-note em {
  color: rgba(247,245,239,0.5);
  font-style: italic;
}
.mood-day-tooltip .mdt-empty {
  font-style: italic;
  color: rgba(247,245,239,0.55);
  font-size: var(--t-small);
}

/* Tooltip on hover — shows the note + label for that day */
.mood-card .mc-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translate(-50%, 4px);
  width: max-content;
  max-width: 200px;
  padding: 9px 12px 10px;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-md);
  text-align: start;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.mood-card .mc-tip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  margin-inline-start: -5px;
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.mood-card:hover .mc-tip,
.mood-card:focus-within .mc-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.mc-tip-head {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--g16);
  margin-bottom: 4px;
}
.mc-tip-mood {
  font-family: var(--display);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--cream);
  line-height: 1.2;
  margin-bottom: 3px;
}
.mc-tip-note {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.4;
  color: rgba(247,245,239,0.85);
}
.mc-tip-note.mc-tip-empty {
  font-style: italic;
  color: rgba(247,245,239,0.5);
}
.mc-tip-meta {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--grow-tint);
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid rgba(247,245,239,0.12);
}

/* Tooltip variant: flip below the card on the first row (so it doesn't get cut off at panel top) */
.mood-card:first-child:nth-last-child(n+5) .mc-tip,
.mood-card.flip-tip .mc-tip { bottom: auto; top: calc(100% + 8px); }
.mood-card:first-child:nth-last-child(n+5) .mc-tip::after,
.mood-card.flip-tip .mc-tip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ink); }

/* Stats */
.mood-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.mood-stat-box {
  padding: var(--s-3);
  background: var(--cream);
  border-radius: var(--r-md);
  border: 1px solid var(--rule-soft);
}
.mood-stat-box .lbl {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 6px;
}
.mood-stat-box .val {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--display);
  font-size: var(--t-h3);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.mood-stat-box .val .of { font-size: 12px; color: var(--muted); font-weight: 400; }
.mood-stat-box .delta {
  font-family: var(--mono);
  font-size: var(--t-micro);
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  letter-spacing: 0.04em;
}
.mood-stat-box .delta.up { color: var(--olive-deep); }
.mood-stat-box .delta.down { color: var(--forest); }
.mood-stat-box .delta.flat { color: var(--muted); }
.mood-stat-box .delta .ico { width: 10px; height: 10px; }

/* ── Journal ────────────────────────────────────────────────── */
.journal-from-therapist {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.journals-list { display: flex; flex-direction: column; gap: 10px; }
.journal-card {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.journal-card:hover { border-color: var(--faint); }
.journal-card.is-pending {
  border-color: var(--g16);
  background: linear-gradient(180deg, var(--g10) 0%, var(--paper) 80%);
}
.journal-card.is-pending::before {
  content: "";
  position: absolute;
}
.journal-card-head {
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}
.journal-card-head:hover { background: rgba(0,0,0,0.02); }
.journal-card .chevron {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  transition: transform var(--t-base) var(--ease-out);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}
.journal-card.is-open .chevron { transform: rotate(90deg); color: var(--forest-deep); }
.journal-head-text { flex: 1; min-width: 0; }
.journal-card-title {
  font-family: var(--display);
  font-size: var(--t-body);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.journal-card-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.journal-card.is-pending .journal-card-meta { color: var(--forest-deep); }
.journal-card-meta .pending-dot {
  width: 5px; height: 5px;
  background: var(--forest);
  border-radius: 50%;
  display: inline-block;
}
.journal-card-meta .logged-dot {
  width: 5px; height: 5px;
  background: var(--grow);
  border-radius: 50%;
  display: inline-block;
}

.journal-card-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-base) var(--ease-out);
}
.journal-card.is-open .journal-card-body { grid-template-rows: 1fr; }
.journal-card-body-inner {
  overflow: hidden;
  padding: 0 var(--s-4);
}
.journal-card.is-open .journal-card-body-inner { padding: 0 16px 14px; }

/* The therapist's question — the thing the patient is answering (QA:
   it was never rendered). Upright on purpose: the question is content,
   not meta, and Arabic script must never be italicized. */
.journal-card-prompt {
  font-family: var(--display);
  font-size: var(--t-body);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  padding: var(--s-3) 0 0;
  border-top: 1px solid var(--rule);
}
.journal-card.is-pending .journal-card-prompt { border-top-color: var(--g16); }
.journal-card-prompt + .journal-card-desc { border-top: none; }

.journal-card-desc {
  font-size: var(--t-small);
  color: var(--muted);
  line-height: 1.5;
  padding: var(--s-3) 0 var(--s-2);
  font-style: italic;
  border-top: 1px solid var(--rule);
}
.journal-card.is-pending .journal-card-desc { border-top-color: var(--g16); }
.journal-entry-list { display: flex; flex-direction: column; gap: var(--s-2); padding-top: 12px; }

/* Each daily log reads as its own object — a discrete card rather than a
   flat dashed list row — so individual entries feel prominent. */
.journal-log {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--rule-soft);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  position: relative;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.journal-log:hover { box-shadow: var(--shadow-sm); }
.journal-log-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: 6px;
}
.journal-log-date {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.journal-entry-body {
  font-size: var(--t-small);
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Today — logged: calm white card with an olive confirmation accent. */
.journal-log.is-today.is-logged { border-inline-start-color: var(--grow); }
.journal-log.is-today.is-logged .journal-log-date { color: var(--olive-deep); }

/* Today — pending: prominent red call to action that the patient can't
   miss, flipping to the white "logged" card above once written. */
.journal-log.is-today.is-pending {
  border: 1px solid var(--g16);
  border-inline-start: 3px solid var(--forest);
  background: linear-gradient(180deg, var(--g10) 0%, var(--paper) 90%);
}
.journal-log.is-today.is-pending .journal-log-date { color: var(--forest-deep); }
.journal-log-prompt {
  font-size: var(--t-small);
  line-height: 1.5;
  color: var(--forest-deep);
  margin: 0 0 10px;
}

/* Status pills */
.log-status {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.log-status.pending { background: var(--forest); color: #fff; }
.log-status.logged {
  background: var(--paper);
  border: 1px solid var(--grow-tint);
  color: var(--olive-deep);
}
.log-status.logged::before { content: "✓ "; }

/* Entry hover affordances */
.entry-actions {
  display: inline-flex;
  gap: var(--s-1);
  margin-inline-start: auto;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.journal-log:hover .entry-actions,
.msg-thread:hover .entry-actions,
.entry-actions:focus-within { opacity: 1; }
.entry-action {
  width: 24px; height: 24px;
  border: 1px solid var(--rule);
  background: var(--cream);
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--muted);
  display: grid; place-items: center;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.entry-action:hover { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.entry-action.delete:hover { border-color: var(--forest); color: var(--forest); }
.entry-action .ico { width: 12px; height: 12px; }
@media (hover: none) {
  .entry-actions { opacity: 1; }
}

/* ── Messages ───────────────────────────────────────────────── */
.msg-list { display: flex; flex-direction: column; }
.msg-thread {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-2);
  margin: 0 -8px;
  border-bottom: 1px solid var(--rule);
  align-items: flex-start;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}
.msg-thread:hover { background: var(--cream); }
.msg-thread:last-child { border-bottom: 0; }
.msg-thread.unread { background: linear-gradient(90deg, var(--g10) 0%, transparent 60%); }
.msg-thread.unread:hover { background: linear-gradient(90deg, var(--g10) 0%, var(--cream) 60%); }
.msg-thread .msg-main { flex: 1; min-width: 0; }
.msg-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 3px;
}
.msg-who {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: -0.005em;
}
.msg-when {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  margin-inline-start: auto;
  letter-spacing: 0.04em;
}
.msg-body {
  font-size: var(--t-small);
  color: var(--ink-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.msg-unread-dot {
  width: 8px; height: 8px;
  background: var(--forest);
  border-radius: 50%;
  margin-top: 14px;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 var(--forest);
  animation: pulse-unread 2.4s var(--ease-out) infinite;
}
@keyframes pulse-unread {
  0%, 100% { box-shadow: 0 0 0 0 rgba(1,93,103,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(1,93,103,0.0); }
}

/* Message composer */
.msg-composer {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: 14px;
  background: var(--cream-deep);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.msg-composer:focus-within {
  border-color: var(--forest);
  background: var(--paper);
}
.msg-composer .to-line {
  font-size: var(--t-micro);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.msg-composer textarea {
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--paper);
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--t-small);
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
  min-height: 60px;
  transition: border-color var(--t-fast);
}
.msg-composer textarea:focus { outline: none; border-color: var(--rule); }
.msg-composer textarea::placeholder { color: var(--text-faint); }
.msg-composer .actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  align-items: center;
}
.msg-composer .char-count {
  font-size: var(--t-micro);
  font-family: var(--mono);
  color: var(--muted);
  margin-inline-end: auto;
  letter-spacing: 0.04em;
}
.msg-composer button.send {
  border: 0;
  background: var(--ink);
  color: var(--cream);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill);
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-small);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}
.msg-composer button.send:hover:not(:disabled) { background: var(--ink); transform: translateY(-1px); }
.msg-composer button.send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Therapist message teaser (dashboard preview card) ─────── */
.msg-teaser {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--cream-deep);
  transition: background var(--t-fast);
  text-decoration: none;
  color: inherit;
}
.msg-teaser:hover { background: var(--cream); }
.msg-teaser.unread {
  background: linear-gradient(90deg, var(--g10) 0%, var(--cream-deep) 70%);
  border: 1px solid var(--g16);
  padding: 13px 15px;
}
.msg-teaser .mt-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-small);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.msg-teaser .mt-main { flex: 1; min-width: 0; }
.msg-teaser .mt-head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  align-items: baseline;
}
.msg-teaser .mt-from {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.msg-teaser .mt-time {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.msg-teaser .mt-preview {
  font-size: var(--t-small);
  color: var(--muted);
  line-height: 1.5;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.msg-teaser.unread .mt-preview { color: var(--text); }
.msg-teaser .mt-unread {
  width: 8px; height: 8px;
  background: var(--forest);
  border-radius: 50%;
  margin-top: 16px;
  flex-shrink: 0;
}
.msg-teaser-empty {
  padding: 18px 4px;
  font-size: var(--t-small);
  color: var(--muted);
  font-style: italic;
}

/* Prominent "Open inbox" CTA at the TOP of the teaser panel (above
   the latest message preview). Full width so it reads as the primary
   action; terra outline → solid on hover. Optional unread badge
   appears between label and arrow. */
.inbox-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid var(--forest);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--forest-deep);
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast);
}
.inbox-btn:hover {
  background: var(--forest);
  color: var(--cream);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -4px rgba(1,93,103,0.4);
}
.inbox-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
}
.inbox-btn-label { flex: 1; }
.inbox-btn-badge {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 600;
  background: var(--forest);
  color: var(--cream);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
  transition: background var(--t-fast), color var(--t-fast);
}
.inbox-btn:hover .inbox-btn-badge {
  background: var(--cream);
  color: var(--forest-deep);
}
.inbox-btn-arrow {
  font-size: 16px;
  transition: transform var(--t-fast);
}
.inbox-btn:hover .inbox-btn-arrow { transform: translateX(2px); }

/* ── Care-team notifications feed ──────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: var(--s-2); }
.notif-item {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--paper);
  border: 1px solid var(--rule);
  position: relative;
}
.notif-item.unread {
  background: var(--grow-tint);
  border-color: var(--grow-tint);
}
.notif-item.notif-clickable { cursor: pointer; transition: border-color 140ms, background 140ms; }
.notif-item.notif-clickable:hover { border-color: var(--grow); }
.notif-item.notif-clickable:focus-visible { outline: 2px solid var(--grow); outline-offset: 2px; }
.notif-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--grow);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-icon svg { width: 14px; height: 14px; }
.notif-main { flex: 1; min-width: 0; }
.notif-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-2);
}
.notif-from {
  font-family: var(--display);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink);
}
.notif-time {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.notif-body {
  font-size: var(--t-small);
  color: var(--text);
  line-height: 1.5;
  margin-top: 4px;
}
.notif-dismiss {
  position: absolute;
  top: 8px; right: 8px;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: var(--s-1);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast);
}
.notif-item:hover .notif-dismiss { opacity: 1; }
.notif-dismiss:hover { background: var(--cream-deep); color: var(--ink); }
/* Expand/collapse toggle at the foot of the care-team list. Sits as a
   full-width text button styled like a quiet secondary link. */
.notif-toggle {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--taupe);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.notif-toggle:hover {
  color: var(--forest-deep);
  border-color: var(--g16);
  background: var(--g10);
}
.notif-empty {
  padding: 18px 4px;
  font-size: var(--t-small);
  color: var(--muted);
  font-style: italic;
}

/* Therapist-source notifications — visually distinct from care-team
   items: terra accent instead of olive, chat-bubble icon, anchor-card
   styling with an "Open inbox →" CTA. Clicking opens messages.html. */
a.notif-item.from-therapist {
  text-decoration: none;
  color: inherit;
  border-inline-start: 3px solid var(--forest);
  background: linear-gradient(90deg, var(--g10) 0%, var(--paper) 80%);
  transition: background var(--t-fast), transform var(--t-fast);
}
a.notif-item.from-therapist.unread {
  background: linear-gradient(90deg, var(--g10) 0%, var(--cream-deep) 80%);
  border-color: var(--forest-deep);
}
a.notif-item.from-therapist:hover {
  background: var(--g10);
  transform: translateX(2px);
}
.notif-icon-therapist {
  background: var(--forest) !important;
}
.notif-cta {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest-deep);
  margin-top: 6px;
}

/* ── Modal (journal entry editor) ──────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(6,38,43, 0.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-5);
  animation: overlay-in 160ms var(--ease-out);
}
.modal-overlay.leaving { animation: overlay-out 140ms var(--ease-out) forwards; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-out { from { opacity: 1; } to { opacity: 0; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 600px;
  width: 100%;
  padding: 26px 28px 22px;
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--t-base) var(--ease-spring);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-overlay.leaving .modal { animation: modal-out 160ms var(--ease-out) forwards; }
@keyframes modal-in  { from { transform: translateY(12px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes modal-out { from { transform: none; opacity: 1; } to { transform: translateY(6px) scale(0.98); opacity: 0; } }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: 8px;
}
.modal-head .lbl {
  font-family: var(--mono);
  font-size: var(--t-micro);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--forest-deep);
}
.modal-close {
  background: transparent;
  border: 0;
  width: 32px; height: 32px;
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--cream-deep); color: var(--ink); }
.modal-close .ico { width: 16px; height: 16px; }
.modal h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-h3);
  color: var(--ink);
  margin: 4px 0 14px;
  letter-spacing: -0.015em;
}
.modal-prompt {
  margin: 0 0 14px;
  padding: 14px 16px;
  background: var(--cream-deep);
  border-radius: var(--r-md);
  border-inline-start: 3px solid var(--forest);
}
.modal-prompt .pt {
  font-family: var(--display);
  font-size: var(--t-body);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.modal-prompt .pd {
  font-size: var(--t-small);
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
  font-style: italic;
}
.modal textarea {
  width: 100%;
  min-height: 220px;
  max-height: 50vh;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper);
  font-family: inherit;
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--t-fast);
}
.modal textarea:focus { border-color: var(--forest); }
.modal textarea::placeholder { color: var(--text-faint); font-style: italic; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: var(--s-3);
}
.modal-foot .count {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.modal-foot .actions {
  display: flex;
  gap: var(--s-2);
}

/* ── Mobile nav bar (replaces sidenav < 900px) ─────────────── */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: var(--s-3) var(--s-4);
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.mobile-topbar .wordmark { margin: 0; font-size: 19px; }
.mobile-topbar .actions { display: flex; gap: var(--s-1); }
.icon-btn {
  width: 36px; height: 36px;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink);
  position: relative;
  transition: background var(--t-fast);
}
.icon-btn:hover { background: var(--cream-deep); }
.icon-btn .ico { width: 16px; height: 16px; }
.icon-btn .badge-dot {
  position: absolute;
  top: 7px; right: 8px;
  width: 7px; height: 7px;
  background: var(--forest);
  border-radius: 50%;
  border: 2px solid var(--paper);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  main.content { padding: 32px 32px 56px; }
  /* Single column on narrow screens. Mobile order follows source:
     welcome → check-in → pulse → journal → notifications. The
     today-band collapses separately at 900px (sessions → anchor). */
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; }
  aside.sidenav { display: none; }
  .mobile-topbar { display: flex; }
  main.content { padding: 24px 20px 56px; }
  .next-session {
    grid-template-columns: auto 1fr;
    padding: 22px 22px;
    gap: 16px 18px;
  }
  .ns-time-block {
    grid-column: 1 / -1;
    text-align: start;
    align-items: flex-start;
    border-top: 1px solid rgba(247,245,239,0.12);
    padding-top: 14px;
  }
  .ns-actions { padding-top: 14px; }
  .ns-portrait { width: 56px; height: 56px; font-size: 20px; }
  .ns-name { font-size: var(--t-h3); }
  .session-row {
    grid-template-columns: 48px 1fr auto;
    gap: var(--s-3);
  }
  .session-pill { display: none; }
  .greet h1 { font-size: var(--t-h1); }
}
@media (max-width: 640px) {
  main.content { padding: 18px 14px 56px; }
  .greet { flex-direction: column; align-items: flex-start; }
  .greet .meta { text-align: start; align-items: flex-start; }
  .panel, .mood { padding: 18px; }
  .mood-card-track { grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .mood-stats { grid-template-columns: 1fr; }
  .ns-countdown { font-size: 26px; }
  .next-session { padding: 18px; border-radius: var(--r-lg); }
}

/* ── Section reveal on load ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal-in 480ms var(--ease-out) forwards;
}
.reveal:nth-child(1) { animation-delay: 0ms; }
.reveal:nth-child(2) { animation-delay: 60ms; }
.reveal:nth-child(3) { animation-delay: 120ms; }
.reveal:nth-child(4) { animation-delay: 180ms; }
@keyframes reveal-in {
  to { opacity: 1; transform: none; }
}

/* Reveal fallback — if motion is disabled or in non-rendering contexts,
   ensure content is visible even if the animation never runs. */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; animation: none; }
}
[data-motion="off"] .reveal { opacity: 1; transform: none; animation: none; }

/* ── Skip-link ────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -200%;
  left: 8px;
  background: var(--ink);
  color: var(--cream);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  z-index: 9999;
  font-size: var(--t-small);
  font-family: var(--display);
  font-weight: 600;
}
.skip-link:focus { top: 8px; }
  /* Tweak-driven hero variants */
  [data-hero-pattern="solid"] .next-session::after { display: none; }
  [data-hero-pattern="glow"]  .next-session::after { display: none; }
  [data-hero-pattern="glow"]  .next-session {
    background:
      radial-gradient(80% 100% at 100% 0%, rgba(1,93,103,0.45) 0%, transparent 55%),
      radial-gradient(60% 80% at 0% 100%, rgba(63,125,82,0.30) 0%, transparent 65%),
      var(--ink);
  }
  [data-accent="subtle"] .next-session {
    background:
      radial-gradient(120% 80% at 100% 0%, rgba(1,93,103,0.08) 0%, transparent 55%),
      var(--ink);
  }
  [data-accent="bold"] .next-session {
    background:
      radial-gradient(110% 90% at 100% 0%, rgba(1,93,103,0.40) 0%, transparent 50%),
      radial-gradient(80% 70% at 0% 100%, rgba(63,125,82,0.25) 0%, transparent 60%),
      var(--ink);
  }
  [data-accent="subtle"] .panel-head .title-dot,
  [data-accent="subtle"] .ns-lbl::before { opacity: 0.6; }
  [data-accent="bold"] .panel-head .title-dot { transform: scale(1.2); }

  /* ── Collapsible sidenav (desktop only; < 900px already uses the
        mobile nav) ─────────────────────────────────────────────── */
  .sn-head { display: flex; justify-content: flex-end; margin: -4px 0 2px; }
  .sn-collapse {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--rule);
    border-radius: var(--r-sm); color: var(--taupe); cursor: pointer;
    transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
  }
  .sn-collapse:hover { border-color: var(--forest); color: var(--forest-deep); background: var(--cream-deep); }

  /* Icon rail — the slim indicator strip shown when the sidenav is
     collapsed. Each icon links to its destination; the top chevron
     expands the full sidenav. */
  .sn-rail { display: none; }
  .sn-rail-btn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; border: 1px solid transparent; background: transparent;
    color: var(--ink); cursor: pointer; text-decoration: none;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  }
  .sn-rail-btn:hover { background: var(--cream-deep); border-color: var(--rule); color: var(--forest-deep); }
  .sn-rail-btn.book { background: var(--forest); color: var(--cream); }
  .sn-rail-btn.book:hover { background: var(--forest-deep); border-color: var(--forest-deep); }
  .sn-rail-btn.expand { color: var(--forest-deep); }
  .sn-rail-btn.expand:hover { background: var(--forest); color: var(--cream); border-color: var(--forest); }
  .sn-rail-divider { width: 22px; height: 1px; background: var(--rule); margin: 3px 0; }
  .sn-rail-spacer { margin-top: auto; }

  @media (min-width: 901px) {
    .page { transition: grid-template-columns 0.26s ease; }
    aside.sidenav { min-width: 0; }
    html.nav-collapsed .page { grid-template-columns: 58px 1fr; }
    html.nav-collapsed aside.sidenav { display: none; }
    /* With the aside removed from the grid, keep the main content in the
       wide second column (otherwise it auto-places into the 58px rail
       column and squishes). */
    html.nav-collapsed main.content { grid-column: 2; }
    html.nav-collapsed .sn-rail {
      display: flex; flex-direction: column; align-items: center; gap: 7px;
      /* inset-inline-start, NOT left (QA doc item 1): the expanded
         sidenav mirrors to the right edge in Arabic, but a physical
         left: 0 pinned the collapsed rail to the opposite side of the
         screen — closing the nav made it jump across the viewport. */
      position: fixed; top: 0; inset-inline-start: 0; width: 58px; height: 100vh;
      padding: 16px 0 18px; background: var(--paper);
      border-inline-end: 1px solid var(--rule); z-index: 120;
    }
    /* The collapse/expand chevrons point toward where the nav goes —
       mirror them in RTL so they keep pointing the right way. */
    [dir="rtl"] .sn-collapse svg,
    [dir="rtl"] .sn-rail-btn.expand svg { transform: scaleX(-1); }
  }
  @media (max-width: 900px) { .sn-rail { display: none !important; } }
