/* ─── Self-hosted fonts ─── */
@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/Fraunces-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable-Italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/JetBrainsMono-variable.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Grain voice: calm but firm */
  --paper: #f6f2e9;
  --paper-raised: #fbf8f1;
  --paper-dark: #ece5d8;
  --navy: #1f2a44;
  --navy-deep: #121a2e;
  --ink: #1a1f2c;
  --ink-muted: #5e5a50;
  --ink-faint: #8f8a7d;
  --rule: #e4dccb;
  --brass: #a37f2b;
  --brass-dark: #735a1a;
  --brass-soft: #e7d9ae;
  /* Semantic: sage/amber/brick — muted, not traffic-signal */
  --sage: #2B7A78;
  --sage-light: #3AAFA9;
  --sage-soft: #dff0ef;
  --amber: #a37f2b;
  --amber-soft: #e7d9ae;
  --brick: #8b3a3a;
  --brick-deep: #6a2a22;
  --brick-soft: #f0dede;
  --amber-wash: #fff8e1;
  --green-deep: #2D6A4F;
  --navy-soft: #e0e4ec;
  --card-bg: #fbf8f1;     /* paper-raised, not cold white. Matches Dashboard. */
  --card-border: #e4dccb;  /* matches --rule for consistency */
  /* Type stack */
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", monospace;
  /* Spacing — document-grade radii, not app-grade. Matches Dashboard. */
  --radius: 4px;
  --radius-sm: 2px;
  --touch-min: 44px;
  --transition: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--sans); background: var(--paper); color: var(--ink); min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* ─── Header ─── */
.header { background: var(--navy); color: var(--paper); padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 100%; }
.header-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; color: inherit; cursor: pointer; text-decoration: none; }
.header-user { font-size: 0.8125rem; color: var(--brass-soft); font-family: var(--mono); }

/* ─── Layout ─── */
.main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.main--narrow { max-width: 800px; }

/* ─── Page Header (Dashboard gravity) ─── */
/* Eyebrow → Title → Subtitle pattern. Matches Dashboard page-header. */
.pc-page-header { margin-bottom: 32px; }
.pc-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.pc-page-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.pc-page-subtitle {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ─── Stat Tiles (Dashboard gravity) ─── */
/* Big-number tiles at the top of views. Matches Dashboard .tile-grid. */
.pc-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.pc-stat-tile {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}
.pc-stat-value {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.pc-stat-value .pc-stat-unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0;
  /* JJ flagged: word-form units ("worsening", "alerts") were mashing
     against the numeral. Tiny gap restores readable noun-phrase. */
  margin-left: 0.25rem;
}
.pc-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-top: 8px;
}
.pc-stat-trend {
  font-size: 0.75rem;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pc-stat-trend--up { color: var(--sage); }
.pc-stat-trend--down { color: var(--brick); }
.pc-stat-trend--flat { color: var(--ink-faint); }

/* ─── Stat tile tones — Behavior Trend composite (1b — Cap L261) ─── */
/* For behaviors, semantic inverts: 'up' arrow on a worsening tile should be
 * brick (more frequent maladaptive behavior = bad), 'down' arrow on an
 * improving tile should be sage. Tone class overrides the trend-arrow color
 * so the same arrow glyph reads correctly on context. */
.pc-stat-tile--brick .pc-stat-trend--up,
.pc-stat-tile--brick .pc-stat-trend--down,
.pc-stat-tile--brick .pc-stat-trend--flat { color: var(--brick); }
.pc-stat-tile--brick .pc-stat-value { color: var(--brick-deep); }
.pc-stat-tile--brick { border-color: var(--brick-soft); }

.pc-stat-tile--sage .pc-stat-trend--up,
.pc-stat-tile--sage .pc-stat-trend--down,
.pc-stat-tile--sage .pc-stat-trend--flat { color: var(--sage); }
.pc-stat-tile--sage .pc-stat-value { color: var(--sage); }
.pc-stat-tile--sage { border-color: var(--sage-soft); }

.pc-stat-tile--muted .pc-stat-value { color: var(--ink-muted); }
.pc-stat-tile--muted .pc-stat-trend--flat { color: var(--ink-faint); }

.pc-stat-tile--interactive {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pc-stat-tile--interactive:hover {
  border-color: var(--brass);
  transform: translateY(-1px);
}
.pc-stat-tile--interactive:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ─── Summary single-column stack (JJ direction 2026-05-10) ─── */
/* Wraps the Summary tab. Single-column at every breakpoint per JJ's
 * preference — the prior 2-col grid (Cap L261) was reverted because
 * the asymmetric column heights read as visually unbalanced. All
 * sections stack in HTML source order. .summary-col + .summary-full-
 * width both collapse to plain block-level containers under this
 * layout; classes preserved for future reversion if needed. */
.summary-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.summary-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;  /* prevent grid blowout from long children */
}
.summary-full-width {
  grid-column: 1 / -1;
}

/* ─── Section Divider (Dashboard gravity) ─── */
/* Eyebrow + title between logical groups. Replaces bare h3/h2. */
.pc-section-eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  margin-top: 32px;
  margin-bottom: 4px;
}

/* ─── Buttons ─── */
.btn { padding: 8px 16px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card-bg); font-family: var(--sans); font-size: 0.8125rem; cursor: pointer; min-height: var(--touch-min); transition: background var(--transition), border-color var(--transition); color: var(--ink); }
.btn:hover { background: var(--paper-dark); }
.btn-sm { padding: 4px 10px; min-height: 32px; font-size: 0.8125rem; }
.btn-primary { background: var(--sage); color: white; border-color: var(--sage); }
.btn-primary:hover { background: var(--sage-light); border-color: var(--sage-light); }
.btn-ghost { background: transparent; border-style: dashed; }
.btn-ghost-sage { color: var(--sage); border-color: var(--sage); }
.btn-ghost-sage:hover { background: var(--sage-soft); }
.btn-ghost-navy { color: var(--navy); border-color: var(--navy); }
.btn-ghost-navy:hover { background: var(--navy-soft); }
.btn-ghost-brass { color: var(--brass); border-color: var(--brass); }
.btn-ghost-brass:hover { background: var(--brass-soft); }
.btn-dismiss { color: var(--brick); border-color: var(--brick); }
.btn-dismiss:hover { background: var(--brick-soft); }

/* ─── Badges ─── */
.badge-pending { font-family: var(--mono); font-size: 0.8125rem; padding: 4px 12px; border-radius: var(--radius-sm); background: var(--brass-soft); color: var(--brass-dark); font-weight: 500; cursor: pointer; text-decoration: none; }
.badge-pending:hover { background: var(--brass); color: white; }
.badge-count { font-family: var(--mono); font-size: 0.6875rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--brass); color: white; min-width: 24px; text-align: center; display: inline-block; }

/* ─── Filter / Sort ─── */
.filter-bar { display: flex; gap: 4px; }
.filter-btn { padding: 6px 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card-bg); font-size: 0.8125rem; cursor: pointer; min-height: 32px; font-family: var(--sans); color: var(--ink-muted); transition: all var(--transition); }
.filter-btn.active { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.filter-btn:hover:not(.active) { background: var(--paper-dark); }

/* ─── Views ─── */
.view { display: none; }
.view.active { display: block; }

/* ═══════════════════════════════════════════
   CLIENT LIST
   ═══════════════════════════════════════════ */
.clients-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.clients-header h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--navy); }
.sort-controls { margin-left: auto; }

.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.client-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--card-bg); padding: 16px; transition: box-shadow var(--transition), border-color var(--transition); cursor: pointer; }
.client-card:hover { border-color: var(--sage); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.client-card.has-pending { border-left: 3px solid var(--brass); }
.cc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cc-id { font-family: var(--serif); font-size: 1.125rem; font-weight: 600; color: var(--navy); }
.cc-indicators { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.cc-ind { font-size: 0.8125rem; color: var(--ink-muted); display: flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-sage { background: var(--sage); }
.dot-amber { background: var(--amber); }
.dot-brick { background: var(--brick); }
.trend-arrow { font-size: 0.75rem; }
.trend-up { color: var(--brick); }
.trend-stable { color: var(--ink-faint); }
.trend-down { color: var(--sage); }
.cc-date { font-size: 0.75rem; color: var(--ink-faint); font-family: var(--mono); }
/* Pending-count pill on client card — Grain L320 spec, 2026-05-10. */
.cc-pending { font-size: 0.6875rem; font-weight: 600; background: var(--brass); color: var(--paper); border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center; }

/* ═══════════════════════════════════════════
   CLIENT DETAIL
   ═══════════════════════════════════════════ */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--ink-muted); text-decoration: none; margin-bottom: 16px; cursor: pointer; }
.back-link:hover { color: var(--sage); }
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-header h2 { font-family: var(--serif); font-size: 1.75rem; font-weight: 600; color: var(--navy); }

/* Tabs */
.tab-row { display: flex; gap: 0; border-bottom: 2px solid var(--rule); margin-bottom: 24px; }
.tab { padding: 10px 20px; border: none; background: none; font-family: var(--serif); font-size: 1rem; font-weight: 500; color: var(--ink-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; min-height: var(--touch-min); transition: color var(--transition), border-color var(--transition); }
.tab.active { color: var(--sage); border-bottom-color: var(--sage); }
.tab:hover { color: var(--ink); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Sections */
.section { margin-bottom: 32px; }
.section-title { font-family: var(--serif); font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }

/* ─── Taxonomy Accordion ─── */
.tax-domain { margin-bottom: 8px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card-bg); overflow: hidden; }
.tax-domain-hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; user-select: none; min-height: var(--touch-min); transition: background var(--transition); }
.tax-domain-hd:hover { background: #ebf0f7; }
.tax-arrow { font-size: 0.75rem; color: var(--ink-muted); width: 16px; text-align: center; transition: transform 0.15s ease; }
.tax-domain-name { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: 0.04em; }
.tax-domain-meta { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); margin-left: auto; }
.tax-domain-body { padding: 0 0 8px 0; }

/* Area */
.tax-area { margin: 0 12px; border-left: 2px solid var(--rule); }
.tax-area-hd { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; user-select: none; min-height: 40px; transition: background var(--transition); }
.tax-area-hd:hover { background: var(--paper-raised); }
.tax-area-name { font-weight: 500; font-size: 0.9375rem; }
.sup-badge { font-family: var(--mono); font-size: 0.625rem; padding: 1px 6px; border-radius: 3px; background: var(--sage); color: white; margin-left: 4px; }

/* Sparkline */
.spark { display: inline-block; vertical-align: middle; margin-left: auto; }
.spark svg { width: 80px; height: 24px; }
.spark polyline { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.spark-sage polyline { stroke: var(--sage); }
.spark-sage circle { color: var(--sage); }
.spark-amber polyline { stroke: var(--amber); }
.spark-amber circle { color: var(--amber); }
.spark-brick polyline { stroke: var(--brick); }
.spark-brick circle { color: var(--brick); }
.trend-spark-point { cursor: help; }

/* Target */
.tax-targets { padding-left: 24px; }
.tax-target { display: flex; align-items: center; gap: 8px; padding: 6px 12px; min-height: 36px; }
.target-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.target-dot.advancing { background: var(--sage); }
.target-dot.stalled { background: var(--amber); }
.target-dot.regressing { background: var(--brick); }
.target-dot.maintaining { background: var(--ink-faint); }
.target-name { font-size: 0.875rem; }
.target-status { font-family: var(--mono); font-size: 0.75rem; margin-left: auto; white-space: nowrap; }

/* Per-target guidance input */
.target-guidance { display: flex; gap: 8px; padding: 4px 12px 8px 24px; align-items: center; }
.target-guidance input { flex: 1; padding: 4px 8px; font-size: 0.8125rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); font-family: var(--mono); color: var(--ink); background: var(--paper-raised); }
.target-guidance input:focus { outline: none; border-color: var(--sage); background: var(--card-bg); box-shadow: 0 0 0 2px rgba(43,122,120,0.12); }
.target-guidance input::placeholder { color: var(--ink-faint); }

/* Add rows */
.add-row { padding: 6px 12px 8px 24px; }
.add-row-area { padding: 8px 16px 12px; }
.add-row-domain { margin-top: 8px; }
.add-row-domain .btn { width: 100%; padding: 10px; }

/* ─── Domain Briefs ─── */
.brief-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.brief-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card-bg); padding: 14px 16px; cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition); }
.brief-card:hover { border-color: var(--sage); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.brief-card-name { font-family: var(--serif); font-weight: 600; font-size: 1rem; color: var(--navy); display: block; }
.brief-card-hint { font-size: 0.75rem; color: var(--ink-faint); display: block; margin-top: 2px; }

/* ─── Behavior Cards ─── */
.beh-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card-bg); margin-bottom: 10px; overflow: hidden; }
/* JJ flagged 2026-05-10: at 60% column width the flex row was forcing
   `.beh-traj-empty` ("— no data this week") to wrap each word onto its
   own line. flex-wrap + row-gap let the action buttons drop to a
   second line gracefully for long-named behaviors instead of cramping
   the trajectory text. Bandaid until Grain rules on whether Behavior
   Trends should be a full-width section. */
.beh-card-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; row-gap: 6px; padding: 12px 16px; }
.beh-card-name { font-family: var(--serif); font-weight: 600; font-size: 1rem; color: var(--navy); flex-shrink: 0; }
.beh-traj-empty { white-space: nowrap; flex-shrink: 0; }

/* Subfolder */
.subfolder { font-size: 0.875rem; border-top: 1px solid var(--paper-dark); cursor: pointer; transition: background var(--transition); }
.subfolder-collapsed { padding: 8px 16px; }
.subfolder-collapsed:hover { background: var(--paper-raised); }
.subfolder-label { font-weight: 600; font-size: 0.75rem; color: var(--navy); text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 2px; }
.subfolder-preview { color: var(--ink-muted); font-size: 0.8125rem; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subfolder-expanded { padding: 12px 16px; background: var(--paper-raised); cursor: default; }
.subfolder-ta { width: 100%; min-height: 100px; padding: 10px; font-family: var(--sans); font-size: 0.875rem; line-height: 1.6; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card-bg); resize: vertical; color: var(--ink); }
.subfolder-ta:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 2px rgba(43,122,120,0.12); }
.subfolder-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* ─── Session Overview ─── */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.overview-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card-bg); padding: 16px; }
.overview-label { font-family: var(--serif); font-weight: 600; font-size: 0.9375rem; color: var(--navy); display: block; margin-bottom: 8px; }
.overview-text { font-size: 0.875rem; line-height: 1.6; color: var(--ink); }

/* ─── Recommendations ─── */
.rec-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card-bg); margin-bottom: 12px; overflow: hidden; }
.rec-card.rec-pending { border-left: 3px solid var(--brass); }
.rec-card.rec-approved { border-left: 3px solid var(--sage); }
.rec-hd { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--paper-raised); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.rec-type { font-family: var(--mono); font-size: 0.6875rem; padding: 2px 8px; border-radius: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }
.rec-type-plateau { background: var(--amber-soft); color: var(--brass-dark); }
.rec-type-behavior { background: var(--brick-soft); color: var(--brick); }
.rec-type-coverage { background: var(--paper-dark); color: var(--ink-muted); }
.rec-type-fidelity { background: var(--sage-soft); color: var(--sage); }
.rec-status { font-family: var(--mono); font-size: 0.625rem; padding: 2px 6px; border-radius: 3px; }
.rec-status-pending { background: var(--amber-soft); color: var(--brass); }
.rec-status-approved { background: var(--sage-soft); color: var(--green-deep); }
.rec-date { font-size: 0.75rem; color: var(--ink-faint); margin-left: auto; font-family: var(--mono); }
.rec-body { padding: 12px 16px; }
.rec-text { font-size: 0.9375rem; line-height: 1.6; margin-bottom: 4px; }
.rec-citation { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-muted); margin-top: 6px; }
.rec-actions { display: flex; gap: 8px; padding: 8px 16px 12px; }

/* ─── Guidance ─── */
.guidance-scope { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--navy); margin: 16px 0 10px; }
.guidance-type { font-family: var(--mono); font-size: 0.6875rem; padding: 2px 8px; border-radius: 3px; font-weight: 500; text-transform: uppercase; }
.guidance-type-strategy { background: var(--sage-soft); color: var(--sage); }
.guidance-type-behavior { background: var(--brick-soft); color: var(--brick); }
.guidance-type-supervision { background: var(--navy-soft); color: var(--navy); }
.evidence-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 8px; }
.chip { font-size: 0.75rem; padding: 3px 8px; background: var(--paper-dark); border-radius: var(--radius-sm); color: var(--ink-muted); }
.chip b { color: var(--ink); font-weight: 500; }

/* ─── Ask ─── */
.conv-scroll { max-height: 420px; overflow-y: auto; margin-bottom: 16px; padding: 4px 0; }
.msg { padding: 10px 14px; margin-bottom: 8px; border-radius: var(--radius); max-width: 85%; }
.msg-user { background: #ebf0f7; margin-left: auto; }
.msg-assistant { background: var(--paper-raised); border: 1px solid var(--rule); }
.msg-role { font-family: var(--mono); font-size: 0.6875rem; color: var(--ink-faint); display: block; margin-bottom: 4px; }
.msg p { font-size: 0.9375rem; line-height: 1.5; }
.msg-body { font-size: 0.9375rem; line-height: 1.55; }
.msg-body .brief-para { font-size: 0.9375rem; margin: 6px 0; }
.msg-body .brief-list { margin: 6px 0 6px 0; padding-left: 18px; }
.msg-body .brief-list > li { margin-bottom: 4px; }
.msg-body .brief-sublist { margin: 4px 0 4px 0; padding-left: 16px; }
.msg-body .brief-sublist li { font-size: 0.875rem; color: var(--ink-muted); margin-bottom: 2px; }
.msg-body .brief-section-title { font-family: var(--serif); font-size: 0.9375rem; margin: 8px 0 4px; color: var(--navy, var(--ink)); }
.msg-body strong { font-weight: 600; color: var(--ink); }
.msg-body p:first-child { margin-top: 0; }
.msg-body p:last-child, .msg-body ul:last-child { margin-bottom: 0; }
.ask-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.ask-ta { flex: 1 1 100%; padding: 10px; border: 1px solid var(--rule); border-radius: var(--radius-sm); font-family: var(--sans); font-size: 0.9375rem; resize: vertical; min-height: 56px; color: var(--ink); }
.ask-ta:focus { outline: none; border-color: var(--sage); }
.ask-toggle-label { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 0.8125rem; color: var(--ink-muted); cursor: pointer; user-select: none; flex: 1 1 100%; }
.ask-toggle-label input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--teal, var(--sage)); }
.ask-toggle-hint { font-family: var(--mono); font-size: 0.6875rem; color: var(--ink-faint); }

.msg-sources { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--paper-dark, #e7ddc4); }
.msg-sources-label { font-family: var(--mono); font-size: 0.625rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.source-pill-row { display: flex; flex-wrap: wrap; gap: 4px; }
.source-pill { font-family: var(--sans); font-size: 0.6875rem; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--rule); background: var(--paper-raised, #faf3df); color: var(--ink-muted); display: inline-flex; align-items: center; gap: 4px; }
.source-pill.source-research { background: #f3ecda; color: #6b5326; border-color: #c9b58a; }
.source-pill.source-research::before { content: '\1F4D6'; font-size: 0.75rem; }
.source-pill.source-client::before { content: '\25CF'; color: var(--teal, var(--sage)); font-size: 0.6em; }

/* ─── Modal ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--card-bg); border-radius: var(--radius); padding: 24px; width: min(520px, 90vw); box-shadow: 0 8px 32px rgba(0,0,0,0.15); max-height: 80vh; overflow-y: auto; }
.modal h3 { font-family: var(--serif); font-size: 1.125rem; margin-bottom: 12px; color: var(--navy); }
.modal p { line-height: 1.6; font-size: 0.9375rem; }

/* ─── Utilities ─── */
.empty-msg { color: var(--ink-faint); font-size: 0.875rem; font-style: italic; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: var(--radius-sm); background: var(--navy); color: var(--paper); font-size: 0.875rem; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; z-index: 300; }
.toast.show { opacity: 1; }
.toast.error { background: var(--brick); }
.ask-header { margin-bottom: 12px; }
.rec-edit-note { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--rule); }
.guidance-add-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.subfolder-preview-empty { color: var(--ink-faint); }
.overview-text-empty { color: var(--ink-faint); }
.add-inline-input { padding: 4px 8px; font-size: 0.8125rem; border: 1px solid var(--sage); border-radius: var(--radius-sm); font-family: var(--mono); color: var(--ink); background: var(--card-bg); }
.add-inline-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(43,122,120,0.12); }

/* ─── Positive News ─── */
.positive-news-input { width: 100%; padding: 10px; font-family: var(--sans); font-size: 0.9375rem; line-height: 1.6; border: 1px solid var(--rule); border-radius: var(--radius-sm); resize: vertical; background: var(--paper-raised); color: var(--ink); min-height: 80px; }
.positive-news-input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 2px rgba(43,122,120,0.12); }
.positive-news-input::placeholder { color: var(--ink-faint); }
.rec-type.general { background: var(--navy-soft); color: var(--navy); }
.news-delete { background: none; border: none; color: var(--ink-faint); font-size: 0.75rem; cursor: pointer; padding: 2px 6px; font-family: var(--mono); transition: color var(--transition); }
.news-delete:hover { color: var(--brick); }

/* ─── Behavior Visualization ─── */
.beh-select { padding: 6px 10px; font-family: var(--sans); font-size: 0.875rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper-raised); color: var(--ink); cursor: pointer; }
.beh-select:focus { outline: none; border-color: var(--sage); }
.beh-controls { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.beh-chart-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card-bg); padding: 16px; margin-bottom: 16px; }
.beh-intensity { font-size: 0.8125rem; color: var(--ink-muted); margin-bottom: 16px; }
.beh-intensity strong { font-weight: 600; }
.beh-chip-section { margin-bottom: 12px; }
.beh-chip-label { font-size: 0.75rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.1em; display: block; margin-bottom: 6px; }
.beh-chip-wrap { display: flex; flex-wrap: wrap; gap: 4px; }

/* ─── Observation Badges ─── */
.rec-type-skill_progress { background: var(--sage-soft); color: var(--sage); }
.rec-type-behavior_event { background: var(--brick-soft); color: var(--brick); }
.rec-type-strategy_feedback { background: var(--amber-soft); color: var(--brass-dark); }
.rec-type-strategy_ineffective { background: var(--brick-soft); color: var(--brick); }
.rec-type-client_enrichment { background: var(--navy-soft); color: var(--navy); }
.rec-type-general_observation { background: var(--paper-dark); color: var(--ink-muted); }
.rec-type-uncategorized { background: var(--paper-dark); color: var(--ink-faint); }
.obs-reviewed-label { font-size: 0.75rem; color: var(--sage); font-family: var(--mono); }
.obs-summary { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 4px; padding: 0 16px 8px; }
.reclassify-options { display: flex; flex-direction: column; gap: 8px; }

/* ─── Transcriber ─── */
.tx-classify-row { padding: 8px 0; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tx-classify-name { font-size: 0.875rem; }
.tx-classify-phi { color: var(--brick); }
.tx-classify-data { color: var(--brass); }
.tx-classify-narrative { color: var(--sage); }
.tx-nav-back { font-size: 0.8125rem; color: var(--ink-muted); text-decoration: none; display: block; margin-bottom: 12px; }
.tx-nav-back:hover { color: var(--sage); }
.tx-nav-eyebrow { font-size: 0.75rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }

/* ─── Parsed Note Review Queue (Surface 1+2) ─── */
.review-section {
  background: var(--paper-raised);
  border-left: 3px solid var(--brass);
  padding: 16px 20px;
  margin-bottom: 24px;
  border-radius: var(--radius-sm);
}
.review-section-title {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 6px 0;
}
.review-section-intro {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.5;
  margin: 0 0 14px 0;
  max-width: 64ch;
}
.review-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.review-card:last-child { margin-bottom: 0; }
.review-card-meta {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.review-fields-readonly { margin-bottom: 4px; }
.review-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
}
.review-field:first-child { border-top: none; padding-top: 0; }
.review-field-name {
  flex: 0 0 200px;
  font-weight: 500;
  color: var(--ink);
}
.review-field-value {
  flex: 1;
  color: var(--ink-muted);
  word-break: break-word;
  font-family: var(--sans);
}
.review-field-list {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  line-height: 1.55;
}
.review-field-list > li {
  margin-bottom: 4px;
}
.review-field-list > li:last-child {
  margin-bottom: 0;
}
.review-field-sublist {
  margin: 3px 0 2px 0;
  padding-left: 20px;
  list-style: circle;
  line-height: 1.5;
}
.review-field-sublist li {
  font-size: 0.84375rem;
  color: var(--ink-muted);
  margin-bottom: 1px;
}
.review-field-cue {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--brass-dark);
  font-style: italic;
  align-self: center;
}
.review-source-disclosure {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.review-source-summary {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.review-source-summary:hover { color: var(--ink-muted); }
.review-source-text {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
}
.review-source-empty {
  font-style: italic;
  color: var(--ink-faint);
}
.review-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.review-edit-form { display: none; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); }
.review-edit-form.active { display: block; }
.review-edit-field { margin-bottom: 12px; }
.review-edit-field-label {
  display: block;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--ink);
  margin-bottom: 4px;
}
.review-edit-field textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8125rem;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  min-height: 60px;
  box-sizing: border-box;
  resize: vertical;
}
.review-edit-field textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 2px rgba(43,122,120,0.12);
}
.btn-warning { background: var(--brick); color: #fff; border-color: var(--brick); }
.btn-warning:hover { background: #7a3232; }

/* ─── Per-field Edit Form Editors (Forge B placeholder; Grain to refine) ─── */
.field-editor { margin-top: 4px; }
.fe-row { margin-bottom: 12px; }
.fe-row:last-child { margin-bottom: 0; }
.fe-row-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.fe-row-checkbox { margin-bottom: 14px; }
.fe-sublabel {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fe-inline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}
.fe-inline-label:not(:first-child) { margin-left: 12px; }
.fe-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.875rem;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--card-bg);
  box-sizing: border-box;
}
.fe-input:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(43,122,120,0.15);
}
.fe-input-narrow { width: 80px; flex: 0 0 auto; }
.fe-input-medium { width: 160px; flex: 0 0 auto; }
.fe-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ink);
  cursor: pointer;
}
.fe-checkbox-label input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.fe-list { margin-bottom: 6px; }
.fe-list-item, .fe-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.fe-pairs { margin-bottom: 6px; }
.fe-remove {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fe-remove:hover {
  border-color: var(--brick);
  color: var(--brick);
  background: var(--brick-soft);
}
.fe-behavior, .fe-skill {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.fe-behavior:last-child, .fe-skill:last-child { margin-bottom: 0; }
.fe-behaviors, .fe-skills { margin-bottom: 6px; }

/* Surface 2: per-target pending parsed indicator.
   Hollow ring in ink-faint — distinct shape AND distinct color from status
   dots (which are filled sage/amber/brick/ink-faint). Reads as a data-
   completeness signal, recessive against the status semantic. */
.target-pending-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--ink-faint);
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
  box-sizing: border-box;
}

/* Dot legend — discoverability for status + data dot meanings. */
.dot-legend-disclosure {
  margin-bottom: 14px;
}
.dot-legend-summary {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  list-style-position: inside;
}
.dot-legend-summary:hover { color: var(--ink-muted); }
.dot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.dot-legend-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.dot-legend-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 2px;
}
.dot-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.dot-legend-item .target-dot,
.dot-legend-item .target-pending-indicator {
  margin-left: 0;
  cursor: default;
}

/* ─── Surface 3: Trend chart tooltip + datapoint source distinction ───
   Datapoints stay monochrome (line color drives status — sage/amber/brick).
   Source distinction is shape only: filled / hollow / ring overlay.
   Tooltip is custom-rendered (Chart.js external tooltip); these classes style it. */
.trend-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--paper-raised);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--navy);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(18, 26, 46, 0.10);
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.45;
  max-width: 260px;
  z-index: 50;
  opacity: 0;
  transition: opacity var(--transition);
}
.trend-tooltip.visible { opacity: 1; }
.trend-tooltip-title {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.trend-tooltip-body { color: var(--ink); }
.trend-tooltip-body strong { color: var(--navy); font-weight: 600; }
.trend-tooltip-empty { font-style: italic; color: var(--ink-faint); }

/* ─── Research Review Queue Tab ─── */
.tab-badge { display: none; margin-left: 4px; font-size: 0.7rem; padding: 0 6px; vertical-align: middle; }
.section-count { margin-left: 8px; font-size: 0.75rem; }
.section-count-sage { background: var(--sage-soft); color: var(--sage); }
.section-count-muted { background: var(--paper-raised); color: var(--ink-muted); }
.section-intro { font-size: 0.8125rem; color: var(--ink-muted); line-height: 1.5; margin: 0 0 16px 0; max-width: 64ch; }
.research-link { font-size: 0.8125rem; color: var(--sage); text-decoration: none; }
.research-link:hover { color: var(--sage-light); text-decoration: underline; }
.chip-mono { font-family: var(--mono); }
.rec-meta { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 6px; }
.rec-meta em { font-style: italic; }
.rec-title { font-weight: 500; line-height: 1.45; }
.feeding-indicator { font-size: 0.8125rem; color: var(--sage); }
.feeding-indicator strong { font-weight: 600; }
.rec-actions-wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rec-action-row { margin-top: 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.research-abstract-btn { font-size: 0.8125rem; padding: 4px 10px; min-height: 28px; }
.abstract-modal-body { line-height: 1.55; font-size: 0.9375rem; min-height: 80px; }
.abstract-modal-meta { margin-top: 8px; font-family: var(--mono); font-size: 0.6875rem; color: var(--ink-faint); }
.modal-actions-end { margin-top: 16px; display: flex; justify-content: flex-end; }
.modal.modal-wide { width: min(640px, 90vw); }

/* Behavior subfolder fill-status pill (Summary tab → Behavior section).
   Uses correct sage/brass tokens — no wrong-hex fallbacks. */
.fill-pill {
  margin-left: 12px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink-muted);
}
.fill-pill-full    { background: var(--sage-soft);   color: var(--sage); }
.fill-pill-partial { background: var(--brass-soft);  color: var(--brass); }
.fill-pill-empty   { background: var(--paper-raised); color: var(--ink-faint); }
.ml-auto { margin-left: auto; }
.collapse-toggle { cursor: pointer; }
.collapse-arrow { margin-right: 6px; color: var(--ink-muted); font-size: 0.75rem; }

/* ─── Brief modal markdown render (Forge B placeholder; Grain to refine) ─── */
.brief-section-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin: 14px 0 6px 0;
}
.brief-section-title:first-child { margin-top: 0; }
.brief-para {
  font-size: 0.9375rem;
  color: var(--ink);
  line-height: 1.6;
  margin: 0 0 8px 0;
}
.brief-list {
  margin: 0 0 10px 0;
  padding-left: 22px;
  list-style: disc;
  line-height: 1.55;
}
.brief-list > li {
  margin-bottom: 4px;
  font-size: 0.9375rem;
  color: var(--ink);
}
.brief-sublist {
  margin: 4px 0 4px 0;
  padding-left: 20px;
  list-style: circle;
  line-height: 1.5;
}
.brief-sublist li {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

/* ─── BUILD 1: Summary tab cache meta bar ─── */
.summary-meta-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.summary-meta-label { color: var(--ink-muted); }
.summary-meta-live { color: var(--ink-faint); font-style: italic; }
.summary-meta-dirty { color: var(--brick); font-weight: 500; }

/* ═══════════════════════════════════════════
   DESKTOP UI — modal sizes + summary 2-col grid
   (Grain spec 2026-05-06, thread pc-desktop-ui-continuation)
   .main--narrow lives in the Layout block (L85)
   ═══════════════════════════════════════════ */
.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-browse { max-width: 480px; }

/* .summary-layout grid defined at L203-222 (responsive 1fr → 3fr/2fr).
   Duplicate removed 2026-05-10 — was overriding the responsive breakpoint
   with a flat 1fr/1fr split at all sizes. */

/* ═══════════════════════════════════════════
   MOBILE BREAKPOINT — graceful degradation for BCBA tablet/phone check-ins
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .main { padding: 16px; }
  .tab-row { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; padding: 10px 14px; font-size: 0.875rem; }
  .detail-header h2 { font-size: 1.375rem; }
  .clients-header { flex-direction: column; align-items: flex-start; }
  .sort-controls { margin-left: 0; width: 100%; }
  .client-grid { grid-template-columns: 1fr; }
  .review-filters { flex-wrap: wrap; }
  .review-filters .filter-btn { flex: 1; min-width: 0; text-align: center; }
  .summary-layout { grid-template-columns: 1fr; }
  .pc-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .pc-page-title { font-size: 1.25rem; }
}

/* ═══════════════════════════════════════════
   OBSERVATIONS FEED — Build 8
   BCBA-facing list of RBT observations on the Summary tab.
   ═══════════════════════════════════════════ */
.pc-observations { margin-top: 24px; }

.pc-obs-unreviewed-badge {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  margin-left: 10px;
  border-radius: var(--radius-sm);
  background: var(--brass);
  color: var(--paper);
  letter-spacing: 0;
  text-transform: none;
}

.pc-obs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.pc-obs-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--transition);
}

/* Unreviewed cards highlight with a left border accent so the BCBA's
   eye lands on what still needs attention. */
.pc-obs-card.pc-obs-status-unreviewed {
  border-left: 3px solid var(--brass);
}
.pc-obs-card.pc-obs-status-reviewed {
  opacity: 0.85;
}
.pc-obs-card.pc-obs-status-reclassified {
  border-left: 3px solid var(--sage);
}

.pc-obs-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8125rem;
}
.pc-obs-rbt {
  font-weight: 600;
  color: var(--ink);
}
.pc-obs-ts {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.pc-obs-cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pc-obs-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--paper-dark);
  color: var(--ink);
}
/* Per-category color cues — muted, not traffic signal. */
.pc-obs-badge.pc-obs-cat-strategy_feedback {
  background: var(--sage-soft);
  color: var(--sage);
}
.pc-obs-badge.pc-obs-cat-strategy_ineffective {
  background: var(--brick-soft);
  color: var(--brick-deep);
}
.pc-obs-badge.pc-obs-cat-client_enrichment {
  background: var(--brass-soft);
  color: var(--brass-dark);
}
.pc-obs-badge.pc-obs-cat-session_observation {
  background: var(--navy-soft);
  color: var(--navy);
}
.pc-obs-badge.pc-obs-cat-new {
  background: var(--paper-dark);
  color: var(--ink-muted);
}

.pc-obs-reclass-note {
  font-size: 0.6875rem;
  color: var(--ink-faint);
  font-style: italic;
}

.pc-obs-status-pill {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--paper-dark);
  color: var(--ink-muted);
  margin-left: auto;
}

.pc-obs-summary {
  margin-top: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}

.pc-obs-linked {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-family: var(--mono);
}

.pc-obs-text {
  margin-top: 8px;
  font-size: 0.8125rem;
}
.pc-obs-text > summary {
  cursor: pointer;
  color: var(--sage);
  font-weight: 500;
  user-select: none;
}
.pc-obs-text > summary:hover {
  color: var(--sage-light);
}
.pc-obs-text-body {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--paper);
  border-left: 2px solid var(--rule);
  color: var(--ink-muted);
  line-height: 1.55;
}

.pc-obs-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pc-obs-reclass-panel {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}
.pc-obs-reclass-panel select {
  font-family: var(--sans);
  font-size: 0.8125rem;
  padding: 4px 8px;
  margin-right: 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--ink);
}

/* ===== Pocket-switcher (cross-app nav: Notes <-> Supervisor) ===== */
.pocket-switcher {
  display: flex;
  background: var(--paper-raised, #f4ede0);
  border-bottom: 1px solid var(--card-border, rgba(0, 0, 0, 0.08));
  padding: 0;
  overflow-x: auto;
}

.pocket-tab {
  padding: 10px 20px;
  font-family: var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted, #6b6357);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.pocket-tab:hover {
  color: var(--ink, #1a1a1a);
}

.pocket-tab.active {
  color: var(--ink, #1a1a1a);
  border-bottom-color: var(--brass, #a37f2b);
}

/* ─── Treatment Plan section (treatment-plan-upload-spec, 2026-05-08) ─── */
/* Calm-but-firm notice — navy/brass, no alarm-red unless rejected. */
.pc-notice {
  border-left: 3px solid var(--brass, #a37f2b);
  background: var(--paper-raised, #fbf8f1);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink, #1a1f2c);
  border-radius: var(--radius-sm);
}
.pc-notice strong { color: var(--navy, #1f2a44); }

.tp-active-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--paper-raised, #fbf8f1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.tp-active-meta { min-width: 0; flex: 1; }
.tp-active-filename {
  font-weight: 600;
  color: var(--ink, #1a1f2c);
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-active-sub {
  font-size: 0.8125rem;
  color: var(--ink-faint, #8f8a7d);
  margin-top: 4px;
  font-family: var(--mono, monospace);
}
.tp-active-actions {
  display: inline-flex;
  gap: 8px;
  flex-shrink: 0;
}

.tp-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.tp-upload-row input[type="file"] {
  flex: 1;
  min-width: 200px;
  font-size: 0.8125rem;
  font-family: var(--sans);
  color: var(--ink, #1a1f2c);
}
.tp-upload-hint {
  font-size: 0.75rem;
  color: var(--ink-faint, #8f8a7d);
  font-family: var(--mono, monospace);
  margin-top: 4px;
}

/* Multi-stage progress banner — shown while upload + PHI scan + embed +
   TP v2 profile extraction pipeline runs (30-90s for full-length plans).
   JS cycles stage text. Calm sage left-border (matches in-progress
   informational pattern, distinct from brick error + amber warning). */
.tp-upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid var(--sage, #2B7A78);
  background: var(--sage-soft, #dff0ef);
  color: var(--ink, #1a1f2c);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: var(--radius-sm);
}
.tp-progress-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--sage, #2B7A78);
  border-top-color: transparent;
  border-radius: 50%;
  animation: tp-progress-spin 800ms linear infinite;
  flex-shrink: 0;
}
.tp-progress-text {
  color: var(--ink, #1a1f2c);
}
@keyframes tp-progress-spin {
  to { transform: rotate(360deg); }
}

/* Rejection / error block — uses muted brick (calm-firm, not alarm-red). */
.tp-error {
  border-left: 3px solid var(--brick, #8b3a3a);
  background: var(--brick-soft, #f0dede);
  color: var(--brick-deep, #6a2a22);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: var(--radius-sm);
}
.tp-error strong { color: var(--brick-deep, #6a2a22); }

/* Soft image-warning + acknowledgment block (Permit L281). Calm-but-firm
   amber/brass tone — informed consent, NOT a hard rejection (brick is
   reserved for PHI rejections). */
.tp-image-warning {
  border-left: 3px solid var(--amber, #a37f2b);
  background: var(--amber-wash, #fff8e1);
  color: var(--ink, #1a1f2c);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: var(--radius-sm);
}
.tp-image-warning-msg {
  margin-bottom: 10px;
  color: var(--ink, #1a1f2c);
}
.tp-image-ack-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 10px;
  font-size: 0.875rem;
  color: var(--ink, #1a1f2c);
}
.tp-image-ack-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.tp-image-ack-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tp-image-ack-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tp-history-disclosure {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}
.tp-history-summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted, #5e5a50);
  user-select: none;
}
.tp-history-summary:hover { background: var(--paper-raised, #fbf8f1); }
.tp-history-disclosure[open] .tp-history-summary {
  border-bottom: 1px solid var(--rule);
}
.tp-history-body { padding: 8px 14px 12px; }

.tp-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tp-history-row {
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}
.tp-history-row:last-child { border-bottom: 0; }
.tp-history-row-active {
  background: rgba(163, 127, 43, 0.04);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: var(--radius-sm);
}
.tp-history-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tp-history-version {
  font-family: var(--mono, monospace);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy, #1f2a44);
  min-width: 30px;
}
.tp-history-filename {
  font-size: 0.875rem;
  color: var(--ink, #1a1f2c);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tp-active-badge {
  font-family: var(--mono, monospace);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--brass, #a37f2b);
  color: var(--paper, #f6f2e9);
}
.tp-history-line2 {
  font-size: 0.75rem;
  color: var(--ink-faint, #8f8a7d);
  font-family: var(--mono, monospace);
  margin-top: 4px;
  margin-left: 38px;
}

/* ─── Client Profile section (tp-v2-client-profile-spec) ─── */
.prof-provenance-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.8125rem;
}
.prof-provenance-source {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.prof-cluster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 1024px) {
  .prof-cluster-grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }
}

.prof-cluster {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.prof-cluster-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.prof-field {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.prof-field:last-child { border-bottom: none; }

.prof-field-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.prof-field-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
}
.prof-field-body {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink);
}
.prof-field-text { margin: 0; }
.prof-field-list {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  line-height: 1.55;
}
.prof-field-list li { margin-bottom: 3px; }
.prof-field-list li:last-child { margin-bottom: 0; }

/* Confidence items — reuse the parsed-note review pattern */
.prof-field-conf {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-style: italic;
  margin-left: 6px;
}

.prof-provenance-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.prof-prov-extracted {
  background: var(--paper-raised);
  color: var(--ink-muted);
}
.prof-prov-confirmed {
  background: var(--sage-soft, rgba(43,122,120,0.08));
  color: var(--sage);
  border-color: var(--sage-light, rgba(43,122,120,0.2));
}
.prof-prov-edited {
  background: var(--amber-soft, rgba(163,127,43,0.08));
  color: var(--brass-dark);
  border-color: var(--brass);
}
.prof-prov-rejected {
  background: var(--brick-soft);
  color: var(--brick-deep);
  border-color: var(--brick);
}

.prof-field-source {
  margin-top: 8px;
}
.prof-field-source-toggle {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 2px 0;
  user-select: none;
  list-style: none;
}
.prof-field-source-toggle::-webkit-details-marker { display: none; }
.prof-field-source-toggle::before {
  content: '▸ ';
  font-size: 0.5625rem;
}
details[open] > .prof-field-source-toggle::before {
  content: '▾ ';
}
.prof-field-source-toggle:hover { color: var(--ink-muted); }
.prof-field-source-text {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
  font-family: var(--sans);
}

.prof-empty {
  padding: 20px 14px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-faint);
  line-height: 1.5;
}
.prof-empty a {
  color: var(--sage);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prof-empty a:hover { color: var(--sage-dark, #1e5a58); }

/* Pending-pointer note inside Profile section when no active profile yet
   but a pending one exists (JJ override: directs BCBA to Profile-to-Review
   panel further down on Summary tab). */
.prof-pending-pointer {
  padding: 14px 16px;
  border-left: 3px solid var(--brass);
  background: var(--paper-raised);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink);
}
.prof-pending-pointer a {
  color: var(--sage);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Profile Review panel (tp-v2-client-profile-spec) ─── */
.profrev-progress {
  margin-bottom: 14px;
}
.profrev-progress-bar {
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.profrev-progress-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 2px;
  transition: width 300ms ease-out;
}
.profrev-progress-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
}

.profrev-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.profrev-card-field {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--navy);
  font-family: var(--serif);
}
.profrev-card-body {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 4px;
}

/* Extraction-failed state — field couldn't be extracted, BCBA fills manually */
.profrev-card-failed {
  border-left: 3px solid var(--brick);
}
.profrev-card-failed-msg {
  font-size: 0.8125rem;
  color: var(--brick);
  font-style: italic;
  margin-bottom: 8px;
}

/* ─── Profile Evolution disclosure ─── */
.prof-evo-disclosure {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.prof-evo-summary {
  font-family: var(--serif);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  list-style: none;
}
.prof-evo-summary::-webkit-details-marker { display: none; }
.prof-evo-summary::before {
  content: '▸ ';
  font-size: 0.75rem;
  color: var(--ink-faint);
}
details[open] > .prof-evo-summary::before {
  content: '▾ ';
}
.prof-evo-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--ink-faint);
  margin-left: 4px;
}
.prof-evo-body {
  margin-top: 10px;
}

.prof-evo-entry {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.prof-evo-entry:last-child { border-bottom: none; }

.prof-evo-version {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.prof-evo-changes {
  margin: 0;
  padding-left: 18px;
  list-style: none;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink);
}
.prof-evo-changes li {
  margin-bottom: 4px;
  position: relative;
}
.prof-evo-changes li::before {
  content: '·';
  position: absolute;
  left: -12px;
  color: var(--ink-faint);
}

.prof-evo-action {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  margin-right: 4px;
}
.prof-evo-added {
  background: var(--sage-soft, rgba(43,122,120,0.08));
  color: var(--sage);
  border: 1px solid var(--sage-light, rgba(43,122,120,0.2));
}
.prof-evo-removed {
  background: var(--brick-soft);
  color: var(--brick-deep);
  border: 1px solid var(--brick);
}
.prof-evo-modified {
  background: var(--amber-soft, rgba(163,127,43,0.08));
  color: var(--brass-dark);
  border: 1px solid var(--brass);
}

.prof-evo-initial-label {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--ink-faint);
}

.prof-evo-full-link {
  display: block;
  margin-top: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sage);
  text-decoration: none;
}
.prof-evo-full-link:hover {
  color: var(--sage-dark, #1e5a58);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Full Profile Evolution History page (Agent B's profile_history.html) ─── */
.prof-history-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}
.prof-history-header {
  margin-bottom: 24px;
}
.prof-history-back {
  font-size: 0.8125rem;
  color: var(--sage);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 8px;
}
.prof-history-back:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prof-history-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 4px;
}
.prof-history-subtitle {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}

/* Timeline spine */
.prof-history-timeline {
  position: relative;
  padding-left: 24px;
}
.prof-history-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--rule);
}

.prof-history-version {
  position: relative;
  margin-bottom: 16px;
}
.prof-history-version:last-child { margin-bottom: 0; }

.prof-history-version-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
  list-style: none;
}
.prof-history-version-hd::-webkit-details-marker { display: none; }

.prof-history-version-dot {
  position: absolute;
  left: -24px;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sage);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--rule);
  z-index: 1;
}
.prof-history-version-dot-inactive {
  background: var(--ink-faint);
}

.prof-history-version-label {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
}
.prof-history-version-badge {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--sage-soft, rgba(43,122,120,0.08));
  color: var(--sage);
  border: 1px solid var(--sage-light, rgba(43,122,120,0.2));
}

.prof-history-version-body {
  padding: 10px 0 0 0;
}
.prof-history-changes {
  margin-bottom: 12px;
}

.prof-history-snapshot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
}
.prof-history-snapshot-toggle {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.prof-history-snapshot-toggle::-webkit-details-marker { display: none; }
.prof-history-snapshot-toggle::before { content: '▸ '; font-size: 0.625rem; }
details[open] > .prof-history-snapshot-toggle::before { content: '▾ '; }
.prof-history-snapshot-toggle:hover { color: var(--ink-muted); }
.prof-history-snapshot-body {
  margin-top: 10px;
}

/* Mobile: collapse timeline padding */
@media (max-width: 600px) {
  .prof-history-page { padding: 16px 12px; }
  .prof-history-timeline { padding-left: 20px; }
  .prof-history-version-dot { left: -20px; width: 10px; height: 10px; }
}

/* ─── Clinical Themes section (accumulating-labels clusters) ─── */
/* Grain visual spec 2026-05-12. Cards live in right column above
   Research Articles. Sparkbar weight indicators (sage fill, 6px height,
   normalized within cluster). Active/Confirmed/Paused state pills.
   Direct-toggle Pause (no arm-and-confirm), inline rename, one-shot
   Confirm. */

.ct-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.ct-card:last-child { margin-bottom: 0; }

.ct-card-paused {
  opacity: 0.6;
  border-style: dashed;
}

.ct-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.ct-card-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ct-card-name-input {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--sage);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  box-shadow: 0 0 0 2px rgba(43,122,120,0.12);
}

.ct-card-state {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ct-state-active {
  background: var(--sage-soft, rgba(43,122,120,0.08));
  color: var(--sage);
  border: 1px solid var(--sage-light, rgba(43,122,120,0.2));
}
.ct-state-paused {
  background: var(--paper-raised, #fbf8f1);
  color: var(--ink-faint);
  border: 1px solid var(--rule);
}
.ct-state-confirmed {
  background: var(--sage-soft, rgba(43,122,120,0.08));
  color: var(--sage);
  border: 1px solid var(--sage-light, rgba(43,122,120,0.2));
}

/* Theme summary — Pillar's "why this cluster matters" sentence.
   Sits between cluster name and labels block. Italic + muted to read
   as a clinical claim, not data. */
.ct-card-theme {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.ct-card-labels {
  margin-bottom: 10px;
}

/* "+N more" expand affordance. Subdued by design — labels themselves
   are secondary to the theme. */
.ct-labels-more {
  padding: 4px 0 2px;
}
.ct-labels-more a {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.ct-labels-more a:hover {
  color: var(--sage);
  text-decoration: underline;
}
.ct-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.ct-label-name {
  flex: 0 0 140px;
  font-size: 0.75rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ct-label-bar-track {
  flex: 1;
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
  min-width: 40px;
}
.ct-label-bar-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 3px;
  transition: width 300ms ease-out;
}
.ct-card-paused .ct-label-bar-fill {
  background: var(--ink-faint);
}
.ct-label-weight {
  flex: 0 0 32px;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-muted);
}

.ct-card-meta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
  margin-bottom: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}
.ct-card-actions {
  display: flex;
  gap: 6px;
}

.ct-empty {
  padding: 16px 14px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-faint);
  line-height: 1.5;
}

/* ─── PC Summary sub-tab bar v2 (segmented pill control) ─── */
/* Grain L393 spec. Replaces v1 underline style (JJ-rejected).
   Raised pill on paper-dark track. Icon + label per tab.
   Sage icon accent on active. Brass badge on Inbox. */

.pc-subtab-bar {
  display: flex;
  gap: 4px;
  background: var(--paper-dark);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 24px;
  margin-top: 8px;
}

.pc-subtab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.pc-subtab:hover:not(.active) {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.03);
}

.pc-subtab.active {
  background: var(--card-bg);
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
              0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* Icon treatment */
.pc-subtab-icon {
  font-size: 15px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.18s ease, color 0.18s ease;
}
.pc-subtab.active .pc-subtab-icon {
  opacity: 1;
  color: var(--sage);
}
.pc-subtab:hover:not(.active) .pc-subtab-icon {
  opacity: 0.8;
}

/* Inbox badge — brass pill */
.pc-subtab-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--paper);
  margin-left: 2px;
}
.pc-subtab-badge:empty,
.pc-subtab-badge[data-count="0"] {
  display: none;
}

.pc-subtab-panel {
  display: none;
}
.pc-subtab-panel.active {
  display: block;
}

.pc-inbox-clear {
  padding: 40px 20px;
  text-align: center;
}
.pc-inbox-clear-text {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--navy);
  margin: 0 0 8px;
}
.pc-inbox-clear-hint {
  font-size: 0.8125rem;
  color: var(--ink-faint);
  line-height: 1.5;
  margin: 0;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  .pc-subtab {
    padding: 8px 12px;
    font-size: 0.8125rem;
    gap: 5px;
  }
  .pc-subtab-icon {
    font-size: 14px;
  }
  .pc-subtab-bar {
    margin-bottom: 20px;
  }
}
@media (max-width: 480px) {
  .pc-subtab-bar {
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
  }
  .pc-subtab {
    padding: 8px 8px;
    font-size: 0.75rem;
    gap: 4px;
  }
  .pc-subtab-icon {
    font-size: 13px;
  }
}

/* Cross-tab inline link in section headers (Blueprint L390 — Profile<->TP).
   Subordinate to the section-title type. Sage hover matches existing PC
   inline-link patterns. */
.pc-cross-link {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--sage);
  text-decoration: none;
  margin-left: 10px;
  vertical-align: middle;
  letter-spacing: 0.01em;
}
.pc-cross-link:hover {
  text-decoration: underline;
}
