:root {
  --ink: #142927;
  --muted: #61716f;
  --surface: #ffffff;
  --canvas: #f3f7f5;
  --line: #d7e1de;
  --teal-900: #103e3a;
  --teal-700: #17645c;
  --teal-100: #dcece8;
  --eucalyptus: #8bb5a8;
  --amber: #d89b35;
  --coral: #c85e4b;
  --navy: #173349;
  --radius: 0.5rem;
  --shadow: 0 0.5rem 1.5rem rgb(20 41 39 / 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 0.2rem solid var(--amber); outline-offset: 0.15rem; }

.skip-link {
  position: fixed; top: 0.75rem; left: 0.75rem; z-index: 100;
  padding: 0.65rem 0.9rem; color: #fff; background: var(--navy); border-radius: var(--radius);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 1.5rem 1rem;
  display: flex; flex-direction: column; color: #e9f4f1; background: var(--teal-900);
}
.brand { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.5rem 1.75rem; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  color: var(--teal-900); background: #d9ede7; border-radius: 50%; font-family: Georgia, serif; font-size: 1.25rem;
}
.brand div { display: grid; line-height: 1.15; }
.brand span:last-child { color: #a9c5be; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
nav { display: grid; gap: 0.3rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding: 0.65rem 0.75rem;
  color: #bfd5cf; border-radius: var(--radius); text-decoration: none; font-weight: 600;
}
.nav-item:hover { color: #fff; background: rgb(255 255 255 / 0.07); }
.nav-item.is-active { color: #fff; background: rgb(255 255 255 / 0.12); }
.nav-item > span { width: 1.25rem; color: var(--eucalyptus); text-align: center; }
.sidebar-note {
  margin-top: auto; padding: 0.85rem; display: flex; gap: 0.65rem; align-items: flex-start;
  border: 1px solid rgb(255 255 255 / 0.15); border-radius: var(--radius);
}
.sidebar-note div { display: grid; }
.sidebar-note span:last-child { color: #a9c5be; font-size: 0.75rem; }
.status-dot { width: 0.55rem; height: 0.55rem; margin-top: 0.35rem; background: #80c69e; border-radius: 50%; }
.sidebar-footer { margin-top: auto; display: grid; gap: 0.65rem; }
.sidebar-footer .sidebar-note { margin-top: 0; }
.staff-identity { min-width: 0; padding: 0.7rem 0.6rem; display: flex; gap: 0.65rem; align-items: center; border-top: 1px solid rgb(255 255 255 / 0.1); }
.staff-identity-avatar { width: 2rem; height: 2rem; flex: 0 0 auto; display: grid; place-items: center; color: var(--teal-900); background: var(--signal-soft, #e9f4cf); border-radius: 50%; font-size: 0.68rem; font-weight: 850; }
.staff-identity div { min-width: 0; display: grid; }
.staff-identity strong, .staff-identity span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-identity strong { color: #f4faf8; font-size: 0.72rem; }
.staff-identity span:last-child { color: #87a29d; font-size: 0.62rem; }

main { width: min(100%, 90rem); padding: 2.25rem clamp(1rem, 3vw, 3rem) 4rem; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 2.5rem; }
.page-description { max-width: 42rem; margin: 0.55rem 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 0.25rem; color: var(--teal-700); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: -0.025em; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 500; line-height: 1.05; }
h2 { font-size: 1.05rem; }
.quick-actions { margin: -1rem 0 2rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.quick-actions button { min-width: 0; padding: 0.85rem; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0 0.65rem; color: var(--ink); text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 0.2rem 0.7rem rgb(20 41 39 / 0.04); }
.quick-actions button:hover { border-color: var(--eucalyptus); transform: translateY(-1px); }
.quick-actions button > span { grid-row: 1 / 3; width: 2rem; height: 2rem; display: grid; place-items: center; color: var(--teal-700); background: var(--teal-100); border-radius: 50%; }
.quick-actions strong { overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.quick-actions small { overflow: hidden; color: var(--muted); font-size: 0.7rem; text-overflow: ellipsis; white-space: nowrap; }

.primary-button, .secondary-button, .text-button, .icon-button {
  border: 0; border-radius: var(--radius); font-weight: 750;
}
.primary-button { padding: 0.7rem 1rem; color: #fff; background: var(--teal-700); }
.primary-button:hover { background: var(--teal-900); }
.secondary-button { padding: 0.7rem 1rem; color: var(--ink); background: var(--teal-100); }
.text-button { padding: 0.35rem 0; color: var(--teal-700); background: transparent; }
.icon-button { width: 2.25rem; height: 2.25rem; color: var(--muted); background: transparent; font-size: 1.5rem; }

section { margin-top: 2rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.section-heading p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }
.section-heading.compact { margin-bottom: 1.1rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { min-height: 7.5rem; padding: 1.15rem 1.25rem; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.metric-value { display: block; margin-top: 0.65rem; font-family: Georgia, serif; font-size: 2.25rem; line-height: 1; }
.metric-note { display: block; margin-top: 0.55rem; color: var(--muted); font-size: 0.75rem; }
.metric-skeleton, .list-skeleton { background: linear-gradient(90deg, #edf2f0 25%, #f7faf9 50%, #edf2f0 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.metric-skeleton { height: 7.5rem; border-right: 1px solid var(--line); }

.reporting-workspace { scroll-margin-top: 1rem; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.reporting-titlebar { padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; color: #f2f7f9; background: var(--navy); }
.reporting-titlebar h2 { font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.reporting-titlebar p:last-child { margin: 0.25rem 0 0; color: #bfd0dc; font-size: 0.85rem; }
.reporting-titlebar .eyebrow { color: #9dcac0; }
.report-freshness { flex: none; padding: 0.65rem 0.8rem; display: flex; gap: 0.6rem; align-items: flex-start; color: var(--ink); background: #edf5f2; border-radius: var(--radius); }
.report-freshness div { display: grid; }
.report-freshness strong { font-size: 0.75rem; }
.report-freshness small { color: var(--muted); font-size: 0.68rem; }
.report-filters { padding: 0.9rem 1.25rem; display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(9rem, 0.7fr) auto auto minmax(12rem, auto); gap: 0.75rem; align-items: end; background: #f5f8f7; border-bottom: 1px solid var(--line); }
.report-filters label { margin: 0; color: var(--muted); font-size: 0.68rem; }
.report-filters select, .report-filters input { min-height: 2.4rem; padding: 0.4rem 0.55rem; font-size: 0.76rem; }
.report-filters .primary-button { min-height: 2.4rem; padding-block: 0.4rem; }
.alert-settings { position: relative; margin: 0; padding: 0; background: transparent; border: 0; }
.alert-settings summary { min-height: 2.4rem; padding: 0.5rem 0.65rem; background: #fff; border: 1px solid var(--line); border-radius: 0.35rem; font-size: 0.75rem; }
.alert-settings[open] > div { position: absolute; z-index: 4; top: calc(100% + 0.35rem); right: 0; width: 15rem; padding: 0.75rem; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.report-export-actions { display: flex; justify-content: flex-end; gap: 0.65rem; align-items: center; }
.report-export-actions button { font-size: 0.75rem; }
.report-alerts { padding: 0 1.25rem; }
.report-alert, .report-all-clear { margin-top: 0.75rem; padding: 0.7rem 0.85rem; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; border-left: 0.2rem solid var(--amber); background: #fff8e8; }
.report-alert.urgent { color: #6e3027; background: #fff2ee; border-left-color: var(--coral); }
.report-all-clear { color: #20523f; background: #edf7f2; border-left-color: #58a27f; }
.report-alert > span, .report-all-clear > span { width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-weight: 850; }
.report-alert div, .report-all-clear div { display: grid; }
.report-alert p, .report-all-clear p { margin: 0; color: inherit; font-size: 0.75rem; opacity: 0.82; }
.report-alert b { font-family: Georgia, serif; font-size: 1.35rem; }
.report-metrics { padding: 1rem 1.25rem; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.report-metric { min-height: 7.2rem; padding: 0.85rem 1rem; display: grid; align-content: start; border-right: 1px solid var(--line); }
.report-metric:last-child { border-right: 0; }
.report-metric > span { color: var(--muted); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.report-metric > strong { margin-top: 0.45rem; font-family: Georgia, serif; font-size: 1.9rem; font-weight: 500; }
.report-metric > small { margin-top: 0.35rem; color: var(--muted); font-size: 0.68rem; line-height: 1.35; }
.report-chart-grid, .report-table-grid, .report-detail-grid { padding: 0 1.25rem 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.report-table-grid { grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr); }
.report-detail-grid { grid-template-columns: minmax(16rem, 0.65fr) minmax(0, 1.35fr); }
.report-card { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.report-card-heading { min-height: 4.5rem; padding: 0.85rem 1rem; display: flex; justify-content: space-between; gap: 0.75rem; align-items: start; border-bottom: 1px solid var(--line); }
.report-card-heading h3 { margin: 0; font-family: Georgia, serif; font-size: 1.05rem; font-weight: 500; }
.report-card-heading p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.72rem; }
.chart-legend { display: flex; gap: 0.65rem; color: var(--muted); font-size: 0.65rem; }
.chart-legend span { display: flex; gap: 0.25rem; align-items: center; }
.chart-legend i { width: 0.55rem; height: 0.55rem; background: var(--teal-700); }
.chart-legend i.surveyed { background: var(--amber); }
.funnel-chart { padding: 1rem; display: grid; gap: 0.7rem; }
.funnel-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 2.5rem; gap: 0.65rem; align-items: center; }
.funnel-row > div:first-child { min-width: 0; display: grid; }
.funnel-row strong { font-size: 0.75rem; }
.funnel-row div > span { color: var(--muted); font-size: 0.65rem; }
.funnel-row > b { font-family: Georgia, serif; font-size: 1rem; text-align: right; }
.funnel-track { height: 1.35rem; overflow: hidden; background: #edf2f0; }
.funnel-track > span { width: var(--bar-width); height: 100%; display: block; background: var(--teal-700); }
.funnel-row:nth-child(2) .funnel-track > span { background: #4f887e; }
.funnel-row:nth-child(3) .funnel-track > span { background: #7ca99c; }
.funnel-row:nth-child(4) .funnel-track > span { background: var(--amber); }
.trend-chart { height: 15rem; padding: 1rem 1rem 0.75rem; display: flex; gap: 0.45rem; align-items: stretch; }
.trend-period { min-width: 0; flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.35rem; text-align: center; }
.trend-bars { min-height: 0; display: flex; gap: 0.16rem; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); }
.trend-bars span { width: min(0.8rem, 42%); height: var(--bar-height); min-height: 0.12rem; background: var(--teal-700); }
.trend-bars span.surveyed { background: var(--amber); }
.trend-period small { overflow: hidden; color: var(--muted); font-size: 0.58rem; text-overflow: ellipsis; white-space: nowrap; }
.responsive-table { width: 100%; overflow-x: auto; }
.responsive-table table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.responsive-table th, .responsive-table td { padding: 0.65rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.responsive-table thead th { color: var(--muted); background: #f5f8f7; font-size: 0.62rem; letter-spacing: 0.04em; text-transform: uppercase; }
.responsive-table tbody th { font-weight: 750; }
.responsive-table td small { display: block; color: var(--muted); text-transform: capitalize; }
.responsive-table tr:last-child th, .responsive-table tr:last-child td { border-bottom: 0; }
.responsive-table .attention-cell { color: #8a392e; font-weight: 800; }
.overdue-row { background: #fff8f6; }
.capacity-meter { min-width: 7rem; display: grid; grid-template-columns: minmax(3.5rem, 1fr) auto; gap: 0.4rem; align-items: center; }
.capacity-meter progress { width: 100%; height: 0.45rem; accent-color: var(--teal-700); }
.capacity-meter.over progress { accent-color: var(--coral); }
.capacity-meter span { font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.overdue-label { display: block; width: fit-content; margin-top: 0.2rem; color: #8a392e; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; }
.report-patient-link { padding: 0; color: var(--teal-700); background: transparent; border: 0; font-weight: 750; text-align: left; }
.report-patient-link:hover { text-decoration: underline; }
.quality-list { padding: 0.25rem 0.9rem; }
.quality-signal { padding: 0.65rem 0; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; border-bottom: 1px solid var(--line); }
.quality-signal:last-child { border-bottom: 0; }
.quality-signal > span { width: 1.45rem; height: 1.45rem; display: grid; place-items: center; color: #20523f; background: #dff2e9; border-radius: 50%; font-size: 0.7rem; font-weight: 850; }
.quality-signal.attention > span { color: #7a5417; background: #f8ecd5; }
.quality-signal p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.68rem; }
.quality-signal b { font-family: Georgia, serif; font-size: 1.1rem; }

.pathway-panel { padding: 1.25rem; background: var(--navy); color: #f2f7f9; border-radius: var(--radius); box-shadow: var(--shadow); }
.pathway-panel p { color: #b7c8d2; }
.pathway-rail { margin: 1.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); list-style: none; }
.pathway-rail li { position: relative; display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.pathway-rail li:not(:last-child)::after { content: ""; position: absolute; top: 1rem; left: 2rem; right: 0.45rem; height: 1px; background: #557184; }
.pathway-rail li > span { position: relative; z-index: 1; width: 2rem; height: 2rem; flex: 0 0 auto; display: grid; place-items: center; color: var(--navy); background: #c9e1d9; border-radius: 50%; font-weight: 800; }
.pathway-rail div { display: grid; position: relative; z-index: 1; padding-right: 0.5rem; background: var(--navy); }
.pathway-rail small { color: #a9bcc7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr); gap: 1rem; }
.data-panel { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.data-panel .section-heading { padding: 1.15rem 1.25rem 0; }
.panel-content { min-height: 12rem; border-top: 1px solid var(--line); }
.list-skeleton { height: 3.8rem; margin: 0.75rem; border-radius: 0.25rem; }
.patient-row, .task-row { display: grid; align-items: center; gap: 0.75rem; min-height: 4.35rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--line); }
.patient-row { grid-template-columns: 2.25rem minmax(0, 1fr) auto; }
.task-row { grid-template-columns: 0.35rem minmax(0, 1fr) auto; }
.patient-row:last-child, .task-row:last-child { border-bottom: 0; }
.avatar { width: 2.25rem; height: 2.25rem; display: grid; place-items: center; color: var(--teal-900); background: var(--teal-100); border-radius: 50%; font-weight: 800; }
.row-copy { min-width: 0; display: grid; }
.row-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-copy small { color: var(--muted); }
.pill { padding: 0.25rem 0.5rem; color: var(--teal-900); background: var(--teal-100); border-radius: 99rem; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.priority-mark { width: 0.35rem; height: 2.4rem; background: var(--eucalyptus); border-radius: 99rem; }
.priority-mark.high, .priority-mark.urgent { background: var(--coral); }
.priority-mark.low { background: #9ba9a6; }
.queue-filters { padding: 0 1.25rem 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.queue-filters > div:first-child { grid-column: 1 / -1; }
.queue-filters label { margin: 0; color: var(--muted); font-size: 0.68rem; }
.queue-filters input, .queue-filters select { min-height: 2.25rem; padding: 0.4rem 0.5rem; font-size: 0.75rem; }
.patient-filters { padding: 0 1.25rem 1rem; display: grid; grid-template-columns: minmax(0, 1fr) 8rem; gap: 0.5rem; align-items: end; }
.patient-filters label { margin: 0; color: var(--muted); font-size: 0.68rem; }
.patient-filters input, .patient-filters select { min-height: 2.25rem; padding: 0.4rem 0.5rem; font-size: 0.75rem; }
.patient-row-meta { display: grid; justify-items: end; gap: 0.2rem; }
.patient-row-meta small { color: var(--muted); font-size: 0.62rem; font-weight: 750; text-transform: uppercase; }
.count-label { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.task-copy { gap: 0.1rem; }
.task-copy small { white-space: normal; }
.task-due.overdue { color: #9b3f31; font-weight: 750; }
.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; align-items: center; }
.task-priority-label { color: var(--muted); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; }
.task-row.is-overdue { background: #fff8f6; }
.empty-state { min-height: 12rem; padding: 2rem; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-state strong { font-family: Georgia, serif; font-size: 1.2rem; }
.empty-state p { max-width: 28rem; margin: 0.3rem 0 0; color: var(--muted); font-size: 0.85rem; }

.alert, .field-error { padding: 0.75rem 0.9rem; color: #772f25; background: #f8e3df; border-left: 0.25rem solid var(--coral); }
.is-hidden { display: none !important; }

dialog { width: min(32rem, calc(100% - 2rem)); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 1.5rem 5rem rgb(20 41 39 / 0.25); }
dialog::backdrop { background: rgb(16 62 58 / 0.55); backdrop-filter: blur(2px); }
dialog form { padding: 1.5rem; }
.dialog-header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.dialog-header h2 { font-family: Georgia, serif; font-size: 1.65rem; font-weight: 500; }
.dialog-intro { color: var(--muted); font-size: 0.9rem; }
label { display: block; margin: 1rem 0 0.35rem; font-size: 0.82rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 2.75rem; padding: 0.6rem 0.7rem; color: var(--ink); background: #fff; border: 1px solid #aabbb7; border-radius: 0.35rem; }
textarea { resize: vertical; }
.field-error { margin-top: 1rem; font-size: 0.85rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.65rem; margin-top: 1.5rem; }

.success { margin-bottom: 1rem; padding: 0.75rem 0.9rem; color: #174b38; background: #dff2e9; border-left: 0.25rem solid #58a27f; }
.row-button { width: 100%; color: inherit; background: transparent; border: 0; text-align: left; }
.row-button:hover { background: #f4f8f7; }
.compact-button { padding: 0.4rem 0.55rem; color: var(--teal-700); background: #fff; border: 1px solid var(--line); border-radius: 0.35rem; font-size: 0.75rem; font-weight: 750; }
.compact-button:hover { background: var(--teal-100); }
.compact-button:disabled { cursor: wait; opacity: 0.65; }
.compact-link { color: var(--teal-700); font-size: 0.72rem; font-weight: 750; text-decoration: none; }
.compact-link:hover { text-decoration: underline; }

.program-section { padding-top: 0.5rem; }
.program-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.program-card { min-height: 12rem; padding: 1.25rem; display: flex; flex-direction: column; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-top: 0.25rem solid var(--eucalyptus); border-radius: var(--radius); }
.program-card:nth-child(2) { border-top-color: var(--amber); }
.program-card:nth-child(3) { border-top-color: #6f8faa; }
.program-card h3 { margin: 0.65rem 0 0; font-family: Georgia, serif; font-size: 1.3rem; font-weight: 500; }
.program-card p { flex: 1; margin: 0.5rem 0 1rem; color: var(--muted); font-size: 0.85rem; }
.program-code { color: var(--teal-700); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.program-card-footer { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.lifecycle-badge { padding: 0.2rem 0.45rem; color: var(--teal-700); background: var(--teal-100); border-radius: 99rem; font-size: 0.65rem; font-weight: 850; letter-spacing: 0.04em; text-transform: uppercase; }
.lifecycle-badge.paused { color: #7a5417; background: #f8ecd5; }
.lifecycle-badge.archived { color: var(--muted); background: #e8edeb; }

.program-studio { margin-top: 2.5rem; scroll-margin-top: 1rem; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.studio-titlebar { padding: 1.5rem; display: flex; justify-content: space-between; align-items: start; gap: 1rem; color: #eef8f5; background: var(--navy); }
.studio-titlebar h2 { margin: 0.15rem 0 0.35rem; max-width: 42rem; font-family: Georgia, serif; font-size: clamp(1.55rem, 3vw, 2.25rem); font-weight: 500; line-height: 1.15; }
.studio-titlebar p:last-child { margin: 0; color: #bfd0dc; }
.studio-titlebar .eyebrow { color: #9dcac0; }
.studio-titlebar .primary-button { flex: none; color: var(--navy); background: #e4f0b8; border-color: #e4f0b8; }
.studio-commandbar { min-height: 4.75rem; padding: 0.75rem 1.25rem; display: flex; justify-content: space-between; align-items: end; gap: 1rem; border-bottom: 1px solid var(--line); }
.studio-commandbar > div:first-child { width: min(28rem, 100%); }
.studio-commandbar label { margin-top: 0; }
.studio-status { display: flex; align-items: center; gap: 0.65rem; color: var(--muted); font-size: 0.75rem; }
.studio-workbench { min-height: 42rem; display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); }
.studio-navigation { padding: 1rem 0.75rem; background: #f5f8f7; border-right: 1px solid var(--line); }
.studio-tab-list { display: block; }
.studio-tab { width: 100%; min-height: 2.5rem; padding: 0.55rem 0.75rem; color: var(--muted); background: transparent; border: 0; border-left: 0.2rem solid transparent; text-align: left; font-size: 0.82rem; font-weight: 750; }
.studio-tab:hover { color: var(--ink); background: #eaf1ef; }
.studio-tab.is-active { color: var(--teal-900); background: #dfece8; border-left-color: var(--teal-700); }
.studio-rail-label { margin: 1.5rem 0.75rem 0.45rem; color: var(--muted); font-size: 0.65rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.version-item { width: 100%; padding: 0.55rem 0.75rem; display: flex; justify-content: space-between; gap: 0.5rem; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.version-item span { font-size: 0.75rem; font-weight: 750; }
.version-item small { color: var(--muted); font-size: 0.65rem; }
.version-item.is-active { background: #fff; box-shadow: inset 0.18rem 0 var(--amber); }
.studio-canvas { min-width: 0; display: flex; flex-direction: column; }
.studio-panel { flex: 1; padding: 1.5rem; }
.studio-panel > h3, .studio-panel .subheading h3 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.integration-status { flex: none; padding: 0.25rem 0.55rem; color: var(--muted); background: #edf2f0; border-radius: 99rem; font-size: 0.68rem; font-weight: 800; }
.integration-status.ready { color: #20523f; background: #dff2e9; }
.integration-status.warning { color: #7a5417; background: #f8ecd5; }
.integration-card { margin-top: 1.25rem; padding: 1.2rem; border: 1px solid var(--line); border-top: 0.25rem solid #78a83b; border-radius: var(--radius); }
.integration-card-header { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.integration-card-header > div:nth-child(2) { display: grid; }
.integration-card-header small { color: var(--muted); font-size: 0.75rem; }
.integration-logo { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; color: #fff; background: #4d7f2d; border-radius: 0.55rem; font-family: Georgia, serif; font-size: 1.35rem; }
.switch-label { margin: 0; display: flex; gap: 0.45rem; align-items: center; }
.switch-label input { width: 1rem; min-height: 1rem; }
.integration-fields { display: grid; grid-template-columns: minmax(12rem, 0.7fr) minmax(16rem, 1.3fr); gap: 0.75rem; }
.callback-box { margin-top: 1rem; padding: 0.75rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; background: #f5f8f7; border: 1px solid var(--line); }
.callback-box > div { min-width: 0; display: grid; }
.callback-box span { color: var(--muted); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; }
.callback-box code { overflow: hidden; font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }
.integration-note { margin-top: 1rem; padding: 0.8rem; color: #314844; background: #f3f8e9; border-left: 0.2rem solid #78a83b; }
.integration-note p { margin: 0.25rem 0 0; font-size: 0.78rem; }
.studio-actions { position: sticky; bottom: 0; z-index: 2; padding: 0.85rem 1.25rem; display: flex; justify-content: flex-end; align-items: center; gap: 0.65rem; background: rgb(255 255 255 / 0.96); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.draft-save-state { margin-right: auto; color: var(--muted); font-size: 0.75rem; }
.draft-save-state.is-dirty { color: #8b5c10; font-weight: 750; }
.version-summary { margin-top: 1.25rem; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); }
.version-summary > div { padding: 0.85rem; display: grid; gap: 0.2rem; border-right: 1px solid var(--line); }
.version-summary > div:nth-child(5) { border-right: 0; }
.version-summary span { color: var(--muted); font-size: 0.65rem; font-weight: 750; text-transform: uppercase; }
.version-summary strong { font-size: 0.85rem; }
.version-summary > button { grid-column: 1 / -1; margin: 0.75rem; justify-self: start; }
.version-comparison { grid-column: 1 / -1; margin: 0; padding: 0.65rem 0.85rem; color: var(--muted); background: #f5f8f7; border-top: 1px solid var(--line); font-size: 0.75rem; }
.validation-results { margin-top: 1rem; }
.validation-success, .validation-errors { padding: 0.85rem 1rem; border-left: 0.25rem solid #58a27f; background: #e6f3ec; }
.validation-errors { color: #772f25; background: #f8e3df; border-left-color: var(--coral); }
.validation-results p { margin: 0.2rem 0 0; }
.education-library { margin-top: 1rem; }
.education-row { padding: 0.75rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.education-row div { display: grid; }
.education-row small { color: var(--muted); font-size: 0.72rem; }
.education-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.education-tools-grid { margin-top: 1.25rem; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr); gap: 1rem; align-items: start; }
.education-editor, .education-tester { min-width: 0; padding: 1rem; background: #f5f8f7; border-left: 0.2rem solid var(--eucalyptus); }
.education-editor h4, .education-tester h4 { margin: 0 0 0.35rem; font-family: "Iowan Old Style", Baskerville, Georgia, serif; font-size: 1.05rem; }
.education-tester { display: grid; background: #eef5f2; border-left-color: var(--teal-700); }
.education-tester .primary-button { justify-self: start; }
.education-test-result { min-height: 4rem; margin-top: 1rem; padding: 0.85rem; color: var(--muted); background: rgb(255 255 255 / 0.65); border: 1px dashed var(--line-strong); border-radius: var(--radius-small); font-size: 0.76rem; }
.education-test-result:empty { display: none; }
.education-test-result.is-loading { border-style: solid; }
.education-test-result.has-answer { color: var(--ink); background: #fff; border-style: solid; border-color: #9fcbbb; }
.education-test-result.has-error { color: #772f25; background: #f8e3df; border-style: solid; border-color: #e5afa7; }
.education-test-result p { margin: 0.35rem 0 0; line-height: 1.6; white-space: pre-wrap; }
.education-test-result details { margin-top: 0.65rem; }
.education-test-result ol { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.credential-state { margin: 1rem 0; padding: 0.65rem 0.75rem; display: grid; gap: 0.15rem; color: var(--muted); background: #f5f8f7; border-left: 0.2rem solid var(--line-strong); font-size: 0.72rem; }
.credential-state.is-active { color: #20523f; background: #e8f4ef; border-left-color: #58a27f; }
.credential-state span { color: var(--muted); font-size: 0.65rem; }
.model-boundary-note { margin: 1rem 0 1.25rem; padding: 0.9rem 1rem; background: #f5f8f7; border-left: 0.2rem solid var(--eucalyptus); }
.model-boundary-note p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8rem; }
.empty-state.compact { min-height: 8rem; }
.patient-profile { margin: 2rem 0; scroll-margin-top: 1rem; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.profile-header { padding: 1.25rem 1.5rem; display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; color: #eef8f5; background: var(--teal-900); }
.profile-header > .text-button { justify-self: start; color: #c7ded8; }
.profile-identity { display: flex; align-items: center; gap: 0.85rem; }
.profile-identity h2 { margin: 0.1rem 0; font-family: Georgia, serif; font-size: 1.75rem; font-weight: 500; }
.profile-identity p { margin: 0; color: #b8d0ca; }
.profile-identity .eyebrow { color: #8fc2b6; }
.profile-avatar { width: 3.5rem; height: 3.5rem; flex: none; display: grid; place-items: center; color: var(--teal-900); background: #e4f0b8; border-radius: 50%; font-family: Georgia, serif; font-size: 1.35rem; }
.profile-header-actions { justify-self: end; display: flex; align-items: center; gap: 0.65rem; }
.profile-header-actions .secondary-button { color: #fff; background: transparent; border-color: rgb(255 255 255 / 0.35); }
.profile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.profile-metrics .metric { min-height: 7rem; }
.profile-tabs { padding: 0 1.25rem; display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.profile-tab { min-height: 3.25rem; padding: 0.65rem 0.8rem; flex: none; color: var(--muted); background: transparent; border: 0; border-bottom: 0.2rem solid transparent; font-size: 0.8rem; font-weight: 750; }
.profile-tab:hover { color: var(--ink); }
.profile-tab.is-active { color: var(--teal-900); border-bottom-color: var(--teal-700); }
.profile-panel { padding: 1.25rem; }
.profile-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.profile-panel .workspace-section { margin-top: 0; }
.profile-enrolment { min-height: 4.5rem; padding: 0.75rem 0; display: grid; grid-template-columns: 0.3rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; border-bottom: 1px solid var(--line); }
.enrolment-program-mark { width: 0.3rem; height: 2.75rem; background: var(--eucalyptus); border-radius: 99rem; }
.profile-enrolment > div:nth-child(2), .profile-task > div { display: grid; }
.profile-enrolment small, .profile-task small { color: var(--muted); font-size: 0.72rem; text-transform: capitalize; }
.questionnaire-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; align-items: center; }
.source-chip { width: fit-content; margin-top: 0.25rem; padding: 0.12rem 0.38rem; color: #35504c; background: #edf2f0; border-radius: 99rem; font-size: 0.62rem; font-weight: 800; text-transform: none; }
.source-chip.formsg { color: #315225; background: #e7f4d8; }
.source-chip.native { color: var(--teal-700); background: var(--teal-100); }
.profile-task { min-height: 3.75rem; padding: 0.65rem 0; display: grid; grid-template-columns: 0.3rem minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; border-bottom: 1px solid var(--line); }
.timeline-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.timeline-toolbar h3 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 500; }
.timeline-toolbar label { margin-top: 0; }
.timeline-toolbar select { width: 14rem; }
.profile-timeline { position: relative; margin-top: 1rem; }
.profile-timeline::before { content: ""; position: absolute; top: 0.5rem; bottom: 0.5rem; left: 1rem; width: 1px; background: var(--line); }
.timeline-entry { position: relative; padding: 0.65rem 0 0.85rem; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.8rem; }
.timeline-symbol { z-index: 1; width: 2rem; height: 2rem; display: grid; place-items: center; color: var(--teal-900); background: var(--teal-100); border: 0.2rem solid #fff; border-radius: 50%; font-size: 0.65rem; font-weight: 850; }
.timeline-symbol.survey { color: #70501c; background: #f6e7c9; }
.timeline-symbol.appointment { color: #294f6e; background: #dbe8f1; }
.timeline-symbol.task { color: #803e32; background: #f3ded9; }
.timeline-symbol.message { color: #4e4c7d; background: #e5e4f2; }
.timeline-symbol.staff { color: #51605d; background: #e8edeb; }
.timeline-entry-heading { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.timeline-entry p { margin: 0.15rem 0; color: var(--muted); font-size: 0.8rem; white-space: pre-line; }
.timeline-entry small { color: var(--muted); font-size: 0.7rem; }
.profile-message-list { max-height: 34rem; }
.profile-message-list .message-row { grid-template-columns: 4.5rem minmax(0, 1fr); }
.profile-message-list .message-row small { grid-column: 2; white-space: normal; }
.profile-details-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.profile-details-form > div { padding: 1rem; border: 1px solid var(--line); }
.profile-details-form > div:nth-last-child(-n + 2) { grid-column: 1 / -1; }
.profile-details-form h3 { margin: 0; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 500; }
.survey-history { margin-top: 1rem; display: grid; gap: 0.75rem; }
.survey-record { padding: 1rem; border: 1px solid var(--line); }
.survey-record-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.survey-record-heading > div { display: grid; }
.survey-record-heading small { color: var(--muted); font-size: 0.72rem; text-transform: capitalize; }
.survey-record dl { margin: 0.75rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.survey-record dl > div { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); }
.survey-record dt { color: var(--muted); font-size: 0.68rem; font-weight: 750; text-transform: capitalize; }
.survey-record dd { margin: 0.1rem 0 0; overflow-wrap: anywhere; font-size: 0.82rem; }
.preview-grid { margin-top: 1.25rem; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1.25rem; align-items: start; }
.patient-preview { padding: 1.25rem; color: #173349; background: #edf5f2; border: 0.5rem solid #d9e8e3; border-radius: 1.25rem; box-shadow: inset 0 0 0 1px #c3d8d1; }
.patient-preview h4 { margin: 0.2rem 0; font-family: Georgia, serif; font-size: 1.25rem; }
.patient-preview > p:not(.eyebrow) { margin: 0 0 1rem; color: var(--muted); font-size: 0.82rem; }
.preview-question { margin-top: 0.75rem; padding: 0.85rem; display: grid; gap: 0.45rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.preview-question small { color: var(--teal-700); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; }
.preview-options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.preview-options span { padding: 0.4rem 0.65rem; color: var(--teal-700); background: var(--teal-100); border: 1px solid #bdd8d1; border-radius: 99rem; font-size: 0.75rem; }
.scenario-tester { padding: 1rem; border: 1px solid var(--line); }
.scenario-tester h4 { margin: 0; }
.code-editor.compact { min-height: 10rem; }
.test-results { margin-top: 1rem; }
.test-results article { margin-top: 0.5rem; padding-top: 0.5rem; display: flex; justify-content: space-between; border-top: 1px solid rgb(23 75 56 / 0.18); }
.test-results article small { color: var(--muted); }
.validation-success.neutral { color: var(--ink); background: #f2f5f4; border-left-color: var(--muted); }
.administration-grid { margin-top: 2rem; }
.staff-row { min-height: 4rem; padding: 0.7rem 1rem; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto auto; gap: 0.7rem; align-items: center; border-bottom: 1px solid var(--line); }
.role-label { color: var(--teal-700); font-size: 0.72rem; font-weight: 750; }
.compact-select { width: auto; min-height: 2rem; padding: 0.3rem 0.45rem; font-size: 0.72rem; }
.activity-list { max-height: 19rem; overflow: auto; }
.activity-row { padding: 0.8rem 1rem; display: grid; grid-template-columns: 0.5rem minmax(0, 1fr); gap: 0.7rem; align-items: start; border-bottom: 1px solid var(--line); }
.activity-row div { display: grid; }
.activity-row strong { font-size: 0.82rem; text-transform: capitalize; }
.activity-row small { color: var(--muted); font-size: 0.72rem; }
.activity-mark { width: 0.45rem; height: 0.45rem; margin-top: 0.45rem; background: var(--amber); border-radius: 50%; }

.wide-dialog { width: min(68rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); }
.workspace-dialog { padding: 1.5rem; }
.dialog-subtitle { margin: 0.2rem 0 0; color: var(--muted); }
.workspace-grid, .studio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.workspace-section { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.workspace-section h3 { margin: 0; font-size: 0.95rem; }
.subheading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.helper { margin: 0.45rem 0; color: var(--muted); font-size: 0.82rem; }
.inline-form { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.inline-form .primary-button { margin-top: 0.75rem; }
.form-submit { margin-top: 0.85rem; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.enrolment-row { padding: 0.75rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.enrolment-row div { display: grid; }
.enrolment-actions { justify-items: end; gap: 0.35rem; }
.enrolment-row small { color: var(--muted); text-transform: capitalize; }
.status-label { color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.status-label.active { color: var(--teal-700); }
.appointment-list { margin-top: 1rem; border-top: 1px solid var(--line); }
.appointment-row { padding: 0.7rem 0; display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.appointment-row div { display: grid; }
.appointment-row small, .appointment-row time { color: var(--muted); font-size: 0.75rem; }
.appointment-row time { white-space: nowrap; }
.message-list { max-height: 16rem; overflow: auto; }
.message-row { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: start; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.message-row p { margin: 0; font-size: 0.85rem; }
.message-row small { color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
.message-direction { color: var(--teal-700); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; }
.conversation-summary { margin-top: 0.8rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.conversation-summary > div { padding: 0.7rem; display: grid; gap: 0.25rem; background: #f5f8f7; border-left: 0.2rem solid var(--eucalyptus); }
.conversation-summary span { color: var(--muted); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; }
.conversation-summary strong { font-size: 0.82rem; text-transform: capitalize; }
.conversation-center { padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.conversation-inbox-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1rem; align-items: start; }
.conversation-inbox-panel { border: 1px solid var(--line); }
.conversation-filters { padding: 0.75rem; display: grid; grid-template-columns: auto repeat(2, minmax(9rem, 1fr)); gap: 0.75rem; align-items: end; background: #f5f8f7; border-bottom: 1px solid var(--line); }
.conversation-filters label { margin: 0; color: var(--muted); font-size: 0.7rem; }
.conversation-filters > .checkbox-label { min-height: 2.5rem; color: var(--ink); font-size: 0.78rem; font-weight: 700; }
.conversation-filters select { min-height: 2.4rem; padding: 0.35rem 0.5rem; font-size: 0.75rem; }
.conversation-inbox { min-height: 10rem; }
.conversation-thread { width: 100%; min-height: 5.5rem; padding: 0.75rem; display: grid; grid-template-columns: 0.3rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; color: inherit; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); }
.conversation-thread:last-child { border-bottom: 0; }
.conversation-thread:hover { background: #f7faf9; }
.conversation-thread-marker { width: 0.3rem; height: 3.5rem; background: var(--eucalyptus); border-radius: 99rem; }
.conversation-thread-marker.unread { background: var(--amber); }
.conversation-thread-marker.urgent { background: var(--coral); }
.conversation-thread-copy { min-width: 0; display: grid; gap: 0.15rem; }
.conversation-thread-copy > span { display: flex; align-items: center; gap: 0.45rem; }
.conversation-thread-copy small, .conversation-thread-state small { color: var(--muted); font-size: 0.7rem; }
.conversation-thread-copy p { margin: 0.2rem 0 0; overflow: hidden; color: var(--muted); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.conversation-thread-state { display: grid; justify-items: end; gap: 0.4rem; }
.unread-badge { min-width: 1.3rem; padding: 0.1rem 0.35rem; color: #fff; background: var(--coral); border-radius: 99rem; font-size: 0.65rem; text-align: center; }
.status-label.open { color: #9b3f31; }
.status-label.paused { color: #875c16; }
.attention-rail { margin: 0; padding: 1rem; color: #eff7f5; background: var(--teal-900); border-radius: var(--radius); }
.attention-rail .eyebrow { color: #9ec8be; }
.attention-rail .helper { color: #bdd4ce; }
.attention-rail #conversation-queue-summary { margin: 1rem 0; display: grid; }
.attention-rail #conversation-queue-summary > div { padding: 0.75rem 0; display: grid; border-bottom: 1px solid rgb(255 255 255 / 0.16); }
.attention-rail #conversation-queue-summary strong { font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.attention-rail #conversation-queue-summary span { color: #bdd4ce; font-size: 0.72rem; }
.conversation-attention-banner { margin-bottom: 0.75rem; padding: 0.75rem 1rem; display: flex; justify-content: space-between; gap: 1rem; color: #6e3027; background: #fff2ee; border-left: 0.25rem solid var(--coral); }
.conversation-attention-banner span { color: #874b41; font-size: 0.8rem; }
.communication-ledger { margin-top: 0.75rem; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.conversation-context-list { margin-top: 0.75rem; display: grid; gap: 0.5rem; }
.context-card { padding: 0.75rem; border-left: 0.2rem solid var(--eucalyptus); background: #f5f8f7; }
.context-card > div { display: flex; justify-content: space-between; gap: 0.75rem; }
.context-card small { color: var(--muted); font-size: 0.68rem; }
.context-card p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.78rem; }
.conversation-control-form { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.retention-controls { margin-top: 0.75rem; padding: 0.75rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 0.75rem; background: #f5f8f7; }
.retention-controls > div { grid-column: 1 / -1; }
.retention-controls label { margin-top: 0; font-size: 0.75rem; }
.retention-controls input[type="number"] { min-height: 2.25rem; }
.message-composer { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-label input { width: 1rem; min-height: 1rem; }
.dialog-choice-group { margin: 1rem 0 0; padding: 1rem; border: 1px solid var(--line); border-radius: 0.9rem; }
.dialog-choice-group legend { padding: 0 0.35rem; font-weight: 750; }
.dialog-choice-group legend small { color: var(--muted); font-weight: 500; }
.checkbox-grid { display: grid; gap: 0.55rem; margin-top: 0.75rem; }
.checkbox-grid .checkbox-label { align-items: flex-start; padding: 0.7rem; border: 1px solid var(--line); border-radius: 0.7rem; }
.checkbox-grid .checkbox-label span { display: grid; gap: 0.15rem; }
.checkbox-grid .checkbox-label small { color: var(--muted); font-weight: 500; }

.settings-workspace { display: none; }
.settings-workspace.is-active-view { display: block; }
.settings-titlebar { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.settings-titlebar h2 { margin: 0.15rem 0 0.35rem; }
.settings-titlebar p:last-child { max-width: 46rem; margin: 0; color: var(--muted); }
.standalone-badge { padding: 0.45rem 0.65rem; border: 1px solid var(--teal-700); color: var(--teal-700); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.settings-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2rem; margin-top: 1.5rem; align-items: start; }
.settings-rail { position: sticky; top: 1rem; display: grid; border-left: 1px solid var(--line); }
.settings-rail button { min-height: 2.75rem; padding: 0.6rem 0.85rem; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--muted); text-align: left; font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.settings-rail button:hover, .settings-rail button:focus-visible { border-left-color: var(--teal-700); color: var(--ink); background: var(--teal-100); }
.settings-content { display: grid; gap: 1rem; }
.settings-section { scroll-margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--line); background: var(--surface); }
.settings-section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.settings-section-heading > div { display: grid; grid-template-columns: 2rem minmax(0, 1fr); column-gap: 0.65rem; }
.settings-section-heading h3 { grid-column: 2; margin: 0; }
.settings-section-heading p { grid-column: 2; margin: 0.25rem 0 0; color: var(--muted); max-width: 44rem; }
.settings-index { grid-row: 1 / span 2; display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--line); color: var(--teal-700); font-size: 0.68rem; font-weight: 850; }
.settings-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1rem; margin-top: 1.25rem; }
.settings-form-grid .wide { grid-column: 1 / -1; }
.settings-savebar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.settings-savebar span { color: var(--muted); font-size: 0.78rem; }
.system-ledger { margin-top: 1rem; border-top: 1px solid var(--line); }
.system-ledger-row { display: grid; grid-template-columns: 0.65rem minmax(0, 1fr) minmax(10rem, auto); gap: 0.75rem; align-items: center; min-height: 4rem; border-bottom: 1px solid var(--line); }
.system-ledger-row > div { display: grid; gap: 0.15rem; }
.system-ledger-row small { color: var(--muted); }
.system-ledger-row > span:last-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; text-align: right; overflow-wrap: anywhere; }
.readiness-mark { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--muted); }
.readiness-mark.ready { background: var(--eucalyptus); box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--eucalyptus), transparent 82%); }
.readiness-mark.waiting { background: #b46a32; box-shadow: 0 0 0 0.2rem color-mix(in srgb, #b46a32, transparent 82%); }
.security-note { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; background: #f5f8f7; }

@media (max-width: 800px) {
  .settings-titlebar, .settings-savebar, .security-note { align-items: flex-start; flex-direction: column; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-rail { position: static; grid-template-columns: repeat(2, 1fr); border-left: 0; border-bottom: 1px solid var(--line); }
  .settings-form-grid { grid-template-columns: 1fr; }
  .settings-form-grid .wide { grid-column: auto; }
  .system-ledger-row { grid-template-columns: 0.65rem minmax(0, 1fr); padding: 0.75rem 0; }
  .system-ledger-row > span:last-child { grid-column: 2; text-align: left; }
}

.questions-heading { margin-top: 1.4rem; }
.question-card { position: relative; margin: 0.75rem 0; padding: 0.85rem; border: 1px solid var(--line); border-radius: 0.35rem; }
.workflow-editor-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 1rem; }
.prompt-card, .rule-card, .flow-node-card { position: relative; margin: 0.75rem 0; padding: 0.85rem; border: 1px solid var(--line); border-radius: 0.35rem; }
.prompt-card legend, .rule-card legend, .flow-node-card legend { padding: 0 0.35rem; color: var(--teal-700); font-size: 0.75rem; font-weight: 800; }
.flow-guidance { margin: 0.75rem 0 1rem; padding: 0.85rem 1rem; background: var(--teal-100); border-left: 3px solid var(--teal-700); }
.flow-guidance p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.82rem; }
.flow-node-heading, .flow-response-grid, .flow-transition-grid, .branch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.flow-node-heading { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.branch-editor { margin-top: 0.75rem; padding-top: 0.65rem; border-top: 1px solid var(--line); }
.branch-editor summary { cursor: pointer; color: var(--teal-700); font-weight: 700; }
.remove-flow-node { position: absolute; top: 0.45rem; right: 0.65rem; color: var(--coral); background: transparent; border: 0; cursor: pointer; }
.remove-prompt, .remove-rule { position: absolute; top: 0.4rem; right: 0.5rem; padding: 0.3rem; color: var(--coral); background: transparent; border: 0; font-size: 0.72rem; font-weight: 750; }
.prompt-card input[readonly] { color: var(--muted); background: #f4f7f6; }
.rule-pair { display: grid; grid-template-columns: minmax(0, 1fr) 6rem; gap: 0.75rem; }
.rule-condition, .rule-outcomes { margin-top: 0.8rem; padding: 0.75rem; display: grid; grid-template-columns: 1fr 0.75fr 1fr; gap: 0.5rem; align-items: end; background: #f5f8f7; border-left: 0.2rem solid var(--eucalyptus); }
.rule-outcomes { border-left-color: var(--amber); }
.rule-condition label, .rule-outcomes label { margin-top: 0; }
.program-access { margin-top: 1rem; padding: 0.75rem; border: 1px solid var(--line); }
.program-access legend { padding: 0 0.35rem; font-size: 0.82rem; font-weight: 750; }
.program-access label { margin-top: 0.5rem; }
.question-card legend { padding: 0 0.35rem; color: var(--teal-700); font-size: 0.75rem; font-weight: 800; }
.remove-question { position: absolute; top: 0.4rem; right: 0.5rem; padding: 0.3rem; color: var(--coral); background: transparent; border: 0; font-size: 0.72rem; font-weight: 750; }
.question-fields { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.question-required { padding-bottom: 0.8rem; }
details { margin-top: 1rem; padding: 0.85rem 1rem; background: #f7faf9; border: 1px solid var(--line); border-radius: var(--radius); }
summary { color: var(--teal-700); cursor: pointer; font-weight: 750; }
.code-editor { min-height: 20rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; line-height: 1.45; }

@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation-duration: 0.01ms !important; } }

@media (max-width: 64rem) {
  .app-shell { grid-template-columns: 5rem minmax(0, 1fr); }
  .sidebar { padding-inline: 0.65rem; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand div, .nav-item:not(.is-active)::after, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item > span { font-size: 1rem; }
  .sidebar-note { justify-content: center; }
  .sidebar-note div { display: none; }
  .content-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-export-actions { justify-content: flex-start; }
  .report-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-metric:nth-child(3n) { border-right: 0; }
  .report-table-grid, .report-detail-grid { grid-template-columns: 1fr; }
  .program-grid { grid-template-columns: 1fr; }
  .queue-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conversation-inbox-layout { grid-template-columns: 1fr; }
  .attention-rail { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem 1rem; align-items: start; }
  .attention-rail #conversation-queue-summary { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attention-rail .helper { grid-column: 1 / -1; }
}

@media (max-width: 48rem) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; overflow: hidden; flex-direction: row; align-items: center; padding: 0.65rem 1rem; }
  .brand { padding: 0; }
  .brand div { display: none; }
  .sidebar nav { min-width: 0; margin-left: auto; display: flex; overflow-x: auto; }
  .sidebar .nav-item { flex: 0 0 2.75rem; }
  .sidebar-note { display: none; }
  main { padding-top: 1.5rem; }
  .topbar { align-items: start; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .reporting-titlebar { align-items: stretch; flex-direction: column; }
  .report-freshness { width: 100%; }
  .report-filters { grid-template-columns: 1fr; }
  .alert-settings[open] > div { position: static; width: 100%; margin-top: 0.35rem; box-shadow: none; }
  .report-export-actions { align-items: stretch; flex-direction: column; }
  .report-export-actions .text-button { text-align: left; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-metric, .report-metric:nth-child(3n) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .report-metric:nth-child(2n) { border-right: 0; }
  .report-chart-grid { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 7.5rem minmax(0, 1fr) 2rem; }
  .chart-legend { flex-direction: column; gap: 0.2rem; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(n + 3) { border-bottom: 0; }
  .pathway-rail { grid-template-columns: 1fr; gap: 0.75rem; }
  .pathway-rail li:not(:last-child)::after { top: 2rem; bottom: -0.75rem; left: 1rem; right: auto; width: 1px; height: auto; }
  .pathway-rail div { padding: 0; }
  .workspace-grid, .studio-grid, .workflow-editor-grid, .flow-node-heading, .flow-response-grid, .flow-transition-grid, .branch-grid { grid-template-columns: 1fr; }
  .form-pair { grid-template-columns: 1fr; gap: 0; }
  .message-row { grid-template-columns: 4rem minmax(0, 1fr); }
  .message-row small { grid-column: 2; }
  .rule-condition, .rule-outcomes { grid-template-columns: 1fr; }
  .conversation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conversation-filters, .communication-ledger { grid-template-columns: 1fr; }
  .conversation-thread { grid-template-columns: 0.3rem minmax(0, 1fr); }
  .conversation-thread-state { grid-column: 2; justify-items: start; }
  .attention-rail { display: block; }
  .attention-rail #conversation-queue-summary { grid-template-columns: 1fr; }
  .staff-row { grid-template-columns: 2.25rem minmax(0, 1fr) auto; }
  .staff-row .status-label { grid-column: 2; }
  .queue-filters { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: 0.35rem minmax(0, 1fr); }
  .task-actions { grid-column: 2; justify-content: flex-start; }
  .studio-titlebar, .studio-commandbar { align-items: stretch; flex-direction: column; }
  .studio-workbench { min-width: 0; width: 100%; grid-template-columns: minmax(0, 1fr); }
  .studio-navigation { min-width: 0; width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .studio-tab-list { display: flex; gap: 0.25rem; overflow-x: auto; }
  .studio-tab { width: auto; flex: none; border-left: 0; border-bottom: 0.2rem solid transparent; }
  .studio-tab.is-active { border-bottom-color: var(--teal-700); }
  .version-rail { display: none; }
  .studio-panel { padding: 1rem; }
  .studio-actions { flex-wrap: wrap; justify-content: stretch; }
  .studio-actions button { flex: 1 1 auto; }
  .draft-save-state { width: 100%; }
  .version-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .version-summary > div { border-bottom: 1px solid var(--line); }
  .preview-grid { grid-template-columns: 1fr; }
  .patient-filters { grid-template-columns: 1fr; }
  .profile-header { grid-template-columns: 1fr auto; }
  .profile-header > .text-button { grid-column: 1 / -1; }
  .profile-identity { min-width: 0; }
  .profile-header-actions { flex-direction: column; align-items: end; }
  .profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-overview-grid, .profile-details-form { grid-template-columns: 1fr; }
  .profile-details-form > div:nth-last-child(-n + 2) { grid-column: auto; }
  .timeline-toolbar { align-items: stretch; flex-direction: column; }
  .timeline-toolbar select { width: 100%; }
  .profile-enrolment { grid-template-columns: 0.3rem minmax(0, 1fr); }
  .profile-enrolment .enrolment-actions { grid-column: 2; justify-items: start; }
  .questionnaire-actions { justify-content: flex-start; }
  .integration-fields { grid-template-columns: 1fr; }
  .callback-box { align-items: stretch; flex-direction: column; }
  .survey-record dl { grid-template-columns: 1fr; }
}

@media (max-width: 23rem) {
  .topbar { display: grid; }
  .metrics { grid-template-columns: 1fr; }
  .metric, .metric:nth-child(n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
}

/* Phase 6 workspace system: calm clinical control room */
:root {
  --ink: #102a2b;
  --muted: #607372;
  --surface: #fbfdfc;
  --canvas: #edf3f1;
  --line: #cfdcda;
  --line-strong: #afc3bf;
  --teal-900: #082f32;
  --teal-700: #0b716b;
  --teal-100: #d9efea;
  --eucalyptus: #79a99d;
  --signal: #b8dc65;
  --signal-soft: #e8f2c9;
  --amber: #c58b29;
  --coral: #bd5749;
  --navy: #102f3c;
  --radius: 0.625rem;
  --radius-small: 0.375rem;
  --shadow: 0 0.75rem 2rem rgb(8 47 50 / 0.07);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

body {
  min-width: 20rem;
  background-color: var(--canvas);
  background-image: linear-gradient(rgb(8 47 50 / 0.025) 1px, transparent 1px), linear-gradient(90deg, rgb(8 47 50 / 0.025) 1px, transparent 1px);
  background-size: 3rem 3rem;
  font-family: "Avenir Next", Avenir, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
button:active { transform: scale(0.975); }

.app-shell { grid-template-columns: 17.25rem minmax(0, 1fr); }
.sidebar {
  z-index: 10;
  padding: 1.25rem 0.875rem 1rem;
  color: #e7f2ef;
  background: #082f32;
  border-right: 1px solid rgb(255 255 255 / 0.08);
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px);
  background-size: 2rem 2rem;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}
.sidebar > * { position: relative; }
.brand { min-height: 3.75rem; padding: 0 0.5rem 1rem; gap: 0.8rem; }
.brand-mark {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--signal);
  background: transparent;
  border: 1px solid rgb(184 220 101 / 0.6);
  border-radius: 50%;
}
.brand-mark::before, .brand-mark::after, .brand-mark i {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.brand-mark::before { inset: 0.42rem; border: 1px solid rgb(184 220 101 / 0.55); }
.brand-mark::after { inset: 0.88rem; background: var(--signal); box-shadow: 0 0 0 0.25rem rgb(184 220 101 / 0.12); }
.brand strong { font-size: 0.95rem; letter-spacing: -0.01em; }
.brand span:last-child { color: #8eaaa5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.62rem; letter-spacing: 0.08em; }
.nav-label { margin: 1rem 0.75rem 0.4rem; color: #76938e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.sidebar nav { gap: 0.18rem; }
.nav-item {
  position: relative;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  color: #acc3be;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 0.82rem;
  font-weight: 650;
}
.nav-item > span:first-child { width: 1.3rem; color: #7fa29a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; }
.nav-item > .nav-copy { width: auto; min-width: 0; flex: 1; color: inherit; text-align: left; }
.nav-item:hover { color: #f6fbfa; background: rgb(255 255 255 / 0.045); }
.nav-item.is-active { color: #fff; background: rgb(184 220 101 / 0.09); border-color: rgb(184 220 101 / 0.18); }
.nav-item.is-active::before { content: ""; position: absolute; left: -0.9rem; width: 0.2rem; height: 1.5rem; background: var(--signal); border-radius: 0 0.2rem 0.2rem 0; }
.nav-item.is-active > span:first-child { color: var(--signal); }
.sidebar-note { padding: 0.75rem; background: rgb(255 255 255 / 0.035); border-color: rgb(255 255 255 / 0.1); border-radius: var(--radius-small); }
.sidebar-note strong { font-size: 0.72rem; }
.sidebar-note span:last-child { color: #87a29d; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.6rem; }
.status-dot { background: var(--signal); box-shadow: 0 0 0 0.2rem rgb(184 220 101 / 0.12); }

main { width: 100%; max-width: 96rem; padding: 0 clamp(1rem, 3vw, 3rem) 4rem; }
.topbar {
  position: sticky;
  z-index: 8;
  top: 0;
  min-height: 8rem;
  margin: 0 calc(clamp(1rem, 3vw, 3rem) * -1) 1.5rem;
  padding: 1.4rem clamp(1rem, 3vw, 3rem) 1.15rem;
  align-items: center;
  background: rgb(237 243 241 / 0.9);
  border-bottom: 1px solid rgb(175 195 191 / 0.72);
  backdrop-filter: blur(16px) saturate(120%);
}
.page-context { min-width: 0; }
.eyebrow { color: var(--teal-700); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.63rem; letter-spacing: 0.12em; }
h1 { font-family: "Iowan Old Style", Baskerville, Georgia, serif; font-size: clamp(1.9rem, 3vw, 2.7rem); font-weight: 500; letter-spacing: -0.035em; }
h2, .reporting-titlebar h2, .dialog-header h2, .profile-details-form h3, .report-card-heading h3 { font-family: "Iowan Old Style", Baskerville, Georgia, serif; }
.page-description { margin-top: 0.3rem; font-size: 0.84rem; }
.topbar-actions { flex: 0 0 auto; display: flex; gap: 0.65rem; align-items: center; }
.mobile-menu-button { display: none; }
.command-button {
  min-height: 2.65rem;
  padding: 0.45rem 0.55rem 0.45rem 0.75rem;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--muted);
  background: rgb(251 253 252 / 0.82);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  font-size: 0.75rem;
}
.command-button > span:first-child { color: var(--teal-700); font-size: 1rem; }
kbd { padding: 0.15rem 0.35rem; color: #536765; background: #edf2f1; border: 1px solid #c9d5d2; border-bottom-width: 2px; border-radius: 0.25rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.62rem; line-height: 1.2; }
.topbar .primary-button { min-height: 2.65rem; display: flex; gap: 0.35rem; align-items: center; box-shadow: 0 0.4rem 1rem rgb(11 113 107 / 0.16); }
.primary-button { background: var(--teal-700); }
.primary-button:hover { background: #085b58; }
.secondary-button { background: var(--teal-100); }

.app-view { display: none; }
.app-view.is-active-view { display: block; }
[data-app-view][id] { scroll-margin-top: 9rem; }
.quick-actions.app-view.is-active-view { display: grid; }
.content-grid:not(.has-active-view) { display: none; }
.content-grid.has-active-view { grid-template-columns: 1fr; }
.content-grid.administration-grid.has-active-view { grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr); }

section { margin-top: 1.25rem; }
.quick-actions { margin: 0 0 1.25rem; }
.quick-actions button { min-height: 4.6rem; background: rgb(251 253 252 / 0.88); border-color: var(--line); border-radius: var(--radius); box-shadow: none; }
.quick-actions button:hover { border-color: var(--teal-700); transform: translateY(-1px); }
.quick-actions button > span { color: var(--teal-900); background: var(--signal-soft); border-radius: var(--radius-small); }
.metrics, .data-panel, .conversation-center, .reporting-workspace, .program-section, .program-studio, .patient-profile { background: rgb(251 253 252 / 0.94); border-color: var(--line); box-shadow: 0 0.25rem 1rem rgb(8 47 50 / 0.035); }
.metrics { overflow: hidden; }
.metric { min-height: 7rem; }
.metric-value, .report-metric > strong, .attention-rail #conversation-queue-summary strong { font-family: "Iowan Old Style", Baskerville, Georgia, serif; }
.pathway-panel { position: relative; overflow: hidden; color: #eff7f5; background: var(--teal-900); box-shadow: var(--shadow); }
.pathway-panel::after { content: ""; position: absolute; top: 0; right: 0; width: 0.3rem; height: 100%; background: var(--signal); }
.pathway-panel p { color: #afc9c3; }
.pathway-rail div { background: var(--teal-900); }
.pathway-rail li > span { background: var(--signal-soft); }
.pathway-rail li:not(:last-child)::after { background: #52756f; }
.reporting-titlebar, .studio-titlebar { background: var(--teal-900); }
.reporting-workspace, .program-studio, .patient-profile { margin-top: 0; }
.data-panel { min-height: min(42rem, calc(100vh - 11rem)); }
.conversation-center { margin-top: 0; min-height: calc(100vh - 11rem); }
.program-section { margin-top: 0; padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); }
.program-section + .program-studio { margin-top: 1rem; }
.row-button:hover, .conversation-thread:hover { background: #f0f6f4; }
.compact-button:hover { border-color: var(--teal-700); }

.command-dialog {
  width: min(39rem, calc(100% - 1.5rem));
  max-height: min(38rem, calc(100vh - 2rem));
  margin-top: min(14vh, 7rem);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  box-shadow: 0 1.5rem 5rem rgb(8 47 50 / 0.28);
}
.command-dialog::backdrop { background: rgb(8 31 33 / 0.46); backdrop-filter: blur(3px); }
.command-shell { display: grid; }
.command-search { min-height: 4.25rem; padding: 0.75rem 1rem; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; border-bottom: 1px solid var(--line); }
.command-search > span { color: var(--teal-700); font-size: 1.3rem; }
.command-search input { min-height: 2.5rem; padding: 0; background: transparent; border: 0; border-radius: 0; font-size: 1rem; }
.command-search input:focus { outline: 0; }
.command-heading { padding: 0.65rem 1rem 0.35rem; display: flex; justify-content: space-between; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }
.command-results { max-height: 28rem; padding: 0.35rem 0.5rem 0.65rem; overflow-y: auto; }
.command-group { padding: 0.55rem 0.5rem 0.25rem; color: #7b8c89; font-size: 0.62rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.command-result { width: 100%; min-height: 3.5rem; padding: 0.5rem 0.65rem; display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; color: var(--ink); text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-small); }
.command-result.is-selected, .command-result:hover { background: var(--teal-100); border-color: #c1ded7; }
.command-result-icon { width: 2rem; height: 2rem; display: grid; place-items: center; color: var(--teal-900); background: #e9f2ef; border: 1px solid #d1e0dc; border-radius: var(--radius-small); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; font-weight: 800; }
.command-result > span:nth-child(2) { min-width: 0; display: grid; }
.command-result strong, .command-result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-result strong { font-size: 0.78rem; }
.command-result small { color: var(--muted); font-size: 0.68rem; }
.command-empty { min-height: 10rem; display: grid; place-content: center; justify-items: center; color: var(--muted); font-size: 0.8rem; }
.command-shell footer { padding: 0.55rem 1rem; display: flex; gap: 1rem; color: var(--muted); background: #f3f7f5; border-top: 1px solid var(--line); font-size: 0.65rem; }
.command-shell footer span { display: flex; gap: 0.35rem; align-items: center; }

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover, .quick-actions button:hover, .row-button:hover, .conversation-thread:hover, .compact-button:hover { transition-duration: 160ms; }
}

@media (max-width: 64rem) {
  .app-shell { grid-template-columns: 4.75rem minmax(0, 1fr); }
  .sidebar { padding-inline: 0.6rem; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand div, .nav-label, .nav-copy, .sidebar-note div, .staff-identity div { display: none; }
  .staff-identity { justify-content: center; padding-inline: 0; }
  .nav-item { justify-content: center; padding-inline: 0.5rem; }
  .nav-item.is-active::before { left: -0.65rem; }
  .content-grid.administration-grid.has-active-view { grid-template-columns: 1fr; }
}

@media (max-width: 48rem) {
  body { padding-bottom: 4.25rem; background-size: 2rem 2rem; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: 100%;
    height: 4.25rem;
    padding: 0.45rem 0.5rem max(0.45rem, env(safe-area-inset-bottom));
    display: block;
    overflow: visible;
    border-top: 1px solid rgb(255 255 255 / 0.12);
  }
  .sidebar::before, .sidebar .brand, .sidebar .nav-label, .sidebar-footer, .sidebar nav:nth-of-type(2) { display: none; }
  .sidebar nav:first-of-type { height: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.15rem; }
  .sidebar .nav-item { min-width: 0; min-height: 3.25rem; padding: 0.25rem; display: grid; place-items: center; gap: 0; font-size: 0.58rem; }
  .sidebar .nav-copy { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar .nav-item > span:first-child { display: block; font-size: 0.9rem; }
  .nav-item.is-active::before { top: -0.45rem; left: 25%; width: 50%; height: 0.18rem; border-radius: 0 0 0.2rem 0.2rem; }
  main { padding: 0 0.75rem 1.5rem; }
  .topbar { min-height: auto; margin: 0 -0.75rem 1rem; padding: 0.9rem 0.75rem; align-items: center; }
  .page-description { display: none; }
  h1 { font-size: 1.55rem; }
  .topbar-actions { gap: 0.4rem; }
  .mobile-menu-button { width: 2.55rem; min-height: 2.55rem; padding: 0; display: grid; place-items: center; color: var(--teal-700); background: rgb(251 253 252 / 0.82); border: 1px solid var(--line-strong); border-radius: var(--radius-small); }
  .mobile-menu-button span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .command-button { width: 2.55rem; padding: 0; justify-content: center; }
  .command-button > span:nth-child(2), .command-button kbd { display: none; }
  .topbar .primary-button { min-height: 2.55rem; padding: 0.55rem 0.7rem; }
  .topbar .primary-button > span:last-child { display: none; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .data-panel, .conversation-center { min-height: auto; }
  .command-dialog { margin-top: 0.75rem; }
  .command-results { max-height: calc(100vh - 12rem); }
  body.is-mobile-menu-open .sidebar nav:nth-of-type(2) { position: fixed; right: 0.5rem; bottom: 4.65rem; left: 0.5rem; z-index: 24; padding: 0.65rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.3rem; background: var(--teal-900); border: 1px solid rgb(255 255 255 / 0.14); border-radius: var(--radius); box-shadow: 0 -1rem 3rem rgb(8 47 50 / 0.25); }
  body.is-mobile-menu-open .sidebar nav:nth-of-type(2) .nav-item { min-height: 2.8rem; padding: 0.55rem 0.65rem; display: flex; justify-content: flex-start; font-size: 0.72rem; }
  body.is-mobile-menu-open .sidebar nav:nth-of-type(2) .nav-copy { display: block; text-align: left; }
}

@media (max-width: 23rem) {
  .quick-actions { grid-template-columns: 1fr; }
  .topbar .eyebrow { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
  button:active { transform: none; }
}

/* Scheduled reporting and WhatsApp operations */
.report-automation { margin: 0; padding: 1.25rem; background: #f1f6f4; border-top: 1px solid var(--line); }
.report-automation-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
.report-automation-heading h2 { font-size: 1.45rem; }
.report-automation-heading p:last-child { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.78rem; }
.report-automation-heading > div:last-child { display: flex; gap: 0.6rem; }
.report-automation-grid { margin-top: 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.automation-panel { min-width: 0; margin: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.automation-panel-heading { min-height: 3.5rem; padding: 0.75rem 1rem; display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; border-bottom: 1px solid var(--line); }
.automation-panel-heading h3 { margin: 0; font-family: "Iowan Old Style", Baskerville, Georgia, serif; font-size: 1rem; font-weight: 600; }
.automation-panel-heading p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.68rem; }
.automation-list { min-height: 8rem; }
.automation-row { min-height: 4.5rem; padding: 0.7rem 0.85rem; display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; border-bottom: 1px solid var(--line); }
.automation-row:last-child { border-bottom: 0; }
.automation-symbol { width: 2rem; height: 2rem; display: grid; place-items: center; color: var(--teal-700); background: var(--teal-100); border-radius: var(--radius-small); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; font-weight: 800; }
.automation-symbol.live { color: #3b5c11; background: var(--signal-soft); }
.automation-symbol.paused { color: #7d5b20; background: #f4e7cf; }
.automation-row > div:nth-child(2) { min-width: 0; display: grid; }
.automation-row strong, .automation-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-row strong { font-size: 0.78rem; }
.automation-row small { color: var(--muted); font-size: 0.65rem; }
.automation-actions { display: flex; gap: 0.45rem; align-items: center; }
.run-history-panel { margin-top: 1rem; }
.run-status { padding: 0.2rem 0.4rem; color: var(--muted); background: #e8efed; border-radius: 99rem; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; }
.run-status.delivered { color: #275c42; background: #dff2e9; }
.run-status.failed { color: #88392d; background: #f8e3df; }
.run-status.retrying, .run-status.running { color: #805b18; background: #f8ecd5; }
.run-error { display: block; max-width: 16rem; color: #88392d !important; white-space: normal !important; }

.whatsapp-operations { grid-column: 1 / -1; min-height: auto; }
.integration-health { padding: 1rem 1.25rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; border-bottom: 1px solid var(--line); }
.integration-health p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.integration-state { padding: 0.35rem 0.55rem; color: #7b382f; background: #fae8e4; border-radius: 99rem; font-size: 0.68rem; font-weight: 800; }
.integration-state.connected { color: #275c42; background: #dff2e9; }
.integration-state.local { color: #70551d; background: #f6ecd7; }
.delivery-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.delivery-counts > div { padding: 0.9rem 1rem; display: grid; border-right: 1px solid var(--line); }
.delivery-counts > div:last-child { border-right: 0; }
.delivery-counts strong { font-family: "Iowan Old Style", Baskerville, Georgia, serif; font-size: 1.5rem; font-weight: 500; }
.delivery-counts span { color: var(--muted); font-size: 0.62rem; font-weight: 800; text-transform: uppercase; }
.webhook-list { padding: 0.8rem 1.25rem; display: grid; gap: 0.6rem; border-bottom: 1px solid var(--line); }
.webhook-list > div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0.75rem; align-items: center; }
.webhook-list span { color: var(--muted); font-size: 0.68rem; font-weight: 750; }
.webhook-list code, .integration-failure code { overflow: hidden; color: var(--teal-700); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.65rem; text-overflow: ellipsis; white-space: nowrap; }
.integration-failures { padding: 0.8rem 1.25rem 1rem; }
.integration-failures h3 { margin: 0 0 0.5rem; font-size: 0.78rem; }
.integration-failure { padding: 0.55rem 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; border-top: 1px solid var(--line); }
.integration-failure div { min-width: 0; display: grid; }
.integration-failure strong { overflow: hidden; font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.integration-failure small, .integration-all-clear { color: var(--muted); font-size: 0.65rem; }
.integration-failure-meta { min-width: 0; display: flex !important; gap: 0.6rem; align-items: center; justify-content: flex-end; }
.provider-accepted { color: var(--muted); font-size: 0.62rem; white-space: nowrap; }

.auth-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(circle at 20% 10%, #dcefeb 0, transparent 34%), #f3f7f6; }
.auth-gate.is-hidden { display: none; }
.auth-card { width: min(28rem, 100%); padding: 2rem; display: grid; gap: 0.75rem; border: 1px solid var(--line); border-radius: 0.75rem; background: white; box-shadow: 0 1.5rem 4rem rgba(23, 55, 51, 0.12); }
.auth-card h1 { margin: 0; font-family: "Iowan Old Style", Baskerville, Georgia, serif; font-size: 2rem; font-weight: 500; }
.auth-card > p { margin: 0 0 0.5rem; color: var(--muted); }
.auth-card .primary-button { width: 100%; margin-top: 0.5rem; justify-content: center; }
.auth-brand { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1.25rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }

@media (max-width: 48rem) {
  .education-tools-grid { grid-template-columns: 1fr; }
  .report-automation-heading { align-items: stretch; flex-direction: column; }
  .report-automation-heading > div:last-child { display: grid; grid-template-columns: 1fr 1fr; }
  .report-automation-grid { grid-template-columns: 1fr; }
  .automation-row { grid-template-columns: 2rem minmax(0, 1fr); }
  .automation-actions { grid-column: 2; justify-content: flex-start; }
  .integration-health { align-items: flex-start; flex-direction: column; }
  .delivery-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delivery-counts > div:nth-child(2) { border-right: 0; }
  .delivery-counts > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .webhook-list > div { grid-template-columns: 1fr; gap: 0.2rem; }
  .integration-failure { grid-template-columns: 1fr; gap: 0.5rem; }
  .integration-failure-meta { align-items: flex-start; justify-content: flex-start; flex-wrap: wrap; }
}
