
/* Workshop room identity — warm obsidian + burnished gold.
 * Fixed palette; does not follow the global Peribolos palette picker.
 * Gold is the primary interactive accent throughout.
 * body.light = warm parchment / reading-lamp mode.
 * body.dark  = full obsidian (deepest dark). */
:root {
  --color-bg:       #1C1812;    /* deep warm obsidian */
  --color-surface:  #261F15;    /* dark mahogany panels */
  --color-oat:      rgba(201, 165, 74, 0.10);   /* gold hover tint */
  --color-ink:      #EDE5D0;    /* warm vellum text */
  --color-ink-soft: #C8BC9E;
  --color-muted:    #9A8E6E;    /* warm muted gold-grey */
  --color-line:     rgba(201, 165, 74, 0.22);   /* burnished gold rule */
  --color-accent:   #C9A55A;    /* burnished gold accent */
  --color-link:     #FFE94A;    /* bright yellow — high-contrast on warm obsidian */
  /* Three-column tonal ramp — rails recede, the canvas is the bright stage */
  --col-1:          #1B160F;    /* col 1 client rail — deepest */
  --col-2:          #251E14;    /* col 2 context pane — mid */
  --col-3:          #2F2619;    /* col 3 canvas — lightest work surface */
  --color-sage:     #8FB39C;    /* "documented / done" state dot */
  --font-display:   var(--p-font-display);
  --font-body:      var(--p-font-body);
}
/* Workshop light — warm parchment / reading-lamp mode */
body.light {
  --color-bg:       #F5EDD8;
  --color-surface:  #FBF5E8;
  --color-oat:      rgba(201, 165, 74, 0.12);
  --color-ink:      #23180A;
  --color-ink-soft: #4A3B28;
  --color-muted:    #8A7558;
  --color-line:     rgba(201, 165, 74, 0.32);
  --color-accent:   #9A6A28;
  --color-link:     #8A5A1A;    /* dark amber — readable on parchment */
  --col-1:          #EFE4CB;    /* col 1 — deepest parchment */
  --col-2:          #F6EEDC;    /* col 2 — mid */
  --col-3:          #FCF7EC;    /* col 3 — lightest, near white */
  --col-threads:    #DED7C7;    /* threads rail — slightly darker cream than the canvas */
  --color-sage:     #6E9079;    /* "documented / done" state dot — Forest & Linen */
}
/* Workshop dark — full obsidian */
body.dark {
  --color-bg:       #100E08;
  --color-surface:  #1A1510;
  --color-oat:      rgba(201, 165, 74, 0.09);
  --color-ink:      #EDE5D0;
  --color-ink-soft: #C8BC9E;
  --color-muted:    #9A8E6E;
  --color-line:     rgba(201, 165, 74, 0.18);
  --color-accent:   #D9B871;
  --color-link:     #FFE94A;    /* bright yellow — high-contrast on obsidian */
  --col-1:          #0F0D07;    /* col 1 — deepest */
  --col-2:          #17130C;    /* col 2 — mid */
  --col-3:          #1F1911;    /* col 3 — lightest of the obsidian set */
}
/* Parchment alias kept for selector parity */
body.legacy-light {
  --color-bg:       #F5EDD8;
  --color-surface:  #FBF5E8;
  --color-oat:      rgba(201, 165, 74, 0.12);
  --color-ink:      #23180A;
  --color-ink-soft: #4A3B28;
  --color-muted:    #8A7558;
  --color-line:     rgba(201, 165, 74, 0.32);
  --color-accent:   #9A6A28;
  --color-link:     #8A5A1A;    /* dark amber — readable on parchment */
  --col-1:          #EFE4CB;    /* col 1 — deepest parchment */
  --col-2:          #F6EEDC;    /* col 2 — mid */
  --col-3:          #FCF7EC;    /* col 3 — lightest, near white */
  --col-threads:    #DED7C7;    /* threads rail — slightly darker cream than the canvas */
  --color-sage:     #6E9079;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; font-family: var(--font-body);
  background: var(--color-bg); color: var(--color-ink);
  overflow: hidden;
}

/* Nav */
.top-nav {
  display: flex; align-items: center; gap: 2px;
  padding: 0 16px; height: 48px; flex-shrink: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 0.9em;
  color: var(--color-ink); cursor: pointer;
  padding: 8px 16px 8px 0; margin-right: 8px;
  border-right: 1px solid var(--color-line);
  white-space: nowrap; flex-shrink: 0;
  text-decoration: none;
}
.nav-brand:hover { opacity: 0.75; }
.nav-brand .mark { flex-shrink: 0; }
.nav-tab {
  font-family: var(--font-body); font-size: 0.85em;
  padding: 6px 12px; border-radius: 4px 4px 0 0;
  color: var(--color-muted); cursor: pointer;
  text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
  line-height: 1; transition: color 0.12s, background 0.12s;
}
.nav-tab:hover { color: var(--color-ink); background: var(--color-oat); text-decoration: none; }
.nav-tab.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.dark-toggle {
  margin-left: auto; background: none; border: none;
  color: var(--color-muted); cursor: pointer; font-size: 1.05em;
  padding: 5px 8px; border-radius: 4px;
}
.dark-toggle:hover { background: var(--color-oat); }

/* Page layout — two columns, today-led. The caseload rail (col 1) and the
 * canvas (col 3). The former middle "case panel" column is folded into the
 * canvas as a per-client case-page, so the middle-pane DOM is kept for the
 * loaders that target it but is removed from the grid (display:none). */
.layout { display: grid; grid-template-columns: var(--sidebar-w, 264px) 1fr; height: calc(100vh - 48px); overflow: hidden; position: relative; }
.layout.no-sidebar { grid-template-columns: 0 1fr; }
.layout.no-sidebar .sidebar,
.layout.no-sidebar .sidebar-resizer { display: none; }
/* Middle pane no longer participates in the layout — folded into the canvas. */
.middle-pane, .middle-resizer { display: none !important; }
.sidebar-resizer {
  position: absolute; top: 0; bottom: 0;
  width: 8px;
  cursor: col-resize; z-index: 50;
  background: transparent;
  transition: background 0.15s, opacity 0.15s;
}
.sidebar-resizer { left: var(--sidebar-w, 264px); margin-left: -4px; }
.sidebar-resizer:hover, .sidebar-resizer.dragging { background: var(--color-accent); opacity: 0.35; }

/* Sidebar (client rail — col 1) */
.sidebar {
  background: var(--col-1);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-header {
  font-size: 0.68em; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--color-muted);
  padding: 13px 16px 9px; flex-shrink: 0;
  border-bottom: 1px solid var(--color-line);
}
.client-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.client-item {
  padding: 9px 16px; cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.client-item:hover { background: var(--color-oat); }
.client-item.active { border-left-color: var(--color-accent); background: var(--color-oat); }
.client-name { font-size: 0.87em; color: var(--color-ink); }
.client-meta { font-size: 0.73em; color: var(--color-muted); margin-top: 2px; }

/* Main area (canvas — col 3) */
.main { display: flex; flex-direction: column; overflow: hidden; background: var(--col-3); }

/* Middle pane (col 2) */
.middle-pane {
  border-right: 1px solid var(--color-line);
  background: var(--col-2);
  display: flex; flex-direction: column; overflow: hidden;
}
#middle-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--color-muted); font-size: 0.82em;
  padding: 24px; text-align: center; line-height: 1.5;
}
#middle-content { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.middle-client-header {
  padding: 12px 16px 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--color-line);
}
.middle-client-name {
  font-size: 0.93em; font-weight: 500; color: var(--color-ink); line-height: 1.3;
}
.middle-scroll { flex: 1; overflow-y: auto; }
.middle-section { border-bottom: 1px solid var(--color-line); padding-bottom: 8px; }
.middle-section-head {
  font-size: 0.63em; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-muted); padding: 12px 16px 6px;
}
.middle-placeholder {
  font-size: 0.78em; color: var(--color-muted); padding: 0 16px 10px;
  font-style: italic; line-height: 1.5;
}
/* Middle pane clickable items — distinct, clearly tappable cards.
   Shared by sessions, intake forms, threads, and standing notes. */
.middle-item,
.middle-thread-item,
.standing-formulation,
.standing-note-item {
  position: relative;
  margin: 5px 12px;
  padding: 10px 26px 10px 13px;
  cursor: pointer;
  background: var(--color-oat);
  border: 1px solid var(--color-line);
  border-radius: 6px;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.middle-item::after,
.middle-thread-item::after,
.standing-formulation::after,
.standing-note-item::after {
  content: '›';
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted); font-size: 1.2em; line-height: 1;
  transition: color 0.12s, transform 0.12s;
}
.middle-item:hover,
.middle-thread-item:hover,
.standing-formulation:hover,
.standing-note-item:hover {
  background: rgba(201, 165, 74, 0.18);
  border-color: var(--color-accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}
.middle-item:hover::after,
.middle-thread-item:hover::after,
.standing-formulation:hover::after,
.standing-note-item:hover::after {
  color: var(--color-accent);
  transform: translateY(-50%) translateX(2px);
}
.middle-item.active,
.middle-thread-item.active,
.standing-formulation.active,
.standing-note-item.active {
  background: rgba(201, 165, 74, 0.18);
  border-color: var(--color-accent);
  box-shadow: inset 2px 0 0 var(--color-accent);
}
.middle-item.active::after,
.middle-thread-item.active::after,
.standing-formulation.active::after,
.standing-note-item.active::after { color: var(--color-accent); }
.middle-item-date { font-size: 0.86em; font-weight: 500; color: var(--color-ink); }
.middle-item-meta { font-size: 0.72em; color: var(--color-muted); margin-top: 3px; }
/* Cancelled / late-cancel / no-show sessions stay listed, struck through. */
.middle-item.is-off .middle-item-date { text-decoration: line-through; color: var(--color-muted); }
.middle-item.is-off { opacity: 0.75; }

/* Session group dropdowns */
.session-group { border: none; }
.session-group-head {
  display: flex; align-items: center; justify-content: space-between;
  list-style: none; cursor: pointer; padding: 8px 16px 4px;
  font-size: 0.63em; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-muted); user-select: none;
}
.session-group-head::-webkit-details-marker { display: none; }
.session-group-head::after {
  content: '▾'; font-size: 2.2em; transition: transform 0.15s;
}
.session-group[open] .session-group-head::after { transform: rotate(0deg); }
.session-group:not([open]) .session-group-head::after { transform: rotate(-90deg); }
.session-group-count {
  background: var(--color-line); color: var(--color-muted);
  border-radius: 8px; padding: 0 5px; font-size: 0.9em; letter-spacing: 0;
}

/* Session card (canvas) */
#surface-session { overflow-y: auto; position: relative; }
#surface-intake-form { overflow-y: auto; }
.session-card { padding: 32px 22px; max-width: 900px; margin: 0 auto; }
.session-back {
  font-size: 0.84em; color: var(--color-ink); cursor: pointer; margin-bottom: 20px;
  display: inline-flex; align-items: center; gap: 7px; user-select: none;
  padding: 7px 15px 7px 12px; border: 1px solid var(--color-line); border-radius: 999px;
  background: var(--color-surface); font-weight: 500;
  /* Stays pinned while the card scrolls — no scrolling up to leave a session. */
  position: sticky; top: 10px; z-index: 6;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.10);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.session-back:hover {
  color: var(--color-ink); border-color: var(--color-accent); background: var(--color-bg);
}
.session-card-header {
  margin-bottom: 24px; padding-bottom: 14px;
  border-bottom: 1px solid var(--color-line);
  display: flex; align-items: flex-start; gap: 12px;
}
.session-card-headings { flex: 1; min-width: 0; }
.session-card-date { font-size: 1.05em; font-weight: 500; color: var(--color-ink); }
.session-card-meta { font-size: 0.8em; color: var(--color-muted); margin-top: 4px; }
.session-card-delete {
  flex-shrink: 0; background: none; border: 1px solid transparent;
  color: var(--color-muted); cursor: pointer; font-size: 1.15em; line-height: 1;
  padding: 4px 9px; border-radius: 4px; font-family: var(--p-font-body);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.session-card-delete:hover {
  color: #8b3a3a; border-color: #8b3a3a; background: var(--color-bg);
}
.session-status-select {
  flex-shrink: 0; font-size: 0.76em; padding: 3px 6px; margin-top: 2px;
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: 4px; color: var(--color-muted); cursor: pointer;
  font-family: var(--p-font-body); letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
}
.session-status-select:hover { color: var(--color-ink); border-color: var(--color-accent); }
.session-status-select.is-off { color: #8b3a3a; border-color: rgba(139, 58, 58, 0.45); }
.ws-cancel-who {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  font-size: 0.72em; color: var(--color-muted); margin-top: 4px;
}
.ws-cancel-who button {
  font-size: 1em; padding: 2px 9px; background: var(--color-surface);
  border: 1px solid var(--color-line); border-radius: 4px; cursor: pointer;
  color: var(--color-ink); font-family: var(--p-font-body);
  transition: border-color 0.15s;
}
.ws-cancel-who button:hover { border-color: var(--color-accent); }
.ws-cancel-who .ws-cancel-who-x {
  border: none; background: none; color: var(--color-muted); padding: 2px 4px; font-size: 1.15em;
}
.ws-cancel-who .ws-cancel-who-x:hover { color: var(--color-ink); }
.session-block { border-bottom: 1px solid var(--color-line); }
.session-block-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; cursor: pointer; user-select: none;
}
.session-block-head:hover { opacity: 0.8; }
.block-chevron {
  font-size: 1.7em; color: var(--color-muted); width: 22px; flex-shrink: 0;
  transition: transform 0.15s; display: inline-block;
}
.session-block:not(.open) .block-chevron { transform: rotate(-90deg); }
.block-label { font-size: 0.84em; font-weight: 500; color: var(--color-ink); flex: 1; }
.block-action {
  font-size: 0.7em; color: var(--color-accent);
  background: none; border: none; cursor: pointer;
  padding: 3px 8px; border-radius: 3px;
  font-family: var(--p-font-body);
}
.block-action:hover:not(:disabled) { background: var(--color-oat); }
.block-action:disabled { color: var(--color-muted); cursor: not-allowed; opacity: 0.5; }
.block-body { padding: 4px 0 16px 14px; }
.session-block:not(.open) .block-body { display: none; }
.block-empty { color: var(--color-muted); font-size: 0.8em; font-style: italic; }

/* Process note block */
.pn-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pn-dictate-btn { font-size: 0.78em; padding: 2px 8px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-ink); font-family: var(--p-font-body); letter-spacing: 0.02em; }
.pn-dictate-btn.recording { background: #8b3a3a; color: #fff; border-color: #8b3a3a; }
/* Transcription-setup states: amber + pulse when the one-time model download is
   still pending (so it's obvious to do before the first session), quiet ✓ when it's
   already done, red when the engine itself is missing. */
.pn-dictate-btn.rec-setup-needed { background: #fbe7c6; color: #7a5200; border-color: #d39a2e; font-weight: 600; animation: recSetupPulse 2.4s ease-in-out infinite; }
.pn-dictate-btn.rec-setup-needed:hover { background: #f7dca8; }
.pn-dictate-btn.rec-setup-blocked { background: #f6dcdc; color: #8b2f2f; border-color: #c97a7a; font-weight: 600; }
.pn-dictate-btn.rec-setup-done { color: var(--color-muted); border-color: var(--color-line); }
@keyframes recSetupPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(211,154,46,0); } 50% { box-shadow: 0 0 0 3px rgba(211,154,46,0.30); } }
@media (prefers-reduced-motion: reduce) { .pn-dictate-btn.rec-setup-needed { animation: none; box-shadow: 0 0 0 2px rgba(211,154,46,0.30); } }
.pn-dictate-btn:disabled { color: var(--color-muted); cursor: default; opacity: 0.55; }
/* Render — the step the material is heading toward. Filled gold ONLY when a
   render is genuinely waiting on a hand (.render-due, set by the JS state
   logic): automatic render off, its one pass already used, or it failed.
   While the automatic pass will handle it, the button stays quiet. */
.pn-render-btn.render-due:not(:disabled) { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); font-weight: 600; }
.pn-render-btn.render-due:not(:disabled):hover { filter: brightness(1.08); }
.pn-progress { font-size: 0.72em; color: var(--color-muted); }
.pn-cleanup-label { font-size: 0.72em; color: var(--color-muted); cursor: pointer; }
.pn-meta { font-size: 0.72em; color: var(--color-muted); margin-left: auto; }
.pn-cleanup-notice { position: fixed; bottom: 18px; right: 18px; max-width: 360px; z-index: 9999; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 6px; box-shadow: 0 4px 18px rgba(0,0,0,0.16); padding: 14px 16px; font-family: var(--p-font-body); }
.pn-cleanup-notice-body { font-size: 0.82em; color: var(--color-ink); line-height: 1.45; }
.pn-cleanup-notice-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.pn-cleanup-notice-dismiss { font-size: 0.74em; color: var(--color-muted); cursor: pointer; display: flex; align-items: center; gap: 5px; }
.pn-cleanup-notice-close { font-size: 0.76em; padding: 3px 12px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-ink); font-family: var(--p-font-body); }
.pn-save { font-size: 0.68em; color: var(--color-muted); opacity: 0; transition: opacity 0.4s; margin-right: 4px; }
.pn-save.show { opacity: 1; }
.pn-save.err { opacity: 1; color: #a33d3d; font-weight: 600; }
.pn-prompts-toggle { font-size: 0.72em; padding: 2px 8px; background: none; border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-muted); font-family: var(--p-font-body); letter-spacing: 0.02em; margin-left: auto; white-space: nowrap; }
.pn-prompts-toggle:hover { color: var(--color-ink); border-color: var(--color-muted); }
.pn-prompts-chev { display: inline-block; transition: transform 0.15s; font-size: 0.9em; }
.pn-prompts-toggle.open .pn-prompts-chev { transform: rotate(180deg); }
.pn-prompts { display: none; margin: 0 0 10px; padding: 10px 12px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 4px; }
.pn-prompts.open { display: block; }
.pn-prompts-scan { font-size: 0.82em; color: var(--color-muted); line-height: 1.7; font-family: var(--p-font-body); }
.pn-prompts-braver { font-size: 0.82em; color: var(--color-muted); line-height: 1.7; font-family: var(--p-font-body); font-style: italic; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-line); }

/* "Why this" — quiet curatorial doors into the Library, woven into the working
   surfaces at the moment of practice. The trigger is unobtrusive; the panel
   holds the craft view and opens onto the references. Curatorial register:
   material is held and made available, never taught or recommended. */
.wx-learn-wrap { margin: 8px 0 2px; }
.wx-learn { font-size: 0.74em; color: var(--color-muted); background: none; border: none; padding: 2px 0; cursor: pointer; font-family: var(--p-font-body); letter-spacing: 0.02em; display: inline-flex; align-items: center; gap: 6px; }
.wx-learn:hover { color: var(--color-ink); }
.wx-learn-q { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border: 1px solid var(--color-line); border-radius: 50%; font-size: 0.8em; line-height: 1; flex: none; }
.wx-learn:hover .wx-learn-q { border-color: var(--color-muted); color: var(--color-ink); }
.wx-learn.open .wx-learn-q { border-color: var(--color-accent); color: var(--color-accent); }
.wx-learn-panel { margin: 8px 0 4px; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 4px; }
.wx-learn-title { font-size: 0.72em; font-weight: 600; color: var(--color-ink); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 7px; }
.wx-learn-panel p { font-size: 0.83em; color: var(--color-ink); line-height: 1.65; margin: 0 0 8px; font-family: var(--p-font-body); }
.wx-learn-panel p:last-of-type { margin-bottom: 0; }
.wx-learn-lib { font-size: 0.7em; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 11px 0 5px; }
.wx-learn-refs { list-style: none; margin: 0; padding: 0; }
.wx-learn-refs li { font-size: 0.82em; line-height: 1.55; margin-bottom: 6px; color: var(--color-muted); }
.wx-learn-refs li:last-child { margin-bottom: 0; }
.wx-learn-refs a.lib-link { font-weight: 600; }
.wx-learn-refs .wx-ref-note { color: var(--color-muted); }

.pn-textarea { width: 100%; box-sizing: border-box; min-height: 400px; background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 4px; color: var(--color-ink); font-size: 0.88em; padding: 10px; resize: vertical; font-family: var(--p-font-body); line-height: 1.6; }
.pn-textarea:focus { outline: none; border-color: var(--color-accent); }
.pn-textarea::placeholder { color: var(--color-muted); }

/* Caption under the recording reflections box (recording surfaces only) */
.pn-felt-gate-note { margin-top: 6px; font-size: 0.78em; color: var(--color-muted); font-style: italic; line-height: 1.5; }
/* A button whose render is in flight — breathes so the state can't be missed. */
button.rendering { color: var(--color-accent); border-color: var(--color-accent); animation: loader-breathe 1.4s ease-in-out infinite; }
button.rendering:disabled { color: var(--color-accent); opacity: 1; }

/* Recording clinician-notes dictate button */
.rec-cn-dictate-btn { font-size: 0.78em; padding: 2px 8px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-ink); font-family: var(--p-font-body); letter-spacing: 0.02em; }
.rec-cn-dictate-btn.recording { background: #8b3a3a; color: #fff; border-color: #8b3a3a; }

/* Click-through transform pane — one section at a time, chips to jump */
/* white-space: normal is essential — the pane renders inside pre-wrap
   containers (.xform-content / .rec-transform-content), where the template
   literal's newlines would otherwise paint as ~100px of blank lines between
   the text and the nav controls. */
.xpane { margin-top: 4px; white-space: normal; }
.xpane-pre { border: 1px solid var(--color-line); border-radius: 4px; margin-bottom: 8px; padding: 10px 12px; white-space: pre-wrap; font-size: 1em; line-height: 1.95; }
.xpane-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
/* One centred reading column for everything in the pane — chips, nav, text.
   A left-pinned 70ch column in a wide pane read as lopsided (all the empty
   space on the right); centring the column balances it. */
.xpane-chips, .xpane-foot, .xpane-sec, .xpane-pre { max-width: 75ch; margin-left: auto; margin-right: auto; }
.xpane-chip { font-size: 0.78em; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--color-line); background: var(--color-surface); color: var(--color-muted); cursor: pointer; font-family: var(--p-font-body); }
.xpane-chip.active { border-color: var(--color-accent); color: var(--color-accent); background: var(--color-bg); }
.xpane-sec { display: none; }
.xpane-sec.active { display: block; }
.xpane-sec-title { font-weight: 600; font-size: 1.05em; color: var(--color-ink); margin: 10px 0 10px; }
/* Reading measure is capped by the centred .xpane-sec column above;
   1.95 line-height + breathing room above/below. */
.xpane-sec-body { white-space: pre-wrap; font-size: 1em; line-height: 1.95; padding-bottom: 14px; }
/* Nav row sits ABOVE the section text (fixed position — the section heights
   vary, so putting it below made the buttons jump around between clicks). */
.xpane-foot { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--color-line); }
.xpane-foot-side { flex: 1 1 0; display: flex; align-items: center; gap: 10px; min-width: 0; }
.xpane-foot-right { justify-content: flex-end; }
.xpane-nav { display: flex; gap: 6px; }
.xpane-arrow { font-size: 0.8em; padding: 3px 12px; border: 1px solid var(--color-line); border-radius: 4px; background: var(--color-surface); color: var(--color-ink); cursor: pointer; font-family: var(--p-font-body); }
.xpane-arrow:hover:not(:disabled) { border-color: var(--color-accent); color: var(--color-accent); }
.xpane-arrow:disabled { opacity: 0.35; cursor: default; }
.xpane-count { font-size: 0.75em; color: var(--color-muted); }
.xpane-all { font-size: 0.75em; background: none; border: none; color: var(--color-muted); cursor: pointer; font-family: var(--p-font-body); }
.xpane-all:hover { color: var(--color-accent); }
.xpane.open-all .xpane-sec { display: block; margin-bottom: 14px; }
.xpane.open-all .xpane-chips, .xpane.open-all .xpane-nav, .xpane.open-all .xpane-count { display: none; }
/* Hanging-indent bullets: inline-block wraps internally, so continuation
   lines align under the text, not the dash. */
.xpane-li { display: inline-block; padding-left: 1.05em; text-indent: -1.05em; margin: 2px 0; }
/* The client's quoted words — italic accent so the client's actual language
   stands out when scanning. Curly quotes supplied by the <q> element. */
.xpane-q { font-style: italic; color: var(--color-accent); quotes: '\201C' '\201D'; }
.xmark { font-size: 0.85em; margin-right: 2px; }
/* In a recording's working document a quote is a doorway — click and the
   transcript opens at that line. Dotted underline = affordance without noise. */
.rec-transform-content .xpane-q { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.rec-transform-content .xpane-q:hover { text-decoration-style: solid; }
/* Page-turn crossfade between sections */
.xpane-sec.active { animation: xpfade 0.16s ease; }
@keyframes xpfade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .xpane-sec.active { animation: none; } }

/* Gate badging on the session-level Transform pill */
.rec-xform-gated { font-size: 0.72em; color: var(--color-muted); display: block; line-height: 1.3; margin-top: 2px; }

/* Transformation block */
.xform-content { white-space: pre-wrap; font-size: 1.05em; line-height: 1.75; color: var(--color-ink); max-height: none; overflow: visible; padding: 2px 0; }
.xform-respond-panel { display: none; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-line); }
.xform-respond-panel.open { display: block; }
.xform-respond-panel textarea { width: 100%; box-sizing: border-box; min-height: 80px; background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 4px; color: var(--color-ink); font-size: 0.84em; padding: 8px; resize: vertical; font-family: var(--p-font-body); line-height: 1.6; }
.xform-respond-panel textarea:focus { outline: none; border-color: var(--color-accent); }
.xform-respond-panel textarea::placeholder { color: var(--color-muted); }
.xform-respond-panel .respond-controls { display: flex; gap: 8px; margin-top: 6px; align-items: center; }
.xform-respond-panel .respond-hint { font-size: 0.75em; color: var(--color-muted); }
.ta-across-hint { font-size: 0.8em; color: var(--color-muted); line-height: 1.55; margin-bottom: 10px; }
.xform-compare-panel { display: none; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-line); }
.xform-compare-panel.open { display: block; }
.xform-compare-hint { font-size: 0.8em; color: var(--color-muted); line-height: 1.55; margin-bottom: 10px; }
.xform-compare-raw { white-space: pre-wrap; font-size: 0.92em; line-height: 1.7; color: var(--color-ink); background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 4px; padding: 10px 12px; max-height: 360px; overflow-y: auto; }
.ta-across-label { width: 100%; box-sizing: border-box; background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 4px; color: var(--color-ink); font-size: 0.86em; padding: 8px; font-family: var(--p-font-body); margin-bottom: 8px; }
.ta-across-label:focus { outline: none; border-color: var(--color-accent); }
.ta-across-label::placeholder { color: var(--color-muted); }

/* Formal record block */
.formal-content { white-space: pre-wrap; font-size: 0.86em; line-height: 1.75; color: var(--color-ink); max-height: 400px; overflow-y: auto; padding: 2px 0; }
.formal-meta { font-size: 0.68em; color: var(--color-muted); margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--color-line); font-family: var(--p-font-body); letter-spacing: 0.02em; }
.goals-check-list { display: flex; flex-direction: column; gap: 5px; }
.goal-check-row { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 0.86em; color: var(--color-ink); }
.goal-check-row input[type="checkbox"] { accent-color: var(--color-accent); width: 14px; height: 14px; flex-shrink: 0; }
.goal-status-note { color: var(--color-muted); font-size: 0.85em; }
.goals-save-status { display: inline-block; margin-top: 8px; font-size: 0.74em; color: var(--color-sage, var(--color-accent)); }
.goals-save-status.err { color: var(--color-danger, #c04040); }
.formal-locked-badge { display: inline-block; padding: 1px 6px; border-radius: 2px; background: var(--color-line); color: var(--color-muted); font-size: 0.9em; margin-right: 6px; }
.formal-append-area { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-line); }
.formal-append-area textarea { width: 100%; box-sizing: border-box; min-height: 80px; background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 4px; color: var(--color-ink); font-size: 0.84em; padding: 8px; resize: vertical; font-family: var(--p-font-body); line-height: 1.6; }
.formal-append-area textarea::placeholder { color: var(--color-muted); }
.formal-append-area .append-controls { display: flex; gap: 8px; margin-top: 6px; align-items: center; }
.formal-append-area input[type=text] { flex: 1; background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 4px; color: var(--color-ink); font-size: 0.82em; padding: 4px 8px; font-family: var(--p-font-body); }
.formal-append-area input[type=text]::placeholder { color: var(--color-muted); }
.formal-append-area input[type=text]:focus, .formal-append-area textarea:focus { outline: none; border-color: var(--color-accent); }

/* Push confirmation pane */
.push-confirm-pane { position: absolute; inset: 0; background: var(--color-bg); z-index: 20; display: flex; flex-direction: column; padding: 28px 40px; overflow-y: auto; }
.push-confirm-head { font-size: 0.84em; font-weight: 500; color: var(--color-ink); margin-bottom: 16px; display: flex; align-items: center; gap: 14px; }
.push-confirm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.push-confirm-col-head { font-size: 0.65em; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-muted); margin-bottom: 8px; }
.push-confirm-col-body { white-space: pre-wrap; font-size: 0.82em; line-height: 1.7; color: var(--color-ink); height: 320px; overflow-y: auto; border: 1px solid var(--color-line); border-radius: 4px; padding: 12px; background: var(--color-surface); }
.push-confirm-foot { margin-top: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.push-confirm-do { font-size: 0.8em; padding: 6px 18px; background: var(--color-accent); color: #fff; border: none; border-radius: 3px; cursor: pointer; font-family: var(--p-font-body); letter-spacing: 0.02em; }
.push-confirm-do:hover:not(:disabled) { opacity: 0.88; }
.push-confirm-do:disabled { opacity: 0.5; cursor: default; }
.push-confirm-cancel { font-size: 0.8em; padding: 6px 14px; background: none; border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-muted); }
.push-confirm-note { font-size: 0.7em; color: var(--color-muted); flex: 1; line-height: 1.5; }

/* Recording block */
@keyframes recBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }
.rec-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #888; flex-shrink: 0; }
.rec-dot.active { background: #ff4444; animation: recBlink 1s infinite; }
.rec-dot.paused { background: #ffaa44; }
.rec-duration { font-size: 0.78em; color: var(--color-muted); font-family: var(--p-font-body); }
.rec-control-btn { font-size: 0.72em; padding: 2px 8px; background: none; border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-muted); }
.rec-speakers-select { font-size: 0.78em; padding: 2px 4px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-ink); font-family: var(--p-font-body); letter-spacing: 0.02em; }
.rec-auto-xform { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75em; color: var(--color-muted); cursor: pointer; user-select: none; white-space: nowrap; font-family: var(--p-font-body); letter-spacing: 0.02em; }
.rec-auto-xform input { margin: 0; cursor: pointer; }
.rec-autostop-nudge { font-size: 0.78em; padding: 5px 9px; margin: 6px 0; background: var(--color-surface); border: 1px solid var(--color-line); border-left: 3px solid #c2883f; border-radius: 3px; color: var(--color-ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-stop-btn { border-color: #5a2d2d; color: #cb7e7e; }
.rec-consent { font-size: 0.82em; line-height: 1.6; color: var(--color-ink); }
.rec-consent label { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; cursor: pointer; }
.rec-consent input[type=checkbox] { margin-top: 3px; flex-shrink: 0; }
.rec-consent-text { color: var(--color-muted); font-size: 0.9em; margin-bottom: 12px; }
.rec-mic-hint { color: var(--color-muted); font-size: 0.9em; margin: 10px 0 0; }
.rec-begin-btn { margin-top: 10px; font-size: 0.78em; padding: 4px 12px; background: #8b3a3a; color: #fff; border: none; border-radius: 3px; cursor: pointer; font-family: var(--p-font-body); letter-spacing: 0.02em; }
.rec-begin-btn:disabled { opacity: 0.4; cursor: default; }
.rec-list { list-style: none; padding: 0; margin: 0; }
.rec-list-item { display: flex; flex-direction: column; align-items: stretch; padding: 10px 0; border-bottom: 1px solid var(--color-line); font-size: 0.82em; }
.rec-list-item:last-child { border-bottom: none; }
.rec-list-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.rec-list-date { color: var(--color-muted); font-family: var(--p-font-body); font-size: 0.88em; }
.rec-list-dur { color: var(--color-muted); }
.rec-list-btn { font-size: 0.72em; padding: 1px 7px; background: none; border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-muted); margin-left: auto; text-decoration: none; }
.rec-transcribing { font-size: 0.72em; color: var(--color-muted); margin-left: auto; display: flex; align-items: center; gap: 6px; }
.rec-transcribing::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--color-muted); animation: loader-breathe 1.4s ease-in-out infinite; }
.rec-failed { font-size: 0.72em; color: #bb7a4a; margin-left: auto; }
/* Auto render waiting on the reflections box — nothing running, so no pulse. */
.rec-awaiting-cn { font-size: 0.72em; color: var(--color-sage, #6E9079); font-style: italic; margin-left: auto; }
.rec-orphaned .rec-list-dur { color: #bb7a4a; }
.rec-recover-note { font-size: 0.72em; color: var(--color-muted); margin-top: 4px; line-height: 1.4; }
.rec-prog-pct { font-variant-numeric: tabular-nums; min-width: 3ch; }
.rec-progress { width: 100%; margin-top: 8px; }
.rec-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.74em; color: var(--color-muted); margin-bottom: 5px; }
.rec-progress-stage { display: flex; align-items: center; gap: 6px; }
.rec-progress-stage::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent); animation: loader-breathe 1.4s ease-in-out infinite; }
.rec-progress-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec-progress-track { height: 4px; background: var(--color-line); border-radius: 2px; overflow: hidden; }
.rec-progress-fill { height: 100%; width: 0%; background: var(--color-accent); border-radius: 2px; transition: width 0.6s ease; }
/* De-identification receipt + honest failure for recording transforms. */
.rec-deid-line:empty { display: none; }
.rec-deid-line { margin-top: 6px; font-size: 0.72em; color: var(--color-sage, #6E9079); line-height: 1.4; }
.rec-xform-fail { font-size: 0.78em; color: var(--color-ink-soft); line-height: 1.45; }
.rec-transcript { font-size: 1.05em; line-height: 1.75; color: var(--color-ink); max-height: 320px; overflow-y: auto; padding: 8px; background: var(--color-surface); border-radius: 4px; margin-top: 6px; }
.rec-transcript-plain { white-space: pre-wrap; }
.rec-speaker-block { margin-bottom: 10px; }
/* Quote-jump landing: the matched words (mark) and their line (flash) light up.
   Warm clay — the client-voice hue on the fixed content ramp. */
.rec-q-mark { background: rgba(169,113,58,.28); color: inherit; border-radius: 3px; padding: 0 2px; }
.rec-q-flash { animation: recqflash 2.4s ease-out; border-radius: 4px; }
@keyframes recqflash { 0% { background: rgba(169,113,58,.22); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .rec-q-flash { animation: none; background: rgba(169,113,58,.12); } }
.rec-q-missing { font-size: 0.78em; color: var(--color-muted); padding: 6px 8px; border: 1px dashed var(--color-line); border-radius: 6px; margin-bottom: 8px; }
.rec-speaker-meta { font-size: 0.72em; color: var(--color-muted); font-family: var(--p-font-body); margin-bottom: 2px; letter-spacing: 0.02em; }
.rec-speaker-text { color: var(--color-ink); }
/* Stage 4: speaker labelling — Therapist (eucalyptus green) / Client (warm clay),
   matched to docs/speaker-labelling-ux.html. Role colours are voice identity,
   not the palette, so they're fixed hues on the content ramp. */
.rec-spk-ts { font-variant-numeric: tabular-nums; color: var(--color-muted); }
.rec-spk-who { font-weight: 700; letter-spacing: 0.02em; }
.rec-spk-who.t { color: #4F6B52; }
.rec-spk-who.c { color: #A9713A; }
.rec-spk-who.raw { color: var(--color-muted); font-weight: 600; }
/* auto state — quiet confirmation + a single Swap */
.rec-label-auto { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; margin: 6px 0 8px; border-radius: 8px; font-size: 0.82em; color: #3d5540;
  background: rgba(79,107,82,.09); border: 1px solid rgba(79,107,82,.22); }
.rec-label-lbl { display: flex; align-items: center; gap: 7px; }
.rec-label-tick { color: #4F6B52; font-weight: 700; }
.rec-label-swap { font: inherit; font-size: 0.92em; font-weight: 600; cursor: pointer; color: #4F6B52;
  background: transparent; border: 1px solid rgba(79,107,82,.4); border-radius: 7px; padding: 5px 11px; }
.rec-label-swap:hover { background: rgba(79,107,82,.1); }
/* manual state — "which one is you?" */
.rec-label-assign { border: 1px solid rgba(190,138,58,.4); background: rgba(190,138,58,.08); border-radius: 10px;
  padding: 13px 15px; margin: 6px 0 10px; }
.rec-label-assign-h { font-size: 1.0em; font-weight: 600; color: var(--color-ink); margin-bottom: 2px; }
.rec-label-assign-sub { font-size: 0.82em; color: var(--color-muted); margin-bottom: 12px; }
.rec-spk-assign { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(190,138,58,.22); }
.rec-spk-snip { flex: 1; min-width: 0; }
.rec-spk-heard { font-size: 0.74em; color: var(--color-muted); font-weight: 600; letter-spacing: 0.02em; }
.rec-spk-quote { font-size: 0.86em; color: var(--color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-spk-seg { display: inline-flex; border: 1px solid var(--color-line); border-radius: 8px; overflow: hidden; flex: none; background: var(--color-surface); }
.rec-spk-seg button { font: inherit; font-size: 0.8em; font-weight: 600; border: none; background: none; padding: 6px 12px; cursor: pointer; color: var(--color-muted); }
.rec-spk-seg button + button { border-left: 1px solid var(--color-line); }
.rec-spk-seg button[aria-pressed="true"].t { background: #4F6B52; color: #fff; }
.rec-spk-seg button[aria-pressed="true"].c { background: #A9713A; color: #fff; }
.rec-transform-area { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--color-line); }
.rec-transform-content { white-space: pre-wrap; font-size: 1.05em; line-height: 1.75; color: var(--color-ink); max-height: none; overflow: visible; padding: 8px; background: var(--color-surface); border-radius: 4px; margin-top: 4px; }
.rec-cn-wrap { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--color-line); }
.rec-cn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rec-cn-label { font-size: 0.95em; color: var(--color-ink); font-weight: 500; }
.rec-cn-ta { width: 100%; box-sizing: border-box; min-height: 100px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 4px; color: var(--color-ink); font-size: 0.85em; padding: 8px; resize: vertical; font-family: var(--font-body); }
/* Persistent prompt labels above the box — they stay put while typing, unlike a placeholder. */
.rec-cn-prompts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px; font-size: 0.78em; color: var(--color-muted); line-height: 1.5; font-family: var(--p-font-body); }
.rec-cn-prompts .rec-cn-prompt { white-space: nowrap; }
.rec-cn-prompts .rec-cn-prompt::before { content: "·"; margin-right: 6px; color: var(--color-line); }
.rec-cn-prompts .rec-cn-prompt:first-child::before { content: none; }
/* Docked variant — the box lives inside the transformed working document, at the section. */
.rec-cn-docked { margin: 6px 0 10px; }
.rec-cn-docked .rec-cn-ta { min-height: 120px; }
/* The docked box sits INSIDE the rendered document, whose content styles leak
   into it (block buttons, document line-height) — pin the dictate button back
   to its compact inline shape. */
.rec-cn-docked .rec-cn-head { display: flex; align-items: center; gap: 8px; }
.rec-cn-docked .rec-cn-dictate-btn { display: inline-flex; align-items: center; gap: 4px; line-height: 1.3; width: auto; }
.rec-rerender-offer { margin-top: 4px; font-size: 0.78em; color: var(--color-muted); display: flex; gap: 8px; align-items: center; }

/* Read-in-isolation modal — opens a transcript or transformation at a
   comfortable reading size, free of the inline block's narrow scroll box. */
.rec-read-block { margin-top: 6px; }
.rec-read-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
/* Styled confirm modal — replaces native confirm() for destructive actions.
   Promise-based (wsConfirm); danger-styled confirm button. Sits above the
   read-overlay (z 1100). */
.ws-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 31, 28, 0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 1200; padding: 16px;
}
.ws-confirm-overlay.open { display: flex; }
.ws-confirm-box {
  background: var(--p-panel); color: var(--p-ink);
  width: 440px; max-width: 92vw;
  border-radius: 6px; box-shadow: 0 10px 40px rgba(31, 31, 28, 0.28);
  padding: 24px 26px 20px;
}
.ws-confirm-title {
  font-family: var(--p-font-display); font-weight: 500; font-size: 18px;
  color: var(--p-ink); margin: 0 0 10px;
}
.ws-confirm-body {
  font-size: 14px; line-height: 1.55; color: var(--p-muted); margin: 0 0 22px;
}
.ws-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ws-confirm-btn {
  font-family: inherit; font-size: 13.5px; cursor: pointer;
  padding: 8px 16px; border-radius: 4px; border: 1px solid transparent;
}
.ws-confirm-cancel { background: none; border-color: var(--p-panel-edge); color: var(--p-ink); }
.ws-confirm-cancel:hover { background: var(--color-oat); }
.ws-confirm-ok { background: #b05050; color: #fff; }
.ws-confirm-ok:hover { background: #9a4444; }

.read-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 31, 28, 0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 1100; padding: 16px;
}
.read-overlay.open { display: flex; }
.read-modal {
  background: var(--p-panel); color: var(--p-ink);
  width: 1300px; max-width: 94vw; max-height: 92vh;
  border-radius: 6px; box-shadow: 0 10px 40px rgba(31, 31, 28, 0.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.read-modal-header {
  padding: 16px 24px 12px; border-bottom: 1px solid var(--p-panel-edge);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.read-modal-title { font-family: var(--p-font-display); font-weight: 500; font-size: 19px; color: var(--p-ink); }
.read-modal-close { background: none; border: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--p-muted); padding: 2px 6px; }
.read-modal-close:hover { color: var(--p-ink); }
.read-modal-body { overflow-y: auto; padding: 28px 48px; flex: 1; }
/* Neutralise the inline block constraints once the content is in the modal,
   and lift it to a comfortable reading size. White-space handling is left to
   each source class (pre-wrap on transforms; default on speaker transcripts). */
.read-modal-body .rec-transcript,
.read-modal-body .rec-transform-content,
.read-modal-body .xform-content {
  font-size: 21px; line-height: 1.7; max-height: none; overflow: visible;
  background: none; padding: 0; margin: 0;
}

/* Middle pane thread items — card container shared above; inner content here */
.thread-row1 { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; padding-right: 26px; }
.thread-title { font-size: 0.83em; color: var(--color-ink); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-date { font-size: 0.68em; color: var(--color-muted); font-family: var(--p-font-body); flex-shrink: 0; }
.thread-preview { font-size: 0.72em; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 26px; }
.thread-anchor-tag { font-size: 0.65em; color: var(--color-muted); background: var(--color-line); border-radius: 2px; padding: 1px 4px; margin-left: 4px; }
.thread-delete {
  display: inline-flex; align-items: center; justify-content: center;
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 18px; width: 22px; height: 22px; border-radius: 4px;
  color: var(--color-muted); opacity: 0.75;
  padding: 0; line-height: 1; z-index: 2;
}
.thread-delete:hover { opacity: 1; color: var(--color-danger, #b05050); background: var(--color-oat); }
/* Always visible (was hover-only and easy to miss); deepens on row hover. */
.middle-thread-item:hover .thread-delete { opacity: 1; }
.middle-thread-item:hover::after { display: none; }
.middle-new-thread { font-size: 0.72em; color: var(--color-muted); padding: 6px 16px 2px; cursor: pointer; }
.middle-new-thread:hover { color: var(--color-ink); }

/* Middle pane standing items — card container shared above; inner content here */
.standing-formulation, .standing-note-item { display: flex; align-items: center; gap: 8px; }
.standing-formulation-label { font-size: 0.83em; color: var(--color-ink); flex: 1; }
.standing-formulation-badge { font-size: 0.65em; color: var(--color-muted); font-family: var(--p-font-body); }
.standing-note-title { font-size: 0.83em; color: var(--color-ink); flex: 1; }
.standing-note-label { font-size: 0.65em; color: var(--color-muted); background: var(--color-line); border-radius: 2px; padding: 1px 5px; }
.standing-note-date { font-size: 0.68em; color: var(--color-muted); font-family: var(--p-font-body); }
.standing-add-btn { font-size: 0.72em; color: var(--color-muted); padding: 6px 16px 2px; cursor: pointer; }
.standing-add-btn:hover { color: var(--color-ink); }

/* Standing note editor surface */
.standing-editor { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.standing-editor-head { padding: 14px 28px 10px; border-bottom: 1px solid var(--color-line); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.standing-editor-back { font-size: 0.78em; color: var(--color-accent); background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; white-space: nowrap; }
.standing-editor-back:hover { text-decoration: underline; }
.standing-editor-title-input { flex: 1; background: none; border: none; font-size: 1em; font-weight: 500; color: var(--color-ink); font-family: var(--p-font-body); outline: none; }
.standing-editor-title-input::placeholder { color: var(--color-muted); }
.standing-editor-save { font-size: 0.68em; color: var(--color-muted); opacity: 0; transition: opacity 0.4s; }
.standing-editor-save.show { opacity: 1; }
.standing-editor-label { font-size: 0.72em; padding: 2px 8px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 3px; color: var(--color-muted); cursor: pointer; }
.standing-editor-delete { font-size: 0.72em; padding: 2px 8px; background: none; border: 1px solid var(--color-line); border-radius: 3px; color: #888; cursor: pointer; }
.standing-editor-body { flex: 1; padding: 16px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.standing-editor-textarea { flex: 1; background: none; border: none; resize: none; color: var(--color-ink); font-size: 0.9em; font-family: var(--p-font-body); line-height: 1.7; outline: none; min-height: 200px; }
.standing-editor-textarea::placeholder { color: var(--color-muted); }
.standing-dictate-btn { align-self: flex-start; font-size: 0.78em; padding: 2px 8px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-ink); font-family: var(--p-font-body); }
.standing-dictate-btn.recording { background: #8b3a3a; color: #fff; border-color: #8b3a3a; }

/* Formulation desk surface */
.formulation-wrap { height: 100%; overflow: hidden; }
.formulation-doc { height: 100%; overflow-y: auto; padding: 24px 36px; }
.formulation-head { font-size: 0.72em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.formulation-head-title { flex: 1; }
.formulation-notes-btn { font-size: 0.9em; font-weight: 400; text-transform: none; letter-spacing: 0; padding: 2px 9px; border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-muted); background: none; font-family: var(--p-font-body); }
.formulation-notes-btn:hover { color: var(--color-ink); border-color: var(--color-muted); }
.formulation-notes-btn.active { background: var(--color-surface); color: var(--color-ink); }
.form-save-indicator { font-size: 0.9em; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--color-muted); opacity: 0; transition: opacity 0.4s; }
.form-save-indicator.show { opacity: 1; }
/* Source panel — process notes reference */
.form-thread-notice { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; padding: 9px 12px; border: 1px solid var(--color-line); border-radius: 6px; background: var(--color-surface); font-size: 0.78em; color: var(--color-muted); }
.form-thread-notice a { color: var(--color-accent); white-space: nowrap; }
.form-thread-notice-x { margin-left: auto; border: none; background: none; color: var(--color-muted); font-size: 1.15em; line-height: 1; cursor: pointer; padding: 0 2px; align-self: center; }
.form-thread-notice-x:hover { color: var(--color-accent); }
.form-source-panel { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--color-line); }
.form-source-head { font-size: 0.68em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); margin-bottom: 12px; }
.form-source-note { margin-bottom: 14px; }
.form-source-note-meta { font-size: 0.68em; color: var(--color-muted); font-family: var(--p-font-body); margin-bottom: 4px; }
.form-source-note-body { font-size: 0.82em; color: var(--color-ink); line-height: 1.7; white-space: pre-wrap; max-height: 180px; overflow: hidden; }
.form-source-note-body.expanded { max-height: none; }
.form-source-expand { font-size: 0.68em; color: var(--color-accent); cursor: pointer; margin-top: 2px; display: inline-block; }
/* Form sections — lighter, document-like */
.form-section { margin-bottom: 0; border-bottom: 1px solid var(--color-line); }
.form-section:last-child { border-bottom: none; }
.form-section-head { display: flex; align-items: center; padding: 10px 0; cursor: pointer; background: none; user-select: none; gap: 8px; }
.form-section-head:hover .form-section-label { color: var(--color-accent); }
.form-section-chevron { font-size: 1.7em; color: var(--color-muted); transition: transform 0.15s; flex-shrink: 0; }
.form-section.open .form-section-chevron { transform: rotate(90deg); }
.form-section-label { font-size: 0.85em; font-weight: 500; color: var(--color-ink); flex: 1; }
.form-section-badge { font-size: 0.63em; color: var(--color-muted); font-family: var(--p-font-body); }
.form-section-body { display: none; padding: 2px 0 16px 18px; }
.form-section.open .form-section-body { display: flex; flex-direction: column; gap: 8px; }
.form-section-hint { font-size: 0.75em; color: var(--color-muted); }
.form-section-body textarea { width: 100%; box-sizing: border-box; background: none; border: none; resize: vertical; color: var(--color-ink); font-size: 0.88em; font-family: var(--p-font-body); line-height: 1.7; outline: none; min-height: 400px; }
.form-section-body textarea::placeholder { color: var(--color-muted); }
/* Data sections: assembled-from-material (top) + clinician's own notes (below divider) */
.form-assembled-tag { font-size: 0.62em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
.form-refreshed-tag { font-size: 0.66em; text-transform: none; letter-spacing: normal; color: var(--color-muted); font-weight: 500; white-space: nowrap; }
.form-section-body textarea.form-assembled-ta { min-height: 130px; background: var(--color-surface); border-radius: 4px; padding: 8px 10px; color: var(--color-muted); font-style: italic; }
.form-user-divider { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: 0.6em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); cursor: pointer; user-select: none; }
.form-user-divider::before, .form-user-divider::after { content: ''; flex: 1; height: 1px; background: var(--color-line); }
.form-user-divider:hover { color: var(--color-accent); }
.form-user-chevron { display: inline-block; transition: transform 0.15s; }
.form-user-wrap.open .form-user-chevron { transform: rotate(90deg); }
.form-user-wrap .form-user-ta { display: none; }
.form-user-wrap.open .form-user-ta { display: block; }
.form-section-body textarea.form-user-ta { min-height: 140px; }
.form-section-footer { display: flex; align-items: center; gap: 8px; }
.form-section-ct-tag { font-size: 0.65em; color: var(--color-muted); font-style: italic; flex: 1; }
.form-dictate-btn { font-size: 0.72em; padding: 2px 8px; background: none; border: 1px solid var(--color-line); border-radius: 3px; cursor: pointer; color: var(--color-muted); font-family: var(--p-font-body); }
.form-dictate-btn:hover { color: var(--color-ink); border-color: var(--color-muted); }
.form-dictate-btn.recording { background: #8b3a3a; color: #fff; border-color: #8b3a3a; }
.form-bring-btn { font-size: 0.72em; padding: 2px 10px; background: none; border: 1px solid var(--color-accent); border-radius: 3px; cursor: pointer; color: var(--color-accent); font-family: var(--p-font-body); transition: background 0.12s, color 0.12s; }
.form-bring-btn:hover { background: var(--color-accent); color: var(--color-bg); }
/* Scaffold */
.scaffold-head { font-size: 0.68em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); margin-bottom: 10px; margin-top: 14px; }
.scaffold-head:first-child { margin-top: 0; }
.scaffold-step { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; font-size: 0.8em; color: var(--color-muted); cursor: pointer; }
.scaffold-step input[type=checkbox] { margin-top: 2px; flex-shrink: 0; }
.scaffold-step.done { color: var(--color-ink); text-decoration: line-through; opacity: 0.5; }
.scaffold-horizon { font-size: 0.78em; color: var(--color-muted); line-height: 1.6; padding: 8px; background: var(--color-surface); border-radius: 3px; margin-top: 6px; }
.delivery-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-line); }
.delivery-toggle { font-size: 0.78em; color: var(--color-muted); cursor: pointer; padding: 4px 0; }
.delivery-toggle:hover { color: var(--color-ink); }
.delivery-steps { margin-top: 10px; }
.delivery-step { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; font-size: 0.8em; color: var(--color-muted); }
.delivery-step input[type=checkbox] { margin-top: 2px; flex-shrink: 0; }

/* Empty state */
.empty-state {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--color-muted); font-size: 0.9em; font-style: italic;
  padding: 40px; text-align: center; line-height: 1.6;
}

/* Workshop content */
.workshop-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Surface tabs */
.surface-tabs {
  display: flex; gap: 0; padding: 0 16px; flex-shrink: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
}
.surface-tab {
  font-family: var(--font-body); font-size: 0.82em;
  padding: 10px 14px; background: none; border: none;
  color: var(--color-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color 0.12s;
}
.surface-tab:hover { color: var(--color-ink); }
.surface-tab.active { color: var(--color-ink); border-bottom-color: var(--color-accent); }

/* Surfaces */
.surface { display: none; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.surface.active { display: flex; }

/* Chat messages — 2-column grid: 56px sender | 1fr content */
.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 56px 36px 32px;
  display: flex; flex-direction: column; gap: 0;
}
.message {
  display: grid;
  grid-template-columns: 72px 1fr;
  column-gap: 20px;
  margin-bottom: 36px;
  align-items: start;
  width: 100%;
}
/* When the next message is from a different speaker, give it more air */
.message + .message.user,
.message + .message.assistant { margin-top: 8px; }
/* When the same speaker continues, tighten — feels like one breath */
.message.user + .message.user,
.message.assistant + .message.assistant { margin-top: -16px; }
.msg-role {
  display: flex; flex-direction: column; align-items: flex-end;
  padding-top: 2px;
  font-family: var(--p-font-display);
  font-style: italic; font-weight: 400;
  font-size: 14px; line-height: 1.3;
  color: var(--color-muted);
  text-align: right;
  letter-spacing: 0;
  text-transform: none;
}
.msg-time {
  font-family: var(--p-font-body);
  font-size: 9.5px; letter-spacing: 0.05em;
  color: var(--color-muted); opacity: 0.55;
  text-transform: none; font-style: normal;
  margin-top: 4px;
}
.msg-delete {
  display: inline;
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--color-muted); opacity: 0.22;
  padding: 0 2px; margin-left: 6px;
  line-height: 1; vertical-align: middle;
  position: relative; top: -1px;
  transition: opacity 0.15s;
}
.msg-delete:hover { opacity: 1; color: var(--color-danger, #b05050); }
.message:hover .msg-delete { opacity: 0.8; }
.msg-content {
  font-size: 15.5px; line-height: 1.72;
  color: var(--color-ink);
  white-space: pre-wrap; word-break: break-word;
}
.msg-content a, .msg-content a:visited {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--color-link) 55%, transparent);
  text-underline-offset: 3px;
}
.msg-content a:hover {
  text-decoration-color: var(--color-link);
}
.message.user .msg-content {
  border-left: 2px solid var(--p-accent);
  padding-left: 16px;
  font-family: var(--p-font-body);
}
.message.assistant .msg-content {
  color: var(--color-ink-soft);
  font-family: var(--p-font-display);
  font-size: 16.5px; line-height: 1.7;
  font-weight: 400;
}
.pii-warning {
  font-size: 12px;
  color: var(--color-ink-soft);
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border-left: 3px solid #f59e0b;
  padding: 4px 10px;
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
}
/* Mic-level preflight (session recorder + dictation surfaces): the first
 * seconds of capture never rose above usable-speech level — e.g. the system
 * input gain dragged down by another app. Non-blocking; capture keeps running. */
.mic-level-warn {
  font-size: 12px;
  color: var(--color-ink-soft);
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border-left: 3px solid #f59e0b;
  padding: 4px 10px;
  margin: 6px 0;
  border-radius: 0 4px 4px 0;
}

/* Informational sibling of .mic-level-warn — no amber: nothing is wrong.
   Shown briefly at record start (the call-audio dip note), then fades. */
.rec-call-note {
  font-size: 12px;
  color: var(--color-muted);
  border-left: 3px solid var(--color-border);
  padding: 4px 10px;
  margin: 6px 0;
  border-radius: 0 4px 4px 0;
  opacity: 1;
  transition: opacity 1.2s ease;
}
.rec-call-note.fading { opacity: 0; }
.lib-link {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}
.lib-link:hover { text-decoration-style: solid; }
/* Plain <a> tags inside rendered transformations (e.g. /references/foo.html
 * refs emitted by _linkifyRefs without a class). Bright-yellow on dark,
 * dark-amber on parchment — matches .lib-link, no per-note rewrite needed.
 * Surfaces: process transform (.xform-content), clinical/formal record
 * (.formal-content), recording transformation summary (.rec-transform-content). */
.xform-content a, .formal-content a, .rec-transform-content a,
.xform-content a:visited, .formal-content a:visited, .rec-transform-content a:visited {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--color-link) 55%, transparent);
  text-underline-offset: 3px;
}
.xform-content a:hover, .formal-content a:hover, .rec-transform-content a:hover {
  text-decoration-color: var(--color-link);
}
.streaming-logo {
  width: 48px; height: 48px;
  color: var(--color-ink);
  display: block;
}
.streaming-logo rect.sl-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* White fill that rises inside the doorway outline as the answer loads. The
 * .sl-fill rect grows upward from the base and is clipped to the doorway
 * shapes, so white only appears within the outline. JS sets y/height each
 * tick; the transition smooths the movement between steps. */
.streaming-logo rect.sl-fill {
  fill: #fff;
  transition: y 140ms linear, height 140ms linear;
}
@keyframes streaming-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.82); }
  50%       { opacity: 0.9;  transform: scale(1.12); }
}
.streaming-pct {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--color-ink-soft);
  text-align: center;
  margin-top: 5px;
  font-family: var(--p-font-body);
}

/* ── Global loading overlay ──────────────────────────────── */
#global-loader {
  position: fixed; inset: 0;
  background: var(--p-page, #F7F3EC);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
#global-loader.visible { opacity: 1; pointer-events: auto; }
#global-loader .loader-mark {
  width: 72px; height: 72px;
  color: var(--p-ink, #3b3327);
  opacity: 0.18;
  animation: loader-breathe 1.8s ease-in-out infinite;
}
@keyframes loader-breathe {
  0%, 100% { opacity: 0.12; }
  50%       { opacity: 0.32; }
}

/* Context (brought-in) message block — sits in the same grid as other messages */
.message.context .msg-role {
  color: var(--p-petrol, #3D6068);
  font-size: 14px; text-transform: none;
  letter-spacing: 0; opacity: 0.8;
  padding-top: 0;
}
.message.context .msg-content {
  border-left: 2px solid var(--p-petrol, #3D6068);
  padding: 6px 10px 6px 14px;
  background: rgba(61, 96, 104, 0.05);
  border-radius: 0 4px 4px 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--color-ink);
  opacity: 0.78;
  max-height: 5.5em;
  overflow: hidden;
  position: relative;
}
.message.context .msg-content::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1.8em;
  background: linear-gradient(transparent, var(--p-page));
}

.btn-ghost {
  font-family: var(--font-body); font-size: 0.78em;
  padding: 4px 8px; background: none; border: none;
  color: var(--color-muted); cursor: pointer;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.btn-ghost:hover { color: var(--color-ink); background: var(--color-oat); }
.btn-ghost.active { color: var(--p-petrol, #4A6B74); }

/* Compose — contained box design */
.compose {
  border-top: 1px solid var(--p-panel-alt-edge);
  background: var(--p-panel-alt);
  color: var(--p-panel-alt-ink);
  padding: 12px 28px 16px;
  flex-shrink: 0;
}
.compose-box {
  border: 1px solid rgba(35, 24, 10, 0.12);
  border-radius: 8px;
  background: #FBF6EC;              /* light cream field — pops off the dark compose tray in every theme */
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compose-box:hover { border-color: rgba(35, 24, 10, 0.22); }
.compose-box:focus-within { border-color: var(--p-accent-lift); box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.6); }
.compose-box textarea {
  width: 100%; resize: none; border: none; outline: none;
  border-radius: 8px 8px 0 0;
  padding: 12px 14px;
  font-family: var(--p-font-body); font-size: 14px;
  color: #23180A; background: transparent;     /* dark ink on the cream field */
  line-height: 1.55;
  min-height: 60px; max-height: 200px;
}
.compose-box textarea::placeholder { color: #8A7558; }
/* The cream field carries dark text, so its inner chrome (notice, tool row,
   shortcut) flips from the dark-tray light colours to warm dark ones. */
.compose-box .data-notice { color: #8A7558; }
.compose-box .case-chat-ctx { color: #8A7558; }
.compose-box .compose-tools { border-top: 1px solid rgba(35, 24, 10, 0.10); }
.compose-box .tool-btn { color: #6B5A40; }
.compose-box .tool-btn:hover { color: #23180A; background: rgba(35, 24, 10, 0.05); }
.compose-box .compose-shortcut { color: #A38F6E; }
.data-notice {
  font-size: 0.71em;
  color: var(--p-panel-alt-faint);
  padding: 0 14px 5px;
  line-height: 1.4;
}
.compose-tools {
  display: flex; align-items: center; gap: 1px;
  padding: 5px 8px;
  border-top: 1px solid var(--p-panel-alt-edge);
  background: transparent;
  border-radius: 0 0 6px 6px;
}
/* The two footnotes (context-loaded + de-identified) sit at the left of the
   tool row, stacked and quiet, with Send pinned right. They shrink/wrap rather
   than push Send off. */
.compose-notes {
  flex: 0 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
  padding-right: 10px;
}
.compose-notes .data-notice,
.compose-notes .case-chat-ctx { padding: 0; }
.tool-btn {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--p-font-body); font-size: 12px;
  padding: 4px 8px; background: none; border: none;
  color: var(--p-panel-alt-mute); cursor: pointer;
  border-radius: 3px; white-space: nowrap;
  transition: color 0.1s, background 0.1s;
}
.tool-btn:hover { color: var(--p-panel-alt-ink); background: var(--p-panel-alt-hover); }
.tool-btn.active { color: var(--p-accent-lift); }
.compose-spacer { flex: 1; }
.compose-shortcut {
  font-family: var(--p-font-body);
  font-size: 10px; color: var(--p-panel-alt-faint);
  letter-spacing: 0.04em; padding-right: 6px;
}
.btn-send {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--p-font-body); font-size: 12px; font-weight: 500;
  padding: 5px 14px;
  background: var(--p-accent-lift); color: var(--p-panel-alt);
  border: none; border-radius: 3px; cursor: pointer;
  letter-spacing: 0.02em; transition: opacity 0.1s;
}
.btn-send:hover { opacity: 0.85; }
.btn-send:disabled { opacity: 0.35; cursor: default; }
/* Demo-only Companion unlock affordance (one-click). Quiet, panel-toned. */
.demo-unlock {
  margin: 10px 28px 0;
  border: 1px solid var(--p-panel-alt-edge);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  padding: 11px 14px;
  font-family: var(--p-font-body);
}
.demo-unlock-line {
  font-size: 12.5px; line-height: 1.5;
  color: var(--p-panel-alt-mute);
  margin-bottom: 8px;
}
.demo-unlock-line a { color: var(--p-accent-lift); text-decoration: none; }
.demo-unlock-line a:hover { text-decoration: underline; }
.demo-unlock-row { display: flex; gap: 7px; align-items: center; }
.demo-token-save {
  font-family: var(--p-font-body); font-size: 12px; font-weight: 500;
  padding: 6px 14px; background: var(--p-accent-lift); color: var(--p-panel-alt);
  border: none; border-radius: 4px; cursor: pointer; flex-shrink: 0;
}
.demo-token-save:hover { opacity: 0.85; }
.demo-unlock-msg {
  font-size: 11.5px; color: var(--p-panel-alt-faint);
  margin-top: 6px; min-height: 0;
}
.demo-unlock-saved {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--p-panel-alt-mute);
}
.demo-token-clear {
  font-family: var(--p-font-body); font-size: 11.5px;
  padding: 4px 10px; background: none; color: var(--p-panel-alt-mute);
  border: 1px solid var(--p-panel-alt-edge); border-radius: 4px;
  cursor: pointer; flex-shrink: 0;
}
.demo-token-clear:hover { color: var(--p-panel-alt-ink); border-color: var(--p-accent-lift); }
/* Modal / non-compose buttons use the shared .p-btn family from
   peribolos.css — promoted from here 2026-08-02, definitions unchanged. */

/* Chat surface: threads sidebar | conversation. Threads sit in a side column so
   the conversation gets the full height; the context panel was retired here. */
#surface-chat { flex-direction: row; position: relative; }
.chat-col {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}

/* "In context" right column */
.context-col {
  width: var(--context-w, 272px); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--p-panel-alt);
  color: var(--p-panel-alt-ink);
  overflow: hidden;
}
.context-resizer {
  width: 8px; flex-shrink: 0; cursor: col-resize; position: relative;
  background: transparent;
}
.context-resizer:hover, .context-resizer.dragging {
  background: var(--color-accent); opacity: 0.35;
}
#surface-chat.context-collapsed .context-col,
#surface-chat.context-collapsed .context-resizer { display: none; }
.context-reopen {
  display: none; position: absolute; top: 14px; right: 0; z-index: 6;
  writing-mode: vertical-rl; padding: 10px 5px; cursor: pointer;
  font-family: var(--p-font-body); font-size: 11px; letter-spacing: 0.08em;
  color: var(--p-panel-alt-ink); background: var(--p-panel-alt);
  border: 1px solid var(--p-panel-alt-edge); border-right: none;
  border-radius: 4px 0 0 4px;
}
#surface-chat.context-collapsed .context-reopen { display: block; }
.context-collapse-btn, .col-collapse-btn {
  background: none; border: none; cursor: pointer;
  color: var(--p-panel-alt-ink); font-size: 13px; padding: 2px 7px;
  line-height: 1; opacity: 0.7;
}
.context-collapse-btn:hover, .col-collapse-btn:hover { opacity: 1; }
.col-collapse-btn { color: var(--color-ink); }
/* sidebar collapse */
.layout.no-sidebar { grid-template-columns: 0 var(--middle-w, 260px) 1fr; }
.layout.no-sidebar.sidebar-only { grid-template-columns: 0 1fr; }
.layout.no-sidebar .sidebar,
.layout.no-sidebar .sidebar-resizer { display: none; }
.col-reopen {
  position: absolute; top: 10px; left: 0; z-index: 7; cursor: pointer;
  writing-mode: vertical-rl; padding: 10px 5px; font-family: var(--p-font-body);
  font-size: 11px; letter-spacing: 0.08em; color: var(--color-ink);
  background: var(--p-panel); border: 1px solid var(--p-panel-edge);
  border-left: none; border-radius: 0 4px 4px 0; display: none;
}
.layout.no-sidebar .col-reopen { display: block; }
/* Middle-column reopen tab — mirrors .col-reopen so a collapsed middle column
   is never stranded. Its only collapse control (the ‹ button) lives inside the
   pane, so without this there's no way back once collapsed. */
.mid-reopen {
  position: absolute; top: 10px; left: var(--sidebar-w, 280px); z-index: 7; cursor: pointer;
  writing-mode: vertical-rl; padding: 10px 5px; font-family: var(--p-font-body);
  font-size: 11px; letter-spacing: 0.08em; color: var(--color-ink);
  background: var(--p-panel); border: 1px solid var(--p-panel-edge);
  border-left: none; border-radius: 0 4px 4px 0; display: none;
}
.layout.sidebar-only .mid-reopen { display: block; }
.layout.no-sidebar.sidebar-only .mid-reopen { left: 0; top: 130px; }
.context-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--p-panel-alt-edge);
  flex-shrink: 0;
}
.context-header-label {
  font-family: var(--p-font-body);
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--p-panel-alt-faint);
  margin-bottom: 5px;
}
.context-header-title {
  font-family: var(--p-font-display);
  font-size: 16px; font-weight: 500;
  color: var(--p-panel-alt-ink); line-height: 1.3;
}
.context-items {
  flex: 1; overflow-y: auto;
  padding: 8px 0;
}
.context-section-label {
  font-family: var(--p-font-body);
  font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--p-panel-alt-faint);
  padding: 10px 20px 4px;
}
.context-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--p-panel-alt-edge);
  cursor: default;
  transition: background 0.1s;
}
.context-item:last-child { border-bottom: none; }
.context-item.brought-in { cursor: pointer; }
.context-item.brought-in:hover { background: var(--p-panel-alt-hover); }
.context-item-icon {
  flex-shrink: 0; padding-top: 1px;
  color: var(--p-panel-alt-mute);
}
.context-item.brought-in .context-item-icon { color: var(--p-accent-lift); }
.context-item-body { flex: 1; min-width: 0; }
.context-item-label {
  font-size: 12.5px; font-weight: 500;
  color: var(--p-panel-alt-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.context-item.brought-in .context-item-label { color: var(--p-accent-lift); }
.context-item-meta {
  font-family: var(--p-font-body);
  font-size: 9.5px; color: var(--p-panel-alt-faint);
  letter-spacing: 0.04em; margin-top: 2px;
}
.context-empty {
  padding: 12px 20px;
  font-size: 12px; color: var(--p-panel-alt-mute);
  font-style: italic; line-height: 1.5;
}
.context-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--p-panel-alt-edge);
  font-style: italic; font-size: 11.5px;
  color: var(--p-panel-alt-mute); line-height: 1.5;
  flex-shrink: 0;
}

/* Date markers in chat — display italic for breath, no caps shouting */
.date-marker {
  display: flex; align-items: center; gap: 16px;
  margin: 28px 0 24px;
  font-family: var(--p-font-display);
  font-style: italic; font-weight: 400;
  font-size: 13.5px; letter-spacing: 0;
  color: var(--p-muted);
  text-transform: none;
}
.date-marker::before, .date-marker::after {
  content: ''; flex: 1; height: 1px;
  background: var(--p-panel-edge-strong);
}

/* Brought-in label — display italic, sits above the excerpt */
.brought-in-label {
  font-family: var(--p-font-display);
  font-style: italic; font-weight: 500;
  font-size: 12.5px; letter-spacing: 0;
  color: var(--p-petrol, #3D6068);
  margin-bottom: 4px;
  text-transform: none; opacity: 0.9;
}

/* Stub surfaces */
.surface-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.surface-placeholder .ph-title {
  font-family: var(--font-display); font-size: 1.15em;
  color: var(--color-ink-soft);
}
.surface-placeholder .ph-sub {
  font-size: 0.82em; color: var(--color-muted); font-style: italic;
}

/* Loading / error */
.sidebar-msg {
  padding: 14px 16px; font-size: 0.82em;
  color: var(--color-muted); font-style: italic;
}

/* ─── Peribolos overrides (Phase 1: restyle, structure unchanged) ─── */

/* Sidebar — petrol ground per Peribolos design system */
.sidebar {
  background: var(--p-panel-alt);
}
.sidebar-header {
  color: var(--p-panel-alt-mute);
  border-bottom: 1px solid var(--p-panel-alt-edge);
  letter-spacing: 0.14em;
}
.client-name { color: var(--p-panel-alt-ink); }
.client-meta { color: var(--p-panel-alt-faint); }
.client-item { border-left-color: transparent; }
.client-item:hover { background: var(--p-panel-alt-hover); }
.client-item.active {
  background: var(--p-panel-alt-hover);
  border-left-color: var(--p-accent-lift);
}
.client-item.active .client-name { font-weight: 500; }
.sidebar-msg { color: var(--p-panel-alt-faint); }

/* Top nav — replace warm parchment nav with Peribolos nav (.p-nav from peribolos.css).
 * Keep .top-nav class on the <nav> for any other JS that may target it. */
.top-nav.p-nav { gap: 4px; }
.top-nav .p-nav-brand { color: var(--p-ink); text-decoration: none; }
.top-nav .p-nav-brand:hover { opacity: 0.8; }
.top-nav .dark-toggle {
  background: none; border: none;
  color: var(--p-muted); cursor: pointer;
  font-size: 16px; padding: 6px 10px;
  border-radius: 4px; margin-left: 8px;
}
.top-nav .dark-toggle:hover { background: var(--p-accent-soft); color: var(--p-ink); }

/* Surface tabs — indigo accent */
.surface-tab.active {
  color: var(--p-ink);
  border-bottom-color: var(--p-accent);
}

/* Empty state — display type for the headline feel */
.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  padding: 80px 32px;
  text-align: center;
}
.empty-mark {
  width: 60px; height: 60px;
  color: var(--p-accent-lift); opacity: 0.55;
  margin-bottom: 4px;
}
.empty-mark svg { width: 100%; height: 100%; display: block; }
.empty-title {
  font-family: var(--p-font-display);
  font-weight: 500; font-style: italic;
  font-size: 28px; line-height: 1.2;
  color: var(--p-ink);
  letter-spacing: 0;
}
.empty-body {
  font-family: var(--p-font-body);
  font-size: 14.5px; line-height: 1.65;
  color: var(--p-muted);
  max-width: 360px;
}
.empty-actions { margin-top: 8px; }
.empty-action {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--p-font-body); font-size: 13px; font-weight: 500;
  padding: 8px 18px;
  background: var(--p-accent); color: var(--p-page);
  border: none; border-radius: 4px;
  cursor: pointer; letter-spacing: 0.02em;
  transition: opacity 0.15s, transform 0.1s;
}
.empty-action:hover { opacity: 0.9; transform: translateY(-1px); }
.empty-action .ea-glyph {
  font-size: 18px; line-height: 1;
  color: var(--p-accent-lift); margin-right: 2px;
}
.empty-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty-action.secondary {
  background: transparent; color: var(--p-accent);
  border: 1px solid var(--p-line, rgba(0,0,0,0.15));
}
.empty-action.secondary .ea-glyph { color: var(--p-accent); }
.empty-action.secondary:hover { opacity: 1; background: rgba(0,0,0,0.03); }
/* Stacked starter: a title line above a quiet subtitle. Used by the Growth
   edge tile, which names the surface and what the counts circle without
   prescribing — the reading stays the clinician's. */
.empty-action.empty-action-stack {
  flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 18px; line-height: 1.25;
}
.empty-action-stack .ea-title { font-weight: 500; }
.empty-action-stack .ea-sub {
  font-size: 11px; font-weight: 400; letter-spacing: 0.01em;
  opacity: 0.72;
}
/* Mode chips (clinical-companion modes) */
.mode-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.mode-chips-chat {
  flex: 0 0 auto; align-items: center;
  padding: 10px 36px;
  border-bottom: 1px solid var(--p-line, rgba(0,0,0,0.08));
}
.mode-chip {
  font-family: var(--p-font-body); font-size: 12px;
  padding: 4px 12px; background: transparent;
  color: var(--p-muted); border: 1px solid var(--p-line, rgba(0,0,0,0.14));
  border-radius: 100px; cursor: pointer; white-space: nowrap; letter-spacing: 0.01em;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.mode-chip:hover { color: var(--p-ink); border-color: var(--p-accent); background: rgba(0,0,0,0.02); }
.empty-modes {
  margin-top: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-modes-label {
  font-family: var(--p-font-body); font-size: 12px;
  color: var(--p-muted); letter-spacing: 0.02em;
}
.empty-modes .mode-chips { justify-content: center; max-width: 440px; }
/* Bench chips read as clear, clickable buttons (accent outline, fill on hover) */
.mode-chips-bench .mode-chip {
  border-color: var(--p-accent);
  color: var(--p-accent);
  background: var(--p-page, #fff);
  padding: 6px 14px; font-weight: 500;
}
.mode-chips-bench .mode-chip:hover {
  background: var(--p-accent);
  color: var(--p-page, #fff);
  border-color: var(--p-accent);
}
/* Mode picker overlay (bench chip → which client?) */
.mode-picker-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.28);
  display: flex; align-items: center; justify-content: center;
}
.mode-picker-card {
  background: var(--p-page, #F7F3EC); border-radius: 8px;
  width: 360px; max-width: 90vw; max-height: 70vh;
  display: flex; flex-direction: column; padding: 18px 18px 14px;
  box-shadow: 0 12px 44px rgba(0,0,0,0.20);
}
.mode-picker-head { font-family: var(--p-font-display); font-size: 19px; color: var(--p-ink); }
.mode-picker-sub { font-family: var(--p-font-body); font-size: 12.5px; color: var(--p-muted); margin: 3px 0 12px; }
.mode-picker-search {
  font-family: var(--p-font-body); font-size: 13px;
  padding: 7px 10px; margin-bottom: 8px;
  border: 1px solid var(--p-line, rgba(0,0,0,0.15)); border-radius: 5px;
  background: var(--p-page, #fff); color: var(--p-ink);
}
.mode-picker-list { overflow-y: auto; flex: 1 1 auto; min-height: 40px; }
.mode-picker-item {
  padding: 8px 10px; border-radius: 5px; cursor: pointer;
  font-family: var(--p-font-body); font-size: 13.5px; color: var(--p-ink);
}
.mode-picker-item:hover { background: rgba(0,0,0,0.05); }
.mode-picker-empty {
  font-family: var(--p-font-body); font-size: 13px; color: var(--p-muted);
  padding: 16px 4px; text-align: center;
}
.mode-picker-cancel {
  margin-top: 10px; align-self: flex-end;
  background: none; border: none; cursor: pointer;
  font-family: var(--p-font-body); font-size: 12.5px; color: var(--p-muted);
}
.mode-picker-cancel:hover { color: var(--p-ink); }
.caseload-view {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  max-width: 720px; margin: 0 auto; padding: 40px 28px 32px;
  width: 100%;
}
.cl-head { margin-bottom: 22px; }
.cl-title {
  font-family: var(--p-font-display); font-size: 22px;
  color: var(--p-ink, #222); letter-spacing: 0.01em;
}
.cl-sub {
  font-family: var(--p-font-body); font-size: 13px;
  color: var(--p-muted); margin-top: 6px; line-height: 1.5;
}
.cl-rows { display: flex; flex-direction: column; }
.cl-row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 13px 0; border-bottom: 1px solid var(--p-line, rgba(0,0,0,0.08));
}
.cl-row .cl-name {
  font-family: var(--p-font-body); font-size: 14px; font-weight: 600;
  color: var(--p-ink, #222);
}
.cl-row .cl-facts {
  font-family: var(--p-font-body); font-size: 13px;
  color: var(--p-muted); line-height: 1.55;
}
.cl-row .cl-facts .sep { opacity: 0.4; padding: 0 6px; }
.cl-past-prompt {
  font-family: var(--p-font-body); font-size: 12.5px;
  color: var(--p-muted); margin-top: 4px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cl-past-btn {
  background: transparent; border: 1px solid var(--p-line, rgba(0,0,0,0.15));
  border-radius: 4px; cursor: pointer; padding: 3px 10px;
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
}
.cl-past-btn:hover { color: var(--p-ink, #222); border-color: var(--p-muted); }
.cl-empty {
  font-family: var(--p-font-body); font-size: 14px;
  color: var(--p-muted); padding: 28px 0; text-align: center;
}
.cl-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 24px; gap: 14px; flex-wrap: wrap;
}
.cl-back {
  background: transparent; border: none; cursor: pointer;
  font-family: var(--p-font-body); font-size: 13px; color: var(--p-muted);
  padding: 6px 4px;
}
.cl-back:hover { color: var(--p-ink, #222); }
.cl-reflect {
  background: var(--p-accent); color: var(--p-page); border: none;
  border-radius: 4px; cursor: pointer; padding: 9px 18px;
  font-family: var(--p-font-body); font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em; transition: opacity 0.15s, transform 0.1s;
}
.cl-reflect:hover { opacity: 0.9; transform: translateY(-1px); }
/* Deliberate Practice home (variant C) — quiet lines, each opening into focused
   work. Material-as-subject; the same holds-and-waits register as the rest of
   the Workshop. */
.dp-lines { display: flex; flex-direction: column; }
.dp-line {
  display: flex; align-items: baseline; gap: 18px;
  width: 100%; text-align: left;
  padding: 16px 2px; border: none; border-bottom: 1px solid var(--p-line, rgba(0,0,0,0.08));
  background: transparent; cursor: pointer;
  transition: background 0.12s;
}
.dp-line:hover { background: var(--color-oat, rgba(201,165,74,0.08)); }
.dp-line-quiet { cursor: default; }
.dp-line-quiet:hover { background: transparent; }
.dp-line-label {
  font-family: var(--p-font-display); font-size: 15.5px;
  color: var(--color-ink, var(--p-ink, #222)); flex-shrink: 0;
  min-width: 168px;
}
.dp-line-value {
  font-family: var(--p-font-body); font-size: 13.5px;
  color: var(--p-muted); line-height: 1.5;
}
.dp-line-quiet .dp-line-value { font-style: italic; opacity: 0.85; }
.dp-line-value.dp-value-named {
  font-style: italic; color: var(--color-ink, var(--p-ink, #222));
}
/* Line body: the preview column — value, optional visual, muted sub-line. */
.dp-line-body { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.dp-line-sub {
  font-family: var(--p-font-body); font-size: 11.5px;
  color: var(--p-muted); opacity: 0.8; line-height: 1.45;
}
/* Open-affordance glyph: ▾ = opens in place, "full read →" = leaves the page. */
.dp-line-glyph {
  font-family: var(--p-font-body); font-size: 11.5px; color: var(--p-muted);
  opacity: 0.55; flex-shrink: 0; align-self: flex-start; white-space: nowrap;
  transition: opacity 0.12s;
}
.dp-line:hover .dp-line-glyph { opacity: 0.9; }
/* Growth-edge marker grid: label · recent bar · prior bar. Present-counts as
   proportion of each window; two tones of the same ink, no verdict colours. */
.dp-ge-grid {
  display: grid; grid-template-columns: 128px 1fr 1fr; gap: 4px 14px;
  align-items: center; max-width: 460px; margin-top: 2px;
}
.dp-ge-head {
  font-family: var(--p-font-body); font-size: 10.5px; color: var(--p-muted);
  opacity: 0.75;
}
.dp-ge-label {
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dp-ge-cell { display: flex; align-items: center; gap: 7px; min-width: 0; }
.dp-ge-track { flex: 1; height: 7px; border-radius: 2px; background: var(--p-line, rgba(0,0,0,0.08)); overflow: hidden; }
.dp-ge-fill { display: block; height: 100%; border-radius: 2px; background: var(--color-ink, var(--p-ink, #222)); }
.dp-ge-cell.dp-ge-recent .dp-ge-fill { opacity: 0.55; }
.dp-ge-cell.dp-ge-prior .dp-ge-fill { opacity: 0.26; }
.dp-ge-n {
  font-family: var(--p-font-body); font-size: 11px; color: var(--p-muted);
  min-width: 16px; text-align: right;
}
/* Rehearsal visuals: week dots + difficulty-mix bar. Facts, not streaks —
   a dot marks a week with any round; no counter, no chain to break. */
.dp-reh-visuals { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.dp-reh-vrow { display: flex; align-items: center; gap: 10px; }
.dp-reh-vlabel {
  font-family: var(--p-font-body); font-size: 11px; color: var(--p-muted);
  opacity: 0.75; min-width: 84px;
}
.dp-reh-vnote {
  font-family: var(--p-font-body); font-size: 11px; color: var(--p-muted); opacity: 0.6;
}
.dp-dots { display: inline-flex; gap: 6px; align-items: center; }
.dp-dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--p-line, rgba(0,0,0,0.18)); box-sizing: border-box;
}
.dp-dot.on { background: var(--color-ink, var(--p-ink, #222)); opacity: 0.55; border-color: transparent; }
.dp-mix { display: inline-flex; width: 132px; height: 7px; border-radius: 2px; overflow: hidden; background: var(--p-line, rgba(0,0,0,0.08)); }
.dp-mix-seg { display: block; height: 100%; background: var(--color-ink, var(--p-ink, #222)); }
.dp-mix-seg.easy { opacity: 0.18; }
.dp-mix-seg.right { opacity: 0.45; }
.dp-mix-seg.hard { opacity: 0.75; }
/* Inline panels — closed by default; .open reveals the focused work. */
.dp-panel {
  display: none;
  padding: 4px 2px 18px; border-bottom: 1px solid var(--p-line, rgba(0,0,0,0.08));
}
.dp-panel.open { display: block; }
.dp-panel-hint {
  font-family: var(--p-font-body); font-size: 12.5px;
  color: var(--p-muted); line-height: 1.5; margin-bottom: 10px;
}
.dp-panel textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: var(--p-font-body); font-size: 14px; line-height: 1.5;
  color: var(--color-ink, var(--p-ink, #222));
  background: var(--col-3, var(--p-page, #fff));
  border: 1px solid var(--color-line, var(--p-line, rgba(0,0,0,0.15)));
  border-radius: 5px; padding: 10px 12px;
}
.dp-panel textarea:focus { outline: none; border-color: var(--color-accent, var(--p-accent)); }
.dp-panel-controls {
  display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap;
}
.dp-action {
  background: var(--p-accent); color: var(--p-page); border: none;
  border-radius: 4px; cursor: pointer; padding: 8px 16px;
  font-family: var(--p-font-body); font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em; transition: opacity 0.15s, transform 0.1s;
}
.dp-action:hover { opacity: 0.9; transform: translateY(-1px); }
.dp-action-quiet {
  background: transparent; color: var(--p-muted);
  padding: 8px 4px; font-weight: 400;
}
.dp-action-quiet:hover { color: var(--color-ink, var(--p-ink, #222)); transform: none; }
.dp-panel-status {
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
}
/* Review-queue rows inside the panel */
.dp-queue-rows { display: flex; flex-direction: column; gap: 2px; }
.dp-queue-group-label {
  font-family: var(--p-font-body); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.13em; color: var(--p-muted); margin: 14px 0 4px;
}
.dp-queue-group-label:first-child { margin-top: 4px; }
.dp-queue-row {
  padding: 10px 0; border-bottom: 1px solid var(--p-line, rgba(0,0,0,0.07));
}
.dp-queue-row-label {
  font-family: var(--p-font-body); font-size: 13.5px; font-weight: 600;
  color: var(--color-ink, var(--p-ink, #222));
}
.dp-queue-row-meta {
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
  line-height: 1.5; margin-top: 2px;
}
.dp-queue-row-note {
  font-family: var(--p-font-body); font-size: 12.5px; color: var(--p-muted);
  font-style: italic; line-height: 1.5; margin-top: 4px;
}
.dp-queue-row-actions { display: flex; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.dp-queue-mini {
  background: transparent; border: 1px solid var(--color-line, var(--p-line, rgba(0,0,0,0.15)));
  border-radius: 4px; cursor: pointer; padding: 4px 11px;
  font-family: var(--p-font-body); font-size: 11.5px; color: var(--p-muted);
  transition: border-color 0.12s, color 0.12s;
}
.dp-queue-mini:hover { border-color: var(--color-accent, var(--p-accent)); color: var(--color-ink, var(--p-ink, #222)); }
.dp-queue-mini[disabled] { opacity: 0.4; cursor: default; }
.dp-queue-mini[disabled]:hover { border-color: var(--color-line, var(--p-line, rgba(0,0,0,0.15))); color: var(--p-muted); }
.dp-queue-empty {
  font-family: var(--p-font-body); font-size: 13px; color: var(--p-muted);
  padding: 8px 0;
}
/* Effect-profile read — counts + band distributions, never per-client */
.dp-effect-body { display: flex; flex-direction: column; gap: 12px; }
.dp-effect-stat { font-family: var(--p-font-body); font-size: 13.5px; color: var(--color-ink, var(--p-ink, #222)); line-height: 1.5; }
.dp-effect-stat .dp-effect-n { font-weight: 600; }
.dp-effect-dist { font-family: var(--p-font-body); font-size: 13px; color: var(--p-muted); line-height: 1.55; }
.dp-effect-dist .sep { opacity: 0.4; padding: 0 6px; }
.dp-effect-foot { font-family: var(--p-font-body); font-size: 11.5px; color: var(--p-muted); margin-top: 4px; }
/* The log — the merged dated record beneath the lines */
.dp-log { margin-top: 26px; }
.dp-log-title {
  font-family: var(--p-font-display); font-size: 15.5px;
  color: var(--color-ink, var(--p-ink, #222)); margin-bottom: 10px;
}
.dp-log-rows { display: grid; grid-template-columns: 52px 1fr; gap: 7px 16px; }
.dp-log-when {
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
  opacity: 0.75; white-space: nowrap;
}
.dp-log-entry {
  font-family: var(--p-font-body); font-size: 13px; color: var(--p-muted);
  line-height: 1.5; min-width: 0;
}
.dp-log-entry .dp-log-own {
  font-style: italic; color: var(--color-ink, var(--p-ink, #222)); opacity: 0.85;
}
.dp-log-empty {
  font-family: var(--p-font-body); font-size: 13px; color: var(--p-muted);
  font-style: italic;
}
.dp-log-foot {
  font-family: var(--p-font-body); font-size: 11px; color: var(--p-muted);
  opacity: 0.6; margin-top: 12px;
}
/* Drill shelf + rehearsal — scaffold-only Library drill cards; self-rated, never graded */
.dp-drill-shelf { display: flex; flex-direction: column; gap: 2px; }
.dp-drill-group { font-family: var(--p-font-body); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--p-muted); margin: 14px 0 4px; }
.dp-drill-group:first-child { margin-top: 2px; }
.dp-drill-row { padding: 11px 0; border-bottom: 1px solid var(--p-line, rgba(0,0,0,0.07)); }
.dp-drill-skill {
  font-family: var(--p-font-body); font-size: 13.5px; font-weight: 600;
  color: var(--color-ink, var(--p-ink, #222)); line-height: 1.45;
}
.dp-drill-title {
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
  line-height: 1.5; margin-top: 2px;
}
.dp-drill-actions { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.dp-drill-link {
  font-family: var(--p-font-body); font-size: 11.5px; color: var(--color-accent, var(--p-accent));
  text-decoration: none;
}
.dp-drill-link:hover { text-decoration: underline; }
.dp-drill-count { font-family: var(--p-font-body); font-size: 11px; color: var(--p-muted); font-style: italic; }
/* Carried-across: on-note trace chips (Workshop content tokens) + DP focus banner (DP --p-* tokens) */
.xform-carried { margin: 0 0 12px; font-size: 0.85em; line-height: 1.7; }
.xform-carried-label { color: var(--color-muted); font-style: italic; margin-right: 8px; }
.xform-carried-chip { display: inline-block; margin: 2px 6px 2px 0; padding: 3px 10px; border: 1px solid var(--color-line); border-radius: 12px; color: var(--color-accent); text-decoration: none; }
.xform-carried-chip:hover { background: var(--color-accent-soft, rgba(0,0,0,0.04)); }
.dp-focus-banner { margin: 4px 0 18px; padding: 14px 16px; border: 1px solid var(--p-line, rgba(0,0,0,0.1)); border-radius: 12px; background: var(--p-accent-soft, rgba(0,0,0,0.03)); }
.dp-focus-kicker { font-family: var(--p-font-body); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--p-muted); }
.dp-focus-marker { font-size: 1.05em; margin: 4px 0 12px; color: var(--p-ink); line-height: 1.5; }
.dp-focus-drills-label { font-family: var(--p-font-body); font-size: 0.85em; color: var(--p-muted); margin-bottom: 7px; }
.dp-focus-drills { display: flex; flex-wrap: wrap; gap: 8px; }
.dp-focus-drill { padding: 4px 11px; border: 1px solid var(--p-line, rgba(0,0,0,0.12)); border-radius: 14px; text-decoration: none; color: var(--color-accent, var(--p-accent)); font-size: 0.85em; }
.dp-focus-drill:hover { text-decoration: underline; }
.dp-focus-hint { font-family: var(--p-font-body); font-size: 0.78em; color: var(--p-muted); margin-top: 10px; font-style: italic; }
.dp-queue-row.dp-q-focus { outline: 2px solid var(--p-accent, #8a7a52); outline-offset: 2px; border-radius: 8px; }
.dp-rehearse-form { margin-top: 11px; display: none; }
.dp-rehearse-form.open { display: block; }
.dp-rehearse-steps {
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
  line-height: 1.6; margin: 0 0 10px; padding-left: 18px;
}
.dp-rehearse-steps li { margin-bottom: 2px; }
.dp-rehearse-label {
  font-family: var(--p-font-body); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--p-muted); margin: 10px 0 5px;
}
.dp-diff-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.dp-diff-choice {
  background: transparent; border: 1px solid var(--color-line, var(--p-line, rgba(0,0,0,0.15)));
  border-radius: 4px; cursor: pointer; padding: 5px 12px;
  font-family: var(--p-font-body); font-size: 11.5px; color: var(--p-muted);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.dp-diff-choice:hover { border-color: var(--color-accent, var(--p-accent)); color: var(--color-ink, var(--p-ink, #222)); }
.dp-diff-choice.sel {
  border-color: var(--color-accent, var(--p-accent));
  background: var(--color-oat, rgba(201,165,74,0.12));
  color: var(--color-ink, var(--p-ink, #222));
}
.dp-rehearse-form textarea {
  width: 100%; box-sizing: border-box; margin-top: 4px; resize: vertical;
  font-family: var(--p-font-body); font-size: 13px; line-height: 1.5;
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--color-line, var(--p-line, rgba(0,0,0,0.15)));
  background: var(--color-bg, #fff); color: var(--color-ink, var(--p-ink, #222));
}
.dp-rehearse-form textarea:focus { outline: none; border-color: var(--color-accent, var(--p-accent)); }
.dp-rehearse-link-row {
  display: flex; align-items: center; gap: 7px; margin-top: 9px;
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted);
}
.dp-rehearse-controls { display: flex; gap: 12px; margin-top: 11px; align-items: center; }
.dp-rehearse-log { margin-top: 12px; }
.dp-rehearse-log-row {
  padding: 8px 0; border-top: 1px solid var(--p-line, rgba(0,0,0,0.06));
  font-family: var(--p-font-body); font-size: 12px; color: var(--p-muted); line-height: 1.5;
}
.dp-rehearse-log-row .dp-rl-diff { color: var(--color-ink, var(--p-ink, #222)); font-weight: 600; }
.dp-rehearse-log-row .dp-rl-note { font-style: italic; }
.empty-footnote {
  font-family: var(--p-font-display);
  font-style: italic; font-size: 12.5px;
  color: var(--p-faint); line-height: 1.6;
  margin-top: 28px;
  max-width: 360px;
  border-top: 1px solid var(--p-panel-edge);
  padding-top: 20px;
}

/* Surface placeholder titles use display type */
.surface-placeholder .ph-title { font-family: var(--p-font-display); }

/* ─── Phase 2: sidebar structure (practitioner / Case Board / Caseload / mode) ─── */

.sidebar {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

/* Practitioner identity card at top */
.sidebar-practitioner {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--p-panel-alt-edge);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.sidebar-practitioner:hover { background: var(--p-panel-alt-hover); }
.sidebar-practitioner .avatar {
  width: 30px; height: 30px;
  background: var(--p-accent-lift);
  color: var(--p-panel-alt);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--p-font-display);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.sidebar-practitioner .who {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.sidebar-practitioner .name {
  font-size: 12.5px; font-weight: 500;
  color: var(--p-panel-alt-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-practitioner .role {
  font-size: 10.5px;
  color: var(--p-panel-alt-mute);
  letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Top-level nav rows (Case Board) */
.nav-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 10px;
  margin: 6px 6px 0;
  font-size: 13px; font-weight: 500;
  color: var(--p-panel-alt-ink);
  cursor: pointer;
  border-left: 2px solid transparent;
  border-radius: 0;
  transition: background 0.1s;
}
.nav-row:hover { background: var(--p-panel-alt-hover); }
.nav-row .nav-row-icon {
  width: 14px; height: 14px;
  color: var(--p-panel-alt-mute);
  flex-shrink: 0;
}
.nav-row .nav-row-meta {
  font-family: var(--p-font-body);
  font-size: 10px;
  color: var(--p-panel-alt-mute);
  letter-spacing: 0.04em;
}

/* Caseload divider */
.sidebar-divider {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 6px;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--p-panel-alt-mute);
  font-weight: 500;
}
.sidebar-divider .line {
  flex: 1; height: 1px; background: var(--p-panel-alt-edge);
}
.sidebar-divider .count {
  font-family: var(--p-font-body);
  font-size: 10px;
  color: var(--p-panel-alt-faint);
  letter-spacing: 0.04em;
  text-transform: none;
}

/* Day-group label inside the client list */
.day-group { margin-bottom: 4px; }
.day-group-label {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px 4px;
  font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--p-panel-alt-faint);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.day-group-label:hover { color: var(--color-ink); }
.day-group-chev {
  font-family: var(--p-font-body);
  font-size: 16px;
  width: 14px;
  display: inline-block;
  letter-spacing: 0;
}
.day-group-count {
  font-family: var(--p-font-body);
  font-size: 9px;
  opacity: 0.6;
  letter-spacing: 0.04em;
  color: var(--p-panel-alt-ink);
}

/* Client row — replaces .client-item structurally */
.client-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  margin: 1px 6px;
  border-radius: 4px;
  color: var(--p-panel-alt-ink);
  cursor: pointer;
  border-left: 2px solid transparent;
  opacity: 0.92;
  transition: background 0.1s, opacity 0.1s, border-left-color 0.15s;
}
.client-row:hover { background: var(--p-panel-alt-hover); opacity: 1; }
.client-row.active {
  opacity: 1;
  background: var(--p-panel-alt-hover);
  border-left-color: var(--p-accent-lift);
  padding-left: 10px;
}
.client-row .client-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--p-font-display);
  font-style: italic; font-weight: 500;
  font-size: 12px; letter-spacing: 0;
  color: var(--p-panel-alt-ink);
  background: var(--p-panel-alt-edge);
  border: 1px solid var(--p-panel-alt-edge);
  text-transform: uppercase;
}
.client-row.active .client-avatar {
  background: rgba(217, 184, 113, 0.15);
  border-color: var(--p-accent-lift);
  color: var(--p-accent-lift);
}
.client-row .client-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.client-row .client-name-row {
  display: flex; align-items: baseline; gap: 6px;
  min-width: 0;
}
.client-row .client-name {
  font-family: var(--p-font-display);
  font-weight: 500; font-size: 14px; line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 1; min-width: 0;
}
.client-row.active .client-name { font-weight: 500; }
.client-row .client-last {
  font-family: var(--p-font-body);
  font-size: 10.5px; line-height: 1.3;
  color: var(--p-panel-alt-faint);
  letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.client-row .client-sessions {
  font-family: var(--p-font-body);
  font-size: 10px;
  color: var(--p-panel-alt-ink);
  opacity: 0.55;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.client-row.active .client-sessions { opacity: 0.8; color: var(--p-accent-lift); }
.client-row .client-missed {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--p-font-body);
  font-size: 10.5px; line-height: 1.3;
  color: #d49328;
  letter-spacing: 0.02em;
  margin-top: 1px;
}
.client-row .client-missed-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}
/* "Ready to look at" — a completed transcription/transformation waiting on this
   client. Same name-row idiom as the session count; accent pill so it reads as
   new. Cleared when the client is opened. */
.client-row .client-ready {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  background: var(--p-accent, var(--color-accent, #c0894a)); color: #fff;
  font-family: var(--p-font-body);
  font-size: 10px; font-weight: 600; line-height: 1;
  flex-shrink: 0;
  animation: clientReadyIn 240ms ease-out;
}
@keyframes clientReadyIn {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.client-row .dot { display: none; } /* legacy — replaced by .client-avatar */

/* Per-client expansion: surface tabs + session notes nested */
.client-detail {
  padding-left: 28px; padding-top: 6px; padding-bottom: 10px;
}
.sub-nav-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--p-panel-alt-ink);
  opacity: 0.78;
  cursor: pointer;
  transition: color 0.12s;
}
.sub-nav-row:hover { opacity: 1; }
.sub-nav-row.active {
  color: var(--p-accent-lift);
  opacity: 1;
  font-weight: 500;
  background: rgba(239, 234, 224, 0.05);
}
.sub-nav-row .meta {
  margin-left: auto;
  font-family: var(--p-font-body);
  font-size: 9px;
  color: var(--p-panel-alt-mute);
  letter-spacing: 0.04em;
}

.client-detail .notes-label {
  padding: 12px 8px 6px;
  font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--p-panel-alt-faint);
  font-weight: 500;
}
.client-detail .session-note-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  font-size: 12px; color: var(--p-panel-alt-ink);
  opacity: 0.7;
}
.client-detail .session-note-row .meta {
  margin-left: auto;
  font-family: var(--p-font-body);
  font-size: 9px;
  color: var(--p-panel-alt-faint);
}

/* Records surfaces (session notes + process notes) */
.records-pane {
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
}
.records-empty {
  font-size: 13px;
  color: var(--p-muted, var(--p-panel-alt-mute));
  padding: 8px 0;
}
.record-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--p-panel-border, var(--p-panel-alt-edge));
}
.record-entry:last-child { border-bottom: none; }
.record-meta {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px; flex-wrap: wrap;
}
.record-date {
  font-family: var(--p-font-body);
  font-size: 11px;
  color: var(--p-panel-alt-mute);
  letter-spacing: 0.06em;
}
.record-badge {
  font-size: 9.5px;
  font-family: var(--p-font-body);
  padding: 1px 5px;
  background: rgba(239,234,224,0.07);
  color: var(--p-panel-alt-ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--p-panel-alt-edge);
}
.record-badge.locked {
  background: rgba(74, 107, 116, 0.15);
  color: var(--p-petrol, #4A6B74);
  border-color: rgba(74, 107, 116, 0.25);
}
.record-badge.pushed {
  background: rgba(180, 150, 90, 0.12);
  color: var(--p-accent, #B4965A);
  border-color: rgba(180, 150, 90, 0.25);
}
.record-preview {
  font-size: 13px;
  color: var(--p-ink, var(--p-panel-alt-ink));
  opacity: 0.72;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 5.5em;
  overflow: hidden;
}

/* Today's sessions button in sidebar */
.sidebar-today-btn {
  display: block; width: calc(100% - 24px);
  margin: 8px 12px 4px;
  padding: 7px 14px;
  background: none;
  border: 1px solid var(--color-line, rgba(201, 165, 74, 0.3));
  border-radius: 4px;
  color: var(--p-panel-alt-ink);
  font-family: var(--p-font-display);
  font-style: italic;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0;
  transition: background 0.12s, border-color 0.12s;
}
.sidebar-today-btn:hover {
  background: var(--p-panel-alt-hover);
  border-color: var(--p-accent-lift);
  color: var(--p-accent-lift);
}

/* Add-a-client row under the Caseload head — the Office record, opened from
   the rail so a new case can be added without leaving the Workshop. */
.rail-add-client {
  display: block; width: calc(100% - 24px);
  margin: 2px 12px 6px;
  padding: 5px 14px;
  background: none;
  border: 1px solid var(--color-line, rgba(201, 165, 74, 0.3));
  border-radius: 4px;
  color: var(--p-panel-alt-ink);
  font-family: var(--p-font-body);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.rail-add-client .rail-add-plus {
  font-size: 1.7em;
  line-height: 1;
  vertical-align: -0.08em;
}
.rail-add-client:hover {
  background: var(--p-panel-alt-hover);
  border-style: dashed;
  color: var(--p-accent-lift);
}

/* Mode footer at bottom of sidebar */
.sidebar-mode-footer {
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid var(--p-panel-alt-edge);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px;
  color: var(--p-panel-alt-mute);
}
.sidebar-mode-footer .mode-label {
  display: flex; align-items: center; gap: 6px;
}
.sidebar-mode-footer .mode-state {
  font-family: var(--p-font-body);
  font-size: 9.5px;
  color: var(--p-panel-alt-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sidebar-privacy-line {
  padding: 4px 18px 10px;
  font-size: 9.5px;
  color: var(--p-panel-alt-faint);
  letter-spacing: 0.03em;
}
/* The desktop app's update-status pill is fixed bottom-left over this line
   (combined_dashboard._UPDATE_FOOTER_SCRIPT flags <html> when it shows) —
   pad the privacy line clear of it so neither text is covered. */
html.peri-update-footer-on .sidebar-privacy-line {
  padding-bottom: 38px;
}

/* Hide the old .surface-tabs at top of main pane (Phase 2 moves them into sidebar). */
.surface-tabs.legacy-top { display: none; }

/* Tighten the client-list region so the mode footer can pin to bottom */
.client-list { flex: 1; overflow-y: auto; padding: 4px 0 12px; }

/* ─── Phase 7: per-client memory panel ────────────────────────────── */

.memory-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--p-panel-alt-edge);
}
.memory-label {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 4px;
  font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--p-panel-alt-faint);
  font-weight: 500;
}
.memory-label .count {
  font-family: var(--p-font-body);
  font-size: 9.5px;
  color: var(--p-panel-alt-faint);
  letter-spacing: 0.04em;
  text-transform: none;
}
.memory-row {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--p-panel-alt-ink);
  opacity: 0.85;
  display: flex; gap: 6px;
  align-items: flex-start;
  border-left: 2px solid transparent;
  transition: background 0.1s;
}
.memory-row:hover { background: var(--p-panel-alt-hover); }
.memory-row .kind {
  flex-shrink: 0;
  font-family: var(--p-font-body);
  font-size: 9px;
  color: var(--p-accent-lift);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 2px;
  width: 50px;
}
.memory-row .body {
  flex: 1;
  line-height: 1.45;
  word-break: break-word;
}
.memory-row .del {
  flex-shrink: 0;
  background: none; border: none;
  color: var(--p-panel-alt-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  opacity: 0; transition: opacity 0.1s;
  align-self: flex-start;
}
.memory-row:hover .del { opacity: 1; }
.memory-row .del:hover { color: var(--p-unsaved); }
.memory-empty {
  padding: 4px 8px 8px;
  font-size: 11.5px;
  color: var(--p-panel-alt-faint);
  font-style: italic;
}
.memory-action-row {
  padding: 6px 8px;
}
.memory-consolidate-btn {
  background: rgba(239, 234, 224, 0.05);
  border: 1px solid var(--p-panel-alt-edge);
  color: var(--p-panel-alt-ink);
  font-family: var(--p-font-body);
  font-size: 11.5px;
  padding: 5px 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: flex; align-items: center; gap: 6px;
}
.memory-consolidate-btn:hover { background: var(--p-panel-alt-hover); color: var(--p-accent-lift); }
.memory-consolidate-btn:disabled { opacity: 0.5; cursor: default; }

/* Memory consolidation modal — centred overlay over the Workshop.
   .ac-overlay (add-a-client) shares the shell but keeps its own class so
   closeMemoryModal() never removes it. */
.mem-overlay, .ac-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 31, 28, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.mem-modal {
  background: var(--p-panel);
  color: var(--p-ink);
  width: 640px; max-width: 100%;
  max-height: 80vh;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(31,31,28,0.25);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mem-modal-header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--p-panel-edge);
}
.mem-modal-header .title {
  font-family: var(--p-font-display); font-weight: 500;
  font-size: 22px; color: var(--p-ink); letter-spacing: 0.005em;
}
.mem-modal-header .sub {
  font-size: 12.5px; color: var(--p-muted); margin-top: 4px;
}
.mem-modal-body {
  overflow-y: auto;
  padding: 12px 22px;
  flex: 1;
}
.mem-proposal {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--p-panel-edge);
}
.mem-proposal:last-child { border-bottom: none; }
.mem-proposal input[type=checkbox] {
  margin-top: 4px;
  accent-color: var(--p-accent);
  width: 14px; height: 14px;
  flex-shrink: 0;
}
.mem-proposal .pkind {
  font-family: var(--p-font-body);
  font-size: 10px;
  color: var(--p-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 60px;
  flex-shrink: 0;
  padding-top: 4px;
}
.mem-proposal textarea {
  flex: 1;
  background: var(--p-page);
  border: 1px solid var(--p-panel-edge);
  padding: 8px 10px;
  font-family: var(--p-font-body);
  font-size: 13px; line-height: 1.5;
  color: var(--p-ink);
  outline: none;
  resize: vertical;
  min-height: 60px;
}
.mem-proposal textarea:focus { border-color: var(--p-accent); }
.mem-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--p-panel-edge);
  display: flex; justify-content: flex-end; gap: 10px;
}
.mem-empty-msg {
  padding: 24px 0;
  text-align: center;
  font-style: italic;
  color: var(--p-muted);
  font-family: var(--p-font-display);
  font-size: 16px;
}

/* Add-a-client form fields */
.ac-field { margin: 10px 0 0; }
.ac-field label {
  display: block; font-size: 11px; letter-spacing: 0.04em;
  color: var(--p-muted); margin-bottom: 4px;
}
.ac-field input {
  width: 100%; box-sizing: border-box;
  background: var(--p-page);
  border: 1px solid var(--p-panel-edge); border-radius: 4px;
  padding: 8px 10px;
  color: var(--p-ink); font-family: var(--p-font-body); font-size: 13px;
  outline: none;
}
.ac-field input:focus { border-color: var(--p-accent); }
.ac-hint { font-size: 12px; color: var(--p-muted); margin-top: 12px; line-height: 1.45; }
.ac-err { color: #a33d3d; font-size: 12.5px; margin-top: 10px; display: none; }

/* ─── Phase 8: within-thread compaction marker ───────────────────── */

.compact-marker {
  margin: 0 auto 18px;
  max-width: 800px;
  background: var(--p-panel);
  border: 1px solid var(--p-panel-edge);
  border-left: 3px solid var(--p-accent-lift);
  padding: 14px 18px;
  font-family: var(--p-font-body);
  font-size: 13px;
  color: var(--p-ink-soft);
  line-height: 1.55;
}
.compact-marker .label {
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: var(--p-font-body);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-muted);
  margin-bottom: 6px;
}
.compact-marker .toggle {
  background: none; border: none;
  color: var(--p-accent);
  font-family: var(--p-font-body);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  text-transform: lowercase;
}
.compact-marker .toggle:hover { text-decoration: underline; }
.compact-summary {
  white-space: pre-wrap;
  font-family: var(--p-font-body);
  color: var(--p-ink-soft);
}
.compact-hidden-msgs {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--p-panel-edge);
}

/* ═══════════════════════════════════════════════════════════════════════
   TWO-COLUMN, TODAY-LED re-architecture (ported from drafts/workshop-shell.html).
   Mapped onto the existing --color-* / --p-* palette so the picker drives it.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── rail: Today section ───────────────────────────────────────────────── */
.rail-today { padding: 6px 12px 2px; }
.rail-today-head, .rail-caseload-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 8px;
  font-size: 0.62em; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--p-panel-alt-mute, var(--color-muted));
}
.rail-today-head .ln, .rail-caseload-head .ln { flex: 1; height: 1px; background: var(--p-panel-alt-edge, var(--color-line)); }
.rail-today-head .ct, .rail-caseload-head .ct { font-family: var(--p-font-body); font-size: 0.95em; }
#today-list { display: flex; flex-direction: column; gap: 1px; }
.today-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  transition: background 0.12s; position: relative;
}
.today-item:hover { background: var(--p-panel-alt-hover, var(--color-oat)); }
.today-item.active { background: var(--p-panel-alt-hover, var(--color-oat)); box-shadow: inset 2px 0 0 var(--p-accent-lift, var(--color-accent)); }
.today-item .time { font-family: var(--p-font-body); font-size: 0.72em; color: var(--p-panel-alt-mute, var(--color-muted)); width: 42px; flex-shrink: 0; }
.today-item .tname {
  font-family: var(--p-font-display, var(--font-display)); font-size: 0.95em; font-weight: 500;
  color: var(--p-panel-alt-ink, var(--color-ink)); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.today-item .dotstate { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.today-item .dotstate.todo { background: var(--p-accent-lift, var(--color-accent)); box-shadow: 0 0 0 3px var(--color-oat); }
.today-item .dotstate.done { background: var(--color-sage, #6E9079); }
.today-item .dotstate.soon { background: transparent; border: 1.5px solid var(--p-panel-alt-mute, var(--color-muted)); }
.rail-today-empty { padding: 4px 10px 8px; font-size: 0.74em; font-style: italic; color: var(--p-panel-alt-mute, var(--color-muted)); }

/* caseload jump-search */
.cl-search {
  margin: 4px 12px 8px; display: flex; align-items: center; gap: 8px;
  background: var(--p-panel-alt-hover, var(--color-oat));
  border: 1px solid var(--p-panel-alt-edge, var(--color-line)); border-radius: 7px; padding: 6px 11px;
}
.cl-search input { flex: 1; background: none; border: 0; outline: 0; font: inherit; font-size: 0.78em; color: var(--color-ink); }
.cl-search input::placeholder { color: var(--p-panel-alt-mute, var(--color-muted)); }
.cl-search svg { opacity: 0.5; flex-shrink: 0; }

/* ── canvas: shared scroller + headings ────────────────────────────────── */
.canvas-view { flex: 1; overflow-y: auto; }
.canvas-inner { width: 100%; max-width: 880px; margin: 0 auto; padding: 38px 48px 120px; }
/* The case-page header (a canvas-inner) sits above the active facet surface in the
   same flex column — it must hold its height so the surface below takes the rest. */
#case-page-head { flex-shrink: 0; max-width: none; margin: 0; padding-left: 36px; padding-right: 36px; }
.canvas-kicker { font-size: 0.7em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-accent); margin-bottom: 10px; }
.canvas-h1 { font-family: var(--p-font-display, var(--font-display)); font-size: 2.0em; font-weight: 500; letter-spacing: 0.005em; line-height: 1.1; color: var(--color-ink); }
.canvas-sub { font-size: 0.85em; color: var(--color-muted); margin-top: 8px; letter-spacing: 0.02em; }
.canvas-back { font-size: 0.8em; color: var(--color-accent); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 18px; background: none; border: 0; padding: 0; font-family: inherit; }
.canvas-back:hover { text-decoration: underline; }

/* ── Today board (default canvas view) ─────────────────────────────────── */
#today-board { flex: 1; overflow-y: auto; }
.today-board-list { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; }
.sess-card {
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 13px;
  box-shadow: var(--p-shadow, 0 14px 34px -18px rgba(33,57,46,.4)); padding: 18px 22px;
  display: flex; align-items: center; gap: 18px; cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.3s; position: relative; overflow: hidden;
}
.sess-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--color-accent); opacity: 0.8; }
.sess-card:hover { transform: translateY(-2px); box-shadow: var(--p-shadow-lift, 0 24px 54px -22px rgba(33,57,46,.5)); }
.sess-card .sess-time { font-family: var(--p-font-body); font-size: 0.82em; color: var(--color-muted); width: 60px; flex-shrink: 0; }
.sess-card .sess-name { font-family: var(--p-font-display, var(--font-display)); font-size: 1.35em; font-weight: 600; color: var(--color-ink); min-width: 150px; flex-shrink: 0; white-space: nowrap; }
.sess-card .sess-body { flex: 1; min-width: 0; }
.sess-card .sess-status { font-size: 0.82em; color: var(--color-ink-soft); display: inline-flex; align-items: center; gap: 7px; }
.sess-card .sess-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.sess-card .sess-status.todo::before { background: var(--color-accent); box-shadow: 0 0 0 3px var(--color-oat); }
.sess-card .sess-status.done::before { background: var(--color-sage, #6E9079); }
.sess-card .sess-status.soon::before { background: transparent; border: 1.5px solid var(--color-muted); }
.sess-card .sess-go { font-size: 0.78em; color: var(--color-accent); letter-spacing: 0.02em; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sess-card .sess-go .arr { transition: transform 0.2s; }
.sess-card:hover .sess-go .arr { transform: translateX(3px); }
.today-board-empty { margin-top: 28px; padding: 28px 22px; border: 1px solid var(--color-line); border-radius: 13px; background: var(--color-surface); font-family: var(--p-font-display, var(--font-display)); font-size: 1.05em; color: var(--color-muted); font-style: italic; }
/* Home Today strip — compact context atop the landing general chat. Lives in the
   chat column; shown only when no client is open (the case header replaces it). */
.home-today { flex-shrink: 0; padding: 16px 22px 12px; border-bottom: 1px solid var(--p-panel-edge, var(--color-line)); }
.home-today-row { display: flex; align-items: baseline; gap: 12px; }
.home-today-kicker { font-size: 0.62em; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-muted); }
.home-today-date { font-family: var(--p-font-display, var(--font-display)); font-size: 1.05em; color: var(--color-ink); }
.home-today-sessions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.home-today-sessions:empty { display: none; }
.home-today-empty { font-size: 0.82em; color: var(--color-muted); font-style: italic; }
/* Home-only general-chat thread switcher — a collapsible bar above the composer. */
.home-threads { flex-shrink: 0; border-top: 1px solid var(--p-panel-edge, var(--color-line)); }
.home-threads-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; cursor: pointer; padding: 8px 22px; font-family: var(--p-font-body); font-size: 0.72em; letter-spacing: 0.09em; text-transform: uppercase; color: var(--color-muted); }
.home-threads-toggle:hover { color: var(--color-ink); }
.home-threads-toggle .htt-chev { font-size: 0.85em; line-height: 1; }
.home-threads-toggle .htt-count { opacity: 0.7; font-variant-numeric: tabular-nums; }
.home-threads-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.home-threads-new { text-transform: none; letter-spacing: 0; font-size: 1.15em; color: var(--color-accent); padding: 1px 7px; border-radius: 6px; }
.home-threads-new:hover { background: rgba(35, 24, 10, 0.05); }
.home-threads-clear { text-transform: none; letter-spacing: 0; font-size: 1em; color: var(--color-muted); padding: 1px 7px; border-radius: 6px; }
.home-threads-clear:hover { background: rgba(35, 24, 10, 0.05); color: var(--color-danger, #B4452F); }
.home-threads-list { max-height: 230px; overflow-y: auto; padding: 0 14px 10px; }
.home-sess-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--color-line); border-radius: 999px; background: transparent; cursor: pointer; font: inherit; font-size: 0.82em; color: var(--color-ink); transition: border-color .2s, background .2s; }
.home-sess-chip:hover { border-color: var(--color-accent); background: rgba(0,0,0,0.015); }
.home-sess-chip .hsc-time { color: var(--color-muted); }
.home-sess-chip .hsc-name { font-weight: 500; }
.home-sess-chip .hsc-state { width: 7px; height: 7px; border-radius: 50%; background: var(--color-accent); flex-shrink: 0; }
.home-sess-chip .hsc-state.done { background: var(--color-sage, #6E9079); }
.home-sess-chip .hsc-state.soon { background: transparent; border: 1.5px solid var(--color-muted); }
/* On the clientless home chat, the client-only compose tools have nothing to act
   on — hide them so the general thread reads as a plain "type and send" surface. */
#surface-chat.home-chat-mode .tool-client { display: none; }

/* ── case-page (per-client canvas) ─────────────────────────────────────── */
.case-page { flex: 1; overflow-y: auto; }
.case-head { display: flex; align-items: flex-end; gap: 14px; border-bottom: 1px solid var(--color-line); padding-bottom: 14px; margin-bottom: 8px; }
.case-ini {
  width: 44px; height: 44px; border-radius: 50%; background: var(--color-oat);
  border: 1px solid var(--color-line); display: flex; align-items: center; justify-content: center;
  font-family: var(--p-font-display, var(--font-display)); font-size: 1.05em; font-weight: 600;
  color: var(--color-accent); letter-spacing: 0.04em; flex-shrink: 0;
}
.case-id h1 { font-family: var(--p-font-display, var(--font-display)); font-size: 1.35em; font-weight: 600; letter-spacing: 0.02em; line-height: 1; color: var(--color-ink); }
.case-id .case-meta { font-size: 0.78em; color: var(--color-muted); margin-top: 6px; font-family: var(--p-font-body); }
.case-office-link { display: inline-block; margin-top: 6px; font-size: 0.78em; font-weight: 500; color: var(--color-accent); text-decoration: none; white-space: nowrap; font-family: var(--p-font-body); }
.case-office-link:hover { text-decoration: underline; }
.facets { display: flex; gap: 4px; margin-left: auto; align-self: center; background: var(--color-oat); border-radius: 10px; padding: 5px; width: fit-content; }
.facet { font: inherit; font-size: 0.82em; color: var(--color-ink-soft); background: transparent; border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer; transition: 0.15s; display: inline-flex; gap: 8px; align-items: center; }
.facet:hover { color: var(--color-ink); }
.facet.sel { background: var(--color-surface); color: var(--color-ink); box-shadow: 0 1px 5px rgba(0,0,0,0.13); }
.facet .gl { font-size: 1em; opacity: 0.65; }
.facet.sel .gl { opacity: 1; }
/* The facet panes host the EXISTING surfaces, so they fill the canvas. */
.case-facets-host { flex: 1; display: flex; flex-direction: column; overflow: hidden; margin-top: 18px; }

/* sessions facet rows */
/* The sessions facet's content can exceed the surface — it must scroll
   (the chat scrolls its messages internally; formulation scrolls its doc). */
#surface-case-sessions { overflow-y: auto; }
.case-sessions-list { display: flex; flex-direction: column; gap: 2px; }
.case-sess-row { display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 12px 16px; border-radius: 10px; cursor: pointer; transition: 0.14s; border: 1px solid transparent; }
.case-sess-row:hover { background: var(--color-surface); border-color: var(--color-line); }
.case-sess-line { display: flex; align-items: center; gap: 16px; }
.case-sess-row .d { font-family: var(--p-font-body); font-size: 0.78em; color: var(--color-muted); width: 110px; flex-shrink: 0; }
.case-sess-row .t { font-family: var(--p-font-display, var(--font-display)); font-size: 0.95em; color: var(--color-ink); flex: 1; }
.case-sess-row .s { font-size: 0.72em; color: var(--color-sage, #6E9079); letter-spacing: 0.03em; }
/* Cancelled / late-cancel / no-show sessions stay listed, struck through. */
.case-sess-row.is-off .d,
.case-sess-row.is-off .t { text-decoration: line-through; color: var(--color-muted); }
.case-sess-row.is-off { opacity: 0.8; }
/* Second line: documented marker + first-line preview + source tag (or a gentle
   "no note yet" for past sessions). Indented to sit under the session type. */
.case-sess-note { display: flex; align-items: baseline; gap: 8px; padding-left: 126px; }
.csn-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; transform: translateY(1px); }
.csn-dot.has { background: var(--color-sage, #6E9079); }
.csn-dot.none { background: transparent; border: 1px solid var(--color-amber, #B8893A); }
.csn-preview { font-size: 0.8em; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.csn-src { font-size: 0.64em; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-muted); opacity: 0.65; flex-shrink: 0; }
.csn-empty { font-size: 0.78em; color: var(--color-amber, #B8893A); font-style: italic; opacity: 0.85; }
.csn-xf { font-size: 0.64em; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-accent); opacity: 0.85; flex-shrink: 0; }
.case-sess-empty-guide { font-size: 0.85em; color: var(--color-muted); line-height: 1.55; padding: 4px 0 8px; }
.case-sess-empty-guide a { color: var(--color-accent); text-decoration: none; }
.case-sess-empty-guide a:hover { text-decoration: underline; }
.case-sess-group-head { font-size: 0.66em; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-muted); padding: 16px 6px 6px; }

/* ── chat facet: past-threads list (thin right-side column of the chat surface) ── */
/* The threads rail is part of the Workshop's fixed parchment/obsidian paper,
   so it themes off the --col-* ramp (not the --p-* palette) — a slightly darker
   cream than the canvas in every palette, flipping to a recessed tone in dark. */
.chat-threads { flex-shrink: 0; width: var(--threads-w, 200px); background: var(--col-threads, var(--col-2)); border-left: 1px solid var(--p-panel-edge); display: flex; flex-direction: column; overflow: hidden; }
.threads-resizer { width: 8px; flex-shrink: 0; cursor: col-resize; background: transparent; }
.threads-resizer:hover, .threads-resizer.dragging { background: var(--color-accent); opacity: 0.35; }
.chat-threads-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.chat-threads-label { font-size: 0.64em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); flex: 1; }
.chat-threads-new { font: inherit; font-size: 0.72em; color: var(--color-accent); background: none; border: 0; cursor: pointer; padding: 0; }
.chat-threads-new:hover { text-decoration: underline; }
.chat-threads-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 4px 8px; }
.chat-threads-list .middle-thread-item { padding-left: 16px; padding-right: 16px; }
.chat-threads-empty { font-size: 0.74em; color: var(--color-muted); font-style: italic; padding: 4px 16px 8px; }

/* ── notes & forms facet ───────────────────────────────────────────────── */
/* Rows reuse the existing .standing-note-item / .middle-item look (oat card,
   chevron, hover + active state) so the two lists read like the rest of the app
   and the existing openers' active-highlight selectors keep working. */
#surface-notes-facet { overflow-y: auto; }
.notes-facet { display: flex; flex-direction: column; gap: 34px; }
.notes-facet-section { display: flex; flex-direction: column; }
.notes-facet-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--color-line); padding-bottom: 8px; margin-bottom: 6px; }
.notes-facet-title { font-family: var(--p-font-display, var(--font-display)); font-size: 1.05em; font-weight: 600; color: var(--color-ink); flex: 1; }
.notes-facet-new { font: inherit; font-size: 0.78em; color: var(--color-accent); background: none; border: 0; cursor: pointer; padding: 0; }
.notes-facet-new:hover { text-decoration: underline; }
/* The reused rows carry their own margin; reset the list's outer padding so the
   first/last rows sit flush under the section heading. */
.notes-facet-list { display: flex; flex-direction: column; }
.notes-facet-list .standing-note-item,
.notes-facet-list .middle-item { margin-left: 0; margin-right: 0; }
.notes-facet-empty { font-size: 0.82em; color: var(--color-muted); font-style: italic; padding: 8px 2px; }
.case-chat-ctx {
  font-size: 0.71em; color: var(--p-panel-alt-faint); line-height: 1.4;
}
.case-chat-ctx b { color: var(--color-accent); font-weight: 500; }
.case-pane-pad { padding: 0 0 24px; }

/* ── transform: shaped developing state (ported from transform redesign) ── */
.xform-dev { margin: 12px 0 6px; padding: 20px 20px 16px; background: color-mix(in srgb, var(--color-accent) 5%, transparent); border: 1px solid color-mix(in srgb, var(--color-accent) 28%, transparent); border-left: 3px solid var(--color-accent); border-radius: 8px; }
.xform-dev-kick { display: flex; align-items: center; gap: 8px; font-size: 0.7em; letter-spacing: 0.15em; text-transform: uppercase; color: var(--color-accent); margin-bottom: 8px; }
.xform-dev-kick::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); animation: loader-breathe 1.4s ease-in-out infinite; }
.xform-dev-carry { font-size: 0.8em; color: var(--color-ink-soft); line-height: 1.5; margin-bottom: 14px; }
.xform-dev-line { font-family: var(--p-font-display, var(--font-display)); font-size: 1.3em; font-weight: 500; min-height: 30px; color: var(--color-ink); line-height: 1.25; }
.xform-dev-line .cur { display: inline-block; width: 2px; height: 0.9em; background: var(--color-accent); margin-left: 3px; vertical-align: -1px; animation: xform-blink 1s steps(1) infinite; }
@keyframes xform-blink { 50% { opacity: 0; } }
.xform-dev-sub { font-size: 0.78em; color: var(--color-muted); margin-top: 9px; min-height: 18px; }
.xform-mer { margin: 22px 0 0; height: 4px; background: var(--color-line); border-radius: 2px; overflow: hidden; position: relative; }
.xform-mer::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: linear-gradient(90deg, var(--color-sage, #6E9079), var(--color-accent)); border-radius: 2px; transition: width 0.5s cubic-bezier(.4,0,.2,1); }
.xform-dev-meta { display: flex; justify-content: space-between; padding: 9px 0 0; font-size: 0.7em; color: var(--color-muted); font-family: var(--p-font-body); }
.xform-dev-away { margin-top: 18px; font-family: var(--p-font-display, var(--font-display)); font-size: 0.85em; color: var(--color-ink-soft); line-height: 1.5; }
.xform-dev-away b { color: var(--color-ink); font-weight: 600; }
/* De-identification receipt — the real counts once de-id has actually run.
   Empty until the server reports; collapses to nothing when empty. */
.xform-dev-deid:empty { display: none; }
.xform-dev-deid { margin-top: 10px; font-size: 0.74em; color: var(--color-sage, #6E9079); font-family: var(--p-font-body); line-height: 1.45; }
.xform-deid-note { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--color-line); font-size: 0.72em; color: var(--color-muted); font-family: var(--p-font-body); line-height: 1.45; }
/* Honest in-block transform failure — the reason stays readable in place. */
.xform-fail { padding: 20px 8px 18px; }
.xform-fail-head { font-family: var(--p-font-display, var(--font-display)); font-size: 1em; font-weight: 600; color: var(--color-ink); line-height: 1.4; }
.xform-fail-sub { margin-top: 7px; font-size: 0.74em; color: var(--color-muted); }

/* ── felt-sense capture before the render ─────────────────────────────── */
.xform-ct-ask { padding: 18px 10px 16px; }
.xform-ct-ask-line { font-family: var(--p-font-display, var(--font-display)); font-size: 0.92em; color: var(--color-ink); line-height: 1.5; max-width: 46em; }
.xform-ct-ask-input { display: block; width: 100%; max-width: 46em; margin-top: 10px; padding: 8px 10px;
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 8px;
  color: var(--color-ink); font-size: 0.86em; }
.xform-ct-ask-actions { margin-top: 9px; display: flex; gap: 10px; }
.xform-ct-ask-add, .xform-ct-ask-skip { font-size: 0.76em; padding: 5px 12px; border-radius: 7px; cursor: pointer; border: 1px solid var(--color-line); }
.xform-ct-ask-add { background: var(--color-accent); color: var(--color-surface); border-color: var(--color-accent); }
.xform-ct-ask-skip { background: transparent; color: var(--color-muted); }

/* ── toast (transform arrival announces itself) ────────────────────────── */
.toast-tray { position: fixed; right: 24px; bottom: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 12px; max-width: 330px; }
.toast {
  background: var(--color-surface); border: 1px solid var(--color-line); border-left: 4px solid var(--color-accent);
  border-radius: 12px; padding: 14px 16px; box-shadow: var(--p-shadow-lift, 0 24px 54px -22px rgba(0,0,0,.5));
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  transform: translateY(140%); opacity: 0;
  transition: transform 0.5s cubic-bezier(.2,.9,.3,1.2), opacity 0.4s;
}
.toast.in { transform: none; opacity: 1; }
.toast .seal { width: 28px; height: 28px; flex-shrink: 0; margin-top: 1px; }
.toast-title { font-family: var(--p-font-display, var(--font-display)); font-size: 1em; font-weight: 600; color: var(--color-ink); line-height: 1.25; }
.toast-sub { font-size: 0.72em; color: var(--color-muted); margin-top: 3px; font-family: var(--p-font-body); }
.toast-cta { font-size: 0.78em; color: var(--color-accent); margin-top: 8px; font-weight: 500; }
.toast-x { margin-left: auto; background: none; border: 0; color: var(--color-muted); cursor: pointer; font-size: 1.1em; line-height: 1; padding: 2px; }
.toast-x:hover { color: var(--color-ink); }

/* ── recording arm prompt (calendar-driven, one-tap, the consent act) ──── */
/* A prominent top-centre banner — more deliberate than a toast because the tap
 * IS the consent. Sits above everything; the clinician acts, the panel states
 * facts (operational register, never personified). */
#rec-arm { position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-160%);
  z-index: 9500; width: min(440px, calc(100vw - 32px));
  background: var(--color-surface); border: 1px solid var(--color-line); border-top: 4px solid var(--color-accent);
  border-radius: 12px; box-shadow: var(--p-shadow-lift, 0 24px 54px -22px rgba(0,0,0,.5));
  padding: 16px 18px; font-family: var(--p-font-body);
  transition: transform 0.45s cubic-bezier(.2,.9,.3,1.2), opacity 0.35s; opacity: 0; }
#rec-arm.in { transform: translateX(-50%) translateY(0); opacity: 1; }
#rec-arm .rec-arm-head { display: flex; align-items: baseline; gap: 8px; }
#rec-arm .rec-arm-title { font-family: var(--p-font-display, var(--font-display)); font-size: 1.02em; font-weight: 600; color: var(--color-ink); }
#rec-arm .rec-arm-when { font-size: 0.74em; color: var(--color-muted); margin-left: auto; }
#rec-arm .rec-arm-x { background: none; border: 0; color: var(--color-muted); cursor: pointer; font-size: 1.15em; line-height: 1; padding: 0 2px; }
#rec-arm .rec-arm-x:hover { color: var(--color-ink); }
#rec-arm .rec-arm-check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.82em; color: var(--color-ink); margin-top: 10px; line-height: 1.35; }
#rec-arm .rec-arm-check .rec-arm-icon { flex-shrink: 0; width: 1.1em; text-align: center; }
#rec-arm .rec-arm-check.ok .rec-arm-icon { color: var(--color-accent); }
#rec-arm .rec-arm-check.warn { color: var(--color-ink); }
#rec-arm .rec-arm-check.warn .rec-arm-icon { color: #c0392b; }
#rec-arm .rec-arm-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
#rec-arm .rec-arm-start { background: var(--color-accent); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 16px; font-weight: 600; cursor: pointer; font-family: var(--p-font-body); font-size: 0.9em; }
#rec-arm .rec-arm-start:disabled { opacity: 0.5; cursor: not-allowed; }
#rec-arm .rec-arm-consent { background: none; border: 1px solid var(--color-line); color: var(--color-ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-family: var(--p-font-body); font-size: 0.86em; }
#rec-arm .rec-arm-later { background: none; border: 0; color: var(--color-muted); cursor: pointer; font-size: 0.82em; margin-left: auto; }
#rec-arm .rec-arm-later:hover { color: var(--color-ink); }

/* ─── Record-a-session panel + own-work floating card ──────────────── */
/* Same chrome family as #rec-arm: fixed panels above the canvas. #rec-now is
 * the ad-hoc door (top-centre, like the auto-arm prompt); #own-rec-card holds
 * a live non-client recording (bottom-right, so it never collides with the
 * arm prompt and survives every canvas re-render — it lives on <body>). */
#rec-now, #own-rec-card { position: fixed; z-index: 9500; width: min(440px, calc(100vw - 32px));
  background: var(--color-surface); border: 1px solid var(--color-line); border-top: 4px solid var(--color-accent);
  border-radius: 12px; box-shadow: var(--p-shadow-lift, 0 24px 54px -22px rgba(0,0,0,.5));
  padding: 16px 18px; font-family: var(--p-font-body); opacity: 0;
  transition: transform 0.35s cubic-bezier(.2,.9,.3,1.2), opacity 0.3s; }
#rec-now { top: 18px; left: 50%; transform: translateX(-50%) translateY(-160%); }
#rec-now.in { transform: translateX(-50%) translateY(0); opacity: 1; }
#own-rec-card { right: 18px; bottom: 18px; transform: translateY(140%); }
#own-rec-card.in { transform: translateY(0); opacity: 1; }
#rec-now .rec-arm-head, #own-rec-card .rec-arm-head { display: flex; align-items: baseline; gap: 8px; }
#rec-now .rec-arm-title, #own-rec-card .rec-arm-title { font-family: var(--p-font-display, var(--font-display)); font-size: 1.02em; font-weight: 600; color: var(--color-ink); }
#rec-now .rec-arm-x, #own-rec-card .rec-arm-x { background: none; border: 0; color: var(--color-muted); cursor: pointer; font-size: 1.15em; line-height: 1; padding: 0 2px; margin-left: auto; }
#rec-now .rec-arm-x:hover, #own-rec-card .rec-arm-x:hover { color: var(--color-ink); }
.rec-now-kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.rec-now-kind { background: none; border: 1px solid var(--color-line); color: var(--color-ink);
  border-radius: 999px; padding: 5px 12px; font-size: 0.8em; cursor: pointer; font-family: var(--p-font-body); }
.rec-now-kind.sel { border-color: var(--color-accent); color: var(--color-accent); font-weight: 600; }
.rec-now-field { margin-top: 12px; }
.rec-now-field input { width: 100%; box-sizing: border-box; background: transparent;
  border: 1px solid var(--color-line); border-radius: 8px; padding: 8px 10px;
  color: var(--color-ink); font-family: var(--p-font-body); font-size: 0.9em; }
.rec-now-hint { font-size: 0.74em; color: var(--color-muted); margin-top: 8px; line-height: 1.4; }
.rec-now-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.rec-now-start { background: var(--color-accent); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 16px; font-weight: 600; cursor: pointer; font-family: var(--p-font-body); font-size: 0.9em; }
.rec-now-start:disabled { opacity: 0.5; cursor: not-allowed; }
.rec-now-cancel { background: none; border: 0; color: var(--color-muted); cursor: pointer; font-size: 0.82em; margin-left: auto; }
.rec-now-cancel:hover { color: var(--color-ink); }
/* Own work rail section */
.own-work-row { padding: 7px 18px 7px 20px; }
.own-work-main { display: flex; align-items: baseline; gap: 8px; }
.own-work-title { font-size: 0.84em; color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.own-work-date { font-size: 0.7em; color: var(--color-muted); margin-left: auto; flex-shrink: 0; }
.own-work-actions { margin-top: 2px; }
.own-work-state { font-size: 0.72em; color: var(--color-muted); }
.own-work-action { background: none; border: 0; color: var(--color-link, var(--color-accent)); font-size: 0.72em; cursor: pointer; padding: 0; font-family: var(--p-font-body); }
.own-work-action:hover { text-decoration: underline; }

/* ─── Outcome & alliance (FIT) ─────────────────────────────────────── */
/* Uses the Workshop palette vars throughout so it follows light/dark/obsidian.
 * Gold (--color-accent) = outcome/ORS; --color-link = alliance/SRS. */
.fit-card { padding: 28px 24px 36px; max-width: 760px; margin: 0 auto; }
.fit-head { margin-bottom: 18px; }
.fit-eyebrow {
  font-size: 0.7em; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--color-accent);
}
.fit-place {
  font-family: var(--font-display); font-style: italic;
  font-size: 1.12em; color: var(--color-ink); margin-top: 4px;
}
.fit-trajectory {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: 10px; padding: 12px 14px 8px; margin-bottom: 14px;
}
.fit-chart { width: 100%; height: auto; display: block; }
.fit-axis { stroke: var(--color-line); stroke-width: 1; }
.fit-svg-tick { fill: var(--color-muted); font-size: 9px; font-family: var(--p-font-mono); }
.fit-svg-ref { fill: var(--color-muted); font-size: 8.5px; font-family: var(--p-font-mono); }
.fit-svg-empty { fill: var(--color-muted); font-size: 11px; font-style: italic; }
.fit-ref { stroke-width: 1; opacity: 0.8; }
.fit-ref-cutoff   { stroke: var(--color-accent); stroke-dasharray: 4 3; opacity: 0.55; }
.fit-ref-alliance { stroke: var(--color-link);   stroke-dasharray: 4 3; opacity: 0.5; }
.fit-ref-rc       { stroke: var(--color-muted);  stroke-dasharray: 1 3; opacity: 0.6; }
.fit-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fit-line-ors { stroke: var(--color-accent); }
.fit-line-srs { stroke: var(--color-link); }
.fit-dot-ors { fill: var(--color-accent); }
.fit-dot-srs { fill: var(--color-link); }
.fit-legend { display: flex; gap: 18px; padding: 6px 2px 2px; }
.fit-legend-item { font-size: 0.74em; color: var(--color-muted); display: inline-flex; align-items: center; gap: 6px; }
.fit-swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.fit-swatch-ors { background: var(--color-accent); }
.fit-swatch-srs { background: var(--color-link); }
.fit-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px;
  margin-bottom: 18px;
}
.fit-fact {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 0.82em; color: var(--color-ink-soft);
  padding: 5px 0; border-bottom: 1px dashed var(--color-line);
}
.fit-fact b { color: var(--color-ink); font-family: var(--p-font-mono); font-size: 0.95em; }
.fit-entry {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 14px;
}
.fit-entry-head { font-size: 0.82em; font-weight: 600; color: var(--color-ink); margin-bottom: 12px; }
.fit-picker-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fit-picker-label { font-size: 0.78em; color: var(--color-muted); }
.fit-select {
  background: var(--color-bg); color: var(--color-ink);
  border: 1px solid var(--color-line); border-radius: 5px;
  padding: 5px 8px; font-family: var(--p-font-body); font-size: 0.84em;
}
.fit-scales { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.fit-scale { min-width: 0; }
.fit-scale-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.78em; font-weight: 600; color: var(--color-accent);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--color-line);
}
.fit-scale-total { font-family: var(--p-font-mono); font-size: 0.95em; color: var(--color-ink); letter-spacing: 0; text-transform: none; }
.fit-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.fit-field-label { font-size: 0.82em; color: var(--color-ink); display: flex; flex-direction: column; }
.fit-field-hint { font-size: 0.82em; color: var(--color-muted); font-style: italic; }
.fit-input {
  width: 64px; text-align: right;
  background: var(--color-bg); color: var(--color-ink);
  border: 1px solid var(--color-line); border-radius: 5px;
  padding: 5px 8px; font-family: var(--p-font-mono); font-size: 0.9em;
}
.fit-input:focus { outline: none; border-color: var(--color-accent); }
.fit-save-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.fit-save-msg { font-size: 0.78em; color: var(--color-muted); }
.fit-note {
  font-size: 0.76em; color: var(--color-muted); line-height: 1.55;
  border-left: 2px solid var(--color-line); padding-left: 12px;
}
@media (max-width: 620px) {
  .fit-scales, .fit-facts { grid-template-columns: 1fr; }
}
