/* MH� brand � portal-wide palette (#2C5169 + black/white; matches CRM Stitch direction) */
:root {
  --mh2-primary: #2c5169;
  --mh2-primary-light: #3d6a86;
  --mh2-primary-dark: #234a61;
  --mh2-accent: #5a7a91;
  --mh2-bg: #f9f9f9;
  --mh2-surface: #ffffff;
  --mh2-text: #000000;
  --mh2-text-muted: #5f5f5f;
  --mh2-muted: #6b7280;
  --mh2-border: #e2e2e2;
  --mh2-sidebar-bg: #ffffff;
  --mh2-sidebar-border: #e2e2e2;
  --mh2-error: #b91c1c;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --font: "DM Sans", system-ui, sans-serif;
  --sidebar-width: 240px;
  --auto-scrollbar-size: 8px;
  --auto-scrollbar-thumb: rgba(0, 0, 0, 0.25);
  --auto-scrollbar-thumb-hover: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  color: var(--mh2-text);
  background: var(--mh2-bg);
  -webkit-font-smoothing: antialiased;
}

/* Table scroll regions: hide scrollbars until hover, focus, or active scroll. */
.utilization-scroll,
.case-loads-scroll,
.task-table-scroll,
.crm-table-scroll,
.crm-actions-table-scroll,
.home-pending-scroll,
.record-audit-table-scroll,
.follow-up-appt-summary-scroll,
.rm-pr-recordings-scroll,
.treatment-plan-bg-scroll-wrap,
.treatment-plan-iv-picker-body-scroll,
.crm-reporting-deposits-scroll,
.crm-reporting-deposits-summary-scroll,
.task-reporting-summary-table tbody,
.conflicts-scroll,
.task-labels-manage-list {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.utilization-scroll:is(:hover, :focus-within, .scrollbar-active),
.case-loads-scroll:is(:hover, :focus-within, .scrollbar-active),
.task-table-scroll:is(:hover, :focus-within, .scrollbar-active),
.crm-table-scroll:is(:hover, :focus-within, .scrollbar-active),
.crm-actions-table-scroll:is(:hover, :focus-within, .scrollbar-active),
.home-pending-scroll:is(:hover, :focus-within, .scrollbar-active),
.record-audit-table-scroll:is(:hover, :focus-within, .scrollbar-active),
.follow-up-appt-summary-scroll:is(:hover, :focus-within, .scrollbar-active),
.rm-pr-recordings-scroll:is(:hover, :focus-within, .scrollbar-active),
.treatment-plan-bg-scroll-wrap:is(:hover, :focus-within, .scrollbar-active),
.treatment-plan-iv-picker-body-scroll:is(:hover, :focus-within, .scrollbar-active),
.crm-reporting-deposits-scroll:is(:hover, :focus-within, .scrollbar-active),
.crm-reporting-deposits-summary-scroll:is(:hover, :focus-within, .scrollbar-active),
.task-reporting-summary-table tbody:is(:hover, :focus-within, .scrollbar-active),
.conflicts-scroll:is(:hover, :focus-within, .scrollbar-active),
.task-labels-manage-list:is(:hover, :focus-within, .scrollbar-active) {
  scrollbar-color: var(--auto-scrollbar-thumb) transparent;
}

.utilization-scroll::-webkit-scrollbar,
.case-loads-scroll::-webkit-scrollbar,
.task-table-scroll::-webkit-scrollbar,
.crm-table-scroll::-webkit-scrollbar,
.crm-actions-table-scroll::-webkit-scrollbar,
.home-pending-scroll::-webkit-scrollbar,
.record-audit-table-scroll::-webkit-scrollbar,
.follow-up-appt-summary-scroll::-webkit-scrollbar,
.rm-pr-recordings-scroll::-webkit-scrollbar,
.treatment-plan-bg-scroll-wrap::-webkit-scrollbar,
.treatment-plan-iv-picker-body-scroll::-webkit-scrollbar,
.crm-reporting-deposits-scroll::-webkit-scrollbar,
.crm-reporting-deposits-summary-scroll::-webkit-scrollbar,
.task-reporting-summary-table tbody::-webkit-scrollbar,
.conflicts-scroll::-webkit-scrollbar,
.task-labels-manage-list::-webkit-scrollbar {
  width: var(--auto-scrollbar-size);
  height: var(--auto-scrollbar-size);
}

.utilization-scroll::-webkit-scrollbar-track,
.case-loads-scroll::-webkit-scrollbar-track,
.task-table-scroll::-webkit-scrollbar-track,
.crm-table-scroll::-webkit-scrollbar-track,
.crm-actions-table-scroll::-webkit-scrollbar-track,
.home-pending-scroll::-webkit-scrollbar-track,
.record-audit-table-scroll::-webkit-scrollbar-track,
.follow-up-appt-summary-scroll::-webkit-scrollbar-track,
.rm-pr-recordings-scroll::-webkit-scrollbar-track,
.treatment-plan-bg-scroll-wrap::-webkit-scrollbar-track,
.treatment-plan-iv-picker-body-scroll::-webkit-scrollbar-track,
.crm-reporting-deposits-scroll::-webkit-scrollbar-track,
.crm-reporting-deposits-summary-scroll::-webkit-scrollbar-track,
.task-reporting-summary-table tbody::-webkit-scrollbar-track,
.conflicts-scroll::-webkit-scrollbar-track,
.task-labels-manage-list::-webkit-scrollbar-track {
  background: transparent;
}

.utilization-scroll::-webkit-scrollbar-thumb,
.case-loads-scroll::-webkit-scrollbar-thumb,
.task-table-scroll::-webkit-scrollbar-thumb,
.crm-table-scroll::-webkit-scrollbar-thumb,
.crm-actions-table-scroll::-webkit-scrollbar-thumb,
.home-pending-scroll::-webkit-scrollbar-thumb,
.record-audit-table-scroll::-webkit-scrollbar-thumb,
.follow-up-appt-summary-scroll::-webkit-scrollbar-thumb,
.rm-pr-recordings-scroll::-webkit-scrollbar-thumb,
.treatment-plan-bg-scroll-wrap::-webkit-scrollbar-thumb,
.treatment-plan-iv-picker-body-scroll::-webkit-scrollbar-thumb,
.crm-reporting-deposits-scroll::-webkit-scrollbar-thumb,
.crm-reporting-deposits-summary-scroll::-webkit-scrollbar-thumb,
.task-reporting-summary-table tbody::-webkit-scrollbar-thumb,
.conflicts-scroll::-webkit-scrollbar-thumb,
.task-labels-manage-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.utilization-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.case-loads-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.task-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.crm-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.crm-actions-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.home-pending-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.record-audit-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.follow-up-appt-summary-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.rm-pr-recordings-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.treatment-plan-bg-scroll-wrap:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.treatment-plan-iv-picker-body-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.crm-reporting-deposits-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.crm-reporting-deposits-summary-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.task-reporting-summary-table tbody:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb,
.conflicts-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb {
  background: var(--auto-scrollbar-thumb);
}

.utilization-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.case-loads-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.task-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.crm-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.crm-actions-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.home-pending-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.record-audit-table-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.follow-up-appt-summary-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.rm-pr-recordings-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.treatment-plan-bg-scroll-wrap:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.treatment-plan-iv-picker-body-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.crm-reporting-deposits-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.crm-reporting-deposits-summary-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.task-reporting-summary-table tbody:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.conflicts-scroll:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover,
.task-labels-manage-list:is(:hover, :focus-within, .scrollbar-active)::-webkit-scrollbar-thumb:hover {
  background: var(--auto-scrollbar-thumb-hover);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.view.hidden {
  display: none;
}

/* Login */
#login-view {
  background: var(--mh2-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--mh2-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  border: 1px solid var(--mh2-border);
}

.login-logo {
  max-width: 160px;
  height: auto;
  margin-bottom: 16px;
  display: block;
}

.login-header h1 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--mh2-primary-dark);
}

.login-header p {
  margin: 0 0 28px 0;
  color: var(--mh2-primary);
  font-size: 0.95rem;
}

.login-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--mh2-text);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--mh2-border);
  border-radius: 8px;
  margin-bottom: 18px;
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

.login-form input:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
  box-shadow: 0 0 0 3px rgba(44, 81, 105, 0.2);
}

.login-form .btn {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}

.error {
  color: var(--mh2-error);
  font-size: 0.875rem;
  margin: 0 0 12px 0;
}

.error.hidden {
  display: none;
}

.btn {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  transition: background 0.2s, color 0.2s;
}

.btn-primary {
  background: var(--mh2-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--mh2-primary-dark);
}

.login-google-required {
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--mh2-muted);
}

.login-google-wrap {
  margin-top: 20px;
  text-align: center;
}
.login-divider {
  display: block;
  margin: 14px 0 12px;
  font-size: 0.875rem;
  color: var(--mh2-muted);
}
.btn-google {
  display: inline-block;
  width: 100%;
  padding: 12px;
  text-align: center;
  font-size: 1rem;
  color: #1f2937;
  background: #fff;
  border: 1px solid var(--mh2-border);
  border-radius: 8px;
  text-decoration: none;
  box-sizing: border-box;
}
.btn-google:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-ghost {
  background: transparent;
  color: var(--mh2-primary);
}

.btn-ghost:hover {
  background: var(--mh2-border);
  color: var(--mh2-primary-dark);
}

/* Portal shell � left sidebar + content; only main area scrolls */
.portal-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  padding: 0 !important;
  background: var(--mh2-bg);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  min-height: 100vh;
  max-height: 100vh;
  background: var(--mh2-sidebar-bg);
  border-right: 1px solid var(--mh2-sidebar-border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--mh2-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar-brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--mh2-text);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-nav .nav-link,
.sidebar-nav .nav-link-footer,
.nav-link-footer {
  display: block;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--mh2-text);
  text-decoration: none;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover,
.nav-link-footer:hover {
  background: var(--mh2-bg);
  color: var(--mh2-primary-dark);
}

.sidebar-nav .nav-link.active,
.nav-link-footer.active {
  background: rgba(44, 81, 105, 0.1);
  color: var(--mh2-primary-dark);
}

.nav-group { margin: 4px 0; }

.nav-group-header {
  display: flex;
  align-items: center;
  margin: 2px 8px 0;
  border-radius: var(--radius-sm);
  min-height: 40px;
}

.nav-group-header .nav-link { flex: 1; margin: 0; min-width: 0; }

.nav-group-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0 4px 0 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--mh2-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-group-toggle:hover { color: var(--mh2-text); background: var(--mh2-bg); }

.nav-group-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.nav-group.collapsed .nav-group-arrow { transform: rotate(-90deg); }

.nav-sublist {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px 8px;
  border-left: 1px solid var(--mh2-border);
  margin-left: 20px;
}

.nav-group.collapsed .nav-sublist { display: none; }

.nav-sublink {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--mh2-text);
  text-decoration: none;
  font-size: 0.875rem;
}

.nav-sublink:hover { background: var(--mh2-bg); color: var(--mh2-primary-dark); }

.nav-sublink.active {
  background: rgba(44, 81, 105, 0.1);
  color: var(--mh2-primary-dark);
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--mh2-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-username {
  font-size: 0.875rem;
  color: var(--mh2-text-muted);
  margin: 0;
}

.sidebar-footer-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: stretch;
}

.sidebar-footer-actions .btn-sidebar {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.btn-sidebar { width: 100%; justify-content: center; }

/* Portal Help modal (Operations first draft) */
.portal-help-modal .crm-modal-content.portal-help-modal-content {
  max-width: 66rem;
  width: min(66rem, 100%);
  max-height: min(90vh, 52rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--mh2-border);
}

.portal-help-modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.portal-help-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 0.75rem 0.15rem 0.25rem 0;
  margin-right: -0.15rem;
}

.portal-help-lead {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  max-width: 40rem;
}

.portal-help-section {
  margin: 0 0 1.35rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--mh2-border);
}

.portal-help-section:last-child {
  border-bottom: none;
  margin-bottom: 0.25rem;
  padding-bottom: 0;
}

.portal-help-section h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--mh2-primary-dark, var(--mh2-text));
}

.portal-help-section h4 {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.portal-help-section p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.portal-help-section ul {
  margin: 0 0 0.55rem;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.portal-help-section li {
  margin-bottom: 0.25rem;
}

.portal-help-data {
  margin-top: 0.55rem !important;
  padding: 0.55rem 0.7rem;
  background: var(--mh2-bg, #f5f7f9);
  border-radius: var(--radius-sm, 6px);
  font-size: 0.85rem !important;
  line-height: 1.4;
}

.portal-help-table-wrap {
  overflow-x: auto;
  margin: 0.4rem 0 0.65rem;
}

.portal-help-table {
  width: 100%;
  font-size: 0.82rem;
}

.portal-help-table th,
.portal-help-table td {
  vertical-align: top;
  text-align: left;
}

.portal-help-modal .crm-modal-actions {
  flex-shrink: 0;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--mh2-border);
}

.portal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: auto;
  background: var(--mh2-bg);
  max-height: 100vh;
}

.page-content {
  flex: 1;
  padding: 24px 32px;
  overflow: auto;
  min-height: 0;
}

/* CRM detail: fill main column height and scroll inside #crm-detail-stack (see #page-crm rules). */
.page-content:has(#page-crm.crm-stitch.active) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
  margin: 0 0 20px 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--mh2-text);
}

/* Cards */
.card {
  background: var(--mh2-surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--mh2-border);
  box-shadow: var(--shadow);
}

.card h2, .card h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.welcome-card h1 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--mh2-primary-dark);
}

.tagline {
  color: var(--mh2-primary);
  margin: 0 0 16px 0;
}

.home-pending-card {
  margin-top: 0;
}

.home-pending-scroll {
  max-height: min(28rem, 60vh);
  overflow-y: auto;
  overflow-x: auto;
}

.home-pending-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  box-shadow: 0 1px 0 var(--mh2-border);
}

.home-pending-actions-cell {
  white-space: nowrap;
  width: 1%;
}

.home-pending-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card .stat-label {
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  color: var(--mh2-primary);
}

.stat-card .stat-value {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--mh2-primary-dark);
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  min-height: 280px;
}

.chart-card canvas {
  max-height: 240px;
}

/* Dashboard */
.dashboard-top-row {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.dashboard-revenue-card {
  text-align: center;
}

.dashboard-revenue-card .dashboard-box-title,
.dashboard-patients-card .dashboard-box-title {
  margin: 0 0 16px 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.dashboard-patients-card .dashboard-box-title {
  text-align: center;
}

.dashboard-revenue-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dashboard-sub-box {
  padding: 12px;
  background: var(--mh2-bg, #f8fafc);
  border-radius: var(--radius);
  border: 1px solid var(--mh2-border);
  text-align: center;
}

.dashboard-sub-box .dashboard-sub-title {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mh2-primary);
}

.dashboard-stat-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mh2-primary-dark);
}

.dashboard-patients-tables {
  display: grid;
  grid-template-columns: minmax(min-content, 1fr) minmax(min-content, 1fr);
  gap: 24px;
  overflow-x: auto;
  min-width: 0;
}

.dashboard-table-title {
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
  text-align: center;
}

.dashboard-patient-table-wrap {
  min-width: 0;
}

.dashboard-count-table { margin: 0; white-space: nowrap; }
.dashboard-count-table td { padding: 6px 12px 6px 0; }
.dashboard-count-label { font-weight: 600; }
.dashboard-count-indent { padding-left: 20px !important; }
.dashboard-count-indent-nested { padding-left: 40px !important; }

/* Keep Revenue and Patients cards same height */
.dashboard-revenue-card,
.dashboard-patients-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dashboard-revenue-card .dashboard-revenue-sub,
.dashboard-patients-card .dashboard-patients-tables {
  flex: 1;
  min-height: 0;
}

.task-reporting-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.task-reporting-summary .data-table {
  margin: 0;
}

/* Fixed height + scroll for the top 3 summary tables; Total stays at bottom */
.task-reporting-table-wrap {
  height: 260px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.task-reporting-summary-table {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.task-reporting-summary-table thead {
  flex-shrink: 0;
  display: block;
}

.task-reporting-summary-table thead tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.task-reporting-summary-table tbody {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: block;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.task-reporting-table-wrap:hover .task-reporting-summary-table tbody,
.task-reporting-summary-table tbody.scrollbar-active {
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

.task-reporting-summary-table tbody::-webkit-scrollbar {
  width: 8px;
}

.task-reporting-summary-table tbody::-webkit-scrollbar-track {
  background: transparent;
}

.task-reporting-summary-table tbody::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.task-reporting-table-wrap:hover .task-reporting-summary-table tbody::-webkit-scrollbar-thumb,
.task-reporting-summary-table tbody.scrollbar-active::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
}

.task-reporting-table-wrap:hover .task-reporting-summary-table tbody::-webkit-scrollbar-thumb:hover,
.task-reporting-summary-table tbody.scrollbar-active::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

.task-reporting-summary-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.task-reporting-summary-table tfoot {
  flex-shrink: 0;
  display: block;
}

.task-reporting-summary-table tfoot tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.task-reporting-summary-table th:first-child,
.task-reporting-summary-table td:first-child {
  width: 65%;
}

.task-reporting-summary-table th.num,
.task-reporting-summary-table td.num {
  width: 35%;
}

.report-total-row {
  font-weight: 600;
  border-top: 1px solid var(--mh2-border);
}

.task-reporting-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.task-reporting-filters label {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
  color: var(--mh2-text);
}

.task-reporting-filters select {
  min-width: 140px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

/* Home page: News/Updates and Wins cards */
.home-two-col {
  align-items: start;
}

.home-list-card {
  min-height: 200px;
}

.home-list-card h3 {
  margin: 0 0 14px 0;
}

.home-bullet-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-bullet-list li {
  position: relative;
  padding: 6px 0 6px 18px;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--mh2-text);
  border-bottom: 1px solid var(--mh2-border);
}

.home-bullet-list li:last-child {
  border-bottom: none;
}

.home-bullet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mh2-primary);
}

.home-wins-list li::before {
  background: var(--mh2-primary-light);
}

.meta {
  margin: 0 0 12px 0;
  font-size: 0.875rem;
  color: var(--mh2-primary);
}

.tables-list {
  list-style: none;
  margin: 0 0 24px 0;
  padding: 0;
}

.tables-list li {
  padding: 10px 12px;
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  border: 1px solid var(--mh2-border);
  margin-bottom: 8px;
  background: var(--mh2-bg);
}

/* Data tables (e.g. Patients page) */
.data-table-card {
  min-height: 200px;
}

.table-loading {
  margin: 0;
  font-size: 0.9rem;
  color: var(--mh2-primary);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--mh2-border);
}

.data-table th {
  font-weight: 600;
  color: var(--mh2-primary-dark);
  background: rgba(44, 81, 105, 0.06);
}

.data-table tbody tr:hover {
  background: rgba(44, 81, 105, 0.04);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.utilization-table-card-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.utilization-table-card-header .muted {
  margin: 0;
  margin-right: auto;
}
.utilization-table-wrapper .utilization-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.utilization-table-wrapper #utilization-table tr.utilization-total-row th,
.utilization-table-wrapper #utilization-table tr.utilization-total-row td {
  font-weight: 600;
  border-top: 2px solid var(--mh2-primary-dark);
}
.utilization-table-wrapper #utilization-table tr.utilization-pct-row th {
  font-weight: 500;
}
.utilization-table-wrapper #utilization-table {
  min-width: 600px;
}
/* Provider column only: no wrap, width fits names, solid background when sticky (use class so row 2 first cell isn't mistaken) */
.utilization-table-wrapper #utilization-table th.col-provider,
.utilization-table-wrapper #utilization-table td.col-provider {
  position: sticky;
  left: 0;
  background: var(--mh2-surface);
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0,0,0,0.04);
  white-space: nowrap;
  width: 1%;
}
.utilization-table-wrapper #utilization-table thead th.col-provider {
  background: var(--mh2-surface);
}
.utilization-table-wrapper #utilization-table th[rowspan] {
  vertical-align: middle;
}
/* Center all data columns (to the right of Provider) */
.utilization-table-wrapper #utilization-table td:not(.col-provider),
.utilization-table-wrapper #utilization-table th:not(.col-provider) {
  text-align: center;
}
.utilization-table-wrapper #utilization-table td:not(.col-provider).num,
.utilization-table-wrapper #utilization-table th:not(.col-provider).num {
  text-align: center;
}
/* Vertical divider to the LEFT of each new week (right of Utilization % = 5th, 10th, 15th column in data rows) */
.utilization-table-wrapper #utilization-table tr:first-child th:nth-child(n+2):not(:last-child) {
  border-right: 2px solid var(--mh2-border);
}
/* Row 2: 5 cells per week; border after 5th (Utilization %) = columns 5, 10, 15 */
.utilization-table-wrapper #utilization-table tr:nth-child(2) th:nth-child(5n) {
  border-right: 2px solid var(--mh2-border);
}
/* Body: 1 Provider + 5 per week; border after Utilization % = columns 6, 11, 16 */
.utilization-table-wrapper #utilization-table tbody td:nth-child(5n+6) {
  border-right: 2px solid var(--mh2-border);
}

.utilization-ave-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.utilization-ave-block {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  background: var(--mh2-surface);
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  min-width: 180px;
}
.utilization-ave-label {
  font-size: 0.85rem;
  color: var(--mh2-text-secondary);
  margin-bottom: 0.25rem;
}
.utilization-ave-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.utilization-capacity-spacer {
  height: 2rem;
  margin-top: 1.5rem;
}
.capacity-table-wrapper #capacity-table th.col-provider,
.capacity-table-wrapper #capacity-table td.col-provider {
  position: sticky;
  left: 0;
  background: var(--mh2-surface);
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0,0,0,0.04);
  white-space: nowrap;
  width: 1%;
}
.capacity-table-wrapper #capacity-table thead th.col-provider {
  background: var(--mh2-surface);
}
.capacity-table-wrapper #capacity-table thead th,
#capacity-by-type-table thead th {
  white-space: nowrap;
}
#capacity-by-type-table td {
  text-align: center;
}
.capacity-table-wrapper #capacity-table td:not(.col-provider),
.capacity-table-wrapper #capacity-table th:not(.col-provider) {
  text-align: center;
}
.capacity-spacer-row .capacity-spacer-cell {
  height: 2rem;
  background: var(--mh2-bg);
  border: none;
  vertical-align: middle;
}
.capacity-table-wrapper #capacity-table tr.capacity-by-type th {
  font-weight: 600;
  color: var(--mh2-primary-dark);
}
.capacity-table-wrapper #capacity-table td.capacity-negative {
  color: var(--mh2-error);
}
#capacity-by-type-table td.capacity-negative {
  color: var(--mh2-error);
}
.capacity-table-wrapper #hours-by-type-table th.col-provider,
.capacity-table-wrapper #hours-by-type-table td.col-provider {
  position: sticky;
  left: 0;
  background: var(--mh2-surface);
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0,0,0,0.04);
  white-space: nowrap;
  width: 1%;
}
.capacity-table-wrapper #hours-by-type-table thead th.col-provider {
  background: var(--mh2-surface);
}
#hours-by-type-table thead th {
  white-space: nowrap;
}
#hours-by-type-table td:not(.col-provider),
#hours-by-type-table th:not(.col-provider) {
  text-align: center;
}
.capacity-table-wrapper #hours-by-type-table tr.utilization-total-row th,
.capacity-table-wrapper #hours-by-type-table tr.utilization-total-row td {
  font-weight: 600;
  border-top: 2px solid var(--mh2-primary-dark);
}
.capacity-table-wrapper #hours-by-type-table thead th:nth-child(3),
.capacity-table-wrapper #hours-by-type-table tbody td:nth-child(3) {
  border-left: 2px solid var(--mh2-border);
}
#page-utilization th.util-sortable-th {
  cursor: pointer;
  user-select: none;
}
#page-utilization th.util-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}
#page-utilization .util-sort-ind {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.2em;
}

/* Conflicts: overlapping appointments tables */
.conflicts-table-card {
  margin-bottom: 1.5rem;
}
.conflicts-table-card:last-child {
  margin-bottom: 0;
}
.conflicts-table-heading {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  color: var(--mh2-primary-dark);
}
.conflicts-scroll {
  overflow: auto;
  max-width: 100%;
  max-height: 320px;
}
.conflicts-table {
  min-width: 480px;
  width: 100%;
}
.conflicts-table td {
  vertical-align: top;
}
.conflicts-table thead th {
  position: sticky;
  top: 0;
  background: var(--mh2-surface);
  z-index: 1;
  box-shadow: 0 1px 0 var(--mh2-border);
}

/* AI Tool: context include controls + scrollable result */
.ai-tool-include {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  background: var(--mh2-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.ai-tool-include-legend {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mh2-text-secondary);
  margin-bottom: 0.25rem;
  width: 100%;
}
.ai-tool-include-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--mh2-text-secondary);
}
.ai-tool-include-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}
.ai-tool-work-product {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  background: var(--mh2-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.ai-tool-prompt-details {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}
.ai-tool-prompt-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--mh2-primary);
}
.ai-tool-prompt-input {
  margin-top: 0.5rem;
  resize: vertical;
}
.ai-tool-chat-input {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  resize: vertical;
}
.ai-tool-result {
  max-height: 320px;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 1rem;
  background: #0b1020;
  color: #e4e7f5;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* AI Chat page */
.page-ai-chat .ai-chat-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: stretch;
}
.ai-chat-card {
  display: flex;
  flex-direction: column;
}
.ai-chat-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}
.ai-chat-transcript {
  flex: 1;
  min-height: 200px;
  max-height: 400px;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-y: auto;
  background: var(--mh2-surface);
}
.ai-chat-message {
  margin-bottom: 0.5rem;
  max-width: 100%;
}
.ai-chat-message-user {
  text-align: right;
}
.ai-chat-message-user .ai-chat-bubble {
  background: var(--mh2-primary);
  color: #fff;
  margin-left: auto;
}
.ai-chat-message-ai .ai-chat-bubble {
  background: #0b1020;
  color: #e4e7f5;
  margin-right: auto;
}
.ai-chat-bubble {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 100%;
}
.ai-chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.ai-chat-input {
  flex: 1;
  resize: vertical;
}
.ai-chat-send-btn {
  white-space: nowrap;
}

/* Patient Details page: center table values; diagnosis table left-aligned; encounters subtables side by side */
.patient-details-tables .data-table th,
.patient-details-tables .data-table td {
  text-align: center;
}
.patient-details-tables .patient-details-diagnosis-table th,
.patient-details-tables .patient-details-diagnosis-table td {
  text-align: left;
}
.patient-details-encounters-title {
  text-align: center;
}

/* Encounters section: two independent tables side by side (no Dashboard coupling) */
.pd-encounters-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: stretch;
}
.pd-encounters-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.pd-encounters-subtitle {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}
.pd-encounters-users-scroll {
  max-height: 320px;
}
/* Left table: vertical summary � compact, metric left, count right */
.pd-encounters-summary-table {
  width: max-content;
}
.pd-encounters-summary-table th,
.pd-encounters-summary-table td {
  text-align: left;
}
.pd-encounters-summary-table th:last-child,
.pd-encounters-summary-table td:last-child {
  padding-left: 1.25rem;
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
/* Right table: unsigned by user � compact, user left, count right */
.pd-encounters-users-table {
  width: max-content;
}
.pd-encounters-users-table th:first-child,
.pd-encounters-users-table td:first-child {
  text-align: left;
}
.pd-encounters-users-table th:last-child,
.pd-encounters-users-table td:last-child {
  padding-left: 1.25rem;
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.conflicts-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.sales-forecast-top-actions {
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Sales prototype: program � month table */
.sales-detail-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sales-detail-filter label {
  font-weight: 500;
}
.sales-detail-filter select {
  min-width: 160px;
  padding: 6px 10px;
  font-size: 0.95rem;
}
.sales-detail-filter input {
  min-width: 140px;
  padding: 6px 10px;
  font-size: 0.95rem;
}

.sales-forecast-detail-filter {
  flex-wrap: wrap;
}

#sales-forecast-detail-export-btn {
  margin-left: auto;
}

.table-sort-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.table-sort-btn:focus-visible {
  outline: 2px solid rgba(31, 99, 187, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}
.table-sort-indicator {
  font-size: 0.8em;
  opacity: 0.75;
}
.sales-table-wrap {
  margin-top: 12px;
  max-height: 420px;
}

/* Admin page: layout + panels */
.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-intro-card {
  border-left: 4px solid var(--mh2-primary);
}

.admin-intro-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.admin-meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 1rem 0 0 0;
}

.admin-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-meta-item dt {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mh2-text-secondary);
}

.admin-meta-item dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
}

.pill-soft {
  background: rgba(31, 99, 187, 0.07);
  color: var(--mh2-primary-dark);
  border: 1px solid rgba(31, 99, 187, 0.16);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: flex-start;
  }
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.admin-panel-title {
  margin: 0 0 0.25rem 0;
}

.admin-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-table-wrap {
  max-height: 360px;
  overflow: auto;
  border-radius: 6px;
  border: 1px solid var(--mh2-border-subtle);
  background: var(--mh2-surface-soft);
  padding: 0.5rem;
}

.admin-table-wrap table {
  margin: 0;
}

.admin-form {
  margin-top: 0.5rem;
}

.admin-fieldset {
  border: 1px solid var(--mh2-border-subtle);
  border-radius: 8px;
  padding: 0.75rem 0.9rem 0.9rem;
}

.admin-fieldset-legend {
  padding: 0 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mh2-text-secondary);
}

.form-row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-row-inline .form-field {
  flex: 1 1 220px;
}

.field-help {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--mh2-text-secondary);
}

.admin-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

#page-admin .form-field-label-strong {
  margin: 0 0 0.35rem 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.admin-role-picker {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--mh2-border-subtle);
  background: var(--mh2-surface);
  font-size: 0.9rem;
  max-height: 12rem;
  overflow-y: auto;
}

.admin-role-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  cursor: pointer;
  font-weight: normal;
}

.admin-role-picker-row input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}

.admin-role-picker-row span {
  line-height: 1.35;
}

#page-admin .form-field > label {
  display: block;
  margin: 0 0 0.35rem 0;
  font-size: 0.875rem;
  font-weight: 600;
}

#page-admin .admin-form input[type="text"],
#page-admin .admin-form input[type="email"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
}

.data-table .admin-user-name-cell {
  max-width: 16rem;
}
.data-table .admin-user-email-cell {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table .admin-user-name-inner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.data-table .admin-user-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table .admin-user-name-cell .task-card-avatar {
  flex-shrink: 0;
}

.admin-avatar-color-field {
  min-width: 12rem;
}
.admin-avatar-color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-avatar-color-row input[type="color"] {
  width: 2.4rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--mh2-border, #ccc);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.data-table .admin-user-roles-col-actions {
  width: 5.75rem;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

#page-admin #admin-user-roles-modal .crm-modal-content {
  max-width: 32rem;
}

#page-admin .admin-user-roles-modal-body .admin-user-roles-modal-label {
  margin: 0 0 0.35rem 0;
}

#page-admin .admin-user-roles-modal-email {
  margin: 0 0 0.85rem 0;
  word-break: break-all;
}

#page-admin .admin-user-roles-modal-names {
  margin: 0 0 1rem 0;
}

#page-admin .admin-user-roles-modal-names .form-field label {
  margin-top: 0;
}

#page-admin .admin-user-roles-modal-hint {
  margin-top: 0.35rem;
}

#page-admin .admin-user-roles-modal-error {
  margin-top: 0.75rem;
}

#page-admin .admin-user-roles-modal-delete {
  color: var(--mh2-danger, #c00);
}
.sales-table-wrap-single {
  overflow: auto;
}
.sales-table-wrap-single .sales-program-table {
  min-width: 400px;
}
/* Sticky header and first column with solid backgrounds (no transparent) so content does not show through */
#sales-table thead th,
#sales-detail-table thead th {
  font-weight: 600;
  color: var(--mh2-primary-dark);
  background: var(--mh2-surface);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}
#sales-table th:first-child,
#sales-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--mh2-surface);
  width: 14rem;
  min-width: 14rem;
  max-width: 14rem;
  box-sizing: border-box;
  border-right: 2px solid var(--mh2-border);
}
#sales-table thead th:first-child {
  z-index: 3;
}
/* Detail table: wider first column for long names (e.g. "Deposit - Advanced Assessment") */
#sales-detail-table th:first-child,
#sales-detail-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--mh2-surface);
  width: 22rem;
  min-width: 22rem;
  max-width: 22rem;
  box-sizing: border-box;
  border-right: 2px solid var(--mh2-border);
}
#sales-detail-table thead th:first-child {
  z-index: 3;
}
.sales-program-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.sales-program-table th,
.sales-program-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--mh2-border);
}
.sales-program-table th.num,
.sales-program-table td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sales-program-table th:first-child,
.sales-program-table td:first-child {
  text-align: left;
}
.sales-program-table th:nth-child(2),
.sales-program-table td:nth-child(2) {
  white-space: nowrap;
  min-width: 9rem;
}
.sales-program-table td:first-child:not(.sales-section-label) {
  white-space: nowrap;
  min-width: 9rem;
}
.sales-program-table .sales-total-row td {
  border-top: 1px solid var(--mh2-border);
  padding-top: 12px;
}
.sales-program-table tr.sales-section-divider td {
  border-top-width: 3px;
  border-top-color: var(--mh2-primary, #2c5169);
}
.sales-program-table .sales-balance-row td {
  border-top: 2px solid var(--mh2-primary);
  padding-top: 12px;
}
.sales-program-table td.sales-subrow {
  padding-left: 28px;
}
.sales-program-table td.sales-subrow-nested {
  padding-left: 48px;
}
.sales-program-table td.sales-section-label {
  font-size: 1.15em;
  font-weight: 600;
  color: var(--mh2-primary, #2c5169);
  text-align: center;
  vertical-align: middle;
  width: 1%;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 12px;
  border-right: 1px solid var(--mh2-border, #e0e0e0);
}
/* Treatment wizard (single-page) */
.treatment-one-page .treatment-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--mh2-border);
}

.treatment-one-page .treatment-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Treatment page � card-based layout */
.page-treatment .page-tagline.treatment-tagline {
  margin: -4px 0 20px 0;
  color: var(--mh2-text-muted);
  font-size: 0.95rem;
}

.page-treatment .treatment-form {
  max-width: 720px;
}

.page-treatment .treatment-form-layout {
  width: 100%;
}

.treatment-form-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.treatment-card {
  background: var(--mh2-surface);
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.treatment-card-header {
  padding: 14px 18px;
  background: rgba(44, 81, 105, 0.05);
  border-bottom: 1px solid var(--mh2-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.treatment-card-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.treatment-card-summary::-webkit-details-marker {
  display: none;
}

.treatment-card-summary::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--mh2-text-muted);
  vertical-align: middle;
  transition: transform 0.2s ease;
}

details[open] .treatment-card-summary::after {
  transform: rotate(180deg);
}

.treatment-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.treatment-card-badge {
  font-size: 0.8rem;
  color: var(--mh2-text-muted);
  font-weight: 400;
}

.treatment-card-body {
  padding: 18px;
}

.treatment-top-row {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(260px, 1fr);
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 720px) {
  .treatment-top-row {
    grid-template-columns: 1fr;
  }
}

.treatment-card-patient .treatment-card-body,
.treatment-card-plan-period .treatment-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.treatment-plan-period-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.treatment-plan-period-dates > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.treatment-sublabel {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--mh2-text-muted);
}

.treatment-input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

.treatment-input:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
  box-shadow: 0 0 0 2px rgba(44, 81, 105, 0.15);
}

.treatment-date {
  width: 100%;
  max-width: 160px;
}

.treatment-label {
  display: block;
  font-weight: 500;
  color: var(--mh2-text);
  margin-bottom: 4px;
}

.treatment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.treatment-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: var(--mh2-text);
  cursor: pointer;
}

.treatment-option input {
  margin: 0;
  flex-shrink: 0;
}

.treatment-subsection {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--mh2-border);
}

.treatment-subsection-title {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mh2-text-muted);
}

/* Metabolic & lifestyle: 4 rows with header column */
.treatment-metabolic-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.treatment-metabolic-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px 20px;
  align-items: start;
  min-height: 2.5rem;
}

.treatment-metabolic-row + .treatment-metabolic-row {
  border-top: 1px solid var(--mh2-border);
  padding-top: 10px;
  margin-top: 6px;
}

.treatment-metabolic-header {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--mh2-primary-dark);
  padding-top: 2px;
}

.treatment-metabolic-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.treatment-card-justification .treatment-card-header {
  flex-wrap: wrap;
}

.treatment-char-count {
  font-size: 0.8rem;
  color: var(--mh2-text-muted);
  font-weight: 400;
}

.treatment-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
  resize: vertical;
}

.treatment-textarea:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
  box-shadow: 0 0 0 2px rgba(44, 81, 105, 0.15);
}

.treatment-actions {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.treatment-submit {
  align-self: flex-start;
}

/* View Treatment Plans page */
.page-treatment-plans .page-tagline.treatment-plans-tagline {
  margin: -4px 0 20px 0;
  color: var(--mh2-text-muted);
  font-size: 0.95rem;
}

.treatment-plans-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 960px;
}

.treatment-plans-filter-form {
  display: block;
}

.treatment-plans-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-end;
}

.treatment-plans-filter-field {
  flex: 0 1 200px;
  min-width: 0;
}

.treatment-plans-filter-field .treatment-input {
  max-width: 100%;
}

.treatment-plans-filter-actions {
  flex: 0 0 auto;
}

.treatment-plans-results-card .treatment-card-body {
  overflow-x: auto;
}

.treatment-plans-results .data-table {
  width: 100%;
  min-width: 640px;
}

.treatment-plans-results .muted {
  margin: 0;
}

/* Mobile page (Provider ? Mobile) */
.page-mobile .page-tagline.mobile-tagline {
  margin: -4px 0 20px 0;
  color: var(--mh2-text-muted);
  font-size: 0.95rem;
}

.mobile-page-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
}

.mobile-card .treatment-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-card-desc {
  margin: 0;
  font-size: 0.9rem;
}

.mobile-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-form .treatment-textarea {
  min-height: 60px;
}

.mobile-btn {
  align-self: flex-start;
}

.mobile-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-overview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.mobile-overview-section-title {
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--mh2-primary-dark);
}

.mobile-overview-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.mobile-overview-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.mobile-overview-list li:last-child {
  border-bottom: none;
}

.mobile-overview-remove-btn {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: none;
  background: rgba(185, 28, 28, 0.04);
  color: var(--mh2-error);
  cursor: pointer;
}

.mobile-overview-remove-btn:hover {
  background: rgba(185, 28, 28, 0.12);
}

.mobile-option-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.mobile-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.mobile-task-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-task-row {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--mh2-surface);
}

/* Mobile page: label + dropdown row (like Tasks view dropdown) */
.mobile-select-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.mobile-select-label {
  flex: 0 0 120px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--mh2-primary-dark);
  padding-top: 8px;
}

.mobile-select {
  flex: 1;
  min-width: 180px;
  min-height: 120px;
  padding: 8px 10px;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  background: var(--mh2-surface);
  font: inherit;
  font-size: 0.9rem;
  color: var(--mh2-text);
}

.mobile-select:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
}

.wizard-card h1 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--mh2-primary-dark);
}

.wizard-desc {
  margin: 0 0 24px 0;
  color: var(--mh2-primary);
  font-size: 0.95rem;
}

.wizard-step {
  margin-bottom: 20px;
}

.wizard-step label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--mh2-text);
}

.wizard-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.wizard-row input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--mh2-border);
  border-radius: 8px;
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

.wizard-row input:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
}

.wizard-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.wizard-questions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wizard-q {
  padding: 16px;
  border: 1px solid var(--mh2-border);
  border-radius: 8px;
  background: rgba(44, 81, 105, 0.03);
}

.wizard-q > label {
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
  color: var(--mh2-primary-dark);
}

.wizard-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.wizard-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  cursor: pointer;
}

.wizard-radio input {
  margin: 0;
}

.treatment-details-table {
  margin: 12px 0;
}

.treatment-recommendation {
  padding: 16px;
  border-radius: 8px;
  background: rgba(44, 81, 105, 0.06);
  border: 1px solid var(--mh2-border);
  margin-bottom: 16px;
}

.treatment-recommendation ul {
  margin: 8px 0 0 0;
  padding-left: 24px;
}

/* News page */
.news-intro-card h1 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--mh2-primary-dark);
}

.news-intro-card .tagline {
  margin: 0 0 16px 0;
}

.news-feed-card h2,
.news-sources-card h2 {
  margin: 0 0 12px 0;
  font-size: 1.15rem;
  color: var(--mh2-primary-dark);
}

.news-placeholder {
  margin: 0;
  color: var(--mh2-primary);
  font-size: 0.95rem;
}

.news-feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-feed-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--mh2-border);
}

.news-feed-list li:last-child {
  border-bottom: none;
}

.news-feed-list a {
  color: var(--mh2-primary);
  font-weight: 500;
  text-decoration: none;
}

.news-feed-list a:hover {
  text-decoration: underline;
}

.news-feed-list .news-item-meta {
  font-size: 0.875rem;
  color: var(--mh2-text-muted);
  margin-top: 4px;
  display: block;
}

.news-item-snippet {
  font-size: 0.9rem;
  color: var(--mh2-text);
  margin: 6px 0 4px 0;
  line-height: 1.4;
}

.news-summarize-btn {
  margin-top: 8px;
  font-size: 0.875rem;
}

.news-findings {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--mh2-bg-subtle, #f5f5f5);
  border-radius: 6px;
  font-size: 0.9rem;
}

.news-findings-title {
  margin: 0 0 6px 0;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.news-findings-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--mh2-text);
  line-height: 1.45;
}

.news-findings-list li {
  padding: 2px 0;
  border-bottom: none;
}

.news-diagnostic-row {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
}
.news-vertex-status {
  margin-left: 8px;
  font-size: 0.85rem;
  color: var(--mh2-text-muted);
}
.news-vertex-status.error {
  color: var(--mh2-danger, #c00);
}

.news-meta,
#news-feed-meta {
  margin: 12px 0 0 0;
  font-size: 0.85rem;
  color: var(--mh2-text-muted);
}

.news-sources-list {
  margin: 12px 0;
  padding-left: 24px;
}

.news-sources-list li {
  margin-bottom: 8px;
}

.news-sources-note {
  margin: 16px 0 0 0;
  font-size: 0.9rem;
  color: var(--mh2-primary);
}

.news-subhead {
  margin: 20px 0 10px 0;
  font-size: 1.05rem;
  color: var(--mh2-primary-dark);
}

.news-category-label {
  margin: 14px 0 6px 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--mh2-primary);
}

.news-sources-card .news-sources-list a {
  color: var(--mh2-primary);
  font-weight: 500;
  text-decoration: none;
}

.news-sources-card .news-sources-list a:hover {
  text-decoration: underline;
}

.news-sources-card code {
  font-size: 0.85rem;
  background: rgba(44, 81, 105, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Task board (Trello-like) */
.task-board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
}

.task-table-view {
  margin-top: 0.25rem;
}

.task-table-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.task-table-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  flex: 0 0 auto;
}

.task-table-filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mh2-text);
  white-space: nowrap;
}

.task-table-filter-select {
  width: 8.5rem;
  min-width: 7rem;
  max-width: 10rem;
  box-sizing: border-box;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.82rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

#task-table-filter-patient.task-table-filter-select {
  width: 7rem;
  min-width: 6rem;
  max-width: 8rem;
}

.task-table-toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex: 0 0 auto;
}

#task-table-mark-complete-btn {
  white-space: nowrap;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1.25;
}
#task-table-mark-complete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
#task-table-mark-complete-btn:disabled:hover {
  background: var(--mh2-primary);
}

#task-table-selection-count {
  white-space: nowrap;
  font-size: 0.8rem;
}

.task-table-scroll {
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
  background: var(--mh2-surface);
}

#task-table-view .task-table-scroll {
  overflow-x: auto;
  width: 100%;
}

.task-table {
  margin: 0;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#task-table.task-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.project-table.task-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.task-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--mh2-surface);
}

.task-table-check-col {
  width: 2.5rem;
  min-width: 2.5rem;
  text-align: center;
}

.task-table-check-col input[type="checkbox"],
.task-table-row-check {
  margin: 0;
  cursor: pointer;
}

.task-table-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.task-table-sort-indicator {
  font-size: 0.85em;
  font-weight: 700;
  margin-left: 0.2em;
  opacity: 0.85;
}

.task-table tbody tr {
  cursor: pointer;
}

.task-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

.task-table-cell-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#task-table th,
#task-table td {
  padding: 8px 10px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#task-table .task-table-check-col {
  width: 2.5rem;
  min-width: 2.5rem;
  overflow: visible;
  text-overflow: unset;
}

#task-table th[data-sort-key="assignee"],
#task-table td.task-table-col-assignee {
  width: 6.5rem;
  min-width: 6.5rem;
}

#task-table th[data-sort-key="project"],
#task-table td.task-table-col-project {
  width: 11rem;
  min-width: 10rem;
  max-width: 12rem;
}

#task-table th[data-sort-key="patient_id"],
#task-table td.task-table-col-patient {
  width: 7.5rem;
  min-width: 7.5rem;
}

#task-table th[data-sort-key="title"],
#task-table td.task-table-title-cell {
  width: 22rem;
  min-width: 18rem;
  max-width: 28rem;
}

#task-table td.task-table-title-cell .task-table-title-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#task-table th[data-sort-key="due_date"],
#task-table td.task-table-col-due {
  width: 7rem;
  min-width: 7rem;
}

#task-table th[data-sort-key="status"],
#task-table td.task-table-col-status {
  width: 7.5rem;
  min-width: 7.5rem;
}

#task-table .task-table-blocked-th,
#task-table .task-table-blocked-cell {
  width: 5.5rem;
  min-width: 5.5rem;
}

#task-table .task-table-assignee-avatars {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
}

#task-table .task-table-assignee-avatars .task-card-avatar {
  width: 22px;
  height: 22px;
  font-size: 0.58rem;
  flex-shrink: 0;
  border: 2px solid var(--mh2-surface);
  box-sizing: border-box;
}

#task-table .task-table-assignee-avatars .task-card-avatar + .task-card-avatar {
  margin-left: -6px;
}

.task-column {
  flex: 0 0 280px;
  min-width: 280px;
  background: var(--mh2-surface);
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}

.task-column-header {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--mh2-text);
  border-bottom: 1px solid var(--mh2-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-column-header-title {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  margin: -2px -4px;
}

.task-column-header-title:hover {
  background: rgba(44, 81, 105, 0.06);
}

.task-list-name-input {
  flex: 1;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 4px 6px;
  border: 1px solid var(--mh2-primary-light);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
  min-width: 0;
}

.task-list-delete-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--mh2-text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.task-list-delete-btn:hover {
  color: var(--mh2-error);
  background: rgba(185, 28, 28, 0.08);
}

.task-column-add-list {
  min-width: 200px;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12px;
}

.task-column-add-list .task-add-list-btn {
  color: var(--mh2-text-muted);
  font-weight: 500;
}

.task-column-add-list .task-add-list-btn:hover {
  color: var(--mh2-primary);
  background: rgba(44, 81, 105, 0.06);
}

.task-card-drop-before {
  border-top: 3px solid var(--mh2-primary);
  margin-top: -3px;
}

.task-card-drop-after {
  border-bottom: 3px solid var(--mh2-primary);
  margin-bottom: -3px;
}

.task-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.task-page-header .page-title {
  margin: 0;
}

.task-page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.task-board-assignee-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.task-board-assignee-filter.hidden {
  display: none;
}

.task-board-assignee-filter .task-table-filter-select {
  width: 10rem;
  max-width: 12rem;
}

.task-card-fields {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.task-card-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  font-size: 0.75rem;
  line-height: 1.25;
}

.task-card-field-k {
  flex: 0 0 4.6rem;
  color: var(--mh2-text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.task-card-field-v {
  min-width: 0;
  color: var(--mh2-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-field-v.task-card-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  overflow: visible;
  white-space: normal;
  text-overflow: unset;
}

.task-card-field .task-card-avatar {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  font-size: 0.55rem;
}

.task-blocked-hidden-count {
  font-size: 0.85rem;
  white-space: nowrap;
}

.task-card-blocked {
  opacity: 0.78;
  border-style: dashed;
}

.task-card-blocked-badge {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: #8a5a00;
  background: #fff6e5;
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

button.task-card-prereq-link {
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.task-card-mark-complete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.task-prereq-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
}

.task-prereq-link {
  flex: 1;
  min-width: 0;
  color: var(--mh2-accent, #0b5fff);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.9375rem;
  word-break: break-word;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.task-prereq-link:hover {
  opacity: 0.85;
}

.task-prereq-none {
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  color: var(--mh2-text-muted, #666);
}

.task-prereq-edit-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.task-prereq-select.hidden {
  display: none;
}

.task-view-dropdown-wrap {
  display: inline-flex;
  align-items: center;
}

.task-view-select {
  min-width: 140px;
  padding: 6px 10px;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  background: var(--mh2-bg);
  font: inherit;
  color: var(--mh2-text);
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.task-card-top .task-card-title {
  flex: 1;
  min-width: 0;
  margin: 0 0 4px 0;
}

.task-card-mark-complete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1.5px solid var(--mh2-border);
  border-radius: 50%;
  background: transparent;
  color: var(--mh2-text-muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.task-card-mark-complete:hover:not(.complete) {
  border-color: var(--mh2-primary-light);
  color: var(--mh2-primary-light);
}

.task-card[data-status="complete"] .task-card-mark-complete,
.task-card-mark-complete.complete {
  border-color: var(--mh2-primary);
  background: var(--mh2-primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
}


.task-column-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 60px;
}

.task-card {
  background: var(--mh2-bg);
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s;
}

.task-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.task-card.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.task-card-title {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--mh2-text);
  margin: 0 0 4px 0;
}

.task-card-meta {
  font-size: 0.8rem;
  color: var(--mh2-text-muted);
  margin: 0;
}

.task-column-add {
  padding: 8px 14px;
  border-top: 1px solid var(--mh2-border);
  flex-shrink: 0;
}

.task-column-add .btn {
  width: 100%;
  justify-content: center;
  color: var(--mh2-text-muted);
  font-weight: 500;
}

.task-column-add .btn:hover {
  color: var(--mh2-primary);
  background: rgba(44, 81, 105, 0.06);
}

.task-column.drop-target {
  background: rgba(44, 81, 105, 0.04);
  border-color: var(--mh2-primary-light);
}

/* Task labels (Trello-style) */
.task-label-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 6px;
}

.task-label-chips-compact {
  position: relative;
  margin-bottom: 6px;
  row-gap: 6px;
}

.task-label-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--task-label-color, #61bd4f);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-label-chips-compact .task-label-chip {
  position: relative;
  box-sizing: border-box;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 8px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 8px;
  color: transparent;
  overflow: hidden;
  cursor: default;
  user-select: none;
}

/* Enlarge the hover target around the 8px color bar without covering neighbors */
.task-label-chips-compact .task-label-chip::before {
  content: "";
  position: absolute;
  top: -5px;
  right: -1px;
  bottom: -5px;
  left: -1px;
}

.task-label-hover-tip {
  position: fixed;
  z-index: 400;
  max-width: min(240px, calc(100vw - 16px));
  padding: 5px 8px;
  border-radius: 4px;
  background: #1f2937;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}

.task-modal-labels-section {
  margin: 0.25rem 0 0.55rem;
}

.task-modal-labels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.task-modal-labels-heading {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--mh2-text-muted, #5b6b7a);
}

.task-labels-manage-btn {
  margin: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  min-height: 0;
}

.task-label-selected {
  min-height: 1.15rem;
}

.task-label-selected .task-label-chips {
  margin: 0;
}

.task-label-picker-empty {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
}

.task-labels-manage-modal {
  max-width: 36rem;
}

.task-labels-manage-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0.35rem 0 0.65rem;
  max-height: min(16rem, 40vh);
  overflow-y: auto;
  padding: 2px 0;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
}

.task-labels-manage-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.28rem 0.5rem;
  border: none;
  border-radius: 0;
  background: transparent;
  font-weight: 400;
  cursor: default;
}

.task-labels-manage-row:hover {
  background: rgba(44, 81, 105, 0.06);
}

.task-labels-manage-row .task-label-apply-check {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  flex-shrink: 0;
}

.task-labels-manage-row .task-label-chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 8rem;
}

.task-labels-manage-row .task-label-edit-name {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  min-height: 1.75rem;
  height: 1.75rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  line-height: 1.25;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

.task-labels-manage-row .task-label-color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  flex-shrink: 0;
}

.task-labels-manage-row .task-label-color-picker-row input[type="color"] {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--mh2-border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.task-labels-manage-row .task-label-color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  min-width: 4.25rem;
}

.task-labels-manage-row .btn {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  min-height: 1.75rem;
  line-height: 1.2;
}

.task-labels-manage-create {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--mh2-border);
}

.task-labels-manage-create-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.task-labels-manage-create-row #task-label-new-name {
  flex: 1 1 8rem;
  min-width: 0;
  min-height: 1.75rem;
  height: 1.75rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  line-height: 1.25;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

.task-labels-manage-create-row .task-label-color-picker-row {
  margin: 0;
}

.task-label-color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.25rem 0 0.5rem;
}

.task-label-color-picker-row input[type="color"] {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--mh2-border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.task-label-color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.task-label-filter-wrap {
  display: inline-flex;
  align-items: center;
}

.project-table-name-btn,
.project-table-count-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--mh2-primary, #2c5169);
  font: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.project-table-count-btn {
  font-variant-numeric: tabular-nums;
}

.project-table-drag-th,
.project-table-drag-col {
  width: 1.75rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.project-table-drag-handle {
  display: inline-block;
  color: var(--mh2-text-muted, #6b7280);
  cursor: grab;
  user-select: none;
  letter-spacing: -0.1em;
}

.project-table-row[draggable="true"] {
  cursor: grab;
}

.project-table-row-dragging {
  opacity: 1;
}

.project-table-row-dragging td {
  background: rgba(44, 81, 105, 0.06);
  color: transparent;
  text-shadow: none;
  border-color: transparent;
}

.project-table-row-dragging td * {
  visibility: hidden;
}

.project-table-row-drop {
  box-shadow: inset 0 2px 0 0 var(--mh2-primary, #2c5169);
  background: rgba(44, 81, 105, 0.05);
}

.project-table-drag-ghost {
  position: fixed;
  top: -9999px;
  left: 0;
  z-index: 10000;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--mh2-border, #d1d5db);
  border-radius: 6px;
  background: var(--mh2-surface, #fff);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--mh2-text, #1f2937);
  white-space: nowrap;
  pointer-events: none;
}

/* Task modals (Tasks board + Task Templates step editor) */
.task-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.task-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.task-modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 48px);
  margin: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.task-modal-content.card {
  margin-bottom: 0;
}

.task-modal-content.task-modal-edit-wrapper {
  max-width: 720px;
}

.task-modal-content.card.task-card-modal {
  max-width: 920px;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  min-height: min(860px, calc(100vh - 16px));
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.task-card-chrome {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 10px 16px 8px;
  background: #fff;
}

.task-card-chrome::before {
  content: "";
}

.task-card-project-header {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 2px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  max-width: min(70vw, 420px);
}

.task-card-project-header .task-card-context-k {
  flex-shrink: 0;
}

.task-card-project-header .task-card-context-v {
  max-width: 280px;
}

.task-card-context {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  min-width: 0;
}

.task-card-context-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.task-card-context-btn {
  cursor: pointer;
  border-radius: 4px;
}

.task-card-context-btn:hover .task-card-context-v {
  text-decoration: underline;
}

.task-card-context-k {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--mh2-text-muted);
}

.task-card-context-v {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mh2-text);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-context-v.is-empty {
  font-weight: 500;
  color: var(--mh2-text-muted);
}

.task-card-chrome-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  justify-self: end;
}

.task-card-delete-btn {
  color: var(--mh2-error);
}

.task-card-close-btn {
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--mh2-text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.task-card-close-btn:hover {
  background: #f3f4f6;
  color: var(--mh2-text);
}

.task-card-divider {
  flex-shrink: 0;
  height: 0;
  border: 0;
  border-top: 1px solid var(--mh2-border);
  margin: 0 16px;
}

.task-card-shell {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow: hidden;
}

.task-card-main {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 22px 24px;
}

.task-card-side {
  flex: 0 0 300px;
  width: 300px;
  min-width: 240px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 16px 16px;
  border-left: 1px solid var(--mh2-border);
  background: #f6f7f8;
}

.task-card-details {
  margin: 8px 0 16px;
}

.task-card-details-chips {
  margin-bottom: 8px;
}

.task-card-avatars {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.task-card-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: hsl(var(--task-avatar-hue, 200), 42%, 38%);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.task-card-avatar.is-add {
  background: #e8eaed;
  color: var(--mh2-text-muted);
  font-size: 1rem;
  font-weight: 500;
}

.task-card-meta-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.task-card-meta-heading {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--mh2-text-muted);
}

.task-card-meta-values {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.task-card-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: #e8eaed;
  font-size: 0.75rem;
  font-weight: 600;
}

.task-assignee-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-card-side .task-modal-add-comment {
  margin-top: 0;
  margin-bottom: 12px;
}

.task-card-side .task-mention-menu {
  top: calc(100% + 4px);
  bottom: auto;
}

.task-comment {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.task-card-shell {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow: hidden;
}

.task-card-main {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 22px 24px;
}

.task-card-side {
  flex: 0 0 300px;
  width: 300px;
  min-width: 240px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 16px 16px;
  border-left: 1px solid var(--mh2-border);
  background: #f6f7f8;
}

.task-card-side {
  flex: 0 0 280px;
  width: 280px;
  min-width: 220px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 16px;
  border-left: 1px solid var(--mh2-border);
  background: #f6f7f8;
}

.task-card-side .task-modal-comments-title,
.task-card-side .task-modal-comments-title {
  flex-shrink: 0;
}

.task-card-side .task-modal-comments-list,
.task-card-side .task-modal-comments-list {
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.task-card-side .task-modal-add-comment,
.task-card-side .task-modal-add-comment,
.task-card-side-placeholder,
.task-card-side-placeholder {
  flex-shrink: 0;
}

.task-card-side-placeholder {
  margin: 0;
  font-size: 0.8rem;
}

.task-card-list-name {
  margin: 0 0 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--mh2-text-muted);
  line-height: 1.3;
}

.task-card-list-name:not(:empty)::before {
  content: "in list ";
  font-weight: 400;
}

.task-modal-content .task-card-title-input,
.task-card-title-input {
  width: 100%;
  margin: 0 0 10px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--mh2-text);
}

.task-card-title-input:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
  background: #fff;
}

.task-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.task-card-chips-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.task-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--mh2-border);
  border-radius: 999px;
  background: #fff;
  color: var(--mh2-text);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.task-card-chip::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.72;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

.task-card-chip[data-task-chip="labels"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M2.5 8.5V3.5A1 1 0 0 1 3.5 2.5h5l5 5-5 5-5-5Z'/><circle cx='6' cy='6' r='1'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M2.5 8.5V3.5A1 1 0 0 1 3.5 2.5h5l5 5-5 5-5-5Z'/><circle cx='6' cy='6' r='1'/></svg>");
}

.task-card-chip[data-task-chip="due"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><circle cx='8' cy='8' r='5.5'/><path d='M8 5.5V8l2 1.5'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><circle cx='8' cy='8' r='5.5'/><path d='M8 5.5V8l2 1.5'/></svg>");
}

.task-card-chip[data-task-chip="assignees"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><circle cx='8' cy='5.5' r='2.25'/><path d='M3.5 13c.6-2.4 2.3-3.5 4.5-3.5s3.9 1.1 4.5 3.5'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><circle cx='8' cy='5.5' r='2.25'/><path d='M3.5 13c.6-2.4 2.3-3.5 4.5-3.5s3.9 1.1 4.5 3.5'/></svg>");
}

.task-card-chip[data-task-chip="checklist"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><rect x='2.5' y='2.5' width='11' height='11' rx='2'/><path d='M5 8.2 7.1 10.2 11.2 5.8'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><rect x='2.5' y='2.5' width='11' height='11' rx='2'/><path d='M5 8.2 7.1 10.2 11.2 5.8'/></svg>");
}

.task-card-chip[data-task-chip="status"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><circle cx='8' cy='8' r='5.5'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><circle cx='8' cy='8' r='5.5'/></svg>");
}

.task-card-chip[data-task-chip="project"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M2.5 5.5h11v7a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-7Z'/><path d='M2.5 5.5 4 3h3.5l1.5 2.5'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M2.5 5.5h11v7a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-7Z'/><path d='M2.5 5.5 4 3h3.5l1.5 2.5'/></svg>");
}

.task-card-chip[data-task-chip="patient"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><rect x='2.5' y='3.5' width='11' height='9' rx='1.5'/><path d='M5 8h6M5 10.5h3.5'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><rect x='2.5' y='3.5' width='11' height='9' rx='1.5'/><path d='M5 8h6M5 10.5h3.5'/></svg>");
}

.task-card-chip[data-task-chip="prereq"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M6.5 9.5 5 11a2.2 2.2 0 1 1-3-3l1.5-1.5M9.5 6.5 11 5a2.2 2.2 0 1 1 3 3L12.5 9.5M6.8 9.2l2.4-2.4'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M6.5 9.5 5 11a2.2 2.2 0 1 1-3-3l1.5-1.5M9.5 6.5 11 5a2.2 2.2 0 1 1 3 3L12.5 9.5M6.8 9.2l2.4-2.4'/></svg>");
}

.task-card-chip[data-task-chip="attachments"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M9.2 4.8 4.6 9.4a2.4 2.4 0 0 0 3.4 3.4l5.2-5.2a3.2 3.2 0 0 0-4.5-4.5L4 7.8'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'><path d='M9.2 4.8 4.6 9.4a2.4 2.4 0 0 0 3.4 3.4l5.2-5.2a3.2 3.2 0 0 0-4.5-4.5L4 7.8'/></svg>");
}

.task-card-chip:hover {
  background: #f3f4f6;
}

.task-card-chip.is-open,
.task-card-chip[aria-expanded="true"] {
  border-color: var(--mh2-primary-light);
  background: rgba(44, 81, 105, 0.08);
}

.task-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.task-card-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: #eef1f4;
  color: var(--mh2-text);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.task-card-summary-item .task-card-avatars {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}

.task-card-summary-item .task-card-avatar {
  width: 16px;
  height: 16px;
  font-size: 0.55rem;
}

.task-card-summary:empty,
.task-card-summary.hidden {
  display: none;
}

.task-card-summary-item:hover {
  background: #e4e9ee;
}

.task-card-summary-item .task-label-chips,
.task-card-summary-item .task-label-chips {
  margin: 0;
}

.task-card-summary-k {
  font-weight: 600;
  color: var(--mh2-text-muted);
}

.task-card-popover-host {
  position: relative;
  z-index: 6;
}

.task-card-popover {
  position: fixed;
  z-index: 130;
  min-width: 260px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--mh2-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.task-card-popover > label:first-child,
.task-card-popover > .task-card-popover-label:first-child {
  margin-top: 0;
}

.task-card-popover-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--mh2-text-muted);
}

.task-card-popover p {
  margin: 0;
  font-size: 0.8rem;
}

.task-card-section-label,
.task-card-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--mh2-text);
}

.task-card-section-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.task-card-desc-block {
  margin: 4px 0 12px;
}

.task-modal-content .task-card-desc-input,
.task-card-desc-input {
  min-height: 96px;
  height: auto;
  padding: 10px 12px;
  background: #f4f5f7;
  border: 1px solid transparent;
  resize: vertical;
}

.task-card-desc-input:focus {
  background: #fff;
  border-color: var(--mh2-primary-light);
  outline: none;
}

.task-card-main .task-modal-actions {
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
  padding-top: 12px;
}

.task-card-field .task-card-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  overflow: visible;
  white-space: normal;
  text-overflow: unset;
}

.task-card-field .task-card-avatar {
  width: 16px;
  height: 16px;
  font-size: 0.55rem;
}

.task-extras-section {
  margin: 4px 0 14px;
}

@media (max-width: 900px) {
  .task-modal-content.card.task-card-modal {
    width: min(920px, calc(100vw - 16px));
  }

  .task-card-main {
    padding: 12px 16px 20px;
  }

  .task-card-side {
    flex: 0 1 240px;
    width: 240px;
    min-width: 200px;
    padding: 12px 12px 14px;
  }
}

@media (max-width: 520px) {
  .task-card-shell {
    flex-direction: column;
    max-height: calc(100vh - 24px);
  }

  .task-card-main {
    flex: 1 1 auto;
    max-height: none;
  }

  .task-card-side {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    max-height: min(36vh, 280px);
    border-left: 0;
    border-top: 1px solid var(--mh2-border);
  }
}

.task-modal-form-dense {
  max-width: 560px;
}

.task-modal-form-dense > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.task-modal-content.task-modal-edit-wrapper.task-modal-form-dense {
  max-width: 820px;
}

.task-modal-field-row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: center;
  margin: 0.45rem 0;
}

.task-modal-field-row-top {
  align-items: start;
}

.task-modal-form-dense .task-modal-field-row > label,
.task-modal-form-dense .task-modal-field-row > .task-modal-content-label {
  display: block;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mh2-text-muted, #5b6b7a);
  line-height: 1.2;
}

.task-modal-form-dense > label,
.task-modal-form-dense .task-modal-edit-main > label {
  margin: 0.55rem 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mh2-text-muted, #5b6b7a);
}

.task-modal-form-dense > label:first-of-type,
.task-modal-form-dense .task-modal-edit-main > label:first-of-type {
  margin-top: 0.35rem;
}

.task-modal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
}

.task-modal-two-col .task-modal-field-row {
  grid-template-columns: 5.5rem minmax(0, 1fr);
}

.task-modal-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.task-prereq-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.task-modal-form-dense input[type="text"],
.task-modal-form-dense input[type="date"],
.task-modal-form-dense select,
.task-modal-form-dense textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 1.85rem;
  height: 1.85rem;
  padding: 0.2rem 0.5rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--mh2-text);
}

.task-modal-form-dense select {
  /* Native selects clip easily at tight heights; keep text centered and readable. */
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.85rem;
}

.task-modal-form-dense textarea {
  height: auto;
  min-height: 4.5rem;
  padding: 0.3rem 0.5rem;
  resize: vertical;
  line-height: 1.35;
}

.task-modal-form-dense .task-assignee-picker-toggle {
  min-height: 1.85rem;
  height: 1.85rem;
  padding: 0.2rem 0.5rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--mh2-text);
}

.task-modal-form-dense .task-assignee-picker-toggle::after {
  font-size: 0.7rem;
}

.task-modal-form-dense .task-modal-actions {
  margin-top: 0.85rem;
}

.task-modal-content label,
.task-modal-content .task-modal-content-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 12px 0 4px 0;
  color: var(--mh2-text);
}

.task-modal-content input[type="text"],
.task-modal-content input[type="date"],
.task-modal-content select,
.task-modal-content textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9375rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
}

.task-assignee-picker {
  position: relative;
  width: 100%;
  z-index: 2;
}

.task-assignee-picker-toggle {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  color: var(--mh2-text);
  cursor: pointer;
}

.task-assignee-picker-toggle::after {
  content: "?";
  flex-shrink: 0;
  opacity: 0.7;
  font-size: 0.8rem;
}

.task-assignee-picker-toggle-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-assignee-picker-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: min(14rem, 40vh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.task-assignee-picker-menu.task-assignee-picker-menu-up {
  top: auto;
  bottom: calc(100% + 4px);
}

.task-assignee-picker-menu.hidden {
  display: none;
}

.task-modal-content .task-assignee-picker-row,
.task-assignee-picker-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.25;
  color: var(--mh2-text);
}

.task-modal-content .task-assignee-picker-row:hover,
.task-assignee-picker-row:hover {
  background: rgba(44, 81, 105, 0.06);
}

.task-modal-content .task-assignee-picker-row input[type="checkbox"],
.task-assignee-picker-row input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  vertical-align: middle;
}

.task-modal-content .task-assignee-picker-row span.task-assignee-picker-name,
.task-assignee-picker-row .task-assignee-picker-name {
  line-height: 1.25;
  word-break: break-all;
  min-width: 0;
}

.task-assignee-picker-row .task-card-avatar {
  width: 22px;
  height: 22px;
  font-size: 0.6rem;
  flex-shrink: 0;
}

.task-assignee-picker-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--mh2-text-muted, #666);
}

.task-modal-content textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 40vh;
}

.task-modal-content.task-modal-form-dense textarea {
  min-height: 4.5rem;
}

.task-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.task-modal-actions .btn:last-of-type {
  margin-left: auto;
}

.task-delete-btn {
  color: var(--mh2-error);
}

.task-delete-btn:hover {
  background: rgba(185, 28, 28, 0.08);
  color: var(--mh2-error);
}

.task-modal-edit-body {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 0.35rem;
}

.task-modal-edit-main {
  flex: 1;
  min-width: 0;
}

.task-modal-edit-comments {
  border-left: 1px solid var(--mh2-border);
  margin-left: 20px;
  padding-left: 20px;
  min-width: 220px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
}

@media (max-width: 640px), (max-height: 720px) {
  .task-modal {
    padding: 12px;
  }

  .task-modal-content {
    max-height: calc(100vh - 24px);
  }

  .task-modal-two-col {
    grid-template-columns: 1fr;
  }

  .task-modal-field-row {
    grid-template-columns: 5rem minmax(0, 1fr);
  }

  .task-modal-edit-body {
    flex-direction: column;
  }

  .task-modal-edit-comments {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--mh2-border);
    min-width: 0;
    max-width: none;
  }
}

.task-modal-comments-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--mh2-text);
}

.task-modal-comments-list {
  overflow-y: auto;
  max-height: 240px;
  flex: 1;
  min-height: 80px;
}

.task-comment {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
  font-size: 0.8rem;
}

.task-comment-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.task-comment:last-child {
  margin-bottom: 0;
}

.task-comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  color: var(--mh2-text-muted);
  font-size: 0.7rem;
}

.task-comment-author {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--mh2-text);
}

.task-comment-time {
  font-size: 0.7rem;
  color: var(--mh2-text-muted);
}

.task-comment-body {
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--mh2-border);
  border-radius: 8px;
  word-break: break-word;
  color: var(--mh2-text);
}

.task-checklist-header-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.65;
}

.task-checklist-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.task-checklist-pct {
  flex-shrink: 0;
  width: 2.2rem;
  font-size: 0.72rem;
  color: var(--mh2-text-muted);
}

.task-comment-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-card-summary {
  align-items: flex-start;
  gap: 16px;
}

.task-modal-add-comment {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-shrink: 0;
}

.task-modal-add-comment .task-comment-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
}

.task-modal-add-comment .task-comment-input:focus {
  outline: none;
  border-color: var(--mh2-primary-light);
}

.task-modal-add-comment .task-comment-submit {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 0.875rem;
}

.task-comment-compose {
  position: relative;
  flex: 1;
  min-width: 0;
}

.task-mention-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  z-index: 20;
}

.task-mention-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  font-size: 0.8rem;
  cursor: pointer;
}

.task-mention-option:hover,
.task-mention-option.active {
  background: rgba(44, 81, 105, 0.08);
}

.task-comment-mention {
  color: var(--mh2-primary);
  font-weight: 600;
}

.task-card-badges {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--mh2-text-muted);
}

.task-card-badge {
  white-space: nowrap;
}

.task-card-extras {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.task-extras-heading-row,
.task-extras-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.task-extras-heading-actions,
.task-extras-heading-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.task-checklist {
  border: 0;
  padding: 0 0 4px;
  margin: 0 0 18px;
}

.task-checklist-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.task-checklist-header-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.65;
}

.task-checklist-header-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.65;
}

.task-checklist-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.task-checklist-pct {
  flex-shrink: 0;
  width: 2.2rem;
  font-size: 0.72rem;
  color: var(--mh2-text-muted);
}

.task-checklist-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 4px;
}

.task-checklist-name:focus {
  border-color: var(--mh2-primary-light);
  outline: none;
  background: #fff;
}

.task-checklist-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.task-checklist-pct {
  flex-shrink: 0;
  width: 2.2rem;
  font-size: 0.72rem;
  color: var(--mh2-text-muted);
}

.task-checklist-progress {
  flex: 1;
  height: 8px;
  background: rgba(44, 81, 105, 0.12);
  border-radius: 99px;
  overflow: hidden;
  margin: 0;
}

.task-checklist-progress-bar {
  height: 100%;
  background: var(--mh2-primary);
  width: 0;
}

.task-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 4px 6px;
  border-radius: 6px;
}

.task-checklist-item:hover {
  background: #f4f5f7;
}

.task-modal-content .task-checklist-item input[type="checkbox"],
.task-checklist-item input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
  width: auto;
  align-self: center;
}

.task-modal-content .task-checklist-item-name,
.task-checklist-item-name {
  flex: 1;
  width: auto;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.875rem;
  padding: 2px 4px;
}

.task-modal-content .task-checklist-item-name:focus,
.task-checklist-item-name:focus {
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
}

.task-modal-content .task-checklist-name,
.task-checklist-name {
  flex: 1;
  width: auto;
  min-width: 0;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 2px 4px;
}

.task-modal-content .task-checklist-name:focus,
.task-checklist-name:focus {
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
}

.task-checklist-item.is-complete .task-checklist-item-name {
  text-decoration: line-through;
  color: var(--mh2-text-muted);
}

.task-checklist-add-toggle {
  display: inline-flex;
  margin: 6px 0 0 24px;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: #e8eaed;
  color: var(--mh2-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.task-checklist-add-toggle:hover {
  background: #dfe1e4;
}

.task-checklist-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0 24px;
}

.task-checklist-add-item-btn {
  flex-shrink: 0;
}

.task-modal-content .task-checklist input[type="text"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 2px 0;
  border: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--mh2-text);
}

.task-modal-content .task-checklist input[type="text"]:focus {
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
}

.task-modal-content .task-checklist-name {
  font-weight: 700;
}

.task-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-attachment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.task-attachment-row a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-attach-link-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto;
  gap: 6px;
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .task-attach-link-form {
    grid-template-columns: 1fr;
  }
}

/* News page */
.news-intro-card h1 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--mh2-primary-dark);
}

.news-intro-card .tagline {
  margin: 0 0 16px 0;
}

.news-feed-card h2,
.news-sources-card h2 {
  margin: 0 0 12px 0;
  font-size: 1.15rem;
  color: var(--mh2-primary-dark);
}

.news-placeholder {
  margin: 0;
  color: var(--mh2-primary);
  font-size: 0.95rem;
}

.news-feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-feed-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--mh2-border);
}

.news-feed-list li:last-child {
  border-bottom: none;
}

.news-feed-list a {
  color: var(--mh2-primary);
  font-weight: 500;
  text-decoration: none;
}

.news-feed-list a:hover {
  text-decoration: underline;
}

.news-feed-list .news-item-meta {
  font-size: 0.875rem;
  color: var(--mh2-text-muted);
  margin-top: 4px;
  display: block;
}

.news-item-snippet {
  font-size: 0.9rem;
  color: var(--mh2-text);
  margin: 6px 0 4px 0;
  line-height: 1.4;
}

.news-summarize-btn {
  margin-top: 8px;
  font-size: 0.875rem;
}

.news-findings {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--mh2-bg-subtle, #f5f5f5);
  border-radius: 6px;
  font-size: 0.9rem;
}

.news-findings-title {
  margin: 0 0 6px 0;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.news-findings-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--mh2-text);
  line-height: 1.45;
}

.news-findings-list li {
  padding: 2px 0;
  border-bottom: none;
}

#news-feed-meta {
  margin: 12px 0 0 0;
  font-size: 0.85rem;
  color: var(--mh2-text-muted);
}

.news-sources-list {
  margin: 12px 0;
  padding-left: 24px;
}

.news-sources-list li {
  margin-bottom: 8px;
}

.news-sources-note {
  margin: 16px 0 0 0;
  font-size: 0.9rem;
  color: var(--mh2-primary);
}

.news-subhead {
  margin: 20px 0 10px 0;
  font-size: 1.05rem;
  color: var(--mh2-primary-dark);
}

.news-category-label {
  margin: 14px 0 6px 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--mh2-primary);
}

.news-sources-card .news-sources-list a {
  color: var(--mh2-primary);
  font-weight: 500;
  text-decoration: none;
}

.news-sources-card .news-sources-list a:hover {
  text-decoration: underline;
}

.news-sources-card code {
  font-size: 0.85rem;
  background: rgba(44, 81, 105, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* CRM � full-width canvas; brand tokens align with :root */
#page-crm.crm-stitch {
  --crm-brand: var(--mh2-primary);
  --crm-brand-dark: var(--mh2-primary-dark);
  --crm-brand-dim: rgba(44, 81, 105, 0.12);
  --crm-canvas: #f9f9f9;
  --crm-surface: #ffffff;
  --crm-text: #000000;
  --crm-text-muted: #5f5f5f;
  --crm-border: #e2e2e2;
  --crm-border-light: #eeeeee;
  background: var(--crm-canvas);
  margin: -24px -32px 0;
  padding: 24px 32px 32px;
  min-height: calc(100% + 24px);
}

#page-crm.crm-stitch .page-title {
  color: var(--crm-text);
  letter-spacing: -0.02em;
  margin-bottom: 0;
}

#page-crm.crm-stitch .muted {
  color: var(--crm-text-muted);
}

#page-crm.crm-stitch .btn-primary {
  background: var(--crm-brand);
  color: #fff;
}

#page-crm.crm-stitch .btn-primary:hover {
  background: var(--crm-brand-dark);
}

#page-crm.crm-stitch .btn-ghost {
  color: var(--crm-brand);
}

#page-crm.crm-stitch .btn-ghost:hover {
  background: var(--crm-brand-dim);
  color: var(--crm-brand-dark);
}

#page-crm.crm-stitch .btn-sm.btn-primary {
  background: var(--crm-brand);
}

#page-crm.crm-stitch .card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#page-crm.crm-stitch .data-table {
  border-collapse: collapse;
}

#page-crm.crm-stitch .data-table thead th {
  background: #f3f3f3;
  color: var(--crm-text);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--crm-border);
}

#page-crm.crm-stitch .data-table tbody td {
  border-bottom: 1px solid var(--crm-border-light);
  color: var(--crm-text);
}

#page-crm.crm-stitch .crm-search-input {
  border: 1px solid var(--crm-border);
  background: var(--crm-surface);
  color: var(--crm-text);
}

#page-crm.crm-stitch .crm-search-input:focus {
  outline: none;
  border-color: var(--crm-brand);
  box-shadow: 0 0 0 2px var(--crm-brand-dim);
}

#page-crm.crm-stitch .crm-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#page-crm.crm-stitch .crm-search-row .crm-search-input {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: none;
}

#page-crm.crm-stitch .crm-list-filter-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.5rem;
  color: var(--crm-text-muted);
  border: 1px solid var(--crm-border);
  border-radius: 6px;
  background: var(--crm-surface);
}

#page-crm.crm-stitch .crm-list-filter-btn:hover {
  color: var(--crm-text);
  border-color: var(--crm-brand);
  background: var(--crm-surface);
}

#page-crm.crm-stitch .crm-list-filter-btn--active {
  color: var(--crm-brand);
  border-color: var(--crm-brand);
  background: color-mix(in srgb, var(--crm-brand) 12%, var(--crm-surface));
}

#page-crm.crm-stitch .crm-list-filter-btn-icon {
  display: block;
  opacity: 0.9;
}

.crm-list-filter-modal-content {
  max-width: 26rem;
  width: min(100%, 26rem);
}

.crm-list-filter-modal-body {
  max-height: min(70vh, 32rem);
  overflow-y: auto;
}

.crm-list-filter-tags-field {
  margin-top: 0.5rem;
}

.crm-list-filter-tags-label {
  display: block;
  font-size: 0.875rem;
  color: var(--mh2-text-muted);
  margin-bottom: 0.35rem;
}

.crm-list-filter-tags-box {
  max-height: 14rem;
  overflow: auto;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  background: var(--mh2-surface);
  font-size: 0.875rem;
}

.crm-list-filter-tag-cat {
  margin-bottom: 0.2rem;
}

.crm-list-filter-tag-cat:last-child {
  margin-bottom: 0;
}

.crm-list-filter-tag-cat-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mh2-text-muted);
  margin-bottom: 0.1rem;
}

.crm-list-filter-tag-cat-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.crm-list-filter-tag-item {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  line-height: 1.35;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

.crm-list-filter-tag-item input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.crm-modal-actions-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#page-crm.crm-stitch .crm-list-tags-td {
  min-width: 6rem;
  max-width: 16rem;
}

#page-crm.crm-stitch .crm-list-tag-cell-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.35rem;
  align-items: center;
}

#page-crm.crm-stitch .crm-list-tags-td .crm-tag-chip {
  max-width: 100%;
}

#page-crm.crm-stitch .crm-detail-box {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
}

#page-crm.crm-stitch .crm-detail-box-title {
  color: var(--crm-text-muted);
}

#page-crm.crm-stitch .crm-detail-textarea {
  border-color: var(--crm-border);
  background: var(--crm-surface);
  color: var(--crm-text);
}

#page-crm.crm-stitch .crm-detail-textarea:focus {
  outline: none;
  border-color: var(--crm-brand);
  box-shadow: 0 0 0 2px var(--crm-brand-dim);
}

#page-crm.crm-stitch .crm-task-detail-form .crm-detail-input,
#page-crm.crm-stitch .crm-task-detail-form select,
#page-crm.crm-stitch .crm-task-detail-form input[type="date"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--crm-border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  background: var(--crm-surface);
  color: var(--crm-text);
}

#page-crm.crm-stitch .crm-task-detail-form label {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--crm-text-muted);
}

#page-crm.crm-stitch .crm-task-detail-form .crm-detail-box-title {
  margin-top: 0;
}

#page-crm.crm-stitch .crm-task-detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

#page-crm.crm-stitch .crm-task-detail-readonly .crm-activity-detail-meta {
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

#page-crm.crm-stitch .crm-task-detail-readonly .crm-activity-detail-body {
  margin-top: 0;
  white-space: pre-wrap;
}

#page-crm.crm-stitch .crm-task-readonly-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
}

#page-crm.crm-stitch .crm-task-no-desc {
  margin: 0.35rem 0 0 0;
}

#page-crm.crm-stitch .crm-modal-content input,
#page-crm.crm-stitch .crm-modal-content textarea,
#page-crm.crm-stitch .crm-modal-content select {
  border-color: var(--crm-border);
}

@media (max-width: 640px) {
  #page-crm.crm-stitch {
    margin: -16px -16px 0;
    padding: 16px 16px 24px;
  }
}

/* CRM shell: column layout so list/detail stacks can shrink and scroll internally. */
#page-crm.crm-stitch.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

#crm-content:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#page-crm.crm-stitch > .crm-page-header,
#page-crm.crm-stitch > #crm-db-unavailable {
  flex-shrink: 0;
}

#page-crm.crm-stitch #crm-list-stack {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden) {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Reporting and other non-table views: scroll the whole panel (table views scroll inside .crm-table-scroll). */
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)) {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Reporting tab: always scroll the full panel (nested mini-tables, not a single list scroll). */
#page-crm.crm-stitch #crm-view-reporting.crm-view-panel:not(.hidden) {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#page-crm.crm-stitch #crm-view-reporting:not(.hidden) .crm-reporting-tables {
  padding-bottom: 0.5rem;
}

#page-crm.crm-stitch #crm-list-stack .crm-contacts-list {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}

/* Actions tab: table scroll is a direct child of the view panel (no .crm-contacts-list wrapper). */
#page-crm.crm-stitch #crm-view-actions.crm-view-panel:not(.hidden) > .crm-table-scroll,
#page-crm.crm-stitch #crm-view-actions.crm-view-panel:not(.hidden) > .crm-actions-table-scroll {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#page-crm.crm-stitch #crm-list-stack .crm-search-row {
  flex-shrink: 0;
}

#page-crm.crm-stitch #crm-list-stack .crm-view-panel.card {
  margin-bottom: 0;
}

/* Detail viewport: fluid width, mostly vertical scroll; inner content may scroll horizontally if needed. */
#crm-detail-stack {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#crm-detail-stack > .crm-detail-shell {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.crm-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.record-audit-page-header {
  align-items: flex-start;
  gap: 1rem;
}

.record-audit-intro {
  max-width: 52rem;
  margin: 0.35rem 0 0;
}

.record-audit-subheading {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.record-audit-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.record-audit-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

.record-audit-sort-ind {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.2em;
}

.provider-retention-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.provider-retention-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

.provider-retention-sort-ind {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.2em;
}

.provider-retention-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-width: 100%;
  max-height: clamp(260px, 52vh, 620px);
  -webkit-overflow-scrolling: touch;
}

#page-provider-retention .provider-retention-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#page-provider-retention .provider-retention-table th,
#page-provider-retention .provider-retention-table td {
  white-space: nowrap;
}

#page-provider-retention .provider-retention-table th.provider-retention-sortable-th {
  white-space: normal;
  line-height: 1.3;
  vertical-align: bottom;
  hyphens: auto;
}

#page-provider-retention #provider-retention-summary-table th.col-provider,
#page-provider-retention #provider-retention-summary-table tbody th[scope="row"] {
  min-width: 9rem;
  max-width: 14rem;
  white-space: normal;
}

#page-provider-retention #provider-retention-summary-table th.num {
  min-width: 6.5rem;
}

#page-provider-retention #provider-retention-table th:first-child {
  min-width: 9rem;
}

#page-provider-retention #provider-retention-table th.num {
  min-width: 7.5rem;
}

#page-provider-retention #provider-retention-summary-table thead th,
#page-provider-retention #provider-retention-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

.case-loads-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.case-loads-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

.case-loads-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.case-loads-subtitle {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.case-loads-filters label {
  font-size: 0.9rem;
  color: var(--mh2-text);
}

.case-loads-filters select {
  min-width: 11rem;
  max-width: 14rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mh2-border);
  border-radius: 6px;
  background: var(--mh2-surface);
}

.case-loads-table-card {
  min-height: 0;
}

.case-loads-scroll {
  max-height: clamp(260px, 52vh, 620px);
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.follow-up-appt-period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.75rem;
}

.follow-up-appt-summary-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.follow-up-appt-summary-corner {
  min-width: 4.25rem;
}

.group-attendance-scroll {
  max-height: clamp(260px, 52vh, 620px);
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#monthly-plan-audit-table tbody tr.monthly-plan-audit-needs-pay {
  background: rgba(220, 80, 60, 0.08);
}

/* Superbill */
.superbill-table-scroll {
  overflow: auto;
  max-width: 100%;
  max-height: min(32rem, 65vh);
  -webkit-overflow-scrolling: touch;
}

#superbill-cpt-map-table-wrap.superbill-table-scroll {
  max-height: min(26rem, 55vh);
}

.superbill-table-scroll .data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.superbill-table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
  vertical-align: bottom;
}

#superbill-table {
  min-width: max(100%, 64rem);
}

#superbill-table tbody tr.superbill-row-flagged {
  background: rgba(220, 140, 40, 0.12);
}

#superbill-table tbody tr.superbill-row-blank-dx {
  background: rgba(200, 70, 50, 0.10);
}

#superbill-table .superbill-note-multi {
  color: #a15c00;
  font-weight: 600;
}

#superbill-table .superbill-flag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #8a4b00;
  background: rgba(220, 140, 40, 0.18);
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
}

#superbill-table .superbill-row-actions {
  white-space: nowrap;
}

#superbill-table .superbill-row-delete-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
}

#superbill-table .superbill-dx-input {
  width: 100%;
  min-width: 12rem;
  min-height: 4.25rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.35;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 0.25rem;
  resize: vertical;
  white-space: pre-wrap;
}

#superbill-table .superbill-dx-input.superbill-dx-blank {
  border-color: #b45309;
  background: rgba(220, 80, 40, 0.08);
}

.superbill-pdf-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
}

.superbill-pdf-actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.superbill-export-btns {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

#superbill-cpt-map-table {
  min-width: max(100%, 56rem);
}

#monthly-plan-audit-table {
  min-width: max(100%, 52rem);
}

#monthly-plan-audit-table thead th {
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  hyphens: none;
}

#monthly-plan-audit-table tbody td {
  white-space: nowrap;
}

#monthly-plan-audit-table .monthly-plan-audit-col-date {
  min-width: 6.75rem;
}

#monthly-plan-audit-table .monthly-plan-audit-col-days {
  min-width: 5.75rem;
  width: 1%;
}

#monthly-plan-audit-table .monthly-plan-audit-col-narrow {
  width: 1%;
  max-width: 5.5rem;
}

#monthly-plan-audit-table .monthly-plan-audit-col-mid {
  width: 1%;
  max-width: 7rem;
}

#monthly-plan-audit-filters {
  margin-bottom: 0.75rem;
}

#group-attendance-table {
  min-width: max(100%, 44rem);
  border-collapse: separate;
  border-spacing: 0;
}

#group-attendance-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

#group-attendance-table thead th.group-attendance-week-col {
  white-space: nowrap;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  font-size: 0.82rem;
  text-align: center;
}

#group-attendance-table thead th.group-attendance-group-col {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  min-width: 18rem;
  max-width: 28rem;
  white-space: nowrap;
  text-align: left;
  box-shadow:
    2px 0 0 var(--mh2-border),
    0 1px 0 var(--mh2-border);
}

#group-attendance-table tbody th.group-attendance-group-col {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 18rem;
  max-width: 28rem;
  white-space: nowrap;
  text-align: left;
  background: var(--mh2-surface);
  box-shadow: 2px 0 0 var(--mh2-border);
}

#group-attendance-table tbody td.num {
  text-align: center;
}

#group-attendance-table tr.utilization-total-row th.group-attendance-group-col,
#group-attendance-table tr.utilization-total-row td.num {
  font-weight: 600;
  border-top: 2px solid var(--mh2-primary-dark);
}

#page-group-attendance th.util-sortable-th {
  cursor: pointer;
  user-select: none;
}

#page-group-attendance th.util-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

#page-team-plans th.util-sortable-th {
  cursor: pointer;
  user-select: none;
}

#page-team-plans #team-plans-cohorts-table th.util-sortable-th {
  cursor: pointer;
  user-select: none;
}

#page-team-plans #team-plans-cohorts-table th.util-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

#page-team-plans th.util-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

#page-team-plans .util-sort-ind {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.2em;
}

#page-team-plans .team-plans-row-count {
  margin: 0 0 0.5rem;
}

#page-team-plans .team-plans-huddle-card {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem 0.6rem;
}

#page-team-plans .team-plans-huddle-header {
  margin-bottom: 0.75rem;
}

#page-team-plans .team-plans-huddle-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--mh2-primary-dark);
}

#page-team-plans .team-plans-huddle-sub {
  max-width: 60rem;
  margin: 0;
}

#page-team-plans .team-plans-huddle-rules {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
}

#page-team-plans .team-plans-huddle-rules li {
  margin-bottom: 0.15rem;
}

#team-plans-huddle-table td,
#team-plans-huddle-table th {
  vertical-align: top;
}

#team-plans-huddle-table td:last-child,
#team-plans-huddle-table th:last-child {
  min-width: 18rem;
  white-space: normal;
}

#team-plans-cohorts-table td,
#team-plans-cohorts-table th {
  vertical-align: top;
}

#page-team-plans .team-plans-cohorts-scroll {
  max-height: 28rem;
  overflow: auto;
}

#page-team-plans .team-plans-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0.25rem 0 0.75rem;
}

#page-team-plans .team-plans-cal-nav {
  padding: 0.15rem 0.6rem;
  font-size: 1.1rem;
  line-height: 1;
}

#page-team-plans .team-plans-cal-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

#page-team-plans .team-plans-cal-month-label {
  font-weight: 600;
  font-size: 1.05rem;
  min-width: 12rem;
  text-align: center;
  color: var(--mh2-primary-dark);
}

#page-team-plans .team-plans-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--mh2-border);
  border: 1px solid var(--mh2-border);
}

#page-team-plans .team-plans-cal-dow {
  background: var(--mh2-surface);
  padding: 0.4rem 0.5rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-align: center;
  color: var(--mh2-primary-dark);
}

#page-team-plans .team-plans-cal-cell {
  background: var(--mh2-surface, #fff);
  min-height: 6rem;
  padding: 0.3rem;
  vertical-align: top;
}

#page-team-plans .team-plans-cal-cell--empty {
  background: var(--mh2-bg, #f7f7f7);
}

#page-team-plans .team-plans-cal-daynum {
  font-size: 0.8rem;
  color: var(--mh2-muted, #666);
  margin-bottom: 0.25rem;
}

#page-team-plans .team-plans-cal-event {
  background: var(--mh2-accent, #2563eb);
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.72rem;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#page-team-plans .team-plans-cal-event--aurora {
  background: #0f766e;
}

#page-team-plans tr.team-plans-cohort-aurora td:first-child {
  font-weight: 600;
  color: #0f766e;
}

#team-plans-cohorts-table td:nth-child(4),
#team-plans-cohorts-table td:nth-child(5),
#team-plans-cohorts-table td:nth-child(6),
#team-plans-cohorts-table th:nth-child(4),
#team-plans-cohorts-table th:nth-child(5),
#team-plans-cohorts-table th:nth-child(6) {
  min-width: 12rem;
  white-space: normal;
}

#team-plans-cohorts-table td.team-plans-week-num-col,
#team-plans-cohorts-table th.team-plans-week-num-col {
  min-width: 5rem;
  white-space: nowrap;
  text-align: center;
}

#team-plans-cohorts-table tr.team-plans-cohort-start td {
  border-top: 2px solid var(--mh2-border);
}

#team-plans-cohorts-table .team-plans-cohort-none {
  color: var(--mh2-danger, #b91c1c);
  font-style: italic;
}

#team-plans-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

#page-group-attendance .util-sort-ind {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.2em;
}

#page-follow-up-appt th.util-sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#page-follow-up-appt th.util-sortable-th:hover {
  color: var(--mh2-accent, #2563eb);
}

#page-follow-up-appt .util-sort-ind {
  font-size: 0.75em;
  opacity: 0.85;
  margin-left: 0.2em;
}

#follow-up-appt-summary-table th,
#follow-up-appt-summary-table td {
  text-align: center;
}

#follow-up-appt-summary-table {
  width: 100%;
  max-width: 48rem;
}

#follow-up-appt-summary-table .col-provider,
#follow-up-appt-summary-table .follow-up-appt-summary-corner {
  text-align: left;
}

#case-loads-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

#case-loads-summary-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

#page-case-loads #case-loads-content > h2.case-loads-subtitle:first-of-type {
  margin-top: 0;
}

.case-loads-matrix-intro {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  max-width: 60rem;
}

.case-loads-matrix-scroll {
  max-height: min(48vh, 28rem);
}

#case-loads-matrix-table {
  min-width: max(100%, 52rem);
}

#case-loads-matrix-table thead th {
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
  font-size: 0.88rem;
  padding: 0.45rem 0.4rem;
}

/* Month columns scroll horizontally; keep z-index low so the frozen "Provider" column (higher z-index) stays on top. */
#case-loads-matrix-table thead tr:first-child th.matrix-month-h {
  position: sticky;
  top: 0;
  z-index: 1;
  vertical-align: bottom;
  text-align: center;
}

#case-loads-matrix-table thead tr:nth-child(2) th.matrix-sub-h {
  position: sticky;
  top: 2.4rem;
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.35rem 0.35rem;
}

/* Frozen first column: must stack above all horizontally scrolling month headers and body cells. */
#case-loads-matrix-table thead th.matrix-corner,
#case-loads-matrix-table thead th.matrix-provider-h {
  position: sticky;
  left: 0;
  z-index: 12;
  text-align: left;
  background: var(--mh2-surface);
  box-shadow: 2px 0 0 var(--mh2-border), 0 1px 0 var(--mh2-border);
  /* Strong edge so month headers do not show through on horizontal pan */
  background-clip: border-box;
}

#case-loads-matrix-table thead th.matrix-provider-h,
#case-loads-matrix-table thead th.matrix-corner {
  top: 0;
  width: 13rem;
  min-width: 13rem;
  max-width: 13rem;
  vertical-align: bottom;
  white-space: nowrap;
}

#case-loads-matrix-table tbody th.matrix-provider-col {
  position: sticky;
  left: 0;
  z-index: 5;
  text-align: left;
  font-weight: 500;
  width: 13rem;
  min-width: 13rem;
  max-width: 13rem;
  background: var(--mh2-surface);
  /* Below thead corner (12) but above scrolling tds (auto/0) */
  box-shadow: 2px 0 0 var(--mh2-border), 2px 0 4px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

/* Scrolling data cells: stay under frozen provider column */
#case-loads-matrix-table tbody td {
  position: relative;
  z-index: 0;
}

#case-loads-matrix-table tbody tr:hover th.matrix-provider-col,
#case-loads-matrix-table tbody tr:hover td {
  background: rgba(44, 81, 105, 0.04);
}

#case-loads-matrix-table #case-loads-matrix-tbody th.matrix-provider-col {
  background: var(--mh2-surface);
}

#case-loads-matrix-table tbody tr:hover th.matrix-provider-col {
  background: rgba(44, 81, 105, 0.06);
}

#case-loads-matrix-table .matrix-sub-h {
  min-width: 4.5rem;
}

#case-loads-matrix-table td.num {
  min-width: 3.5rem;
}

#case-loads-matrix-table th.matrix-month-sep,
#case-loads-matrix-table td.matrix-month-sep {
  border-left: 2px solid var(--mh2-border);
}

.aurora-hrs-intro {
  margin: 0.35rem 0 0;
  max-width: 52rem;
}

.aurora-hrs-meta {
  margin: 0 0 1rem;
}

.aurora-hrs-table-card {
  margin-bottom: 1.25rem;
}

.aurora-hrs-scroll {
  max-height: min(56vh, 36rem);
}

#page-aurora-hrs .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

#page-aurora-hrs .aurora-hrs-sortable-th {
  cursor: pointer;
  user-select: none;
}

#page-aurora-hrs td.num,
#page-aurora-hrs th.num {
  white-space: nowrap;
}

#page-aurora-hrs th.aurora-hrs-th-wrap {
  white-space: normal;
  line-height: 1.15;
}

.aurora-hrs-period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.75rem;
}

.aurora-hrs-appt-filters select {
  min-width: 9.5rem;
}

/* Record Audit: fixed viewport-relative height, vertical (and horizontal) scroll */
.record-audit-table-card {
  min-height: 0;
}

.record-audit-table-scroll {
  max-height: clamp(220px, 36vh, 380px);
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#record-audit-table thead th,
#record-audit-detail-table thead th,
#record-audit-outcome-summary-table thead th,
#record-audit-outcome-detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
}

.crm-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.crm-segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.25rem 0;
  min-height: 2.6rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

#page-crm.crm-stitch #crm-content .crm-segmented {
  flex-shrink: 0;
}

.crm-segment-btn {
  flex: 0 0 auto;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--mh2-border);
  background: var(--mh2-surface);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--mh2-text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.crm-segment-btn:hover {
  background: var(--mh2-bg);
}

.crm-segment-btn.active {
  background: var(--mh2-primary);
  color: #fff;
  border-color: var(--mh2-primary);
}

#page-crm.crm-stitch .crm-segment-btn {
  border-color: var(--crm-border);
  background: var(--crm-surface);
  color: var(--crm-text);
}

#page-crm.crm-stitch .crm-segment-btn:hover {
  background: #f3f3f3;
}

#page-crm.crm-stitch .crm-segment-btn.active {
  background: var(--crm-brand);
  border-color: var(--crm-brand);
  color: #fff;
}

#page-crm.crm-stitch #crm-contacts-table tbody tr:hover,
#page-crm.crm-stitch #crm-organizations-table tbody tr.crm-clickable-row:hover {
  background: rgba(44, 81, 105, 0.06);
}

.crm-view-panel.hidden {
  display: none;
}

.crm-panel-empty {
  margin: 0.75rem 0 0 0;
  padding: 0 0.25rem;
}

.crm-action-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  font-size: 0.85rem;
}

.crm-action-status label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-weight: 400;
}

button.crm-action-related-link {
  display: inline;
  max-width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--crm-brand, var(--mh2-primary, #2c5169));
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
  text-align: left;
}

button.crm-action-related-link:hover {
  color: var(--crm-brand-dark, #1a3344);
}

button.crm-action-related-link:focus-visible {
  outline: 2px solid var(--crm-brand, var(--mh2-primary, #2c5169));
  outline-offset: 2px;
}

.crm-intake-email-detail .crm-intake-email-subject {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem 0;
  color: var(--crm-text, inherit);
}

.crm-intake-body-plain {
  margin-top: 0.75rem;
  white-space: pre-wrap;
  max-height: none;
  overflow: visible;
  font-size: 0.95rem;
  line-height: 1.45;
}

.crm-intake-call-dl {
  margin: 0;
}

.crm-intake-call-dl-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.crm-intake-call-dl-row dt {
  margin: 0;
  color: var(--crm-text-muted, #666);
  font-weight: 500;
}

.crm-intake-call-dl-row dd {
  margin: 0;
}

.crm-detail-shell {
  margin-top: 0.25rem;
}

/* Fluid rhythm + layout queries: width is the detail card, not the viewport (avoids reflow while horizontally scrolling). */
/* ~20% larger banner type line than base; name remains larger than meta/type. */
#crm-contact-detail,
#crm-org-detail {
  container-type: inline-size;
  container-name: crm-detail-shell;
  --crm-banner-column-gap: clamp(0.5rem, 0.28rem + 1.15vw, 1.125rem);
  --crm-banner-row-gap: clamp(0.2rem, 0.1rem + 0.55vw, 0.45rem);
  --crm-banner-edge-gap: clamp(0.45rem, 0.28rem + 0.95vw, 0.95rem);
  --crm-banner-block-pad: clamp(0.2rem, 0.1rem + 0.45vw, 0.42rem);
  --crm-banner-icon-gap: clamp(0.22rem, 0.16rem + 0.35vw, 0.4rem);
  --crm-banner-name-size: clamp(1.26rem, 1.104rem + 0.48vw, 1.536rem);
  --crm-banner-type-size: clamp(0.936rem, 0.864rem + 0.3vw, 1.05rem);
  --crm-banner-meta-size: clamp(0.984rem, 0.912rem + 0.264vw, 1.08rem);
  --crm-banner-strip-margin: clamp(0.3rem, 0.15rem + 0.55vw, 0.5rem);
}

#crm-contact-detail {
  --crm-detail-fixed-width: 980px;
}

@supports (width: 1cqi) {
  #crm-contact-detail,
  #crm-org-detail {
    --crm-banner-column-gap: clamp(0.5rem, 0.3rem + 2.8cqi, 1.125rem);
    --crm-banner-row-gap: clamp(0.2rem, 0.1rem + 1.1cqi, 0.45rem);
    --crm-banner-edge-gap: clamp(0.45rem, 0.28rem + 2.2cqi, 0.95rem);
    --crm-banner-block-pad: clamp(0.2rem, 0.1rem + 0.85cqi, 0.42rem);
    --crm-banner-icon-gap: clamp(0.22rem, 0.16rem + 0.65cqi, 0.4rem);
    --crm-banner-name-size: clamp(1.26rem, 1.104rem + 1.08cqi, 1.536rem);
    --crm-banner-type-size: clamp(0.936rem, 0.864rem + 0.54cqi, 1.05rem);
    --crm-banner-meta-size: clamp(0.984rem, 0.912rem + 0.48cqi, 1.08rem);
    --crm-banner-strip-margin: clamp(0.3rem, 0.12rem + 1cqi, 0.5rem);
  }
}

.crm-detail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  margin-bottom: 0.2rem;
}

.crm-contact-detail-top {
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--crm-banner-edge-gap, 0.75rem);
  padding: var(--crm-banner-block-pad, 0.35rem) 0 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--mh2-border) 78%, transparent);
}

.crm-org-detail-top {
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--crm-banner-edge-gap, 0.75rem);
  padding: var(--crm-banner-block-pad, 0.35rem) 0 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--mh2-border) 78%, transparent);
}

/*
 * Contact banner: centered name row; below � type � email � phone in three equal columns.
 */
.crm-contact-banner-spread {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: var(--crm-banner-column-gap, 1rem);
}

#crm-contact-detail .crm-contact-detail-top {
  flex-wrap: nowrap;
}

.crm-contact-banner-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.crm-contact-banner-name-row {
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: var(--mh2-primary);
  text-align: center;
  width: 100%;
}

.crm-contact-banner-name-row .crm-detail-title-main {
  display: block;
  font-size: var(--crm-banner-name-size, 1.25rem);
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-contact-banner-meta-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  font-size: var(--crm-banner-meta-size, 0.88rem);
  color: var(--mh2-text);
}

.crm-contact-banner-meta-segment {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--crm-banner-icon-gap, 0.35rem);
  min-width: 0;
  flex: 1 1 0;
  text-align: center;
}

.crm-contact-banner-meta-segment:first-child .crm-contact-banner-value {
  color: var(--mh2-text-muted);
  font-weight: 500;
  font-size: var(--crm-banner-type-size, 0.84rem);
}

.crm-contact-banner-meta-segment:first-child .crm-contact-banner-value::before {
  content: "Contact Type: ";
}

.crm-contact-banner-meta-dot {
  flex: 0 0 auto;
  color: var(--mh2-text-muted);
  font-weight: 500;
  font-size: 1.1em;
  line-height: 1;
  padding: 0 0.15rem;
  user-select: none;
}

.crm-org-banner-spread {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: var(--crm-banner-column-gap, 1rem);
}

.crm-org-banner-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.crm-org-banner-name-row {
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: var(--mh2-primary);
  text-align: center;
  width: 100%;
  font-size: var(--crm-banner-name-size, 1.25rem);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-org-banner-meta-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  font-size: var(--crm-banner-meta-size, 0.88rem);
  color: var(--mh2-text);
}

.crm-org-banner-meta-segment {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--crm-banner-icon-gap, 0.35rem);
  min-width: 0;
  flex: 1 1 0;
  text-align: center;
}

.crm-org-banner-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-org-banner-meta-dot {
  flex: 0 0 auto;
  color: var(--mh2-text-muted);
  font-weight: 500;
  font-size: 1.1em;
  line-height: 1;
  padding: 0 0.15rem;
  user-select: none;
}

.crm-org-banner-icon {
  width: 1rem;
  text-align: center;
  color: var(--mh2-text-muted);
  flex: 0 0 1rem;
}


.crm-detail-title {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  color: var(--mh2-primary);
}

.crm-detail-title-main {
  display: inline;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
}

.crm-detail-title-sub {
  display: inline;
  margin-left: 0.55rem;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--mh2-text-muted);
}

.crm-detail-meta {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
}

.crm-detail-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
  min-height: 706px;
}

.crm-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  min-height: 0;
  height: 100%;
  /* Sidebar boxes have fixed heights (see below) and scroll independently when content overflows. */
}

.crm-detail-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  height: 100%;
}

/* Fixed sidebar heights � content scrolls when it overflows so the layout stays stable. */
.crm-sticky-block,
.crm-misc-block {
  flex: 0 0 auto;
  height: 260px;
  min-height: 260px;
  max-height: 260px;
  overflow: hidden;
}

.crm-tags-block {
  flex: 0 0 auto;
  height: 150px;
  min-height: 150px;
  max-height: 150px;
  overflow: hidden;
}

.crm-primary-dl {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
}

.crm-primary-dl-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.5rem;
}

.crm-primary-dl-row dt {
  margin: 0;
  color: var(--mh2-text-muted);
  font-weight: 500;
  font-size: 0.8rem;
}

.crm-primary-dl-row dd {
  margin: 0;
  word-break: break-word;
}

#crm-org-primary-edit {
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.5rem;
  min-height: 1.25rem;
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}

#crm-contact-primary-edit {
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.5rem;
  min-height: 1.25rem;
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}

#crm-contact-detail-back {
  background: var(--mh2-border);
}

#crm-org-detail-back {
  background: var(--mh2-border);
}

.crm-detail-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.crm-detail-box-header .crm-detail-box-title {
  margin: 0;
}

.crm-sticky-block {
  display: flex;
  flex-direction: column;
}

.crm-sticky-textarea {
  flex: 1 1 auto;
  min-height: 140px;
  width: 100%;
  resize: none;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-bg);
  color: var(--mh2-text);
  padding: 0.75rem;
  font: inherit;
  line-height: 1.45;
}

.crm-sticky-textarea.is-readonly {
  background: transparent;
  border-color: transparent;
  padding: 0;
  resize: none;
}

.crm-detail-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  margin-bottom: 0;
}

.crm-detail-banner-main {
  min-width: 0;
  flex: 1;
}

.crm-contact-banner-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  min-height: 1.05rem;
  max-width: 240px;
}

.crm-contact-banner-spread .crm-contact-banner-row {
  max-width: none;
}

.crm-contact-banner-icon {
  width: 1rem;
  text-align: center;
  color: var(--mh2-text-muted);
  flex: 0 0 1rem;
}

.crm-contact-banner-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Toolbar meta line: single-row ellipsis per segment (Option C). */
.crm-contact-banner-meta-line .crm-contact-banner-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Match misc-panel Edit sizing (see .crm-misc-readonly > .btn). */
#crm-contact-sticky-save,
#crm-org-sticky-save {
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.5rem;
  min-height: 1.25rem;
}

.crm-detail-banner-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.crm-detail-banner-item dt {
  margin: 0 0 0.15rem 0;
  color: var(--mh2-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.crm-detail-banner-item dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  word-break: break-word;
}

/* Org detail primary banner only: stack when the detail card is narrow (contact banner never wraps � see #crm-contact-detail rules). */
@container crm-detail-shell (max-width: 1100px) {
  .crm-detail-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .crm-detail-banner-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.crm-misc-readonly {
  position: static;
}

.crm-misc-readonly > .btn.btn-primary.btn-sm {
  position: static;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.5rem;
  min-height: 1.25rem;
}

.crm-misc-block {
  position: relative;
  padding-top: 2.25rem;
}

.crm-misc-block .crm-detail-box-title {
  margin-right: 5.5rem;
}

#crm-contact-patient-misc-edit,
#crm-contact-referrer-misc-edit,
#crm-org-misc-edit {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  z-index: 2;
}

.crm-activity-detail-inner {
  position: relative;
}

.crm-task-detail-readonly .crm-activity-detail-meta,
.crm-task-detail-readonly .crm-activity-detail-body,
.crm-task-detail-readonly .crm-task-no-desc {
  padding-right: 0;
}

.crm-misc-placeholder {
  font-size: 0.9rem;
  line-height: 1.45;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
}

.crm-misc-copy {
  margin: 0;
}

.crm-tags-placeholder {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
}

.crm-tags-block {
  position: relative;
  padding-top: 2.25rem;
}

.crm-tags-block .crm-detail-box-title {
  margin-right: 5.5rem;
}

.crm-tags-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  max-height: 108px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
}

.crm-tag-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--mh2-border);
  background: var(--mh2-surface);
  font-size: 0.78rem;
  line-height: 1.2;
  color: var(--mh2-text);
}

.crm-tag-chip-overflow {
  background: color-mix(in srgb, var(--mh2-surface) 88%, var(--mh2-border));
  color: var(--mh2-text-muted);
}

.crm-tags-actions {
  display: block;
}

.crm-tags-manage-edit {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  z-index: 2;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.28rem 0.5rem;
  min-height: 1.25rem;
}

.crm-tags-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.crm-tags-inline-row-3 {
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr) auto;
}

.crm-tags-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crm-tags-inline-row > select.crm-detail-input,
.crm-tags-inline-row > input.crm-detail-input {
  width: 100%;
}

.crm-tags-assignment-list {
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
  padding: 0.7rem 0.95rem 0.7rem 1.15rem;
  height: 320px;
  max-height: min(45vh, 420px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.crm-tags-category-block {
  margin-bottom: 0.7rem;
}

.crm-tags-category-block:last-child {
  margin-bottom: 0;
}

.crm-tags-category-title {
  margin: 0 0 0.35rem 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mh2-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-tags-checkbox-list {
  display: grid;
  gap: 0;
}

.crm-tags-checkbox-row {
  display: grid;
  grid-template-columns: 0.95rem minmax(0, 1fr);
  align-items: center;
  column-gap: 1rem;
  min-width: 0;
  margin: 0 !important;
  padding: 0;
  min-height: 1.4rem;
  line-height: 1.15;
}

.crm-tags-checkbox-row input[type="checkbox"] {
  margin: 0;
  width: 0.95rem;
  height: 0.95rem;
  justify-self: start;
  align-self: center;
}

.crm-tags-checkbox-row span {
  padding-left: 0.2rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-modal-content.crm-tags-modal-content {
  width: min(980px, calc(100vw - 2rem));
  max-width: 980px;
}

.crm-tags-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.crm-tags-modal-header h2 {
  margin: 0;
}

.crm-tags-modal-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.crm-tags-modal-section {
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-bg);
  padding: 0.8rem;
}

.crm-tags-modal-section-title {
  margin: 0 0 0.7rem 0;
  font-size: 0.92rem;
}

.crm-tags-modal-subtitle {
  margin: 1.1rem 0 0.5rem 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--mh2-border);
  font-size: 0.92rem;
  color: var(--mh2-primary-dark);
  font-weight: 600;
}

.crm-tags-assign-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.crm-misc-readonly {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--mh2-text);
}

.crm-misc-readonly .crm-primary-dl {
  margin: 0;
}

.crm-misc-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.9rem;
}

.crm-misc-form .crm-primary-dl-row {
  margin: 0;
}

.crm-misc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.crm-misc-field > span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mh2-muted, #666);
}

.crm-misc-org-select {
  font-family: var(--font);
  max-height: 10rem;
}

.crm-org-tree-col {
  width: 2.25rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.crm-org-tree-cell {
  vertical-align: middle;
  text-align: center;
  width: 2.25rem;
}

.crm-org-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--mh2-text-muted, #666);
}

.crm-org-tree-toggle:hover {
  color: var(--mh2-text);
  background: var(--mh2-bg);
}

.crm-org-tree-arrow {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.crm-org-tree-toggle.collapsed .crm-org-tree-arrow {
  transform: rotate(-90deg);
}

.crm-org-tree-spacer {
  display: inline-block;
  width: 1.25rem;
}

tr.crm-org-child-row td:nth-child(2) {
  background: color-mix(in srgb, var(--mh2-surface) 92%, var(--mh2-border) 8%);
}

.crm-org-child-name {
  display: inline-block;
  padding-left: 1.75rem;
  border-left: 3px solid color-mix(in srgb, var(--mh2-accent, var(--mh2-border)) 55%, var(--mh2-border));
  margin-left: 0.35rem;
  color: color-mix(in srgb, var(--mh2-text) 88%, var(--mh2-muted, gray));
}

.crm-activity-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  flex: 1 1 auto;
}

.crm-activity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.crm-activity-tab {
  padding: 0.45rem 1rem;
  border: 1px solid var(--mh2-border);
  background: var(--mh2-surface);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--mh2-text);
}

.crm-activity-tab:hover {
  background: var(--mh2-bg);
}

.crm-activity-tab.active {
  background: var(--mh2-primary);
  color: #fff;
  border-color: var(--mh2-primary);
}

.crm-activity-detail {
  padding: 1rem;
  flex: 0 0 60%;
  min-height: 0;
  overflow: auto;
  margin-bottom: 0;
}

.crm-activity-detail-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.crm-activity-detail-meta {
  font-size: 0.85rem;
}

.crm-activity-detail-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.45;
}

.crm-activity-table-wrap {
  flex: 1 1 40%;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
}

.crm-activity-table {
  margin: 0;
  font-size: 0.9rem;
}

.crm-activity-ai-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0.85rem 1rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  background: var(--mh2-surface);
}

.crm-activity-ai-panel.hidden {
  display: none;
}

.crm-ai-sources {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.crm-ai-sources-legend {
  padding: 0;
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mh2-text);
  width: 100%;
}

.crm-ai-source-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--mh2-text);
}

.crm-ai-hint {
  margin: 0;
  font-size: 0.82rem;
}

.crm-ai-field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mh2-text);
}

.crm-ai-prompt,
.crm-ai-summary {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--mh2-text);
  background: var(--mh2-bg);
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  resize: vertical;
}

.crm-ai-prompt {
  min-height: 4.5rem;
  max-height: 8rem;
}

.crm-ai-summary {
  flex: 1 1 auto;
  min-height: 10rem;
  overflow-y: auto;
  resize: vertical;
}

.crm-ai-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
}

.crm-ai-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
}

.crm-activity-table th,
.crm-activity-table td {
  white-space: nowrap;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  line-height: 1.2;
}

.crm-activity-table .btn.btn-sm {
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  min-height: 1.15rem;
}

.crm-activity-row-selected td {
  background: rgba(44, 81, 105, 0.1);
}

.crm-activity-empty {
  padding: 0.75rem;
  margin: 0;
}

.crm-activity-task-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.crm-activity-note-footer,
.crm-activity-task-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  flex-shrink: 0;
}

.crm-activity-hint {
  font-size: 0.8rem;
  margin: 0;
}

.crm-modal-actions-split {
  justify-content: space-between;
  align-items: center;
}

.crm-modal-actions-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.crm-activity-pre {
  margin: 0;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.crm-detail-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(260px, 1fr) minmax(180px, 220px);
  gap: 1rem;
  align-items: stretch;
  min-height: 360px;
}

@media (max-width: 1100px) {
  .crm-detail-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

.crm-detail-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.crm-detail-box {
  background: var(--mh2-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--mh2-border);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.crm-detail-box-scroll {
  flex: 1;
  max-height: 220px;
  overflow-y: auto;
}

.crm-detail-notes-main {
  flex: 1;
  min-height: 320px;
}

.crm-detail-box-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mh2-text-muted);
}

.crm-detail-subhead {
  margin: 1rem 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.crm-detail-textarea {
  width: 100%;
  min-height: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  resize: vertical;
  background: var(--mh2-surface);
}

.crm-detail-notes-field {
  min-height: 120px;
}

.crm-detail-notes-timeline {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.crm-add-note-form-inline {
  flex-direction: column;
  align-items: stretch;
}

.crm-add-note-form-inline textarea {
  width: 100%;
}

.crm-detail-db-list {
  font-size: 0.9rem;
  line-height: 1.45;
}

.crm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.crm-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.crm-tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--mh2-border);
  background: var(--mh2-surface);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--mh2-text);
}

.crm-tab:hover {
  background: var(--mh2-bg);
}

.crm-tab.active {
  background: var(--mh2-primary);
  color: #fff;
  border-color: var(--mh2-primary);
}

.crm-tab-panel {
  display: none;
}

.crm-tab-panel.active {
  display: block;
}

.crm-reporting-tables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .crm-reporting-tables {
    grid-template-columns: 1fr;
  }
}

.crm-reporting-table-card {
  margin: 0;
  min-width: 0;
  height: auto;
  display: flex;
  flex-direction: column;
}

.crm-reporting-table-title {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mh2-primary-dark, #234a61);
}

.crm-reporting-global-toolbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.25rem;
  padding: 0.75rem 1rem;
}

.crm-reporting-period-summary {
  margin: 0;
  font-size: 0.85rem;
  flex: 1 1 12rem;
}

.crm-reporting-custom-modal-content .crm-modal-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.crm-reporting-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.crm-reporting-table-toolbar .crm-reporting-table-title {
  margin: 0;
}

.crm-reporting-time-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crm-reporting-time-filter label {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.crm-reporting-time-filter select {
  min-width: 8.5rem;
}

.crm-reporting-mini-table {
  width: 100%;
  font-size: 0.9rem;
}

.crm-reporting-mini-table .crm-reporting-total-row td {
  border-top: 2px solid var(--mh2-border, rgba(35, 74, 97, 0.2));
  padding-top: 0.5rem;
}

.crm-reporting-table-card--wide {
  grid-column: 1 / -1;
}

.crm-reporting-section-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--mh2-primary-dark, #234a61);
}

.crm-reporting-deposits-summary-scroll {
  width: fit-content;
  max-width: 28rem;
  max-height: 12.5rem; /* header + ~4�5 body rows */
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 1rem;
  scrollbar-width: thin;
}

.crm-reporting-deposits-summary {
  width: 100%;
  margin-bottom: 0;
}

.crm-reporting-deposits-summary thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.crm-reporting-deposits-summary th.num,
.crm-reporting-deposits-summary td.num {
  width: 1%;
  white-space: nowrap;
  padding-left: 1.25rem;
}

.crm-reporting-deposits-scroll {
  max-height: min(50vh, 420px);
  overflow-x: auto;
  overflow-y: auto;
}

#crm-view-reporting .crm-list-count {
  margin: 0 0 0.75rem;
}

/* Patients, Referrers, Organizations, Actions, Jotforms � scroll region (fallback cap when not in Stitch flex layout). */
.crm-table-scroll {
  max-height: min(65vh, 546px);
  overflow-y: auto;
  overflow-x: auto;
}

/* Stitch CRM lists: fill remaining column height so X/Y scrollbars stay in view (fixed max-height hid the horizontal bar below the fold). */
#page-crm.crm-stitch #crm-list-stack .crm-table-scroll {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  max-height: none;
  scrollbar-gutter: auto;
}

/* CRM: scrollbars stay hidden until the scroll region is hovered or focused (keyboard). */
#page-crm.crm-stitch {
  --crm-scrollbar-thumb: rgba(0, 0, 0, 0.25);
  --crm-scrollbar-thumb-hover: rgba(0, 0, 0, 0.4);
}

#page-crm.crm-stitch .crm-table-scroll,
#page-crm.crm-stitch #crm-detail-stack,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)),
#page-crm.crm-stitch .crm-segmented,
#page-crm.crm-stitch .crm-misc-placeholder,
#page-crm.crm-stitch .crm-tags-placeholder,
#page-crm.crm-stitch .crm-tags-chip-list,
#page-crm.crm-stitch .crm-tags-assignment-list,
#page-crm.crm-stitch .crm-activity-detail,
#page-crm.crm-stitch .crm-activity-table-wrap,
#page-crm.crm-stitch .crm-detail-box-scroll,
#page-crm.crm-stitch .crm-modal-content,
#page-crm.crm-stitch .crm-list-filter-modal-body,
#page-crm.crm-stitch .crm-list-filter-tags-box,
#page-crm.crm-stitch .crm-list-tag-cell-inner,
#page-crm.crm-stitch .crm-pipeline-board {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

#page-crm.crm-stitch .crm-table-scroll:hover,
#page-crm.crm-stitch .crm-table-scroll:focus-within,
#page-crm.crm-stitch #crm-detail-stack:hover,
#page-crm.crm-stitch #crm-detail-stack:focus-within,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)):hover,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)):focus-within,
#page-crm.crm-stitch .crm-segmented:hover,
#page-crm.crm-stitch .crm-segmented:focus-within,
#page-crm.crm-stitch .crm-misc-placeholder:hover,
#page-crm.crm-stitch .crm-misc-placeholder:focus-within,
#page-crm.crm-stitch .crm-tags-placeholder:hover,
#page-crm.crm-stitch .crm-tags-placeholder:focus-within,
#page-crm.crm-stitch .crm-tags-chip-list:hover,
#page-crm.crm-stitch .crm-tags-chip-list:focus-within,
#page-crm.crm-stitch .crm-tags-assignment-list:hover,
#page-crm.crm-stitch .crm-tags-assignment-list:focus-within,
#page-crm.crm-stitch .crm-activity-detail:hover,
#page-crm.crm-stitch .crm-activity-detail:focus-within,
#page-crm.crm-stitch .crm-activity-table-wrap:hover,
#page-crm.crm-stitch .crm-activity-table-wrap:focus-within,
#page-crm.crm-stitch .crm-detail-box-scroll:hover,
#page-crm.crm-stitch .crm-detail-box-scroll:focus-within,
#page-crm.crm-stitch .crm-modal-content:hover,
#page-crm.crm-stitch .crm-modal-content:focus-within,
#page-crm.crm-stitch .crm-list-filter-modal-body:hover,
#page-crm.crm-stitch .crm-list-filter-modal-body:focus-within,
#page-crm.crm-stitch .crm-list-filter-tags-box:hover,
#page-crm.crm-stitch .crm-list-filter-tags-box:focus-within,
#page-crm.crm-stitch .crm-list-tag-cell-inner:hover,
#page-crm.crm-stitch .crm-list-tag-cell-inner:focus-within,
#page-crm.crm-stitch .crm-pipeline-board:hover,
#page-crm.crm-stitch .crm-pipeline-board:focus-within {
  scrollbar-color: var(--crm-scrollbar-thumb) transparent;
}

#page-crm.crm-stitch .crm-table-scroll::-webkit-scrollbar,
#page-crm.crm-stitch #crm-detail-stack::-webkit-scrollbar,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll))::-webkit-scrollbar,
#page-crm.crm-stitch .crm-segmented::-webkit-scrollbar,
#page-crm.crm-stitch .crm-misc-placeholder::-webkit-scrollbar,
#page-crm.crm-stitch .crm-tags-placeholder::-webkit-scrollbar,
#page-crm.crm-stitch .crm-tags-chip-list::-webkit-scrollbar,
#page-crm.crm-stitch .crm-tags-assignment-list::-webkit-scrollbar,
#page-crm.crm-stitch .crm-activity-detail::-webkit-scrollbar,
#page-crm.crm-stitch .crm-activity-table-wrap::-webkit-scrollbar,
#page-crm.crm-stitch .crm-detail-box-scroll::-webkit-scrollbar,
#page-crm.crm-stitch .crm-modal-content::-webkit-scrollbar,
#page-crm.crm-stitch .crm-list-filter-modal-body::-webkit-scrollbar,
#page-crm.crm-stitch .crm-list-filter-tags-box::-webkit-scrollbar,
#page-crm.crm-stitch .crm-list-tag-cell-inner::-webkit-scrollbar,
#page-crm.crm-stitch .crm-pipeline-board::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#page-crm.crm-stitch .crm-table-scroll::-webkit-scrollbar-track,
#page-crm.crm-stitch #crm-detail-stack::-webkit-scrollbar-track,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll))::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-segmented::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-misc-placeholder::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-tags-placeholder::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-tags-chip-list::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-tags-assignment-list::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-activity-detail::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-activity-table-wrap::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-detail-box-scroll::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-modal-content::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-list-filter-modal-body::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-list-filter-tags-box::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-list-tag-cell-inner::-webkit-scrollbar-track,
#page-crm.crm-stitch .crm-pipeline-board::-webkit-scrollbar-track {
  background: transparent;
}

#page-crm.crm-stitch .crm-table-scroll::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-detail-stack::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll))::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-segmented::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-misc-placeholder::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-placeholder::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-chip-list::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-assignment-list::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-detail::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-table-wrap::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-detail-box-scroll::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-modal-content::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-modal-body::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-tags-box::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-tag-cell-inner::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-pipeline-board::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

#page-crm.crm-stitch .crm-table-scroll:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-table-scroll:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-detail-stack:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-detail-stack:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)):hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)):focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-segmented:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-segmented:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-misc-placeholder:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-misc-placeholder:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-placeholder:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-placeholder:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-chip-list:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-chip-list:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-assignment-list:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-assignment-list:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-detail:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-detail:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-table-wrap:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-table-wrap:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-detail-box-scroll:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-detail-box-scroll:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-modal-content:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-modal-content:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-modal-body:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-modal-body:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-tags-box:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-tags-box:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-tag-cell-inner:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-tag-cell-inner:focus-within::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-pipeline-board:hover::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-pipeline-board:focus-within::-webkit-scrollbar-thumb {
  background: var(--crm-scrollbar-thumb);
}

#page-crm.crm-stitch .crm-table-scroll:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch #crm-detail-stack:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)):hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-segmented:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-misc-placeholder:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-tags-placeholder:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-tags-chip-list:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-tags-assignment-list:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-activity-detail:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-activity-table-wrap:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-detail-box-scroll:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-modal-content:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-list-filter-modal-body:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-list-filter-tags-box:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-list-tag-cell-inner:hover::-webkit-scrollbar-thumb:hover,
#page-crm.crm-stitch .crm-pipeline-board:hover::-webkit-scrollbar-thumb:hover {
  background: var(--crm-scrollbar-thumb-hover);
}

/* CRM: also reveal scrollbars while the user is actively scrolling (no hover required). */
#page-crm.crm-stitch .crm-table-scroll.scrollbar-active,
#page-crm.crm-stitch #crm-detail-stack.scrollbar-active,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)).scrollbar-active,
#page-crm.crm-stitch .crm-segmented.scrollbar-active,
#page-crm.crm-stitch .crm-misc-placeholder.scrollbar-active,
#page-crm.crm-stitch .crm-tags-placeholder.scrollbar-active,
#page-crm.crm-stitch .crm-tags-chip-list.scrollbar-active,
#page-crm.crm-stitch .crm-tags-assignment-list.scrollbar-active,
#page-crm.crm-stitch .crm-activity-detail.scrollbar-active,
#page-crm.crm-stitch .crm-activity-table-wrap.scrollbar-active,
#page-crm.crm-stitch .crm-detail-box-scroll.scrollbar-active,
#page-crm.crm-stitch .crm-modal-content.scrollbar-active,
#page-crm.crm-stitch .crm-list-filter-modal-body.scrollbar-active,
#page-crm.crm-stitch .crm-list-filter-tags-box.scrollbar-active,
#page-crm.crm-stitch .crm-list-tag-cell-inner.scrollbar-active,
#page-crm.crm-stitch .crm-pipeline-board.scrollbar-active {
  scrollbar-color: var(--crm-scrollbar-thumb) transparent;
}

#page-crm.crm-stitch .crm-table-scroll.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-detail-stack.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch #crm-list-stack > .crm-view-panel:not(.hidden):not(:has(.crm-table-scroll)).scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-segmented.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-misc-placeholder.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-placeholder.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-chip-list.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-tags-assignment-list.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-detail.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-activity-table-wrap.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-detail-box-scroll.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-modal-content.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-modal-body.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-filter-tags-box.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-list-tag-cell-inner.scrollbar-active::-webkit-scrollbar-thumb,
#page-crm.crm-stitch .crm-pipeline-board.scrollbar-active::-webkit-scrollbar-thumb {
  background: var(--crm-scrollbar-thumb);
}

.crm-table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-bg, #f3f3f3);
  box-shadow: 0 1px 0 var(--mh2-border, rgba(0, 0, 0, 0.12));
}

/* Stitch CRM list tables: sticky header styling + header cells stay on one line. */
#page-crm.crm-stitch .crm-table-scroll .data-table thead th {
  background: #f3f3f3;
  box-shadow: 0 1px 0 var(--crm-border);
  white-space: nowrap;
}

#page-crm.crm-stitch .crm-table-scroll .data-table tbody td {
  white-space: nowrap;
  vertical-align: middle;
}

/* Tags stay on one row; scroll inside the cell if there are many chips. */
#page-crm.crm-stitch .crm-table-scroll .data-table tbody td.crm-list-tags-td {
  white-space: nowrap;
}

#page-crm.crm-stitch .crm-table-scroll .data-table tbody td.crm-list-tags-td .crm-list-tag-cell-inner {
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
}

.crm-table-scroll .data-table thead th.crm-sortable-th {
  cursor: pointer;
  user-select: none;
}

.crm-table-scroll .data-table thead th .crm-sort-indicator {
  font-size: 0.85em;
  font-weight: 700;
  margin-left: 0.2em;
  opacity: 0.85;
}

.crm-search-row {
  margin-bottom: 0.75rem;
}

.crm-search-row.crm-search-row-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.crm-actions-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.crm-actions-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 12rem;
}

.crm-actions-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mh2-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-actions-filter-select {
  padding: 0.4rem 0.55rem;
  font-size: 0.92rem;
}

/* Actions list: min table width + horizontal scroll (narrow viewports); cap long text columns. */
.crm-actions-table-scroll {
  overflow-x: auto;
  overflow-y: auto;
}

#crm-actions-table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

#crm-actions-table th,
#crm-actions-table td {
  box-sizing: border-box;
}

#crm-actions-table .crm-actions-col-owner {
  width: 8.5rem;
  min-width: 8.5rem;
  max-width: 8.5rem;
  overflow: hidden;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

#crm-actions-table th:nth-child(2),
#crm-actions-table td:nth-child(2) {
  min-width: 9rem;
  max-width: 12rem;
}

#crm-actions-table th:nth-child(3),
#crm-actions-table td:nth-child(3) {
  min-width: 4.5rem;
}

#crm-actions-table .crm-actions-col-source {
  width: 6rem;
  min-width: 6rem;
  max-width: 6rem;
}

#crm-actions-table th:nth-child(5),
#crm-actions-table td:nth-child(5) {
  min-width: 6.5rem;
}

#crm-actions-table .crm-actions-col-desc {
  width: 14rem;
  min-width: 14rem;
  max-width: 14rem;
}

#crm-actions-table .crm-actions-col-status {
  width: 9.5rem;
  min-width: 9.5rem;
}

#crm-actions-table td.crm-actions-col-desc,
#crm-actions-table td.crm-actions-col-source,
#crm-actions-table td:nth-child(2) {
  overflow: hidden;
}

#crm-actions-table .crm-actions-owner-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--crm-border, var(--mh2-border, #d8dce3));
  background: var(--crm-surface, var(--mh2-surface, #fff));
}

#crm-actions-table .crm-actions-owner-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1.75rem;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    to right,
    rgb(255 255 255 / 0),
    var(--crm-surface, var(--mh2-surface, #fff)) 55%
  );
  border-radius: 0 6px 6px 0;
}

#crm-actions-table .crm-actions-owner-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.4rem;
  width: 0.65rem;
  height: 0.65rem;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2364748b' d='M2 3.5 5 7l3-3.5'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

#crm-actions-table .crm-actions-owner-select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: 0.875rem;
  line-height: 1.25;
  padding: 0.28rem 1.5rem 0.28rem 0.4rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

#crm-actions-table .crm-actions-owner-select:focus {
  outline: none;
}

#crm-actions-table .crm-actions-owner-wrap:focus-within {
  border-color: var(--crm-brand, var(--mh2-accent, #2563eb));
  box-shadow: 0 0 0 2px var(--crm-brand-dim, rgb(37 99 235 / 0.15));
}

#crm-actions-table td:nth-child(2) .crm-action-related-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

#crm-actions-table .crm-actions-desc-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

#crm-actions-table .crm-actions-source-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.crm-bulk-action-label {
  font-size: 0.9rem;
  color: var(--mh2-fg, inherit);
  margin: 0;
  white-space: nowrap;
}

.crm-bulk-action-select {
  min-width: 11rem;
  max-width: 16rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--mh2-surface, #fff);
  color: var(--mh2-fg, inherit);
}

.crm-bulk-action-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.crm-export-status {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.crm-list-count {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--mh2-muted, #5c5348);
}

#page-crm.crm-stitch .crm-list-count {
  color: var(--crm-muted, #5c5348);
}

#crm-view-contacts .crm-list-count,
#crm-view-organizations .crm-list-count {
  margin-top: 0.25rem;
}

#crm-view-actions .crm-list-count {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

#crm-view-jotforms .crm-list-count {
  margin-bottom: 0.75rem;
}

.crm-export-status--loading {
  color: var(--mh2-muted, #5c5348);
}

.crm-export-status--success {
  color: var(--mh2-accent, #2d6a4f);
}

.crm-export-status--error {
  color: #b42318;
}

.crm-table-select-th,
.crm-table-select-td {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.crm-table-select-th {
  line-height: 1;
}

.crm-list-row-checkbox,
.crm-list-select-all {
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
  vertical-align: middle;
}

.crm-search-input {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
}

.crm-pipeline-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.crm-pipeline-column {
  min-width: 260px;
  flex-shrink: 0;
  background: var(--mh2-bg);
  border-radius: var(--radius);
  padding: 0.75rem;
  border: 1px solid var(--mh2-border);
}

.crm-pipeline-stage-name {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.crm-pipeline-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.crm-pipeline-card {
  padding: 0.6rem 0.75rem;
  cursor: default;
}

.crm-pipeline-card-title {
  margin: 0 0 0.25rem 0;
  font-weight: 500;
  font-size: 0.9rem;
}

.crm-pipeline-card-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--mh2-text-muted);
}

.crm-report-summary {
  margin-bottom: 1rem;
}

.crm-leads-contacts-card {
  margin-top: 1rem;
}

.crm-report-filters-card {
  margin-top: 1rem;
}

.crm-report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.crm-report-filters label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.crm-report-filters select,
.crm-report-filters input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  min-width: 120px;
}

.crm-report-contacts-card {
  margin-top: 1rem;
}

#crm-report-contacts-table tbody tr.crm-clickable-row {
  cursor: pointer;
}

#crm-report-contacts-table tbody tr.crm-clickable-row:hover {
  background: var(--mh2-bg);
}

.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.crm-modal.hidden {
  display: none;
}

.crm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.crm-modal-content {
  position: relative;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.crm-contact-modal-content.crm-contact-modal-content {
  max-width: 720px;
}

.crm-contact-form-row {
  display: flex;
  gap: 0;
  align-items: flex-start;
  margin-top: 0.5rem;
}

.crm-contact-form-left {
  flex: 1;
  min-width: 0;
  padding-right: 0;
}

.crm-contact-form-divider {
  width: 1px;
  min-width: 1px;
  align-self: stretch;
  background: var(--mh2-border);
  margin: 0 1.25rem;
}

.crm-contact-form-divider.hidden {
  display: none;
}

.crm-contact-form-patient-details {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
  padding-left: 0;
  border-left: none;
}

.crm-contact-form-patient-details.hidden {
  display: none;
}

.crm-patient-details-title {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mh2-primary-dark);
}

.crm-modal-content label {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.crm-modal-content label .required {
  color: var(--mh2-error);
}

.crm-modal-content input,
.crm-modal-content textarea,
.crm-modal-content select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
}

.crm-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

.crm-detail-content h3 {
  margin: 1rem 0 0.5rem 0;
  font-size: 1rem;
}

.crm-detail-section {
  margin-top: 1.25rem;
}

.crm-add-note-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.5rem;
}

.crm-add-note-form textarea {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
}

.crm-note-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--mh2-border);
}

.crm-note-item:last-child {
  border-bottom: none;
}

.crm-note-meta {
  font-size: 0.8rem;
  color: var(--mh2-text-muted);
}

.crm-note-item p {
  margin: 0.25rem 0 0 0;
}

.crm-note-item .crm-note-delete {
  margin-top: 0.25rem;
}

#crm-contacts-table tbody tr,
#crm-organizations-table tbody tr.crm-clickable-row {
  cursor: pointer;
}

#crm-contacts-table tbody tr:hover,
#crm-organizations-table tbody tr.crm-clickable-row:hover {
  background: var(--mh2-bg);
}

#crm-leads-contacts-table tbody tr.crm-clickable-row {
  cursor: pointer;
}

#crm-leads-contacts-table tbody tr.crm-clickable-row:hover {
  background: var(--mh2-bg);
}

.crm-csv-field-ref {
  margin: 0 0 0.75rem 0;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  background: var(--mh2-bg);
}

.crm-csv-field-ref summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.crm-csv-field-ref-intro {
  font-size: 0.85rem;
  margin: 0.4rem 0 0.5rem 0;
}

.crm-csv-field-ref-body {
  max-height: 12rem;
  overflow: auto;
  font-size: 0.88rem;
  line-height: 1.4;
  margin-top: 0.25rem;
}

.crm-csv-field-ref-line {
  margin: 0.35rem 0;
  word-wrap: break-word;
}

.crm-csv-field-ref-line code {
  font-size: 0.9em;
  padding: 0 0.2em;
}

.muted {
  color: var(--mh2-text-muted);
  font-size: 0.9rem;
}

/* Retention: programs by patient � month */
.retention-page-header {
  align-items: flex-start;
  gap: 1rem;
}

.retention-matrix-intro {
  margin: 0;
  font-size: 0.9rem;
  max-width: 62rem;
  line-height: 1.45;
}

.retention-summary-narrow {
  max-width: 36rem;
  width: 100%;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

#retention-summary-table tr.retention-summary-total th,
#retention-summary-table tr.retention-summary-total td {
  font-weight: 600;
  border-top: 2px solid var(--mh2-border);
  padding-top: 0.5rem;
  text-align: left;
}

#retention-summary-table tr.retention-summary-total td.num {
  text-align: right;
}

.retention-detail-filters {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
}

.retention-detail-row-count {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
}

.retention-detail-no-match {
  margin: 0.5rem 0 0;
}

.retention-filter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.retention-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  flex: 1 1 0;
  min-width: 0;
}

.retention-filter-label {
  color: var(--mh2-text-muted);
  font-weight: 500;
}

.retention-filter-select {
  width: 100%;
  min-width: 0;
  max-width: 13.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--mh2-surface);
  box-sizing: border-box;
}

.retention-summary-scroll {
  max-height: clamp(140px, 28vh, 320px);
}

/* Shared form layout (Task Templates, Lab Calculations, etc.) */
.patient-sales-scenario-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
}

.patient-sales-scenario-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.patient-sales-scenario-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mh2-text-muted, #5c6b7a);
}

.patient-sales-scenario-input {
  width: 8rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}

.lab-calculations-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem 1.25rem;
}

.lab-calculations-results-dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0;
}

.lab-calculations-results-dl > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.lab-calculations-results-dl dt {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mh2-text-muted, #5c6b7a);
  margin: 0;
}

.lab-calculations-results-dl dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.lab-calculations-section-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.lab-calculations-inline-results {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mh2-border, #e2e8f0);
}

.lab-calc-cerbo-preview {
  margin-top: 0.75rem;
}

.lab-calc-json-preview {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  background: var(--mh2-surface-muted, #f4f7fa);
  border: 1px solid var(--mh2-border, #e2e8f0);
  border-radius: 6px;
  overflow-x: auto;
  max-height: 16rem;
  white-space: pre-wrap;
  word-break: break-word;
}

#lab-calc-docs-table tr.lab-calc-doc-row-selected td {
  background: rgba(45, 125, 210, 0.08);
}

.btn-sm {
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}

#retention-program-table thead th.retention-sortable-th {
  cursor: pointer;
  user-select: none;
}

#retention-program-table thead th.retention-sortable-th:hover {
  color: var(--mh2-accent);
}

.retention-matrix-scroll {
  max-height: clamp(260px, 58vh, 720px);
}

.retention-matrix-month-sep {
  box-shadow: inset 1px 0 0 var(--mh2-border);
}

#retention-program-table {
  min-width: max(100%, 44rem);
  font-size: 0.875rem;
  border-collapse: separate;
  border-spacing: 0;
}

/* Month columns: sticky on vertical scroll only (thead). z-index stays below frozen corner headers. */
#retention-program-table thead th.retention-matrix-month-h {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.45rem 0.35rem;
  white-space: nowrap;
  background: var(--mh2-surface);
  box-shadow: 0 1px 0 var(--mh2-border);
  color: var(--mh2-primary-dark);
  vertical-align: bottom;
}

/* Frozen identifier columns � thead vs tbody rules split so thead z-index isn�t overwritten (fixes cols 2�3 slipping on scroll). */
#retention-program-table thead th.retention-matrix-sticky-cell:nth-child(1) {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 20;
  min-width: 8.75rem;
  max-width: 12rem;
  text-align: left;
  white-space: nowrap;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border),
    0 1px 0 var(--mh2-border);
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  vertical-align: bottom;
}

#retention-program-table thead th.retention-matrix-sticky-cell:nth-child(2) {
  position: sticky;
  top: 0;
  left: 8.75rem;
  z-index: 20;
  min-width: 6rem;
  max-width: 9rem;
  text-align: left;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border),
    0 1px 0 var(--mh2-border);
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  vertical-align: bottom;
}

#retention-program-table thead th.retention-matrix-sticky-cell:nth-child(3) {
  position: sticky;
  top: 0;
  left: 14.75rem;
  z-index: 20;
  min-width: 6rem;
  max-width: 9rem;
  text-align: left;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border),
    0 1px 0 var(--mh2-border);
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  vertical-align: bottom;
}

#retention-program-table thead th.retention-matrix-sticky-cell:nth-child(4) {
  position: sticky;
  top: 0;
  left: 20.75rem;
  z-index: 20;
  min-width: 5.25rem;
  max-width: 6rem;
  text-align: center;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border),
    0 1px 0 var(--mh2-border);
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  vertical-align: bottom;
}

#retention-program-table tbody th.retention-matrix-sticky-cell:first-child {
  position: sticky;
  left: 0;
  z-index: 12;
  min-width: 8.75rem;
  max-width: 12rem;
  text-align: left;
  white-space: nowrap;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border);
  background: var(--mh2-surface);
}

#retention-program-table tbody td.retention-matrix-sticky-cell:nth-child(2) {
  position: sticky;
  left: 8.75rem;
  z-index: 11;
  min-width: 6rem;
  max-width: 9rem;
  text-align: left;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border);
  background: var(--mh2-surface);
}

#retention-program-table tbody td.retention-matrix-sticky-cell:nth-child(3) {
  position: sticky;
  left: 14.75rem;
  z-index: 11;
  min-width: 6rem;
  max-width: 9rem;
  text-align: left;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border);
  background: var(--mh2-surface);
}

#retention-program-table tbody td.retention-matrix-sticky-cell:nth-child(4) {
  position: sticky;
  left: 20.75rem;
  z-index: 11;
  min-width: 5.25rem;
  max-width: 6rem;
  text-align: center;
  box-shadow:
    inset 1px 0 0 var(--mh2-border),
    2px 0 0 var(--mh2-border);
  background: var(--mh2-surface);
}

#retention-program-table tbody td:nth-child(n + 5) {
  vertical-align: top;
}

#retention-program-table tbody td.retention-matrix-month-sep {
  max-width: 14rem;
  white-space: normal;
  vertical-align: top;
}

#retention-program-table tbody tr:hover > th:first-child,
#retention-program-table tbody tr:hover > td {
  background: rgba(44, 81, 105, 0.04);
}

/* Provider Availability (operations) */
.provider-availability-day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
}

.provider-availability-day-tab.active {
  font-weight: 600;
  background: rgba(44, 81, 105, 0.1);
  border-color: var(--mh2-accent, #2c5169);
}

.provider-availability-scroll {
  max-height: min(70vh, 42rem);
  overflow: auto;
}

.provider-availability-table .col-provider {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 10rem;
  background: var(--mh2-surface);
  box-shadow: 2px 0 0 var(--mh2-border);
}

.provider-availability-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--mh2-surface-raised, #f4f6f8);
  white-space: nowrap;
  font-size: 0.72rem;
  padding: 0.35rem 0.4rem;
}

.provider-availability-table thead th.col-provider {
  z-index: 4;
}

.provider-avail-slot-th {
  min-width: 4.25rem;
  text-align: center;
}

.provider-avail-cell {
  text-align: center;
  font-size: 0.72rem;
  padding: 0.3rem 0.35rem;
  text-transform: lowercase;
}

.provider-avail-cell--off {
  background: #e8eaed;
  color: #9aa3ad;
}

.provider-avail-cell--open {
  color: var(--mh2-text-muted, #5c6b7a);
}

.provider-avail-cell--booked {
  background: rgba(44, 81, 105, 0.14);
  color: var(--mh2-text, #1a2a36);
  font-weight: 500;
}

.provider-avail-cell--admin {
  background: rgba(180, 120, 40, 0.18);
  color: #5c3d10;
  font-weight: 500;
}

.retention-unscheduled-scroll {
  max-height: clamp(260px, 52vh, 620px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.retention-active-future-scroll {
  max-height: clamp(260px, 52vh, 620px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.retention-active-future-summary-card {
  width: 100%;
  max-width: 42rem;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
}

#retention-active-future-summary-table {
  width: 100%;
}

#retention-active-future-table.retention-active-future-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

#retention-active-future-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
  vertical-align: bottom;
  line-height: 1.3;
  white-space: nowrap;
}

#retention-active-future-table tbody td {
  vertical-align: top;
  padding: 0.45rem 0.5rem;
}

#retention-active-future-table .col-active-future-patient {
  min-width: 5.5rem;
  max-width: 7rem;
}

#retention-active-future-table .col-active-future-status {
  min-width: 5.5rem;
  max-width: 8rem;
}

#retention-active-future-table .col-active-future-date {
  min-width: 6rem;
  max-width: 7.5rem;
}

#retention-unscheduled-table.retention-unscheduled-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

#retention-unscheduled-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--mh2-surface);
  color: var(--mh2-primary-dark);
  box-shadow: 0 1px 0 var(--mh2-border);
  vertical-align: bottom;
  line-height: 1.3;
  white-space: normal;
}

#retention-unscheduled-table tbody td {
  vertical-align: top;
  padding: 0.45rem 0.5rem;
}

#retention-unscheduled-table .col-unsched-patient {
  min-width: 5.5rem;
  max-width: 7rem;
}

#retention-unscheduled-table .col-unsched-date {
  min-width: 6rem;
  max-width: 7.5rem;
}

#retention-unscheduled-table .col-unsched-provider {
  min-width: 8rem;
  max-width: 10rem;
}

#retention-unscheduled-table .col-unsched-appt-type {
  min-width: 8rem;
  max-width: 11rem;
}

#retention-unscheduled-table .col-unsched-programs,
#retention-unscheduled-table .col-unsched-providers,
#retention-unscheduled-table .col-unsched-outreach-owner {
  min-width: 11rem;
  max-width: 14rem;
}

.retention-unscheduled-cell-inner {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.retention-fixed-day-scroll {
  max-height: clamp(260px, 58vh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

#retention-fixed-day-table.retention-fixed-day-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

#retention-fixed-day-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--mh2-surface);
  box-shadow: inset 0 -1px 0 var(--mh2-border);
  white-space: nowrap;
}

#retention-fixed-day-table thead th[data-fixed-day-sort] {
  cursor: pointer;
  user-select: none;
}

#retention-fixed-day-table thead th[data-fixed-day-sort]:hover {
  color: var(--mh2-accent);
}

#retention-fixed-day-table tbody th,
#retention-fixed-day-table tbody td {
  min-width: 7rem;
  vertical-align: top;
}

#retention-fixed-day-table tbody th:first-child {
  min-width: 5.5rem;
}

#retention-fixed-day-table .retention-threshold-cell {
  min-width: 5rem;
  text-align: center;
  white-space: nowrap;
}

.retention-fixed-day-summary-card {
  width: 100%;
  max-width: 36rem;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
}

.retention-fixed-day-filter-card {
  width: 100%;
  max-width: 18rem;
  box-sizing: border-box;
}

#retention-fixed-day-summary-table {
  width: 100%;
}


/* ===== Merged from portal-wiki: meetings + treatment plans ===== */
/* Meeting page � rooms / recordings workflow */
.rm-meeting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.rm-cerbo-note-modal-content.crm-modal-content {
  max-width: 640px;
}

.rm-cerbo-pt-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
}

.rm-cerbo-pt-row .input {
  flex: 1;
  min-width: 0;
}

.rm-cerbo-pt-row .btn {
  flex-shrink: 0;
}

.rm-cerbo-pt-status-ok {
  color: var(--mh2-success, #1a7f4c);
}

.rm-cerbo-pt-status-err {
  color: var(--mh2-error, #c00);
}

.rm-pr-create-form {
  margin-bottom: 0.75rem;
}

.rm-pr-create-actions {
  grid-column: 1 / -1;
  margin-top: 0.85rem;
}

.rm-pr-rooms-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
}

.rm-pr-rooms-table {
  width: 100%;
  font-size: 0.9rem;
  margin: 0;
  table-layout: fixed;
}

.rm-pr-rooms-table td {
  vertical-align: middle;
  border-right: 1px solid var(--mh2-border);
}

.rm-pr-rooms-table td:last-child {
  border-right: none;
}

.rm-pr-rooms-table thead th {
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

.rm-pr-rooms-table td:nth-child(1) {
  width: 20%;
  min-width: 7.5rem;
}

.rm-pr-rooms-table td:nth-child(2) {
  width: 42%;
  min-width: 4rem;
}

.rm-pr-rooms-table td:nth-child(3) {
  width: 38%;
  min-width: 16.5rem;
  white-space: nowrap;
}

.rm-pr-rooms-table .rm-pr-link-cell {
  word-break: break-all;
  font-size: 0.82rem;
  color: var(--mh2-text-muted);
}

.rm-pr-rooms-table tr.rm-pr-room-selected td {
  background: color-mix(in srgb, var(--mh2-primary) 8%, transparent);
}

.rm-pr-room-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
}

.rm-pr-room-actions .btn {
  flex-shrink: 0;
}

.rm-btn-delete {
  color: #9b2c2c;
}

.rm-btn-delete:hover {
  color: #7f1d1d;
  background: color-mix(in srgb, #9b2c2c 10%, transparent);
}

.rm-select-upload-block {
  margin-top: 0.75rem;
  max-width: 36rem;
}

.rm-select-upload-label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.rm-pr-recordings-scroll {
  max-height: 14.5rem;
  overflow-y: auto;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
  background: var(--mh2-surface);
}

.rm-pr-recordings-table {
  width: 100%;
  font-size: 0.88rem;
  margin: 0;
  table-layout: fixed;
}

.rm-pr-recordings-table td {
  border-right: 1px solid var(--mh2-border);
  vertical-align: middle;
}

.rm-pr-recordings-table td:last-child {
  border-right: none;
}

.rm-pr-recordings-table td:nth-child(1) {
  width: 7.75rem;
  min-width: 7.75rem;
}

.rm-pr-recordings-table td:nth-child(2) {
  width: 11.5rem;
  white-space: nowrap;
}

.rm-pr-recordings-table th:nth-child(3) {
  width: auto;
  white-space: nowrap;
}

.rm-pr-recordings-table td:nth-child(3) {
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-pr-recordings-table td:nth-child(4),
.rm-pr-recordings-table th:nth-child(4) {
  width: 22rem;
  white-space: nowrap;
}

.rm-pr-recordings-table.rm-pr-recordings-table--shared td:nth-child(2) {
  width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-pr-recordings-table.rm-pr-recordings-table--shared td:nth-child(3) {
  width: 11.5rem;
  white-space: nowrap;
}

.rm-pr-recordings-table.rm-pr-recordings-table--shared td:nth-child(4) {
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-pr-recordings-table.rm-pr-recordings-table--shared td:nth-child(5),
.rm-pr-recordings-table.rm-pr-recordings-table--shared th:nth-child(5) {
  width: 11.5rem;
  white-space: nowrap;
}

.rm-pr-recordings-table thead th {
  position: sticky;
  top: 0;
  background: var(--mh2-surface);
  z-index: 1;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

.rm-pr-recordings-table tr.rm-pr-rec-selected td {
  font-weight: 600;
  background: color-mix(in srgb, var(--mh2-primary) 8%, transparent);
}

.rm-pr-rec-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
}

.rm-pr-rec-actions .btn {
  flex-shrink: 0;
}

.rm-playback-panel {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
  background: #0f1419;
}

.rm-playback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.rm-playback-title {
  margin: 0;
  color: #e8eef4;
  font-size: 0.95rem;
  font-weight: 600;
}

.rm-playback-panel .btn-ghost {
  color: #c8d0d8;
}

.rm-playback-video {
  display: block;
  width: 100%;
  max-height: min(70vh, 520px);
  background: #000;
  border-radius: 6px;
}

.rm-playback-video.rm-playback-audio-only {
  max-height: 54px;
  min-height: 54px;
}

.rm-share-grants-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 10rem;
  overflow-y: auto;
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
}

.rm-share-grants-list:empty::after {
  content: "Not shared with anyone yet.";
  display: block;
  padding: 0.6rem 0.75rem;
  color: var(--mh2-muted, #6b7280);
  font-size: 0.85rem;
}

.rm-share-grant-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--mh2-border);
  font-size: 0.88rem;
}

.rm-share-grant-row:last-child {
  border-bottom: none;
}

.rm-share-grant-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.rm-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.rm-video-tile {
  background: var(--mh2-bg);
  border: 1px solid var(--mh2-border);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.rm-video-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mh2-text-muted);
  margin-bottom: 0.35rem;
}

.rm-video-host {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rm-artifacts-list {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--mh2-text-muted);
}

.rm-artifacts-list li {
  margin: 0.2rem 0;
}

.rm-workflow-card {
  border: 1px solid var(--mh2-border);
}

.rm-workflow-card--locked {
  opacity: 0.72;
}

.rm-workflow-card--active {
  border-color: var(--mh2-primary);
  box-shadow: 0 0 0 1px rgba(44, 81, 105, 0.12);
  opacity: 1;
}

.rm-workflow-card--complete .rm-step-num {
  background: var(--mh2-primary);
  color: #fff;
}

.rm-step-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.rm-hours-note {
  max-width: 52rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--mh2-border);
  border-left: 4px solid var(--mh2-primary, #2c5169);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--mh2-primary, #2c5169) 8%, #fff);
  color: var(--mh2-text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.rm-hours-note strong {
  font-weight: 650;
}

.rm-step-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--mh2-border);
  color: var(--mh2-text);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}

.rm-step-title {
  font-size: 1rem !important;
  margin: 0 0 0.15rem;
}

.rm-step-sub {
  margin: 0;
  font-size: 0.88rem;
}

.treatment-plan-period-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.treatment-plan-period-dates > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* View Treatment Plans page */
.page-treatment-plans .page-tagline.treatment-plans-tagline {
  margin: -4px 0 20px 0;
  color: var(--mh2-text-muted);
  font-size: 0.95rem;
}

.treatment-plans-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 960px;
}

.treatment-plans-segmented {
  margin: 0 0 0.75rem;
}

.tp-contrib-due-banner {
  margin: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  max-width: 28rem;
}

.tp-action-status {
  margin: 0.65rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.tp-action-status.tp-action-status-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #6ee7b7;
}

.tp-action-status.tp-action-status-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

.tp-contribution-row.tp-contrib-locked {
  opacity: 0.55;
}

.tp-contribution-row.tp-contrib-locked input[type="checkbox"] {
  cursor: not-allowed;
}

.tp-dx-readonly {
  flex: 1;
  min-width: 10rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--mh2-text, #0f172a);
  background: var(--mh2-surface-muted, #f8fafc);
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  border-radius: 6px;
}

.treatment-plans-inline-editor {
  max-width: 52rem;
}

.treatment-plans-inline-editor .tp-plan-card {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem 1rem;
}

.treatment-plans-inline-editor .tp-plan-card-title {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--mh2-text, #0f172a);
  letter-spacing: -0.01em;
}

.treatment-plans-inline-editor .tp-plan-card-lead {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mh2-text-muted, #64748b);
  max-width: 44rem;
}

.treatment-plans-inline-editor .tp-plan-subsection-title {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mh2-text, #0f172a);
}

.treatment-plans-inline-editor .tp-plan-subsection-title-spaced {
  margin-top: 1.15rem;
}

.treatment-plans-inline-editor .tp-plan-subsection-lead {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--mh2-text-muted, #64748b);
}

.treatment-plans-inline-editor .tp-plan-card-active {
  border-left: 3px solid var(--mh2-primary, #2c5169);
}

.treatment-plans-inline-editor .tp-plan-card-maintenance {
  border-left: 3px solid var(--mh2-primary-light, #3d6a86);
  background: var(--mh2-surface-muted, #f8fafc);
}

.treatment-plans-inline-editor .tp-care-team-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.15rem;
}

.treatment-plans-patient-card {
  max-width: 52rem;
}

.treatment-plan-bg-scroll-wrap {
  max-height: 15rem;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  border-radius: 6px;
  background: var(--mh2-surface-muted, #f8fafc);
  padding: 0.5rem 0.65rem;
}

.treatment-plan-bg-scroll-wrap .treatment-plan-modal-cerbo {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

#treatment-plan-iv-picker .crm-modal-backdrop,
#treatment-plan-problem-picker .crm-modal-backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.treatment-plan-iv-picker-shell.crm-modal-content {
  overflow: hidden;
  max-width: 84rem;
  width: min(84rem, calc(100vw - 2rem));
}

.treatment-plan-problem-picker-shell.crm-modal-content {
  overflow: hidden;
  max-width: 36rem;
  width: min(36rem, calc(100vw - 2rem));
}

.treatment-plan-iv-picker-shell,
.treatment-plan-problem-picker-shell {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 52rem);
  overflow: hidden;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  box-shadow:
    0 25px 50px -12px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  background: var(--mh2-surface, #fff);
}

.treatment-plan-iv-picker-header {
  flex-shrink: 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--mh2-border-subtle, #e8ecf0);
}

.treatment-plan-iv-picker-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.treatment-plan-iv-picker-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--mh2-text, #0f172a);
}

.treatment-plan-iv-picker-subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.treatment-plan-iv-picker-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: -0.2rem -0.25rem 0 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--mh2-text-muted, #64748b);
  background: transparent;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.treatment-plan-iv-picker-close:hover {
  color: var(--mh2-text, #0f172a);
  background: var(--mh2-surface-muted, #f1f5f9);
}

.treatment-plan-iv-picker-close:focus-visible {
  outline: 2px solid var(--mh2-primary, #2563eb);
  outline-offset: 2px;
}

.treatment-plan-iv-picker-footer {
  flex-shrink: 0;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--mh2-border-subtle, #e8ecf0);
  background: var(--mh2-surface, #fff);
}

.treatment-plan-iv-picker-error {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.treatment-plan-iv-picker-freetext-label {
  display: block;
  font-size: 0.82rem;
  margin: 0.5rem 0 0.25rem;
}

.treatment-plan-iv-picker-freetext {
  margin-top: 0;
}

.treatment-plan-iv-picker-actions {
  margin-top: 0.85rem;
  justify-content: flex-end;
  gap: 0.5rem;
}

.treatment-plan-iv-picker-body-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem 0.75rem 0.5rem 0.25rem;
  background: var(--mh2-surface-muted, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  /* Hide scrollbar until hover / focus / active scroll */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.treatment-plan-iv-picker-body-scroll:hover,
.treatment-plan-iv-picker-body-scroll:focus-within,
.treatment-plan-iv-picker-body-scroll:active {
  scrollbar-color: rgba(15, 23, 42, 0.28) transparent;
}

.treatment-plan-iv-picker-body-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.treatment-plan-iv-picker-body-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.treatment-plan-iv-picker-body-scroll::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 8px;
}

.treatment-plan-iv-picker-body-scroll:hover::-webkit-scrollbar-thumb,
.treatment-plan-iv-picker-body-scroll:focus-within::-webkit-scrollbar-thumb,
.treatment-plan-iv-picker-body-scroll:active::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.28);
}

.treatment-plan-iv-picker-body-scroll:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.42);
}

.tp-iv-modal-section {
  margin-bottom: 1.25rem;
  padding: 1rem 1rem 1.05rem;
  border-radius: 10px;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  background: var(--mh2-surface, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tp-iv-modal-section:last-child {
  margin-bottom: 0;
}

.tp-iv-section-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--mh2-text, #0f172a);
}

.tp-iv-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.tp-iv-section-head .tp-iv-section-title {
  margin: 0;
}

.tp-iv-section-lead {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.tp-iv-section-note {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.tp-iv-med-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tp-iv-grid-med {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10.5rem, 14rem) auto;
  gap: 0.65rem 1rem;
  align-items: center;
}

  .tp-iv-grid-med {
    grid-template-columns: 1fr;
  }

.tp-iv-med-maintain {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.15;
  color: var(--mh2-text, #0f172a);
  white-space: nowrap;
  cursor: pointer;
}

.tp-iv-med-maintain input[type="checkbox"] {
  margin: 0;
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

.tp-iv-med-maintain input[type="checkbox"]:checked ~ .tp-iv-med-maintain-text {
  color: var(--mh2-text, #0f172a);
  font-weight: 600;
}

.tp-iv-med-label {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--mh2-text, #0f172a);
  word-break: break-word;
}

.tp-iv-grid-med select.tp-iv-med-custom-action {
  width: 100%;
  min-height: 2.25rem;
  font-size: 0.82rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  border-radius: 8px;
  background: var(--mh2-surface, #fff);
  color: var(--mh2-text, #0f172a);
}

.tp-iv-grid-med select.tp-iv-med-custom-action:focus {
  outline: none;
  border-color: var(--mh2-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tp-iv-med-custom.tp-iv-grid-med {
  padding-top: 0.35rem;
  margin-top: 0.15rem;
  border-top: 1px dashed var(--mh2-border-subtle, #e2e8f0);
}

.tp-iv-check-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tp-iv-check-row {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 0.5rem 0.65rem;
  align-items: center;
}

.tp-iv-check-row .tp-iv-check-tile {
  white-space: nowrap;
}

.tp-iv-check-row .tp-iv-pick-detail {
  margin: 0;
  width: 100%;
  min-width: 0;
}

.tp-iv-check-row .tp-iv-pick-detail:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--mh2-surface-muted, #f1f5f9);
}

.tp-iv-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.5rem 1rem;
}

.tp-iv-check-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
}

  .tp-iv-check-grid-2 {
    grid-template-columns: 1fr;
  }

.tp-iv-check-tile {
  display: grid;
  grid-template-columns: 0.95rem minmax(0, 1fr);
  align-items: center;
  column-gap: 1rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  min-height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--mh2-border-subtle, #e8ecf0);
  background: var(--mh2-surface-muted, #f8fafc);
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.25;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.tp-iv-check-tile:hover {
  border-color: var(--mh2-border, #cbd5e1);
  background: var(--mh2-surface, #fff);
}

.tp-iv-check-tile input[type="checkbox"] {
  margin: 0;
  width: 0.95rem;
  height: 0.95rem;
  justify-self: start;
  align-self: center;
  flex-shrink: 0;
}

.tp-iv-check-tile-text {
  min-width: 0;
  align-self: center;
  padding-left: 0.15rem;
}

.treatment-plans-inline-actions {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--mh2-border-subtle, #e2e8f0);
}

.tp-plan-toolbar-left,
.tp-plan-toolbar-right {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 720px) {
  .treatment-plans-inline-actions.crm-modal-actions-split {
    flex-direction: column;
    align-items: stretch;
  }

  .tp-plan-toolbar-left,
  .tp-plan-toolbar-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.tp-intervention-details {
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.5rem;
  background: var(--mh2-surface, #fff);
}

.tp-intervention-details[open] {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.tp-intervention-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.35;
  list-style: none;
}

.tp-intervention-summary::-webkit-details-marker {
  display: none;
}

.tp-intervention-summary::before {
  content: "?";
  display: inline-block;
  width: 1rem;
  font-size: 0.75rem;
  color: var(--mh2-text-muted, #64748b);
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.tp-intervention-details[open] .tp-intervention-summary::before {
  transform: rotate(90deg);
}

.tp-intervention-hint-list li {
  margin-bottom: 0.2rem;
}

.tp-iv-assign-card {
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.35rem;
  background: var(--mh2-surface, #fff);
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
}

.tp-iv-assign-grid {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.tp-iv-assign-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.86rem;
  line-height: 1.3;
  color: var(--mh2-text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-iv-assign-controls {
  display: flex;
  flex-direction: row;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.tp-iv-goal-assign {
  position: relative;
  flex: 0 0 auto;
  width: 7.5rem;
  max-width: 7.5rem;
}

.tp-iv-assign-goals-trigger {
  display: block;
  width: 100%;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-iv-assign-controls .tp-iv-assign-remove {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
}

.tp-iv-assign-goals-popover {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 15rem;
  max-width: min(22rem, 92vw);
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--mh2-border, #cbd5e1);
  background: var(--mh2-surface, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.tp-iv-assign-goals-popover.hidden {
  display: none;
}

.tp-iv-assign-goals-checklist {
  max-height: 11rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tp-iv-assign-goal-option {
  display: grid;
  grid-template-columns: 0.95rem minmax(0, 1fr);
  align-items: start;
  column-gap: 0.45rem;
  margin: 0;
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.3;
  cursor: pointer;
}

.tp-iv-assign-goal-option:hover {
  background: var(--mh2-surface-muted, #f1f5f9);
}

.tp-iv-assign-goal-option input[type="checkbox"] {
  margin: 0.15rem 0 0;
}

.tp-iv-assign-goals-empty {
  margin: 0;
  font-size: 0.8rem;
}

.tp-iv-assign-goals-done {
  align-self: flex-end;
  margin-top: 0.1rem;
}

#treatment-plan-iv-picker,
#treatment-plan-problem-picker {
  z-index: 110;
}

/* Width set again after generic .crm-modal-content (max-width: 480px) below. */
.treatment-plan-outcomes-modal-shell.crm-modal-content {
  display: flex;
  flex-direction: column;
}

.treatment-plan-outcomes-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.treatment-plan-outcomes-modal-close {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--mh2-text-muted, #666);
  padding: 0.15rem 0.35rem;
}

.treatment-plan-outcomes-modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.treatment-plan-outcomes-modal-body:hover,
.treatment-plan-outcomes-modal-body:focus-within,
.treatment-plan-outcomes-modal-body:active {
  scrollbar-color: rgba(15, 23, 42, 0.28) transparent;
}

.treatment-plan-outcomes-modal-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.treatment-plan-outcomes-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.treatment-plan-outcomes-modal-body::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 8px;
}

.treatment-plan-outcomes-modal-body:hover::-webkit-scrollbar-thumb,
.treatment-plan-outcomes-modal-body:focus-within::-webkit-scrollbar-thumb,
.treatment-plan-outcomes-modal-body:active::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.28);
}

.tp-outcomes-goal-table .tp-outcomes-goal-text {
  max-width: 36rem;
  word-break: break-word;
}

.tp-outcomes-subsection-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0.95rem 0 0.3rem;
}

.tp-outcomes-subsection-head:first-of-type {
  margin-top: 0.7rem;
}

.tp-outcomes-subsection-title {
  font-size: 0.86rem;
  margin: 0;
  flex-shrink: 0;
}

.tp-outcomes-subsection-hint {
  font-size: 0.8rem;
  margin: 0;
  flex: 1 1 14rem;
  line-height: 1.35;
}

.tp-outcomes-pb-table select.tp-outcomes-pb-trajectory {
  width: 100%;
  max-width: 16rem;
}

.tp-outcomes-goal-table select.tp-outcomes-goal-achieved {
  width: 100%;
  min-width: 4.5rem;
  max-width: 7.5rem;
}

.tp-outcomes-plan-notes-section {
  border-top: 1px solid var(--mh2-border, #e5e5e5);
  padding-top: 0.25rem;
}

.tp-outcomes-plan-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 14rem;
  overflow-y: auto;
  margin-bottom: 0.65rem;
}

.tp-outcomes-plan-note {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.35rem;
  background: var(--mh2-bg, #f7f7f7);
  border: 1px solid var(--mh2-border, #e5e5e5);
}

.tp-outcomes-plan-note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--mh2-text-muted, #666);
}

.tp-outcomes-plan-note-meta time {
  font-weight: 600;
}

.tp-outcomes-plan-note-by::before {
  content: "�";
  margin-right: 0.35rem;
}

.tp-outcomes-plan-note-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.tp-outcomes-plan-notes-compose {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-start;
}

.tp-outcomes-plan-note-input {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}

.tp-outcomes-iv-table select.tp-outcomes-iv-score {
  width: 100%;
  min-width: 4.5rem;
}

.treatment-plans-outcomes-table .btn-sm {
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
}

.tp-problem-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.treatment-plan-problem-picker-shell .tp-iv-pick-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.15rem 0 0.25rem;
}

.tp-problem-pick-table-wrap {
  /* Single scroll lives on .treatment-plan-iv-picker-body-scroll � avoid a second bar */
  overflow: visible;
  max-height: none;
}

.tp-problem-pick-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.tp-problem-pick-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--mh2-border-subtle, #e8ecf0);
  vertical-align: middle;
}

.tp-problem-pick-table thead th {
  position: sticky;
  top: 0;
  background: var(--mh2-surface, #fff);
  font-weight: 600;
  font-size: 0.78rem;
  text-align: left;
  color: var(--mh2-text-muted, #64748b);
  z-index: 1;
}

.tp-problem-pick-check {
  text-align: center;
  width: 4.25rem;
}

.tp-problem-pick-name {
  line-height: 1.3;
}

.treatment-plan-problem-picker-shell .tp-problem-pick-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  margin: 0;
  padding: 0;
}

.tp-problem-pick-other-block {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--mh2-border-subtle, #e8ecf0);
}

.tp-problem-pick-other-label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
  font-weight: 500;
}

.treatment-plan-problem-picker-shell #treatment-plan-problem-picker-other {
  width: 100%;
  box-sizing: border-box;
}

.treatment-plan-problem-picker-shell label.tp-iv-pick-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.2rem 0;
  font-weight: 400;
  font-size: 0.88rem;
  line-height: 1.3;
  width: 100%;
  cursor: pointer;
}

.treatment-plan-problem-picker-shell label.tp-iv-pick-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  align-self: center;
  border-radius: 0.2rem;
}

.treatment-plan-problem-picker-shell label.tp-problem-pick-row span {
  flex: 1 1 auto;
  min-width: 0;
}

.tp-iv-pick-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0 0.5rem;
}

.tp-iv-pick-label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.84rem;
  line-height: 1.35;
  cursor: pointer;
}

.tp-iv-pick-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.tp-iv-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
  padding: 0.2rem 0.35rem 0.2rem 0.5rem;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  border-radius: 6px;
  background: var(--mh2-surface, #fff);
  font-size: 0.8rem;
  line-height: 1.3;
}

.tp-iv-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.tp-iv-chip-remove {
  padding: 0 0.25rem !important;
  min-height: auto !important;
  line-height: 1.2;
}

.treatment-plans-filter-form {
  display: block;
}

.treatment-plans-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-end;
}

.treatment-plans-filter-field {
  flex: 0 1 200px;
  min-width: 0;
}

.treatment-plans-filter-field .treatment-input {
  max-width: 100%;
}

.treatment-plans-filter-actions {
  flex: 0 0 auto;
}

.treatment-plans-results-card .treatment-card-body {
  overflow-x: auto;
}

.treatment-plans-results .data-table {
  width: 100%;
  min-width: 640px;
}

#treatment-plans-results .treatment-plans-data-table td {
  text-align: center;
  vertical-align: middle;
}

.treatment-plans-results .muted {
  margin: 0;
}

.treatment-plan-modal-cerbo {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--mh2-border-subtle, #e2e8f0);
  border-radius: 6px;
  background: var(--mh2-surface-muted, #f8fafc);
  font-size: 0.84rem;
  line-height: 1.45;
}

.treatment-plan-modal-cerbo .treatment-plan-cerbo-section-title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mh2-text, #0f172a);
}

.treatment-plan-modal-cerbo .treatment-plan-cerbo-section-title:not(:first-child) {
  margin-top: 0.65rem;
}

.treatment-plan-modal-cerbo ul {
  margin: 0;
  padding-left: 1.1rem;
}

.treatment-plan-modal-cerbo li {
  margin-bottom: 0.3rem;
}

.treatment-plan-modal-cerbo .treatment-plan-cerbo-rx-line {
  margin: 0 0 0.35rem;
}

.crm-modal-content.treatment-plan-outcomes-modal-shell {
  width: min(78rem, calc(100vw - 2rem));
  max-width: min(78rem, calc(100vw - 2rem));
  max-height: min(90vh, 56rem);
  overflow: hidden;
}

.crm-modal-content.treatment-plan-iv-picker-shell {
  width: min(84rem, calc(100vw - 2rem));
  max-width: min(84rem, calc(100vw - 2rem));
  max-height: min(90vh, 52rem);
  overflow: hidden;
}

.crm-modal-content.treatment-plan-problem-picker-shell {
  width: min(36rem, calc(100vw - 2rem));
  max-width: min(36rem, calc(100vw - 2rem));
  max-height: min(90vh, 52rem);
  overflow: hidden;
}


/* Task Templates (Leadership) */
.task-mgmt-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9rem;
}
.task-mgmt-actions-cell {
  white-space: nowrap;
}
.task-mgmt-define-roles-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 52rem;
  margin-bottom: 0.5rem;
}
.task-mgmt-role-assign-row {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--mh2-border, #e2e8f0);
  border-radius: 6px;
  background: var(--mh2-surface, #fff);
}
.task-mgmt-role-users {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.4rem;
}
.task-mgmt-role-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
#task-mgmt-roles-modal .task-modal-content label {
  display: block;
  margin-top: 0.65rem;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}
#task-mgmt-roles-modal .task-modal-content input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}
#task-mgmt-preview-table .task-mgmt-preview-due {
  min-width: 9.5rem;
}
#task-mgmt-launch-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
#task-mgmt-step-modal .task-modal-content {
  max-width: 36rem;
}

#task-mgmt-step-modal .task-modal-content label {
  display: block;
  margin-top: 0.65rem;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}
#task-mgmt-step-modal .task-modal-content input[type="text"],
#task-mgmt-step-modal .task-modal-content input[type="number"],
#task-mgmt-step-modal .task-modal-content select,
#task-mgmt-step-modal .task-modal-content textarea {
  width: 100%;
  box-sizing: border-box;
}

/* Keto Tracker — ketones over time chart */
.keto-over-time-card .keto-ot-chart-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 56rem;
  height: 280px;
}
.keto-over-time-card #keto-ot-vital-toggles .crm-segment-btn {
  white-space: nowrap;
}

/* Ketosis Analysis multi-row header */
.keto-analysis-table {
  --keto-analysis-h1: 2.4rem;
  border-collapse: separate;
  border-spacing: 0;
}
.keto-analysis-table thead th {
  vertical-align: middle;
  white-space: normal;
  line-height: 1.25;
  font-size: 0.82rem;
  text-align: center;
  border-left: 1px solid rgba(15, 23, 42, 0.14);
  background: var(--mh2-surface, #fff);
  background-clip: padding-box;
}
.keto-analysis-table thead .keto-analysis-pid-h,
.keto-analysis-table thead .keto-analysis-pid-fill,
.keto-analysis-table tbody td:first-child {
  border-left: none;
}
.keto-analysis-table tbody td {
  text-align: center;
  border-left: 1px solid rgba(15, 23, 42, 0.14);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: middle;
  background: var(--mh2-surface, #fff);
}
/* Stronger dividers between metric groups */
.keto-analysis-table thead tr:first-child > th:nth-child(2),
.keto-analysis-table thead tr:first-child > th:nth-child(3),
.keto-analysis-table thead tr:first-child > th:nth-child(4),
.keto-analysis-table thead tr:nth-child(2) > th:nth-child(2),
.keto-analysis-table thead tr:nth-child(2) > th:nth-child(4),
.keto-analysis-table thead tr:nth-child(2) > th:nth-child(6),
.keto-analysis-table tbody td:nth-child(2),
.keto-analysis-table tbody td:nth-child(4),
.keto-analysis-table tbody td:nth-child(6) {
  border-left-color: rgba(15, 23, 42, 0.28);
  border-left-width: 2px;
}
.keto-analysis-table tbody td.num {
  text-align: center;
}
/* Sticky two-row header - row2 top is measured (--keto-analysis-h1) */
.keto-analysis-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 4;
  /* Divider under group labels only (not under Patient ID - spacer owns the shared bottom edge) */
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
}
.keto-analysis-table thead tr:first-child > th.keto-analysis-pid-h {
  z-index: 5;
  border-bottom: none;
  vertical-align: middle;
}
.keto-analysis-table thead tr:nth-child(2) th {
  position: sticky;
  top: var(--keto-analysis-h1);
  z-index: 3;
  border-bottom: none;
  /* Upward bleed seals subpixel gaps; bottom shadow is the shared header underline */
  box-shadow:
    0 -3px 0 0 var(--mh2-surface, #fff),
    0 1px 0 0 rgba(15, 23, 42, 0.14);
}
.keto-analysis-table thead tr:nth-child(2) > th.keto-analysis-pid-fill {
  z-index: 5;
  padding: 0;
  font-size: 0;
  line-height: 0;
  border-top: none;
  min-width: 0;
}
.keto-analysis-rules code {
  font-size: 0.85em;
}

/* Keto Tracker list table - sticky header */
#keto-tracker-table {
  border-collapse: separate;
  border-spacing: 0;
}
#keto-tracker-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--mh2-surface, #fff);
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
}

#page-keto-tracker th.util-sortable-th {
  cursor: pointer;
  user-select: none;
}
#page-keto-tracker th.util-sortable-th:hover {
  background: color-mix(in srgb, var(--mh2-surface, #fff) 92%, #0f172a);
}
