:root {
  --bg: #eef3ef;
  --panel: #ffffff;
  --panel-soft: #f7faf6;
  --ink: #17221f;
  --muted: #65716d;
  --line: #dce5df;
  --green: #184e43;
  --green-2: #2f7666;
  --mint: #d9eee6;
  --yellow: #f4c94d;
  --coral: #c75d4d;
  --blue: #385f86;
  --purple: #69528e;
  --shadow: 0 18px 48px rgba(21, 39, 34, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 243, 239, 0.86)),
    radial-gradient(900px 320px at 50% 0, rgba(24, 78, 67, 0.18), rgba(24, 78, 67, 0) 70%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid rgba(24, 78, 67, 0.13);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: grid;
  gap: 12px;
}

.wb-wordmark {
  display: block;
  max-width: 100%;
  color: var(--green);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.preview-mark,
.status-pill,
.source-pill,
.system-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  white-space: nowrap;
}

.preview-mark {
  padding: 5px 9px;
  color: #214941;
  background: var(--mint);
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: #cfe0d7;
  background: #f4f8f5;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mini-label,
.metric-label,
.eyebrow,
.doc-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-transform: uppercase;
}

.chip-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.system-chip {
  padding: 6px 8px;
  color: #24433d;
  background: #eef5f1;
  font-size: 12px;
  font-weight: 700;
}

.workspace {
  width: min(100%, 1440px);
  padding: 24px;
}

.topbar,
.section-head,
.document-toolbar,
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  min-height: 82px;
  margin-bottom: 14px;
}

.topbar h1,
.section-head h2,
.review-panel h2,
.roi-result strong {
  margin: 0;
}

.topbar h1 {
  font-size: 30px;
  line-height: 1.08;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-2);
}

.topbar-actions,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.link-btn {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-btn {
  padding: 0 16px;
  border: 1px solid var(--green);
  color: #ffffff;
  background: var(--green);
}

.primary-btn:hover {
  background: #0f3b32;
}

.secondary-btn,
.ghost-btn {
  padding: 0 13px;
  border: 1px solid #ccd9d2;
  color: var(--green);
  background: #ffffff;
}

.ghost-btn {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
}

.link-btn {
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  color: var(--green);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.privacy-banner,
.context-strip,
.work-panel,
.review-panel,
.document-panel,
.participant-card,
.source-card,
.compliance-card,
.roi-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.privacy-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 14px;
  color: #2c3b37;
  border-color: #cbded7;
  background: #f2fbf7;
}

.context-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
}

.context-strip div {
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7faf6;
}

.context-strip strong {
  display: block;
  margin-top: 3px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  margin-bottom: 14px;
}

.section-head.compact {
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 22px;
  line-height: 1.2;
}

.participant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.participant-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 12px;
  min-height: 162px;
  padding: 16px;
  text-align: left;
}

.participant-card:hover,
.participant-card.selected {
  border-color: var(--green-2);
}

.participant-avatar {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 900;
}

.participant-main {
  display: grid;
  gap: 4px;
}

.participant-main strong {
  font-size: 18px;
}

.participant-main em,
.participant-main span {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.participant-status {
  grid-column: 2;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  color: #1f453e;
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.work-panel,
.review-panel {
  padding: 18px;
}

.intake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-card {
  min-height: 260px;
  padding: 14px;
  box-shadow: none;
}

.source-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.source-card h3,
.document-toolbar h3,
.source-drawer h3,
.compliance-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.source-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.source-dot.referral {
  background: var(--blue);
}

.source-dot.pbsp {
  background: var(--green-2);
}

dl,
.goal-section dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  line-height: 1.42;
}

.source-card p,
.source-drawer p,
.care-section p,
.progress-summary p,
.goal-section dd,
.goal-section li,
.privacy-banner span,
.roi-result p {
  color: #34413d;
  line-height: 1.55;
}

.verbatim-line {
  padding: 10px;
  border-left: 4px solid var(--coral);
  background: #fff4f1;
}

.reading-pane {
  display: grid;
  gap: 8px;
  min-height: 56px;
  margin: 14px 0;
}

.stream-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid #dce7e1;
  border-radius: 8px;
  background: #f7fbf9;
}

.stream-row span {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

.stream-row p {
  margin: 0;
  line-height: 1.45;
}

.document-panel {
  overflow: hidden;
  box-shadow: none;
}

.document-toolbar {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.care-sections,
.progress-sections {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.care-section,
.goal-section,
.progress-summary {
  padding: 14px;
  border: 1px solid #e1e8e4;
  border-radius: 8px;
  background: #ffffff;
}

.care-section h4,
.goal-section h4,
.progress-summary h4 {
  margin: 0;
  font-size: 17px;
}

.risk-section {
  border-color: #efc0b7;
  background: #fff9f7;
}

.section-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.source-pill {
  padding: 5px 8px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

.source-pill.referral {
  background: var(--blue);
}

.source-pill.pbsp {
  background: var(--green-2);
}

.source-pill.synthesis {
  background: var(--purple);
}

.source-pill.verbatim {
  background: var(--coral);
}

.status-pill {
  padding: 5px 8px;
  color: #1f463f;
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.danger {
  color: #713026;
  background: #ffe1dc;
}

.check-list {
  display: grid;
  gap: 11px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  line-height: 1.45;
}

.check {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border-radius: 5px;
  background: var(--line);
}

.check.on {
  background: var(--green-2);
}

.check.warn {
  background: var(--yellow);
}

.folder-preview {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 124px;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid #cfded6;
  border-radius: 8px;
  background: #f4f8f5;
}

.folder-tab {
  position: absolute;
  top: -9px;
  left: 18px;
  width: 76px;
  height: 18px;
  border: 1px solid #cfded6;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f4f8f5;
}

.folder-preview strong {
  margin-top: 5px;
}

.folder-preview span,
.folder-preview em {
  color: var(--muted);
  font-style: normal;
}

.folder-preview.filed {
  border-color: var(--green-2);
  background: #eefaf5;
}

.source-drawer {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.drawer-source-list {
  display: grid;
  gap: 8px;
}

.drawer-source {
  display: grid;
  gap: 6px;
  padding: 9px;
  border-radius: 8px;
  background: #f7faf6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stats-grid div {
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf6;
}

.stats-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
}

.note-table {
  display: grid;
  gap: 6px;
}

.note-row {
  display: grid;
  grid-template-columns: 54px minmax(64px, 1fr) minmax(86px, 1fr);
  gap: 8px;
  padding: 9px;
  border: 1px solid #e2e9e5;
  border-radius: 8px;
  background: #ffffff;
  font-size: 12px;
}

.note-row span:nth-child(4) {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid #edf2ef;
  line-height: 1.45;
}

.note-head {
  color: var(--muted);
  background: #f4f8f5;
  font-weight: 900;
  text-transform: uppercase;
}

.goal-section dl div {
  padding: 9px;
  border-radius: 8px;
  background: #f7faf6;
}

.incident-block {
  border-color: #efc0b7;
}

.incident-block ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.compliance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compliance-card {
  display: grid;
  gap: 10px;
  min-height: 170px;
  padding: 16px;
  box-shadow: none;
}

.compliance-card strong {
  font-size: 24px;
}

.compliance-card.good {
  border-color: #bddbcf;
}

.compliance-card.warn {
  border-color: #e7d392;
}

.compliance-card.bad {
  border-color: #e7aaa2;
}

.roi-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.roi-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.roi-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.roi-controls input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #cfded6;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.roi-result {
  display: grid;
  align-content: center;
  min-height: 260px;
  padding: 20px;
}

.roi-result strong {
  margin: 10px 0 0;
  color: var(--green);
  font-size: 54px;
  line-height: 1;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 44px));
  padding: 12px 14px;
  border: 1px solid #cfded6;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .two-column,
  .roi-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-panel {
    position: static;
  }

  .participant-grid,
  .compliance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(238, 243, 239, 0.95)),
      var(--bg);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(24, 78, 67, 0.13);
  }

  .brand-lockup {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .wb-wordmark {
    font-size: 19px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .section-head,
  .document-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .context-strip,
  .participant-grid,
  .intake-grid,
  .stats-grid,
  .compliance-grid,
  .roi-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .note-row {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .note-row span:nth-child(3),
  .note-row span:nth-child(4) {
    grid-column: 1 / -1;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar-actions,
  .privacy-banner,
  .context-strip,
  .review-panel,
  .reading-pane,
  .toast {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .two-column {
    display: block;
    width: auto;
    padding: 0;
  }

  .work-panel,
  .document-panel,
  .care-section,
  .goal-section {
    box-shadow: none;
  }
}

/* Editable intake fields — the live "try it yourself" surface */
.edit-hint {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 12px;
}
.edit-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.edit-row label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.edit-field {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--panel-soft);
  resize: vertical;
}
.edit-field:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(24, 78, 67, 0.12);
}
.stream-row.pending span {
  animation: ympulse 1s ease-in-out infinite;
}
.stream-row.done span {
  background: var(--green);
}
@keyframes ympulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ===== Overview + Compliance dashboard ===== */
.role-toggle, .lead-control { display: flex; align-items: center; gap: 6px; }
.lead-control { font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.role-btn, .lead-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.lead-btn { padding: 5px 11px; font-size: 12px; }
.role-btn.active, .lead-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.ov-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ov-label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ov-value { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.ov-sub { font-size: 12px; color: var(--muted); }
.ov-tile.good { border-left-color: var(--green); }
.ov-tile.warn { border-left-color: var(--yellow); }
.ov-tile.bad { border-left-color: var(--coral); }
.ov-tile.accent { border-left-color: var(--blue); }
.ov-tile.audit { grid-column: span 2; background: linear-gradient(180deg, #ffffff, var(--panel-soft)); }
.ov-meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0 2px; }
.ov-meter span { display: block; height: 100%; background: var(--green); }
.ov-tile.audit.warn .ov-meter span { background: var(--yellow); }
.ov-tile.audit.bad .ov-meter span { background: var(--coral); }

.overview-clear { display: none; }
.overview-clear.show { display: block; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px; font-weight: 700; }
.overview-clear.good { background: var(--mint); color: #1f463f; }
.overview-clear.warn { background: #fbecc2; color: #6b531a; }
.overview-clear.bad { background: #ffe1dc; color: #713026; }

.quarter-bar { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.qbar-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.qbar-head strong { color: var(--ink); }
.qbar-track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.qbar-track span { display: block; height: 100%; background: var(--blue); }

/* The demo status strip (selected participant / document status / data mode) is
   only meaningful on the Care Plans and Progress Reports flows (one participant +
   a draft document in focus). Hide it on every other tab. */
.workspace:has(> .view[data-panel="overview"].active) > .context-strip,
.workspace:has(> .view[data-panel="participants"].active) > .context-strip,
.workspace:has(> .view[data-panel="compliance"].active) > .context-strip,
.workspace:has(> .view[data-panel="roi"].active) > .context-strip {
  display: none;
}

/* Topbar actions (Print draft / Generate care plan) only belong on the Care
   Plans tab. Hide them on every other tab. */
.workspace:has(> .view[data-panel="overview"].active) > .topbar > .topbar-actions,
.workspace:has(> .view[data-panel="participants"].active) > .topbar > .topbar-actions,
.workspace:has(> .view[data-panel="progress"].active) > .topbar > .topbar-actions,
.workspace:has(> .view[data-panel="compliance"].active) > .topbar > .topbar-actions,
.workspace:has(> .view[data-panel="roi"].active) > .topbar > .topbar-actions {
  display: none;
}

/* Overview · bento grid: compliance tile (2x2) + enriched stat tiles + report bar. */
.overview-bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.overview-bento .ov-tile { margin: 0; }

/* Compact "Compliance & assets" tile — spans 2 columns × 2 rows. */
.ca-tile { grid-column: span 2; grid-row: span 2; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.ca-tile.good { border-left-color: var(--green-2); }
.ca-tile.warn { border-left-color: var(--yellow); }
.ca-tile.bad { border-left-color: var(--coral); }
.ca-top { display: flex; justify-content: space-between; gap: 14px; padding: 15px 17px 10px; }
.ca-top h3 { margin: 2px 0 0; font-size: 18px; color: var(--ink); }
.ca-counts { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.ca-audit { flex: none; text-align: center; background: linear-gradient(180deg, #fff, var(--panel-soft)); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; min-width: 120px; }
.ca-pct { font-size: 26px; font-weight: 800; color: var(--green); line-height: 1; }
.ca-albl { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.ca-meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0 4px; }
.ca-meter span { display: block; height: 100%; background: var(--green); }
.ca-audit.warn .ca-meter span { background: var(--yellow); }
.ca-audit.bad .ca-meter span { background: var(--coral); }
.ca-asub { font-size: 10px; color: var(--muted); }
.ca-rows { border-top: 1px solid var(--line); flex: 1; }
.ca-row { display: flex; align-items: center; gap: 11px; padding: 9px 17px; border-bottom: 1px solid var(--line); }
.ca-row:last-child { border-bottom: none; }
.ca-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: var(--panel-soft); border: 1px solid var(--line); }
.ca-row.over .ca-ic { background: #ffe1dc; border-color: #f3c8c0; }
.ca-main { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ca-main em { display: block; font-weight: 400; font-style: normal; font-size: 11px; color: var(--muted); }
.ca-pill { flex: none; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 10px; }
.ca-pill.red { background: var(--coral); color: #fff; }
.ca-pill.amber { background: var(--yellow); color: #5a4410; }
.ca-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 17px; background: var(--panel-soft); font-size: 12.5px; color: var(--muted); }
.ca-foot .link-btn { color: var(--green-2); font-weight: 700; }

/* Enriched stat tiles (second layer of detail). */
.ov-split { display: flex; height: 7px; border-radius: 999px; overflow: hidden; margin: 6px 0 3px; background: var(--line); }
.ov-split i { display: block; height: 100%; }
.ov-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.ov-legend b { color: var(--ink); font-weight: 700; }
.ov-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.ov-stages { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; font-size: 12.5px; color: var(--ink); }
.ov-stages em { color: var(--muted); font-style: normal; }
.ov-break { font-size: 13px; color: var(--ink); margin-top: 2px; }
.ov-break b { font-weight: 700; }

/* Reporting-season bar spans the full bento width. */
.ov-report { grid-column: 1 / -1; margin-top: 0; }

@media (max-width: 860px) {
  .overview-bento { grid-template-columns: repeat(2, 1fr); }
  .ca-tile { grid-column: span 2; grid-row: auto; }
  .ca-top { flex-direction: column; }
  .ca-audit { align-self: stretch; }
}

.compliance-board { display: grid; gap: 18px; }
.cmp-cat { display: grid; gap: 8px; }
.cmp-cat h3 { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); margin: 0; }
.cmp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}
.cmp-row.overdue { border-left-color: var(--coral); }
.cmp-row.soon { border-left-color: var(--yellow); }
.cmp-row.clear { border-left-color: var(--green); }
.cmp-main { display: flex; flex-direction: column; gap: 2px; }
.cmp-main strong { font-size: 14px; color: var(--ink); }
.cmp-main span { font-size: 12px; color: var(--muted); }
.cmp-meta { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.cmp-due { font-size: 12px; color: var(--muted); }
.status-pill.overdue { color: #713026; background: #ffe1dc; }
.status-pill.soon { color: #6b531a; background: #fbecc2; }
.status-pill.clear { color: #1f463f; background: var(--mint); }

@media (max-width: 720px) {
  .ov-tile.audit { grid-column: span 1; }
  .cmp-row { flex-direction: column; align-items: flex-start; }
  .cmp-meta { width: 100%; justify-content: space-between; }
}

/* ===== Meet & greet (3rd input) + upload affordance ===== */
.intake-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.source-dot.meetgreet { background: #d98a2e; }
.source-pill.meetgreet { color: #6b4a14; background: #f6e2c0; }
.upload-affordance { margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; }
.upload-btn {
  border: 1px dashed var(--line);
  background: var(--panel-soft);
  color: var(--green);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.upload-btn:hover:not(:disabled) { border-color: var(--green); }
.upload-btn:disabled { opacity: 0.6; cursor: default; }
.upload-note { font-size: 11px; color: var(--muted); font-style: italic; }

/* Care inputs full-width: taller text boxes + spacing */
textarea.edit-field { min-height: 76px; }
[data-panel="care"] .intake-grid { margin-bottom: 14px; }
[data-panel="care"] .reading-pane { margin-bottom: 14px; }

/* New-participant / reset buttons + document upload control */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.intake-upload { margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
[data-panel="care"] .intake-upload .upload-btn { width: 100%; }

/* Meet & greet card: let the notes box grow to fill the empty space */
.meetgreet-card { display: flex; flex-direction: column; }
.meetgreet-card [data-bind="meetgreet-summary"] { flex: 1; display: flex; flex-direction: column; }
.meetgreet-card [data-bind="meetgreet-summary"] .edit-row { flex: 1; display: flex; flex-direction: column; }
.meetgreet-card [data-bind="meetgreet-summary"] textarea.edit-field { flex: 1; min-height: 220px; }

/* ---- Editable progress-report draft (click any text to edit in place) ---- */
.progress-sections .edit-hint {
  background: var(--mint);
  color: var(--green);
  font-style: normal;
  border-radius: 8px;
  padding: 8px 12px;
}
.progress-sections [data-pedit] {
  border-radius: 4px;
  cursor: text;
  transition: background .12s, box-shadow .12s;
}
.progress-sections [data-pedit]:hover {
  background: #f3f8f4;
  box-shadow: inset 0 0 0 1px var(--line);
}
.progress-sections [data-pedit]:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--green-2);
}

/* ---- Reportable-incident flags (NDIS Commission notification heuristic) ---- */
.incident-block .inc-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--coral);
  margin: 4px 0 10px;
}
.incident-block .inc-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.incident-block .inc-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--panel-soft);
  border-left: 3px solid var(--line);
}
.incident-block .inc-row.inc-report { border-left-color: var(--coral); background: #fdf1ee; }
.incident-block .inc-row.inc-review { border-left-color: var(--yellow); background: #fdf8e8; }
.incident-block .inc-flag {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: #e7ede9;
}
.incident-block .inc-flag.inc-report { color: #fff; background: var(--coral); }
.incident-block .inc-flag.inc-review { color: #6b531a; background: var(--yellow); }
.incident-block .inc-text { font-size: 13px; line-height: 1.5; color: var(--ink); }

/* "What the AI reads" sub-line on the Progress Reports input panel */
.review-sub { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
